summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/asn_pack.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/asn1/asn_pack.c')
-rw-r--r--src/lib/libcrypto/asn1/asn_pack.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/lib/libcrypto/asn1/asn_pack.c b/src/lib/libcrypto/asn1/asn_pack.c
index 65f4b9bf97..09d150583a 100644
--- a/src/lib/libcrypto/asn1/asn_pack.c
+++ b/src/lib/libcrypto/asn1/asn_pack.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn_pack.c,v 1.15 2015/12/23 20:37:23 mmcc Exp $ */ 1/* $OpenBSD: asn_pack.c,v 1.16 2017/01/29 17:49:22 beck 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 1999. 3 * project 1999.
4 */ 4 */
@@ -77,7 +77,7 @@ ASN1_seq_unpack(const unsigned char *buf, int len, d2i_of_void *d2i,
77 pbuf = buf; 77 pbuf = buf;
78 if (!(sk = d2i_ASN1_SET(NULL, &pbuf, len, d2i, free_func, 78 if (!(sk = d2i_ASN1_SET(NULL, &pbuf, len, d2i, free_func,
79 V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL))) 79 V_ASN1_SEQUENCE, V_ASN1_UNIVERSAL)))
80 ASN1err(ASN1_F_ASN1_SEQ_UNPACK,ASN1_R_DECODE_ERROR); 80 ASN1error(ASN1_R_DECODE_ERROR);
81 return sk; 81 return sk;
82} 82}
83 83
@@ -94,11 +94,11 @@ ASN1_seq_pack(STACK_OF(OPENSSL_BLOCK) *safes, i2d_of_void *i2d,
94 94
95 if (!(safelen = i2d_ASN1_SET(safes, NULL, i2d, V_ASN1_SEQUENCE, 95 if (!(safelen = i2d_ASN1_SET(safes, NULL, i2d, V_ASN1_SEQUENCE,
96 V_ASN1_UNIVERSAL, IS_SEQUENCE))) { 96 V_ASN1_UNIVERSAL, IS_SEQUENCE))) {
97 ASN1err(ASN1_F_ASN1_SEQ_PACK,ASN1_R_ENCODE_ERROR); 97 ASN1error(ASN1_R_ENCODE_ERROR);
98 return NULL; 98 return NULL;
99 } 99 }
100 if (!(safe = malloc(safelen))) { 100 if (!(safe = malloc(safelen))) {
101 ASN1err(ASN1_F_ASN1_SEQ_PACK,ERR_R_MALLOC_FAILURE); 101 ASN1error(ERR_R_MALLOC_FAILURE);
102 return NULL; 102 return NULL;
103 } 103 }
104 p = safe; 104 p = safe;
@@ -121,7 +121,7 @@ ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i)
121 121
122 p = oct->data; 122 p = oct->data;
123 if (!(ret = d2i(NULL, &p, oct->length))) 123 if (!(ret = d2i(NULL, &p, oct->length)))
124 ASN1err(ASN1_F_ASN1_UNPACK_STRING,ASN1_R_DECODE_ERROR); 124 ASN1error(ASN1_R_DECODE_ERROR);
125 return ret; 125 return ret;
126} 126}
127 127
@@ -135,18 +135,18 @@ ASN1_pack_string(void *obj, i2d_of_void *i2d, ASN1_STRING **oct)
135 135
136 if (!oct || !*oct) { 136 if (!oct || !*oct) {
137 if (!(octmp = ASN1_STRING_new())) { 137 if (!(octmp = ASN1_STRING_new())) {
138 ASN1err(ASN1_F_ASN1_PACK_STRING,ERR_R_MALLOC_FAILURE); 138 ASN1error(ERR_R_MALLOC_FAILURE);
139 return NULL; 139 return NULL;
140 } 140 }
141 } else 141 } else
142 octmp = *oct; 142 octmp = *oct;
143 143
144 if (!(octmp->length = i2d(obj, NULL))) { 144 if (!(octmp->length = i2d(obj, NULL))) {
145 ASN1err(ASN1_F_ASN1_PACK_STRING,ASN1_R_ENCODE_ERROR); 145 ASN1error(ASN1_R_ENCODE_ERROR);
146 goto err; 146 goto err;
147 } 147 }
148 if (!(p = malloc (octmp->length))) { 148 if (!(p = malloc (octmp->length))) {
149 ASN1err(ASN1_F_ASN1_PACK_STRING,ERR_R_MALLOC_FAILURE); 149 ASN1error(ERR_R_MALLOC_FAILURE);
150 goto err; 150 goto err;
151 } 151 }
152 octmp->data = p; 152 octmp->data = p;
@@ -174,7 +174,7 @@ ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_STRING **oct)
174 174
175 if (!oct || !*oct) { 175 if (!oct || !*oct) {
176 if (!(octmp = ASN1_STRING_new ())) { 176 if (!(octmp = ASN1_STRING_new ())) {
177 ASN1err(ASN1_F_ASN1_ITEM_PACK, ERR_R_MALLOC_FAILURE); 177 ASN1error(ERR_R_MALLOC_FAILURE);
178 return NULL; 178 return NULL;
179 } 179 }
180 } else 180 } else
@@ -184,11 +184,11 @@ ASN1_item_pack(void *obj, const ASN1_ITEM *it, ASN1_STRING **oct)
184 octmp->data = NULL; 184 octmp->data = NULL;
185 185
186 if (!(octmp->length = ASN1_item_i2d(obj, &octmp->data, it))) { 186 if (!(octmp->length = ASN1_item_i2d(obj, &octmp->data, it))) {
187 ASN1err(ASN1_F_ASN1_ITEM_PACK, ASN1_R_ENCODE_ERROR); 187 ASN1error(ASN1_R_ENCODE_ERROR);
188 goto err; 188 goto err;
189 } 189 }
190 if (!octmp->data) { 190 if (!octmp->data) {
191 ASN1err(ASN1_F_ASN1_ITEM_PACK, ERR_R_MALLOC_FAILURE); 191 ASN1error(ERR_R_MALLOC_FAILURE);
192 goto err; 192 goto err;
193 } 193 }
194 if (oct) 194 if (oct)
@@ -210,6 +210,6 @@ ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it)
210 210
211 p = oct->data; 211 p = oct->data;
212 if (!(ret = ASN1_item_d2i(NULL, &p, oct->length, it))) 212 if (!(ret = ASN1_item_d2i(NULL, &p, oct->length, it)))
213 ASN1err(ASN1_F_ASN1_ITEM_UNPACK, ASN1_R_DECODE_ERROR); 213 ASN1error(ASN1_R_DECODE_ERROR);
214 return ret; 214 return ret;
215} 215}