Systemsicherheit/Assignment 7 - SGX Hands-on/rsa/rsa.h

37 lines
612 B
C
Raw Normal View History

2024-06-29 16:10:15 +02:00
#ifndef RSA_H
#define RSA_H
#include <gmp.h>
#include <stdint.h>
#ifndef MODULUS_SIZE
#define MODULUS_SIZE 256ULL
#endif
typedef uint8_t u8;
typedef uint16_t u16;
typedef uint32_t u32;
typedef uint64_t u64;
typedef struct {
mpz_t p;
mpz_t q;
mpz_t n;
mpz_t e;
mpz_t d;
} rsa_key;
typedef struct {
mpz_t e;
mpz_t n;
} rsa_public_key;
void rsa_print(rsa_key *key);
int rsa_init(rsa_key *key);
void rsa_free(rsa_key *key);
int rsa_sign(u8 *sig, const u8 *sha256, const rsa_key *key);
2024-06-29 16:46:07 +02:00
int rsa_verify(const u8 *sig, const size_t sig_length, u8 *sha256, rsa_public_key *pk);
2024-06-29 16:10:15 +02:00
#endif