summaryrefslogtreecommitdiffstats
path: root/src/methods/composed_gmac
diff options
context:
space:
mode:
Diffstat (limited to 'src/methods/composed_gmac')
-rw-r--r--src/methods/composed_gmac/composed_gmac.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/methods/composed_gmac/composed_gmac.c b/src/methods/composed_gmac/composed_gmac.c
index cb0d5d6..b8ee2f6 100644
--- a/src/methods/composed_gmac/composed_gmac.c
+++ b/src/methods/composed_gmac/composed_gmac.c
@@ -147,7 +147,13 @@ static fastd_method_session_state_t* method_session_init(fastd_context_t *ctx, c
uint8_t zeroiv[session->gmac_cipher_info->iv_length];
memset(zeroiv, 0, session->gmac_cipher_info->iv_length);
- session->gmac_cipher->crypt(ctx, session->gmac_cipher_state, &H, &ZERO_BLOCK, sizeof(fastd_block128_t), zeroiv);
+ if (!session->gmac_cipher->crypt(ctx, session->gmac_cipher_state, &H, &ZERO_BLOCK, sizeof(fastd_block128_t), zeroiv)) {
+ session->cipher->free_state(ctx, session->cipher_state);
+ session->gmac_cipher->free_state(ctx, session->gmac_cipher_state);
+ free(session);
+
+ return NULL;
+ }
session->ghash = fastd_mac_get_by_name(ctx, "ghash", &session->ghash_info, &session->ghash_ctx);
if (!session->ghash)