Cleanse PKCS#8 private key components.
[openssl.git] / crypto / asn1 / asn1_lib.c
index bf8452689b94f9dfe3ff863bd534641509b1da64..1586aaff14f3c42a3d4b91dd56440b0fedc7cba3 100644 (file)
@@ -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;