diff options
author | beck <> | 2000-03-19 11:13:58 +0000 |
---|---|---|
committer | beck <> | 2000-03-19 11:13:58 +0000 |
commit | 796d609550df3a33fc11468741c5d2f6d3df4c11 (patch) | |
tree | 6c6d539061caa20372dad0ac4ddb1dfae2fbe7fe /src/lib/libcrypto/bn/bn_lib.c | |
parent | 5be3114c1fd7e0dfea1e38d3abb4cbba75244419 (diff) | |
download | openbsd-796d609550df3a33fc11468741c5d2f6d3df4c11.tar.gz openbsd-796d609550df3a33fc11468741c5d2f6d3df4c11.tar.bz2 openbsd-796d609550df3a33fc11468741c5d2f6d3df4c11.zip |
OpenSSL 0.9.5 merge
*warning* this bumps shared lib minors for libssl and libcrypto from 2.1 to 2.2
if you are using the ssl26 packages for ssh and other things to work you will
need to get new ones (see ~beck/libsslsnap/<arch>) on cvs or ~beck/src-patent.tar.gz on cvs
Diffstat (limited to 'src/lib/libcrypto/bn/bn_lib.c')
-rw-r--r-- | src/lib/libcrypto/bn/bn_lib.c | 60 |
1 files changed, 14 insertions, 46 deletions
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c index 5d62d88e8b..0e6b12d9c3 100644 --- a/src/lib/libcrypto/bn/bn_lib.c +++ b/src/lib/libcrypto/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 | */ |
74 | OPENSSL_GLOBAL int bn_limit_bits=0; | 74 | static int bn_limit_bits=0; |
75 | OPENSSL_GLOBAL int bn_limit_num=8; /* (1<<bn_limit_bits) */ | 75 | static int bn_limit_num=8; /* (1<<bn_limit_bits) */ |
76 | OPENSSL_GLOBAL int bn_limit_bits_low=0; | 76 | static int bn_limit_bits_low=0; |
77 | OPENSSL_GLOBAL int bn_limit_num_low=8; /* (1<<bn_limit_bits_low) */ | 77 | static int bn_limit_num_low=8; /* (1<<bn_limit_bits_low) */ |
78 | OPENSSL_GLOBAL int bn_limit_bits_high=0; | 78 | static int bn_limit_bits_high=0; |
79 | OPENSSL_GLOBAL int bn_limit_num_high=8; /* (1<<bn_limit_bits_high) */ | 79 | static int bn_limit_num_high=8; /* (1<<bn_limit_bits_high) */ |
80 | OPENSSL_GLOBAL int bn_limit_bits_mont=0; | 80 | static int bn_limit_bits_mont=0; |
81 | OPENSSL_GLOBAL int bn_limit_num_mont=8; /* (1<<bn_limit_bits_mont) */ | 81 | static int bn_limit_num_mont=8; /* (1<<bn_limit_bits_mont) */ |
82 | 82 | ||
83 | void BN_set_params(int mult, int high, int low, int mont) | 83 | void 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. | |
308 | BN_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 | |||
324 | void BN_CTX_init(BN_CTX *ctx) | ||
325 | { | ||
326 | memset(ctx,0,sizeof(BN_CTX)); | ||
327 | ctx->tos=0; | ||
328 | ctx->flags=0; | ||
329 | } | ||
330 | |||
331 | void 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 | ||
344 | BIGNUM *bn_expand2(BIGNUM *b, int words) | 312 | BIGNUM *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--; |