diff options
author | Werner Koch <[email protected]> | 2005-03-07 13:59:59 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2005-03-07 13:59:59 +0000 |
commit | c91e30fda49244ee89edc74acd1a9897f35e6539 (patch) | |
tree | fe38ba8ec1f9014eb9323f0a4f7fe748070e5644 /cipher/primegen.c | |
parent | * libcurl.m4: Use $LIBS instead of $LDFLAGS. This should help build (diff) | |
download | gnupg-c91e30fda49244ee89edc74acd1a9897f35e6539.tar.gz gnupg-c91e30fda49244ee89edc74acd1a9897f35e6539.zip |
* primegen.c (is_prime): Free A2. Noted by [email protected].
Fixes #423.
* DETAILS: Document new status codes.
* cardglue.c (agent_scd_pkdecrypt, agent_scd_pksign)
(agent_scd_genkey, agent_scd_setattr, agent_scd_change_pin)
(agent_scd_checkpin, agent_openpgp_storekey): Make sure to send a
SC_OP_FAILURE after card operations which might change data.
* card-util.c (change_pin): Send a SC_OP_SUCCESS after a PIN has
been changed.
(change_name): Removed a debug output.
* status.h, status.c: New codes BAD_PASSPHRASE_PIN, SC_OP_FAILURE
and SC_OP_SUCCESS.
* de.po: Updated. Translation is still in the works, though.
Diffstat (limited to '')
-rw-r--r-- | cipher/primegen.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/cipher/primegen.c b/cipher/primegen.c index 22b9bc455..dda9012b5 100644 --- a/cipher/primegen.c +++ b/cipher/primegen.c @@ -462,15 +462,16 @@ is_prime( MPI n, int steps, int *count ) mpi_set_ui( x, 2 ); } else { - /*mpi_set_bytes( x, nbits-1, get_random_byte, 0 );*/ - { char *p = get_random_bits( nbits, 0, 0 ); - mpi_set_buffer( x, p, (nbits+7)/8, 0 ); - m_free(p); - } - /* make sure that the number is smaller than the prime - * and keep the randomness of the high bit */ + char *p; + + p = get_random_bits( nbits, 0, 0 ); + mpi_set_buffer( x, p, (nbits+7)/8, 0 ); + m_free(p); + + /* Make sure that the number is smaller than the prime + * and keep the randomness of the high bit. */ if( mpi_test_bit( x, nbits-2 ) ) { - mpi_set_highbit( x, nbits-2 ); /* clear all higher bits */ + mpi_set_highbit( x, nbits-2 ); /* Clear all higher bits */ } else { mpi_set_highbit( x, nbits-2 ); @@ -498,6 +499,7 @@ is_prime( MPI n, int steps, int *count ) mpi_free( z ); mpi_free( nminus1 ); mpi_free( q ); + mpi_free (a2); return rc; } |