projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make "make depend" work on MacOS out of the box.
[openssl.git]
/
crypto
/
evp
/
p_open.c
diff --git
a/crypto/evp/p_open.c
b/crypto/evp/p_open.c
index c0a50b9cd6b25e6543f04b520acb9829f88c2a11..c748fbea877250031f8b40b60b36ef2d4b5f85c9 100644
(file)
--- a/
crypto/evp/p_open.c
+++ b/
crypto/evp/p_open.c
@@
-56,22
+56,26
@@
* [including the GNU Public Licence.]
*/
* [including the GNU Public Licence.]
*/
-#ifndef OPENSSL_NO_RSA
#include <stdio.h>
#include "cryptlib.h"
#include <stdio.h>
#include "cryptlib.h"
+
+#ifndef OPENSSL_NO_RSA
+
#include <openssl/evp.h>
#include <openssl/objects.h>
#include <openssl/x509.h>
#include <openssl/evp.h>
#include <openssl/objects.h>
#include <openssl/x509.h>
+#include <openssl/rsa.h>
-int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, unsigned char *ek,
- int ekl, unsigned char *iv, EVP_PKEY *priv)
+int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
+ const unsigned char *ek, int ekl, const unsigned char *iv,
+ EVP_PKEY *priv)
{
unsigned char *key=NULL;
int i,size=0,ret=0;
if(type) {
EVP_CIPHER_CTX_init(ctx);
{
unsigned char *key=NULL;
int i,size=0,ret=0;
if(type) {
EVP_CIPHER_CTX_init(ctx);
- if(!EVP_DecryptInit
(ctx,type,
NULL,NULL)) return 0;
+ if(!EVP_DecryptInit
_ex(ctx,type,NULL,
NULL,NULL)) return 0;
}
if(!priv) return 1;
}
if(!priv) return 1;
@@
-91,17
+95,17
@@
int EVP_OpenInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, unsigned char *ek,
goto err;
}
goto err;
}
- i=EVP_PKEY_decrypt(key,ek,ekl,priv);
+ i=EVP_PKEY_decrypt
_old
(key,ek,ekl,priv);
if ((i <= 0) || !EVP_CIPHER_CTX_set_key_length(ctx, i))
{
/* ERROR */
goto err;
}
if ((i <= 0) || !EVP_CIPHER_CTX_set_key_length(ctx, i))
{
/* ERROR */
goto err;
}
- if(!EVP_DecryptInit
(ctx
,NULL,key,iv)) goto err;
+ if(!EVP_DecryptInit
_ex(ctx,NULL
,NULL,key,iv)) goto err;
ret=1;
err:
ret=1;
err:
- if (key != NULL)
memset(key,0
,size);
+ if (key != NULL)
OPENSSL_cleanse(key
,size);
OPENSSL_free(key);
return(ret);
}
OPENSSL_free(key);
return(ret);
}
@@
-110,8
+114,9
@@
int EVP_OpenFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
{
int i;
{
int i;
- i=EVP_DecryptFinal(ctx,out,outl);
- EVP_DecryptInit(ctx,NULL,NULL,NULL);
+ i=EVP_DecryptFinal_ex(ctx,out,outl);
+ if (i)
+ i = EVP_DecryptInit_ex(ctx,NULL,NULL,NULL,NULL);
return(i);
}
#else /* !OPENSSL_NO_RSA */
return(i);
}
#else /* !OPENSSL_NO_RSA */