diff options
| author | tb <> | 2023-03-13 07:31:09 +0000 |
|---|---|---|
| committer | tb <> | 2023-03-13 07:31:09 +0000 |
| commit | 1a2e5d994000e27e8d3809226045e1ebd95bb0df (patch) | |
| tree | f95ecf2981293dd65813815d89c743d68930c244 /src | |
| parent | a000ef26734da6ea7f446ae52ac64059cf358592 (diff) | |
| download | openbsd-1a2e5d994000e27e8d3809226045e1ebd95bb0df.tar.gz openbsd-1a2e5d994000e27e8d3809226045e1ebd95bb0df.tar.bz2 openbsd-1a2e5d994000e27e8d3809226045e1ebd95bb0df.zip | |
Stop confusing out and asn_bio in BIO_new_NDEF()
BIO_new_NDEF() sets up an ASN.1 BIO to the output chain and then adds even
more BIOs. Since BIO_push(bio, new_tail) returns bio on success, after the
if ((out = BIO_push(asn_bio, out)) != NULL) the 'out' BIO and the 'asn_bio'
are the same. The code then goes on and uses one or the other. This is very
confusing. Simply stop using out once it's appended to asn_bio.
ok jsing
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/asn1/bio_ndef.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/libcrypto/asn1/bio_ndef.c b/src/lib/libcrypto/asn1/bio_ndef.c index 182ca52960..d6642e573e 100644 --- a/src/lib/libcrypto/asn1/bio_ndef.c +++ b/src/lib/libcrypto/asn1/bio_ndef.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bio_ndef.c,v 1.16 2023/03/11 16:29:48 tb Exp $ */ | 1 | /* $OpenBSD: bio_ndef.c,v 1.17 2023/03/13 07:31:09 tb 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. | 3 | * project. |
| 4 | */ | 4 | */ |
| @@ -116,7 +116,7 @@ BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it) | |||
| 116 | if ((asn_bio = BIO_new(BIO_f_asn1())) == NULL) | 116 | if ((asn_bio = BIO_new(BIO_f_asn1())) == NULL) |
| 117 | goto err; | 117 | goto err; |
| 118 | 118 | ||
| 119 | if ((out = BIO_push(asn_bio, out)) == NULL) | 119 | if (BIO_push(asn_bio, out) == NULL) |
| 120 | goto err; | 120 | goto err; |
| 121 | pop_bio = asn_bio; | 121 | pop_bio = asn_bio; |
| 122 | 122 | ||
| @@ -127,7 +127,7 @@ BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it) | |||
| 127 | * ASN1 structure needs. | 127 | * ASN1 structure needs. |
| 128 | */ | 128 | */ |
| 129 | 129 | ||
| 130 | sarg.out = out; | 130 | sarg.out = asn_bio; |
| 131 | sarg.ndef_bio = NULL; | 131 | sarg.ndef_bio = NULL; |
| 132 | sarg.boundary = NULL; | 132 | sarg.boundary = NULL; |
| 133 | 133 | ||
| @@ -138,7 +138,7 @@ BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it) | |||
| 138 | ndef_aux->it = it; | 138 | ndef_aux->it = it; |
| 139 | ndef_aux->ndef_bio = sarg.ndef_bio; | 139 | ndef_aux->ndef_bio = sarg.ndef_bio; |
| 140 | ndef_aux->boundary = sarg.boundary; | 140 | ndef_aux->boundary = sarg.boundary; |
| 141 | ndef_aux->out = out; | 141 | ndef_aux->out = asn_bio; |
| 142 | 142 | ||
| 143 | BIO_ctrl(asn_bio, BIO_C_SET_EX_ARG, 0, ndef_aux); | 143 | BIO_ctrl(asn_bio, BIO_C_SET_EX_ARG, 0, ndef_aux); |
| 144 | 144 | ||
