diff options
author | djm <> | 2006-06-27 05:05:42 +0000 |
---|---|---|
committer | djm <> | 2006-06-27 05:05:42 +0000 |
commit | f6198d4d0ab97685dc56be2d48715ed39fcc74b9 (patch) | |
tree | 6e28360095ed5ba5ef1760a419c43eef4ef6946b /src/lib/libcrypto/asn1 | |
parent | 0ff0f9d99c40072de315264b0f602bd639e7f662 (diff) | |
download | openbsd-f6198d4d0ab97685dc56be2d48715ed39fcc74b9.tar.gz openbsd-f6198d4d0ab97685dc56be2d48715ed39fcc74b9.tar.bz2 openbsd-f6198d4d0ab97685dc56be2d48715ed39fcc74b9.zip |
import of openssl-0.9.7j
Diffstat (limited to 'src/lib/libcrypto/asn1')
-rw-r--r-- | src/lib/libcrypto/asn1/asn1.h | 2 | ||||
-rw-r--r-- | src/lib/libcrypto/asn1/asn1_err.c | 324 | ||||
-rw-r--r-- | src/lib/libcrypto/asn1/tasn_dec.c | 78 | ||||
-rw-r--r-- | src/lib/libcrypto/asn1/tasn_enc.c | 9 |
4 files changed, 240 insertions, 173 deletions
diff --git a/src/lib/libcrypto/asn1/asn1.h b/src/lib/libcrypto/asn1/asn1.h index ceaeb4cbe3..0184b475a7 100644 --- a/src/lib/libcrypto/asn1/asn1.h +++ b/src/lib/libcrypto/asn1/asn1.h | |||
@@ -962,6 +962,7 @@ void ERR_load_ASN1_strings(void); | |||
962 | #define ASN1_F_ASN1_DUP 111 | 962 | #define ASN1_F_ASN1_DUP 111 |
963 | #define ASN1_F_ASN1_ENUMERATED_SET 112 | 963 | #define ASN1_F_ASN1_ENUMERATED_SET 112 |
964 | #define ASN1_F_ASN1_ENUMERATED_TO_BN 113 | 964 | #define ASN1_F_ASN1_ENUMERATED_TO_BN 113 |
965 | #define ASN1_F_ASN1_FIND_END 182 | ||
965 | #define ASN1_F_ASN1_GENERALIZEDTIME_SET 178 | 966 | #define ASN1_F_ASN1_GENERALIZEDTIME_SET 178 |
966 | #define ASN1_F_ASN1_GET_OBJECT 114 | 967 | #define ASN1_F_ASN1_GET_OBJECT 114 |
967 | #define ASN1_F_ASN1_HEADER_NEW 115 | 968 | #define ASN1_F_ASN1_HEADER_NEW 115 |
@@ -1075,6 +1076,7 @@ void ERR_load_ASN1_strings(void); | |||
1075 | #define ASN1_R_MISSING_SECOND_NUMBER 138 | 1076 | #define ASN1_R_MISSING_SECOND_NUMBER 138 |
1076 | #define ASN1_R_MSTRING_NOT_UNIVERSAL 139 | 1077 | #define ASN1_R_MSTRING_NOT_UNIVERSAL 139 |
1077 | #define ASN1_R_MSTRING_WRONG_TAG 140 | 1078 | #define ASN1_R_MSTRING_WRONG_TAG 140 |
1079 | #define ASN1_R_NESTED_ASN1_STRING 174 | ||
1078 | #define ASN1_R_NON_HEX_CHARACTERS 141 | 1080 | #define ASN1_R_NON_HEX_CHARACTERS 141 |
1079 | #define ASN1_R_NOT_ENOUGH_DATA 142 | 1081 | #define ASN1_R_NOT_ENOUGH_DATA 142 |
1080 | #define ASN1_R_NO_MATCHING_CHOICE_TYPE 143 | 1082 | #define ASN1_R_NO_MATCHING_CHOICE_TYPE 143 |
diff --git a/src/lib/libcrypto/asn1/asn1_err.c b/src/lib/libcrypto/asn1/asn1_err.c index 3b57c8fbae..315d0a0807 100644 --- a/src/lib/libcrypto/asn1/asn1_err.c +++ b/src/lib/libcrypto/asn1/asn1_err.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* crypto/asn1/asn1_err.c */ | 1 | /* crypto/asn1/asn1_err.c */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2004 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
@@ -64,169 +64,175 @@ | |||
64 | 64 | ||
65 | /* BEGIN ERROR CODES */ | 65 | /* BEGIN ERROR CODES */ |
66 | #ifndef OPENSSL_NO_ERR | 66 | #ifndef OPENSSL_NO_ERR |
67 | |||
68 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_ASN1,func,0) | ||
69 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_ASN1,0,reason) | ||
70 | |||
67 | static ERR_STRING_DATA ASN1_str_functs[]= | 71 | static ERR_STRING_DATA ASN1_str_functs[]= |
68 | { | 72 | { |
69 | {ERR_PACK(0,ASN1_F_A2D_ASN1_OBJECT,0), "a2d_ASN1_OBJECT"}, | 73 | {ERR_FUNC(ASN1_F_A2D_ASN1_OBJECT), "a2d_ASN1_OBJECT"}, |
70 | {ERR_PACK(0,ASN1_F_A2I_ASN1_ENUMERATED,0), "a2i_ASN1_ENUMERATED"}, | 74 | {ERR_FUNC(ASN1_F_A2I_ASN1_ENUMERATED), "a2i_ASN1_ENUMERATED"}, |
71 | {ERR_PACK(0,ASN1_F_A2I_ASN1_INTEGER,0), "a2i_ASN1_INTEGER"}, | 75 | {ERR_FUNC(ASN1_F_A2I_ASN1_INTEGER), "a2i_ASN1_INTEGER"}, |
72 | {ERR_PACK(0,ASN1_F_A2I_ASN1_STRING,0), "a2i_ASN1_STRING"}, | 76 | {ERR_FUNC(ASN1_F_A2I_ASN1_STRING), "a2i_ASN1_STRING"}, |
73 | {ERR_PACK(0,ASN1_F_ASN1_BIT_STRING_SET_BIT,0), "ASN1_BIT_STRING_set_bit"}, | 77 | {ERR_FUNC(ASN1_F_ASN1_BIT_STRING_SET_BIT), "ASN1_BIT_STRING_set_bit"}, |
74 | {ERR_PACK(0,ASN1_F_ASN1_CHECK_TLEN,0), "ASN1_CHECK_TLEN"}, | 78 | {ERR_FUNC(ASN1_F_ASN1_CHECK_TLEN), "ASN1_CHECK_TLEN"}, |
75 | {ERR_PACK(0,ASN1_F_ASN1_COLLATE_PRIMITIVE,0), "ASN1_COLLATE_PRIMITIVE"}, | 79 | {ERR_FUNC(ASN1_F_ASN1_COLLATE_PRIMITIVE), "ASN1_COLLATE_PRIMITIVE"}, |
76 | {ERR_PACK(0,ASN1_F_ASN1_COLLECT,0), "ASN1_COLLECT"}, | 80 | {ERR_FUNC(ASN1_F_ASN1_COLLECT), "ASN1_COLLECT"}, |
77 | {ERR_PACK(0,ASN1_F_ASN1_D2I_BIO,0), "ASN1_d2i_bio"}, | 81 | {ERR_FUNC(ASN1_F_ASN1_D2I_BIO), "ASN1_d2i_bio"}, |
78 | {ERR_PACK(0,ASN1_F_ASN1_D2I_EX_PRIMITIVE,0), "ASN1_D2I_EX_PRIMITIVE"}, | 82 | {ERR_FUNC(ASN1_F_ASN1_D2I_EX_PRIMITIVE), "ASN1_D2I_EX_PRIMITIVE"}, |
79 | {ERR_PACK(0,ASN1_F_ASN1_D2I_FP,0), "ASN1_d2i_fp"}, | 83 | {ERR_FUNC(ASN1_F_ASN1_D2I_FP), "ASN1_d2i_fp"}, |
80 | {ERR_PACK(0,ASN1_F_ASN1_DIGEST,0), "ASN1_digest"}, | 84 | {ERR_FUNC(ASN1_F_ASN1_DIGEST), "ASN1_digest"}, |
81 | {ERR_PACK(0,ASN1_F_ASN1_DO_ADB,0), "ASN1_DO_ADB"}, | 85 | {ERR_FUNC(ASN1_F_ASN1_DO_ADB), "ASN1_DO_ADB"}, |
82 | {ERR_PACK(0,ASN1_F_ASN1_DUP,0), "ASN1_dup"}, | 86 | {ERR_FUNC(ASN1_F_ASN1_DUP), "ASN1_dup"}, |
83 | {ERR_PACK(0,ASN1_F_ASN1_ENUMERATED_SET,0), "ASN1_ENUMERATED_set"}, | 87 | {ERR_FUNC(ASN1_F_ASN1_ENUMERATED_SET), "ASN1_ENUMERATED_set"}, |
84 | {ERR_PACK(0,ASN1_F_ASN1_ENUMERATED_TO_BN,0), "ASN1_ENUMERATED_to_BN"}, | 88 | {ERR_FUNC(ASN1_F_ASN1_ENUMERATED_TO_BN), "ASN1_ENUMERATED_to_BN"}, |
85 | {ERR_PACK(0,ASN1_F_ASN1_GENERALIZEDTIME_SET,0), "ASN1_GENERALIZEDTIME_set"}, | 89 | {ERR_FUNC(ASN1_F_ASN1_FIND_END), "ASN1_FIND_END"}, |
86 | {ERR_PACK(0,ASN1_F_ASN1_GET_OBJECT,0), "ASN1_get_object"}, | 90 | {ERR_FUNC(ASN1_F_ASN1_GENERALIZEDTIME_SET), "ASN1_GENERALIZEDTIME_set"}, |
87 | {ERR_PACK(0,ASN1_F_ASN1_HEADER_NEW,0), "ASN1_HEADER_new"}, | 91 | {ERR_FUNC(ASN1_F_ASN1_GET_OBJECT), "ASN1_get_object"}, |
88 | {ERR_PACK(0,ASN1_F_ASN1_I2D_BIO,0), "ASN1_i2d_bio"}, | 92 | {ERR_FUNC(ASN1_F_ASN1_HEADER_NEW), "ASN1_HEADER_new"}, |
89 | {ERR_PACK(0,ASN1_F_ASN1_I2D_FP,0), "ASN1_i2d_fp"}, | 93 | {ERR_FUNC(ASN1_F_ASN1_I2D_BIO), "ASN1_i2d_bio"}, |
90 | {ERR_PACK(0,ASN1_F_ASN1_INTEGER_SET,0), "ASN1_INTEGER_set"}, | 94 | {ERR_FUNC(ASN1_F_ASN1_I2D_FP), "ASN1_i2d_fp"}, |
91 | {ERR_PACK(0,ASN1_F_ASN1_INTEGER_TO_BN,0), "ASN1_INTEGER_to_BN"}, | 95 | {ERR_FUNC(ASN1_F_ASN1_INTEGER_SET), "ASN1_INTEGER_set"}, |
92 | {ERR_PACK(0,ASN1_F_ASN1_ITEM_EX_D2I,0), "ASN1_ITEM_EX_D2I"}, | 96 | {ERR_FUNC(ASN1_F_ASN1_INTEGER_TO_BN), "ASN1_INTEGER_to_BN"}, |
93 | {ERR_PACK(0,ASN1_F_ASN1_ITEM_NEW,0), "ASN1_item_new"}, | 97 | {ERR_FUNC(ASN1_F_ASN1_ITEM_EX_D2I), "ASN1_ITEM_EX_D2I"}, |
94 | {ERR_PACK(0,ASN1_F_ASN1_MBSTRING_COPY,0), "ASN1_mbstring_copy"}, | 98 | {ERR_FUNC(ASN1_F_ASN1_ITEM_NEW), "ASN1_item_new"}, |
95 | {ERR_PACK(0,ASN1_F_ASN1_OBJECT_NEW,0), "ASN1_OBJECT_new"}, | 99 | {ERR_FUNC(ASN1_F_ASN1_MBSTRING_COPY), "ASN1_mbstring_copy"}, |
96 | {ERR_PACK(0,ASN1_F_ASN1_PACK_STRING,0), "ASN1_pack_string"}, | 100 | {ERR_FUNC(ASN1_F_ASN1_OBJECT_NEW), "ASN1_OBJECT_new"}, |
97 | {ERR_PACK(0,ASN1_F_ASN1_PBE_SET,0), "ASN1_PBE_SET"}, | 101 | {ERR_FUNC(ASN1_F_ASN1_PACK_STRING), "ASN1_pack_string"}, |
98 | {ERR_PACK(0,ASN1_F_ASN1_SEQ_PACK,0), "ASN1_seq_pack"}, | 102 | {ERR_FUNC(ASN1_F_ASN1_PBE_SET), "ASN1_PBE_SET"}, |
99 | {ERR_PACK(0,ASN1_F_ASN1_SEQ_UNPACK,0), "ASN1_seq_unpack"}, | 103 | {ERR_FUNC(ASN1_F_ASN1_SEQ_PACK), "ASN1_seq_pack"}, |
100 | {ERR_PACK(0,ASN1_F_ASN1_SIGN,0), "ASN1_sign"}, | 104 | {ERR_FUNC(ASN1_F_ASN1_SEQ_UNPACK), "ASN1_seq_unpack"}, |
101 | {ERR_PACK(0,ASN1_F_ASN1_STRING_SET,0), "ASN1_STRING_set"}, | 105 | {ERR_FUNC(ASN1_F_ASN1_SIGN), "ASN1_sign"}, |
102 | {ERR_PACK(0,ASN1_F_ASN1_STRING_TABLE_ADD,0), "ASN1_STRING_TABLE_add"}, | 106 | {ERR_FUNC(ASN1_F_ASN1_STRING_SET), "ASN1_STRING_set"}, |
103 | {ERR_PACK(0,ASN1_F_ASN1_STRING_TYPE_NEW,0), "ASN1_STRING_type_new"}, | 107 | {ERR_FUNC(ASN1_F_ASN1_STRING_TABLE_ADD), "ASN1_STRING_TABLE_add"}, |
104 | {ERR_PACK(0,ASN1_F_ASN1_TEMPLATE_D2I,0), "ASN1_TEMPLATE_D2I"}, | 108 | {ERR_FUNC(ASN1_F_ASN1_STRING_TYPE_NEW), "ASN1_STRING_type_new"}, |
105 | {ERR_PACK(0,ASN1_F_ASN1_TEMPLATE_EX_D2I,0), "ASN1_TEMPLATE_EX_D2I"}, | 109 | {ERR_FUNC(ASN1_F_ASN1_TEMPLATE_D2I), "ASN1_TEMPLATE_D2I"}, |
106 | {ERR_PACK(0,ASN1_F_ASN1_TEMPLATE_NEW,0), "ASN1_TEMPLATE_NEW"}, | 110 | {ERR_FUNC(ASN1_F_ASN1_TEMPLATE_EX_D2I), "ASN1_TEMPLATE_EX_D2I"}, |
107 | {ERR_PACK(0,ASN1_F_ASN1_TIME_SET,0), "ASN1_TIME_set"}, | 111 | {ERR_FUNC(ASN1_F_ASN1_TEMPLATE_NEW), "ASN1_TEMPLATE_NEW"}, |
108 | {ERR_PACK(0,ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING,0), "ASN1_TYPE_get_int_octetstring"}, | 112 | {ERR_FUNC(ASN1_F_ASN1_TIME_SET), "ASN1_TIME_set"}, |
109 | {ERR_PACK(0,ASN1_F_ASN1_TYPE_GET_OCTETSTRING,0), "ASN1_TYPE_get_octetstring"}, | 113 | {ERR_FUNC(ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING), "ASN1_TYPE_get_int_octetstring"}, |
110 | {ERR_PACK(0,ASN1_F_ASN1_UNPACK_STRING,0), "ASN1_unpack_string"}, | 114 | {ERR_FUNC(ASN1_F_ASN1_TYPE_GET_OCTETSTRING), "ASN1_TYPE_get_octetstring"}, |
111 | {ERR_PACK(0,ASN1_F_ASN1_UTCTIME_SET,0), "ASN1_UTCTIME_set"}, | 115 | {ERR_FUNC(ASN1_F_ASN1_UNPACK_STRING), "ASN1_unpack_string"}, |
112 | {ERR_PACK(0,ASN1_F_ASN1_VERIFY,0), "ASN1_verify"}, | 116 | {ERR_FUNC(ASN1_F_ASN1_UTCTIME_SET), "ASN1_UTCTIME_set"}, |
113 | {ERR_PACK(0,ASN1_F_BN_TO_ASN1_ENUMERATED,0), "BN_to_ASN1_ENUMERATED"}, | 117 | {ERR_FUNC(ASN1_F_ASN1_VERIFY), "ASN1_verify"}, |
114 | {ERR_PACK(0,ASN1_F_BN_TO_ASN1_INTEGER,0), "BN_to_ASN1_INTEGER"}, | 118 | {ERR_FUNC(ASN1_F_BN_TO_ASN1_ENUMERATED), "BN_to_ASN1_ENUMERATED"}, |
115 | {ERR_PACK(0,ASN1_F_COLLECT_DATA,0), "COLLECT_DATA"}, | 119 | {ERR_FUNC(ASN1_F_BN_TO_ASN1_INTEGER), "BN_to_ASN1_INTEGER"}, |
116 | {ERR_PACK(0,ASN1_F_D2I_ASN1_BIT_STRING,0), "D2I_ASN1_BIT_STRING"}, | 120 | {ERR_FUNC(ASN1_F_COLLECT_DATA), "COLLECT_DATA"}, |
117 | {ERR_PACK(0,ASN1_F_D2I_ASN1_BOOLEAN,0), "d2i_ASN1_BOOLEAN"}, | 121 | {ERR_FUNC(ASN1_F_D2I_ASN1_BIT_STRING), "D2I_ASN1_BIT_STRING"}, |
118 | {ERR_PACK(0,ASN1_F_D2I_ASN1_BYTES,0), "d2i_ASN1_bytes"}, | 122 | {ERR_FUNC(ASN1_F_D2I_ASN1_BOOLEAN), "d2i_ASN1_BOOLEAN"}, |
119 | {ERR_PACK(0,ASN1_F_D2I_ASN1_GENERALIZEDTIME,0), "D2I_ASN1_GENERALIZEDTIME"}, | 123 | {ERR_FUNC(ASN1_F_D2I_ASN1_BYTES), "d2i_ASN1_bytes"}, |
120 | {ERR_PACK(0,ASN1_F_D2I_ASN1_HEADER,0), "d2i_ASN1_HEADER"}, | 124 | {ERR_FUNC(ASN1_F_D2I_ASN1_GENERALIZEDTIME), "D2I_ASN1_GENERALIZEDTIME"}, |
121 | {ERR_PACK(0,ASN1_F_D2I_ASN1_INTEGER,0), "D2I_ASN1_INTEGER"}, | 125 | {ERR_FUNC(ASN1_F_D2I_ASN1_HEADER), "d2i_ASN1_HEADER"}, |
122 | {ERR_PACK(0,ASN1_F_D2I_ASN1_OBJECT,0), "d2i_ASN1_OBJECT"}, | 126 | {ERR_FUNC(ASN1_F_D2I_ASN1_INTEGER), "D2I_ASN1_INTEGER"}, |
123 | {ERR_PACK(0,ASN1_F_D2I_ASN1_SET,0), "d2i_ASN1_SET"}, | 127 | {ERR_FUNC(ASN1_F_D2I_ASN1_OBJECT), "d2i_ASN1_OBJECT"}, |
124 | {ERR_PACK(0,ASN1_F_D2I_ASN1_TYPE_BYTES,0), "d2i_ASN1_type_bytes"}, | 128 | {ERR_FUNC(ASN1_F_D2I_ASN1_SET), "d2i_ASN1_SET"}, |
125 | {ERR_PACK(0,ASN1_F_D2I_ASN1_UINTEGER,0), "d2i_ASN1_UINTEGER"}, | 129 | {ERR_FUNC(ASN1_F_D2I_ASN1_TYPE_BYTES), "d2i_ASN1_type_bytes"}, |
126 | {ERR_PACK(0,ASN1_F_D2I_ASN1_UTCTIME,0), "D2I_ASN1_UTCTIME"}, | 130 | {ERR_FUNC(ASN1_F_D2I_ASN1_UINTEGER), "d2i_ASN1_UINTEGER"}, |
127 | {ERR_PACK(0,ASN1_F_D2I_NETSCAPE_RSA,0), "d2i_Netscape_RSA"}, | 131 | {ERR_FUNC(ASN1_F_D2I_ASN1_UTCTIME), "D2I_ASN1_UTCTIME"}, |
128 | {ERR_PACK(0,ASN1_F_D2I_NETSCAPE_RSA_2,0), "D2I_NETSCAPE_RSA_2"}, | 132 | {ERR_FUNC(ASN1_F_D2I_NETSCAPE_RSA), "d2i_Netscape_RSA"}, |
129 | {ERR_PACK(0,ASN1_F_D2I_PRIVATEKEY,0), "d2i_PrivateKey"}, | 133 | {ERR_FUNC(ASN1_F_D2I_NETSCAPE_RSA_2), "D2I_NETSCAPE_RSA_2"}, |
130 | {ERR_PACK(0,ASN1_F_D2I_PUBLICKEY,0), "d2i_PublicKey"}, | 134 | {ERR_FUNC(ASN1_F_D2I_PRIVATEKEY), "d2i_PrivateKey"}, |
131 | {ERR_PACK(0,ASN1_F_D2I_X509,0), "D2I_X509"}, | 135 | {ERR_FUNC(ASN1_F_D2I_PUBLICKEY), "d2i_PublicKey"}, |
132 | {ERR_PACK(0,ASN1_F_D2I_X509_CINF,0), "D2I_X509_CINF"}, | 136 | {ERR_FUNC(ASN1_F_D2I_X509), "D2I_X509"}, |
133 | {ERR_PACK(0,ASN1_F_D2I_X509_NAME,0), "D2I_X509_NAME"}, | 137 | {ERR_FUNC(ASN1_F_D2I_X509_CINF), "D2I_X509_CINF"}, |
134 | {ERR_PACK(0,ASN1_F_D2I_X509_PKEY,0), "d2i_X509_PKEY"}, | 138 | {ERR_FUNC(ASN1_F_D2I_X509_NAME), "D2I_X509_NAME"}, |
135 | {ERR_PACK(0,ASN1_F_I2D_ASN1_SET,0), "i2d_ASN1_SET"}, | 139 | {ERR_FUNC(ASN1_F_D2I_X509_PKEY), "d2i_X509_PKEY"}, |
136 | {ERR_PACK(0,ASN1_F_I2D_ASN1_TIME,0), "I2D_ASN1_TIME"}, | 140 | {ERR_FUNC(ASN1_F_I2D_ASN1_SET), "i2d_ASN1_SET"}, |
137 | {ERR_PACK(0,ASN1_F_I2D_DSA_PUBKEY,0), "i2d_DSA_PUBKEY"}, | 141 | {ERR_FUNC(ASN1_F_I2D_ASN1_TIME), "I2D_ASN1_TIME"}, |
138 | {ERR_PACK(0,ASN1_F_I2D_NETSCAPE_RSA,0), "i2d_Netscape_RSA"}, | 142 | {ERR_FUNC(ASN1_F_I2D_DSA_PUBKEY), "i2d_DSA_PUBKEY"}, |
139 | {ERR_PACK(0,ASN1_F_I2D_PRIVATEKEY,0), "i2d_PrivateKey"}, | 143 | {ERR_FUNC(ASN1_F_I2D_NETSCAPE_RSA), "i2d_Netscape_RSA"}, |
140 | {ERR_PACK(0,ASN1_F_I2D_PUBLICKEY,0), "i2d_PublicKey"}, | 144 | {ERR_FUNC(ASN1_F_I2D_PRIVATEKEY), "i2d_PrivateKey"}, |
141 | {ERR_PACK(0,ASN1_F_I2D_RSA_PUBKEY,0), "i2d_RSA_PUBKEY"}, | 145 | {ERR_FUNC(ASN1_F_I2D_PUBLICKEY), "i2d_PublicKey"}, |
142 | {ERR_PACK(0,ASN1_F_LONG_C2I,0), "LONG_C2I"}, | 146 | {ERR_FUNC(ASN1_F_I2D_RSA_PUBKEY), "i2d_RSA_PUBKEY"}, |
143 | {ERR_PACK(0,ASN1_F_OID_MODULE_INIT,0), "OID_MODULE_INIT"}, | 147 | {ERR_FUNC(ASN1_F_LONG_C2I), "LONG_C2I"}, |
144 | {ERR_PACK(0,ASN1_F_PKCS5_PBE2_SET,0), "PKCS5_pbe2_set"}, | 148 | {ERR_FUNC(ASN1_F_OID_MODULE_INIT), "OID_MODULE_INIT"}, |
145 | {ERR_PACK(0,ASN1_F_X509_CINF_NEW,0), "X509_CINF_NEW"}, | 149 | {ERR_FUNC(ASN1_F_PKCS5_PBE2_SET), "PKCS5_pbe2_set"}, |
146 | {ERR_PACK(0,ASN1_F_X509_CRL_ADD0_REVOKED,0), "X509_CRL_add0_revoked"}, | 150 | {ERR_FUNC(ASN1_F_X509_CINF_NEW), "X509_CINF_NEW"}, |
147 | {ERR_PACK(0,ASN1_F_X509_INFO_NEW,0), "X509_INFO_new"}, | 151 | {ERR_FUNC(ASN1_F_X509_CRL_ADD0_REVOKED), "X509_CRL_add0_revoked"}, |
148 | {ERR_PACK(0,ASN1_F_X509_NAME_NEW,0), "X509_NAME_NEW"}, | 152 | {ERR_FUNC(ASN1_F_X509_INFO_NEW), "X509_INFO_new"}, |
149 | {ERR_PACK(0,ASN1_F_X509_NEW,0), "X509_NEW"}, | 153 | {ERR_FUNC(ASN1_F_X509_NAME_NEW), "X509_NAME_NEW"}, |
150 | {ERR_PACK(0,ASN1_F_X509_PKEY_NEW,0), "X509_PKEY_new"}, | 154 | {ERR_FUNC(ASN1_F_X509_NEW), "X509_NEW"}, |
155 | {ERR_FUNC(ASN1_F_X509_PKEY_NEW), "X509_PKEY_new"}, | ||
151 | {0,NULL} | 156 | {0,NULL} |
152 | }; | 157 | }; |
153 | 158 | ||
154 | static ERR_STRING_DATA ASN1_str_reasons[]= | 159 | static ERR_STRING_DATA ASN1_str_reasons[]= |
155 | { | 160 | { |
156 | {ASN1_R_ADDING_OBJECT ,"adding object"}, | 161 | {ERR_REASON(ASN1_R_ADDING_OBJECT) ,"adding object"}, |
157 | {ASN1_R_AUX_ERROR ,"aux error"}, | 162 | {ERR_REASON(ASN1_R_AUX_ERROR) ,"aux error"}, |
158 | {ASN1_R_BAD_CLASS ,"bad class"}, | 163 | {ERR_REASON(ASN1_R_BAD_CLASS) ,"bad class"}, |
159 | {ASN1_R_BAD_OBJECT_HEADER ,"bad object header"}, | 164 | {ERR_REASON(ASN1_R_BAD_OBJECT_HEADER) ,"bad object header"}, |
160 | {ASN1_R_BAD_PASSWORD_READ ,"bad password read"}, | 165 | {ERR_REASON(ASN1_R_BAD_PASSWORD_READ) ,"bad password read"}, |
161 | {ASN1_R_BAD_TAG ,"bad tag"}, | 166 | {ERR_REASON(ASN1_R_BAD_TAG) ,"bad tag"}, |
162 | {ASN1_R_BN_LIB ,"bn lib"}, | 167 | {ERR_REASON(ASN1_R_BN_LIB) ,"bn lib"}, |
163 | {ASN1_R_BOOLEAN_IS_WRONG_LENGTH ,"boolean is wrong length"}, | 168 | {ERR_REASON(ASN1_R_BOOLEAN_IS_WRONG_LENGTH),"boolean is wrong length"}, |
164 | {ASN1_R_BUFFER_TOO_SMALL ,"buffer too small"}, | 169 | {ERR_REASON(ASN1_R_BUFFER_TOO_SMALL) ,"buffer too small"}, |
165 | {ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER ,"cipher has no object identifier"}, | 170 | {ERR_REASON(ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER),"cipher has no object identifier"}, |
166 | {ASN1_R_DATA_IS_WRONG ,"data is wrong"}, | 171 | {ERR_REASON(ASN1_R_DATA_IS_WRONG) ,"data is wrong"}, |
167 | {ASN1_R_DECODE_ERROR ,"decode error"}, | 172 | {ERR_REASON(ASN1_R_DECODE_ERROR) ,"decode error"}, |
168 | {ASN1_R_DECODING_ERROR ,"decoding error"}, | 173 | {ERR_REASON(ASN1_R_DECODING_ERROR) ,"decoding error"}, |
169 | {ASN1_R_ENCODE_ERROR ,"encode error"}, | 174 | {ERR_REASON(ASN1_R_ENCODE_ERROR) ,"encode error"}, |
170 | {ASN1_R_ERROR_GETTING_TIME ,"error getting time"}, | 175 | {ERR_REASON(ASN1_R_ERROR_GETTING_TIME) ,"error getting time"}, |
171 | {ASN1_R_ERROR_LOADING_SECTION ,"error loading section"}, | 176 | {ERR_REASON(ASN1_R_ERROR_LOADING_SECTION),"error loading section"}, |
172 | {ASN1_R_ERROR_PARSING_SET_ELEMENT ,"error parsing set element"}, | 177 | {ERR_REASON(ASN1_R_ERROR_PARSING_SET_ELEMENT),"error parsing set element"}, |
173 | {ASN1_R_ERROR_SETTING_CIPHER_PARAMS ,"error setting cipher params"}, | 178 | {ERR_REASON(ASN1_R_ERROR_SETTING_CIPHER_PARAMS),"error setting cipher params"}, |
174 | {ASN1_R_EXPECTING_AN_INTEGER ,"expecting an integer"}, | 179 | {ERR_REASON(ASN1_R_EXPECTING_AN_INTEGER) ,"expecting an integer"}, |
175 | {ASN1_R_EXPECTING_AN_OBJECT ,"expecting an object"}, | 180 | {ERR_REASON(ASN1_R_EXPECTING_AN_OBJECT) ,"expecting an object"}, |
176 | {ASN1_R_EXPECTING_A_BOOLEAN ,"expecting a boolean"}, | 181 | {ERR_REASON(ASN1_R_EXPECTING_A_BOOLEAN) ,"expecting a boolean"}, |
177 | {ASN1_R_EXPECTING_A_TIME ,"expecting a time"}, | 182 | {ERR_REASON(ASN1_R_EXPECTING_A_TIME) ,"expecting a time"}, |
178 | {ASN1_R_EXPLICIT_LENGTH_MISMATCH ,"explicit length mismatch"}, | 183 | {ERR_REASON(ASN1_R_EXPLICIT_LENGTH_MISMATCH),"explicit length mismatch"}, |
179 | {ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED ,"explicit tag not constructed"}, | 184 | {ERR_REASON(ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED),"explicit tag not constructed"}, |
180 | {ASN1_R_FIELD_MISSING ,"field missing"}, | 185 | {ERR_REASON(ASN1_R_FIELD_MISSING) ,"field missing"}, |
181 | {ASN1_R_FIRST_NUM_TOO_LARGE ,"first num too large"}, | 186 | {ERR_REASON(ASN1_R_FIRST_NUM_TOO_LARGE) ,"first num too large"}, |
182 | {ASN1_R_HEADER_TOO_LONG ,"header too long"}, | 187 | {ERR_REASON(ASN1_R_HEADER_TOO_LONG) ,"header too long"}, |
183 | {ASN1_R_ILLEGAL_CHARACTERS ,"illegal characters"}, | 188 | {ERR_REASON(ASN1_R_ILLEGAL_CHARACTERS) ,"illegal characters"}, |
184 | {ASN1_R_ILLEGAL_NULL ,"illegal null"}, | 189 | {ERR_REASON(ASN1_R_ILLEGAL_NULL) ,"illegal null"}, |
185 | {ASN1_R_ILLEGAL_OPTIONAL_ANY ,"illegal optional any"}, | 190 | {ERR_REASON(ASN1_R_ILLEGAL_OPTIONAL_ANY) ,"illegal optional any"}, |
186 | {ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE ,"illegal options on item template"}, | 191 | {ERR_REASON(ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE),"illegal options on item template"}, |
187 | {ASN1_R_ILLEGAL_TAGGED_ANY ,"illegal tagged any"}, | 192 | {ERR_REASON(ASN1_R_ILLEGAL_TAGGED_ANY) ,"illegal tagged any"}, |
188 | {ASN1_R_INTEGER_TOO_LARGE_FOR_LONG ,"integer too large for long"}, | 193 | {ERR_REASON(ASN1_R_INTEGER_TOO_LARGE_FOR_LONG),"integer too large for long"}, |
189 | {ASN1_R_INVALID_BMPSTRING_LENGTH ,"invalid bmpstring length"}, | 194 | {ERR_REASON(ASN1_R_INVALID_BMPSTRING_LENGTH),"invalid bmpstring length"}, |
190 | {ASN1_R_INVALID_DIGIT ,"invalid digit"}, | 195 | {ERR_REASON(ASN1_R_INVALID_DIGIT) ,"invalid digit"}, |
191 | {ASN1_R_INVALID_SEPARATOR ,"invalid separator"}, | 196 | {ERR_REASON(ASN1_R_INVALID_SEPARATOR) ,"invalid separator"}, |
192 | {ASN1_R_INVALID_TIME_FORMAT ,"invalid time format"}, | 197 | {ERR_REASON(ASN1_R_INVALID_TIME_FORMAT) ,"invalid time format"}, |
193 | {ASN1_R_INVALID_UNIVERSALSTRING_LENGTH ,"invalid universalstring length"}, | 198 | {ERR_REASON(ASN1_R_INVALID_UNIVERSALSTRING_LENGTH),"invalid universalstring length"}, |
194 | {ASN1_R_INVALID_UTF8STRING ,"invalid utf8string"}, | 199 | {ERR_REASON(ASN1_R_INVALID_UTF8STRING) ,"invalid utf8string"}, |
195 | {ASN1_R_IV_TOO_LARGE ,"iv too large"}, | 200 | {ERR_REASON(ASN1_R_IV_TOO_LARGE) ,"iv too large"}, |
196 | {ASN1_R_LENGTH_ERROR ,"length error"}, | 201 | {ERR_REASON(ASN1_R_LENGTH_ERROR) ,"length error"}, |
197 | {ASN1_R_MISSING_EOC ,"missing eoc"}, | 202 | {ERR_REASON(ASN1_R_MISSING_EOC) ,"missing eoc"}, |
198 | {ASN1_R_MISSING_SECOND_NUMBER ,"missing second number"}, | 203 | {ERR_REASON(ASN1_R_MISSING_SECOND_NUMBER),"missing second number"}, |
199 | {ASN1_R_MSTRING_NOT_UNIVERSAL ,"mstring not universal"}, | 204 | {ERR_REASON(ASN1_R_MSTRING_NOT_UNIVERSAL),"mstring not universal"}, |
200 | {ASN1_R_MSTRING_WRONG_TAG ,"mstring wrong tag"}, | 205 | {ERR_REASON(ASN1_R_MSTRING_WRONG_TAG) ,"mstring wrong tag"}, |
201 | {ASN1_R_NON_HEX_CHARACTERS ,"non hex characters"}, | 206 | {ERR_REASON(ASN1_R_NESTED_ASN1_STRING) ,"nested asn1 string"}, |
202 | {ASN1_R_NOT_ENOUGH_DATA ,"not enough data"}, | 207 | {ERR_REASON(ASN1_R_NON_HEX_CHARACTERS) ,"non hex characters"}, |
203 | {ASN1_R_NO_MATCHING_CHOICE_TYPE ,"no matching choice type"}, | 208 | {ERR_REASON(ASN1_R_NOT_ENOUGH_DATA) ,"not enough data"}, |
204 | {ASN1_R_NULL_IS_WRONG_LENGTH ,"null is wrong length"}, | 209 | {ERR_REASON(ASN1_R_NO_MATCHING_CHOICE_TYPE),"no matching choice type"}, |
205 | {ASN1_R_ODD_NUMBER_OF_CHARS ,"odd number of chars"}, | 210 | {ERR_REASON(ASN1_R_NULL_IS_WRONG_LENGTH) ,"null is wrong length"}, |
206 | {ASN1_R_PRIVATE_KEY_HEADER_MISSING ,"private key header missing"}, | 211 | {ERR_REASON(ASN1_R_ODD_NUMBER_OF_CHARS) ,"odd number of chars"}, |
207 | {ASN1_R_SECOND_NUMBER_TOO_LARGE ,"second number too large"}, | 212 | {ERR_REASON(ASN1_R_PRIVATE_KEY_HEADER_MISSING),"private key header missing"}, |
208 | {ASN1_R_SEQUENCE_LENGTH_MISMATCH ,"sequence length mismatch"}, | 213 | {ERR_REASON(ASN1_R_SECOND_NUMBER_TOO_LARGE),"second number too large"}, |
209 | {ASN1_R_SEQUENCE_NOT_CONSTRUCTED ,"sequence not constructed"}, | 214 | {ERR_REASON(ASN1_R_SEQUENCE_LENGTH_MISMATCH),"sequence length mismatch"}, |
210 | {ASN1_R_SHORT_LINE ,"short line"}, | 215 | {ERR_REASON(ASN1_R_SEQUENCE_NOT_CONSTRUCTED),"sequence not constructed"}, |
211 | {ASN1_R_STRING_TOO_LONG ,"string too long"}, | 216 | {ERR_REASON(ASN1_R_SHORT_LINE) ,"short line"}, |
212 | {ASN1_R_STRING_TOO_SHORT ,"string too short"}, | 217 | {ERR_REASON(ASN1_R_STRING_TOO_LONG) ,"string too long"}, |
213 | {ASN1_R_TAG_VALUE_TOO_HIGH ,"tag value too high"}, | 218 | {ERR_REASON(ASN1_R_STRING_TOO_SHORT) ,"string too short"}, |
214 | {ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD,"the asn1 object identifier is not known for this md"}, | 219 | {ERR_REASON(ASN1_R_TAG_VALUE_TOO_HIGH) ,"tag value too high"}, |
215 | {ASN1_R_TOO_LONG ,"too long"}, | 220 | {ERR_REASON(ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD),"the asn1 object identifier is not known for this md"}, |
216 | {ASN1_R_TYPE_NOT_CONSTRUCTED ,"type not constructed"}, | 221 | {ERR_REASON(ASN1_R_TOO_LONG) ,"too long"}, |
217 | {ASN1_R_UNABLE_TO_DECODE_RSA_KEY ,"unable to decode rsa key"}, | 222 | {ERR_REASON(ASN1_R_TYPE_NOT_CONSTRUCTED) ,"type not constructed"}, |
218 | {ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY ,"unable to decode rsa private key"}, | 223 | {ERR_REASON(ASN1_R_UNABLE_TO_DECODE_RSA_KEY),"unable to decode rsa key"}, |
219 | {ASN1_R_UNEXPECTED_EOC ,"unexpected eoc"}, | 224 | {ERR_REASON(ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY),"unable to decode rsa private key"}, |
220 | {ASN1_R_UNKNOWN_FORMAT ,"unknown format"}, | 225 | {ERR_REASON(ASN1_R_UNEXPECTED_EOC) ,"unexpected eoc"}, |
221 | {ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM ,"unknown message digest algorithm"}, | 226 | {ERR_REASON(ASN1_R_UNKNOWN_FORMAT) ,"unknown format"}, |
222 | {ASN1_R_UNKNOWN_OBJECT_TYPE ,"unknown object type"}, | 227 | {ERR_REASON(ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM),"unknown message digest algorithm"}, |
223 | {ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE ,"unknown public key type"}, | 228 | {ERR_REASON(ASN1_R_UNKNOWN_OBJECT_TYPE) ,"unknown object type"}, |
224 | {ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE ,"unsupported any defined by type"}, | 229 | {ERR_REASON(ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE),"unknown public key type"}, |
225 | {ASN1_R_UNSUPPORTED_CIPHER ,"unsupported cipher"}, | 230 | {ERR_REASON(ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE),"unsupported any defined by type"}, |
226 | {ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM ,"unsupported encryption algorithm"}, | 231 | {ERR_REASON(ASN1_R_UNSUPPORTED_CIPHER) ,"unsupported cipher"}, |
227 | {ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE ,"unsupported public key type"}, | 232 | {ERR_REASON(ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM),"unsupported encryption algorithm"}, |
228 | {ASN1_R_WRONG_TAG ,"wrong tag"}, | 233 | {ERR_REASON(ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE),"unsupported public key type"}, |
229 | {ASN1_R_WRONG_TYPE ,"wrong type"}, | 234 | {ERR_REASON(ASN1_R_WRONG_TAG) ,"wrong tag"}, |
235 | {ERR_REASON(ASN1_R_WRONG_TYPE) ,"wrong type"}, | ||
230 | {0,NULL} | 236 | {0,NULL} |
231 | }; | 237 | }; |
232 | 238 | ||
@@ -240,8 +246,8 @@ void ERR_load_ASN1_strings(void) | |||
240 | { | 246 | { |
241 | init=0; | 247 | init=0; |
242 | #ifndef OPENSSL_NO_ERR | 248 | #ifndef OPENSSL_NO_ERR |
243 | ERR_load_strings(ERR_LIB_ASN1,ASN1_str_functs); | 249 | ERR_load_strings(0,ASN1_str_functs); |
244 | ERR_load_strings(ERR_LIB_ASN1,ASN1_str_reasons); | 250 | ERR_load_strings(0,ASN1_str_reasons); |
245 | #endif | 251 | #endif |
246 | 252 | ||
247 | } | 253 | } |
diff --git a/src/lib/libcrypto/asn1/tasn_dec.c b/src/lib/libcrypto/asn1/tasn_dec.c index 2426cb6253..c22501fc63 100644 --- a/src/lib/libcrypto/asn1/tasn_dec.c +++ b/src/lib/libcrypto/asn1/tasn_dec.c | |||
@@ -66,6 +66,7 @@ | |||
66 | #include <openssl/err.h> | 66 | #include <openssl/err.h> |
67 | 67 | ||
68 | static int asn1_check_eoc(unsigned char **in, long len); | 68 | static int asn1_check_eoc(unsigned char **in, long len); |
69 | static int asn1_find_end(unsigned char **in, long len, char inf); | ||
69 | static int asn1_collect(BUF_MEM *buf, unsigned char **in, long len, char inf, int tag, int aclass); | 70 | static int asn1_collect(BUF_MEM *buf, unsigned char **in, long len, char inf, int tag, int aclass); |
70 | static int collect_data(BUF_MEM *buf, unsigned char **p, long plen); | 71 | static int collect_data(BUF_MEM *buf, unsigned char **p, long plen); |
71 | static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, char *inf, char *cst, | 72 | static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, char *inf, char *cst, |
@@ -644,7 +645,7 @@ static int asn1_d2i_ex_primitive(ASN1_VALUE **pval, unsigned char **in, long inl | |||
644 | cont = *in; | 645 | cont = *in; |
645 | /* If indefinite length constructed find the real end */ | 646 | /* If indefinite length constructed find the real end */ |
646 | if(inf) { | 647 | if(inf) { |
647 | if(!asn1_collect(NULL, &p, plen, inf, -1, -1)) goto err; | 648 | if(!asn1_find_end(&p, plen, inf)) goto err; |
648 | len = p - cont; | 649 | len = p - cont; |
649 | } else { | 650 | } else { |
650 | len = p - cont + plen; | 651 | len = p - cont + plen; |
@@ -807,12 +808,66 @@ int asn1_ex_c2i(ASN1_VALUE **pval, unsigned char *cont, int len, int utype, char | |||
807 | return ret; | 808 | return ret; |
808 | } | 809 | } |
809 | 810 | ||
811 | /* This function finds the end of an ASN1 structure when passed its maximum | ||
812 | * length, whether it is indefinite length and a pointer to the content. | ||
813 | * This is more efficient than calling asn1_collect because it does not | ||
814 | * recurse on each indefinite length header. | ||
815 | */ | ||
816 | |||
817 | static int asn1_find_end(unsigned char **in, long len, char inf) | ||
818 | { | ||
819 | int expected_eoc; | ||
820 | long plen; | ||
821 | unsigned char *p = *in, *q; | ||
822 | /* If not indefinite length constructed just add length */ | ||
823 | if (inf == 0) | ||
824 | { | ||
825 | *in += len; | ||
826 | return 1; | ||
827 | } | ||
828 | expected_eoc = 1; | ||
829 | /* Indefinite length constructed form. Find the end when enough EOCs | ||
830 | * are found. If more indefinite length constructed headers | ||
831 | * are encountered increment the expected eoc count otherwise justi | ||
832 | * skip to the end of the data. | ||
833 | */ | ||
834 | while (len > 0) | ||
835 | { | ||
836 | if(asn1_check_eoc(&p, len)) | ||
837 | { | ||
838 | expected_eoc--; | ||
839 | if (expected_eoc == 0) | ||
840 | break; | ||
841 | len -= 2; | ||
842 | continue; | ||
843 | } | ||
844 | q = p; | ||
845 | /* Just read in a header: only care about the length */ | ||
846 | if(!asn1_check_tlen(&plen, NULL, NULL, &inf, NULL, &p, len, | ||
847 | -1, 0, 0, NULL)) | ||
848 | { | ||
849 | ASN1err(ASN1_F_ASN1_FIND_END, ERR_R_NESTED_ASN1_ERROR); | ||
850 | return 0; | ||
851 | } | ||
852 | if (inf) | ||
853 | expected_eoc++; | ||
854 | else | ||
855 | p += plen; | ||
856 | len -= p - q; | ||
857 | } | ||
858 | if (expected_eoc) | ||
859 | { | ||
860 | ASN1err(ASN1_F_ASN1_FIND_END, ASN1_R_MISSING_EOC); | ||
861 | return 0; | ||
862 | } | ||
863 | *in = p; | ||
864 | return 1; | ||
865 | } | ||
866 | |||
810 | /* This function collects the asn1 data from a constructred string | 867 | /* This function collects the asn1 data from a constructred string |
811 | * type into a buffer. The values of 'in' and 'len' should refer | 868 | * type into a buffer. The values of 'in' and 'len' should refer |
812 | * to the contents of the constructed type and 'inf' should be set | 869 | * to the contents of the constructed type and 'inf' should be set |
813 | * if it is indefinite length. If 'buf' is NULL then we just want | 870 | * if it is indefinite length. |
814 | * to find the end of the current structure: useful for indefinite | ||
815 | * length constructed stuff. | ||
816 | */ | 871 | */ |
817 | 872 | ||
818 | static int asn1_collect(BUF_MEM *buf, unsigned char **in, long len, char inf, int tag, int aclass) | 873 | static int asn1_collect(BUF_MEM *buf, unsigned char **in, long len, char inf, int tag, int aclass) |
@@ -822,11 +877,6 @@ static int asn1_collect(BUF_MEM *buf, unsigned char **in, long len, char inf, in | |||
822 | char cst, ininf; | 877 | char cst, ininf; |
823 | p = *in; | 878 | p = *in; |
824 | inf &= 1; | 879 | inf &= 1; |
825 | /* If no buffer and not indefinite length constructed just pass over the encoded data */ | ||
826 | if(!buf && !inf) { | ||
827 | *in += len; | ||
828 | return 1; | ||
829 | } | ||
830 | while(len > 0) { | 880 | while(len > 0) { |
831 | q = p; | 881 | q = p; |
832 | /* Check for EOC */ | 882 | /* Check for EOC */ |
@@ -845,9 +895,15 @@ static int asn1_collect(BUF_MEM *buf, unsigned char **in, long len, char inf, in | |||
845 | } | 895 | } |
846 | /* If indefinite length constructed update max length */ | 896 | /* If indefinite length constructed update max length */ |
847 | if(cst) { | 897 | if(cst) { |
848 | if(!asn1_collect(buf, &p, plen, ininf, tag, aclass)) return 0; | 898 | #ifdef OPENSSL_ALLOW_NESTED_ASN1_STRINGS |
899 | if (!asn1_collect(buf, &p, plen, ininf, tag, aclass)) | ||
900 | return 0; | ||
901 | #else | ||
902 | ASN1err(ASN1_F_ASN1_COLLECT, ASN1_R_NESTED_ASN1_STRING); | ||
903 | return 0; | ||
904 | #endif | ||
849 | } else { | 905 | } else { |
850 | if(!collect_data(buf, &p, plen)) return 0; | 906 | if(plen && !collect_data(buf, &p, plen)) return 0; |
851 | } | 907 | } |
852 | len -= p - q; | 908 | len -= p - q; |
853 | } | 909 | } |
diff --git a/src/lib/libcrypto/asn1/tasn_enc.c b/src/lib/libcrypto/asn1/tasn_enc.c index f6c8ddef0a..c675c3c832 100644 --- a/src/lib/libcrypto/asn1/tasn_enc.c +++ b/src/lib/libcrypto/asn1/tasn_enc.c | |||
@@ -445,9 +445,12 @@ int asn1_ex_i2c(ASN1_VALUE **pval, unsigned char *cout, int *putype, const ASN1_ | |||
445 | case V_ASN1_BOOLEAN: | 445 | case V_ASN1_BOOLEAN: |
446 | tbool = (ASN1_BOOLEAN *)pval; | 446 | tbool = (ASN1_BOOLEAN *)pval; |
447 | if(*tbool == -1) return -1; | 447 | if(*tbool == -1) return -1; |
448 | /* Default handling if value == size field then omit */ | 448 | if (it->utype != V_ASN1_ANY) |
449 | if(*tbool && (it->size > 0)) return -1; | 449 | { |
450 | if(!*tbool && !it->size) return -1; | 450 | /* Default handling if value == size field then omit */ |
451 | if(*tbool && (it->size > 0)) return -1; | ||
452 | if(!*tbool && !it->size) return -1; | ||
453 | } | ||
451 | c = (unsigned char)*tbool; | 454 | c = (unsigned char)*tbool; |
452 | cont = &c; | 455 | cont = &c; |
453 | len = 1; | 456 | len = 1; |