summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortb <>2023-03-13 07:31:09 +0000
committertb <>2023-03-13 07:31:09 +0000
commitfc7471682dc0a11ebac8c980c6afce3ab21dc45f (patch)
treef95ecf2981293dd65813815d89c743d68930c244 /src
parent2bc94b417c66333b4acae96b46d4aff34b3813cd (diff)
downloadopenbsd-fc7471682dc0a11ebac8c980c6afce3ab21dc45f.tar.gz
openbsd-fc7471682dc0a11ebac8c980c6afce3ab21dc45f.tar.bz2
openbsd-fc7471682dc0a11ebac8c980c6afce3ab21dc45f.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.c8
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