Go to the source code of this file.
|
static int | mpi_to_ltc_error (int err) |
|
int | gen_rand_impl (unsigned char *dst, unsigned int len) |
|
static int | rand_prime_helper (unsigned char *dst, int len, void *dat) |
|
static int | rand_prime (mp_int *N, long len) |
|
int | rsa_make_key (int size, long e, rsa_key *key) |
|
void | rsa_free (rsa_key *key) |
|
int | rsa_exptmod (const unsigned char *in, unsigned long inlen, unsigned char *out, unsigned long *outlen, int which, rsa_key *key) |
|
◆ gen_rand_impl()
◆ mpi_to_ltc_error()
static int mpi_to_ltc_error |
( |
int |
err | ) |
|
|
static |
Definition at line 42 of file rsa.c.
43{
45
49 }
50 }
52}
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
GLint GLint GLint GLint GLint x
static const struct @542 mpi_to_ltc_codes[]
Referenced by rand_prime(), rsa_exptmod(), and rsa_make_key().
◆ rand_prime()
Definition at line 61 of file rsa.c.
62{
64
65
69 } else {
70
72
73 }
74
75
76 if (len < 16 || len > 8192) {
77 printf(
"Invalid prime size!\n");
79 }
80
81
82
83
85}
#define LTM_PRIME_2MSB_ON
@ CRYPT_INVALID_PRIME_SIZE
GLuint GLuint GLsizei GLenum type
int mp_prime_rabin_miller_trials(int size)
int mp_prime_random_ex(mp_int *a, int t, int size, int flags, ltm_prime_callback cb, void *dat)
static int rand_prime_helper(unsigned char *dst, int len, void *dat)
static int mpi_to_ltc_error(int err)
Referenced by rsa_make_key().
◆ rand_prime_helper()
Definition at line 56 of file rsa.c.
57{
59}
int gen_rand_impl(unsigned char *dst, unsigned int len)
Referenced by rand_prime().
◆ rsa_exptmod()
Definition at line 180 of file rsa.c.
183{
187
188
191 }
192
193
196 }
197
198
201
202
205 goto done;
206 }
207
208
210
212
213
215
216
219
220
223 } else {
224
226 }
227
228
232 goto done;
233 }
235
236
239
240
242 goto done;
245done:
248}
int mp_to_unsigned_bin(const mp_int *a, unsigned char *b)
void mp_clear_multi(mp_int *mp,...)
int mp_unsigned_bin_size(const mp_int *a)
int mp_add(mp_int *a, mp_int *b, mp_int *c)
int mp_sub(mp_int *a, mp_int *b, mp_int *c)
int mp_cmp(const mp_int *a, const mp_int *b)
int mp_mulmod(const mp_int *a, const mp_int *b, mp_int *c, mp_int *d)
int mp_read_unsigned_bin(mp_int *a, const unsigned char *b, int c)
int mp_exptmod(const mp_int *G, const mp_int *X, mp_int *P, mp_int *Y)
int mp_mul(const mp_int *a, const mp_int *b, mp_int *c)
int mp_init_multi(mp_int *mp,...)
Referenced by encrypt_block_impl().
◆ rsa_free()
◆ rsa_make_key()
Definition at line 87 of file rsa.c.
88{
91
94 }
95
96 if ((
e < 3) || ((
e & 1) == 0)) {
98 }
99
102 }
103
104
106
107
108 do {
113
114
115 do {
120
121
123
125
126
130 }
131
135
136
137
143
146
147
156
157
159
160
162 goto done;
168done:
171}
GLdouble GLdouble GLdouble GLdouble q
int mp_copy(const mp_int *a, mp_int *b)
int mp_invmod(const mp_int *a, mp_int *b, mp_int *c)
int mp_gcd(const mp_int *a, const mp_int *b, mp_int *c)
int mp_mod(const mp_int *a, mp_int *b, mp_int *c)
int mp_lcm(const mp_int *a, const mp_int *b, mp_int *c)
int mp_sub_d(mp_int *a, mp_digit b, mp_int *c)
int mp_cmp_d(const mp_int *a, mp_digit b)
int mp_set_int(mp_int *a, unsigned long b)
static int rand_prime(mp_int *N, long len)
Referenced by new_key_impl().
◆ ltc_code
Definition at line 34 of file rsa.c.
◆ mpi_code
const struct { ... } mpi_to_ltc_codes[] |