summaryrefslogtreecommitdiff
path: root/src/lib/libssl/src/crypto/bn/bn_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/src/crypto/bn/bn_lib.c')
-rw-r--r--src/lib/libssl/src/crypto/bn/bn_lib.c60
1 files changed, 14 insertions, 46 deletions
diff --git a/src/lib/libssl/src/crypto/bn/bn_lib.c b/src/lib/libssl/src/crypto/bn/bn_lib.c
index 5d62d88e8b..0e6b12d9c3 100644
--- a/src/lib/libssl/src/crypto/bn/bn_lib.c
+++ b/src/lib/libssl/src/crypto/bn/bn_lib.c
@@ -71,14 +71,14 @@ const char *BN_version="Big Number" OPENSSL_VERSION_PTEXT;
71 * 7 - 128 == 4096 71 * 7 - 128 == 4096
72 * 8 - 256 == 8192 72 * 8 - 256 == 8192
73 */ 73 */
74OPENSSL_GLOBAL int bn_limit_bits=0; 74static int bn_limit_bits=0;
75OPENSSL_GLOBAL int bn_limit_num=8; /* (1<<bn_limit_bits) */ 75static int bn_limit_num=8; /* (1<<bn_limit_bits) */
76OPENSSL_GLOBAL int bn_limit_bits_low=0; 76static int bn_limit_bits_low=0;
77OPENSSL_GLOBAL int bn_limit_num_low=8; /* (1<<bn_limit_bits_low) */ 77static int bn_limit_num_low=8; /* (1<<bn_limit_bits_low) */
78OPENSSL_GLOBAL int bn_limit_bits_high=0; 78static int bn_limit_bits_high=0;
79OPENSSL_GLOBAL int bn_limit_num_high=8; /* (1<<bn_limit_bits_high) */ 79static int bn_limit_num_high=8; /* (1<<bn_limit_bits_high) */
80OPENSSL_GLOBAL int bn_limit_bits_mont=0; 80static int bn_limit_bits_mont=0;
81OPENSSL_GLOBAL int bn_limit_num_mont=8; /* (1<<bn_limit_bits_mont) */ 81static int bn_limit_num_mont=8; /* (1<<bn_limit_bits_mont) */
82 82
83void BN_set_params(int mult, int high, int low, int mont) 83void BN_set_params(int mult, int high, int low, int mont)
84 { 84 {
@@ -304,42 +304,10 @@ BIGNUM *BN_new(void)
304 return(ret); 304 return(ret);
305 } 305 }
306 306
307 307/* This is an internal function that should not be used in applications.
308BN_CTX *BN_CTX_new(void) 308 * It ensures that 'b' has enough room for a 'words' word number number.
309 { 309 * It is mostly used by the various BIGNUM routines. If there is an error,
310 BN_CTX *ret; 310 * NULL is returned. If not, 'b' is returned. */
311
312 ret=(BN_CTX *)Malloc(sizeof(BN_CTX));
313 if (ret == NULL)
314 {
315 BNerr(BN_F_BN_CTX_NEW,ERR_R_MALLOC_FAILURE);
316 return(NULL);
317 }
318
319 BN_CTX_init(ret);
320 ret->flags=BN_FLG_MALLOCED;
321 return(ret);
322 }
323
324void BN_CTX_init(BN_CTX *ctx)
325 {
326 memset(ctx,0,sizeof(BN_CTX));
327 ctx->tos=0;
328 ctx->flags=0;
329 }
330
331void BN_CTX_free(BN_CTX *c)
332 {
333 int i;
334
335 if(c == NULL)
336 return;
337
338 for (i=0; i<BN_CTX_NUM; i++)
339 BN_clear_free(&(c->bn[i]));
340 if (c->flags & BN_FLG_MALLOCED)
341 Free(c);
342 }
343 311
344BIGNUM *bn_expand2(BIGNUM *b, int words) 312BIGNUM *bn_expand2(BIGNUM *b, int words)
345 { 313 {
@@ -389,7 +357,7 @@ BIGNUM *bn_expand2(BIGNUM *b, int words)
389 * if A and B happen to share same cache line such code is going to 357 * if A and B happen to share same cache line such code is going to
390 * cause severe cache trashing. Both factors have severe impact on 358 * cause severe cache trashing. Both factors have severe impact on
391 * performance of modern CPUs and this is the reason why this 359 * performance of modern CPUs and this is the reason why this
392 * particulare piece of code is #ifdefed away and replaced by more 360 * particular piece of code is #ifdefed away and replaced by more
393 * "friendly" version found in #else section below. This comment 361 * "friendly" version found in #else section below. This comment
394 * also applies to BN_copy function. 362 * also applies to BN_copy function.
395 * 363 *
@@ -420,7 +388,7 @@ BIGNUM *bn_expand2(BIGNUM *b, int words)
420 A[0]=B[0]; 388 A[0]=B[0];
421 case 0: 389 case 0:
422 /* I need the 'case 0' entry for utrix cc. 390 /* I need the 'case 0' entry for utrix cc.
423 * If the optimiser is turned on, it does the 391 * If the optimizer is turned on, it does the
424 * switch table by doing 392 * switch table by doing
425 * a=top&7 393 * a=top&7
426 * a--; 394 * a--;