summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjsing <>2022-05-12 19:24:38 +0000
committerjsing <>2022-05-12 19:24:38 +0000
commit6155cf7bfd858311b1886870071239d0493780d7 (patch)
tree0807f2e18383d9a0450d6a37abf55a3f58d5c54e /src
parent5bdcfefad695534cdfef84146076871e71771406 (diff)
downloadopenbsd-6155cf7bfd858311b1886870071239d0493780d7.tar.gz
openbsd-6155cf7bfd858311b1886870071239d0493780d7.tar.bz2
openbsd-6155cf7bfd858311b1886870071239d0493780d7.zip
Use freezero() with ASN1_ENCODING.
While ASN1_ENCODING is currently only used with types that should only contain public information, we assume that ASN.1 may contain sensitive information, hence use freezero() here instead of free(). ok deraadt@ tb@
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/asn1/tasn_utl.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/libcrypto/asn1/tasn_utl.c b/src/lib/libcrypto/asn1/tasn_utl.c
index 4ef4232c7e..e3b2c9e4dc 100644
--- a/src/lib/libcrypto/asn1/tasn_utl.c
+++ b/src/lib/libcrypto/asn1/tasn_utl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: tasn_utl.c,v 1.14 2022/05/10 05:19:23 jsing Exp $ */ 1/* $OpenBSD: tasn_utl.c,v 1.15 2022/05/12 19:24:38 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 */
@@ -153,7 +153,7 @@ asn1_enc_free(ASN1_VALUE **pval, const ASN1_ITEM *it)
153 153
154 enc = asn1_get_enc_ptr(pval, it); 154 enc = asn1_get_enc_ptr(pval, it);
155 if (enc) { 155 if (enc) {
156 free(enc->enc); 156 freezero(enc->enc, enc->len);
157 enc->enc = NULL; 157 enc->enc = NULL;
158 enc->len = 0; 158 enc->len = 0;
159 enc->modified = 1; 159 enc->modified = 1;
@@ -170,7 +170,7 @@ asn1_enc_save(ASN1_VALUE **pval, const unsigned char *in, int inlen,
170 if (!enc) 170 if (!enc)
171 return 1; 171 return 1;
172 172
173 free(enc->enc); 173 freezero(enc->enc, enc->len);
174 enc->enc = malloc(inlen); 174 enc->enc = malloc(inlen);
175 if (!enc->enc) 175 if (!enc->enc)
176 return 0; 176 return 0;