summaryrefslogtreecommitdiffstats
path: root/crypto/evp/p_seal.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2000-05-30 18:26:22 +0000
committerDr. Stephen Henson <steve@openssl.org>2000-05-30 18:26:22 +0000
commit49528751b878a8198f628dff6651e4547818a2cf (patch)
treea73b437572c1052cc8337746602b501bebdbbaee /crypto/evp/p_seal.c
parent547bf7f9838285a111c50959a2363221971ab863 (diff)
More EVP cipher revision.
Change EVP_SealInit() and EVP_OpenInit() to handle cipher parameters. Make it possible to set RC2 and RC5 params. Make RC2 ASN1 code use the effective key bits and not the key length. TODO: document how new API works.
Diffstat (limited to 'crypto/evp/p_seal.c')
-rw-r--r--crypto/evp/p_seal.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/crypto/evp/p_seal.c b/crypto/evp/p_seal.c
index d449e892bf..47efc0d3d8 100644
--- a/crypto/evp/p_seal.c
+++ b/crypto/evp/p_seal.c
@@ -73,17 +73,20 @@ int EVP_SealInit(EVP_CIPHER_CTX *ctx, EVP_CIPHER *type, unsigned char **ek,
int i;
if (npubk <= 0) return(0);
+ if(type) {
+ EVP_CIPHER_CTX_init(ctx);
+ EVP_EncryptInit(ctx,type,NULL,NULL);
+ }
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++)
{
- 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);
}