Extend callback function to support print customization.
[openssl.git] / crypto / asn1 / p8_pkey.c
index b634d5bc85c663d50973e709bec5f42a51a61e7d..31ec2a812114c1ea34ab5a878d6626909003e467 100644 (file)
@@ -3,7 +3,7 @@
  * project 1999.
  */
 /* ====================================================================
- * Copyright (c) 1999 The OpenSSL Project.  All rights reserved.
+ * Copyright (c) 1999-2005 The OpenSSL Project.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #include <openssl/x509.h>
 
 /* Minor tweak to operation: zero private key data */
-static int pkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it)
+static int pkey_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
+                                                       void *exarg)
 {
        /* Since the structure must still be valid use ASN1_OP_FREE_PRE */
        if(operation == ASN1_OP_FREE_PRE) {
                PKCS8_PRIV_KEY_INFO *key = (PKCS8_PRIV_KEY_INFO *)*pval;
                if (key->pkey->value.octet_string)
-               memset(key->pkey->value.octet_string->data,
-                                0, key->pkey->value.octet_string->length);
+               OPENSSL_cleanse(key->pkey->value.octet_string->data,
+                       key->pkey->value.octet_string->length);
        }
        return 1;
 }