diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/asn1/asn1_err.c | 498 | ||||
| -rw-r--r-- | src/lib/libcrypto/asn1/asn1_gen.c | 193 | ||||
| -rw-r--r-- | src/lib/libcrypto/asn1/asn1_lib.c | 404 | ||||
| -rw-r--r-- | src/lib/libcrypto/asn1/asn1_par.c | 351 |
4 files changed, 761 insertions, 685 deletions
diff --git a/src/lib/libcrypto/asn1/asn1_err.c b/src/lib/libcrypto/asn1/asn1_err.c index c229c4b4db..4f50423b92 100644 --- a/src/lib/libcrypto/asn1/asn1_err.c +++ b/src/lib/libcrypto/asn1/asn1_err.c | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | * are met: | 7 | * are met: |
| 8 | * | 8 | * |
| 9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. |
| 11 | * | 11 | * |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer in | 13 | * notice, this list of conditions and the following disclaimer in |
| @@ -68,264 +68,262 @@ | |||
| 68 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_ASN1,func,0) | 68 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_ASN1,func,0) |
| 69 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_ASN1,0,reason) | 69 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_ASN1,0,reason) |
| 70 | 70 | ||
| 71 | static ERR_STRING_DATA ASN1_str_functs[]= | 71 | static ERR_STRING_DATA ASN1_str_functs[] = { |
| 72 | { | 72 | {ERR_FUNC(ASN1_F_A2D_ASN1_OBJECT), "a2d_ASN1_OBJECT"}, |
| 73 | {ERR_FUNC(ASN1_F_A2D_ASN1_OBJECT), "a2d_ASN1_OBJECT"}, | 73 | {ERR_FUNC(ASN1_F_A2I_ASN1_ENUMERATED), "a2i_ASN1_ENUMERATED"}, |
| 74 | {ERR_FUNC(ASN1_F_A2I_ASN1_ENUMERATED), "a2i_ASN1_ENUMERATED"}, | 74 | {ERR_FUNC(ASN1_F_A2I_ASN1_INTEGER), "a2i_ASN1_INTEGER"}, |
| 75 | {ERR_FUNC(ASN1_F_A2I_ASN1_INTEGER), "a2i_ASN1_INTEGER"}, | 75 | {ERR_FUNC(ASN1_F_A2I_ASN1_STRING), "a2i_ASN1_STRING"}, |
| 76 | {ERR_FUNC(ASN1_F_A2I_ASN1_STRING), "a2i_ASN1_STRING"}, | 76 | {ERR_FUNC(ASN1_F_APPEND_EXP), "APPEND_EXP"}, |
| 77 | {ERR_FUNC(ASN1_F_APPEND_EXP), "APPEND_EXP"}, | 77 | {ERR_FUNC(ASN1_F_ASN1_BIT_STRING_SET_BIT), "ASN1_BIT_STRING_set_bit"}, |
| 78 | {ERR_FUNC(ASN1_F_ASN1_BIT_STRING_SET_BIT), "ASN1_BIT_STRING_set_bit"}, | 78 | {ERR_FUNC(ASN1_F_ASN1_CB), "ASN1_CB"}, |
| 79 | {ERR_FUNC(ASN1_F_ASN1_CB), "ASN1_CB"}, | 79 | {ERR_FUNC(ASN1_F_ASN1_CHECK_TLEN), "ASN1_CHECK_TLEN"}, |
| 80 | {ERR_FUNC(ASN1_F_ASN1_CHECK_TLEN), "ASN1_CHECK_TLEN"}, | 80 | {ERR_FUNC(ASN1_F_ASN1_COLLATE_PRIMITIVE), "ASN1_COLLATE_PRIMITIVE"}, |
| 81 | {ERR_FUNC(ASN1_F_ASN1_COLLATE_PRIMITIVE), "ASN1_COLLATE_PRIMITIVE"}, | 81 | {ERR_FUNC(ASN1_F_ASN1_COLLECT), "ASN1_COLLECT"}, |
| 82 | {ERR_FUNC(ASN1_F_ASN1_COLLECT), "ASN1_COLLECT"}, | 82 | {ERR_FUNC(ASN1_F_ASN1_D2I_EX_PRIMITIVE), "ASN1_D2I_EX_PRIMITIVE"}, |
| 83 | {ERR_FUNC(ASN1_F_ASN1_D2I_EX_PRIMITIVE), "ASN1_D2I_EX_PRIMITIVE"}, | 83 | {ERR_FUNC(ASN1_F_ASN1_D2I_FP), "ASN1_d2i_fp"}, |
| 84 | {ERR_FUNC(ASN1_F_ASN1_D2I_FP), "ASN1_d2i_fp"}, | 84 | {ERR_FUNC(ASN1_F_ASN1_D2I_READ_BIO), "ASN1_D2I_READ_BIO"}, |
| 85 | {ERR_FUNC(ASN1_F_ASN1_D2I_READ_BIO), "ASN1_D2I_READ_BIO"}, | 85 | {ERR_FUNC(ASN1_F_ASN1_DIGEST), "ASN1_digest"}, |
| 86 | {ERR_FUNC(ASN1_F_ASN1_DIGEST), "ASN1_digest"}, | 86 | {ERR_FUNC(ASN1_F_ASN1_DO_ADB), "ASN1_DO_ADB"}, |
| 87 | {ERR_FUNC(ASN1_F_ASN1_DO_ADB), "ASN1_DO_ADB"}, | 87 | {ERR_FUNC(ASN1_F_ASN1_DUP), "ASN1_dup"}, |
| 88 | {ERR_FUNC(ASN1_F_ASN1_DUP), "ASN1_dup"}, | 88 | {ERR_FUNC(ASN1_F_ASN1_ENUMERATED_SET), "ASN1_ENUMERATED_set"}, |
| 89 | {ERR_FUNC(ASN1_F_ASN1_ENUMERATED_SET), "ASN1_ENUMERATED_set"}, | 89 | {ERR_FUNC(ASN1_F_ASN1_ENUMERATED_TO_BN), "ASN1_ENUMERATED_to_BN"}, |
| 90 | {ERR_FUNC(ASN1_F_ASN1_ENUMERATED_TO_BN), "ASN1_ENUMERATED_to_BN"}, | 90 | {ERR_FUNC(ASN1_F_ASN1_EX_C2I), "ASN1_EX_C2I"}, |
| 91 | {ERR_FUNC(ASN1_F_ASN1_EX_C2I), "ASN1_EX_C2I"}, | 91 | {ERR_FUNC(ASN1_F_ASN1_FIND_END), "ASN1_FIND_END"}, |
| 92 | {ERR_FUNC(ASN1_F_ASN1_FIND_END), "ASN1_FIND_END"}, | 92 | {ERR_FUNC(ASN1_F_ASN1_GENERALIZEDTIME_ADJ), "ASN1_GENERALIZEDTIME_adj"}, |
| 93 | {ERR_FUNC(ASN1_F_ASN1_GENERALIZEDTIME_ADJ), "ASN1_GENERALIZEDTIME_adj"}, | 93 | {ERR_FUNC(ASN1_F_ASN1_GENERALIZEDTIME_SET), "ASN1_GENERALIZEDTIME_set"}, |
| 94 | {ERR_FUNC(ASN1_F_ASN1_GENERALIZEDTIME_SET), "ASN1_GENERALIZEDTIME_set"}, | 94 | {ERR_FUNC(ASN1_F_ASN1_GENERATE_V3), "ASN1_generate_v3"}, |
| 95 | {ERR_FUNC(ASN1_F_ASN1_GENERATE_V3), "ASN1_generate_v3"}, | 95 | {ERR_FUNC(ASN1_F_ASN1_GET_OBJECT), "ASN1_get_object"}, |
| 96 | {ERR_FUNC(ASN1_F_ASN1_GET_OBJECT), "ASN1_get_object"}, | 96 | {ERR_FUNC(ASN1_F_ASN1_HEADER_NEW), "ASN1_HEADER_NEW"}, |
| 97 | {ERR_FUNC(ASN1_F_ASN1_HEADER_NEW), "ASN1_HEADER_NEW"}, | 97 | {ERR_FUNC(ASN1_F_ASN1_I2D_BIO), "ASN1_i2d_bio"}, |
| 98 | {ERR_FUNC(ASN1_F_ASN1_I2D_BIO), "ASN1_i2d_bio"}, | 98 | {ERR_FUNC(ASN1_F_ASN1_I2D_FP), "ASN1_i2d_fp"}, |
| 99 | {ERR_FUNC(ASN1_F_ASN1_I2D_FP), "ASN1_i2d_fp"}, | 99 | {ERR_FUNC(ASN1_F_ASN1_INTEGER_SET), "ASN1_INTEGER_set"}, |
| 100 | {ERR_FUNC(ASN1_F_ASN1_INTEGER_SET), "ASN1_INTEGER_set"}, | 100 | {ERR_FUNC(ASN1_F_ASN1_INTEGER_TO_BN), "ASN1_INTEGER_to_BN"}, |
| 101 | {ERR_FUNC(ASN1_F_ASN1_INTEGER_TO_BN), "ASN1_INTEGER_to_BN"}, | 101 | {ERR_FUNC(ASN1_F_ASN1_ITEM_D2I_FP), "ASN1_item_d2i_fp"}, |
| 102 | {ERR_FUNC(ASN1_F_ASN1_ITEM_D2I_FP), "ASN1_item_d2i_fp"}, | 102 | {ERR_FUNC(ASN1_F_ASN1_ITEM_DUP), "ASN1_item_dup"}, |
| 103 | {ERR_FUNC(ASN1_F_ASN1_ITEM_DUP), "ASN1_item_dup"}, | 103 | {ERR_FUNC(ASN1_F_ASN1_ITEM_EX_COMBINE_NEW), "ASN1_ITEM_EX_COMBINE_NEW"}, |
| 104 | {ERR_FUNC(ASN1_F_ASN1_ITEM_EX_COMBINE_NEW), "ASN1_ITEM_EX_COMBINE_NEW"}, | 104 | {ERR_FUNC(ASN1_F_ASN1_ITEM_EX_D2I), "ASN1_ITEM_EX_D2I"}, |
| 105 | {ERR_FUNC(ASN1_F_ASN1_ITEM_EX_D2I), "ASN1_ITEM_EX_D2I"}, | 105 | {ERR_FUNC(ASN1_F_ASN1_ITEM_I2D_BIO), "ASN1_item_i2d_bio"}, |
| 106 | {ERR_FUNC(ASN1_F_ASN1_ITEM_I2D_BIO), "ASN1_item_i2d_bio"}, | 106 | {ERR_FUNC(ASN1_F_ASN1_ITEM_I2D_FP), "ASN1_item_i2d_fp"}, |
| 107 | {ERR_FUNC(ASN1_F_ASN1_ITEM_I2D_FP), "ASN1_item_i2d_fp"}, | 107 | {ERR_FUNC(ASN1_F_ASN1_ITEM_PACK), "ASN1_item_pack"}, |
| 108 | {ERR_FUNC(ASN1_F_ASN1_ITEM_PACK), "ASN1_item_pack"}, | 108 | {ERR_FUNC(ASN1_F_ASN1_ITEM_SIGN), "ASN1_item_sign"}, |
| 109 | {ERR_FUNC(ASN1_F_ASN1_ITEM_SIGN), "ASN1_item_sign"}, | 109 | {ERR_FUNC(ASN1_F_ASN1_ITEM_SIGN_CTX), "ASN1_item_sign_ctx"}, |
| 110 | {ERR_FUNC(ASN1_F_ASN1_ITEM_SIGN_CTX), "ASN1_item_sign_ctx"}, | 110 | {ERR_FUNC(ASN1_F_ASN1_ITEM_UNPACK), "ASN1_item_unpack"}, |
| 111 | {ERR_FUNC(ASN1_F_ASN1_ITEM_UNPACK), "ASN1_item_unpack"}, | 111 | {ERR_FUNC(ASN1_F_ASN1_ITEM_VERIFY), "ASN1_item_verify"}, |
| 112 | {ERR_FUNC(ASN1_F_ASN1_ITEM_VERIFY), "ASN1_item_verify"}, | 112 | {ERR_FUNC(ASN1_F_ASN1_MBSTRING_NCOPY), "ASN1_mbstring_ncopy"}, |
| 113 | {ERR_FUNC(ASN1_F_ASN1_MBSTRING_NCOPY), "ASN1_mbstring_ncopy"}, | 113 | {ERR_FUNC(ASN1_F_ASN1_OBJECT_NEW), "ASN1_OBJECT_new"}, |
| 114 | {ERR_FUNC(ASN1_F_ASN1_OBJECT_NEW), "ASN1_OBJECT_new"}, | 114 | {ERR_FUNC(ASN1_F_ASN1_OUTPUT_DATA), "ASN1_OUTPUT_DATA"}, |
| 115 | {ERR_FUNC(ASN1_F_ASN1_OUTPUT_DATA), "ASN1_OUTPUT_DATA"}, | 115 | {ERR_FUNC(ASN1_F_ASN1_PACK_STRING), "ASN1_pack_string"}, |
| 116 | {ERR_FUNC(ASN1_F_ASN1_PACK_STRING), "ASN1_pack_string"}, | 116 | {ERR_FUNC(ASN1_F_ASN1_PCTX_NEW), "ASN1_PCTX_new"}, |
| 117 | {ERR_FUNC(ASN1_F_ASN1_PCTX_NEW), "ASN1_PCTX_new"}, | 117 | {ERR_FUNC(ASN1_F_ASN1_PKCS5_PBE_SET), "ASN1_PKCS5_PBE_SET"}, |
| 118 | {ERR_FUNC(ASN1_F_ASN1_PKCS5_PBE_SET), "ASN1_PKCS5_PBE_SET"}, | 118 | {ERR_FUNC(ASN1_F_ASN1_SEQ_PACK), "ASN1_seq_pack"}, |
| 119 | {ERR_FUNC(ASN1_F_ASN1_SEQ_PACK), "ASN1_seq_pack"}, | 119 | {ERR_FUNC(ASN1_F_ASN1_SEQ_UNPACK), "ASN1_seq_unpack"}, |
| 120 | {ERR_FUNC(ASN1_F_ASN1_SEQ_UNPACK), "ASN1_seq_unpack"}, | 120 | {ERR_FUNC(ASN1_F_ASN1_SIGN), "ASN1_sign"}, |
| 121 | {ERR_FUNC(ASN1_F_ASN1_SIGN), "ASN1_sign"}, | 121 | {ERR_FUNC(ASN1_F_ASN1_STR2TYPE), "ASN1_STR2TYPE"}, |
| 122 | {ERR_FUNC(ASN1_F_ASN1_STR2TYPE), "ASN1_STR2TYPE"}, | 122 | {ERR_FUNC(ASN1_F_ASN1_STRING_SET), "ASN1_STRING_set"}, |
| 123 | {ERR_FUNC(ASN1_F_ASN1_STRING_SET), "ASN1_STRING_set"}, | 123 | {ERR_FUNC(ASN1_F_ASN1_STRING_TABLE_ADD), "ASN1_STRING_TABLE_add"}, |
| 124 | {ERR_FUNC(ASN1_F_ASN1_STRING_TABLE_ADD), "ASN1_STRING_TABLE_add"}, | 124 | {ERR_FUNC(ASN1_F_ASN1_STRING_TYPE_NEW), "ASN1_STRING_type_new"}, |
| 125 | {ERR_FUNC(ASN1_F_ASN1_STRING_TYPE_NEW), "ASN1_STRING_type_new"}, | 125 | {ERR_FUNC(ASN1_F_ASN1_TEMPLATE_EX_D2I), "ASN1_TEMPLATE_EX_D2I"}, |
| 126 | {ERR_FUNC(ASN1_F_ASN1_TEMPLATE_EX_D2I), "ASN1_TEMPLATE_EX_D2I"}, | 126 | {ERR_FUNC(ASN1_F_ASN1_TEMPLATE_NEW), "ASN1_TEMPLATE_NEW"}, |
| 127 | {ERR_FUNC(ASN1_F_ASN1_TEMPLATE_NEW), "ASN1_TEMPLATE_NEW"}, | 127 | {ERR_FUNC(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I), "ASN1_TEMPLATE_NOEXP_D2I"}, |
| 128 | {ERR_FUNC(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I), "ASN1_TEMPLATE_NOEXP_D2I"}, | 128 | {ERR_FUNC(ASN1_F_ASN1_TIME_ADJ), "ASN1_TIME_adj"}, |
| 129 | {ERR_FUNC(ASN1_F_ASN1_TIME_ADJ), "ASN1_TIME_adj"}, | 129 | {ERR_FUNC(ASN1_F_ASN1_TIME_SET), "ASN1_TIME_set"}, |
| 130 | {ERR_FUNC(ASN1_F_ASN1_TIME_SET), "ASN1_TIME_set"}, | 130 | {ERR_FUNC(ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING), "ASN1_TYPE_get_int_octetstring"}, |
| 131 | {ERR_FUNC(ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING), "ASN1_TYPE_get_int_octetstring"}, | 131 | {ERR_FUNC(ASN1_F_ASN1_TYPE_GET_OCTETSTRING), "ASN1_TYPE_get_octetstring"}, |
| 132 | {ERR_FUNC(ASN1_F_ASN1_TYPE_GET_OCTETSTRING), "ASN1_TYPE_get_octetstring"}, | 132 | {ERR_FUNC(ASN1_F_ASN1_UNPACK_STRING), "ASN1_unpack_string"}, |
| 133 | {ERR_FUNC(ASN1_F_ASN1_UNPACK_STRING), "ASN1_unpack_string"}, | 133 | {ERR_FUNC(ASN1_F_ASN1_UTCTIME_ADJ), "ASN1_UTCTIME_adj"}, |
| 134 | {ERR_FUNC(ASN1_F_ASN1_UTCTIME_ADJ), "ASN1_UTCTIME_adj"}, | 134 | {ERR_FUNC(ASN1_F_ASN1_UTCTIME_SET), "ASN1_UTCTIME_set"}, |
| 135 | {ERR_FUNC(ASN1_F_ASN1_UTCTIME_SET), "ASN1_UTCTIME_set"}, | 135 | {ERR_FUNC(ASN1_F_ASN1_VERIFY), "ASN1_verify"}, |
| 136 | {ERR_FUNC(ASN1_F_ASN1_VERIFY), "ASN1_verify"}, | 136 | {ERR_FUNC(ASN1_F_B64_READ_ASN1), "B64_READ_ASN1"}, |
| 137 | {ERR_FUNC(ASN1_F_B64_READ_ASN1), "B64_READ_ASN1"}, | 137 | {ERR_FUNC(ASN1_F_B64_WRITE_ASN1), "B64_WRITE_ASN1"}, |
| 138 | {ERR_FUNC(ASN1_F_B64_WRITE_ASN1), "B64_WRITE_ASN1"}, | 138 | {ERR_FUNC(ASN1_F_BIO_NEW_NDEF), "BIO_new_NDEF"}, |
| 139 | {ERR_FUNC(ASN1_F_BIO_NEW_NDEF), "BIO_new_NDEF"}, | 139 | {ERR_FUNC(ASN1_F_BITSTR_CB), "BITSTR_CB"}, |
| 140 | {ERR_FUNC(ASN1_F_BITSTR_CB), "BITSTR_CB"}, | 140 | {ERR_FUNC(ASN1_F_BN_TO_ASN1_ENUMERATED), "BN_to_ASN1_ENUMERATED"}, |
| 141 | {ERR_FUNC(ASN1_F_BN_TO_ASN1_ENUMERATED), "BN_to_ASN1_ENUMERATED"}, | 141 | {ERR_FUNC(ASN1_F_BN_TO_ASN1_INTEGER), "BN_to_ASN1_INTEGER"}, |
| 142 | {ERR_FUNC(ASN1_F_BN_TO_ASN1_INTEGER), "BN_to_ASN1_INTEGER"}, | 142 | {ERR_FUNC(ASN1_F_C2I_ASN1_BIT_STRING), "c2i_ASN1_BIT_STRING"}, |
| 143 | {ERR_FUNC(ASN1_F_C2I_ASN1_BIT_STRING), "c2i_ASN1_BIT_STRING"}, | 143 | {ERR_FUNC(ASN1_F_C2I_ASN1_INTEGER), "c2i_ASN1_INTEGER"}, |
| 144 | {ERR_FUNC(ASN1_F_C2I_ASN1_INTEGER), "c2i_ASN1_INTEGER"}, | 144 | {ERR_FUNC(ASN1_F_C2I_ASN1_OBJECT), "c2i_ASN1_OBJECT"}, |
| 145 | {ERR_FUNC(ASN1_F_C2I_ASN1_OBJECT), "c2i_ASN1_OBJECT"}, | 145 | {ERR_FUNC(ASN1_F_COLLECT_DATA), "COLLECT_DATA"}, |
| 146 | {ERR_FUNC(ASN1_F_COLLECT_DATA), "COLLECT_DATA"}, | 146 | {ERR_FUNC(ASN1_F_D2I_ASN1_BIT_STRING), "D2I_ASN1_BIT_STRING"}, |
| 147 | {ERR_FUNC(ASN1_F_D2I_ASN1_BIT_STRING), "D2I_ASN1_BIT_STRING"}, | 147 | {ERR_FUNC(ASN1_F_D2I_ASN1_BOOLEAN), "d2i_ASN1_BOOLEAN"}, |
| 148 | {ERR_FUNC(ASN1_F_D2I_ASN1_BOOLEAN), "d2i_ASN1_BOOLEAN"}, | 148 | {ERR_FUNC(ASN1_F_D2I_ASN1_BYTES), "d2i_ASN1_bytes"}, |
| 149 | {ERR_FUNC(ASN1_F_D2I_ASN1_BYTES), "d2i_ASN1_bytes"}, | 149 | {ERR_FUNC(ASN1_F_D2I_ASN1_GENERALIZEDTIME), "D2I_ASN1_GENERALIZEDTIME"}, |
| 150 | {ERR_FUNC(ASN1_F_D2I_ASN1_GENERALIZEDTIME), "D2I_ASN1_GENERALIZEDTIME"}, | 150 | {ERR_FUNC(ASN1_F_D2I_ASN1_HEADER), "D2I_ASN1_HEADER"}, |
| 151 | {ERR_FUNC(ASN1_F_D2I_ASN1_HEADER), "D2I_ASN1_HEADER"}, | 151 | {ERR_FUNC(ASN1_F_D2I_ASN1_INTEGER), "D2I_ASN1_INTEGER"}, |
| 152 | {ERR_FUNC(ASN1_F_D2I_ASN1_INTEGER), "D2I_ASN1_INTEGER"}, | 152 | {ERR_FUNC(ASN1_F_D2I_ASN1_OBJECT), "d2i_ASN1_OBJECT"}, |
| 153 | {ERR_FUNC(ASN1_F_D2I_ASN1_OBJECT), "d2i_ASN1_OBJECT"}, | 153 | {ERR_FUNC(ASN1_F_D2I_ASN1_SET), "d2i_ASN1_SET"}, |
| 154 | {ERR_FUNC(ASN1_F_D2I_ASN1_SET), "d2i_ASN1_SET"}, | 154 | {ERR_FUNC(ASN1_F_D2I_ASN1_TYPE_BYTES), "d2i_ASN1_type_bytes"}, |
| 155 | {ERR_FUNC(ASN1_F_D2I_ASN1_TYPE_BYTES), "d2i_ASN1_type_bytes"}, | 155 | {ERR_FUNC(ASN1_F_D2I_ASN1_UINTEGER), "d2i_ASN1_UINTEGER"}, |
| 156 | {ERR_FUNC(ASN1_F_D2I_ASN1_UINTEGER), "d2i_ASN1_UINTEGER"}, | 156 | {ERR_FUNC(ASN1_F_D2I_ASN1_UTCTIME), "D2I_ASN1_UTCTIME"}, |
| 157 | {ERR_FUNC(ASN1_F_D2I_ASN1_UTCTIME), "D2I_ASN1_UTCTIME"}, | 157 | {ERR_FUNC(ASN1_F_D2I_AUTOPRIVATEKEY), "d2i_AutoPrivateKey"}, |
| 158 | {ERR_FUNC(ASN1_F_D2I_AUTOPRIVATEKEY), "d2i_AutoPrivateKey"}, | 158 | {ERR_FUNC(ASN1_F_D2I_NETSCAPE_RSA), "d2i_Netscape_RSA"}, |
| 159 | {ERR_FUNC(ASN1_F_D2I_NETSCAPE_RSA), "d2i_Netscape_RSA"}, | 159 | {ERR_FUNC(ASN1_F_D2I_NETSCAPE_RSA_2), "D2I_NETSCAPE_RSA_2"}, |
| 160 | {ERR_FUNC(ASN1_F_D2I_NETSCAPE_RSA_2), "D2I_NETSCAPE_RSA_2"}, | 160 | {ERR_FUNC(ASN1_F_D2I_PRIVATEKEY), "d2i_PrivateKey"}, |
| 161 | {ERR_FUNC(ASN1_F_D2I_PRIVATEKEY), "d2i_PrivateKey"}, | 161 | {ERR_FUNC(ASN1_F_D2I_PUBLICKEY), "d2i_PublicKey"}, |
| 162 | {ERR_FUNC(ASN1_F_D2I_PUBLICKEY), "d2i_PublicKey"}, | 162 | {ERR_FUNC(ASN1_F_D2I_RSA_NET), "d2i_RSA_NET"}, |
| 163 | {ERR_FUNC(ASN1_F_D2I_RSA_NET), "d2i_RSA_NET"}, | 163 | {ERR_FUNC(ASN1_F_D2I_RSA_NET_2), "D2I_RSA_NET_2"}, |
| 164 | {ERR_FUNC(ASN1_F_D2I_RSA_NET_2), "D2I_RSA_NET_2"}, | 164 | {ERR_FUNC(ASN1_F_D2I_X509), "D2I_X509"}, |
| 165 | {ERR_FUNC(ASN1_F_D2I_X509), "D2I_X509"}, | 165 | {ERR_FUNC(ASN1_F_D2I_X509_CINF), "D2I_X509_CINF"}, |
| 166 | {ERR_FUNC(ASN1_F_D2I_X509_CINF), "D2I_X509_CINF"}, | 166 | {ERR_FUNC(ASN1_F_D2I_X509_PKEY), "d2i_X509_PKEY"}, |
| 167 | {ERR_FUNC(ASN1_F_D2I_X509_PKEY), "d2i_X509_PKEY"}, | 167 | {ERR_FUNC(ASN1_F_I2D_ASN1_BIO_STREAM), "i2d_ASN1_bio_stream"}, |
| 168 | {ERR_FUNC(ASN1_F_I2D_ASN1_BIO_STREAM), "i2d_ASN1_bio_stream"}, | 168 | {ERR_FUNC(ASN1_F_I2D_ASN1_SET), "i2d_ASN1_SET"}, |
| 169 | {ERR_FUNC(ASN1_F_I2D_ASN1_SET), "i2d_ASN1_SET"}, | 169 | {ERR_FUNC(ASN1_F_I2D_ASN1_TIME), "I2D_ASN1_TIME"}, |
| 170 | {ERR_FUNC(ASN1_F_I2D_ASN1_TIME), "I2D_ASN1_TIME"}, | 170 | {ERR_FUNC(ASN1_F_I2D_DSA_PUBKEY), "i2d_DSA_PUBKEY"}, |
| 171 | {ERR_FUNC(ASN1_F_I2D_DSA_PUBKEY), "i2d_DSA_PUBKEY"}, | 171 | {ERR_FUNC(ASN1_F_I2D_EC_PUBKEY), "i2d_EC_PUBKEY"}, |
| 172 | {ERR_FUNC(ASN1_F_I2D_EC_PUBKEY), "i2d_EC_PUBKEY"}, | 172 | {ERR_FUNC(ASN1_F_I2D_PRIVATEKEY), "i2d_PrivateKey"}, |
| 173 | {ERR_FUNC(ASN1_F_I2D_PRIVATEKEY), "i2d_PrivateKey"}, | 173 | {ERR_FUNC(ASN1_F_I2D_PUBLICKEY), "i2d_PublicKey"}, |
| 174 | {ERR_FUNC(ASN1_F_I2D_PUBLICKEY), "i2d_PublicKey"}, | 174 | {ERR_FUNC(ASN1_F_I2D_RSA_NET), "i2d_RSA_NET"}, |
| 175 | {ERR_FUNC(ASN1_F_I2D_RSA_NET), "i2d_RSA_NET"}, | 175 | {ERR_FUNC(ASN1_F_I2D_RSA_PUBKEY), "i2d_RSA_PUBKEY"}, |
| 176 | {ERR_FUNC(ASN1_F_I2D_RSA_PUBKEY), "i2d_RSA_PUBKEY"}, | 176 | {ERR_FUNC(ASN1_F_LONG_C2I), "LONG_C2I"}, |
| 177 | {ERR_FUNC(ASN1_F_LONG_C2I), "LONG_C2I"}, | 177 | {ERR_FUNC(ASN1_F_OID_MODULE_INIT), "OID_MODULE_INIT"}, |
| 178 | {ERR_FUNC(ASN1_F_OID_MODULE_INIT), "OID_MODULE_INIT"}, | 178 | {ERR_FUNC(ASN1_F_PARSE_TAGGING), "PARSE_TAGGING"}, |
| 179 | {ERR_FUNC(ASN1_F_PARSE_TAGGING), "PARSE_TAGGING"}, | 179 | {ERR_FUNC(ASN1_F_PKCS5_PBE2_SET_IV), "PKCS5_pbe2_set_iv"}, |
| 180 | {ERR_FUNC(ASN1_F_PKCS5_PBE2_SET_IV), "PKCS5_pbe2_set_iv"}, | 180 | {ERR_FUNC(ASN1_F_PKCS5_PBE_SET), "PKCS5_pbe_set"}, |
| 181 | {ERR_FUNC(ASN1_F_PKCS5_PBE_SET), "PKCS5_pbe_set"}, | 181 | {ERR_FUNC(ASN1_F_PKCS5_PBE_SET0_ALGOR), "PKCS5_pbe_set0_algor"}, |
| 182 | {ERR_FUNC(ASN1_F_PKCS5_PBE_SET0_ALGOR), "PKCS5_pbe_set0_algor"}, | 182 | {ERR_FUNC(ASN1_F_PKCS5_PBKDF2_SET), "PKCS5_pbkdf2_set"}, |
| 183 | {ERR_FUNC(ASN1_F_PKCS5_PBKDF2_SET), "PKCS5_pbkdf2_set"}, | 183 | {ERR_FUNC(ASN1_F_SMIME_READ_ASN1), "SMIME_read_ASN1"}, |
| 184 | {ERR_FUNC(ASN1_F_SMIME_READ_ASN1), "SMIME_read_ASN1"}, | 184 | {ERR_FUNC(ASN1_F_SMIME_TEXT), "SMIME_text"}, |
| 185 | {ERR_FUNC(ASN1_F_SMIME_TEXT), "SMIME_text"}, | 185 | {ERR_FUNC(ASN1_F_X509_CINF_NEW), "X509_CINF_NEW"}, |
| 186 | {ERR_FUNC(ASN1_F_X509_CINF_NEW), "X509_CINF_NEW"}, | 186 | {ERR_FUNC(ASN1_F_X509_CRL_ADD0_REVOKED), "X509_CRL_add0_revoked"}, |
| 187 | {ERR_FUNC(ASN1_F_X509_CRL_ADD0_REVOKED), "X509_CRL_add0_revoked"}, | 187 | {ERR_FUNC(ASN1_F_X509_INFO_NEW), "X509_INFO_new"}, |
| 188 | {ERR_FUNC(ASN1_F_X509_INFO_NEW), "X509_INFO_new"}, | 188 | {ERR_FUNC(ASN1_F_X509_NAME_ENCODE), "X509_NAME_ENCODE"}, |
| 189 | {ERR_FUNC(ASN1_F_X509_NAME_ENCODE), "X509_NAME_ENCODE"}, | 189 | {ERR_FUNC(ASN1_F_X509_NAME_EX_D2I), "X509_NAME_EX_D2I"}, |
| 190 | {ERR_FUNC(ASN1_F_X509_NAME_EX_D2I), "X509_NAME_EX_D2I"}, | 190 | {ERR_FUNC(ASN1_F_X509_NAME_EX_NEW), "X509_NAME_EX_NEW"}, |
| 191 | {ERR_FUNC(ASN1_F_X509_NAME_EX_NEW), "X509_NAME_EX_NEW"}, | 191 | {ERR_FUNC(ASN1_F_X509_NEW), "X509_NEW"}, |
| 192 | {ERR_FUNC(ASN1_F_X509_NEW), "X509_NEW"}, | 192 | {ERR_FUNC(ASN1_F_X509_PKEY_NEW), "X509_PKEY_new"}, |
| 193 | {ERR_FUNC(ASN1_F_X509_PKEY_NEW), "X509_PKEY_new"}, | 193 | {0, NULL} |
| 194 | {0,NULL} | ||
| 195 | }; | 194 | }; |
| 196 | 195 | ||
| 197 | static ERR_STRING_DATA ASN1_str_reasons[]= | 196 | static ERR_STRING_DATA ASN1_str_reasons[]= { |
| 198 | { | 197 | {ERR_REASON(ASN1_R_ADDING_OBJECT) , "adding object"}, |
| 199 | {ERR_REASON(ASN1_R_ADDING_OBJECT) ,"adding object"}, | 198 | {ERR_REASON(ASN1_R_ASN1_PARSE_ERROR) , "asn1 parse error"}, |
| 200 | {ERR_REASON(ASN1_R_ASN1_PARSE_ERROR) ,"asn1 parse error"}, | 199 | {ERR_REASON(ASN1_R_ASN1_SIG_PARSE_ERROR) , "asn1 sig parse error"}, |
| 201 | {ERR_REASON(ASN1_R_ASN1_SIG_PARSE_ERROR) ,"asn1 sig parse error"}, | 200 | {ERR_REASON(ASN1_R_AUX_ERROR) , "aux error"}, |
| 202 | {ERR_REASON(ASN1_R_AUX_ERROR) ,"aux error"}, | 201 | {ERR_REASON(ASN1_R_BAD_CLASS) , "bad class"}, |
| 203 | {ERR_REASON(ASN1_R_BAD_CLASS) ,"bad class"}, | 202 | {ERR_REASON(ASN1_R_BAD_OBJECT_HEADER) , "bad object header"}, |
| 204 | {ERR_REASON(ASN1_R_BAD_OBJECT_HEADER) ,"bad object header"}, | 203 | {ERR_REASON(ASN1_R_BAD_PASSWORD_READ) , "bad password read"}, |
| 205 | {ERR_REASON(ASN1_R_BAD_PASSWORD_READ) ,"bad password read"}, | 204 | {ERR_REASON(ASN1_R_BAD_TAG) , "bad tag"}, |
| 206 | {ERR_REASON(ASN1_R_BAD_TAG) ,"bad tag"}, | 205 | {ERR_REASON(ASN1_R_BMPSTRING_IS_WRONG_LENGTH), "bmpstring is wrong length"}, |
| 207 | {ERR_REASON(ASN1_R_BMPSTRING_IS_WRONG_LENGTH),"bmpstring is wrong length"}, | 206 | {ERR_REASON(ASN1_R_BN_LIB) , "bn lib"}, |
| 208 | {ERR_REASON(ASN1_R_BN_LIB) ,"bn lib"}, | 207 | {ERR_REASON(ASN1_R_BOOLEAN_IS_WRONG_LENGTH), "boolean is wrong length"}, |
| 209 | {ERR_REASON(ASN1_R_BOOLEAN_IS_WRONG_LENGTH),"boolean is wrong length"}, | 208 | {ERR_REASON(ASN1_R_BUFFER_TOO_SMALL) , "buffer too small"}, |
| 210 | {ERR_REASON(ASN1_R_BUFFER_TOO_SMALL) ,"buffer too small"}, | 209 | {ERR_REASON(ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER), "cipher has no object identifier"}, |
| 211 | {ERR_REASON(ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER),"cipher has no object identifier"}, | 210 | {ERR_REASON(ASN1_R_CONTEXT_NOT_INITIALISED), "context not initialised"}, |
| 212 | {ERR_REASON(ASN1_R_CONTEXT_NOT_INITIALISED),"context not initialised"}, | 211 | {ERR_REASON(ASN1_R_DATA_IS_WRONG) , "data is wrong"}, |
| 213 | {ERR_REASON(ASN1_R_DATA_IS_WRONG) ,"data is wrong"}, | 212 | {ERR_REASON(ASN1_R_DECODE_ERROR) , "decode error"}, |
| 214 | {ERR_REASON(ASN1_R_DECODE_ERROR) ,"decode error"}, | 213 | {ERR_REASON(ASN1_R_DECODING_ERROR) , "decoding error"}, |
| 215 | {ERR_REASON(ASN1_R_DECODING_ERROR) ,"decoding error"}, | 214 | {ERR_REASON(ASN1_R_DEPTH_EXCEEDED) , "depth exceeded"}, |
| 216 | {ERR_REASON(ASN1_R_DEPTH_EXCEEDED) ,"depth exceeded"}, | 215 | {ERR_REASON(ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED), "digest and key type not supported"}, |
| 217 | {ERR_REASON(ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED),"digest and key type not supported"}, | 216 | {ERR_REASON(ASN1_R_ENCODE_ERROR) , "encode error"}, |
| 218 | {ERR_REASON(ASN1_R_ENCODE_ERROR) ,"encode error"}, | 217 | {ERR_REASON(ASN1_R_ERROR_GETTING_TIME) , "error getting time"}, |
| 219 | {ERR_REASON(ASN1_R_ERROR_GETTING_TIME) ,"error getting time"}, | 218 | {ERR_REASON(ASN1_R_ERROR_LOADING_SECTION), "error loading section"}, |
| 220 | {ERR_REASON(ASN1_R_ERROR_LOADING_SECTION),"error loading section"}, | 219 | {ERR_REASON(ASN1_R_ERROR_PARSING_SET_ELEMENT), "error parsing set element"}, |
| 221 | {ERR_REASON(ASN1_R_ERROR_PARSING_SET_ELEMENT),"error parsing set element"}, | 220 | {ERR_REASON(ASN1_R_ERROR_SETTING_CIPHER_PARAMS), "error setting cipher params"}, |
| 222 | {ERR_REASON(ASN1_R_ERROR_SETTING_CIPHER_PARAMS),"error setting cipher params"}, | 221 | {ERR_REASON(ASN1_R_EXPECTING_AN_INTEGER) , "expecting an integer"}, |
| 223 | {ERR_REASON(ASN1_R_EXPECTING_AN_INTEGER) ,"expecting an integer"}, | 222 | {ERR_REASON(ASN1_R_EXPECTING_AN_OBJECT) , "expecting an object"}, |
| 224 | {ERR_REASON(ASN1_R_EXPECTING_AN_OBJECT) ,"expecting an object"}, | 223 | {ERR_REASON(ASN1_R_EXPECTING_A_BOOLEAN) , "expecting a boolean"}, |
| 225 | {ERR_REASON(ASN1_R_EXPECTING_A_BOOLEAN) ,"expecting a boolean"}, | 224 | {ERR_REASON(ASN1_R_EXPECTING_A_TIME) , "expecting a time"}, |
| 226 | {ERR_REASON(ASN1_R_EXPECTING_A_TIME) ,"expecting a time"}, | 225 | {ERR_REASON(ASN1_R_EXPLICIT_LENGTH_MISMATCH), "explicit length mismatch"}, |
| 227 | {ERR_REASON(ASN1_R_EXPLICIT_LENGTH_MISMATCH),"explicit length mismatch"}, | 226 | {ERR_REASON(ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED), "explicit tag not constructed"}, |
| 228 | {ERR_REASON(ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED),"explicit tag not constructed"}, | 227 | {ERR_REASON(ASN1_R_FIELD_MISSING) , "field missing"}, |
| 229 | {ERR_REASON(ASN1_R_FIELD_MISSING) ,"field missing"}, | 228 | {ERR_REASON(ASN1_R_FIRST_NUM_TOO_LARGE) , "first num too large"}, |
| 230 | {ERR_REASON(ASN1_R_FIRST_NUM_TOO_LARGE) ,"first num too large"}, | 229 | {ERR_REASON(ASN1_R_HEADER_TOO_LONG) , "header too long"}, |
| 231 | {ERR_REASON(ASN1_R_HEADER_TOO_LONG) ,"header too long"}, | 230 | {ERR_REASON(ASN1_R_ILLEGAL_BITSTRING_FORMAT), "illegal bitstring format"}, |
| 232 | {ERR_REASON(ASN1_R_ILLEGAL_BITSTRING_FORMAT),"illegal bitstring format"}, | 231 | {ERR_REASON(ASN1_R_ILLEGAL_BOOLEAN) , "illegal boolean"}, |
| 233 | {ERR_REASON(ASN1_R_ILLEGAL_BOOLEAN) ,"illegal boolean"}, | 232 | {ERR_REASON(ASN1_R_ILLEGAL_CHARACTERS) , "illegal characters"}, |
| 234 | {ERR_REASON(ASN1_R_ILLEGAL_CHARACTERS) ,"illegal characters"}, | 233 | {ERR_REASON(ASN1_R_ILLEGAL_FORMAT) , "illegal format"}, |
| 235 | {ERR_REASON(ASN1_R_ILLEGAL_FORMAT) ,"illegal format"}, | 234 | {ERR_REASON(ASN1_R_ILLEGAL_HEX) , "illegal hex"}, |
| 236 | {ERR_REASON(ASN1_R_ILLEGAL_HEX) ,"illegal hex"}, | 235 | {ERR_REASON(ASN1_R_ILLEGAL_IMPLICIT_TAG) , "illegal implicit tag"}, |
| 237 | {ERR_REASON(ASN1_R_ILLEGAL_IMPLICIT_TAG) ,"illegal implicit tag"}, | 236 | {ERR_REASON(ASN1_R_ILLEGAL_INTEGER) , "illegal integer"}, |
| 238 | {ERR_REASON(ASN1_R_ILLEGAL_INTEGER) ,"illegal integer"}, | 237 | {ERR_REASON(ASN1_R_ILLEGAL_NESTED_TAGGING), "illegal nested tagging"}, |
| 239 | {ERR_REASON(ASN1_R_ILLEGAL_NESTED_TAGGING),"illegal nested tagging"}, | 238 | {ERR_REASON(ASN1_R_ILLEGAL_NULL) , "illegal null"}, |
| 240 | {ERR_REASON(ASN1_R_ILLEGAL_NULL) ,"illegal null"}, | 239 | {ERR_REASON(ASN1_R_ILLEGAL_NULL_VALUE) , "illegal null value"}, |
| 241 | {ERR_REASON(ASN1_R_ILLEGAL_NULL_VALUE) ,"illegal null value"}, | 240 | {ERR_REASON(ASN1_R_ILLEGAL_OBJECT) , "illegal object"}, |
| 242 | {ERR_REASON(ASN1_R_ILLEGAL_OBJECT) ,"illegal object"}, | 241 | {ERR_REASON(ASN1_R_ILLEGAL_OPTIONAL_ANY) , "illegal optional any"}, |
| 243 | {ERR_REASON(ASN1_R_ILLEGAL_OPTIONAL_ANY) ,"illegal optional any"}, | 242 | {ERR_REASON(ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE), "illegal options on item template"}, |
| 244 | {ERR_REASON(ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE),"illegal options on item template"}, | 243 | {ERR_REASON(ASN1_R_ILLEGAL_TAGGED_ANY) , "illegal tagged any"}, |
| 245 | {ERR_REASON(ASN1_R_ILLEGAL_TAGGED_ANY) ,"illegal tagged any"}, | 244 | {ERR_REASON(ASN1_R_ILLEGAL_TIME_VALUE) , "illegal time value"}, |
| 246 | {ERR_REASON(ASN1_R_ILLEGAL_TIME_VALUE) ,"illegal time value"}, | 245 | {ERR_REASON(ASN1_R_INTEGER_NOT_ASCII_FORMAT), "integer not ascii format"}, |
| 247 | {ERR_REASON(ASN1_R_INTEGER_NOT_ASCII_FORMAT),"integer not ascii format"}, | 246 | {ERR_REASON(ASN1_R_INTEGER_TOO_LARGE_FOR_LONG), "integer too large for long"}, |
| 248 | {ERR_REASON(ASN1_R_INTEGER_TOO_LARGE_FOR_LONG),"integer too large for long"}, | 247 | {ERR_REASON(ASN1_R_INVALID_BMPSTRING_LENGTH), "invalid bmpstring length"}, |
| 249 | {ERR_REASON(ASN1_R_INVALID_BMPSTRING_LENGTH),"invalid bmpstring length"}, | 248 | {ERR_REASON(ASN1_R_INVALID_DIGIT) , "invalid digit"}, |
| 250 | {ERR_REASON(ASN1_R_INVALID_DIGIT) ,"invalid digit"}, | 249 | {ERR_REASON(ASN1_R_INVALID_MIME_TYPE) , "invalid mime type"}, |
| 251 | {ERR_REASON(ASN1_R_INVALID_MIME_TYPE) ,"invalid mime type"}, | 250 | {ERR_REASON(ASN1_R_INVALID_MODIFIER) , "invalid modifier"}, |
| 252 | {ERR_REASON(ASN1_R_INVALID_MODIFIER) ,"invalid modifier"}, | 251 | {ERR_REASON(ASN1_R_INVALID_NUMBER) , "invalid number"}, |
| 253 | {ERR_REASON(ASN1_R_INVALID_NUMBER) ,"invalid number"}, | 252 | {ERR_REASON(ASN1_R_INVALID_OBJECT_ENCODING), "invalid object encoding"}, |
| 254 | {ERR_REASON(ASN1_R_INVALID_OBJECT_ENCODING),"invalid object encoding"}, | 253 | {ERR_REASON(ASN1_R_INVALID_SEPARATOR) , "invalid separator"}, |
| 255 | {ERR_REASON(ASN1_R_INVALID_SEPARATOR) ,"invalid separator"}, | 254 | {ERR_REASON(ASN1_R_INVALID_TIME_FORMAT) , "invalid time format"}, |
| 256 | {ERR_REASON(ASN1_R_INVALID_TIME_FORMAT) ,"invalid time format"}, | 255 | {ERR_REASON(ASN1_R_INVALID_UNIVERSALSTRING_LENGTH), "invalid universalstring length"}, |
| 257 | {ERR_REASON(ASN1_R_INVALID_UNIVERSALSTRING_LENGTH),"invalid universalstring length"}, | 256 | {ERR_REASON(ASN1_R_INVALID_UTF8STRING) , "invalid utf8string"}, |
| 258 | {ERR_REASON(ASN1_R_INVALID_UTF8STRING) ,"invalid utf8string"}, | 257 | {ERR_REASON(ASN1_R_IV_TOO_LARGE) , "iv too large"}, |
| 259 | {ERR_REASON(ASN1_R_IV_TOO_LARGE) ,"iv too large"}, | 258 | {ERR_REASON(ASN1_R_LENGTH_ERROR) , "length error"}, |
| 260 | {ERR_REASON(ASN1_R_LENGTH_ERROR) ,"length error"}, | 259 | {ERR_REASON(ASN1_R_LIST_ERROR) , "list error"}, |
| 261 | {ERR_REASON(ASN1_R_LIST_ERROR) ,"list error"}, | 260 | {ERR_REASON(ASN1_R_MIME_NO_CONTENT_TYPE) , "mime no content type"}, |
| 262 | {ERR_REASON(ASN1_R_MIME_NO_CONTENT_TYPE) ,"mime no content type"}, | 261 | {ERR_REASON(ASN1_R_MIME_PARSE_ERROR) , "mime parse error"}, |
| 263 | {ERR_REASON(ASN1_R_MIME_PARSE_ERROR) ,"mime parse error"}, | 262 | {ERR_REASON(ASN1_R_MIME_SIG_PARSE_ERROR) , "mime sig parse error"}, |
| 264 | {ERR_REASON(ASN1_R_MIME_SIG_PARSE_ERROR) ,"mime sig parse error"}, | 263 | {ERR_REASON(ASN1_R_MISSING_EOC) , "missing eoc"}, |
| 265 | {ERR_REASON(ASN1_R_MISSING_EOC) ,"missing eoc"}, | 264 | {ERR_REASON(ASN1_R_MISSING_SECOND_NUMBER), "missing second number"}, |
| 266 | {ERR_REASON(ASN1_R_MISSING_SECOND_NUMBER),"missing second number"}, | 265 | {ERR_REASON(ASN1_R_MISSING_VALUE) , "missing value"}, |
| 267 | {ERR_REASON(ASN1_R_MISSING_VALUE) ,"missing value"}, | 266 | {ERR_REASON(ASN1_R_MSTRING_NOT_UNIVERSAL), "mstring not universal"}, |
| 268 | {ERR_REASON(ASN1_R_MSTRING_NOT_UNIVERSAL),"mstring not universal"}, | 267 | {ERR_REASON(ASN1_R_MSTRING_WRONG_TAG) , "mstring wrong tag"}, |
| 269 | {ERR_REASON(ASN1_R_MSTRING_WRONG_TAG) ,"mstring wrong tag"}, | 268 | {ERR_REASON(ASN1_R_NESTED_ASN1_STRING) , "nested asn1 string"}, |
| 270 | {ERR_REASON(ASN1_R_NESTED_ASN1_STRING) ,"nested asn1 string"}, | 269 | {ERR_REASON(ASN1_R_NON_HEX_CHARACTERS) , "non hex characters"}, |
| 271 | {ERR_REASON(ASN1_R_NON_HEX_CHARACTERS) ,"non hex characters"}, | 270 | {ERR_REASON(ASN1_R_NOT_ASCII_FORMAT) , "not ascii format"}, |
| 272 | {ERR_REASON(ASN1_R_NOT_ASCII_FORMAT) ,"not ascii format"}, | 271 | {ERR_REASON(ASN1_R_NOT_ENOUGH_DATA) , "not enough data"}, |
| 273 | {ERR_REASON(ASN1_R_NOT_ENOUGH_DATA) ,"not enough data"}, | 272 | {ERR_REASON(ASN1_R_NO_CONTENT_TYPE) , "no content type"}, |
| 274 | {ERR_REASON(ASN1_R_NO_CONTENT_TYPE) ,"no content type"}, | 273 | {ERR_REASON(ASN1_R_NO_DEFAULT_DIGEST) , "no default digest"}, |
| 275 | {ERR_REASON(ASN1_R_NO_DEFAULT_DIGEST) ,"no default digest"}, | 274 | {ERR_REASON(ASN1_R_NO_MATCHING_CHOICE_TYPE), "no matching choice type"}, |
| 276 | {ERR_REASON(ASN1_R_NO_MATCHING_CHOICE_TYPE),"no matching choice type"}, | 275 | {ERR_REASON(ASN1_R_NO_MULTIPART_BODY_FAILURE), "no multipart body failure"}, |
| 277 | {ERR_REASON(ASN1_R_NO_MULTIPART_BODY_FAILURE),"no multipart body failure"}, | 276 | {ERR_REASON(ASN1_R_NO_MULTIPART_BOUNDARY), "no multipart boundary"}, |
| 278 | {ERR_REASON(ASN1_R_NO_MULTIPART_BOUNDARY),"no multipart boundary"}, | 277 | {ERR_REASON(ASN1_R_NO_SIG_CONTENT_TYPE) , "no sig content type"}, |
| 279 | {ERR_REASON(ASN1_R_NO_SIG_CONTENT_TYPE) ,"no sig content type"}, | 278 | {ERR_REASON(ASN1_R_NULL_IS_WRONG_LENGTH) , "null is wrong length"}, |
| 280 | {ERR_REASON(ASN1_R_NULL_IS_WRONG_LENGTH) ,"null is wrong length"}, | 279 | {ERR_REASON(ASN1_R_OBJECT_NOT_ASCII_FORMAT), "object not ascii format"}, |
| 281 | {ERR_REASON(ASN1_R_OBJECT_NOT_ASCII_FORMAT),"object not ascii format"}, | 280 | {ERR_REASON(ASN1_R_ODD_NUMBER_OF_CHARS) , "odd number of chars"}, |
| 282 | {ERR_REASON(ASN1_R_ODD_NUMBER_OF_CHARS) ,"odd number of chars"}, | 281 | {ERR_REASON(ASN1_R_PRIVATE_KEY_HEADER_MISSING), "private key header missing"}, |
| 283 | {ERR_REASON(ASN1_R_PRIVATE_KEY_HEADER_MISSING),"private key header missing"}, | 282 | {ERR_REASON(ASN1_R_SECOND_NUMBER_TOO_LARGE), "second number too large"}, |
| 284 | {ERR_REASON(ASN1_R_SECOND_NUMBER_TOO_LARGE),"second number too large"}, | 283 | {ERR_REASON(ASN1_R_SEQUENCE_LENGTH_MISMATCH), "sequence length mismatch"}, |
| 285 | {ERR_REASON(ASN1_R_SEQUENCE_LENGTH_MISMATCH),"sequence length mismatch"}, | 284 | {ERR_REASON(ASN1_R_SEQUENCE_NOT_CONSTRUCTED), "sequence not constructed"}, |
| 286 | {ERR_REASON(ASN1_R_SEQUENCE_NOT_CONSTRUCTED),"sequence not constructed"}, | 285 | {ERR_REASON(ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG), "sequence or set needs config"}, |
| 287 | {ERR_REASON(ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG),"sequence or set needs config"}, | 286 | {ERR_REASON(ASN1_R_SHORT_LINE) , "short line"}, |
| 288 | {ERR_REASON(ASN1_R_SHORT_LINE) ,"short line"}, | 287 | {ERR_REASON(ASN1_R_SIG_INVALID_MIME_TYPE), "sig invalid mime type"}, |
| 289 | {ERR_REASON(ASN1_R_SIG_INVALID_MIME_TYPE),"sig invalid mime type"}, | 288 | {ERR_REASON(ASN1_R_STREAMING_NOT_SUPPORTED), "streaming not supported"}, |
| 290 | {ERR_REASON(ASN1_R_STREAMING_NOT_SUPPORTED),"streaming not supported"}, | 289 | {ERR_REASON(ASN1_R_STRING_TOO_LONG) , "string too long"}, |
| 291 | {ERR_REASON(ASN1_R_STRING_TOO_LONG) ,"string too long"}, | 290 | {ERR_REASON(ASN1_R_STRING_TOO_SHORT) , "string too short"}, |
| 292 | {ERR_REASON(ASN1_R_STRING_TOO_SHORT) ,"string too short"}, | 291 | {ERR_REASON(ASN1_R_TAG_VALUE_TOO_HIGH) , "tag value too high"}, |
| 293 | {ERR_REASON(ASN1_R_TAG_VALUE_TOO_HIGH) ,"tag value too high"}, | 292 | {ERR_REASON(ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD), "the asn1 object identifier is not known for this md"}, |
| 294 | {ERR_REASON(ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD),"the asn1 object identifier is not known for this md"}, | 293 | {ERR_REASON(ASN1_R_TIME_NOT_ASCII_FORMAT), "time not ascii format"}, |
| 295 | {ERR_REASON(ASN1_R_TIME_NOT_ASCII_FORMAT),"time not ascii format"}, | 294 | {ERR_REASON(ASN1_R_TOO_LONG) , "too long"}, |
| 296 | {ERR_REASON(ASN1_R_TOO_LONG) ,"too long"}, | 295 | {ERR_REASON(ASN1_R_TYPE_NOT_CONSTRUCTED) , "type not constructed"}, |
| 297 | {ERR_REASON(ASN1_R_TYPE_NOT_CONSTRUCTED) ,"type not constructed"}, | 296 | {ERR_REASON(ASN1_R_UNABLE_TO_DECODE_RSA_KEY), "unable to decode rsa key"}, |
| 298 | {ERR_REASON(ASN1_R_UNABLE_TO_DECODE_RSA_KEY),"unable to decode rsa key"}, | 297 | {ERR_REASON(ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY), "unable to decode rsa private key"}, |
| 299 | {ERR_REASON(ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY),"unable to decode rsa private key"}, | 298 | {ERR_REASON(ASN1_R_UNEXPECTED_EOC) , "unexpected eoc"}, |
| 300 | {ERR_REASON(ASN1_R_UNEXPECTED_EOC) ,"unexpected eoc"}, | 299 | {ERR_REASON(ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH), "universalstring is wrong length"}, |
| 301 | {ERR_REASON(ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH),"universalstring is wrong length"}, | 300 | {ERR_REASON(ASN1_R_UNKNOWN_FORMAT) , "unknown format"}, |
| 302 | {ERR_REASON(ASN1_R_UNKNOWN_FORMAT) ,"unknown format"}, | 301 | {ERR_REASON(ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM), "unknown message digest algorithm"}, |
| 303 | {ERR_REASON(ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM),"unknown message digest algorithm"}, | 302 | {ERR_REASON(ASN1_R_UNKNOWN_OBJECT_TYPE) , "unknown object type"}, |
| 304 | {ERR_REASON(ASN1_R_UNKNOWN_OBJECT_TYPE) ,"unknown object type"}, | 303 | {ERR_REASON(ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE), "unknown public key type"}, |
| 305 | {ERR_REASON(ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE),"unknown public key type"}, | 304 | {ERR_REASON(ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM), "unknown signature algorithm"}, |
| 306 | {ERR_REASON(ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM),"unknown signature algorithm"}, | 305 | {ERR_REASON(ASN1_R_UNKNOWN_TAG) , "unknown tag"}, |
| 307 | {ERR_REASON(ASN1_R_UNKNOWN_TAG) ,"unknown tag"}, | 306 | {ERR_REASON(ASN1_R_UNKOWN_FORMAT) , "unknown format"}, |
| 308 | {ERR_REASON(ASN1_R_UNKOWN_FORMAT) ,"unknown format"}, | 307 | {ERR_REASON(ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE), "unsupported any defined by type"}, |
| 309 | {ERR_REASON(ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE),"unsupported any defined by type"}, | 308 | {ERR_REASON(ASN1_R_UNSUPPORTED_CIPHER) , "unsupported cipher"}, |
| 310 | {ERR_REASON(ASN1_R_UNSUPPORTED_CIPHER) ,"unsupported cipher"}, | 309 | {ERR_REASON(ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM), "unsupported encryption algorithm"}, |
| 311 | {ERR_REASON(ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM),"unsupported encryption algorithm"}, | 310 | {ERR_REASON(ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE), "unsupported public key type"}, |
| 312 | {ERR_REASON(ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE),"unsupported public key type"}, | 311 | {ERR_REASON(ASN1_R_UNSUPPORTED_TYPE) , "unsupported type"}, |
| 313 | {ERR_REASON(ASN1_R_UNSUPPORTED_TYPE) ,"unsupported type"}, | 312 | {ERR_REASON(ASN1_R_WRONG_PUBLIC_KEY_TYPE), "wrong public key type"}, |
| 314 | {ERR_REASON(ASN1_R_WRONG_PUBLIC_KEY_TYPE),"wrong public key type"}, | 313 | {ERR_REASON(ASN1_R_WRONG_TAG) , "wrong tag"}, |
| 315 | {ERR_REASON(ASN1_R_WRONG_TAG) ,"wrong tag"}, | 314 | {ERR_REASON(ASN1_R_WRONG_TYPE) , "wrong type"}, |
| 316 | {ERR_REASON(ASN1_R_WRONG_TYPE) ,"wrong type"}, | 315 | {0, NULL} |
| 317 | {0,NULL} | ||
| 318 | }; | 316 | }; |
| 319 | 317 | ||
| 320 | #endif | 318 | #endif |
| 321 | 319 | ||
| 322 | void ERR_load_ASN1_strings(void) | 320 | void |
| 321 | ERR_load_ASN1_strings(void) | ||
| 323 | { | 322 | { |
| 324 | #ifndef OPENSSL_NO_ERR | 323 | #ifndef OPENSSL_NO_ERR |
| 325 | |||
| 326 | if (ERR_func_error_string(ASN1_str_functs[0].error) == NULL) { | 324 | if (ERR_func_error_string(ASN1_str_functs[0].error) == NULL) { |
| 327 | ERR_load_strings(0,ASN1_str_functs); | 325 | ERR_load_strings(0, ASN1_str_functs); |
| 328 | ERR_load_strings(0,ASN1_str_reasons); | 326 | ERR_load_strings(0, ASN1_str_reasons); |
| 329 | } | 327 | } |
| 330 | #endif | 328 | #endif |
| 331 | } | 329 | } |
diff --git a/src/lib/libcrypto/asn1/asn1_gen.c b/src/lib/libcrypto/asn1/asn1_gen.c index 314df379f9..c66bea2ab4 100644 --- a/src/lib/libcrypto/asn1/asn1_gen.c +++ b/src/lib/libcrypto/asn1/asn1_gen.c | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | * are met: | 10 | * are met: |
| 11 | * | 11 | * |
| 12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. |
| 14 | * | 14 | * |
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | 15 | * 2. Redistributions in binary form must reproduce the above copyright |
| 16 | * notice, this list of conditions and the following disclaimer in | 16 | * notice, this list of conditions and the following disclaimer in |
| @@ -85,16 +85,13 @@ | |||
| 85 | /* List of bits */ | 85 | /* List of bits */ |
| 86 | #define ASN1_GEN_FORMAT_BITLIST 4 | 86 | #define ASN1_GEN_FORMAT_BITLIST 4 |
| 87 | 87 | ||
| 88 | 88 | struct tag_name_st { | |
| 89 | struct tag_name_st | ||
| 90 | { | ||
| 91 | const char *strnam; | 89 | const char *strnam; |
| 92 | int len; | 90 | int len; |
| 93 | int tag; | 91 | int tag; |
| 94 | }; | 92 | }; |
| 95 | 93 | ||
| 96 | typedef struct | 94 | typedef struct { |
| 97 | { | ||
| 98 | int exp_tag; | 95 | int exp_tag; |
| 99 | int exp_class; | 96 | int exp_class; |
| 100 | int exp_constructed; | 97 | int exp_constructed; |
| @@ -102,8 +99,7 @@ typedef struct | |||
| 102 | long exp_len; | 99 | long exp_len; |
| 103 | } tag_exp_type; | 100 | } tag_exp_type; |
| 104 | 101 | ||
| 105 | typedef struct | 102 | typedef struct { |
| 106 | { | ||
| 107 | int imp_tag; | 103 | int imp_tag; |
| 108 | int imp_class; | 104 | int imp_class; |
| 109 | int utype; | 105 | int utype; |
| @@ -115,13 +111,15 @@ typedef struct | |||
| 115 | 111 | ||
| 116 | static int bitstr_cb(const char *elem, int len, void *bitstr); | 112 | static int bitstr_cb(const char *elem, int len, void *bitstr); |
| 117 | static int asn1_cb(const char *elem, int len, void *bitstr); | 113 | static int asn1_cb(const char *elem, int len, void *bitstr); |
| 118 | static int append_exp(tag_exp_arg *arg, int exp_tag, int exp_class, int exp_constructed, int exp_pad, int imp_ok); | 114 | static int append_exp(tag_exp_arg *arg, int exp_tag, int exp_class, |
| 115 | int exp_constructed, int exp_pad, int imp_ok); | ||
| 119 | static int parse_tagging(const char *vstart, int vlen, int *ptag, int *pclass); | 116 | static int parse_tagging(const char *vstart, int vlen, int *ptag, int *pclass); |
| 120 | static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf); | 117 | static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf); |
| 121 | static ASN1_TYPE *asn1_str2type(const char *str, int format, int utype); | 118 | static ASN1_TYPE *asn1_str2type(const char *str, int format, int utype); |
| 122 | static int asn1_str2tag(const char *tagstr, int len); | 119 | static int asn1_str2tag(const char *tagstr, int len); |
| 123 | 120 | ||
| 124 | ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf) | 121 | ASN1_TYPE * |
| 122 | ASN1_generate_nconf(char *str, CONF *nconf) | ||
| 125 | { | 123 | { |
| 126 | X509V3_CTX cnf; | 124 | X509V3_CTX cnf; |
| 127 | 125 | ||
| @@ -132,7 +130,8 @@ ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf) | |||
| 132 | return ASN1_generate_v3(str, &cnf); | 130 | return ASN1_generate_v3(str, &cnf); |
| 133 | } | 131 | } |
| 134 | 132 | ||
| 135 | ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf) | 133 | ASN1_TYPE * |
| 134 | ASN1_generate_v3(char *str, X509V3_CTX *cnf) | ||
| 136 | { | 135 | { |
| 137 | ASN1_TYPE *ret; | 136 | ASN1_TYPE *ret; |
| 138 | tag_exp_arg asn1_tags; | 137 | tag_exp_arg asn1_tags; |
| @@ -156,15 +155,17 @@ ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf) | |||
| 156 | if (CONF_parse_list(str, ',', 1, asn1_cb, &asn1_tags) != 0) | 155 | if (CONF_parse_list(str, ',', 1, asn1_cb, &asn1_tags) != 0) |
| 157 | return NULL; | 156 | return NULL; |
| 158 | 157 | ||
| 159 | if ((asn1_tags.utype == V_ASN1_SEQUENCE) || (asn1_tags.utype == V_ASN1_SET)) { | 158 | if ((asn1_tags.utype == V_ASN1_SEQUENCE) || |
| 159 | (asn1_tags.utype == V_ASN1_SET)) { | ||
| 160 | if (!cnf) { | 160 | if (!cnf) { |
| 161 | ASN1err(ASN1_F_ASN1_GENERATE_V3, ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG); | 161 | ASN1err(ASN1_F_ASN1_GENERATE_V3, |
| 162 | ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG); | ||
| 162 | return NULL; | 163 | return NULL; |
| 163 | } | 164 | } |
| 164 | ret = asn1_multi(asn1_tags.utype, asn1_tags.str, cnf); | 165 | ret = asn1_multi(asn1_tags.utype, asn1_tags.str, cnf); |
| 165 | } | 166 | } else |
| 166 | else | 167 | ret = asn1_str2type(asn1_tags.str, asn1_tags.format, |
| 167 | ret = asn1_str2type(asn1_tags.str, asn1_tags.format, asn1_tags.utype); | 168 | asn1_tags.utype); |
| 168 | 169 | ||
| 169 | if (!ret) | 170 | if (!ret) |
| 170 | return NULL; | 171 | return NULL; |
| @@ -184,7 +185,8 @@ ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf) | |||
| 184 | if (asn1_tags.imp_tag != -1) { | 185 | if (asn1_tags.imp_tag != -1) { |
| 185 | /* If IMPLICIT we will replace the underlying tag */ | 186 | /* If IMPLICIT we will replace the underlying tag */ |
| 186 | /* Skip existing tag+len */ | 187 | /* Skip existing tag+len */ |
| 187 | r = ASN1_get_object(&cpy_start, &hdr_len, &hdr_tag, &hdr_class, cpy_len); | 188 | r = ASN1_get_object(&cpy_start, &hdr_len, &hdr_tag, |
| 189 | &hdr_class, cpy_len); | ||
| 188 | if (r & 0x80) | 190 | if (r & 0x80) |
| 189 | goto err; | 191 | goto err; |
| 190 | /* Update copy length */ | 192 | /* Update copy length */ |
| @@ -197,21 +199,20 @@ ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf) | |||
| 197 | /* Indefinite length constructed */ | 199 | /* Indefinite length constructed */ |
| 198 | hdr_constructed = 2; | 200 | hdr_constructed = 2; |
| 199 | hdr_len = 0; | 201 | hdr_len = 0; |
| 200 | } | 202 | } else |
| 201 | else | ||
| 202 | /* Just retain constructed flag */ | 203 | /* Just retain constructed flag */ |
| 203 | hdr_constructed = r & V_ASN1_CONSTRUCTED; | 204 | hdr_constructed = r & V_ASN1_CONSTRUCTED; |
| 204 | /* Work out new length with IMPLICIT tag: ignore constructed | 205 | /* Work out new length with IMPLICIT tag: ignore constructed |
| 205 | * because it will mess up if indefinite length | 206 | * because it will mess up if indefinite length |
| 206 | */ | 207 | */ |
| 207 | len = ASN1_object_size(0, hdr_len, asn1_tags.imp_tag); | 208 | len = ASN1_object_size(0, hdr_len, asn1_tags.imp_tag); |
| 208 | } | 209 | } else |
| 209 | else | ||
| 210 | len = cpy_len; | 210 | len = cpy_len; |
| 211 | 211 | ||
| 212 | /* Work out length in any EXPLICIT, starting from end */ | 212 | /* Work out length in any EXPLICIT, starting from end */ |
| 213 | 213 | ||
| 214 | for(i = 0, etmp = asn1_tags.exp_list + asn1_tags.exp_count - 1; i < asn1_tags.exp_count; i++, etmp--) { | 214 | for (i = 0, etmp = asn1_tags.exp_list + asn1_tags.exp_count - 1; |
| 215 | i < asn1_tags.exp_count; i++, etmp--) { | ||
| 215 | /* Content length: number of content octets + any padding */ | 216 | /* Content length: number of content octets + any padding */ |
| 216 | len += etmp->exp_pad; | 217 | len += etmp->exp_pad; |
| 217 | etmp->exp_len = len; | 218 | etmp->exp_len = len; |
| @@ -226,14 +227,13 @@ ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf) | |||
| 226 | goto err; | 227 | goto err; |
| 227 | 228 | ||
| 228 | /* Generate tagged encoding */ | 229 | /* Generate tagged encoding */ |
| 229 | |||
| 230 | p = new_der; | 230 | p = new_der; |
| 231 | 231 | ||
| 232 | /* Output explicit tags first */ | 232 | /* Output explicit tags first */ |
| 233 | 233 | for (i = 0, etmp = asn1_tags.exp_list; i < asn1_tags.exp_count; | |
| 234 | for (i = 0, etmp = asn1_tags.exp_list; i < asn1_tags.exp_count; i++, etmp++) { | 234 | i++, etmp++) { |
| 235 | ASN1_put_object(&p, etmp->exp_constructed, etmp->exp_len, | 235 | ASN1_put_object(&p, etmp->exp_constructed, etmp->exp_len, |
| 236 | etmp->exp_tag, etmp->exp_class); | 236 | etmp->exp_tag, etmp->exp_class); |
| 237 | if (etmp->exp_pad) | 237 | if (etmp->exp_pad) |
| 238 | *p++ = 0; | 238 | *p++ = 0; |
| 239 | } | 239 | } |
| @@ -241,12 +241,12 @@ ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf) | |||
| 241 | /* If IMPLICIT, output tag */ | 241 | /* If IMPLICIT, output tag */ |
| 242 | 242 | ||
| 243 | if (asn1_tags.imp_tag != -1) { | 243 | if (asn1_tags.imp_tag != -1) { |
| 244 | if (asn1_tags.imp_class == V_ASN1_UNIVERSAL | 244 | if (asn1_tags.imp_class == V_ASN1_UNIVERSAL && |
| 245 | && (asn1_tags.imp_tag == V_ASN1_SEQUENCE | 245 | (asn1_tags.imp_tag == V_ASN1_SEQUENCE || |
| 246 | || asn1_tags.imp_tag == V_ASN1_SET) ) | 246 | asn1_tags.imp_tag == V_ASN1_SET)) |
| 247 | hdr_constructed = V_ASN1_CONSTRUCTED; | 247 | hdr_constructed = V_ASN1_CONSTRUCTED; |
| 248 | ASN1_put_object(&p, hdr_constructed, hdr_len, | 248 | ASN1_put_object(&p, hdr_constructed, hdr_len, |
| 249 | asn1_tags.imp_tag, asn1_tags.imp_class); | 249 | asn1_tags.imp_tag, asn1_tags.imp_class); |
| 250 | } | 250 | } |
| 251 | 251 | ||
| 252 | /* Copy across original encoding */ | 252 | /* Copy across original encoding */ |
| @@ -257,17 +257,17 @@ ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf) | |||
| 257 | /* Obtain new ASN1_TYPE structure */ | 257 | /* Obtain new ASN1_TYPE structure */ |
| 258 | ret = d2i_ASN1_TYPE(NULL, &cp, len); | 258 | ret = d2i_ASN1_TYPE(NULL, &cp, len); |
| 259 | 259 | ||
| 260 | err: | 260 | err: |
| 261 | if (orig_der) | 261 | if (orig_der) |
| 262 | free(orig_der); | 262 | free(orig_der); |
| 263 | if (new_der) | 263 | if (new_der) |
| 264 | free(new_der); | 264 | free(new_der); |
| 265 | 265 | ||
| 266 | return ret; | 266 | return ret; |
| 267 | |||
| 268 | } | 267 | } |
| 269 | 268 | ||
| 270 | static int asn1_cb(const char *elem, int len, void *bitstr) | 269 | static int |
| 270 | asn1_cb(const char *elem, int len, void *bitstr) | ||
| 271 | { | 271 | { |
| 272 | tag_exp_arg *arg = bitstr; | 272 | tag_exp_arg *arg = bitstr; |
| 273 | int i; | 273 | int i; |
| @@ -277,7 +277,7 @@ static int asn1_cb(const char *elem, int len, void *bitstr) | |||
| 277 | 277 | ||
| 278 | int tmp_tag, tmp_class; | 278 | int tmp_tag, tmp_class; |
| 279 | 279 | ||
| 280 | for(i = 0, p = elem; i < len; p++, i++) { | 280 | for (i = 0, p = elem; i < len; p++, i++) { |
| 281 | /* Look for the ':' in name value pairs */ | 281 | /* Look for the ':' in name value pairs */ |
| 282 | if (*p == ':') { | 282 | if (*p == ':') { |
| 283 | vstart = p + 1; | 283 | vstart = p + 1; |
| @@ -307,7 +307,7 @@ static int asn1_cb(const char *elem, int len, void *bitstr) | |||
| 307 | return 0; | 307 | return 0; |
| 308 | } | 308 | } |
| 309 | 309 | ||
| 310 | switch(utype) { | 310 | switch (utype) { |
| 311 | 311 | ||
| 312 | case ASN1_GEN_FLAG_IMP: | 312 | case ASN1_GEN_FLAG_IMP: |
| 313 | /* Check for illegal multiple IMPLICIT tagging */ | 313 | /* Check for illegal multiple IMPLICIT tagging */ |
| @@ -315,12 +315,12 @@ static int asn1_cb(const char *elem, int len, void *bitstr) | |||
| 315 | ASN1err(ASN1_F_ASN1_CB, ASN1_R_ILLEGAL_NESTED_TAGGING); | 315 | ASN1err(ASN1_F_ASN1_CB, ASN1_R_ILLEGAL_NESTED_TAGGING); |
| 316 | return -1; | 316 | return -1; |
| 317 | } | 317 | } |
| 318 | if (!parse_tagging(vstart, vlen, &arg->imp_tag, &arg->imp_class)) | 318 | if (!parse_tagging(vstart, vlen, &arg->imp_tag, |
| 319 | &arg->imp_class)) | ||
| 319 | return -1; | 320 | return -1; |
| 320 | break; | 321 | break; |
| 321 | 322 | ||
| 322 | case ASN1_GEN_FLAG_EXP: | 323 | case ASN1_GEN_FLAG_EXP: |
| 323 | |||
| 324 | if (!parse_tagging(vstart, vlen, &tmp_tag, &tmp_class)) | 324 | if (!parse_tagging(vstart, vlen, &tmp_tag, &tmp_class)) |
| 325 | return -1; | 325 | return -1; |
| 326 | if (!append_exp(arg, tmp_tag, tmp_class, 1, 0, 0)) | 326 | if (!append_exp(arg, tmp_tag, tmp_class, 1, 0, 0)) |
| @@ -365,14 +365,15 @@ static int asn1_cb(const char *elem, int len, void *bitstr) | |||
| 365 | } | 365 | } |
| 366 | 366 | ||
| 367 | return 1; | 367 | return 1; |
| 368 | |||
| 369 | } | 368 | } |
| 370 | 369 | ||
| 371 | static int parse_tagging(const char *vstart, int vlen, int *ptag, int *pclass) | 370 | static int |
| 371 | parse_tagging(const char *vstart, int vlen, int *ptag, int *pclass) | ||
| 372 | { | 372 | { |
| 373 | char erch[2]; | 373 | char erch[2]; |
| 374 | long tag_num; | 374 | long tag_num; |
| 375 | char *eptr; | 375 | char *eptr; |
| 376 | |||
| 376 | if (!vstart) | 377 | if (!vstart) |
| 377 | return 0; | 378 | return 0; |
| 378 | tag_num = strtoul(vstart, &eptr, 10); | 379 | tag_num = strtoul(vstart, &eptr, 10); |
| @@ -387,7 +388,7 @@ static int parse_tagging(const char *vstart, int vlen, int *ptag, int *pclass) | |||
| 387 | /* If we have non numeric characters, parse them */ | 388 | /* If we have non numeric characters, parse them */ |
| 388 | if (eptr) | 389 | if (eptr) |
| 389 | vlen -= eptr - vstart; | 390 | vlen -= eptr - vstart; |
| 390 | else | 391 | else |
| 391 | vlen = 0; | 392 | vlen = 0; |
| 392 | if (vlen) { | 393 | if (vlen) { |
| 393 | switch (*eptr) { | 394 | switch (*eptr) { |
| @@ -408,7 +409,7 @@ static int parse_tagging(const char *vstart, int vlen, int *ptag, int *pclass) | |||
| 408 | *pclass = V_ASN1_CONTEXT_SPECIFIC; | 409 | *pclass = V_ASN1_CONTEXT_SPECIFIC; |
| 409 | break; | 410 | break; |
| 410 | 411 | ||
| 411 | default: | 412 | default: |
| 412 | erch[0] = *eptr; | 413 | erch[0] = *eptr; |
| 413 | erch[1] = 0; | 414 | erch[1] = 0; |
| 414 | ASN1err(ASN1_F_PARSE_TAGGING, ASN1_R_INVALID_MODIFIER); | 415 | ASN1err(ASN1_F_PARSE_TAGGING, ASN1_R_INVALID_MODIFIER); |
| @@ -417,8 +418,7 @@ static int parse_tagging(const char *vstart, int vlen, int *ptag, int *pclass) | |||
| 417 | break; | 418 | break; |
| 418 | 419 | ||
| 419 | } | 420 | } |
| 420 | } | 421 | } else |
| 421 | else | ||
| 422 | *pclass = V_ASN1_CONTEXT_SPECIFIC; | 422 | *pclass = V_ASN1_CONTEXT_SPECIFIC; |
| 423 | 423 | ||
| 424 | return 1; | 424 | return 1; |
| @@ -427,7 +427,8 @@ static int parse_tagging(const char *vstart, int vlen, int *ptag, int *pclass) | |||
| 427 | 427 | ||
| 428 | /* Handle multiple types: SET and SEQUENCE */ | 428 | /* Handle multiple types: SET and SEQUENCE */ |
| 429 | 429 | ||
| 430 | static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf) | 430 | static ASN1_TYPE * |
| 431 | asn1_multi(int utype, const char *section, X509V3_CTX *cnf) | ||
| 431 | { | 432 | { |
| 432 | ASN1_TYPE *ret = NULL; | 433 | ASN1_TYPE *ret = NULL; |
| 433 | STACK_OF(ASN1_TYPE) *sk = NULL; | 434 | STACK_OF(ASN1_TYPE) *sk = NULL; |
| @@ -445,7 +446,8 @@ static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf) | |||
| 445 | if (!sect) | 446 | if (!sect) |
| 446 | goto bad; | 447 | goto bad; |
| 447 | for (i = 0; i < sk_CONF_VALUE_num(sect); i++) { | 448 | for (i = 0; i < sk_CONF_VALUE_num(sect); i++) { |
| 448 | ASN1_TYPE *typ = ASN1_generate_v3(sk_CONF_VALUE_value(sect, i)->value, cnf); | 449 | ASN1_TYPE *typ = ASN1_generate_v3( |
| 450 | sk_CONF_VALUE_value(sect, i)->value, cnf); | ||
| 449 | if (!typ) | 451 | if (!typ) |
| 450 | goto bad; | 452 | goto bad; |
| 451 | if (!sk_ASN1_TYPE_push(sk, typ)) | 453 | if (!sk_ASN1_TYPE_push(sk, typ)) |
| @@ -476,11 +478,9 @@ static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf) | |||
| 476 | 478 | ||
| 477 | der = NULL; | 479 | der = NULL; |
| 478 | 480 | ||
| 479 | bad: | 481 | bad: |
| 480 | |||
| 481 | if (der) | 482 | if (der) |
| 482 | free(der); | 483 | free(der); |
| 483 | |||
| 484 | if (sk) | 484 | if (sk) |
| 485 | sk_ASN1_TYPE_pop_free(sk, ASN1_TYPE_free); | 485 | sk_ASN1_TYPE_pop_free(sk, ASN1_TYPE_free); |
| 486 | if (sect) | 486 | if (sect) |
| @@ -489,9 +489,12 @@ static ASN1_TYPE *asn1_multi(int utype, const char *section, X509V3_CTX *cnf) | |||
| 489 | return ret; | 489 | return ret; |
| 490 | } | 490 | } |
| 491 | 491 | ||
| 492 | static int append_exp(tag_exp_arg *arg, int exp_tag, int exp_class, int exp_constructed, int exp_pad, int imp_ok) | 492 | static int |
| 493 | append_exp(tag_exp_arg *arg, int exp_tag, int exp_class, int exp_constructed, | ||
| 494 | int exp_pad, int imp_ok) | ||
| 493 | { | 495 | { |
| 494 | tag_exp_type *exp_tmp; | 496 | tag_exp_type *exp_tmp; |
| 497 | |||
| 495 | /* Can only have IMPLICIT if permitted */ | 498 | /* Can only have IMPLICIT if permitted */ |
| 496 | if ((arg->imp_tag != -1) && !imp_ok) { | 499 | if ((arg->imp_tag != -1) && !imp_ok) { |
| 497 | ASN1err(ASN1_F_APPEND_EXP, ASN1_R_ILLEGAL_IMPLICIT_TAG); | 500 | ASN1err(ASN1_F_APPEND_EXP, ASN1_R_ILLEGAL_IMPLICIT_TAG); |
| @@ -523,8 +526,8 @@ static int append_exp(tag_exp_arg *arg, int exp_tag, int exp_class, int exp_cons | |||
| 523 | return 1; | 526 | return 1; |
| 524 | } | 527 | } |
| 525 | 528 | ||
| 526 | 529 | static int | |
| 527 | static int asn1_str2tag(const char *tagstr, int len) | 530 | asn1_str2tag(const char *tagstr, int len) |
| 528 | { | 531 | { |
| 529 | unsigned int i; | 532 | unsigned int i; |
| 530 | static const struct tag_name_st *tntmp, tnst [] = { | 533 | static const struct tag_name_st *tntmp, tnst [] = { |
| @@ -586,29 +589,28 @@ static int asn1_str2tag(const char *tagstr, int len) | |||
| 586 | ASN1_GEN_STR("BITWRAP", ASN1_GEN_FLAG_BITWRAP), | 589 | ASN1_GEN_STR("BITWRAP", ASN1_GEN_FLAG_BITWRAP), |
| 587 | ASN1_GEN_STR("FORM", ASN1_GEN_FLAG_FORMAT), | 590 | ASN1_GEN_STR("FORM", ASN1_GEN_FLAG_FORMAT), |
| 588 | ASN1_GEN_STR("FORMAT", ASN1_GEN_FLAG_FORMAT), | 591 | ASN1_GEN_STR("FORMAT", ASN1_GEN_FLAG_FORMAT), |
| 589 | }; | 592 | }; |
| 590 | 593 | ||
| 591 | if (len == -1) | 594 | if (len == -1) |
| 592 | len = strlen(tagstr); | 595 | len = strlen(tagstr); |
| 593 | 596 | ||
| 594 | tntmp = tnst; | 597 | tntmp = tnst; |
| 595 | for (i = 0; i < sizeof(tnst) / sizeof(struct tag_name_st); i++, tntmp++) { | 598 | for (i = 0; i < sizeof(tnst) / sizeof(struct tag_name_st); |
| 599 | i++, tntmp++) { | ||
| 596 | if ((len == tntmp->len) && !strncmp(tntmp->strnam, tagstr, len)) | 600 | if ((len == tntmp->len) && !strncmp(tntmp->strnam, tagstr, len)) |
| 597 | return tntmp->tag; | 601 | return tntmp->tag; |
| 598 | } | 602 | } |
| 599 | 603 | ||
| 600 | return -1; | 604 | return -1; |
| 601 | } | 605 | } |
| 602 | 606 | ||
| 603 | static ASN1_TYPE *asn1_str2type(const char *str, int format, int utype) | 607 | static ASN1_TYPE * |
| 608 | asn1_str2type(const char *str, int format, int utype) | ||
| 604 | { | 609 | { |
| 605 | ASN1_TYPE *atmp = NULL; | 610 | ASN1_TYPE *atmp = NULL; |
| 606 | |||
| 607 | CONF_VALUE vtmp; | 611 | CONF_VALUE vtmp; |
| 608 | |||
| 609 | unsigned char *rdata; | 612 | unsigned char *rdata; |
| 610 | long rdlen; | 613 | long rdlen; |
| 611 | |||
| 612 | int no_unused = 1; | 614 | int no_unused = 1; |
| 613 | 615 | ||
| 614 | if (!(atmp = ASN1_TYPE_new())) { | 616 | if (!(atmp = ASN1_TYPE_new())) { |
| @@ -619,15 +621,16 @@ static ASN1_TYPE *asn1_str2type(const char *str, int format, int utype) | |||
| 619 | if (!str) | 621 | if (!str) |
| 620 | str = ""; | 622 | str = ""; |
| 621 | 623 | ||
| 622 | switch(utype) { | 624 | switch (utype) { |
| 623 | 625 | ||
| 624 | case V_ASN1_NULL: | 626 | case V_ASN1_NULL: |
| 625 | if (str && *str) { | 627 | if (str && *str) { |
| 626 | ASN1err(ASN1_F_ASN1_STR2TYPE, ASN1_R_ILLEGAL_NULL_VALUE); | 628 | ASN1err(ASN1_F_ASN1_STR2TYPE, |
| 629 | ASN1_R_ILLEGAL_NULL_VALUE); | ||
| 627 | goto bad_form; | 630 | goto bad_form; |
| 628 | } | 631 | } |
| 629 | break; | 632 | break; |
| 630 | 633 | ||
| 631 | case V_ASN1_BOOLEAN: | 634 | case V_ASN1_BOOLEAN: |
| 632 | if (format != ASN1_GEN_FORMAT_ASCII) { | 635 | if (format != ASN1_GEN_FORMAT_ASCII) { |
| 633 | ASN1err(ASN1_F_ASN1_STR2TYPE, ASN1_R_NOT_ASCII_FORMAT); | 636 | ASN1err(ASN1_F_ASN1_STR2TYPE, ASN1_R_NOT_ASCII_FORMAT); |
| @@ -645,10 +648,12 @@ static ASN1_TYPE *asn1_str2type(const char *str, int format, int utype) | |||
| 645 | case V_ASN1_INTEGER: | 648 | case V_ASN1_INTEGER: |
| 646 | case V_ASN1_ENUMERATED: | 649 | case V_ASN1_ENUMERATED: |
| 647 | if (format != ASN1_GEN_FORMAT_ASCII) { | 650 | if (format != ASN1_GEN_FORMAT_ASCII) { |
| 648 | ASN1err(ASN1_F_ASN1_STR2TYPE, ASN1_R_INTEGER_NOT_ASCII_FORMAT); | 651 | ASN1err(ASN1_F_ASN1_STR2TYPE, |
| 652 | ASN1_R_INTEGER_NOT_ASCII_FORMAT); | ||
| 649 | goto bad_form; | 653 | goto bad_form; |
| 650 | } | 654 | } |
| 651 | if (!(atmp->value.integer = s2i_ASN1_INTEGER(NULL, (char *)str))) { | 655 | if (!(atmp->value.integer = |
| 656 | s2i_ASN1_INTEGER(NULL, (char *)str))) { | ||
| 652 | ASN1err(ASN1_F_ASN1_STR2TYPE, ASN1_R_ILLEGAL_INTEGER); | 657 | ASN1err(ASN1_F_ASN1_STR2TYPE, ASN1_R_ILLEGAL_INTEGER); |
| 653 | goto bad_str; | 658 | goto bad_str; |
| 654 | } | 659 | } |
| @@ -656,7 +661,8 @@ static ASN1_TYPE *asn1_str2type(const char *str, int format, int utype) | |||
| 656 | 661 | ||
| 657 | case V_ASN1_OBJECT: | 662 | case V_ASN1_OBJECT: |
| 658 | if (format != ASN1_GEN_FORMAT_ASCII) { | 663 | if (format != ASN1_GEN_FORMAT_ASCII) { |
| 659 | ASN1err(ASN1_F_ASN1_STR2TYPE, ASN1_R_OBJECT_NOT_ASCII_FORMAT); | 664 | ASN1err(ASN1_F_ASN1_STR2TYPE, |
| 665 | ASN1_R_OBJECT_NOT_ASCII_FORMAT); | ||
| 660 | goto bad_form; | 666 | goto bad_form; |
| 661 | } | 667 | } |
| 662 | if (!(atmp->value.object = OBJ_txt2obj(str, 0))) { | 668 | if (!(atmp->value.object = OBJ_txt2obj(str, 0))) { |
| @@ -668,7 +674,8 @@ static ASN1_TYPE *asn1_str2type(const char *str, int format, int utype) | |||
| 668 | case V_ASN1_UTCTIME: | 674 | case V_ASN1_UTCTIME: |
| 669 | case V_ASN1_GENERALIZEDTIME: | 675 | case V_ASN1_GENERALIZEDTIME: |
| 670 | if (format != ASN1_GEN_FORMAT_ASCII) { | 676 | if (format != ASN1_GEN_FORMAT_ASCII) { |
| 671 | ASN1err(ASN1_F_ASN1_STR2TYPE, ASN1_R_TIME_NOT_ASCII_FORMAT); | 677 | ASN1err(ASN1_F_ASN1_STR2TYPE, |
| 678 | ASN1_R_TIME_NOT_ASCII_FORMAT); | ||
| 672 | goto bad_form; | 679 | goto bad_form; |
| 673 | } | 680 | } |
| 674 | if (!(atmp->value.asn1_string = ASN1_STRING_new())) { | 681 | if (!(atmp->value.asn1_string = ASN1_STRING_new())) { |
| @@ -681,10 +688,10 @@ static ASN1_TYPE *asn1_str2type(const char *str, int format, int utype) | |||
| 681 | } | 688 | } |
| 682 | atmp->value.asn1_string->type = utype; | 689 | atmp->value.asn1_string->type = utype; |
| 683 | if (!ASN1_TIME_check(atmp->value.asn1_string)) { | 690 | if (!ASN1_TIME_check(atmp->value.asn1_string)) { |
| 684 | ASN1err(ASN1_F_ASN1_STR2TYPE, ASN1_R_ILLEGAL_TIME_VALUE); | 691 | ASN1err(ASN1_F_ASN1_STR2TYPE, |
| 692 | ASN1_R_ILLEGAL_TIME_VALUE); | ||
| 685 | goto bad_str; | 693 | goto bad_str; |
| 686 | } | 694 | } |
| 687 | |||
| 688 | break; | 695 | break; |
| 689 | 696 | ||
| 690 | case V_ASN1_BMPSTRING: | 697 | case V_ASN1_BMPSTRING: |
| @@ -706,20 +713,16 @@ static ASN1_TYPE *asn1_str2type(const char *str, int format, int utype) | |||
| 706 | goto bad_form; | 713 | goto bad_form; |
| 707 | } | 714 | } |
| 708 | 715 | ||
| 709 | 716 | if (ASN1_mbstring_copy(&atmp->value.asn1_string, | |
| 710 | if (ASN1_mbstring_copy(&atmp->value.asn1_string, (unsigned char *)str, | 717 | (unsigned char *)str, -1, format, |
| 711 | -1, format, ASN1_tag2bit(utype)) <= 0) { | 718 | ASN1_tag2bit(utype)) <= 0) { |
| 712 | ASN1err(ASN1_F_ASN1_STR2TYPE, ERR_R_MALLOC_FAILURE); | 719 | ASN1err(ASN1_F_ASN1_STR2TYPE, ERR_R_MALLOC_FAILURE); |
| 713 | goto bad_str; | 720 | goto bad_str; |
| 714 | } | 721 | } |
| 715 | |||
| 716 | |||
| 717 | break; | 722 | break; |
| 718 | 723 | ||
| 719 | case V_ASN1_BIT_STRING: | 724 | case V_ASN1_BIT_STRING: |
| 720 | |||
| 721 | case V_ASN1_OCTET_STRING: | 725 | case V_ASN1_OCTET_STRING: |
| 722 | |||
| 723 | if (!(atmp->value.asn1_string = ASN1_STRING_new())) { | 726 | if (!(atmp->value.asn1_string = ASN1_STRING_new())) { |
| 724 | ASN1err(ASN1_F_ASN1_STR2TYPE, ERR_R_MALLOC_FAILURE); | 727 | ASN1err(ASN1_F_ASN1_STR2TYPE, ERR_R_MALLOC_FAILURE); |
| 725 | goto bad_form; | 728 | goto bad_form; |
| @@ -728,7 +731,8 @@ static ASN1_TYPE *asn1_str2type(const char *str, int format, int utype) | |||
| 728 | if (format == ASN1_GEN_FORMAT_HEX) { | 731 | if (format == ASN1_GEN_FORMAT_HEX) { |
| 729 | 732 | ||
| 730 | if (!(rdata = string_to_hex((char *)str, &rdlen))) { | 733 | if (!(rdata = string_to_hex((char *)str, &rdlen))) { |
| 731 | ASN1err(ASN1_F_ASN1_STR2TYPE, ASN1_R_ILLEGAL_HEX); | 734 | ASN1err(ASN1_F_ASN1_STR2TYPE, |
| 735 | ASN1_R_ILLEGAL_HEX); | ||
| 732 | goto bad_str; | 736 | goto bad_str; |
| 733 | } | 737 | } |
| 734 | 738 | ||
| @@ -736,29 +740,31 @@ static ASN1_TYPE *asn1_str2type(const char *str, int format, int utype) | |||
| 736 | atmp->value.asn1_string->length = rdlen; | 740 | atmp->value.asn1_string->length = rdlen; |
| 737 | atmp->value.asn1_string->type = utype; | 741 | atmp->value.asn1_string->type = utype; |
| 738 | 742 | ||
| 739 | } | 743 | } else if (format == ASN1_GEN_FORMAT_ASCII) |
| 740 | else if (format == ASN1_GEN_FORMAT_ASCII) | ||
| 741 | ASN1_STRING_set(atmp->value.asn1_string, str, -1); | 744 | ASN1_STRING_set(atmp->value.asn1_string, str, -1); |
| 742 | else if ((format == ASN1_GEN_FORMAT_BITLIST) && (utype == V_ASN1_BIT_STRING)) { | 745 | else if ((format == ASN1_GEN_FORMAT_BITLIST) && |
| 743 | if (!CONF_parse_list(str, ',', 1, bitstr_cb, atmp->value.bit_string)) { | 746 | (utype == V_ASN1_BIT_STRING)) { |
| 744 | ASN1err(ASN1_F_ASN1_STR2TYPE, ASN1_R_LIST_ERROR); | 747 | if (!CONF_parse_list(str, ',', 1, bitstr_cb, |
| 748 | atmp->value.bit_string)) { | ||
| 749 | ASN1err(ASN1_F_ASN1_STR2TYPE, | ||
| 750 | ASN1_R_LIST_ERROR); | ||
| 745 | goto bad_str; | 751 | goto bad_str; |
| 746 | } | 752 | } |
| 747 | no_unused = 0; | 753 | no_unused = 0; |
| 748 | 754 | ||
| 749 | } else { | 755 | } else { |
| 750 | ASN1err(ASN1_F_ASN1_STR2TYPE, ASN1_R_ILLEGAL_BITSTRING_FORMAT); | 756 | ASN1err(ASN1_F_ASN1_STR2TYPE, |
| 757 | ASN1_R_ILLEGAL_BITSTRING_FORMAT); | ||
| 751 | goto bad_form; | 758 | goto bad_form; |
| 752 | } | 759 | } |
| 753 | 760 | ||
| 754 | if ((utype == V_ASN1_BIT_STRING) && no_unused) { | 761 | if ((utype == V_ASN1_BIT_STRING) && no_unused) { |
| 755 | atmp->value.asn1_string->flags | 762 | atmp->value.asn1_string->flags &= |
| 756 | &= ~(ASN1_STRING_FLAG_BITS_LEFT|0x07); | 763 | ~(ASN1_STRING_FLAG_BITS_LEFT | 0x07); |
| 757 | atmp->value.asn1_string->flags | 764 | atmp->value.asn1_string->flags |= |
| 758 | |= ASN1_STRING_FLAG_BITS_LEFT; | 765 | ASN1_STRING_FLAG_BITS_LEFT; |
| 759 | } | 766 | } |
| 760 | 767 | ||
| 761 | |||
| 762 | break; | 768 | break; |
| 763 | 769 | ||
| 764 | default: | 770 | default: |
| @@ -767,24 +773,22 @@ static ASN1_TYPE *asn1_str2type(const char *str, int format, int utype) | |||
| 767 | break; | 773 | break; |
| 768 | } | 774 | } |
| 769 | 775 | ||
| 770 | |||
| 771 | atmp->type = utype; | 776 | atmp->type = utype; |
| 772 | return atmp; | 777 | return atmp; |
| 773 | 778 | ||
| 774 | |||
| 775 | bad_str: | 779 | bad_str: |
| 776 | ERR_add_error_data(2, "string=", str); | 780 | ERR_add_error_data(2, "string=", str); |
| 777 | bad_form: | 781 | bad_form: |
| 778 | |||
| 779 | ASN1_TYPE_free(atmp); | 782 | ASN1_TYPE_free(atmp); |
| 780 | return NULL; | 783 | return NULL; |
| 781 | |||
| 782 | } | 784 | } |
| 783 | 785 | ||
| 784 | static int bitstr_cb(const char *elem, int len, void *bitstr) | 786 | static int |
| 787 | bitstr_cb(const char *elem, int len, void *bitstr) | ||
| 785 | { | 788 | { |
| 786 | long bitnum; | 789 | long bitnum; |
| 787 | char *eptr; | 790 | char *eptr; |
| 791 | |||
| 788 | if (!elem) | 792 | if (!elem) |
| 789 | return 0; | 793 | return 0; |
| 790 | bitnum = strtoul(elem, &eptr, 10); | 794 | bitnum = strtoul(elem, &eptr, 10); |
| @@ -800,4 +804,3 @@ static int bitstr_cb(const char *elem, int len, void *bitstr) | |||
| 800 | } | 804 | } |
| 801 | return 1; | 805 | return 1; |
| 802 | } | 806 | } |
| 803 | |||
diff --git a/src/lib/libcrypto/asn1/asn1_lib.c b/src/lib/libcrypto/asn1/asn1_lib.c index 7693556281..49d650b125 100644 --- a/src/lib/libcrypto/asn1/asn1_lib.c +++ b/src/lib/libcrypto/asn1/asn1_lib.c | |||
| @@ -5,21 +5,21 @@ | |||
| 5 | * This package is an SSL implementation written | 5 | * This package is an SSL implementation written |
| 6 | * by Eric Young (eay@cryptsoft.com). | 6 | * by Eric Young (eay@cryptsoft.com). |
| 7 | * The implementation was written so as to conform with Netscapes SSL. | 7 | * The implementation was written so as to conform with Netscapes SSL. |
| 8 | * | 8 | * |
| 9 | * This library is free for commercial and non-commercial use as long as | 9 | * This library is free for commercial and non-commercial use as long as |
| 10 | * the following conditions are aheared to. The following conditions | 10 | * the following conditions are aheared to. The following conditions |
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | 11 | * apply to all code found in this distribution, be it the RC4, RSA, |
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation |
| 13 | * included with this distribution is covered by the same copyright terms | 13 | * included with this distribution is covered by the same copyright terms |
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). |
| 15 | * | 15 | * |
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | 16 | * Copyright remains Eric Young's, and as such any Copyright notices in |
| 17 | * the code are not to be removed. | 17 | * the code are not to be removed. |
| 18 | * If this package is used in a product, Eric Young should be given attribution | 18 | * If this package is used in a product, Eric Young should be given attribution |
| 19 | * as the author of the parts of the library used. | 19 | * as the author of the parts of the library used. |
| 20 | * This can be in the form of a textual message at program startup or | 20 | * This can be in the form of a textual message at program startup or |
| 21 | * in documentation (online or textual) provided with the package. | 21 | * in documentation (online or textual) provided with the package. |
| 22 | * | 22 | * |
| 23 | * Redistribution and use in source and binary forms, with or without | 23 | * Redistribution and use in source and binary forms, with or without |
| 24 | * modification, are permitted provided that the following conditions | 24 | * modification, are permitted provided that the following conditions |
| 25 | * are met: | 25 | * are met: |
| @@ -34,10 +34,10 @@ | |||
| 34 | * Eric Young (eay@cryptsoft.com)" | 34 | * Eric Young (eay@cryptsoft.com)" |
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | 35 | * The word 'cryptographic' can be left out if the rouines from the library |
| 36 | * being used are not cryptographic related :-). | 36 | * being used are not cryptographic related :-). |
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | 37 | * 4. If you include any Windows specific code (or a derivative thereof) from |
| 38 | * the apps directory (application code) you must include an acknowledgement: | 38 | * the apps directory (application code) you must include an acknowledgement: |
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" |
| 40 | * | 40 | * |
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| @@ -49,7 +49,7 @@ | |||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 51 | * SUCH DAMAGE. | 51 | * SUCH DAMAGE. |
| 52 | * | 52 | * |
| 53 | * The licence and distribution terms for any publically available version or | 53 | * The licence and distribution terms for any publically available version or |
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be |
| 55 | * copied and put under another distribution licence | 55 | * copied and put under another distribution licence |
| @@ -62,192 +62,214 @@ | |||
| 62 | #include <openssl/asn1.h> | 62 | #include <openssl/asn1.h> |
| 63 | #include <openssl/asn1_mac.h> | 63 | #include <openssl/asn1_mac.h> |
| 64 | 64 | ||
| 65 | static int asn1_get_length(const unsigned char **pp,int *inf,long *rl,int max); | 65 | static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, int max); |
| 66 | static void asn1_put_length(unsigned char **pp, int length); | 66 | static void asn1_put_length(unsigned char **pp, int length); |
| 67 | const char ASN1_version[]="ASN.1" OPENSSL_VERSION_PTEXT; | 67 | const char ASN1_version[]="ASN.1" OPENSSL_VERSION_PTEXT; |
| 68 | 68 | ||
| 69 | static int _asn1_check_infinite_end(const unsigned char **p, long len) | 69 | static int |
| 70 | _asn1_check_infinite_end(const unsigned char **p, long len) | ||
| 70 | { | 71 | { |
| 71 | /* If there is 0 or 1 byte left, the length check should pick | 72 | /* If there is 0 or 1 byte left, the length check should pick |
| 72 | * things up */ | 73 | * things up */ |
| 73 | if (len <= 0) | 74 | if (len <= 0) |
| 74 | return(1); | 75 | return (1); |
| 75 | else if ((len >= 2) && ((*p)[0] == 0) && ((*p)[1] == 0)) { | 76 | else if ((len >= 2) && ((*p)[0] == 0) && ((*p)[1] == 0)) { |
| 76 | (*p)+=2; | 77 | (*p) += 2; |
| 77 | return(1); | 78 | return (1); |
| 78 | } | 79 | } |
| 79 | return(0); | 80 | return (0); |
| 80 | } | 81 | } |
| 81 | 82 | ||
| 82 | int ASN1_check_infinite_end(unsigned char **p, long len) | 83 | int |
| 84 | ASN1_check_infinite_end(unsigned char **p, long len) | ||
| 83 | { | 85 | { |
| 84 | return _asn1_check_infinite_end((const unsigned char **)p, len); | 86 | return _asn1_check_infinite_end((const unsigned char **)p, len); |
| 85 | } | 87 | } |
| 86 | 88 | ||
| 87 | int ASN1_const_check_infinite_end(const unsigned char **p, long len) | 89 | int |
| 90 | ASN1_const_check_infinite_end(const unsigned char **p, long len) | ||
| 88 | { | 91 | { |
| 89 | return _asn1_check_infinite_end(p, len); | 92 | return _asn1_check_infinite_end(p, len); |
| 90 | } | 93 | } |
| 91 | 94 | ||
| 92 | 95 | int | |
| 93 | int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, | 96 | ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, |
| 94 | int *pclass, long omax) | 97 | int *pclass, long omax) |
| 95 | { | 98 | { |
| 96 | int i,ret; | 99 | int i, ret; |
| 97 | long l; | 100 | long l; |
| 98 | const unsigned char *p= *pp; | 101 | const unsigned char *p= *pp; |
| 99 | int tag,xclass,inf; | 102 | int tag, xclass, inf; |
| 100 | long max=omax; | 103 | long max = omax; |
| 101 | 104 | ||
| 102 | if (!max) goto err; | 105 | if (!max) |
| 103 | ret=(*p&V_ASN1_CONSTRUCTED); | 106 | goto err; |
| 104 | xclass=(*p&V_ASN1_PRIVATE); | 107 | ret = (*p & V_ASN1_CONSTRUCTED); |
| 105 | i= *p&V_ASN1_PRIMITIVE_TAG; | 108 | xclass = (*p & V_ASN1_PRIVATE); |
| 109 | i= *p & V_ASN1_PRIMITIVE_TAG; | ||
| 106 | if (i == V_ASN1_PRIMITIVE_TAG) { /* high-tag */ | 110 | if (i == V_ASN1_PRIMITIVE_TAG) { /* high-tag */ |
| 107 | p++; | 111 | p++; |
| 108 | if (--max == 0) goto err; | 112 | if (--max == 0) |
| 109 | l=0; | 113 | goto err; |
| 110 | while (*p&0x80) { | 114 | l = 0; |
| 111 | l<<=7L; | 115 | while (*p & 0x80) { |
| 112 | l|= *(p++)&0x7f; | 116 | l <<= 7L; |
| 113 | if (--max == 0) goto err; | 117 | l |= *(p++) & 0x7f; |
| 114 | if (l > (INT_MAX >> 7L)) goto err; | 118 | if (--max == 0) |
| 119 | goto err; | ||
| 120 | if (l > (INT_MAX >> 7L)) | ||
| 121 | goto err; | ||
| 115 | } | 122 | } |
| 116 | l<<=7L; | 123 | l <<= 7L; |
| 117 | l|= *(p++)&0x7f; | 124 | l |= *(p++) & 0x7f; |
| 118 | tag=(int)l; | 125 | tag = (int)l; |
| 119 | if (--max == 0) goto err; | 126 | if (--max == 0) |
| 120 | } else { | 127 | goto err; |
| 121 | tag=i; | 128 | } else { |
| 129 | tag = i; | ||
| 122 | p++; | 130 | p++; |
| 123 | if (--max == 0) goto err; | 131 | if (--max == 0) |
| 132 | goto err; | ||
| 124 | } | 133 | } |
| 125 | *ptag=tag; | 134 | *ptag = tag; |
| 126 | *pclass=xclass; | 135 | *pclass = xclass; |
| 127 | if (!asn1_get_length(&p,&inf,plength,(int)max)) goto err; | 136 | if (!asn1_get_length(&p, &inf, plength, (int)max)) |
| 137 | goto err; | ||
| 128 | 138 | ||
| 129 | #if 0 | 139 | #if 0 |
| 130 | fprintf(stderr,"p=%d + *plength=%ld > omax=%ld + *pp=%d (%d > %d)\n", | 140 | fprintf(stderr, "p=%d + *plength=%ld > omax=%ld + *pp=%d (%d > %d)\n", |
| 131 | (int)p,*plength,omax,(int)*pp,(int)(p+ *plength), | 141 | (int)p, *plength, omax, (int)*pp, (int)(p+ *plength), |
| 132 | (int)(omax+ *pp)); | 142 | (int)(omax+ *pp)); |
| 133 | 143 | ||
| 134 | #endif | 144 | #endif |
| 135 | if (*plength > (omax - (p - *pp))) { | 145 | if (*plength > (omax - (p - *pp))) { |
| 136 | ASN1err(ASN1_F_ASN1_GET_OBJECT,ASN1_R_TOO_LONG); | 146 | ASN1err(ASN1_F_ASN1_GET_OBJECT, ASN1_R_TOO_LONG); |
| 137 | /* Set this so that even if things are not long enough | 147 | /* Set this so that even if things are not long enough |
| 138 | * the values are set correctly */ | 148 | * the values are set correctly */ |
| 139 | ret|=0x80; | 149 | ret |= 0x80; |
| 140 | } | 150 | } |
| 141 | *pp=p; | 151 | *pp = p; |
| 142 | return(ret|inf); | 152 | return (ret | inf); |
| 153 | |||
| 143 | err: | 154 | err: |
| 144 | ASN1err(ASN1_F_ASN1_GET_OBJECT,ASN1_R_HEADER_TOO_LONG); | 155 | ASN1err(ASN1_F_ASN1_GET_OBJECT, ASN1_R_HEADER_TOO_LONG); |
| 145 | return(0x80); | 156 | return (0x80); |
| 146 | } | 157 | } |
| 147 | 158 | ||
| 148 | static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, int max) | 159 | static int |
| 160 | asn1_get_length(const unsigned char **pp, int *inf, long *rl, int max) | ||
| 149 | { | 161 | { |
| 150 | const unsigned char *p= *pp; | 162 | const unsigned char *p= *pp; |
| 151 | unsigned long ret=0; | 163 | unsigned long ret = 0; |
| 152 | unsigned int i; | 164 | unsigned int i; |
| 153 | 165 | ||
| 154 | if (max-- < 1) return(0); | 166 | if (max-- < 1) |
| 167 | return (0); | ||
| 155 | if (*p == 0x80) { | 168 | if (*p == 0x80) { |
| 156 | *inf=1; | 169 | *inf = 1; |
| 157 | ret=0; | 170 | ret = 0; |
| 158 | p++; | 171 | p++; |
| 159 | } else { | 172 | } else { |
| 160 | *inf=0; | 173 | *inf = 0; |
| 161 | i= *p&0x7f; | 174 | i= *p & 0x7f; |
| 162 | if (*(p++) & 0x80) { | 175 | if (*(p++) & 0x80) { |
| 163 | if (i > sizeof(long)) | 176 | if (i > sizeof(long)) |
| 164 | return 0; | 177 | return 0; |
| 165 | if (max-- == 0) return(0); | 178 | if (max-- == 0) |
| 179 | return (0); | ||
| 166 | while (i-- > 0) { | 180 | while (i-- > 0) { |
| 167 | ret<<=8L; | 181 | ret <<= 8L; |
| 168 | ret|= *(p++); | 182 | ret |= *(p++); |
| 169 | if (max-- == 0) return(0); | 183 | if (max-- == 0) |
| 184 | return (0); | ||
| 170 | } | 185 | } |
| 171 | } | 186 | } else |
| 172 | else | 187 | ret = i; |
| 173 | ret=i; | ||
| 174 | } | 188 | } |
| 175 | if (ret > LONG_MAX) | 189 | if (ret > LONG_MAX) |
| 176 | return 0; | 190 | return 0; |
| 177 | *pp=p; | 191 | *pp = p; |
| 178 | *rl=(long)ret; | 192 | *rl = (long)ret; |
| 179 | return(1); | 193 | return (1); |
| 180 | } | 194 | } |
| 181 | 195 | ||
| 182 | /* class 0 is constructed | 196 | /* class 0 is constructed |
| 183 | * constructed == 2 for indefinite length constructed */ | 197 | * constructed == 2 for indefinite length constructed */ |
| 184 | void ASN1_put_object(unsigned char **pp, int constructed, int length, int tag, | 198 | void |
| 185 | int xclass) | 199 | ASN1_put_object(unsigned char **pp, int constructed, int length, int tag, |
| 200 | int xclass) | ||
| 186 | { | 201 | { |
| 187 | unsigned char *p= *pp; | 202 | unsigned char *p= *pp; |
| 188 | int i, ttag; | 203 | int i, ttag; |
| 189 | 204 | ||
| 190 | i=(constructed)?V_ASN1_CONSTRUCTED:0; | 205 | i = (constructed) ? V_ASN1_CONSTRUCTED : 0; |
| 191 | i|=(xclass&V_ASN1_PRIVATE); | 206 | i |= (xclass & V_ASN1_PRIVATE); |
| 192 | if (tag < 31) | 207 | if (tag < 31) |
| 193 | *(p++)=i|(tag&V_ASN1_PRIMITIVE_TAG); | 208 | *(p++) = i | (tag & V_ASN1_PRIMITIVE_TAG); |
| 194 | else { | 209 | else { |
| 195 | *(p++)=i|V_ASN1_PRIMITIVE_TAG; | 210 | *(p++) = i | V_ASN1_PRIMITIVE_TAG; |
| 196 | for(i = 0, ttag = tag; ttag > 0; i++) ttag >>=7; | 211 | for(i = 0, ttag = tag; ttag > 0; i++) |
| 212 | ttag >>= 7; | ||
| 197 | ttag = i; | 213 | ttag = i; |
| 198 | while(i-- > 0) { | 214 | while (i-- > 0) { |
| 199 | p[i] = tag & 0x7f; | 215 | p[i] = tag & 0x7f; |
| 200 | if(i != (ttag - 1)) p[i] |= 0x80; | 216 | if (i != (ttag - 1)) |
| 217 | p[i] |= 0x80; | ||
| 201 | tag >>= 7; | 218 | tag >>= 7; |
| 202 | } | 219 | } |
| 203 | p += ttag; | 220 | p += ttag; |
| 204 | } | 221 | } |
| 205 | if (constructed == 2) | 222 | if (constructed == 2) |
| 206 | *(p++)=0x80; | 223 | *(p++) = 0x80; |
| 207 | else | 224 | else |
| 208 | asn1_put_length(&p,length); | 225 | asn1_put_length(&p, length); |
| 209 | *pp=p; | 226 | *pp = p; |
| 210 | } | 227 | } |
| 211 | 228 | ||
| 212 | int ASN1_put_eoc(unsigned char **pp) | 229 | int |
| 230 | ASN1_put_eoc(unsigned char **pp) | ||
| 213 | { | 231 | { |
| 214 | unsigned char *p = *pp; | 232 | unsigned char *p = *pp; |
| 233 | |||
| 215 | *p++ = 0; | 234 | *p++ = 0; |
| 216 | *p++ = 0; | 235 | *p++ = 0; |
| 217 | *pp = p; | 236 | *pp = p; |
| 218 | return 2; | 237 | return 2; |
| 219 | } | 238 | } |
| 220 | 239 | ||
| 221 | static void asn1_put_length(unsigned char **pp, int length) | 240 | static void |
| 241 | asn1_put_length(unsigned char **pp, int length) | ||
| 222 | { | 242 | { |
| 223 | unsigned char *p= *pp; | 243 | unsigned char *p= *pp; |
| 224 | int i,l; | 244 | |
| 245 | int i, l; | ||
| 225 | if (length <= 127) | 246 | if (length <= 127) |
| 226 | *(p++)=(unsigned char)length; | 247 | *(p++) = (unsigned char)length; |
| 227 | else { | 248 | else { |
| 228 | l=length; | 249 | l = length; |
| 229 | for (i=0; l > 0; i++) | 250 | for (i = 0; l > 0; i++) |
| 230 | l>>=8; | 251 | l >>= 8; |
| 231 | *(p++)=i|0x80; | 252 | *(p++) = i | 0x80; |
| 232 | l=i; | 253 | l = i; |
| 233 | while (i-- > 0) { | 254 | while (i-- > 0) { |
| 234 | p[i]=length&0xff; | 255 | p[i] = length & 0xff; |
| 235 | length>>=8; | 256 | length >>= 8; |
| 236 | } | 257 | } |
| 237 | p+=l; | 258 | p += l; |
| 238 | } | 259 | } |
| 239 | *pp=p; | 260 | *pp = p; |
| 240 | } | 261 | } |
| 241 | 262 | ||
| 242 | int ASN1_object_size(int constructed, int length, int tag) | 263 | int |
| 264 | ASN1_object_size(int constructed, int length, int tag) | ||
| 243 | { | 265 | { |
| 244 | int ret; | 266 | int ret; |
| 245 | 267 | ||
| 246 | ret=length; | 268 | ret = length; |
| 247 | ret++; | 269 | ret++; |
| 248 | if (tag >= 31) { | 270 | if (tag >= 31) { |
| 249 | while (tag > 0) { | 271 | while (tag > 0) { |
| 250 | tag>>=7; | 272 | tag >>= 7; |
| 251 | ret++; | 273 | ret++; |
| 252 | } | 274 | } |
| 253 | } | 275 | } |
| @@ -256,125 +278,134 @@ int ASN1_object_size(int constructed, int length, int tag) | |||
| 256 | ret++; | 278 | ret++; |
| 257 | if (length > 127) { | 279 | if (length > 127) { |
| 258 | while (length > 0) { | 280 | while (length > 0) { |
| 259 | length>>=8; | 281 | length >>= 8; |
| 260 | ret++; | 282 | ret++; |
| 261 | } | 283 | } |
| 262 | } | 284 | } |
| 263 | return(ret); | 285 | return (ret); |
| 264 | } | 286 | } |
| 265 | 287 | ||
| 266 | static int _asn1_Finish(ASN1_const_CTX *c) | 288 | static int |
| 289 | _asn1_Finish(ASN1_const_CTX *c) | ||
| 267 | { | 290 | { |
| 268 | if ((c->inf == (1|V_ASN1_CONSTRUCTED)) && (!c->eos)) { | 291 | if ((c->inf == (1|V_ASN1_CONSTRUCTED)) && (!c->eos)) { |
| 269 | if (!ASN1_const_check_infinite_end(&c->p,c->slen)) { | 292 | if (!ASN1_const_check_infinite_end(&c->p, c->slen)) { |
| 270 | c->error=ERR_R_MISSING_ASN1_EOS; | 293 | c->error = ERR_R_MISSING_ASN1_EOS; |
| 271 | return(0); | 294 | return (0); |
| 272 | } | 295 | } |
| 273 | } | 296 | } |
| 274 | if ( ((c->slen != 0) && !(c->inf & 1)) || | 297 | if (((c->slen != 0) && !(c->inf & 1)) || |
| 275 | ((c->slen < 0) && (c->inf & 1))) { | 298 | ((c->slen < 0) && (c->inf & 1))) { |
| 276 | c->error=ERR_R_ASN1_LENGTH_MISMATCH; | 299 | c->error = ERR_R_ASN1_LENGTH_MISMATCH; |
| 277 | return(0); | 300 | return (0); |
| 278 | } | 301 | } |
| 279 | return(1); | 302 | return (1); |
| 280 | } | 303 | } |
| 281 | 304 | ||
| 282 | int asn1_Finish(ASN1_CTX *c) | 305 | int |
| 306 | asn1_Finish(ASN1_CTX *c) | ||
| 283 | { | 307 | { |
| 284 | return _asn1_Finish((ASN1_const_CTX *)c); | 308 | return _asn1_Finish((ASN1_const_CTX *)c); |
| 285 | } | 309 | } |
| 286 | 310 | ||
| 287 | int asn1_const_Finish(ASN1_const_CTX *c) | 311 | int |
| 312 | asn1_const_Finish(ASN1_const_CTX *c) | ||
| 288 | { | 313 | { |
| 289 | return _asn1_Finish(c); | 314 | return _asn1_Finish(c); |
| 290 | } | 315 | } |
| 291 | 316 | ||
| 292 | int asn1_GetSequence(ASN1_const_CTX *c, long *length) | 317 | int |
| 318 | asn1_GetSequence(ASN1_const_CTX *c, long *length) | ||
| 293 | { | 319 | { |
| 294 | const unsigned char *q; | 320 | const unsigned char *q; |
| 295 | 321 | ||
| 296 | q=c->p; | 322 | q = c->p; |
| 297 | c->inf=ASN1_get_object(&(c->p),&(c->slen),&(c->tag),&(c->xclass), | 323 | c->inf = ASN1_get_object(&(c->p), &(c->slen), &(c->tag), &(c->xclass), |
| 298 | *length); | 324 | *length); |
| 299 | if (c->inf & 0x80) { | 325 | if (c->inf & 0x80) { |
| 300 | c->error=ERR_R_BAD_GET_ASN1_OBJECT_CALL; | 326 | c->error = ERR_R_BAD_GET_ASN1_OBJECT_CALL; |
| 301 | return(0); | 327 | return (0); |
| 302 | } | 328 | } |
| 303 | if (c->tag != V_ASN1_SEQUENCE) { | 329 | if (c->tag != V_ASN1_SEQUENCE) { |
| 304 | c->error=ERR_R_EXPECTING_AN_ASN1_SEQUENCE; | 330 | c->error = ERR_R_EXPECTING_AN_ASN1_SEQUENCE; |
| 305 | return(0); | 331 | return (0); |
| 306 | } | 332 | } |
| 307 | (*length)-=(c->p-q); | 333 | (*length) -= (c->p - q); |
| 308 | if (c->max && (*length < 0)) { | 334 | if (c->max && (*length < 0)) { |
| 309 | c->error=ERR_R_ASN1_LENGTH_MISMATCH; | 335 | c->error = ERR_R_ASN1_LENGTH_MISMATCH; |
| 310 | return(0); | 336 | return (0); |
| 311 | } | 337 | } |
| 312 | if (c->inf == (1|V_ASN1_CONSTRUCTED)) | 338 | if (c->inf == (1|V_ASN1_CONSTRUCTED)) |
| 313 | c->slen= *length+ *(c->pp)-c->p; | 339 | c->slen= *length+ *(c->pp) - c->p; |
| 314 | c->eos=0; | 340 | c->eos = 0; |
| 315 | return(1); | 341 | return (1); |
| 316 | } | 342 | } |
| 317 | 343 | ||
| 318 | int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str) | 344 | int |
| 345 | ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str) | ||
| 319 | { | 346 | { |
| 320 | if (str == NULL) | 347 | if (str == NULL) |
| 321 | return 0; | 348 | return 0; |
| 322 | dst->type = str->type; | 349 | dst->type = str->type; |
| 323 | if (!ASN1_STRING_set(dst,str->data,str->length)) | 350 | if (!ASN1_STRING_set(dst, str->data, str->length)) |
| 324 | return 0; | 351 | return 0; |
| 325 | dst->flags = str->flags; | 352 | dst->flags = str->flags; |
| 326 | return 1; | 353 | return 1; |
| 327 | } | 354 | } |
| 328 | 355 | ||
| 329 | ASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *str) | 356 | ASN1_STRING * |
| 357 | ASN1_STRING_dup(const ASN1_STRING *str) | ||
| 330 | { | 358 | { |
| 331 | ASN1_STRING *ret; | 359 | ASN1_STRING *ret; |
| 360 | |||
| 332 | if (!str) | 361 | if (!str) |
| 333 | return NULL; | 362 | return NULL; |
| 334 | ret=ASN1_STRING_new(); | 363 | ret = ASN1_STRING_new(); |
| 335 | if (!ret) | 364 | if (!ret) |
| 336 | return NULL; | 365 | return NULL; |
| 337 | if (!ASN1_STRING_copy(ret,str)) { | 366 | if (!ASN1_STRING_copy(ret, str)) { |
| 338 | ASN1_STRING_free(ret); | 367 | ASN1_STRING_free(ret); |
| 339 | return NULL; | 368 | return NULL; |
| 340 | } | 369 | } |
| 341 | return ret; | 370 | return ret; |
| 342 | } | 371 | } |
| 343 | 372 | ||
| 344 | int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len) | 373 | int |
| 374 | ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len) | ||
| 345 | { | 375 | { |
| 346 | unsigned char *c; | 376 | unsigned char *c; |
| 347 | const char *data=_data; | 377 | const char *data = _data; |
| 348 | 378 | ||
| 349 | if (len < 0) { | 379 | if (len < 0) { |
| 350 | if (data == NULL) | 380 | if (data == NULL) |
| 351 | return(0); | 381 | return (0); |
| 352 | else | 382 | else |
| 353 | len=strlen(data); | 383 | len = strlen(data); |
| 354 | } | 384 | } |
| 355 | if ((str->length < len) || (str->data == NULL)) { | 385 | if ((str->length < len) || (str->data == NULL)) { |
| 356 | c=str->data; | 386 | c = str->data; |
| 357 | if (c == NULL) | 387 | if (c == NULL) |
| 358 | str->data=malloc(len+1); | 388 | str->data = malloc(len + 1); |
| 359 | else | 389 | else |
| 360 | str->data=realloc(c,len+1); | 390 | str->data = realloc(c, len + 1); |
| 361 | 391 | ||
| 362 | if (str->data == NULL) { | 392 | if (str->data == NULL) { |
| 363 | ASN1err(ASN1_F_ASN1_STRING_SET,ERR_R_MALLOC_FAILURE); | 393 | ASN1err(ASN1_F_ASN1_STRING_SET, ERR_R_MALLOC_FAILURE); |
| 364 | str->data=c; | 394 | str->data = c; |
| 365 | return(0); | 395 | return (0); |
| 366 | } | 396 | } |
| 367 | } | 397 | } |
| 368 | str->length=len; | 398 | str->length = len; |
| 369 | if (data != NULL) { | 399 | if (data != NULL) { |
| 370 | memcpy(str->data,data,len); | 400 | memcpy(str->data, data, len); |
| 371 | /* an allowance for strings :-) */ | 401 | /* an allowance for strings :-) */ |
| 372 | str->data[len]='\0'; | 402 | str->data[len]='\0'; |
| 373 | } | 403 | } |
| 374 | return(1); | 404 | return (1); |
| 375 | } | 405 | } |
| 376 | 406 | ||
| 377 | void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len) | 407 | void |
| 408 | ASN1_STRING_set0(ASN1_STRING *str, void *data, int len) | ||
| 378 | { | 409 | { |
| 379 | if (str->data) | 410 | if (str->data) |
| 380 | free(str->data); | 411 | free(str->data); |
| @@ -382,69 +413,86 @@ void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len) | |||
| 382 | str->length = len; | 413 | str->length = len; |
| 383 | } | 414 | } |
| 384 | 415 | ||
| 385 | ASN1_STRING *ASN1_STRING_new(void) | 416 | ASN1_STRING * |
| 417 | ASN1_STRING_new(void) | ||
| 386 | { | 418 | { |
| 387 | return(ASN1_STRING_type_new(V_ASN1_OCTET_STRING)); | 419 | return (ASN1_STRING_type_new(V_ASN1_OCTET_STRING)); |
| 388 | } | 420 | } |
| 389 | 421 | ||
| 390 | 422 | ASN1_STRING * | |
| 391 | ASN1_STRING *ASN1_STRING_type_new(int type) | 423 | ASN1_STRING_type_new(int type) |
| 392 | { | 424 | { |
| 393 | ASN1_STRING *ret; | 425 | ASN1_STRING *ret; |
| 394 | 426 | ||
| 395 | ret=(ASN1_STRING *)malloc(sizeof(ASN1_STRING)); | 427 | ret = (ASN1_STRING *)malloc(sizeof(ASN1_STRING)); |
| 396 | if (ret == NULL) { | 428 | if (ret == NULL) { |
| 397 | ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW,ERR_R_MALLOC_FAILURE); | 429 | ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE); |
| 398 | return(NULL); | 430 | return (NULL); |
| 399 | } | 431 | } |
| 400 | ret->length=0; | 432 | ret->length = 0; |
| 401 | ret->type=type; | 433 | ret->type = type; |
| 402 | ret->data=NULL; | 434 | ret->data = NULL; |
| 403 | ret->flags=0; | 435 | ret->flags = 0; |
| 404 | return(ret); | 436 | return (ret); |
| 405 | } | 437 | } |
| 406 | 438 | ||
| 407 | void ASN1_STRING_free(ASN1_STRING *a) | 439 | void |
| 440 | ASN1_STRING_free(ASN1_STRING *a) | ||
| 408 | { | 441 | { |
| 409 | if (a == NULL) return; | 442 | if (a == NULL) |
| 443 | return; | ||
| 410 | if (a->data && !(a->flags & ASN1_STRING_FLAG_NDEF)) | 444 | if (a->data && !(a->flags & ASN1_STRING_FLAG_NDEF)) |
| 411 | free(a->data); | 445 | free(a->data); |
| 412 | free(a); | 446 | free(a); |
| 413 | } | 447 | } |
| 414 | 448 | ||
| 415 | int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b) | 449 | int |
| 450 | ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b) | ||
| 416 | { | 451 | { |
| 417 | int i; | 452 | int i; |
| 418 | 453 | ||
| 419 | i=(a->length-b->length); | 454 | i = (a->length - b->length); |
| 420 | if (i == 0) { | 455 | if (i == 0) { |
| 421 | i=memcmp(a->data,b->data,a->length); | 456 | i = memcmp(a->data, b->data, a->length); |
| 422 | if (i == 0) | 457 | if (i == 0) |
| 423 | return(a->type-b->type); | 458 | return (a->type - b->type); |
| 424 | else | 459 | else |
| 425 | return(i); | 460 | return (i); |
| 426 | } | 461 | } else |
| 427 | else | 462 | return (i); |
| 428 | return(i); | ||
| 429 | } | 463 | } |
| 430 | 464 | ||
| 431 | void asn1_add_error(const unsigned char *address, int offset) | 465 | void |
| 466 | asn1_add_error(const unsigned char *address, int offset) | ||
| 432 | { | 467 | { |
| 433 | char buf1[DECIMAL_SIZE(address)+1],buf2[DECIMAL_SIZE(offset)+1]; | 468 | char buf1[DECIMAL_SIZE(address) + 1], buf2[DECIMAL_SIZE(offset) + 1]; |
| 434 | 469 | ||
| 435 | (void) snprintf(buf1,sizeof buf1,"%lu",(unsigned long)address); | 470 | (void) snprintf(buf1, sizeof buf1, "%lu", (unsigned long)address); |
| 436 | (void) snprintf(buf2,sizeof buf2,"%d",offset); | 471 | (void) snprintf(buf2, sizeof buf2, "%d", offset); |
| 437 | ERR_add_error_data(4,"address=",buf1," offset=",buf2); | 472 | ERR_add_error_data(4, "address=", buf1, " offset=", buf2); |
| 438 | } | 473 | } |
| 439 | 474 | ||
| 440 | int ASN1_STRING_length(const ASN1_STRING *x) | 475 | int |
| 441 | { return M_ASN1_STRING_length(x); } | 476 | ASN1_STRING_length(const ASN1_STRING *x) |
| 477 | { | ||
| 478 | return M_ASN1_STRING_length(x); | ||
| 479 | } | ||
| 442 | 480 | ||
| 443 | void ASN1_STRING_length_set(ASN1_STRING *x, int len) | 481 | void |
| 444 | { M_ASN1_STRING_length_set(x, len); return; } | 482 | ASN1_STRING_length_set(ASN1_STRING *x, int len) |
| 483 | { | ||
| 484 | M_ASN1_STRING_length_set(x, len); | ||
| 485 | return; | ||
| 486 | } | ||
| 445 | 487 | ||
| 446 | int ASN1_STRING_type(ASN1_STRING *x) | 488 | int |
| 447 | { return M_ASN1_STRING_type(x); } | 489 | ASN1_STRING_type(ASN1_STRING *x) |
| 490 | { | ||
| 491 | return M_ASN1_STRING_type(x); | ||
| 492 | } | ||
| 448 | 493 | ||
| 449 | unsigned char * ASN1_STRING_data(ASN1_STRING *x) | 494 | unsigned char * |
| 450 | { return M_ASN1_STRING_data(x); } | 495 | ASN1_STRING_data(ASN1_STRING *x) |
| 496 | { | ||
| 497 | return M_ASN1_STRING_data(x); | ||
| 498 | } | ||
diff --git a/src/lib/libcrypto/asn1/asn1_par.c b/src/lib/libcrypto/asn1/asn1_par.c index d3d2f52481..064b3dcb22 100644 --- a/src/lib/libcrypto/asn1/asn1_par.c +++ b/src/lib/libcrypto/asn1/asn1_par.c | |||
| @@ -5,21 +5,21 @@ | |||
| 5 | * This package is an SSL implementation written | 5 | * This package is an SSL implementation written |
| 6 | * by Eric Young (eay@cryptsoft.com). | 6 | * by Eric Young (eay@cryptsoft.com). |
| 7 | * The implementation was written so as to conform with Netscapes SSL. | 7 | * The implementation was written so as to conform with Netscapes SSL. |
| 8 | * | 8 | * |
| 9 | * This library is free for commercial and non-commercial use as long as | 9 | * This library is free for commercial and non-commercial use as long as |
| 10 | * the following conditions are aheared to. The following conditions | 10 | * the following conditions are aheared to. The following conditions |
| 11 | * apply to all code found in this distribution, be it the RC4, RSA, | 11 | * apply to all code found in this distribution, be it the RC4, RSA, |
| 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | 12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation |
| 13 | * included with this distribution is covered by the same copyright terms | 13 | * included with this distribution is covered by the same copyright terms |
| 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | 14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). |
| 15 | * | 15 | * |
| 16 | * Copyright remains Eric Young's, and as such any Copyright notices in | 16 | * Copyright remains Eric Young's, and as such any Copyright notices in |
| 17 | * the code are not to be removed. | 17 | * the code are not to be removed. |
| 18 | * If this package is used in a product, Eric Young should be given attribution | 18 | * If this package is used in a product, Eric Young should be given attribution |
| 19 | * as the author of the parts of the library used. | 19 | * as the author of the parts of the library used. |
| 20 | * This can be in the form of a textual message at program startup or | 20 | * This can be in the form of a textual message at program startup or |
| 21 | * in documentation (online or textual) provided with the package. | 21 | * in documentation (online or textual) provided with the package. |
| 22 | * | 22 | * |
| 23 | * Redistribution and use in source and binary forms, with or without | 23 | * Redistribution and use in source and binary forms, with or without |
| 24 | * modification, are permitted provided that the following conditions | 24 | * modification, are permitted provided that the following conditions |
| 25 | * are met: | 25 | * are met: |
| @@ -34,10 +34,10 @@ | |||
| 34 | * Eric Young (eay@cryptsoft.com)" | 34 | * Eric Young (eay@cryptsoft.com)" |
| 35 | * The word 'cryptographic' can be left out if the rouines from the library | 35 | * The word 'cryptographic' can be left out if the rouines from the library |
| 36 | * being used are not cryptographic related :-). | 36 | * being used are not cryptographic related :-). |
| 37 | * 4. If you include any Windows specific code (or a derivative thereof) from | 37 | * 4. If you include any Windows specific code (or a derivative thereof) from |
| 38 | * the apps directory (application code) you must include an acknowledgement: | 38 | * the apps directory (application code) you must include an acknowledgement: |
| 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | 39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" |
| 40 | * | 40 | * |
| 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | 41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
| 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| @@ -49,7 +49,7 @@ | |||
| 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 51 | * SUCH DAMAGE. | 51 | * SUCH DAMAGE. |
| 52 | * | 52 | * |
| 53 | * The licence and distribution terms for any publically available version or | 53 | * The licence and distribution terms for any publically available version or |
| 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | 54 | * derivative of this code cannot be changed. i.e. this code cannot simply be |
| 55 | * copied and put under another distribution licence | 55 | * copied and put under another distribution licence |
| @@ -62,14 +62,16 @@ | |||
| 62 | #include <openssl/objects.h> | 62 | #include <openssl/objects.h> |
| 63 | #include <openssl/asn1.h> | 63 | #include <openssl/asn1.h> |
| 64 | 64 | ||
| 65 | static int asn1_print_info(BIO *bp, int tag, int xclass,int constructed, | ||
| 66 | int indent); | ||
| 67 | static int asn1_parse2(BIO *bp, const unsigned char **pp, long length, | ||
| 68 | int offset, int depth, int indent, int dump); | ||
| 69 | static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed, | 65 | static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed, |
| 70 | int indent) | 66 | int indent); |
| 67 | static int asn1_parse2(BIO *bp, const unsigned char **pp, long length, | ||
| 68 | int offset, int depth, int indent, int dump); | ||
| 69 | |||
| 70 | static int | ||
| 71 | asn1_print_info(BIO *bp, int tag, int xclass, int constructed, | ||
| 72 | int indent) | ||
| 71 | { | 73 | { |
| 72 | static const char fmt[]="%-18s"; | 74 | static const char fmt[] = "%-18s"; |
| 73 | char str[128]; | 75 | char str[128]; |
| 74 | const char *p; | 76 | const char *p; |
| 75 | 77 | ||
| @@ -77,47 +79,51 @@ static int asn1_print_info(BIO *bp, int tag, int xclass, int constructed, | |||
| 77 | p="cons: "; | 79 | p="cons: "; |
| 78 | else | 80 | else |
| 79 | p="prim: "; | 81 | p="prim: "; |
| 80 | if (BIO_write(bp,p,6) < 6) goto err; | 82 | if (BIO_write(bp, p, 6) < 6) |
| 81 | BIO_indent(bp,indent,128); | 83 | goto err; |
| 84 | BIO_indent(bp, indent, 128); | ||
| 82 | 85 | ||
| 83 | p=str; | 86 | p = str; |
| 84 | if ((xclass & V_ASN1_PRIVATE) == V_ASN1_PRIVATE) | 87 | if ((xclass & V_ASN1_PRIVATE) == V_ASN1_PRIVATE) |
| 85 | (void) snprintf(str,sizeof str,"priv [ %d ] ",tag); | 88 | (void) snprintf(str, sizeof str, "priv [ %d ] ", tag); |
| 86 | else if ((xclass & V_ASN1_CONTEXT_SPECIFIC) == V_ASN1_CONTEXT_SPECIFIC) | 89 | else if ((xclass & V_ASN1_CONTEXT_SPECIFIC) == V_ASN1_CONTEXT_SPECIFIC) |
| 87 | (void) snprintf(str,sizeof str,"cont [ %d ]",tag); | 90 | (void) snprintf(str, sizeof str, "cont [ %d ]", tag); |
| 88 | else if ((xclass & V_ASN1_APPLICATION) == V_ASN1_APPLICATION) | 91 | else if ((xclass & V_ASN1_APPLICATION) == V_ASN1_APPLICATION) |
| 89 | (void) snprintf(str,sizeof str,"appl [ %d ]",tag); | 92 | (void) snprintf(str, sizeof str, "appl [ %d ]", tag); |
| 90 | else if (tag > 30) | 93 | else if (tag > 30) |
| 91 | (void) snprintf(str,sizeof str,"<ASN1 %d>",tag); | 94 | (void) snprintf(str, sizeof str, "<ASN1 %d>", tag); |
| 92 | else | 95 | else |
| 93 | p = ASN1_tag2str(tag); | 96 | p = ASN1_tag2str(tag); |
| 94 | 97 | ||
| 95 | if (BIO_printf(bp,fmt,p) <= 0) | 98 | if (BIO_printf(bp, fmt, p) <= 0) |
| 96 | goto err; | 99 | goto err; |
| 97 | return(1); | 100 | return (1); |
| 98 | err: | 101 | err: |
| 99 | return(0); | 102 | return (0); |
| 100 | } | 103 | } |
| 101 | 104 | ||
| 102 | int ASN1_parse(BIO *bp, const unsigned char *pp, long len, int indent) | 105 | int |
| 106 | ASN1_parse(BIO *bp, const unsigned char *pp, long len, int indent) | ||
| 103 | { | 107 | { |
| 104 | return(asn1_parse2(bp,&pp,len,0,0,indent,0)); | 108 | return (asn1_parse2(bp, &pp, len, 0, 0, indent, 0)); |
| 105 | } | 109 | } |
| 106 | 110 | ||
| 107 | int ASN1_parse_dump(BIO *bp, const unsigned char *pp, long len, int indent, int dump) | 111 | int |
| 112 | ASN1_parse_dump(BIO *bp, const unsigned char *pp, long len, int indent, int dump) | ||
| 108 | { | 113 | { |
| 109 | return(asn1_parse2(bp,&pp,len,0,0,indent,dump)); | 114 | return (asn1_parse2(bp, &pp, len, 0, 0, indent, dump)); |
| 110 | } | 115 | } |
| 111 | 116 | ||
| 112 | static int asn1_parse2(BIO *bp, const unsigned char **pp, long length, int offset, | 117 | static int |
| 113 | int depth, int indent, int dump) | 118 | asn1_parse2(BIO *bp, const unsigned char **pp, long length, int offset, |
| 119 | int depth, int indent, int dump) | ||
| 114 | { | 120 | { |
| 115 | const unsigned char *p,*ep,*tot,*op,*opp; | 121 | const unsigned char *p, *ep, *tot, *op, *opp; |
| 116 | long len; | 122 | long len; |
| 117 | int tag,xclass,ret=0; | 123 | int tag, xclass, ret = 0; |
| 118 | int nl,hl,j,r; | 124 | int nl, hl, j, r; |
| 119 | ASN1_OBJECT *o=NULL; | 125 | ASN1_OBJECT *o = NULL; |
| 120 | ASN1_OCTET_STRING *os=NULL; | 126 | ASN1_OCTET_STRING *os = NULL; |
| 121 | /* ASN1_BMPSTRING *bmp=NULL;*/ | 127 | /* ASN1_BMPSTRING *bmp=NULL;*/ |
| 122 | int dump_indent; | 128 | int dump_indent; |
| 123 | 129 | ||
| @@ -126,179 +132,194 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length, int offse | |||
| 126 | #else | 132 | #else |
| 127 | dump_indent = 6; /* Because we know BIO_dump_indent() */ | 133 | dump_indent = 6; /* Because we know BIO_dump_indent() */ |
| 128 | #endif | 134 | #endif |
| 129 | p= *pp; | 135 | p = *pp; |
| 130 | tot=p+length; | 136 | tot = p + length; |
| 131 | op=p-1; | 137 | op = p - 1; |
| 132 | while ((p < tot) && (op < p)) { | 138 | while ((p < tot) && (op < p)) { |
| 133 | op=p; | 139 | op = p; |
| 134 | j=ASN1_get_object(&p,&len,&tag,&xclass,length); | 140 | j = ASN1_get_object(&p, &len, &tag, &xclass, length); |
| 135 | #ifdef LINT | 141 | #ifdef LINT |
| 136 | j=j; | 142 | j = j; |
| 137 | #endif | 143 | #endif |
| 138 | if (j & 0x80) { | 144 | if (j & 0x80) { |
| 139 | if (BIO_write(bp,"Error in encoding\n",18) <= 0) | 145 | if (BIO_write(bp, "Error in encoding\n", 18) <= 0) |
| 140 | goto end; | 146 | goto end; |
| 141 | ret=0; | 147 | ret = 0; |
| 142 | goto end; | 148 | goto end; |
| 143 | } | 149 | } |
| 144 | hl=(p-op); | 150 | hl = (p - op); |
| 145 | length-=hl; | 151 | length -= hl; |
| 146 | /* if j == 0x21 it is a constructed indefinite length object */ | 152 | /* if j == 0x21 it is a constructed indefinite length object */ |
| 147 | if (BIO_printf(bp,"%5ld:",(long)offset+(long)(op- *pp)) | 153 | if (BIO_printf(bp, "%5ld:", (long)offset + |
| 148 | <= 0) goto end; | 154 | (long)(op - *pp)) <= 0) |
| 155 | goto end; | ||
| 149 | 156 | ||
| 150 | if (j != (V_ASN1_CONSTRUCTED | 1)) { | 157 | if (j != (V_ASN1_CONSTRUCTED | 1)) { |
| 151 | if (BIO_printf(bp,"d=%-2d hl=%ld l=%4ld ", | 158 | if (BIO_printf(bp, "d=%-2d hl=%ld l=%4ld ", |
| 152 | depth,(long)hl,len) <= 0) | 159 | depth, (long)hl, len) <= 0) |
| 153 | goto end; | 160 | goto end; |
| 154 | } else { | 161 | } else { |
| 155 | if (BIO_printf(bp,"d=%-2d hl=%ld l=inf ", | 162 | if (BIO_printf(bp, "d=%-2d hl=%ld l=inf ", |
| 156 | depth,(long)hl) <= 0) | 163 | depth, (long)hl) <= 0) |
| 157 | goto end; | 164 | goto end; |
| 158 | } | 165 | } |
| 159 | if (!asn1_print_info(bp,tag,xclass,j,(indent)?depth:0)) | 166 | if (!asn1_print_info(bp, tag, xclass, j, (indent) ? depth : 0)) |
| 160 | goto end; | 167 | goto end; |
| 161 | if (j & V_ASN1_CONSTRUCTED) { | 168 | if (j & V_ASN1_CONSTRUCTED) { |
| 162 | ep=p+len; | 169 | ep = p + len; |
| 163 | if (BIO_write(bp,"\n",1) <= 0) goto end; | 170 | if (BIO_write(bp, "\n", 1) <= 0) |
| 171 | goto end; | ||
| 164 | if (len > length) { | 172 | if (len > length) { |
| 165 | BIO_printf(bp, | 173 | BIO_printf(bp, "length is greater than %ld\n", |
| 166 | "length is greater than %ld\n",length); | 174 | length); |
| 167 | ret=0; | 175 | ret = 0; |
| 168 | goto end; | 176 | goto end; |
| 169 | } | 177 | } |
| 170 | if ((j == 0x21) && (len == 0)) { | 178 | if ((j == 0x21) && (len == 0)) { |
| 171 | for (;;) { | 179 | for (;;) { |
| 172 | r=asn1_parse2(bp,&p,(long)(tot-p), | 180 | r = asn1_parse2(bp, &p, (long)(tot - p), |
| 173 | offset+(p - *pp),depth+1, | 181 | offset + (p - *pp), depth + 1, |
| 174 | indent,dump); | 182 | indent, dump); |
| 175 | if (r == 0) { ret=0; goto end; } | 183 | if (r == 0) { |
| 176 | if ((r == 2) || (p >= tot)) break; | 184 | ret = 0; |
| 185 | goto end; | ||
| 186 | } | ||
| 187 | if ((r == 2) || (p >= tot)) | ||
| 188 | break; | ||
| 177 | } | 189 | } |
| 178 | } | 190 | } else |
| 179 | else | ||
| 180 | while (p < ep) { | 191 | while (p < ep) { |
| 181 | r=asn1_parse2(bp,&p,(long)len, | 192 | r = asn1_parse2(bp, &p, (long)len, |
| 182 | offset+(p - *pp),depth+1, | 193 | offset + (p - *pp), depth + 1, |
| 183 | indent,dump); | 194 | indent, dump); |
| 184 | if (r == 0) { ret=0; goto end; } | 195 | if (r == 0) { |
| 196 | ret = 0; | ||
| 197 | goto end; | ||
| 198 | } | ||
| 185 | } | 199 | } |
| 186 | } else if (xclass != 0) { | 200 | } else if (xclass != 0) { |
| 187 | p+=len; | 201 | p += len; |
| 188 | if (BIO_write(bp,"\n",1) <= 0) goto end; | 202 | if (BIO_write(bp, "\n", 1) <= 0) |
| 203 | goto end; | ||
| 189 | } else { | 204 | } else { |
| 190 | nl=0; | 205 | nl = 0; |
| 191 | if ( (tag == V_ASN1_PRINTABLESTRING) || | 206 | if ((tag == V_ASN1_PRINTABLESTRING) || |
| 192 | (tag == V_ASN1_T61STRING) || | 207 | (tag == V_ASN1_T61STRING) || |
| 193 | (tag == V_ASN1_IA5STRING) || | 208 | (tag == V_ASN1_IA5STRING) || |
| 194 | (tag == V_ASN1_VISIBLESTRING) || | 209 | (tag == V_ASN1_VISIBLESTRING) || |
| 195 | (tag == V_ASN1_NUMERICSTRING) || | 210 | (tag == V_ASN1_NUMERICSTRING) || |
| 196 | (tag == V_ASN1_UTF8STRING) || | 211 | (tag == V_ASN1_UTF8STRING) || |
| 197 | (tag == V_ASN1_UTCTIME) || | 212 | (tag == V_ASN1_UTCTIME) || |
| 198 | (tag == V_ASN1_GENERALIZEDTIME)) { | 213 | (tag == V_ASN1_GENERALIZEDTIME)) { |
| 199 | if (BIO_write(bp,":",1) <= 0) goto end; | 214 | if (BIO_write(bp, ":", 1) <= 0) |
| 215 | goto end; | ||
| 200 | if ((len > 0) && | 216 | if ((len > 0) && |
| 201 | BIO_write(bp,(const char *)p,(int)len) | 217 | BIO_write(bp, (const char *)p, (int)len) != |
| 202 | != (int)len) | 218 | (int)len) |
| 203 | goto end; | 219 | goto end; |
| 204 | } else if (tag == V_ASN1_OBJECT) { | 220 | } else if (tag == V_ASN1_OBJECT) { |
| 205 | opp=op; | 221 | opp = op; |
| 206 | if (d2i_ASN1_OBJECT(&o,&opp,len+hl) != NULL) { | 222 | if (d2i_ASN1_OBJECT(&o, &opp, len + hl) != |
| 207 | if (BIO_write(bp,":",1) <= 0) goto end; | 223 | NULL) { |
| 208 | i2a_ASN1_OBJECT(bp,o); | 224 | if (BIO_write(bp, ":", 1) <= 0) |
| 225 | goto end; | ||
| 226 | i2a_ASN1_OBJECT(bp, o); | ||
| 209 | } else { | 227 | } else { |
| 210 | if (BIO_write(bp,":BAD OBJECT",11) <= 0) | 228 | if (BIO_write(bp, ":BAD OBJECT", |
| 229 | 11) <= 0) | ||
| 211 | goto end; | 230 | goto end; |
| 212 | } | 231 | } |
| 213 | } else if (tag == V_ASN1_BOOLEAN) { | 232 | } else if (tag == V_ASN1_BOOLEAN) { |
| 214 | int ii; | 233 | int ii; |
| 215 | 234 | ||
| 216 | opp=op; | 235 | opp = op; |
| 217 | ii=d2i_ASN1_BOOLEAN(NULL,&opp,len+hl); | 236 | ii = d2i_ASN1_BOOLEAN(NULL, &opp, len + hl); |
| 218 | if (ii < 0) { | 237 | if (ii < 0) { |
| 219 | if (BIO_write(bp,"Bad boolean\n",12) <= 0) | 238 | if (BIO_write(bp, "Bad boolean\n", |
| 239 | 12) <= 0) | ||
| 220 | goto end; | 240 | goto end; |
| 221 | } | 241 | } |
| 222 | BIO_printf(bp,":%d",ii); | 242 | BIO_printf(bp, ":%d", ii); |
| 223 | } else if (tag == V_ASN1_BMPSTRING) { | 243 | } else if (tag == V_ASN1_BMPSTRING) { |
| 224 | /* do the BMP thang */ | 244 | /* do the BMP thang */ |
| 225 | } else if (tag == V_ASN1_OCTET_STRING) { | 245 | } else if (tag == V_ASN1_OCTET_STRING) { |
| 226 | int i,printable=1; | 246 | int i, printable = 1; |
| 227 | 247 | ||
| 228 | opp=op; | 248 | opp = op; |
| 229 | os=d2i_ASN1_OCTET_STRING(NULL,&opp,len+hl); | 249 | os = d2i_ASN1_OCTET_STRING(NULL, &opp, len + hl); |
| 230 | if (os != NULL && os->length > 0) { | 250 | if (os != NULL && os->length > 0) { |
| 231 | opp = os->data; | 251 | opp = os->data; |
| 232 | /* testing whether the octet string is | 252 | /* testing whether the octet string is |
| 233 | * printable */ | 253 | * printable */ |
| 234 | for (i=0; i<os->length; i++) { | 254 | for (i = 0; i < os->length; i++) { |
| 235 | if (( (opp[i] < ' ') && | 255 | if (((opp[i] < ' ') && |
| 236 | (opp[i] != '\n') && | 256 | (opp[i] != '\n') && |
| 237 | (opp[i] != '\r') && | 257 | (opp[i] != '\r') && |
| 238 | (opp[i] != '\t')) || | 258 | (opp[i] != '\t')) || |
| 239 | (opp[i] > '~')) { | 259 | (opp[i] > '~')) { |
| 240 | printable=0; | 260 | printable = 0; |
| 241 | break; | 261 | break; |
| 242 | } | 262 | } |
| 243 | } | 263 | } |
| 244 | if (printable) { | 264 | if (printable) { |
| 245 | /* printable string */ | 265 | /* printable string */ |
| 246 | if (BIO_write(bp,":",1) <= 0) | 266 | if (BIO_write(bp, ":", 1) <= 0) |
| 247 | goto end; | 267 | goto end; |
| 248 | if (BIO_write(bp,(const char *)opp, | 268 | if (BIO_write(bp, (const char *)opp, |
| 249 | os->length) <= 0) | 269 | os->length) <= 0) |
| 250 | goto end; | 270 | goto end; |
| 251 | } else if (!dump) { | 271 | } else if (!dump) { |
| 252 | /* not printable => print octet string | 272 | /* not printable => print octet string |
| 253 | * as hex dump */ | 273 | * as hex dump */ |
| 254 | if (BIO_write(bp,"[HEX DUMP]:",11) <= 0) | 274 | if (BIO_write(bp, "[HEX DUMP]:", 11) <= 0) |
| 255 | goto end; | 275 | goto end; |
| 256 | for (i=0; i<os->length; i++) { | 276 | for (i = 0; i < os->length; i++) { |
| 257 | if (BIO_printf(bp,"%02X" | 277 | if (BIO_printf(bp, |
| 258 | , opp[i]) <= 0) | 278 | "%02X", opp[i]) <= 0) |
| 259 | goto end; | 279 | goto end; |
| 260 | } | 280 | } |
| 261 | } else { | 281 | } else { |
| 262 | /* print the normal dump */ | 282 | /* print the normal dump */ |
| 263 | if (!nl) { | 283 | if (!nl) { |
| 264 | if (BIO_write(bp,"\n",1) <= 0) | 284 | if (BIO_write(bp, "\n", 1) <= 0) |
| 265 | goto end; | 285 | goto end; |
| 266 | } | 286 | } |
| 267 | if (BIO_dump_indent(bp, | 287 | if (BIO_dump_indent(bp, |
| 268 | (const char *)opp, | 288 | (const char *)opp, |
| 269 | ((dump == -1 || dump > | 289 | ((dump == -1 || dump > |
| 270 | os->length)?os->length:dump), | 290 | os->length) ? os->length : dump), |
| 271 | dump_indent) <= 0) | 291 | dump_indent) <= 0) |
| 272 | goto end; | 292 | goto end; |
| 273 | nl=1; | 293 | nl = 1; |
| 274 | } | 294 | } |
| 275 | } | 295 | } |
| 276 | if (os != NULL) { | 296 | if (os != NULL) { |
| 277 | M_ASN1_OCTET_STRING_free(os); | 297 | M_ASN1_OCTET_STRING_free(os); |
| 278 | os=NULL; | 298 | os = NULL; |
| 279 | } | 299 | } |
| 280 | } else if (tag == V_ASN1_INTEGER) { | 300 | } else if (tag == V_ASN1_INTEGER) { |
| 281 | ASN1_INTEGER *bs; | 301 | ASN1_INTEGER *bs; |
| 282 | int i; | 302 | int i; |
| 283 | 303 | ||
| 284 | opp=op; | 304 | opp = op; |
| 285 | bs=d2i_ASN1_INTEGER(NULL,&opp,len+hl); | 305 | bs = d2i_ASN1_INTEGER(NULL, &opp, len + hl); |
| 286 | if (bs != NULL) { | 306 | if (bs != NULL) { |
| 287 | if (BIO_write(bp,":",1) <= 0) goto end; | 307 | if (BIO_write(bp, ":", 1) <= 0) |
| 308 | goto end; | ||
| 288 | if (bs->type == V_ASN1_NEG_INTEGER) | 309 | if (bs->type == V_ASN1_NEG_INTEGER) |
| 289 | if (BIO_write(bp,"-",1) <= 0) | 310 | if (BIO_write(bp, "-", 1) <= 0) |
| 290 | goto end; | 311 | goto end; |
| 291 | for (i=0; i<bs->length; i++) { | 312 | for (i = 0; i < bs->length; i++) { |
| 292 | if (BIO_printf(bp,"%02X", | 313 | if (BIO_printf(bp, "%02X", |
| 293 | bs->data[i]) <= 0) | 314 | bs->data[i]) <= 0) |
| 294 | goto end; | 315 | goto end; |
| 295 | } | 316 | } |
| 296 | if (bs->length == 0) { | 317 | if (bs->length == 0) { |
| 297 | if (BIO_write(bp,"00",2) <= 0) | 318 | if (BIO_write(bp, "00", 2) <= 0) |
| 298 | goto end; | 319 | goto end; |
| 299 | } | 320 | } |
| 300 | } else { | 321 | } else { |
| 301 | if (BIO_write(bp,"BAD INTEGER",11) <= 0) | 322 | if (BIO_write(bp, "BAD INTEGER", 11) <= 0) |
| 302 | goto end; | 323 | goto end; |
| 303 | } | 324 | } |
| 304 | M_ASN1_INTEGER_free(bs); | 325 | M_ASN1_INTEGER_free(bs); |
| @@ -306,75 +327,81 @@ static int asn1_parse2(BIO *bp, const unsigned char **pp, long length, int offse | |||
| 306 | ASN1_ENUMERATED *bs; | 327 | ASN1_ENUMERATED *bs; |
| 307 | int i; | 328 | int i; |
| 308 | 329 | ||
| 309 | opp=op; | 330 | opp = op; |
| 310 | bs=d2i_ASN1_ENUMERATED(NULL,&opp,len+hl); | 331 | bs = d2i_ASN1_ENUMERATED(NULL, &opp, len + hl); |
| 311 | if (bs != NULL) { | 332 | if (bs != NULL) { |
| 312 | if (BIO_write(bp,":",1) <= 0) goto end; | 333 | if (BIO_write(bp, ":", 1) <= 0) |
| 334 | goto end; | ||
| 313 | if (bs->type == V_ASN1_NEG_ENUMERATED) | 335 | if (bs->type == V_ASN1_NEG_ENUMERATED) |
| 314 | if (BIO_write(bp,"-",1) <= 0) | 336 | if (BIO_write(bp, "-", 1) <= 0) |
| 315 | goto end; | 337 | goto end; |
| 316 | for (i=0; i<bs->length; i++) { | 338 | for (i = 0; i < bs->length; i++) { |
| 317 | if (BIO_printf(bp,"%02X", | 339 | if (BIO_printf(bp, "%02X", |
| 318 | bs->data[i]) <= 0) | 340 | bs->data[i]) <= 0) |
| 319 | goto end; | 341 | goto end; |
| 320 | } | 342 | } |
| 321 | if (bs->length == 0) { | 343 | if (bs->length == 0) { |
| 322 | if (BIO_write(bp,"00",2) <= 0) | 344 | if (BIO_write(bp, "00", 2) <= 0) |
| 323 | goto end; | 345 | goto end; |
| 324 | } | 346 | } |
| 325 | } else { | 347 | } else { |
| 326 | if (BIO_write(bp,"BAD ENUMERATED",14) <= 0) | 348 | if (BIO_write(bp, "BAD ENUMERATED", 14) <= 0) |
| 327 | goto end; | 349 | goto end; |
| 328 | } | 350 | } |
| 329 | M_ASN1_ENUMERATED_free(bs); | 351 | M_ASN1_ENUMERATED_free(bs); |
| 330 | } else if (len > 0 && dump) { | 352 | } else if (len > 0 && dump) { |
| 331 | if (!nl) { | 353 | if (!nl) { |
| 332 | if (BIO_write(bp,"\n",1) <= 0) | 354 | if (BIO_write(bp, "\n", 1) <= 0) |
| 333 | goto end; | 355 | goto end; |
| 334 | } | 356 | } |
| 335 | if (BIO_dump_indent(bp,(const char *)p, | 357 | if (BIO_dump_indent(bp, (const char *)p, |
| 336 | ((dump == -1 || dump > len)?len:dump), | 358 | ((dump == -1 || dump > len) ? len : dump), |
| 337 | dump_indent) <= 0) | 359 | dump_indent) <= 0) |
| 338 | goto end; | 360 | goto end; |
| 339 | nl=1; | 361 | nl = 1; |
| 340 | } | 362 | } |
| 341 | 363 | ||
| 342 | if (!nl) { | 364 | if (!nl) { |
| 343 | if (BIO_write(bp,"\n",1) <= 0) goto end; | 365 | if (BIO_write(bp, "\n", 1) <= 0) |
| 366 | goto end; | ||
| 344 | } | 367 | } |
| 345 | p+=len; | 368 | p += len; |
| 346 | if ((tag == V_ASN1_EOC) && (xclass == 0)) { | 369 | if ((tag == V_ASN1_EOC) && (xclass == 0)) { |
| 347 | ret=2; /* End of sequence */ | 370 | ret = 2; /* End of sequence */ |
| 348 | goto end; | 371 | goto end; |
| 349 | } | 372 | } |
| 350 | } | 373 | } |
| 351 | length-=len; | 374 | length -= len; |
| 352 | } | 375 | } |
| 353 | ret=1; | 376 | ret = 1; |
| 377 | |||
| 354 | end: | 378 | end: |
| 355 | if (o != NULL) ASN1_OBJECT_free(o); | 379 | if (o != NULL) |
| 356 | if (os != NULL) M_ASN1_OCTET_STRING_free(os); | 380 | ASN1_OBJECT_free(o); |
| 357 | *pp=p; | 381 | if (os != NULL) |
| 358 | return(ret); | 382 | M_ASN1_OCTET_STRING_free(os); |
| 383 | *pp = p; | ||
| 384 | return (ret); | ||
| 359 | } | 385 | } |
| 360 | 386 | ||
| 361 | const char *ASN1_tag2str(int tag) | 387 | const char * |
| 388 | ASN1_tag2str(int tag) | ||
| 362 | { | 389 | { |
| 363 | static const char * const tag2str[] = { | 390 | static const char * const tag2str[] = { |
| 364 | "EOC", "BOOLEAN", "INTEGER", "BIT STRING", "OCTET STRING", /* 0-4 */ | 391 | "EOC", "BOOLEAN", "INTEGER", "BIT STRING", "OCTET STRING", /* 0-4 */ |
| 365 | "NULL", "OBJECT", "OBJECT DESCRIPTOR", "EXTERNAL", "REAL", /* 5-9 */ | 392 | "NULL", "OBJECT", "OBJECT DESCRIPTOR", "EXTERNAL", "REAL", /* 5-9 */ |
| 366 | "ENUMERATED", "<ASN1 11>", "UTF8STRING", "<ASN1 13>", /* 10-13 */ | 393 | "ENUMERATED", "<ASN1 11>", "UTF8STRING", "<ASN1 13>", /* 10-13 */ |
| 367 | "<ASN1 14>", "<ASN1 15>", "SEQUENCE", "SET", /* 15-17 */ | 394 | "<ASN1 14>", "<ASN1 15>", "SEQUENCE", "SET", /* 15-17 */ |
| 368 | "NUMERICSTRING", "PRINTABLESTRING", "T61STRING", /* 18-20 */ | 395 | "NUMERICSTRING", "PRINTABLESTRING", "T61STRING", /* 18-20 */ |
| 369 | "VIDEOTEXSTRING", "IA5STRING", "UTCTIME","GENERALIZEDTIME", /* 21-24 */ | 396 | "VIDEOTEXSTRING", "IA5STRING", "UTCTIME", "GENERALIZEDTIME", /* 21-24 */ |
| 370 | "GRAPHICSTRING", "VISIBLESTRING", "GENERALSTRING", /* 25-27 */ | 397 | "GRAPHICSTRING", "VISIBLESTRING", "GENERALSTRING", /* 25-27 */ |
| 371 | "UNIVERSALSTRING", "<ASN1 29>", "BMPSTRING" /* 28-30 */ | 398 | "UNIVERSALSTRING", "<ASN1 29>", "BMPSTRING" /* 28-30 */ |
| 372 | }; | 399 | }; |
| 373 | 400 | ||
| 374 | if((tag == V_ASN1_NEG_INTEGER) || (tag == V_ASN1_NEG_ENUMERATED)) | 401 | if ((tag == V_ASN1_NEG_INTEGER) || (tag == V_ASN1_NEG_ENUMERATED)) |
| 375 | tag &= ~0x100; | 402 | tag &= ~0x100; |
| 376 | 403 | ||
| 377 | if(tag < 0 || tag > 30) return "(unknown)"; | 404 | if (tag < 0 || tag > 30) |
| 405 | return "(unknown)"; | ||
| 378 | return tag2str[tag]; | 406 | return tag2str[tag]; |
| 379 | } | 407 | } |
| 380 | |||
