Macros | Functions | Variables
rsa_impl.c File Reference
#include <openssl/rsa.h>
#include <assert.h>
#include <limits.h>
#include <string.h>
#include <openssl/bn.h>
#include <openssl/err.h>
#include <openssl/mem.h>
#include <openssl/thread.h>
#include <openssl/type_check.h>
#include "internal.h"
#include "../bn/internal.h"
#include "../../internal.h"
#include "../delocate.h"
#include "../rand/fork_detect.h"
Include dependency graph for rsa_impl.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MAX_BLINDINGS_PER_RSA   1024
 

Functions

 DEFINE_METHOD_FUNCTION (RSA_METHOD, RSA_default_method)
 
static int ensure_bignum (BIGNUM **out)
 
static int ensure_fixed_copy (BIGNUM **out, const BIGNUM *in, int width)
 
static int freeze_private_key (RSA *rsa, BN_CTX *ctx)
 
static int generate_prime (BIGNUM *out, int bits, const BIGNUM *e, const BIGNUM *p, const BIGNUM *sqrt2, const BIGNUM *pow2_bits_100, BN_CTX *ctx, BN_GENCB *cb)
 
static int mod_exp (BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
 
static int mod_montgomery (BIGNUM *r, const BIGNUM *I, const BIGNUM *p, const BN_MONT_CTX *mont_p, const BIGNUM *q, BN_CTX *ctx)
 
static void replace_bignum (BIGNUM **out, BIGNUM **in)
 
static void replace_bn_mont_ctx (BN_MONT_CTX **out, BN_MONT_CTX **in)
 
static BN_BLINDINGrsa_blinding_get (RSA *rsa, unsigned *index_used, BN_CTX *ctx)
 
static void rsa_blinding_release (RSA *rsa, BN_BLINDING *blinding, unsigned blinding_index)
 
int rsa_check_public_key (const RSA *rsa)
 
int rsa_default_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_default_private_transform (RSA *rsa, uint8_t *out, const uint8_t *in, size_t len)
 
int rsa_default_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)
 
size_t rsa_default_size (const RSA *rsa)
 
int RSA_encrypt (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_generate_key_ex (RSA *rsa, int bits, const BIGNUM *e_value, BN_GENCB *cb)
 
static int RSA_generate_key_ex_maybe_fips (RSA *rsa, int bits, const BIGNUM *e_value, BN_GENCB *cb, int check_fips)
 
int RSA_generate_key_fips (RSA *rsa, int bits, BN_GENCB *cb)
 
static int rsa_generate_key_impl (RSA *rsa, int bits, const BIGNUM *e_value, BN_GENCB *cb)
 
int RSA_verify_raw (RSA *rsa, size_t *out_len, uint8_t *out, size_t max_out, const uint8_t *in, size_t in_len, int padding)
 

Variables

const BN_ULONG kBoringSSLRSASqrtTwo []
 
const size_t kBoringSSLRSASqrtTwoLen = OPENSSL_ARRAY_SIZE(kBoringSSLRSASqrtTwo)
 

Macro Definition Documentation

◆ MAX_BLINDINGS_PER_RSA

#define MAX_BLINDINGS_PER_RSA   1024

Definition at line 356 of file rsa_impl.c.

Function Documentation

◆ DEFINE_METHOD_FUNCTION()

DEFINE_METHOD_FUNCTION ( RSA_METHOD  ,
RSA_default_method   
)

Definition at line 1410 of file rsa_impl.c.

◆ ensure_bignum()

static int ensure_bignum ( BIGNUM **  out)
static

Definition at line 932 of file rsa_impl.c.

◆ ensure_fixed_copy()

static int ensure_fixed_copy ( BIGNUM **  out,
const BIGNUM in,
int  width 
)
static

Definition at line 121 of file rsa_impl.c.

◆ freeze_private_key()

static int freeze_private_key ( RSA rsa,
BN_CTX ctx 
)
static

Definition at line 141 of file rsa_impl.c.

◆ generate_prime()

static int generate_prime ( BIGNUM out,
int  bits,
const BIGNUM e,
const BIGNUM p,
const BIGNUM sqrt2,
const BIGNUM pow2_bits_100,
BN_CTX ctx,
BN_GENCB cb 
)
static

Definition at line 1011 of file rsa_impl.c.

◆ mod_exp()

static int mod_exp ( BIGNUM r0,
const BIGNUM I,
RSA rsa,
BN_CTX ctx 
)
static

Definition at line 849 of file rsa_impl.c.

◆ mod_montgomery()

static int mod_montgomery ( BIGNUM r,
const BIGNUM I,
const BIGNUM p,
const BN_MONT_CTX mont_p,
const BIGNUM q,
BN_CTX ctx 
)
static

Definition at line 820 of file rsa_impl.c.

◆ replace_bignum()

static void replace_bignum ( BIGNUM **  out,
BIGNUM **  in 
)
static

Definition at line 1312 of file rsa_impl.c.

◆ replace_bn_mont_ctx()

static void replace_bn_mont_ctx ( BN_MONT_CTX **  out,
BN_MONT_CTX **  in 
)
static

Definition at line 1318 of file rsa_impl.c.

◆ rsa_blinding_get()

static BN_BLINDING* rsa_blinding_get ( RSA rsa,
unsigned *  index_used,
BN_CTX ctx 
)
static

Definition at line 366 of file rsa_impl.c.

◆ rsa_blinding_release()

static void rsa_blinding_release ( RSA rsa,
BN_BLINDING blinding,
unsigned  blinding_index 
)
static

Definition at line 467 of file rsa_impl.c.

◆ rsa_check_public_key()

int rsa_check_public_key ( const RSA rsa)

Definition at line 76 of file rsa_impl.c.

◆ rsa_default_decrypt()

int rsa_default_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 529 of file rsa_impl.c.

◆ rsa_default_private_transform()

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

Definition at line 689 of file rsa_impl.c.

◆ rsa_default_sign_raw()

int rsa_default_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 481 of file rsa_impl.c.

◆ rsa_default_size()

size_t rsa_default_size ( const RSA rsa)

Definition at line 258 of file rsa_impl.c.

◆ RSA_encrypt()

int RSA_encrypt ( 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 262 of file rsa_impl.c.

◆ RSA_generate_key_ex()

int RSA_generate_key_ex ( RSA rsa,
int  bits,
const BIGNUM e_value,
BN_GENCB cb 
)

Definition at line 1386 of file rsa_impl.c.

◆ RSA_generate_key_ex_maybe_fips()

static int RSA_generate_key_ex_maybe_fips ( RSA rsa,
int  bits,
const BIGNUM e_value,
BN_GENCB cb,
int  check_fips 
)
static

Definition at line 1324 of file rsa_impl.c.

◆ RSA_generate_key_fips()

int RSA_generate_key_fips ( RSA rsa,
int  bits,
BN_GENCB cb 
)

Definition at line 1392 of file rsa_impl.c.

◆ rsa_generate_key_impl()

static int rsa_generate_key_impl ( RSA rsa,
int  bits,
const BIGNUM e_value,
BN_GENCB cb 
)
static

Definition at line 1141 of file rsa_impl.c.

◆ RSA_verify_raw()

int RSA_verify_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 596 of file rsa_impl.c.

Variable Documentation

◆ kBoringSSLRSASqrtTwo

const BN_ULONG kBoringSSLRSASqrtTwo[]
Initial value:
= {
TOBN(0x4d7c60a5, 0xe633e3e1), TOBN(0x5fcf8f7b, 0xca3ea33b),
TOBN(0xc246785e, 0x92957023), TOBN(0xf9acce41, 0x797f2805),
TOBN(0xfdfe170f, 0xd3b1f780), TOBN(0xd24f4a76, 0x3facb882),
TOBN(0x18838a2e, 0xaff5f3b2), TOBN(0xc1fcbdde, 0xa2f7dc33),
TOBN(0xdea06241, 0xf7aa81c2), TOBN(0xf6a1be3f, 0xca221307),
TOBN(0x332a5e9f, 0x7bda1ebf), TOBN(0x0104dc01, 0xfe32352f),
TOBN(0xb8cf341b, 0x6f8236c7), TOBN(0x4264dabc, 0xd528b651),
TOBN(0xf4d3a02c, 0xebc93e0c), TOBN(0x81394ab6, 0xd8fd0efd),
TOBN(0xeaa4a089, 0x9040ca4a), TOBN(0xf52f120f, 0x836e582e),
TOBN(0xcb2a6343, 0x31f3c84d), TOBN(0xc6d5a8a3, 0x8bb7e9dc),
TOBN(0x460abc72, 0x2f7c4e33), TOBN(0xcab1bc91, 0x1688458a),
TOBN(0x53059c60, 0x11bc337b), TOBN(0xd2202e87, 0x42af1f4e),
TOBN(0x78048736, 0x3dfa2768), TOBN(0x0f74a85e, 0x439c7b4a),
TOBN(0xa8b1fe6f, 0xdc83db39), TOBN(0x4afc8304, 0x3ab8a2c3),
TOBN(0xed17ac85, 0x83339915), TOBN(0x1d6f60ba, 0x893ba84c),
TOBN(0x597d89b3, 0x754abe9f), TOBN(0xb504f333, 0xf9de6484),
}

Definition at line 985 of file rsa_impl.c.

◆ kBoringSSLRSASqrtTwoLen

const size_t kBoringSSLRSASqrtTwoLen = OPENSSL_ARRAY_SIZE(kBoringSSLRSASqrtTwo)

Definition at line 1003 of file rsa_impl.c.



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