diff options
author | jsing <> | 2022-09-03 18:45:51 +0000 |
---|---|---|
committer | jsing <> | 2022-09-03 18:45:51 +0000 |
commit | 5bb948dd8541248e1d3ad5dc62cd87323e2df812 (patch) | |
tree | 6b5b1c2abda78a05e0b9d022e64e28467a06c779 /src/lib/libcrypto/asn1/tasn_dec.c | |
parent | 08cad1d5d4e840186d932d4ee28fa6e1463e3f28 (diff) | |
download | openbsd-5bb948dd8541248e1d3ad5dc62cd87323e2df812.tar.gz openbsd-5bb948dd8541248e1d3ad5dc62cd87323e2df812.tar.bz2 openbsd-5bb948dd8541248e1d3ad5dc62cd87323e2df812.zip |
Provide c2i_ASN1_ENUMERATED_cbs() and call it from asn1_c2i_primitive().
This avoids asn1_c2i_primitive() from needing knowledge about the internals
of ASN1_INTEGER and ASN1_ENUMERATED.
ok tb@
Diffstat (limited to 'src/lib/libcrypto/asn1/tasn_dec.c')
-rw-r--r-- | src/lib/libcrypto/asn1/tasn_dec.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/libcrypto/asn1/tasn_dec.c b/src/lib/libcrypto/asn1/tasn_dec.c index 235685484c..22d8006d0a 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.78 2022/06/29 08:56:44 beck Exp $ */ | 1 | /* $OpenBSD: tasn_dec.c,v 1.79 2022/09/03 18:45:51 jsing 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 | */ |
@@ -277,7 +277,6 @@ static int | |||
277 | asn1_c2i_primitive(ASN1_VALUE **pval, CBS *content, int utype, const ASN1_ITEM *it) | 277 | asn1_c2i_primitive(ASN1_VALUE **pval, CBS *content, int utype, const ASN1_ITEM *it) |
278 | { | 278 | { |
279 | ASN1_STRING *stmp; | 279 | ASN1_STRING *stmp; |
280 | ASN1_INTEGER **tint; | ||
281 | ASN1_BOOLEAN *tbool; | 280 | ASN1_BOOLEAN *tbool; |
282 | uint8_t u8val; | 281 | uint8_t u8val; |
283 | int ret = 0; | 282 | int ret = 0; |
@@ -318,13 +317,14 @@ asn1_c2i_primitive(ASN1_VALUE **pval, CBS *content, int utype, const ASN1_ITEM * | |||
318 | goto err; | 317 | goto err; |
319 | break; | 318 | break; |
320 | 319 | ||
321 | case V_ASN1_INTEGER: | ||
322 | case V_ASN1_ENUMERATED: | 320 | case V_ASN1_ENUMERATED: |
323 | tint = (ASN1_INTEGER **)pval; | 321 | if (!c2i_ASN1_ENUMERATED_cbs((ASN1_ENUMERATED **)pval, content)) |
324 | if (!c2i_ASN1_INTEGER_cbs(tint, content)) | 322 | goto err; |
323 | break; | ||
324 | |||
325 | case V_ASN1_INTEGER: | ||
326 | if (!c2i_ASN1_INTEGER_cbs((ASN1_INTEGER **)pval, content)) | ||
325 | goto err; | 327 | goto err; |
326 | /* Fixup type to match the expected form */ | ||
327 | (*tint)->type = utype | ((*tint)->type & V_ASN1_NEG); | ||
328 | break; | 328 | break; |
329 | 329 | ||
330 | case V_ASN1_OCTET_STRING: | 330 | case V_ASN1_OCTET_STRING: |