pkcs12: Treat empty string and no password differently
When deriving the PKCS#12 key, the empty string should result in a non-zero length Unicode string (two bytes for the 0 terminator).
This commit is contained in:
@@ -157,7 +157,7 @@ bool pkcs12_derive_key(hash_algorithm_t hash, chunk_t password, chunk_t salt,
|
|||||||
bool success;
|
bool success;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (password.len)
|
if (password.ptr)
|
||||||
{ /* convert the password to UTF-16BE (without BOM) with 0 terminator */
|
{ /* convert the password to UTF-16BE (without BOM) with 0 terminator */
|
||||||
unicode = chunk_alloca(password.len * 2 + 2);
|
unicode = chunk_alloca(password.len * 2 + 2);
|
||||||
for (i = 0; i < password.len; i++)
|
for (i = 0; i < password.len; i++)
|
||||||
|
|||||||
Reference in New Issue
Block a user