From 3820b6439478ff9b1b090120859bbb56918ec594 Mon Sep 17 00:00:00 2001 From: Michael Rash Date: Wed, 1 Jan 2014 19:45:38 -0500 Subject: [PATCH] [libfko] ensure a NULL HMAC key is properly handled --- lib/fko_hmac.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/fko_hmac.c b/lib/fko_hmac.c index dac961bd..337a638a 100644 --- a/lib/fko_hmac.c +++ b/lib/fko_hmac.c @@ -48,6 +48,9 @@ fko_verify_hmac(fko_ctx_t ctx, if(!CTX_INITIALIZED(ctx)) return(FKO_ERROR_CTX_NOT_INITIALIZED); + if(hmac_key == NULL) + return(FKO_ERROR_INVALID_DATA); + if (! is_valid_encoded_msg_len(ctx->encrypted_msg_len)) return(FKO_ERROR_INVALID_DATA_HMAC_MSGLEN_VALIDFAIL); @@ -230,6 +233,9 @@ int fko_set_spa_hmac(fko_ctx_t ctx, if(!CTX_INITIALIZED(ctx)) return(FKO_ERROR_CTX_NOT_INITIALIZED); + if(hmac_key == NULL) + return(FKO_ERROR_INVALID_DATA); + if(hmac_key_len < 0 || hmac_key_len > MAX_DIGEST_BLOCK_LEN) return(FKO_ERROR_INVALID_HMAC_KEY_LEN);