summaryrefslogtreecommitdiffstats
path: root/engines/e_ossltest.c
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2015-12-13 22:06:14 +0100
committerRichard Levitte <levitte@openssl.org>2016-01-12 13:52:22 +0100
commit936166aff21dafed33aeb92bad0a5b46d730221d (patch)
treed8d6943e520a08b35519ad9d5cd3168dfab14f14 /engines/e_ossltest.c
parentc0ca39bdd6048c77901f821ba0d2eeaa9341f7af (diff)
Adapt cipher implementations to opaque EVP_CIPHER_CTX
Note: there's a larger number of implementations in crypto/evp/ that aren't affected because they include evp_locl.h. They will be handled in a separate commit. Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'engines/e_ossltest.c')
-rw-r--r--engines/e_ossltest.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/engines/e_ossltest.c b/engines/e_ossltest.c
index 5fdb23ed6a..a5adacf461 100644
--- a/engines/e_ossltest.c
+++ b/engines/e_ossltest.c
@@ -287,7 +287,7 @@ static const EVP_CIPHER ossltest_aes_128_cbc = { \
EVP_CIPH_FLAG_DEFAULT_ASN1 | EVP_CIPH_CBC_MODE,
ossltest_aes128_init_key,
ossltest_aes128_cbc_cipher,
- NULL,
+ NULL, /* FIXME: when EVP_CIPHER goes opaque, this should be set to EVP_aes_128_cbc()->ctx_size */
0, /* We don't know the size of cipher_data at compile time */
NULL,NULL,NULL,NULL
};
@@ -569,14 +569,15 @@ static int digest_sha512_final(EVP_MD_CTX *ctx, unsigned char *md)
int ossltest_aes128_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
const unsigned char *iv, int enc)
{
- if (ctx->cipher_data == NULL) {
+ if (EVP_CIPHER_CTX_cipher_data(ctx) == NULL) {
/*
* Normally cipher_data is allocated automatically for an engine but
* we don't know the ctx_size as compile time so we have to do it at
* run time
*/
- ctx->cipher_data = OPENSSL_zalloc(EVP_aes_128_cbc()->ctx_size);
- if (ctx->cipher_data == NULL) {
+ /* FIXME: when EVP_CIPHER goes opaque, we won't need this trickery any more */
+ EVP_CIPHER_CTX_new_cipher_data(ctx, EVP_aes_128_cbc()->ctx_size);
+ if (EVP_CIPHER_CTX_cipher_data(ctx) == NULL) {
OSSLTESTerr(OSSLTEST_F_OSSLTEST_AES128_INIT_KEY,
ERR_R_MALLOC_FAILURE);
return 0;