diff options
author | Matt Caswell <matt@openssl.org> | 2019-03-26 12:11:12 +0000 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2019-03-27 14:31:56 +0000 |
commit | 17838470617afd50813a66adcebad2e6e17de79c (patch) | |
tree | db2ab932b6b858e87517d46e3b0d839c413d27b1 /crypto/modes | |
parent | 183f52e29af27285ea4ed7c947b71c83618f8702 (diff) |
Correctly check the return code of EVP_MAC_ctrl everwhere it is used
EVP_MAC_ctrl is documented to return 0 or -1 on failure. Numerous places
were not getting this check correct.
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/8584)
Diffstat (limited to 'crypto/modes')
-rw-r--r-- | crypto/modes/siv128.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/modes/siv128.c b/crypto/modes/siv128.c index 99b11d179a..f812d0a727 100644 --- a/crypto/modes/siv128.c +++ b/crypto/modes/siv128.c @@ -166,8 +166,8 @@ int CRYPTO_siv128_init(SIV128_CONTEXT *ctx, const unsigned char *key, int klen, || (ctx->cipher_ctx = EVP_CIPHER_CTX_new()) == NULL || (ctx->mac_ctx_init = EVP_MAC_CTX_new_id(EVP_MAC_CMAC)) == NULL || (ctx->mac_ctx = EVP_MAC_CTX_new_id(EVP_MAC_CMAC)) == NULL - || !EVP_MAC_ctrl(ctx->mac_ctx_init, EVP_MAC_CTRL_SET_CIPHER, cbc) - || !EVP_MAC_ctrl(ctx->mac_ctx_init, EVP_MAC_CTRL_SET_KEY, key, klen) + || EVP_MAC_ctrl(ctx->mac_ctx_init, EVP_MAC_CTRL_SET_CIPHER, cbc) <= 0 + || EVP_MAC_ctrl(ctx->mac_ctx_init, EVP_MAC_CTRL_SET_KEY, key, klen) <= 0 || !EVP_EncryptInit_ex(ctx->cipher_ctx, ctr, NULL, key + klen, NULL) || !EVP_MAC_CTX_copy(ctx->mac_ctx, ctx->mac_ctx_init) || !EVP_MAC_update(ctx->mac_ctx, zero, sizeof(zero)) |