diff options
author | Niels Möller <nisse@lysator.liu.se> | 2004-01-08 13:37:13 +0100 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2004-01-08 13:37:13 +0100 |
commit | 21ee1904b5c46f314b862eea33d3b86fcf6c7c88 (patch) | |
tree | 87460c8b18c74f6b20f94bac8e3cc1b378a6215f /dsa-keygen.c | |
parent | dcd5b982b7323a3834bbf43019dd8b30df7e71e4 (diff) | |
download | nettle-21ee1904b5c46f314b862eea33d3b86fcf6c7c88.tar.gz |
(TMP_DECL, TMP_ALLOC): New macros. When alloca is unavailable, they
work by allocating a fix amount of stack and imposing a hard limit on
what can be allocated. Updated all users of alloca.
Rev: src/nettle/bignum-random.c:1.4
Rev: src/nettle/cbc.c:1.8
Rev: src/nettle/dsa-keygen.c:1.7
Rev: src/nettle/hmac.c:1.6
Rev: src/nettle/pkcs1-rsa-md5.c:1.3
Rev: src/nettle/pkcs1-rsa-sha1.c:1.3
Rev: src/nettle/rsa-decrypt.c:1.5
Rev: src/nettle/rsa-encrypt.c:1.8
Rev: src/nettle/sexp.c:1.15
Diffstat (limited to 'dsa-keygen.c')
-rw-r--r-- | dsa-keygen.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/dsa-keygen.c b/dsa-keygen.c index 2bd9fd66..beb895ed 100644 --- a/dsa-keygen.c +++ b/dsa-keygen.c @@ -35,6 +35,7 @@ #include "bignum.h" #include "memxor.h" +#include "nettle-internal.h" /* The (slow) NIST method of generating DSA primes. Algorithm 4.56 of * Handbook of Applied Cryptography. */ @@ -118,8 +119,10 @@ dsa_nist_gen(mpz_t p, mpz_t q, progress(progress_ctx, '\n'); { + /* Official maximum key size: L = 1024 => n = 6 */ + TMP_DECL(buffer, uint8_t, (6 + 1) * SHA1_DIGEST_SIZE); unsigned size = (n+1) * SHA1_DIGEST_SIZE; - uint8_t *buffer = alloca(size); + TMP_ALLOC(buffer, size); unsigned i, j; for (i = 0, j = 2; i<4096; i++, j+= n+1) |