make
[openssl.git] / crypto / pem / pem_seal.c
index 50a1b9162a5bb0991e729749d92393087d5a7e2f..4e554e5481e0c60cf520906671b7c2498ff8d2c1 100644 (file)
@@ -56,6 +56,7 @@
  * [including the GNU Public Licence.]
  */
 
+#include <openssl/opensslconf.h>       /* for OPENSSL_NO_RSA */
 #ifndef OPENSSL_NO_RSA
 #include <stdio.h>
 #include "cryptlib.h"
@@ -64,6 +65,7 @@
 #include <openssl/objects.h>
 #include <openssl/x509.h>
 #include <openssl/pem.h>
+#include <openssl/rsa.h>
 
 int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, EVP_MD *md_type,
             unsigned char **ek, int *ekl, unsigned char *iv, EVP_PKEY **pubk,
@@ -112,7 +114,7 @@ int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, EVP_MD *md_type,
        ret=npubk;
 err:
        if (s != NULL) OPENSSL_free(s);
-       memset(key,0,EVP_MAX_KEY_LENGTH);
+       OPENSSL_cleanse(key,EVP_MAX_KEY_LENGTH);
        return(ret);
        }
 
@@ -161,7 +163,7 @@ int PEM_SealFinal(PEM_ENCODE_SEAL_CTX *ctx, unsigned char *sig, int *sigl,
                goto err;
                }
 
-       EVP_EncryptFinal(&ctx->cipher,s,(int *)&i);
+       EVP_EncryptFinal_ex(&ctx->cipher,s,(int *)&i);
        EVP_EncodeUpdate(&ctx->encode,out,&j,s,i);
        *outl=j;
        out+=j;