* grub-core/lib/pbkdf2.c: Remove variable length arrays.

This commit is contained in:
Vladimir Serbinenko 2013-11-12 01:52:55 +01:00
parent 41f26e0ebc
commit 9c6482b8d6
2 changed files with 9 additions and 2 deletions

View File

@ -1,3 +1,7 @@
2013-11-12 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/lib/pbkdf2.c: Remove variable length arrays.
2013-11-12 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/tests/pbkdf2_test.c: New test.

View File

@ -41,8 +41,8 @@ grub_crypto_pbkdf2 (const struct gcry_md_spec *md,
grub_uint8_t *DK, grub_size_t dkLen)
{
unsigned int hLen = md->mdlen;
grub_uint8_t U[md->mdlen];
grub_uint8_t T[md->mdlen];
grub_uint8_t U[GRUB_CRYPTO_MAX_MDLEN];
grub_uint8_t T[GRUB_CRYPTO_MAX_MDLEN];
unsigned int u;
unsigned int l;
unsigned int r;
@ -52,6 +52,9 @@ grub_crypto_pbkdf2 (const struct gcry_md_spec *md,
grub_uint8_t *tmp;
grub_size_t tmplen = Slen + 4;
if (md->mdlen > GRUB_CRYPTO_MAX_MDLEN)
return GPG_ERR_INV_ARG;
if (c == 0)
return GPG_ERR_INV_ARG;