Lines Matching refs:BIGNUM

296 /* get a clone of a BIGNUM with changed flags, for *temporary* use only
309 typedef struct bignum_st BIGNUM;
332 BIGNUM RR; /* used to convert to montgomery form */
333 BIGNUM N; /* The modulus */
334 BIGNUM Ni; /* R*(1/R mod N) - N*Ni = 1
346 BIGNUM N; /* the divisor */
347 BIGNUM Nr; /* the reciprocal */
415 BIGNUM *_tmp_bn = (a); \
425 const BIGNUM *BN_value_one(void);
433 BIGNUM *BN_CTX_get(BN_CTX *ctx);
435 int BN_rand(BIGNUM *rnd, int bits, int top,int bottom);
436 int BN_pseudo_rand(BIGNUM *rnd, int bits, int top,int bottom);
437 int BN_rand_range(BIGNUM *rnd, const BIGNUM *range);
438 int BN_pseudo_rand_range(BIGNUM *rnd, const BIGNUM *range);
439 int BN_num_bits(const BIGNUM *a);
441 BIGNUM *BN_new(void);
442 void BN_init(BIGNUM *);
443 void BN_clear_free(BIGNUM *a);
444 BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b);
445 void BN_swap(BIGNUM *a, BIGNUM *b);
446 BIGNUM *BN_bin2bn(const unsigned char *s,int len,BIGNUM *ret);
447 int BN_bn2bin(const BIGNUM *a, unsigned char *to);
448 BIGNUM *BN_mpi2bn(const unsigned char *s,int len,BIGNUM *ret);
449 int BN_bn2mpi(const BIGNUM *a, unsigned char *to);
450 int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
451 int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
452 int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
453 int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
454 int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
455 int BN_sqr(BIGNUM *r, const BIGNUM *a,BN_CTX *ctx);
456 /** BN_set_negative sets sign of a BIGNUM
457 * \param b pointer to the BIGNUM object
458 * \param n 0 if the BIGNUM b should be positive and a value != 0 otherwise
460 void BN_set_negative(BIGNUM *b, int n);
461 /** BN_is_negative returns 1 if the BIGNUM is negative
462 * \param a pointer to the BIGNUM object
467 int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, const BIGNUM *d,
470 int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx);
471 int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx);
472 int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m);
473 int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx);
474 int BN_mod_sub_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m);
475 int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
476 const BIGNUM *m, BN_CTX *ctx);
477 int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
478 int BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
479 int BN_mod_lshift1_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *m);
480 int BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m, BN_CTX *ctx);
481 int BN_mod_lshift_quick(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m);
483 BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w);
484 BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w);
485 int BN_mul_word(BIGNUM *a, BN_ULONG w);
486 int BN_add_word(BIGNUM *a, BN_ULONG w);
487 int BN_sub_word(BIGNUM *a, BN_ULONG w);
488 int BN_set_word(BIGNUM *a, BN_ULONG w);
489 BN_ULONG BN_get_word(const BIGNUM *a);
491 int BN_cmp(const BIGNUM *a, const BIGNUM *b);
492 void BN_free(BIGNUM *a);
493 int BN_is_bit_set(const BIGNUM *a, int n);
494 int BN_lshift(BIGNUM *r, const BIGNUM *a, int n);
495 int BN_lshift1(BIGNUM *r, const BIGNUM *a);
496 int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,BN_CTX *ctx);
498 int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
499 const BIGNUM *m,BN_CTX *ctx);
500 int BN_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
501 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
502 int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
503 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont);
504 int BN_mod_exp_mont_word(BIGNUM *r, BN_ULONG a, const BIGNUM *p,
505 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
506 int BN_mod_exp2_mont(BIGNUM *r, const BIGNUM *a1, const BIGNUM *p1,
507 const BIGNUM *a2, const BIGNUM *p2,const BIGNUM *m,
509 int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
510 const BIGNUM *m,BN_CTX *ctx);
512 int BN_mask_bits(BIGNUM *a,int n);
514 int BN_print_fp(FILE *fp, const BIGNUM *a);
517 int BN_print(BIO *fp, const BIGNUM *a);
519 int BN_print(void *fp, const BIGNUM *a);
521 int BN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx);
522 int BN_rshift(BIGNUM *r, const BIGNUM *a, int n);
523 int BN_rshift1(BIGNUM *r, const BIGNUM *a);
524 void BN_clear(BIGNUM *a);
525 BIGNUM *BN_dup(const BIGNUM *a);
526 int BN_ucmp(const BIGNUM *a, const BIGNUM *b);
527 int BN_set_bit(BIGNUM *a, int n);
528 int BN_clear_bit(BIGNUM *a, int n);
529 char * BN_bn2hex(const BIGNUM *a);
530 char * BN_bn2dec(const BIGNUM *a);
531 int BN_hex2bn(BIGNUM **a, const char *str);
532 int BN_dec2bn(BIGNUM **a, const char *str);
533 int BN_asc2bn(BIGNUM **a, const char *str);
534 int BN_gcd(BIGNUM *r,const BIGNUM *a,const BIGNUM *b,BN_CTX *ctx);
535 int BN_kronecker(const BIGNUM *a,const BIGNUM *b,BN_CTX *ctx); /* returns -2 for error */
536 BIGNUM *BN_mod_inverse(BIGNUM *ret,
537 const BIGNUM *a, const BIGNUM *n,BN_CTX *ctx);
538 BIGNUM *BN_mod_sqrt(BIGNUM *ret,
539 const BIGNUM *a, const BIGNUM *n,BN_CTX *ctx);
541 void BN_consttime_swap(BN_ULONG swap, BIGNUM *a, BIGNUM *b, int nwords);
545 BIGNUM *BN_generate_prime(BIGNUM *ret,int bits,int safe,
546 const BIGNUM *add, const BIGNUM *rem,
548 int BN_is_prime(const BIGNUM *p,int nchecks,
551 int BN_is_prime_fasttest(const BIGNUM *p,int nchecks,
557 int BN_generate_prime_ex(BIGNUM *ret,int bits,int safe, const BIGNUM *add,
558 const BIGNUM *rem, BN_GENCB *cb);
559 int BN_is_prime_ex(const BIGNUM *p,int nchecks, BN_CTX *ctx, BN_GENCB *cb);
560 int BN_is_prime_fasttest_ex(const BIGNUM *p,int nchecks, BN_CTX *ctx,
563 int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx);
565 int BN_X931_derive_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2,
566 const BIGNUM *Xp, const BIGNUM *Xp1, const BIGNUM *Xp2,
567 const BIGNUM *e, BN_CTX *ctx, BN_GENCB *cb);
568 int BN_X931_generate_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2,
569 BIGNUM *Xp1, BIGNUM *Xp2,
570 const BIGNUM *Xp,
571 const BIGNUM *e, BN_CTX *ctx,
576 int BN_mod_mul_montgomery(BIGNUM *r,const BIGNUM *a,const BIGNUM *b,
580 int BN_from_montgomery(BIGNUM *r,const BIGNUM *a,
583 int BN_MONT_CTX_set(BN_MONT_CTX *mont,const BIGNUM *mod,BN_CTX *ctx);
586 const BIGNUM *mod, BN_CTX *ctx);
592 BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod);
595 int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);
596 int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);
597 int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *);
598 int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *);
607 const BIGNUM *e, BIGNUM *m, BN_CTX *ctx,
608 int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
609 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx),
620 int BN_RECP_CTX_set(BN_RECP_CTX *recp,const BIGNUM *rdiv,BN_CTX *ctx);
621 int BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y,
623 int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
624 const BIGNUM *m, BN_CTX *ctx);
625 int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m,
632 * The BIGNUM::neg property of BIGNUMs representing binary polynomials is
639 int BN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); /*r = a + b*/
641 int BN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p); /*r=a mod p*/
642 int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
643 const BIGNUM *p, BN_CTX *ctx); /* r = (a * b) mod p */
644 int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
646 int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *b, const BIGNUM *p,
648 int BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
649 const BIGNUM *p, BN_CTX *ctx); /* r = (a / b) mod p */
650 int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
651 const BIGNUM *p, BN_CTX *ctx); /* r = (a ^ b) mod p */
652 int BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
654 int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
662 int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[]);
664 int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
666 int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[],
668 int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *b, const int p[],
670 int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
672 int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
674 int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a,
676 int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a,
678 int BN_GF2m_poly2arr(const BIGNUM *a, int p[], int max);
679 int BN_GF2m_arr2poly(const int p[], BIGNUM *a);
685 int BN_nist_mod_192(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
686 int BN_nist_mod_224(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
687 int BN_nist_mod_256(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
688 int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
689 int BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx);
691 const BIGNUM *BN_get0_nist_prime_192(void);
692 const BIGNUM *BN_get0_nist_prime_224(void);
693 const BIGNUM *BN_get0_nist_prime_256(void);
694 const BIGNUM *BN_get0_nist_prime_384(void);
695 const BIGNUM *BN_get0_nist_prime_521(void);
697 int BN_generate_dsa_nonce(BIGNUM *out, const BIGNUM *range, const BIGNUM *priv,
706 BIGNUM *bn_expand2(BIGNUM *a, int words);
708 BIGNUM *bn_dup_expand(const BIGNUM *a, int words); /* unused */
752 const BIGNUM *_bnum1 = (a); \
773 const BIGNUM *_bnum2 = (a); \
786 const BIGNUM *_bnum2 = (bn); \
821 BIGNUM *get_rfc2409_prime_768(BIGNUM *bn);
822 BIGNUM *get_rfc2409_prime_1024(BIGNUM *bn);
825 BIGNUM *get_rfc3526_prime_1536(BIGNUM *bn);
826 BIGNUM *get_rfc3526_prime_2048(BIGNUM *bn);
827 BIGNUM *get_rfc3526_prime_3072(BIGNUM *bn);
828 BIGNUM *get_rfc3526_prime_4096(BIGNUM *bn);
829 BIGNUM *get_rfc3526_prime_6144(BIGNUM *bn);
830 BIGNUM *get_rfc3526_prime_8192(BIGNUM *bn);
832 int BN_bntest_rand(BIGNUM *rnd, int bits, int top,int bottom);