[Review] Address applicable review comments from PR#157 (PBKDF2)

Some issues found with my PBKDF2 implementation are also found in the HKDF
code, so fix them here, too.

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>