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);