aboutsummaryrefslogtreecommitdiff
path: root/crypto/evp/evp_locl.h
diff options
context:
space:
mode:
authorBen Laurie <ben@openssl.org>2001-07-30 23:57:25 +0000
committerBen Laurie <ben@openssl.org>2001-07-30 23:57:25 +0000
commitdbad169019598981174ff46c7a9bf58373b0e53a (patch)
treece8ca1188d5614648f24b03967785543f1edc8f5 /crypto/evp/evp_locl.h
parent3ba5d1cf2eb6ef28ac5f6d9f3d28020d00c5be50 (diff)
downloadopenssl-dbad169019598981174ff46c7a9bf58373b0e53a.zip
openssl-dbad169019598981174ff46c7a9bf58373b0e53a.tar.gz
openssl-dbad169019598981174ff46c7a9bf58373b0e53a.tar.bz2
Really add the EVP and all of the DES changes.
Diffstat (limited to 'crypto/evp/evp_locl.h')
-rw-r--r--crypto/evp/evp_locl.h43
1 files changed, 21 insertions, 22 deletions
diff --git a/crypto/evp/evp_locl.h b/crypto/evp/evp_locl.h
index 264e9ce..62fbeba 100644
--- a/crypto/evp/evp_locl.h
+++ b/crypto/evp/evp_locl.h
@@ -66,40 +66,40 @@
inl -= 8; \
for(i=0; i <= inl; i+=8) \
-#define BLOCK_CIPHER_func_ecb(cname, cprefix, kname) \
+#define BLOCK_CIPHER_func_ecb(cname, cprefix, kstruct, ksched) \
static int cname##_ecb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) \
{\
BLOCK_CIPHER_ecb_loop() \
- cprefix##_ecb_encrypt(in + i, out + i, &ctx->c.kname, ctx->encrypt);\
+ cprefix##_ecb_encrypt(in + i, out + i, &((kstruct *)ctx->cipher_data)->ksched, ctx->encrypt);\
return 1;\
}
-#define BLOCK_CIPHER_func_ofb(cname, cprefix, kname) \
+#define BLOCK_CIPHER_func_ofb(cname, cprefix, kstruct, ksched) \
static int cname##_ofb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) \
{\
- cprefix##_ofb64_encrypt(in, out, (long)inl, &ctx->c.kname, ctx->iv, &ctx->num);\
+ cprefix##_ofb64_encrypt(in, out, (long)inl, &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, &ctx->num);\
return 1;\
}
-#define BLOCK_CIPHER_func_cbc(cname, cprefix, kname) \
+#define BLOCK_CIPHER_func_cbc(cname, cprefix, kstruct, ksched) \
static int cname##_cbc_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) \
{\
- cprefix##_cbc_encrypt(in, out, (long)inl, &ctx->c.kname, ctx->iv, ctx->encrypt);\
+ cprefix##_cbc_encrypt(in, out, (long)inl, &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, ctx->encrypt);\
return 1;\
}
-#define BLOCK_CIPHER_func_cfb(cname, cprefix, kname) \
+#define BLOCK_CIPHER_func_cfb(cname, cprefix, kstruct, ksched) \
static int cname##_cfb_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, const unsigned char *in, unsigned int inl) \
{\
- cprefix##_cfb64_encrypt(in, out, (long)inl, &ctx->c.kname, ctx->iv, &ctx->num, ctx->encrypt);\
+ cprefix##_cfb64_encrypt(in, out, (long)inl, &((kstruct *)ctx->cipher_data)->ksched, ctx->iv, &ctx->num, ctx->encrypt);\
return 1;\
}
-#define BLOCK_CIPHER_all_funcs(cname, cprefix, kname) \
- BLOCK_CIPHER_func_cbc(cname, cprefix, kname) \
- BLOCK_CIPHER_func_cfb(cname, cprefix, kname) \
- BLOCK_CIPHER_func_ecb(cname, cprefix, kname) \
- BLOCK_CIPHER_func_ofb(cname, cprefix, kname)
+#define BLOCK_CIPHER_all_funcs(cname, cprefix, kstruct, ksched) \
+ BLOCK_CIPHER_func_cbc(cname, cprefix, kstruct, ksched) \
+ BLOCK_CIPHER_func_cfb(cname, cprefix, kstruct, ksched) \
+ BLOCK_CIPHER_func_ecb(cname, cprefix, kstruct, ksched) \
+ BLOCK_CIPHER_func_ofb(cname, cprefix, kstruct, ksched)
#define BLOCK_CIPHER_def1(cname, nmode, mode, MODE, kstruct, nid, block_size, \
key_len, iv_len, flags, init_key, cleanup, \
@@ -110,8 +110,7 @@ static const EVP_CIPHER cname##_##mode = { \
init_key, \
cname##_##mode##_cipher, \
cleanup, \
- sizeof(EVP_CIPHER_CTX)-sizeof((((EVP_CIPHER_CTX *)NULL)->c))+\
- sizeof((((EVP_CIPHER_CTX *)NULL)->c.kstruct)),\
+ sizeof(kstruct), \
set_asn1, get_asn1,\
ctrl, \
NULL \
@@ -213,11 +212,11 @@ static const EVP_CIPHER cname##_ecb = {\
const EVP_CIPHER *EVP_##cname##_ecb(void) { return &cname##_ecb; }
*/
+#define IMPLEMENT_BLOCK_CIPHER(cname, ksched, cprefix, kstruct, nid, \
+ block_size, key_len, iv_len, flags, init_key, \
+ cleanup, set_asn1, get_asn1, ctrl) \
+ BLOCK_CIPHER_all_funcs(cname, cprefix, kstruct, ksched) \
+ BLOCK_CIPHER_defs(cname, kstruct, nid, block_size, key_len, iv_len, \
+ flags, init_key, cleanup, set_asn1, get_asn1, ctrl)
-#define IMPLEMENT_BLOCK_CIPHER(cname, kname, cprefix, kstruct, \
- nid, block_size, key_len, iv_len, flags, \
- init_key, cleanup, set_asn1, get_asn1, ctrl) \
- BLOCK_CIPHER_all_funcs(cname, cprefix, kname) \
- BLOCK_CIPHER_defs(cname, kstruct, nid, block_size, key_len, iv_len, flags,\
- init_key, cleanup, set_asn1, get_asn1, ctrl)
-
+#define EVP_C_DATA(kstruct, ctx) ((kstruct *)(ctx)->cipher_data)