cryptlib  3.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros
keygen.h
Go to the documentation of this file.
1 /****************************************************************************
2 * *
3 * cryptlib PKC Keygen Header File *
4 * Copyright Peter Gutmann 1997-2004 *
5 * *
6 ****************************************************************************/
7 
8 #ifndef _KEYGEN_DEFINED
9 
10 #define _KEYGEN_DEFINED
11 
12 /* The number of iterations of Miller-Rabin for an error probbility of
13  (1/2)^80, from HAC */
14 
15 #define getNoPrimeChecks( noBits ) \
16  ( ( noBits < 150 ) ? 18 : ( noBits < 200 ) ? 15 : \
17  ( noBits < 250 ) ? 12 : ( noBits < 300 ) ? 9 : \
18  ( noBits < 350 ) ? 8 : ( noBits < 400 ) ? 7 : \
19  ( noBits < 500 ) ? 6 : ( noBits < 600 ) ? 5 : \
20  ( noBits < 800 ) ? 4 : ( noBits < 1250 ) ? 3 : 2 )
21 
22 /* Prototypes for functions in kg_prime.c */
23 
25 BOOLEAN primeSieve( const BIGNUM *candidate );
26 CHECK_RETVAL STDC_NONNULL_ARG( ( 1, 2 ) ) \
27 int primeProbable( INOUT PKC_INFO *pkcInfo,
29  IN_RANGE( 1, 100 ) const int noChecks );
30 CHECK_RETVAL STDC_NONNULL_ARG( ( 1, 2 ) ) \
31 int generatePrime( INOUT PKC_INFO *pkcInfo,
33  IN_LENGTH_SHORT_MIN( 120 ) const int noBits,
34  IN_INT_OPT const long exponent );
35 
36 #endif /* _KEYGEN_DEFINED */
37