summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bn/bn_mod.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/bn/bn_mod.c')
-rw-r--r--src/lib/libcrypto/bn/bn_mod.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/lib/libcrypto/bn/bn_mod.c b/src/lib/libcrypto/bn/bn_mod.c
index 79766d0036..365f6fcf03 100644
--- a/src/lib/libcrypto/bn/bn_mod.c
+++ b/src/lib/libcrypto/bn/bn_mod.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_mod.c,v 1.21 2023/06/13 09:28:13 tb Exp $ */ 1/* $OpenBSD: bn_mod.c,v 1.22 2023/07/08 12:21:58 beck Exp $ */
2/* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> 2/* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de>
3 * for the OpenSSL project. */ 3 * for the OpenSSL project. */
4/* ==================================================================== 4/* ====================================================================
@@ -146,6 +146,7 @@ BN_nnmod(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx)
146 return BN_usub(r, m, r); 146 return BN_usub(r, m, r);
147 return 1; 147 return 1;
148} 148}
149LCRYPTO_ALIAS(BN_nnmod);
149 150
150int 151int
151BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 152BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
@@ -159,6 +160,7 @@ BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
159 return 0; 160 return 0;
160 return BN_nnmod(r, r, m, ctx); 161 return BN_nnmod(r, r, m, ctx);
161} 162}
163LCRYPTO_ALIAS(BN_mod_add);
162 164
163/* 165/*
164 * BN_mod_add() variant that may only be used if both a and b are non-negative 166 * BN_mod_add() variant that may only be used if both a and b are non-negative
@@ -177,6 +179,7 @@ BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m)
177 return BN_usub(r, r, m); 179 return BN_usub(r, r, m);
178 return 1; 180 return 1;
179} 181}
182LCRYPTO_ALIAS(BN_mod_add_quick);
180 183
181int 184int
182BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 185BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
@@ -190,6 +193,7 @@ BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
190 return 0; 193 return 0;
191 return BN_nnmod(r, r, m, ctx); 194 return BN_nnmod(r, r, m, ctx);
192} 195}
196LCRYPTO_ALIAS(BN_mod_sub);
193 197
194/* 198/*
195 * BN_mod_sub() variant that may only be used if both a and b are non-negative 199 * BN_mod_sub() variant that may only be used if both a and b are non-negative
@@ -208,6 +212,7 @@ BN_mod_sub_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m)
208 return 0; 212 return 0;
209 return BN_usub(r, m, r); 213 return BN_usub(r, m, r);
210} 214}
215LCRYPTO_ALIAS(BN_mod_sub_quick);
211 216
212int 217int
213BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 218BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
@@ -246,12 +251,14 @@ BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
246 251
247 return ret; 252 return ret;
248} 253}
254LCRYPTO_ALIAS(BN_mod_mul);
249 255
250int 256int
251BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx) 257BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx)
252{ 258{
253 return BN_mod_mul(r, a, a, m, ctx); 259 return BN_mod_mul(r, a, a, m, ctx);
254} 260}
261LCRYPTO_ALIAS(BN_mod_sqr);
255 262
256int 263int
257BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx) 264BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx)
@@ -264,6 +271,7 @@ BN_mod_lshift1(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx)
264 return 0; 271 return 0;
265 return BN_nnmod(r, r, m, ctx); 272 return BN_nnmod(r, r, m, ctx);
266} 273}
274LCRYPTO_ALIAS(BN_mod_lshift1);
267 275
268/* 276/*
269 * BN_mod_lshift1() variant that may be used if a is non-negative 277 * BN_mod_lshift1() variant that may be used if a is non-negative
@@ -282,6 +290,7 @@ BN_mod_lshift1_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *m)
282 return BN_usub(r, r, m); 290 return BN_usub(r, r, m);
283 return 1; 291 return 1;
284} 292}
293LCRYPTO_ALIAS(BN_mod_lshift1_quick);
285 294
286int 295int
287BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m, BN_CTX *ctx) 296BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m, BN_CTX *ctx)
@@ -316,6 +325,7 @@ BN_mod_lshift(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m, BN_CTX *ctx)
316 325
317 return ret; 326 return ret;
318} 327}
328LCRYPTO_ALIAS(BN_mod_lshift);
319 329
320/* 330/*
321 * BN_mod_lshift() variant that may be used if a is non-negative 331 * BN_mod_lshift() variant that may be used if a is non-negative
@@ -356,3 +366,4 @@ BN_mod_lshift_quick(BIGNUM *r, const BIGNUM *a, int n, const BIGNUM *m)
356 366
357 return 1; 367 return 1;
358} 368}
369LCRYPTO_ALIAS(BN_mod_lshift_quick);