projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
strsep implementation to allow the file to compile on non-BSD systems
[openssl.git]
/
crypto
/
evp
/
p_seal.c
diff --git
a/crypto/evp/p_seal.c
b/crypto/evp/p_seal.c
index d449e892bf7f7899f91e9621c06c674af86d1744..ff16370994f960eaaabf966eaa2e1e13c8a73e48 100644
(file)
--- a/
crypto/evp/p_seal.c
+++ b/
crypto/evp/p_seal.c
@@
-59,7
+59,7
@@
#include <stdio.h>
#include "cryptlib.h"
#include <openssl/rand.h>
#include <stdio.h>
#include "cryptlib.h"
#include <openssl/rand.h>
-#ifndef NO_RSA
+#ifndef
OPENSSL_
NO_RSA
#include <openssl/rsa.h>
#endif
#include <openssl/evp.h>
#include <openssl/rsa.h>
#endif
#include <openssl/evp.h>
@@
-72,18
+72,21
@@
int EVP_SealInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char **ek,
unsigned char key[EVP_MAX_KEY_LENGTH];
int i;
unsigned char key[EVP_MAX_KEY_LENGTH];
int i;
+ if(type) {
+ EVP_CIPHER_CTX_init(ctx);
+ if(!EVP_EncryptInit(ctx,type,NULL,NULL)) return 0;
+ }
if (npubk <= 0) return(0);
if (RAND_bytes(key,EVP_MAX_KEY_LENGTH) <= 0)
return(0);
if (npubk <= 0) return(0);
if (RAND_bytes(key,EVP_MAX_KEY_LENGTH) <= 0)
return(0);
- if (
type->iv_len > 0
)
- RAND_pseudo_bytes(iv,
type->iv_len
);
+ if (
EVP_CIPHER_CTX_iv_length(ctx)
)
+ RAND_pseudo_bytes(iv,
EVP_CIPHER_CTX_iv_length(ctx)
);
- EVP_CIPHER_CTX_init(ctx);
- EVP_EncryptInit(ctx,type,key,iv);
+ if(!EVP_EncryptInit(ctx,NULL,key,iv)) return 0;
for (i=0; i<npubk; i++)
{
for (i=0; i<npubk; i++)
{
- ekl[i]=EVP_PKEY_encrypt(ek[i],key,EVP_CIPHER_
key_length(type
),
+ ekl[i]=EVP_PKEY_encrypt(ek[i],key,EVP_CIPHER_
CTX_key_length(ctx
),
pubk[i]);
if (ekl[i] <= 0) return(-1);
}
pubk[i]);
if (ekl[i] <= 0) return(-1);
}