diff options
author | Richard Levitte <levitte@openssl.org> | 2015-11-27 14:02:12 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2015-12-07 17:39:23 +0100 |
commit | 6e59a892db781658c050e5217127c4147c116ac9 (patch) | |
tree | eec9e79e1c71f9c2897f49b29084bf42a66e96db /engines | |
parent | 9b6c00707eae2cbce79479f4b1a5dc11019abca0 (diff) |
Adjust all accesses to EVP_MD_CTX to use accessor functions.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'engines')
-rw-r--r-- | engines/ccgost/gost_crypt.c | 15 | ||||
-rw-r--r-- | engines/ccgost/gost_md.c | 16 | ||||
-rw-r--r-- | engines/ccgost/gost_pmeth.c | 3 | ||||
-rw-r--r-- | engines/e_dasync.c | 2 | ||||
-rw-r--r-- | engines/e_ossltest.c | 8 |
5 files changed, 23 insertions, 21 deletions
diff --git a/engines/ccgost/gost_crypt.c b/engines/ccgost/gost_crypt.c index fb066d9534..9483fa3b64 100644 --- a/engines/ccgost/gost_crypt.c +++ b/engines/ccgost/gost_crypt.c @@ -500,7 +500,7 @@ int gost89_get_asn1_parameters(EVP_CIPHER_CTX *ctx, ASN1_TYPE *params) int gost_imit_init_cpa(EVP_MD_CTX *ctx) { - struct ossl_gost_imit_ctx *c = ctx->md_data; + struct ossl_gost_imit_ctx *c = EVP_MD_CTX_md_data(ctx); memset(c->buffer, 0, sizeof(c->buffer)); memset(c->partial_block, 0, sizeof(c->partial_block)); c->count = 0; @@ -529,7 +529,7 @@ static void mac_block_mesh(struct ossl_gost_imit_ctx *c, int gost_imit_update(EVP_MD_CTX *ctx, const void *data, size_t count) { - struct ossl_gost_imit_ctx *c = ctx->md_data; + struct ossl_gost_imit_ctx *c = EVP_MD_CTX_md_data(ctx); const unsigned char *p = data; size_t bytes = count, i; if (!(c->key_set)) { @@ -561,7 +561,7 @@ int gost_imit_update(EVP_MD_CTX *ctx, const void *data, size_t count) int gost_imit_final(EVP_MD_CTX *ctx, unsigned char *md) { - struct ossl_gost_imit_ctx *c = ctx->md_data; + struct ossl_gost_imit_ctx *c = EVP_MD_CTX_md_data(ctx); if (!c->key_set) { GOSTerr(GOST_F_GOST_IMIT_FINAL, GOST_R_MAC_KEY_NOT_SET); return 0; @@ -595,9 +595,9 @@ int gost_imit_ctrl(EVP_MD_CTX *ctx, int type, int arg, void *ptr) return 0; } - gost_key(&(((struct ossl_gost_imit_ctx *)(ctx->md_data))->cctx), + gost_key(&(((struct ossl_gost_imit_ctx *)(EVP_MD_CTX_md_data(ctx)))->cctx), ptr); - ((struct ossl_gost_imit_ctx *)(ctx->md_data))->key_set = 1; + ((struct ossl_gost_imit_ctx *)(EVP_MD_CTX_md_data(ctx)))->key_set = 1; return 1; } @@ -608,13 +608,14 @@ int gost_imit_ctrl(EVP_MD_CTX *ctx, int type, int arg, void *ptr) int gost_imit_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from) { - memcpy(to->md_data, from->md_data, sizeof(struct ossl_gost_imit_ctx)); + memcpy(EVP_MD_CTX_md_data(to), EVP_MD_CTX_md_data(from), + sizeof(struct ossl_gost_imit_ctx)); return 1; } /* Clean up imit ctx */ int gost_imit_cleanup(EVP_MD_CTX *ctx) { - memset(ctx->md_data, 0, sizeof(struct ossl_gost_imit_ctx)); + memset(EVP_MD_CTX_md_data(ctx), 0, sizeof(struct ossl_gost_imit_ctx)); return 1; } diff --git a/engines/ccgost/gost_md.c b/engines/ccgost/gost_md.c index 6c96a1bd24..7b780772b2 100644 --- a/engines/ccgost/gost_md.c +++ b/engines/ccgost/gost_md.c @@ -36,7 +36,7 @@ EVP_MD digest_gost = { int gost_digest_init(EVP_MD_CTX *ctx) { - struct ossl_gost_digest_ctx *c = ctx->md_data; + struct ossl_gost_digest_ctx *c = EVP_MD_CTX_md_data(ctx); memset(&(c->dctx), 0, sizeof(gost_hash_ctx)); gost_init(&(c->cctx), &GostR3411_94_CryptoProParamSet); c->dctx.cipher_ctx = &(c->cctx); @@ -45,20 +45,20 @@ int gost_digest_init(EVP_MD_CTX *ctx) int gost_digest_update(EVP_MD_CTX *ctx, const void *data, size_t count) { - return hash_block((gost_hash_ctx *) ctx->md_data, data, count); + return hash_block((gost_hash_ctx *) EVP_MD_CTX_md_data(ctx), data, count); } int gost_digest_final(EVP_MD_CTX *ctx, unsigned char *md) { - return finish_hash((gost_hash_ctx *) ctx->md_data, md); + return finish_hash((gost_hash_ctx *) EVP_MD_CTX_md_data(ctx), md); } int gost_digest_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from) { - struct ossl_gost_digest_ctx *md_ctx = to->md_data; - if (to->md_data && from->md_data) { - memcpy(to->md_data, from->md_data, + struct ossl_gost_digest_ctx *md_ctx = EVP_MD_CTX_md_data(to); + if (EVP_MD_CTX_md_data(to) && EVP_MD_CTX_md_data(from)) { + memcpy(EVP_MD_CTX_md_data(to), EVP_MD_CTX_md_data(from), sizeof(struct ossl_gost_digest_ctx)); md_ctx->dctx.cipher_ctx = &(md_ctx->cctx); } @@ -67,7 +67,7 @@ int gost_digest_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from) int gost_digest_cleanup(EVP_MD_CTX *ctx) { - if (ctx->md_data) - memset(ctx->md_data, 0, sizeof(struct ossl_gost_digest_ctx)); + if (EVP_MD_CTX_md_data(ctx)) + memset(EVP_MD_CTX_md_data(ctx), 0, sizeof(struct ossl_gost_digest_ctx)); return 1; } diff --git a/engines/ccgost/gost_pmeth.c b/engines/ccgost/gost_pmeth.c index e70e2979db..f0f331e5cc 100644 --- a/engines/ccgost/gost_pmeth.c +++ b/engines/ccgost/gost_pmeth.c @@ -388,7 +388,8 @@ static int pkey_gost_mac_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) } else { key = &(data->key); } - return mctx->digest->md_ctrl(mctx, EVP_MD_CTRL_SET_KEY, 32, key); + return EVP_MD_CTX_md(mctx)->md_ctrl(mctx, EVP_MD_CTRL_SET_KEY, + 32, key); } } return -2; diff --git a/engines/e_dasync.c b/engines/e_dasync.c index c31b43a36d..7f6aa7568d 100644 --- a/engines/e_dasync.c +++ b/engines/e_dasync.c @@ -259,7 +259,7 @@ static void dummy_pause_job(void) { * implementation */ #undef data -#define data(ctx) ((SHA_CTX *)(ctx)->md_data) +#define data(ctx) ((SHA_CTX *)EVP_MD_CTX_md_data(ctx)) static int dasync_sha1_init(EVP_MD_CTX *ctx) { dummy_pause_job(); diff --git a/engines/e_ossltest.c b/engines/e_ossltest.c index 94e53cd0ca..02c3c58570 100644 --- a/engines/e_ossltest.c +++ b/engines/e_ossltest.c @@ -365,7 +365,7 @@ static void fill_known_data(unsigned char *md, unsigned int len) * the same value. */ #undef data -#define data(ctx) ((MD5_CTX *)(ctx)->md_data) +#define data(ctx) ((MD5_CTX *)EVP_MD_CTX_md_data(ctx)) static int digest_md5_init(EVP_MD_CTX *ctx) { return MD5_Init(data(ctx)); @@ -392,7 +392,7 @@ static int digest_md5_final(EVP_MD_CTX *ctx, unsigned char *md) * SHA1 implementation. */ #undef data -#define data(ctx) ((SHA_CTX *)(ctx)->md_data) +#define data(ctx) ((SHA_CTX *)EVP_MD_CTX_md_data(ctx)) static int digest_sha1_init(EVP_MD_CTX *ctx) { return SHA1_Init(data(ctx)); @@ -419,7 +419,7 @@ static int digest_sha1_final(EVP_MD_CTX *ctx, unsigned char *md) * SHA256 implementation. */ #undef data -#define data(ctx) ((SHA256_CTX *)(ctx)->md_data) +#define data(ctx) ((SHA256_CTX *)EVP_MD_CTX_md_data(ctx)) static int digest_sha256_init(EVP_MD_CTX *ctx) { return SHA256_Init(data(ctx)); @@ -446,7 +446,7 @@ static int digest_sha256_final(EVP_MD_CTX *ctx, unsigned char *md) * SHA384/512 implementation. */ #undef data -#define data(ctx) ((SHA512_CTX *)(ctx)->md_data) +#define data(ctx) ((SHA512_CTX *)EVP_MD_CTX_md_data(ctx)) static int digest_sha384_init(EVP_MD_CTX *ctx) { return SHA384_Init(data(ctx)); |