Go to the documentation of this file.
68 #include "../../internal.h"
71 #define BN_MUL_RECURSIVE_SIZE_NORMAL 16
72 #define BN_SQR_RECURSIVE_SIZE_NORMAL BN_MUL_RECURSIVE_SIZE_NORMAL
76 size_t num, BN_ULONG *
tmp) {
83 const BN_ULONG *
b,
size_t nb) {
88 const BN_ULONG *ltmp =
a;
92 BN_ULONG *rr = &(
r[na]);
131 const BN_ULONG *
b,
int cl,
int dl) {
146 for (
int i = 0;
i < dl;
i++) {
147 r[
i] = 0
u -
b[
i] - borrow;
153 for (
int i = 0;
i < dl;
i++) {
156 r[
i] =
a[
i] - borrow;
172 const BN_ULONG *
b,
int cl,
int dl,
176 int r_len = cl + (dl < 0 ? -dl : dl);
184 int cl =
a->width <
b->width ?
a->width :
b->width;
185 int dl =
a->width -
b->width;
186 int r_len =
a->width <
b->width ?
b->width :
a->width;
189 int ok =
tmp != NULL &&
212 int n2,
int dna,
int dnb, BN_ULONG *t) {
214 assert(n2 != 0 && (n2 & (n2 - 1)) == 0);
221 if (n2 == 8 && dna == 0 && dnb == 0) {
231 sizeof(BN_ULONG) * -(dna + dnb));
246 int n = n2 / 2, tna =
n + dna, tnb =
n + dnb;
258 if (
n == 4 && dna == 0 && dnb == 0) {
263 }
else if (
n == 8 && dna == 0 && dnb == 0) {
269 BN_ULONG *
p = &t[n2 * 2];
281 BN_ULONG c_neg =
c -
bn_sub_words(&t[n2 * 2], t, &t[n2], n2);
285 "crypto_word_t is too small");
293 for (
int i =
n + n2;
i < n2 + n2;
i++) {
312 const BN_ULONG *
b,
int n,
int tna,
int tnb,
315 assert(
n != 0 && (
n & (
n - 1)) == 0);
317 assert(0 <= tna && tna <
n);
318 assert(0 <= tnb && tnb <
n);
319 assert(-1 <= tna - tnb && tna - tnb <= 1);
353 OPENSSL_memset(&
r[n2 + tna + tnb], 0,
sizeof(BN_ULONG) * (n2 - tna - tnb));
355 BN_ULONG *
p = &t[n2 * 2];
367 if (
i < tna ||
i < tnb) {
374 if (
i == tna ||
i == tnb) {
395 BN_ULONG c_neg =
c -
bn_sub_words(&t[n2 * 2], t, &t[n2], n2);
399 "crypto_word_t is too small");
407 for (
int i =
n + n2;
i < n2 + n2;
i++) {
424 if (al == 0 || bl == 0) {
432 if (
r ==
a ||
r ==
b) {
440 rr->
neg =
a->neg ^
b->neg;
455 static const int kMulNormalSize = 16;
456 if (al >= kMulNormalSize && bl >= kMulNormalSize) {
457 if (-1 <=
i &&
i <= 1) {
466 assert(j <= al || j <= bl);
471 if (al > j || bl > j) {
478 assert(al >= j && bl >= j);
528 if (
a->neg ||
b->neg) {
537 const BN_ULONG *
b,
size_t num_b) {
538 if (num_r != num_a + num_b) {
543 if (num_a == 8 && num_b == 8) {
558 const BN_ULONG *ap =
a;
560 rp[0] = rp[
max - 1] = 0;
570 for (
size_t i =
n - 2;
i > 0;
i--) {
594 assert(n2 != 0 && (n2 & (n2 - 1)) == 0);
615 BN_ULONG *t_recursive = &t[n2 * 2];
638 for (
size_t i =
n + n2;
i < n2 + n2;
i++) {
692 }
else if (al == 8) {
700 if (al != 0 && (al & (al - 1)) == 0) {
742 }
else if (num_a == 8) {
static BN_ULONG bn_sub_part_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int cl, int dl)
int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
#define bn_set_minimal_width
#define OPENSSL_PUT_ERROR(library, reason)
#define BN_SQR_RECURSIVE_SIZE_NORMAL
OPENSSL_EXPORT pem_password_cb void * u
#define BN_R_NEGATIVE_NUMBER
static void bn_sqr_recursive(BN_ULONG *r, const BN_ULONG *a, size_t n2, BN_ULONG *t)
int BN_mul_word(BIGNUM *bn, BN_ULONG w)
static void * OPENSSL_memset(void *dst, int c, size_t n)
int bn_mul_consttime(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
static int bn_mul_impl(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
static BN_ULONG bn_abs_sub_part_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int cl, int dl, BN_ULONG *tmp)
static void bn_abs_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, size_t num, BN_ULONG *tmp)
int bn_sqr_consttime(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
static void bn_mul_part_recursive(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n, int tna, int tnb, BN_ULONG *t)
#define BN_MUL_RECURSIVE_SIZE_NORMAL
int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
UniquePtr< SSL_SESSION > ret
static void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, size_t n, BN_ULONG *tmp)
static crypto_word_t constant_time_select_w(crypto_word_t mask, crypto_word_t a, crypto_word_t b)
static void bn_mul_recursive(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n2, int dna, int dnb, BN_ULONG *t)
#define BN_SMALL_MAX_WORDS
void bn_sqr_small(BN_ULONG *r, size_t num_r, const BN_ULONG *a, size_t num_a)
static void bn_mul_normal(BN_ULONG *r, const BN_ULONG *a, size_t na, const BN_ULONG *b, size_t nb)
static upb_pb_encoder_segment * top(upb_pb_encoder *e)
void bn_mul_small(BN_ULONG *r, size_t num_r, const BN_ULONG *a, size_t num_a, const BN_ULONG *b, size_t num_b)
int bn_abs_sub_consttime(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
#define OPENSSL_STATIC_ASSERT(cond, msg)
grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:00:41