nrfxlib API 0.1.0
Loading...
Searching...
No Matches
ocrypto_rsa_primitives.h File Reference
#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  ocrypto_rsa_pub_key
 
struct  ocrypto_rsa_key
 
struct  ocrypto_rsa_crt_key
 

Macros

#define OCRYPTO_RSA_PUB_KEY_SIZE(bits)   ((bits)/32)
 
#define OCRYPTO_RSA_KEY_SIZE(bits)   ((bits)/32*2)
 
#define OCRYPTO_RSA_CRT_KEY_SIZE(bits)   ((bits)/32*7/2)
 
#define OCRYPTO_RSA_PUB_MEM_SIZE(bits)   ((bits)/32*11)
 
#define OCRYPTO_RSA_MEM_SIZE(bits)   ((bits)/32*26)
 
#define OCRYPTO_RSA_CRT_MEM_SIZE(bits)   ((bits)/32*14)
 

Functions

variable-bit RSA key setup.

This group of functions is used for generic RSA key setup.

int ocrypto_rsa_init_pub_key (ocrypto_rsa_pub_key *key, uint32_t *key_mem, const uint8_t *n, size_t n_len, uint32_t e)
 
int ocrypto_rsa_init_key (ocrypto_rsa_key *key, uint32_t *key_mem, const uint8_t *n, size_t n_len, const uint8_t *d, size_t d_len)
 
int ocrypto_rsa_init_crt_key (ocrypto_rsa_crt_key *key, uint32_t *key_mem, const uint8_t *p, size_t p_len, const uint8_t *q, size_t q_len, const uint8_t *dp, size_t dp_len, const uint8_t *dq, size_t dq_len, const uint8_t *qinv, size_t qi_len)
 
RSA primitives.

This group of functions is used for basic RSA arithmetic.

int ocrypto_rsa_pub_exp (uint8_t *c, size_t c_len, const uint8_t *m, size_t m_len, const ocrypto_rsa_pub_key *pk, uint32_t *mem)
 
int ocrypto_rsa_exp (uint8_t *m, size_t m_len, const uint8_t *c, size_t c_len, const ocrypto_rsa_key *key, uint32_t *mem)
 
int ocrypto_rsa_crt_exp (uint8_t *m, size_t m_len, const uint8_t *c, size_t c_len, const ocrypto_rsa_crt_key *key, uint32_t *mem)