summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bn/bn.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/bn/bn.h')
-rw-r--r--src/lib/libcrypto/bn/bn.h63
1 files changed, 1 insertions, 62 deletions
diff --git a/src/lib/libcrypto/bn/bn.h b/src/lib/libcrypto/bn/bn.h
index 52e3d078ab..b15e6311f9 100644
--- a/src/lib/libcrypto/bn/bn.h
+++ b/src/lib/libcrypto/bn/bn.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn.h,v 1.68 2023/04/25 17:42:07 tb Exp $ */ 1/* $OpenBSD: bn.h,v 1.69 2023/04/25 19:53:30 tb Exp $ */
2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -505,67 +505,6 @@ void BN_set_params(int mul, int high, int low, int mont);
505int BN_get_params(int which); /* 0, mul, 1 high, 2 low, 3 mont */ 505int BN_get_params(int which); /* 0, mul, 1 high, 2 low, 3 mont */
506#endif 506#endif
507 507
508#ifndef OPENSSL_NO_EC2M
509
510/* Functions for arithmetic over binary polynomials represented by BIGNUMs.
511 *
512 * The BIGNUM::neg property of BIGNUMs representing binary polynomials is
513 * ignored.
514 *
515 * Note that input arguments are not const so that their bit arrays can
516 * be expanded to the appropriate size if needed.
517 */
518
519int BN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); /*r = a + b*/
520#define BN_GF2m_sub(r, a, b) BN_GF2m_add(r, a, b)
521int BN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p); /*r=a mod p*/
522int
523BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
524 const BIGNUM *p, BN_CTX *ctx); /* r = (a * b) mod p */
525int
526BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
527 BN_CTX *ctx); /* r = (a * a) mod p */
528int
529BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *b, const BIGNUM *p,
530 BN_CTX *ctx); /* r = (1 / b) mod p */
531int
532BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
533 const BIGNUM *p, BN_CTX *ctx); /* r = (a / b) mod p */
534int
535BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
536 const BIGNUM *p, BN_CTX *ctx); /* r = (a ^ b) mod p */
537int
538BN_GF2m_mod_sqrt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
539 BN_CTX *ctx); /* r = sqrt(a) mod p */
540int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
541 BN_CTX *ctx); /* r^2 + r = a mod p */
542#define BN_GF2m_cmp(a, b) BN_ucmp((a), (b))
543/* Some functions allow for representation of the irreducible polynomials
544 * as an unsigned int[], say p. The irreducible f(t) is then of the form:
545 * t^p[0] + t^p[1] + ... + t^p[k]
546 * where m = p[0] > p[1] > ... > p[k] = 0.
547 */
548int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[]);
549/* r = a mod p */
550int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
551 const int p[], BN_CTX *ctx); /* r = (a * b) mod p */
552int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[],
553 BN_CTX *ctx); /* r = (a * a) mod p */
554int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *b, const int p[],
555 BN_CTX *ctx); /* r = (1 / b) mod p */
556int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
557 const int p[], BN_CTX *ctx); /* r = (a / b) mod p */
558int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
559 const int p[], BN_CTX *ctx); /* r = (a ^ b) mod p */
560int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a,
561 const int p[], BN_CTX *ctx); /* r = sqrt(a) mod p */
562int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a,
563 const int p[], BN_CTX *ctx); /* r^2 + r = a mod p */
564int BN_GF2m_poly2arr(const BIGNUM *a, int p[], int max);
565int BN_GF2m_arr2poly(const int p[], BIGNUM *a);
566
567#endif
568
569/* Primes from RFC 2409 */ 508/* Primes from RFC 2409 */
570BIGNUM *get_rfc2409_prime_768(BIGNUM *bn); 509BIGNUM *get_rfc2409_prime_768(BIGNUM *bn);
571BIGNUM *get_rfc2409_prime_1024(BIGNUM *bn); 510BIGNUM *get_rfc2409_prime_1024(BIGNUM *bn);