diff options
| author | miod <> | 2014-04-24 21:31:02 +0000 |
|---|---|---|
| committer | miod <> | 2014-04-24 21:31:02 +0000 |
| commit | 7e3ee009cb00e65ea487ba61ae3b5271c73c19d6 (patch) | |
| tree | e53472b5e8d9eec9f62ca322e053d1c8f66dc1cc /src/lib/libcrypto/bn/bn_mod.c | |
| parent | 04cb67d517205b357d70ac65a314fea6e6a1a479 (diff) | |
| download | openbsd-7e3ee009cb00e65ea487ba61ae3b5271c73c19d6.tar.gz openbsd-7e3ee009cb00e65ea487ba61ae3b5271c73c19d6.tar.bz2 openbsd-7e3ee009cb00e65ea487ba61ae3b5271c73c19d6.zip | |
Try to clean the maze of <openssl/bn.h> defines regarding the BN internals.
The intent of this change is to only keep support for two kind of architectures:
- those with 32-bit int and long, and 64-bit long long, where
``long * long -> long long'' multiplication routines are available.
- those with 64-bit int and long, and no 128-bit long long type.
This gets rid of the SIXTY_FOUR_BIT_LONG, SIXTY_FOUR_BIT (not the same!),
THIRTY_TWO_BIT, SIXTEEN_BIT and EIGHT_BIT defines.
After this change, the types and defines are as follows:
arch: 64bit 32bit rationale
BN_LLONG undefined defined defined if l * l -> ll
BN_ULLONG undefined u long long result of BN_LONG * BN_LONG
BN_ULONG u long u int native register size
BN_LONG long int the same, signed
BN_BITS 128 64 size of 2*BN_ULONG in bits
BN_BYTES 8 4 size of 2*BN_ULONG in bytes
BN_BITS2 64 32 BN_BITS / 2
Tested on various 32-bit and 64-bit OpenBSD systems of various endianness.
Diffstat (limited to 'src/lib/libcrypto/bn/bn_mod.c')
| -rw-r--r-- | src/lib/libcrypto/bn/bn_mod.c | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/src/lib/libcrypto/bn/bn_mod.c b/src/lib/libcrypto/bn/bn_mod.c index 77d6ddb91a..6c439402dd 100644 --- a/src/lib/libcrypto/bn/bn_mod.c +++ b/src/lib/libcrypto/bn/bn_mod.c | |||
| @@ -115,15 +115,6 @@ | |||
| 115 | #include "bn_lcl.h" | 115 | #include "bn_lcl.h" |
| 116 | 116 | ||
| 117 | 117 | ||
| 118 | #if 0 /* now just a #define */ | ||
| 119 | int BN_mod(BIGNUM *rem, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) | ||
| 120 | { | ||
| 121 | return(BN_div(NULL,rem,m,d,ctx)); | ||
| 122 | /* note that rem->neg == m->neg (unless the remainder is zero) */ | ||
| 123 | } | ||
| 124 | #endif | ||
| 125 | |||
| 126 | |||
| 127 | int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) | 118 | int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) |
| 128 | { | 119 | { |
| 129 | /* like BN_mod, but returns non-negative remainder | 120 | /* like BN_mod, but returns non-negative remainder |
