Polly 19.0.0git
Functions
rsamath.c File Reference
#include "rsamath.h"
#include <limits.h>
#include <string.h>

Go to the source code of this file.

Functions

static mp_result s_rsa_transform (mp_int msg, mp_int exp, mp_int mod, mp_int out)
 
mp_result rsa_i2osp (mp_int z, unsigned char *out, int len)
 
mp_result rsa_os2ip (mp_int z, unsigned char *in, int len)
 
mp_result rsa_rsaep (mp_int msg, mp_int exp, mp_int mod, mp_int cipher)
 
mp_result rsa_rsadp (mp_int cipher, mp_int exp, mp_int mod, mp_int msg)
 
mp_result rsa_rsasp (mp_int msg, mp_int exp, mp_int mod, mp_int signature)
 
mp_result rsa_rsavp (mp_int signature, mp_int exp, mp_int mod, mp_int msg)
 
int rsa_max_message_len (mp_int mod)
 
mp_result rsa_pkcs1v15_encode (unsigned char *buf, int msg_len, int buf_len, int tag, random_f filler)
 
mp_result rsa_pkcs1v15_decode (unsigned char *buf, int buf_len, int tag, int *msg_len)
 

Function Documentation

◆ rsa_i2osp()

mp_result rsa_i2osp ( mp_int  z,
unsigned char *  out,
int  len 
)

Definition at line 36 of file rsamath.c.

References mp_int_binary_len, mp_int_to_binary, MP_OK, and MP_RANGE.

◆ rsa_max_message_len()

int rsa_max_message_len ( mp_int  mod)

Definition at line 76 of file rsamath.c.

References mp_int_count_bits.

◆ rsa_os2ip()

mp_result rsa_os2ip ( mp_int  z,
unsigned char *  in,
int  len 
)

Definition at line 50 of file rsamath.c.

References mp_int_read_binary.

◆ rsa_pkcs1v15_decode()

mp_result rsa_pkcs1v15_decode ( unsigned char *  buf,
int  buf_len,
int  tag,
int *  msg_len 
)

Definition at line 114 of file rsamath.c.

References MP_OK, MP_UNDEF, and tag().

Referenced by main().

◆ rsa_pkcs1v15_encode()

mp_result rsa_pkcs1v15_encode ( unsigned char *  buf,
int  msg_len,
int  buf_len,
int  tag,
random_f  filler 
)

Definition at line 87 of file rsamath.c.

References MP_OK, MP_RANGE, and tag().

Referenced by main().

◆ rsa_rsadp()

mp_result rsa_rsadp ( mp_int  cipher,
mp_int  exp,
mp_int  mod,
mp_int  msg 
)

Definition at line 60 of file rsamath.c.

References s_rsa_transform().

◆ rsa_rsaep()

mp_result rsa_rsaep ( mp_int  msg,
mp_int  exp,
mp_int  mod,
mp_int  cipher 
)

Definition at line 55 of file rsamath.c.

References s_rsa_transform().

◆ rsa_rsasp()

mp_result rsa_rsasp ( mp_int  msg,
mp_int  exp,
mp_int  mod,
mp_int  signature 
)

Definition at line 65 of file rsamath.c.

References s_rsa_transform().

◆ rsa_rsavp()

mp_result rsa_rsavp ( mp_int  signature,
mp_int  exp,
mp_int  mod,
mp_int  msg 
)

Definition at line 70 of file rsamath.c.

References s_rsa_transform().

◆ s_rsa_transform()

static mp_result s_rsa_transform ( mp_int  msg,
mp_int  exp,
mp_int  mod,
mp_int  out 
)
static

Definition at line 139 of file rsamath.c.

References mp_int_compare, mp_int_compare_zero, mp_int_exptmod, and MP_RANGE.

Referenced by rsa_rsadp(), rsa_rsaep(), rsa_rsasp(), and rsa_rsavp().