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:47:11 +0000 (08:47 -0400)
commitfa013b65241dfed9b7d9e10e0adfedc9869c797e
tree484147798c49c20544b9d79bb71146ed21b9557d
parent9998b32cb63b0bdd3d014abfa1d70e9a2c20a283
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)
crypto/evp/p5_crpt2.c
test/evp_test.c
test/evptests.txt