Skip asn1 zeroize if freeing shallow pointers
This skips zeroizing additional pointers to data.
(Note: actual sensitive data should still be zeroized when freed.)
Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
diff --git a/library/asn1parse.c b/library/asn1parse.c
index 12a378c..4bc1771 100644
--- a/library/asn1parse.c
+++ b/library/asn1parse.c
@@ -314,7 +314,6 @@
while( seq != NULL )
{
mbedtls_asn1_sequence *next = seq->next;
- mbedtls_platform_zeroize( seq, sizeof( *seq ) );
mbedtls_free( seq );
seq = next;
}
@@ -450,7 +449,8 @@
while( ( cur = *head ) != NULL )
{
*head = cur->next;
- mbedtls_asn1_free_named_data( cur );
+ mbedtls_free( cur->oid.p );
+ mbedtls_free( cur->val.p );
mbedtls_free( cur );
}
}
@@ -460,7 +460,6 @@
for( mbedtls_asn1_named_data *next; name != NULL; name = next )
{
next = name->next;
- mbedtls_platform_zeroize( name, sizeof( *name ) );
mbedtls_free( name );
}
}