1 /* 2 * This file is part of the openHiTLS project. 3 * 4 * openHiTLS is licensed under the Mulan PSL v2. 5 * You can use this software according to the terms and conditions of the Mulan PSL v2. 6 * You may obtain a copy of Mulan PSL v2 at: 7 * 8 * http://license.coscl.org.cn/MulanPSL2 9 * 10 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 11 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 12 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 13 * See the Mulan PSL v2 for more details. 14 */ 15 16 #ifndef BSL_ASN1_LOCAL_H 17 #define BSL_ASN1_LOCAL_H 18 19 #include <stdint.h> 20 #include <stdlib.h> 21 #include "bsl_asn1.h" 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 #define BSL_ASN1_VAL_MAX_BIT_STRING_LEN 7 28 #define BSL_ASN1_MAX_LIST_NEST_EPTH 2 29 #define BSL_ASN1_FLAG_OPTIONAL_DEFAUL (BSL_ASN1_FLAG_OPTIONAL | BSL_ASN1_FLAG_DEFAULT) 30 31 /* Gets the mask of the class */ 32 #define BSL_ASN1_CLASS_MASK 0xC0 33 34 typedef struct _ASN1_AnyOrChoiceParam { 35 uint32_t idx; 36 void *previousAsnOrTag; 37 BSL_ASN1_DecTemplCallBack tagCb; 38 } BSL_ASN1_AnyOrChoiceParam; 39 40 typedef struct _BSL_ASN1_EncodeItem { 41 uint32_t asnOctetNum; // tag + len + content 42 BSL_ASN1_Buffer *asn; 43 uint8_t tag; 44 uint8_t depth; 45 uint8_t skip; // Whether to skip processing template item 46 uint8_t optional; 47 uint8_t lenOctetNum; // The maximum number of the length octets is 126 + 1 48 } BSL_ASN1_EncodeItem; 49 50 #ifdef __cplusplus 51 } 52 #endif 53 54 #endif // BSL_ASN1_LOCAL_H 55