Fixed PKCS5_PBKDF2_HMAC() to adhere to the documentation.
authorPéter Budai <buc@peterbudai.eu>
Tue, 11 Oct 2016 17:26:23 +0000 (19:26 +0200)
committerRich Salz <rsalz@openssl.org>
Fri, 17 Mar 2017 12:57:04 +0000 (08:57 -0400)
commit8d049ed24b06ada5bb8c50143c23c061647ca5d9
tree0814022bf46a62e1dce5236dba87caefa551800e
parent79037e85140887276476e03ce941b1ff0382543d
Fixed PKCS5_PBKDF2_HMAC() to adhere to the documentation.

The documentation of this function states that the password parameter
can be NULL. However, the implementation returns an error in this case
due to the inner workings of the HMAC_Init_ex() function.
With this change, NULL password will be treated as an empty string and
PKCS5_PBKDF2_HMAC() no longer fails on this input.

I have also added two new test cases that tests the handling of the
special values NULL and -1 of the password and passlen parameters,
respectively.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1692)
(cherry picked from commit fa013b65241dfed9b7d9e10e0adfedc9869c797e)
crypto/evp/p5_crpt2.c
test/evp_test.c
test/evptests.txt