summaryrefslogtreecommitdiffstats
path: root/crypto/asn1/asn1_lib.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2015-03-03 14:20:23 +0000
committerDr. Stephen Henson <steve@openssl.org>2015-03-08 16:27:55 +0000
commita8ae0891d4bfd18f224777aed1fbb172504421f1 (patch)
tree0a220c89779a4a667e1eedfc1eab1e37b031064e /crypto/asn1/asn1_lib.c
parente3013932df2d899e8600c305342bc14b682dc0d1 (diff)
Cleanse PKCS#8 private key components.
New function ASN1_STRING_clear_free which cleanses an ASN1_STRING structure before freeing it. Call ASN1_STRING_clear_free on PKCS#8 private key components. Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/asn1/asn1_lib.c')
-rw-r--r--crypto/asn1/asn1_lib.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/crypto/asn1/asn1_lib.c b/crypto/asn1/asn1_lib.c
index bf8452689b..1586aaff14 100644
--- a/crypto/asn1/asn1_lib.c
+++ b/crypto/asn1/asn1_lib.c
@@ -427,6 +427,13 @@ void ASN1_STRING_free(ASN1_STRING *a)
OPENSSL_free(a);
}
+void ASN1_STRING_clear_free(ASN1_STRING *a)
+{
+ if (a && a->data && !(a->flags & ASN1_STRING_FLAG_NDEF))
+ OPENSSL_cleanse(a->data, a->length);
+ ASN1_STRING_free(a);
+}
+
int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b)
{
int i;