Classes | Functions | Variables
rsa.c File Reference
#include <openssl/rsa.h>
#include <limits.h>
#include <string.h>
#include <openssl/bn.h>
#include <openssl/digest.h>
#include <openssl/engine.h>
#include <openssl/err.h>
#include <openssl/ex_data.h>
#include <openssl/md5.h>
#include <openssl/mem.h>
#include <openssl/nid.h>
#include <openssl/sha.h>
#include <openssl/thread.h>
#include "../bn/internal.h"
#include "../delocate.h"
#include "../../internal.h"
#include "internal.h"
Include dependency graph for rsa.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pkcs1_sig_prefix
 

Functions

static int check_mod_inverse (int *out_ok, const BIGNUM *a, const BIGNUM *ainv, const BIGNUM *m, unsigned m_min_bits, BN_CTX *ctx)
 
 DEFINE_LOCAL_DATA (BIGNUM, g_small_factors)
 
int RSA_add_pkcs1_prefix (uint8_t **out_msg, size_t *out_msg_len, int *is_alloced, int hash_nid, const uint8_t *digest, size_t digest_len)
 
unsigned RSA_bits (const RSA *rsa)
 
int RSA_blinding_on (RSA *rsa, BN_CTX *ctx)
 
int RSA_check_fips (RSA *key)
 
int RSA_check_key (const RSA *key)
 
int RSA_decrypt (RSA *rsa, size_t *out_len, uint8_t *out, size_t max_out, const uint8_t *in, size_t in_len, int padding)
 
int RSA_flags (const RSA *rsa)
 
void RSA_free (RSA *rsa)
 
void RSA_get0_crt_params (const RSA *rsa, const BIGNUM **out_dmp1, const BIGNUM **out_dmq1, const BIGNUM **out_iqmp)
 
const BIGNUMRSA_get0_d (const RSA *rsa)
 
const BIGNUMRSA_get0_dmp1 (const RSA *rsa)
 
const BIGNUMRSA_get0_dmq1 (const RSA *rsa)
 
const BIGNUMRSA_get0_e (const RSA *rsa)
 
void RSA_get0_factors (const RSA *rsa, const BIGNUM **out_p, const BIGNUM **out_q)
 
const BIGNUMRSA_get0_iqmp (const RSA *rsa)
 
void RSA_get0_key (const RSA *rsa, const BIGNUM **out_n, const BIGNUM **out_e, const BIGNUM **out_d)
 
const BIGNUMRSA_get0_n (const RSA *rsa)
 
const BIGNUMRSA_get0_p (const RSA *rsa)
 
const RSA_PSS_PARAMSRSA_get0_pss_params (const RSA *rsa)
 
const BIGNUMRSA_get0_q (const RSA *rsa)
 
void * RSA_get_ex_data (const RSA *rsa, int idx)
 
int RSA_get_ex_new_index (long argl, void *argp, CRYPTO_EX_unused *unused, CRYPTO_EX_dup *dup_unused, CRYPTO_EX_free *free_func)
 
int RSA_is_opaque (const RSA *rsa)
 
RSARSA_new (void)
 
RSARSA_new_method (const ENGINE *engine)
 
int RSA_private_decrypt (size_t flen, const uint8_t *from, uint8_t *to, RSA *rsa, int padding)
 
int RSA_private_encrypt (size_t flen, const uint8_t *from, uint8_t *to, RSA *rsa, int padding)
 
int RSA_private_transform (RSA *rsa, uint8_t *out, const uint8_t *in, size_t len)
 
int RSA_public_decrypt (size_t flen, const uint8_t *from, uint8_t *to, RSA *rsa, int padding)
 
int RSA_public_encrypt (size_t flen, const uint8_t *from, uint8_t *to, RSA *rsa, int padding)
 
int RSA_set0_crt_params (RSA *rsa, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp)
 
int RSA_set0_factors (RSA *rsa, BIGNUM *p, BIGNUM *q)
 
int RSA_set0_key (RSA *rsa, BIGNUM *n, BIGNUM *e, BIGNUM *d)
 
int RSA_set_ex_data (RSA *rsa, int idx, void *arg)
 
int RSA_sign (int hash_nid, const uint8_t *digest, unsigned digest_len, uint8_t *out, unsigned *out_len, RSA *rsa)
 
int RSA_sign_pss_mgf1 (RSA *rsa, size_t *out_len, uint8_t *out, size_t max_out, const uint8_t *digest, size_t digest_len, const EVP_MD *md, const EVP_MD *mgf1_md, int salt_len)
 
int RSA_sign_raw (RSA *rsa, size_t *out_len, uint8_t *out, size_t max_out, const uint8_t *in, size_t in_len, int padding)
 
unsigned RSA_size (const RSA *rsa)
 
int RSA_up_ref (RSA *rsa)
 
int RSA_verify (int hash_nid, const uint8_t *digest, size_t digest_len, const uint8_t *sig, size_t sig_len, RSA *rsa)
 
int RSA_verify_pss_mgf1 (RSA *rsa, const uint8_t *digest, size_t digest_len, const EVP_MD *md, const EVP_MD *mgf1_md, int salt_len, const uint8_t *sig, size_t sig_len)
 

Variables

static const struct pkcs1_sig_prefix kPKCS1SigPrefixes []
 
static const BN_ULONG kSmallFactorsLimbs []
 
static const unsigned SSL_SIG_LENGTH = 36
 

Function Documentation

◆ check_mod_inverse()

static int check_mod_inverse ( int out_ok,
const BIGNUM a,
const BIGNUM ainv,
const BIGNUM m,
unsigned  m_min_bits,
BN_CTX ctx 
)
static

Definition at line 665 of file rsa.c.

◆ DEFINE_LOCAL_DATA()

DEFINE_LOCAL_DATA ( BIGNUM  ,
g_small_factors   
)

Definition at line 831 of file rsa.c.

◆ RSA_add_pkcs1_prefix()

int RSA_add_pkcs1_prefix ( uint8_t **  out_msg,
size_t *  out_msg_len,
int is_alloced,
int  hash_nid,
const uint8_t digest,
size_t  digest_len 
)

Definition at line 466 of file rsa.c.

◆ RSA_bits()

unsigned RSA_bits ( const RSA rsa)

Definition at line 168 of file rsa.c.

◆ RSA_blinding_on()

int RSA_blinding_on ( RSA rsa,
BN_CTX ctx 
)

Definition at line 933 of file rsa.c.

◆ RSA_check_fips()

int RSA_check_fips ( RSA key)

Definition at line 839 of file rsa.c.

◆ RSA_check_key()

int RSA_check_key ( const RSA key)

Definition at line 688 of file rsa.c.

◆ RSA_decrypt()

int RSA_decrypt ( RSA rsa,
size_t *  out_len,
uint8_t out,
size_t  max_out,
const uint8_t in,
size_t  in_len,
int  padding 
)

Definition at line 330 of file rsa.c.

◆ RSA_flags()

int RSA_flags ( const RSA rsa)

Definition at line 931 of file rsa.c.

◆ RSA_free()

void RSA_free ( RSA rsa)

Definition at line 121 of file rsa.c.

◆ RSA_get0_crt_params()

void RSA_get0_crt_params ( const RSA rsa,
const BIGNUM **  out_dmp1,
const BIGNUM **  out_dmq1,
const BIGNUM **  out_iqmp 
)

Definition at line 215 of file rsa.c.

◆ RSA_get0_d()

const BIGNUM* RSA_get0_d ( const RSA rsa)

Definition at line 174 of file rsa.c.

◆ RSA_get0_dmp1()

const BIGNUM* RSA_get0_dmp1 ( const RSA rsa)

Definition at line 180 of file rsa.c.

◆ RSA_get0_dmq1()

const BIGNUM* RSA_get0_dmq1 ( const RSA rsa)

Definition at line 182 of file rsa.c.

◆ RSA_get0_e()

const BIGNUM* RSA_get0_e ( const RSA rsa)

Definition at line 172 of file rsa.c.

◆ RSA_get0_factors()

void RSA_get0_factors ( const RSA rsa,
const BIGNUM **  out_p,
const BIGNUM **  out_q 
)

Definition at line 199 of file rsa.c.

◆ RSA_get0_iqmp()

const BIGNUM* RSA_get0_iqmp ( const RSA rsa)

Definition at line 184 of file rsa.c.

◆ RSA_get0_key()

void RSA_get0_key ( const RSA rsa,
const BIGNUM **  out_n,
const BIGNUM **  out_e,
const BIGNUM **  out_d 
)

Definition at line 186 of file rsa.c.

◆ RSA_get0_n()

const BIGNUM* RSA_get0_n ( const RSA rsa)

Definition at line 170 of file rsa.c.

◆ RSA_get0_p()

const BIGNUM* RSA_get0_p ( const RSA rsa)

Definition at line 176 of file rsa.c.

◆ RSA_get0_pss_params()

const RSA_PSS_PARAMS* RSA_get0_pss_params ( const RSA rsa)

Definition at line 209 of file rsa.c.

◆ RSA_get0_q()

const BIGNUM* RSA_get0_q ( const RSA rsa)

Definition at line 178 of file rsa.c.

◆ RSA_get_ex_data()

void* RSA_get_ex_data ( const RSA rsa,
int  idx 
)

Definition at line 395 of file rsa.c.

◆ RSA_get_ex_new_index()

int RSA_get_ex_new_index ( long  argl,
void *  argp,
CRYPTO_EX_unused unused,
CRYPTO_EX_dup dup_unused,
CRYPTO_EX_free free_func 
)

Definition at line 381 of file rsa.c.

◆ RSA_is_opaque()

int RSA_is_opaque ( const RSA rsa)

Definition at line 377 of file rsa.c.

◆ RSA_new()

RSA* RSA_new ( void  )

Definition at line 85 of file rsa.c.

◆ RSA_new_method()

RSA* RSA_new_method ( const ENGINE engine)

Definition at line 87 of file rsa.c.

◆ RSA_private_decrypt()

int RSA_private_decrypt ( size_t  flen,
const uint8_t from,
uint8_t to,
RSA rsa,
int  padding 
)

Definition at line 339 of file rsa.c.

◆ RSA_private_encrypt()

int RSA_private_encrypt ( size_t  flen,
const uint8_t from,
uint8_t to,
RSA rsa,
int  padding 
)

Definition at line 315 of file rsa.c.

◆ RSA_private_transform()

int RSA_private_transform ( RSA rsa,
uint8_t out,
const uint8_t in,
size_t  len 
)

Definition at line 922 of file rsa.c.

◆ RSA_public_decrypt()

int RSA_public_decrypt ( size_t  flen,
const uint8_t from,
uint8_t to,
RSA rsa,
int  padding 
)

Definition at line 354 of file rsa.c.

◆ RSA_public_encrypt()

int RSA_public_encrypt ( size_t  flen,
const uint8_t from,
uint8_t to,
RSA rsa,
int  padding 
)

Definition at line 291 of file rsa.c.

◆ RSA_set0_crt_params()

int RSA_set0_crt_params ( RSA rsa,
BIGNUM dmp1,
BIGNUM dmq1,
BIGNUM iqmp 
)

Definition at line 268 of file rsa.c.

◆ RSA_set0_factors()

int RSA_set0_factors ( RSA rsa,
BIGNUM p,
BIGNUM q 
)

Definition at line 250 of file rsa.c.

◆ RSA_set0_key()

int RSA_set0_key ( RSA rsa,
BIGNUM n,
BIGNUM e,
BIGNUM d 
)

Definition at line 228 of file rsa.c.

◆ RSA_set_ex_data()

int RSA_set_ex_data ( RSA rsa,
int  idx,
void *  arg 
)

Definition at line 391 of file rsa.c.

◆ RSA_sign()

int RSA_sign ( int  hash_nid,
const uint8_t digest,
unsigned  digest_len,
uint8_t out,
unsigned *  out_len,
RSA rsa 
)

Definition at line 526 of file rsa.c.

◆ RSA_sign_pss_mgf1()

int RSA_sign_pss_mgf1 ( RSA rsa,
size_t *  out_len,
uint8_t out,
size_t  max_out,
const uint8_t digest,
size_t  digest_len,
const EVP_MD md,
const EVP_MD mgf1_md,
int  salt_len 
)

Definition at line 557 of file rsa.c.

◆ RSA_sign_raw()

int RSA_sign_raw ( RSA rsa,
size_t *  out_len,
uint8_t out,
size_t  max_out,
const uint8_t in,
size_t  in_len,
int  padding 
)

Definition at line 306 of file rsa.c.

◆ RSA_size()

unsigned RSA_size ( const RSA rsa)

Definition at line 369 of file rsa.c.

◆ RSA_up_ref()

int RSA_up_ref ( RSA rsa)

Definition at line 163 of file rsa.c.

◆ RSA_verify()

int RSA_verify ( int  hash_nid,
const uint8_t digest,
size_t  digest_len,
const uint8_t sig,
size_t  sig_len,
RSA rsa 
)

Definition at line 580 of file rsa.c.

◆ RSA_verify_pss_mgf1()

int RSA_verify_pss_mgf1 ( RSA rsa,
const uint8_t digest,
size_t  digest_len,
const EVP_MD md,
const EVP_MD mgf1_md,
int  salt_len,
const uint8_t sig,
size_t  sig_len 
)

Definition at line 633 of file rsa.c.

Variable Documentation

◆ kPKCS1SigPrefixes

const struct pkcs1_sig_prefix kPKCS1SigPrefixes[]
static

Definition at line 418 of file rsa.c.

◆ kSmallFactorsLimbs

const BN_ULONG kSmallFactorsLimbs[]
static
Initial value:
= {
TOBN(0xc4309333, 0x3ef4e3e1), TOBN(0x71161eb6, 0xcd2d655f),
TOBN(0x95e2238c, 0x0bf94862), TOBN(0x3eb233d3, 0x24f7912b),
TOBN(0x6b55514b, 0xbf26c483), TOBN(0x0a84d817, 0x5a144871),
TOBN(0x77d12fee, 0x9b82210a), TOBN(0xdb5b93c2, 0x97f050b3),
TOBN(0x4acad6b9, 0x4d6c026b), TOBN(0xeb7751f3, 0x54aec893),
TOBN(0xdba53368, 0x36bc85c4), TOBN(0xd85a1b28, 0x7f5ec78e),
TOBN(0x2eb072d8, 0x6b322244), TOBN(0xbba51112, 0x5e2b3aea),
TOBN(0x36ed1a6c, 0x0e2486bf), TOBN(0x5f270460, 0xec0c5727),
0x000017b1
}

Definition at line 819 of file rsa.c.

◆ SSL_SIG_LENGTH

const unsigned SSL_SIG_LENGTH = 36
static

Definition at line 401 of file rsa.c.



grpc
Author(s):
autogenerated on Fri May 16 2025 03:01:29