[libfko] ensure a NULL HMAC key is properly handled

This commit is contained in:
Michael Rash
2014-01-01 19:45:38 -05:00
parent 34a3808b99
commit 3820b64394
+6
View File
@@ -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);