30 lines
473 B
C
30 lines
473 B
C
#ifndef _RSA_H
|
|
#define _RSA_H 1
|
|
|
|
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include <stddef.h>
|
|
#include <stdlib.h>
|
|
#include <fcntl.h>
|
|
#include <unistd.h>
|
|
#include <string.h>
|
|
#include <stdbool.h>
|
|
|
|
#define RSA_BLOCK_SIZE 128
|
|
|
|
typedef struct rsa_s {
|
|
uint64_t n;
|
|
uint64_t d;
|
|
} rsa_t;
|
|
|
|
void *protected_malloc(size_t size);
|
|
|
|
rsa_t rsa_generate_keys();
|
|
|
|
uint16_t generate_prime();
|
|
uint64_t pow_mod(uint64_t nn, uint64_t e, uint64_t mm);
|
|
uint16_t get_random_bytes(int fd);
|
|
|
|
#endif
|
|
|