Polly 20.0.0git
Classes | Functions
rsakey.c File Reference
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
#include <unistd.h>
#include "imath.h"
#include "iprime.h"

Go to the source code of this file.

Classes

struct  rsa_key
 

Functions

int randomize (unsigned char *buf, size_t len)
 
mp_result mp_int_randomize (mp_int a, mp_size n_bits)
 
mp_result find_prime (mp_int seed, FILE *fb)
 
mp_result rsa_key_init (rsa_key *kp)
 
void rsa_key_clear (rsa_key *kp)
 
void rsa_key_write (rsa_key *kp, FILE *ofp)
 
int main (int argc, char *argv[])
 

Function Documentation

◆ find_prime()

mp_result find_prime ( mp_int  seed,
FILE *  fb 
)

Definition at line 246 of file rsakey.c.

References count(), MP_FALSE, mp_int_add_value, mp_int_is_even(), mp_int_is_prime(), MP_OK, MP_TRUE, and res.

Referenced by main().

◆ main()

int main ( int  argc,
char *  argv[] 
)

◆ mp_int_randomize()

mp_result mp_int_randomize ( mp_int  a,
mp_size  n_bits 
)

Definition at line 213 of file rsakey.c.

References a(), mp_int_read_unsigned, MP_MEMORY, MP_OK, MP_TRUNC, randomize(), and res.

Referenced by main().

◆ randomize()

int randomize ( unsigned char *  buf,
size_t  len 
)

Definition at line 201 of file rsakey.c.

Referenced by mp_int_randomize().

◆ rsa_key_clear()

void rsa_key_clear ( rsa_key kp)

Definition at line 276 of file rsakey.c.

References rsa_key::d, rsa_key::e, mp_int_clear, rsa_key::n, rsa_key::p, and rsa_key::q.

Referenced by main().

◆ rsa_key_init()

mp_result rsa_key_init ( rsa_key kp)

Definition at line 266 of file rsakey.c.

References rsa_key::d, rsa_key::e, mp_int_init, MP_OK, rsa_key::n, rsa_key::p, and rsa_key::q.

Referenced by main().

◆ rsa_key_write()

void rsa_key_write ( rsa_key kp,
FILE *  ofp 
)

Definition at line 284 of file rsakey.c.

References rsa_key::d, rsa_key::e, mp_int_string_len, mp_int_to_string, rsa_key::n, rsa_key::p, and rsa_key::q.

Referenced by main().