diff options
author | Richard Levitte <levitte@openssl.org> | 2015-12-18 17:01:28 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2016-01-12 13:52:22 +0100 |
commit | 6435f0f6c6093e8e1dfb7b32c2a1a0cc646ba66d (patch) | |
tree | 444ba1661bcef4661ae6d390969833b533f6cf96 /crypto/evp/e_idea.c | |
parent | 135727abe0bfbb6ff85b92244fd67e3e831a6ee3 (diff) |
Adapt builtin cipher implementations to opaque EVP_CIPHER
They all stop including evp_locl.h, so we also take care of their
adaptation to opaque EVP_CIPHER_CTX, as was promised in an earlier
commit.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/evp/e_idea.c')
-rw-r--r-- | crypto/evp/e_idea.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/crypto/evp/e_idea.c b/crypto/evp/e_idea.c index 233eec873a..261fbeb175 100644 --- a/crypto/evp/e_idea.c +++ b/crypto/evp/e_idea.c @@ -62,9 +62,15 @@ #ifndef OPENSSL_NO_IDEA # include <openssl/evp.h> # include <openssl/objects.h> -# include "evp_locl.h" +# include "internal/evp_int.h" # include <openssl/idea.h> +/* Can't use IMPLEMENT_BLOCK_CIPHER because idea_ecb_encrypt is different */ + +typedef struct { + IDEA_KEY_SCHEDULE ks; +} EVP_IDEA_KEY; + static int idea_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc); @@ -77,16 +83,10 @@ static int idea_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, size_t inl) { BLOCK_CIPHER_ecb_loop() - idea_ecb_encrypt(in + i, out + i, ctx->cipher_data); + idea_ecb_encrypt(in + i, out + i, &EVP_C_DATA(EVP_IDEA_KEY,ctx)->ks); return 1; } -/* Can't use IMPLEMENT_BLOCK_CIPHER because idea_ecb_encrypt is different */ - -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, 64, EVP_IDEA_KEY, ks) BLOCK_CIPHER_func_cfb(idea, idea, 64, EVP_IDEA_KEY, ks) @@ -105,12 +105,12 @@ static int idea_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, enc = 1; } if (enc) - idea_set_encrypt_key(key, ctx->cipher_data); + idea_set_encrypt_key(key, &EVP_C_DATA(EVP_IDEA_KEY,ctx)->ks); else { IDEA_KEY_SCHEDULE tmp; idea_set_encrypt_key(key, &tmp); - idea_set_decrypt_key(&tmp, ctx->cipher_data); + idea_set_decrypt_key(&tmp, &EVP_C_DATA(EVP_IDEA_KEY,ctx)->ks); OPENSSL_cleanse((unsigned char *)&tmp, sizeof(IDEA_KEY_SCHEDULE)); } return 1; |