Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update HMAC to fail when null value is passed to out parameter (#1662)
### Issues: CryptoAlg-2522 ### Description of changes: Currently, `NULL` passed as the value of `out` can result in a segmentation fault. This change adds checks to the HMAC one-shot API and HMAC_final function to handle scenarios where `NULL` is passed as a value to the `out` parameter to return from the functions and prevent further computation. ### Testing: Added additional test case in `crypto/hmac_extra/hmac_test.cc` to verify the behavior when `NULL` is passed as a value to `out` in both functions. ### Call-outs: - OpenSSL supports this differently by allowing the computation to occur but allocating a throw-away array [OpenSSL implementation](https://github.com/openssl/openssl/blob/1977c00f00ad0546421a5ec0b40c1326aee4cddb/crypto/hmac/hmac.c#L233) - We should also evaluate if this change should be back-ported to the FIPS branches By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license. Co-authored-by: Sean McGrail <[email protected]>
- Loading branch information