diff options
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/bn/bn.h | 50 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/bn_lcl.h | 46 |
2 files changed, 46 insertions, 50 deletions
diff --git a/src/lib/libcrypto/bn/bn.h b/src/lib/libcrypto/bn/bn.h index 5d9f17c4d9..abf8cfcf70 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.51 2022/01/14 07:49:49 tb Exp $ */ | 1 | /* $OpenBSD: bn.h,v 1.52 2022/01/14 08:01:47 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 | * |
| @@ -241,54 +241,6 @@ void BN_with_flags(BIGNUM *dest, const BIGNUM *src, int flags); | |||
| 241 | #define BN_RAND_BOTTOM_ANY 0 | 241 | #define BN_RAND_BOTTOM_ANY 0 |
| 242 | #define BN_RAND_BOTTOM_ODD 1 | 242 | #define BN_RAND_BOTTOM_ODD 1 |
| 243 | 243 | ||
| 244 | /* Move to bn_lcl.h */ | ||
| 245 | struct bignum_st { | ||
| 246 | BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit chunks. */ | ||
| 247 | int top; /* Index of last used d +1. */ | ||
| 248 | /* The next are internal book keeping for bn_expand. */ | ||
| 249 | int dmax; /* Size of the d array. */ | ||
| 250 | int neg; /* one if the number is negative */ | ||
| 251 | int flags; | ||
| 252 | }; | ||
| 253 | |||
| 254 | /* Move to bn_lcl.h */ | ||
| 255 | /* Used for montgomery multiplication */ | ||
| 256 | struct bn_mont_ctx_st { | ||
| 257 | int ri; /* number of bits in R */ | ||
| 258 | BIGNUM RR; /* used to convert to montgomery form */ | ||
| 259 | BIGNUM N; /* The modulus */ | ||
| 260 | BIGNUM Ni; /* R*(1/R mod N) - N*Ni = 1 | ||
| 261 | * (Ni is only stored for bignum algorithm) */ | ||
| 262 | BN_ULONG n0[2];/* least significant word(s) of Ni; | ||
| 263 | (type changed with 0.9.9, was "BN_ULONG n0;" before) */ | ||
| 264 | int flags; | ||
| 265 | }; | ||
| 266 | |||
| 267 | /* Move to bn_lcl.h */ | ||
| 268 | /* Used for reciprocal division/mod functions | ||
| 269 | * It cannot be shared between threads | ||
| 270 | */ | ||
| 271 | struct bn_recp_ctx_st { | ||
| 272 | BIGNUM N; /* the divisor */ | ||
| 273 | BIGNUM Nr; /* the reciprocal */ | ||
| 274 | int num_bits; | ||
| 275 | int shift; | ||
| 276 | int flags; | ||
| 277 | }; | ||
| 278 | |||
| 279 | /* Move to bn_lcl.h */ | ||
| 280 | /* Used for slow "generation" functions. */ | ||
| 281 | struct bn_gencb_st { | ||
| 282 | unsigned int ver; /* To handle binary (in)compatibility */ | ||
| 283 | void *arg; /* callback-specific data */ | ||
| 284 | union { | ||
| 285 | /* if(ver==1) - handles old style callbacks */ | ||
| 286 | void (*cb_1)(int, int, void *); | ||
| 287 | /* if(ver==2) - new callback style */ | ||
| 288 | int (*cb_2)(int, int, BN_GENCB *); | ||
| 289 | } cb; | ||
| 290 | }; | ||
| 291 | |||
| 292 | BN_GENCB *BN_GENCB_new(void); | 244 | BN_GENCB *BN_GENCB_new(void); |
| 293 | void BN_GENCB_free(BN_GENCB *cb); | 245 | void BN_GENCB_free(BN_GENCB *cb); |
| 294 | 246 | ||
diff --git a/src/lib/libcrypto/bn/bn_lcl.h b/src/lib/libcrypto/bn/bn_lcl.h index d0f36822dc..d8c9e20f40 100644 --- a/src/lib/libcrypto/bn/bn_lcl.h +++ b/src/lib/libcrypto/bn/bn_lcl.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_lcl.h,v 1.30 2018/11/05 23:52:47 tb Exp $ */ | 1 | /* $OpenBSD: bn_lcl.h,v 1.31 2022/01/14 08:01:47 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -118,6 +118,50 @@ | |||
| 118 | 118 | ||
| 119 | __BEGIN_HIDDEN_DECLS | 119 | __BEGIN_HIDDEN_DECLS |
| 120 | 120 | ||
| 121 | struct bignum_st { | ||
| 122 | BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit chunks. */ | ||
| 123 | int top; /* Index of last used d +1. */ | ||
| 124 | /* The next are internal book keeping for bn_expand. */ | ||
| 125 | int dmax; /* Size of the d array. */ | ||
| 126 | int neg; /* one if the number is negative */ | ||
| 127 | int flags; | ||
| 128 | }; | ||
| 129 | |||
| 130 | /* Used for montgomery multiplication */ | ||
| 131 | struct bn_mont_ctx_st { | ||
| 132 | int ri; /* number of bits in R */ | ||
| 133 | BIGNUM RR; /* used to convert to montgomery form */ | ||
| 134 | BIGNUM N; /* The modulus */ | ||
| 135 | BIGNUM Ni; /* R*(1/R mod N) - N*Ni = 1 | ||
| 136 | * (Ni is only stored for bignum algorithm) */ | ||
| 137 | BN_ULONG n0[2];/* least significant word(s) of Ni; | ||
| 138 | (type changed with 0.9.9, was "BN_ULONG n0;" before) */ | ||
| 139 | int flags; | ||
| 140 | }; | ||
| 141 | |||
| 142 | /* Used for reciprocal division/mod functions | ||
| 143 | * It cannot be shared between threads | ||
| 144 | */ | ||
| 145 | struct bn_recp_ctx_st { | ||
| 146 | BIGNUM N; /* the divisor */ | ||
| 147 | BIGNUM Nr; /* the reciprocal */ | ||
| 148 | int num_bits; | ||
| 149 | int shift; | ||
| 150 | int flags; | ||
| 151 | }; | ||
| 152 | |||
| 153 | /* Used for slow "generation" functions. */ | ||
| 154 | struct bn_gencb_st { | ||
| 155 | unsigned int ver; /* To handle binary (in)compatibility */ | ||
| 156 | void *arg; /* callback-specific data */ | ||
| 157 | union { | ||
| 158 | /* if(ver==1) - handles old style callbacks */ | ||
| 159 | void (*cb_1)(int, int, void *); | ||
| 160 | /* if(ver==2) - new callback style */ | ||
| 161 | int (*cb_2)(int, int, BN_GENCB *); | ||
| 162 | } cb; | ||
| 163 | }; | ||
| 164 | |||
| 121 | /* | 165 | /* |
| 122 | * BN_window_bits_for_exponent_size -- macro for sliding window mod_exp functions | 166 | * BN_window_bits_for_exponent_size -- macro for sliding window mod_exp functions |
| 123 | * | 167 | * |
