diff options
| author | miod <> | 2015-02-14 15:23:57 +0000 |
|---|---|---|
| committer | miod <> | 2015-02-14 15:23:57 +0000 |
| commit | f928256bd8f26f6341cc06e979b619e41ea499ad (patch) | |
| tree | 094ce60cf2e7b1b8f53728f3c1052390bfef6120 /src/lib/libcrypto/asn1/tasn_dec.c | |
| parent | e6042c517487477956b35e6dd081ccafc1b4f02c (diff) | |
| download | openbsd-f928256bd8f26f6341cc06e979b619e41ea499ad.tar.gz openbsd-f928256bd8f26f6341cc06e979b619e41ea499ad.tar.bz2 openbsd-f928256bd8f26f6341cc06e979b619e41ea499ad.zip | |
Remove IMPLEMENT_COMPAT_ASN1() and related support code. Nothing uses it in
libcrypto/libssl, and nothing seems to use it in the wild, apart from embedded
copies of OpenSSL.
ok jsing@
Diffstat (limited to 'src/lib/libcrypto/asn1/tasn_dec.c')
| -rw-r--r-- | src/lib/libcrypto/asn1/tasn_dec.c | 72 |
1 files changed, 3 insertions, 69 deletions
diff --git a/src/lib/libcrypto/asn1/tasn_dec.c b/src/lib/libcrypto/asn1/tasn_dec.c index f633d03e9c..791a10a9c0 100644 --- a/src/lib/libcrypto/asn1/tasn_dec.c +++ b/src/lib/libcrypto/asn1/tasn_dec.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tasn_dec.c,v 1.24 2014/06/12 15:49:27 deraadt Exp $ */ | 1 | /* $OpenBSD: tasn_dec.c,v 1.25 2015/02/14 15:23:57 miod Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2000. | 3 | * project 2000. |
| 4 | */ | 4 | */ |
| @@ -155,19 +155,17 @@ ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, | |||
| 155 | const ASN1_ITEM *it, int tag, int aclass, char opt, ASN1_TLC *ctx) | 155 | const ASN1_ITEM *it, int tag, int aclass, char opt, ASN1_TLC *ctx) |
| 156 | { | 156 | { |
| 157 | const ASN1_TEMPLATE *tt, *errtt = NULL; | 157 | const ASN1_TEMPLATE *tt, *errtt = NULL; |
| 158 | const ASN1_COMPAT_FUNCS *cf; | ||
| 159 | const ASN1_EXTERN_FUNCS *ef; | 158 | const ASN1_EXTERN_FUNCS *ef; |
| 160 | const ASN1_AUX *aux = it->funcs; | 159 | const ASN1_AUX *aux = it->funcs; |
| 161 | ASN1_aux_cb *asn1_cb; | 160 | ASN1_aux_cb *asn1_cb; |
| 162 | const unsigned char *p = NULL, *q; | 161 | const unsigned char *p = NULL, *q; |
| 163 | unsigned char *wp = NULL; /* BIG FAT WARNING! BREAKS CONST WHERE USED */ | 162 | unsigned char oclass; |
| 164 | unsigned char imphack = 0, oclass; | ||
| 165 | char seq_eoc, seq_nolen, cst, isopt; | 163 | char seq_eoc, seq_nolen, cst, isopt; |
| 166 | long tmplen; | 164 | long tmplen; |
| 167 | int i; | 165 | int i; |
| 168 | int otag; | 166 | int otag; |
| 169 | int ret = 0; | 167 | int ret = 0; |
| 170 | ASN1_VALUE **pchptr, *ptmpval; | 168 | ASN1_VALUE **pchptr; |
| 171 | 169 | ||
| 172 | if (!pval) | 170 | if (!pval) |
| 173 | return 0; | 171 | return 0; |
| @@ -236,70 +234,6 @@ ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, | |||
| 236 | return ef->asn1_ex_d2i(pval, in, len, | 234 | return ef->asn1_ex_d2i(pval, in, len, |
| 237 | it, tag, aclass, opt, ctx); | 235 | it, tag, aclass, opt, ctx); |
| 238 | 236 | ||
| 239 | case ASN1_ITYPE_COMPAT: | ||
| 240 | /* we must resort to old style evil hackery */ | ||
| 241 | cf = it->funcs; | ||
| 242 | |||
| 243 | /* If OPTIONAL see if it is there */ | ||
| 244 | if (opt) { | ||
| 245 | int exptag; | ||
| 246 | p = *in; | ||
| 247 | if (tag == -1) | ||
| 248 | exptag = it->utype; | ||
| 249 | else | ||
| 250 | exptag = tag; | ||
| 251 | /* Don't care about anything other than presence | ||
| 252 | * of expected tag */ | ||
| 253 | |||
| 254 | ret = asn1_check_tlen(NULL, NULL, NULL, NULL, NULL, | ||
| 255 | &p, len, exptag, aclass, 1, ctx); | ||
| 256 | if (!ret) { | ||
| 257 | ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, | ||
| 258 | ERR_R_NESTED_ASN1_ERROR); | ||
| 259 | goto err; | ||
| 260 | } | ||
| 261 | if (ret == -1) | ||
| 262 | return -1; | ||
| 263 | } | ||
| 264 | |||
| 265 | /* This is the old style evil hack IMPLICIT handling: | ||
| 266 | * since the underlying code is expecting a tag and | ||
| 267 | * class other than the one present we change the | ||
| 268 | * buffer temporarily then change it back afterwards. | ||
| 269 | * This doesn't and never did work for tags > 30. | ||
| 270 | * | ||
| 271 | * Yes this is *horrible* but it is only needed for | ||
| 272 | * old style d2i which will hopefully not be around | ||
| 273 | * for much longer. | ||
| 274 | * FIXME: should copy the buffer then modify it so | ||
| 275 | * the input buffer can be const: we should *always* | ||
| 276 | * copy because the old style d2i might modify the | ||
| 277 | * buffer. | ||
| 278 | */ | ||
| 279 | |||
| 280 | if (tag != -1) { | ||
| 281 | wp = *(unsigned char **)in; | ||
| 282 | imphack = *wp; | ||
| 283 | if (p == NULL) { | ||
| 284 | ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, | ||
| 285 | ERR_R_NESTED_ASN1_ERROR); | ||
| 286 | goto err; | ||
| 287 | } | ||
| 288 | *wp = (unsigned char)((*p & V_ASN1_CONSTRUCTED) | | ||
| 289 | it->utype); | ||
| 290 | } | ||
| 291 | |||
| 292 | ptmpval = cf->asn1_d2i(pval, in, len); | ||
| 293 | |||
| 294 | if (tag != -1) | ||
| 295 | *wp = imphack; | ||
| 296 | |||
| 297 | if (ptmpval) | ||
| 298 | return 1; | ||
| 299 | |||
| 300 | ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ERR_R_NESTED_ASN1_ERROR); | ||
| 301 | goto err; | ||
| 302 | |||
| 303 | case ASN1_ITYPE_CHOICE: | 237 | case ASN1_ITYPE_CHOICE: |
| 304 | if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL)) | 238 | if (asn1_cb && !asn1_cb(ASN1_OP_D2I_PRE, pval, it, NULL)) |
| 305 | goto auxerr; | 239 | goto auxerr; |
