diff options
author | beck <> | 2017-01-29 17:49:23 +0000 |
---|---|---|
committer | beck <> | 2017-01-29 17:49:23 +0000 |
commit | 957b11334a7afb14537322f0e4795b2e368b3f59 (patch) | |
tree | 1a54abba678898ee5270ae4f3404a50ee9a92eea /src/lib/libcrypto/asn1/a_set.c | |
parent | df96e020e729c6c37a8c7fe311fdd1fe6a8718c5 (diff) | |
download | openbsd-957b11334a7afb14537322f0e4795b2e368b3f59.tar.gz openbsd-957b11334a7afb14537322f0e4795b2e368b3f59.tar.bz2 openbsd-957b11334a7afb14537322f0e4795b2e368b3f59.zip |
Send the function codes from the error functions to the bit bucket,
as was done earlier in libssl. Thanks inoguchi@ for noticing
libssl had more reacharounds into this.
ok jsing@ inoguchi@
Diffstat (limited to 'src/lib/libcrypto/asn1/a_set.c')
-rw-r--r-- | src/lib/libcrypto/asn1/a_set.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/lib/libcrypto/asn1/a_set.c b/src/lib/libcrypto/asn1/a_set.c index 63d55c3714..4d5cae337b 100644 --- a/src/lib/libcrypto/asn1/a_set.c +++ b/src/lib/libcrypto/asn1/a_set.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: a_set.c,v 1.17 2015/03/19 14:00:22 tedu Exp $ */ | 1 | /* $OpenBSD: a_set.c,v 1.18 2017/01/29 17:49:22 beck Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -125,7 +125,7 @@ i2d_ASN1_SET(STACK_OF(OPENSSL_BLOCK) *a, unsigned char **pp, i2d_of_void *i2d, | |||
125 | /* In this array we will store the SET blobs */ | 125 | /* In this array we will store the SET blobs */ |
126 | rgSetBlob = reallocarray(NULL, sk_OPENSSL_BLOCK_num(a), sizeof(MYBLOB)); | 126 | rgSetBlob = reallocarray(NULL, sk_OPENSSL_BLOCK_num(a), sizeof(MYBLOB)); |
127 | if (rgSetBlob == NULL) { | 127 | if (rgSetBlob == NULL) { |
128 | ASN1err(ASN1_F_I2D_ASN1_SET, ERR_R_MALLOC_FAILURE); | 128 | ASN1error(ERR_R_MALLOC_FAILURE); |
129 | return 0; | 129 | return 0; |
130 | } | 130 | } |
131 | 131 | ||
@@ -146,7 +146,7 @@ i2d_ASN1_SET(STACK_OF(OPENSSL_BLOCK) *a, unsigned char **pp, i2d_of_void *i2d, | |||
146 | qsort(rgSetBlob, sk_OPENSSL_BLOCK_num(a), sizeof(MYBLOB), SetBlobCmp); | 146 | qsort(rgSetBlob, sk_OPENSSL_BLOCK_num(a), sizeof(MYBLOB), SetBlobCmp); |
147 | if ((pTempMem = malloc(totSize)) == NULL) { | 147 | if ((pTempMem = malloc(totSize)) == NULL) { |
148 | free(rgSetBlob); | 148 | free(rgSetBlob); |
149 | ASN1err(ASN1_F_I2D_ASN1_SET, ERR_R_MALLOC_FAILURE); | 149 | ASN1error(ERR_R_MALLOC_FAILURE); |
150 | return 0; | 150 | return 0; |
151 | } | 151 | } |
152 | 152 | ||
@@ -175,7 +175,7 @@ d2i_ASN1_SET(STACK_OF(OPENSSL_BLOCK) **a, const unsigned char **pp, long length, | |||
175 | 175 | ||
176 | if (a == NULL || (*a) == NULL) { | 176 | if (a == NULL || (*a) == NULL) { |
177 | if ((ret = sk_OPENSSL_BLOCK_new_null()) == NULL) { | 177 | if ((ret = sk_OPENSSL_BLOCK_new_null()) == NULL) { |
178 | ASN1err(ASN1_F_D2I_ASN1_SET, ERR_R_MALLOC_FAILURE); | 178 | ASN1error(ERR_R_MALLOC_FAILURE); |
179 | goto err; | 179 | goto err; |
180 | } | 180 | } |
181 | } else | 181 | } else |
@@ -188,15 +188,15 @@ d2i_ASN1_SET(STACK_OF(OPENSSL_BLOCK) **a, const unsigned char **pp, long length, | |||
188 | if (c.inf & 0x80) | 188 | if (c.inf & 0x80) |
189 | goto err; | 189 | goto err; |
190 | if (ex_class != c.xclass) { | 190 | if (ex_class != c.xclass) { |
191 | ASN1err(ASN1_F_D2I_ASN1_SET, ASN1_R_BAD_CLASS); | 191 | ASN1error(ASN1_R_BAD_CLASS); |
192 | goto err; | 192 | goto err; |
193 | } | 193 | } |
194 | if (ex_tag != c.tag) { | 194 | if (ex_tag != c.tag) { |
195 | ASN1err(ASN1_F_D2I_ASN1_SET, ASN1_R_BAD_TAG); | 195 | ASN1error(ASN1_R_BAD_TAG); |
196 | goto err; | 196 | goto err; |
197 | } | 197 | } |
198 | if (c.slen + c.p > c.max) { | 198 | if (c.slen + c.p > c.max) { |
199 | ASN1err(ASN1_F_D2I_ASN1_SET, ASN1_R_LENGTH_ERROR); | 199 | ASN1error(ASN1_R_LENGTH_ERROR); |
200 | goto err; | 200 | goto err; |
201 | } | 201 | } |
202 | /* check for infinite constructed - it can be as long | 202 | /* check for infinite constructed - it can be as long |
@@ -211,8 +211,7 @@ d2i_ASN1_SET(STACK_OF(OPENSSL_BLOCK) **a, const unsigned char **pp, long length, | |||
211 | if (M_ASN1_D2I_end_sequence()) | 211 | if (M_ASN1_D2I_end_sequence()) |
212 | break; | 212 | break; |
213 | if ((s = d2i(NULL, &c.p, c.slen)) == NULL) { | 213 | if ((s = d2i(NULL, &c.p, c.slen)) == NULL) { |
214 | ASN1err(ASN1_F_D2I_ASN1_SET, | 214 | ASN1error(ASN1_R_ERROR_PARSING_SET_ELEMENT); |
215 | ASN1_R_ERROR_PARSING_SET_ELEMENT); | ||
216 | asn1_add_error(*pp, (int)(c.p - *pp)); | 215 | asn1_add_error(*pp, (int)(c.p - *pp)); |
217 | goto err; | 216 | goto err; |
218 | } | 217 | } |