- 69ED0DE509C413D6E911966E2E60DE118D6D8DB4516AC444FEC119C08576153246DA0F6AA27DDFCFE3398290A93E000C4A4B6F296B452ED3DDFE406660247708
+ D3DF108B121830777634FA225DD26165762168EE632C81906B9FEB22B43017360F77FAE03CE53F4EEEC2B81EB28249BCC6542D50AE0FEC9F3F1C0D33EB6B3C20
eucrypt/smg_rsa/include/smg_rsa.h
(8 . 6)(8 . 13)
48 #include "mpi.h"
49 #include "knobs.h"
50
51 /*
52 * These are constants as per TMSR RSA specification, NOT knobs!
53 * TMSR key length is 4096 bits (512 octets); this means 2 primes of 2048 bits (256 octets) each.
54 * NB: if you choose here an odd key length in octets you might end up with a smaller actual key, read the code.
55 */
56 static const int KEY_LENGTH_OCTETS = 512;
57
58 /*********truerandom.c*********/
59
60 /*
(63 . 6)(70 . 22)
62 */
63 int is_composite( MPI n, int nwitnesses, int entropy_source);
64
65 /**
66 * Generates a random number that has passed the Miller-Rabin test for primality (see function is_composite above).
67 * NB: top 2 bits and bottom bit are ALWAYS 1! (i.e. a mask 110....01 is applied to the random bits)
68 * a prime of 8*noctets long will have only (8*noctets-3) bits that are randomly chosen!
69 * NB: this method does NOT allocate space for the requested MPI; it is the caller's responsibility to allocate it!
70 * The source of randomness is ENTROPY_SOURCE in eucrypt/smg_rsa/include/knobs.h
71 * The number of witnesses checked by Miller-Rabin is M_R_ITERATIONS in eucrypt/smg_rsa/include/knobs.h
72 * Preconditions:
73 * noctets > 0 (at least one octet!)
74 * output has known allocated memory for at least nlimbs(noctets)
75 * successful access to the entropy source
76 * @param noctets the length of the desired prime number, in octets
77 * @param output an MPI with sufficient memory allocated for a number that is noctets long
78 */
79 void gen_random_prime( unsigned int noctets, MPI output);
80
81
82 #endif /*SMG_RSA*/
83