diff options
author | Ben Laurie <ben@openssl.org> | 2001-07-30 23:57:25 +0000 |
---|---|---|
committer | Ben Laurie <ben@openssl.org> | 2001-07-30 23:57:25 +0000 |
commit | dbad169019598981174ff46c7a9bf58373b0e53a (patch) | |
tree | ce8ca1188d5614648f24b03967785543f1edc8f5 /crypto/evp/e_idea.c | |
parent | 3ba5d1cf2eb6ef28ac5f6d9f3d28020d00c5be50 (diff) |
Really add the EVP and all of the DES changes.
Diffstat (limited to 'crypto/evp/e_idea.c')
-rw-r--r-- | crypto/evp/e_idea.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/crypto/evp/e_idea.c b/crypto/evp/e_idea.c index 53fc64a869..66f06c0622 100644 --- a/crypto/evp/e_idea.c +++ b/crypto/evp/e_idea.c @@ -63,6 +63,7 @@ #include <openssl/evp.h> #include <openssl/objects.h> #include "evp_locl.h" +#include <openssl/idea.h> static int idea_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv,int enc); @@ -75,17 +76,22 @@ static int idea_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) { BLOCK_CIPHER_ecb_loop() - idea_ecb_encrypt(in + i, out + i, &ctx->c.idea_ks); + idea_ecb_encrypt(in + i, out + i, ctx->cipher_data); return 1; } /* Can't use IMPLEMENT_BLOCK_CIPHER because idea_ecb_encrypt is different */ -BLOCK_CIPHER_func_cbc(idea, idea, idea_ks) -BLOCK_CIPHER_func_ofb(idea, idea, idea_ks) -BLOCK_CIPHER_func_cfb(idea, idea, idea_ks) +typedef struct + { + IDEA_KEY_SCHEDULE ks; + } EVP_IDEA_KEY; + +BLOCK_CIPHER_func_cbc(idea, idea, EVP_IDEA_KEY, ks) +BLOCK_CIPHER_func_ofb(idea, idea, EVP_IDEA_KEY, ks) +BLOCK_CIPHER_func_cfb(idea, idea, EVP_IDEA_KEY, ks) -BLOCK_CIPHER_defs(idea, idea_ks, NID_idea, 8, 16, 8, +BLOCK_CIPHER_defs(idea, IDEA_KEY_SCHEDULE, NID_idea, 8, 16, 8, 0, idea_init_key, NULL, EVP_CIPHER_set_asn1_iv, EVP_CIPHER_get_asn1_iv, NULL) @@ -96,13 +102,13 @@ static int idea_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, if (EVP_CIPHER_CTX_mode(ctx) == EVP_CIPH_OFB_MODE) enc = 1; else if (EVP_CIPHER_CTX_mode(ctx) == EVP_CIPH_CFB_MODE) enc = 1; } - if (enc) idea_set_encrypt_key(key,&(ctx->c.idea_ks)); + if (enc) idea_set_encrypt_key(key,ctx->cipher_data); else { IDEA_KEY_SCHEDULE tmp; idea_set_encrypt_key(key,&tmp); - idea_set_decrypt_key(&tmp,&(ctx->c.idea_ks)); + idea_set_decrypt_key(&tmp,ctx->cipher_data); memset((unsigned char *)&tmp,0, sizeof(IDEA_KEY_SCHEDULE)); } |