Loading CHANGES +12 −1 Original line number Diff line number Diff line Loading @@ -4,6 +4,17 @@ Changes between 0.9.5a and 0.9.6 [xx XXX 2000] *) Re-implement BN_mod_exp2_mont using independent (and larger) windows. This makes DSA verification about 2 % faster. [Bodo Moeller] *) Increase maximum window size in BN_mod_exp_... to 6 bits instead of 5 (meaning that now 2^5 values will be precomputed, which is only 4 KB plus overhead for 1024 bit moduli). This makes exponentiations about 0.5 % faster for 1024 bit exponents (as measured by "openssl speed rsa2048"). [Bodo Moeller] *) Rename memory handling macros to avoid conflicts with other software: Malloc => OPENSSL_malloc Loading @@ -13,7 +24,7 @@ [Richard Levitte] *) New function BN_mod_exp_mont_word for small bases (roughly 15-20% faster than BN_mod_exp_mont). faster than BN_mod_exp_mont, i.e. 7.5-10% for a full DH exchange). [Bodo Moeller] *) CygWin32 support. Loading TABLE +11 −11 Original line number Diff line number Diff line Loading @@ -632,7 +632,7 @@ $dso_scheme = *** debug-ben $cc = gcc $cflags = -DBN_DEBUG -DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -O2 -pedantic -Wall -Wshadow -Werror -pipe $cflags = -DBN_DEBUG -DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -O2 -pedantic -Wall -Wshadow -Werror -pipe $unistd = $thread_cflag = (unknown) $lflags = Loading @@ -650,7 +650,7 @@ $dso_scheme = *** debug-ben-debug $cc = gcc $cflags = -DBN_DEBUG -DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe $cflags = -DBN_DEBUG -DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe $unistd = $thread_cflag = (unknown) $lflags = Loading Loading @@ -1228,7 +1228,7 @@ $dso_scheme = $cc = cc $cflags = -n32 -O2 -use_readonly_const -DTERMIOS -DB_ENDIAN -DBN_DIV3W $unistd = $thread_cflag = (unknown) $thread_cflag = -D_SGI_MP_SOURCE $lflags = $bn_ops = DES_PTR RC4_CHAR RC4_CHUNK_LL DES_RISC2 DES_UNROLL BF_PTR SIXTY_FOUR_BIT $bn_obj = asm/mips3.o Loading @@ -1246,7 +1246,7 @@ $dso_scheme = $cc = gcc $cflags = -mabi=n32 -mmips-as -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W $unistd = $thread_cflag = (unknown) $thread_cflag = -D_SGI_MP_SOURCE $lflags = $bn_ops = MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK_LL DES_UNROLL DES_RISC2 DES_PTR BF_PTR SIXTY_FOUR_BIT $bn_obj = asm/mips3.o Loading @@ -1264,7 +1264,7 @@ $dso_scheme = $cc = cc $cflags = -64 -mips4 -O2 -use_readonly_const -DTERMIOS -DB_ENDIAN -DBN_DIV3W $unistd = $thread_cflag = (unknown) $thread_cflag = -D_SGI_MP_SOURCE $lflags = $bn_ops = RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG $bn_obj = asm/mips3.o Loading @@ -1282,7 +1282,7 @@ $dso_scheme = $cc = gcc $cflags = -mabi=64 -mips4 -mmips-as -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W $unistd = $thread_cflag = (unknown) $thread_cflag = -D_SGI_MP_SOURCE $lflags = $bn_ops = RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG $bn_obj = asm/mips3.o Loading @@ -1300,7 +1300,7 @@ $dso_scheme = $cc = ccc $cflags = -fast -readonly_strings -DL_ENDIAN -DTERMIO $unistd = $thread_cflag = (unknown) $thread_cflag = -D_REENTRANT $lflags = $bn_ops = SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL $bn_obj = asm/alpha.o Loading @@ -1318,7 +1318,7 @@ $dso_scheme = $cc = gcc $cflags = -O3 -DL_ENDIAN -DTERMIO $unistd = $thread_cflag = (unknown) $thread_cflag = -D_REENTRANT $lflags = $bn_ops = SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL $bn_obj = asm/alpha.o Loading @@ -1336,7 +1336,7 @@ $dso_scheme = $cc = ccc $cflags = -fast -readonly_strings -DL_ENDIAN -DTERMIO $unistd = $thread_cflag = (unknown) $thread_cflag = -D_REENTRANT $lflags = $bn_ops = SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL $bn_obj = asm/alpha.o Loading @@ -1354,7 +1354,7 @@ $dso_scheme = $cc = gcc $cflags = -O3 -DL_ENDIAN -DTERMIO $unistd = $thread_cflag = (unknown) $thread_cflag = -D_REENTRANT $lflags = $bn_ops = SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_UNROLL $bn_obj = asm/alpha.o Loading Loading @@ -1859,7 +1859,7 @@ $cc = gcc $cflags = -O3 -mv8 -Dssize_t=int $unistd = $thread_cflag = (unknown) $lflags = $lflags = -liberty $bn_ops = BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL DES_PTR DES_RISC1 $bn_obj = $des_obj = Loading crypto/bn/bn.h +1 −0 Original line number Diff line number Diff line Loading @@ -485,6 +485,7 @@ BN_ULONG bn_sub_words(BN_ULONG *rp, BN_ULONG *ap, BN_ULONG *bp,int num); #define BN_F_BN_CTX_NEW 106 #define BN_F_BN_DIV 107 #define BN_F_BN_EXPAND2 108 #define BN_F_BN_MOD_EXP2_MONT 118 #define BN_F_BN_MOD_EXP_MONT 109 #define BN_F_BN_MOD_EXP_MONT_WORD 117 #define BN_F_BN_MOD_INVERSE 110 Loading crypto/bn/bn_err.c +2 −1 Original line number Diff line number Diff line Loading @@ -76,8 +76,9 @@ static ERR_STRING_DATA BN_str_functs[]= {ERR_PACK(0,BN_F_BN_CTX_NEW,0), "BN_CTX_new"}, {ERR_PACK(0,BN_F_BN_DIV,0), "BN_div"}, {ERR_PACK(0,BN_F_BN_EXPAND2,0), "bn_expand2"}, {ERR_PACK(0,BN_F_BN_MOD_EXP2_MONT,0), "BN_mod_exp2_mont"}, {ERR_PACK(0,BN_F_BN_MOD_EXP_MONT,0), "BN_mod_exp_mont"}, {ERR_PACK(0,BN_F_BN_MOD_EXP_MONT_WORD,0), "BN_MOD_EXP_MONT_WORD"}, {ERR_PACK(0,BN_F_BN_MOD_EXP_MONT_WORD,0), "BN_mod_exp_mont_word"}, {ERR_PACK(0,BN_F_BN_MOD_INVERSE,0), "BN_mod_inverse"}, {ERR_PACK(0,BN_F_BN_MOD_MUL_RECIPROCAL,0), "BN_mod_mul_reciprocal"}, {ERR_PACK(0,BN_F_BN_MPI2BN,0), "BN_mpi2bn"}, Loading crypto/bn/bn_exp.c +37 −52 Original line number Diff line number Diff line Loading @@ -121,7 +121,7 @@ #endif #define TABLE_SIZE 16 #define TABLE_SIZE 32 /* slow but works */ int BN_mod_mul(BIGNUM *ret, BIGNUM *a, BIGNUM *b, const BIGNUM *m, BN_CTX *ctx) Loading Loading @@ -427,18 +427,12 @@ int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, ts=1; if (!BN_mod(&(val[0]),a,m,ctx)) goto err; /* 1 */ window = BN_window_bits_for_exponent_size(bits); if (window > 1) { if (!BN_mod_mul_reciprocal(aa,&(val[0]),&(val[0]),&recp,ctx)) goto err; /* 2 */ if (bits <= 17) /* This is probably 3 or 0x10001, so just do singles */ window=1; else if (bits >= 256) window=5; /* max size of window */ else if (bits >= 128) window=4; else window=3; j=1<<(window-1); for (i=1; i<j; i++) { Loading @@ -447,6 +441,7 @@ int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, goto err; } ts=i; } start=1; /* This is used to avoid multiplication etc * when there is only the value '1' in the Loading Loading @@ -574,17 +569,11 @@ int BN_mod_exp_mont(BIGNUM *rr, BIGNUM *a, const BIGNUM *p, else aa=a; if (!BN_to_montgomery(&(val[0]),aa,mont,ctx)) goto err; /* 1 */ if (!BN_mod_mul_montgomery(d,&(val[0]),&(val[0]),mont,ctx)) goto err; /* 2 */ if (bits <= 20) /* This is probably 3 or 0x10001, so just do singles */ window=1; else if (bits >= 256) window=5; /* max size of window */ else if (bits >= 128) window=4; else window=3; window = BN_window_bits_for_exponent_size(bits); if (window > 1) { if (!BN_mod_mul_montgomery(d,&(val[0]),&(val[0]),mont,ctx)) goto err; /* 2 */ j=1<<(window-1); for (i=1; i<j; i++) { Loading @@ -593,6 +582,7 @@ int BN_mod_exp_mont(BIGNUM *rr, BIGNUM *a, const BIGNUM *p, goto err; } ts=i; } start=1; /* This is used to avoid multiplication etc * when there is only the value '1' in the Loading Loading @@ -787,18 +777,12 @@ int BN_mod_exp_simple(BIGNUM *r, BIGNUM *a, BIGNUM *p, BIGNUM *m, BN_init(&(val[0])); ts=1; if (!BN_mod(&(val[0]),a,m,ctx)) goto err; /* 1 */ window = BN_window_bits_for_exponent_size(bits); if (window > 1) { if (!BN_mod_mul(d,&(val[0]),&(val[0]),m,ctx)) goto err; /* 2 */ if (bits <= 17) /* This is probably 3 or 0x10001, so just do singles */ window=1; else if (bits >= 256) window=5; /* max size of window */ else if (bits >= 128) window=4; else window=3; j=1<<(window-1); for (i=1; i<j; i++) { Loading @@ -807,6 +791,7 @@ int BN_mod_exp_simple(BIGNUM *r, BIGNUM *a, BIGNUM *p, BIGNUM *m, goto err; } ts=i; } start=1; /* This is used to avoid multiplication etc * when there is only the value '1' in the Loading Loading
CHANGES +12 −1 Original line number Diff line number Diff line Loading @@ -4,6 +4,17 @@ Changes between 0.9.5a and 0.9.6 [xx XXX 2000] *) Re-implement BN_mod_exp2_mont using independent (and larger) windows. This makes DSA verification about 2 % faster. [Bodo Moeller] *) Increase maximum window size in BN_mod_exp_... to 6 bits instead of 5 (meaning that now 2^5 values will be precomputed, which is only 4 KB plus overhead for 1024 bit moduli). This makes exponentiations about 0.5 % faster for 1024 bit exponents (as measured by "openssl speed rsa2048"). [Bodo Moeller] *) Rename memory handling macros to avoid conflicts with other software: Malloc => OPENSSL_malloc Loading @@ -13,7 +24,7 @@ [Richard Levitte] *) New function BN_mod_exp_mont_word for small bases (roughly 15-20% faster than BN_mod_exp_mont). faster than BN_mod_exp_mont, i.e. 7.5-10% for a full DH exchange). [Bodo Moeller] *) CygWin32 support. Loading
TABLE +11 −11 Original line number Diff line number Diff line Loading @@ -632,7 +632,7 @@ $dso_scheme = *** debug-ben $cc = gcc $cflags = -DBN_DEBUG -DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -O2 -pedantic -Wall -Wshadow -Werror -pipe $cflags = -DBN_DEBUG -DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -O2 -pedantic -Wall -Wshadow -Werror -pipe $unistd = $thread_cflag = (unknown) $lflags = Loading @@ -650,7 +650,7 @@ $dso_scheme = *** debug-ben-debug $cc = gcc $cflags = -DBN_DEBUG -DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe $cflags = -DBN_DEBUG -DREF_CHECK -DBN_CTX_DEBUG -DCRYPTO_MDEBUG -DPEDANTIC -DDEBUG_SAFESTACK -g3 -O2 -pedantic -Wall -Wshadow -Werror -pipe $unistd = $thread_cflag = (unknown) $lflags = Loading Loading @@ -1228,7 +1228,7 @@ $dso_scheme = $cc = cc $cflags = -n32 -O2 -use_readonly_const -DTERMIOS -DB_ENDIAN -DBN_DIV3W $unistd = $thread_cflag = (unknown) $thread_cflag = -D_SGI_MP_SOURCE $lflags = $bn_ops = DES_PTR RC4_CHAR RC4_CHUNK_LL DES_RISC2 DES_UNROLL BF_PTR SIXTY_FOUR_BIT $bn_obj = asm/mips3.o Loading @@ -1246,7 +1246,7 @@ $dso_scheme = $cc = gcc $cflags = -mabi=n32 -mmips-as -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W $unistd = $thread_cflag = (unknown) $thread_cflag = -D_SGI_MP_SOURCE $lflags = $bn_ops = MD2_CHAR RC4_INDEX RC4_CHAR RC4_CHUNK_LL DES_UNROLL DES_RISC2 DES_PTR BF_PTR SIXTY_FOUR_BIT $bn_obj = asm/mips3.o Loading @@ -1264,7 +1264,7 @@ $dso_scheme = $cc = cc $cflags = -64 -mips4 -O2 -use_readonly_const -DTERMIOS -DB_ENDIAN -DBN_DIV3W $unistd = $thread_cflag = (unknown) $thread_cflag = -D_SGI_MP_SOURCE $lflags = $bn_ops = RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG $bn_obj = asm/mips3.o Loading @@ -1282,7 +1282,7 @@ $dso_scheme = $cc = gcc $cflags = -mabi=64 -mips4 -mmips-as -O3 -DTERMIOS -DB_ENDIAN -DBN_DIV3W $unistd = $thread_cflag = (unknown) $thread_cflag = -D_SGI_MP_SOURCE $lflags = $bn_ops = RC4_CHAR RC4_CHUNK DES_RISC2 DES_UNROLL SIXTY_FOUR_BIT_LONG $bn_obj = asm/mips3.o Loading @@ -1300,7 +1300,7 @@ $dso_scheme = $cc = ccc $cflags = -fast -readonly_strings -DL_ENDIAN -DTERMIO $unistd = $thread_cflag = (unknown) $thread_cflag = -D_REENTRANT $lflags = $bn_ops = SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL $bn_obj = asm/alpha.o Loading @@ -1318,7 +1318,7 @@ $dso_scheme = $cc = gcc $cflags = -O3 -DL_ENDIAN -DTERMIO $unistd = $thread_cflag = (unknown) $thread_cflag = -D_REENTRANT $lflags = $bn_ops = SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_RISC1 DES_UNROLL $bn_obj = asm/alpha.o Loading @@ -1336,7 +1336,7 @@ $dso_scheme = $cc = ccc $cflags = -fast -readonly_strings -DL_ENDIAN -DTERMIO $unistd = $thread_cflag = (unknown) $thread_cflag = -D_REENTRANT $lflags = $bn_ops = SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_PTR DES_RISC1 DES_UNROLL $bn_obj = asm/alpha.o Loading @@ -1354,7 +1354,7 @@ $dso_scheme = $cc = gcc $cflags = -O3 -DL_ENDIAN -DTERMIO $unistd = $thread_cflag = (unknown) $thread_cflag = -D_REENTRANT $lflags = $bn_ops = SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_RISC1 DES_UNROLL $bn_obj = asm/alpha.o Loading Loading @@ -1859,7 +1859,7 @@ $cc = gcc $cflags = -O3 -mv8 -Dssize_t=int $unistd = $thread_cflag = (unknown) $lflags = $lflags = -liberty $bn_ops = BN_LLONG RC4_CHAR RC4_CHUNK DES_UNROLL DES_PTR DES_RISC1 $bn_obj = $des_obj = Loading
crypto/bn/bn.h +1 −0 Original line number Diff line number Diff line Loading @@ -485,6 +485,7 @@ BN_ULONG bn_sub_words(BN_ULONG *rp, BN_ULONG *ap, BN_ULONG *bp,int num); #define BN_F_BN_CTX_NEW 106 #define BN_F_BN_DIV 107 #define BN_F_BN_EXPAND2 108 #define BN_F_BN_MOD_EXP2_MONT 118 #define BN_F_BN_MOD_EXP_MONT 109 #define BN_F_BN_MOD_EXP_MONT_WORD 117 #define BN_F_BN_MOD_INVERSE 110 Loading
crypto/bn/bn_err.c +2 −1 Original line number Diff line number Diff line Loading @@ -76,8 +76,9 @@ static ERR_STRING_DATA BN_str_functs[]= {ERR_PACK(0,BN_F_BN_CTX_NEW,0), "BN_CTX_new"}, {ERR_PACK(0,BN_F_BN_DIV,0), "BN_div"}, {ERR_PACK(0,BN_F_BN_EXPAND2,0), "bn_expand2"}, {ERR_PACK(0,BN_F_BN_MOD_EXP2_MONT,0), "BN_mod_exp2_mont"}, {ERR_PACK(0,BN_F_BN_MOD_EXP_MONT,0), "BN_mod_exp_mont"}, {ERR_PACK(0,BN_F_BN_MOD_EXP_MONT_WORD,0), "BN_MOD_EXP_MONT_WORD"}, {ERR_PACK(0,BN_F_BN_MOD_EXP_MONT_WORD,0), "BN_mod_exp_mont_word"}, {ERR_PACK(0,BN_F_BN_MOD_INVERSE,0), "BN_mod_inverse"}, {ERR_PACK(0,BN_F_BN_MOD_MUL_RECIPROCAL,0), "BN_mod_mul_reciprocal"}, {ERR_PACK(0,BN_F_BN_MPI2BN,0), "BN_mpi2bn"}, Loading
crypto/bn/bn_exp.c +37 −52 Original line number Diff line number Diff line Loading @@ -121,7 +121,7 @@ #endif #define TABLE_SIZE 16 #define TABLE_SIZE 32 /* slow but works */ int BN_mod_mul(BIGNUM *ret, BIGNUM *a, BIGNUM *b, const BIGNUM *m, BN_CTX *ctx) Loading Loading @@ -427,18 +427,12 @@ int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, ts=1; if (!BN_mod(&(val[0]),a,m,ctx)) goto err; /* 1 */ window = BN_window_bits_for_exponent_size(bits); if (window > 1) { if (!BN_mod_mul_reciprocal(aa,&(val[0]),&(val[0]),&recp,ctx)) goto err; /* 2 */ if (bits <= 17) /* This is probably 3 or 0x10001, so just do singles */ window=1; else if (bits >= 256) window=5; /* max size of window */ else if (bits >= 128) window=4; else window=3; j=1<<(window-1); for (i=1; i<j; i++) { Loading @@ -447,6 +441,7 @@ int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, goto err; } ts=i; } start=1; /* This is used to avoid multiplication etc * when there is only the value '1' in the Loading Loading @@ -574,17 +569,11 @@ int BN_mod_exp_mont(BIGNUM *rr, BIGNUM *a, const BIGNUM *p, else aa=a; if (!BN_to_montgomery(&(val[0]),aa,mont,ctx)) goto err; /* 1 */ if (!BN_mod_mul_montgomery(d,&(val[0]),&(val[0]),mont,ctx)) goto err; /* 2 */ if (bits <= 20) /* This is probably 3 or 0x10001, so just do singles */ window=1; else if (bits >= 256) window=5; /* max size of window */ else if (bits >= 128) window=4; else window=3; window = BN_window_bits_for_exponent_size(bits); if (window > 1) { if (!BN_mod_mul_montgomery(d,&(val[0]),&(val[0]),mont,ctx)) goto err; /* 2 */ j=1<<(window-1); for (i=1; i<j; i++) { Loading @@ -593,6 +582,7 @@ int BN_mod_exp_mont(BIGNUM *rr, BIGNUM *a, const BIGNUM *p, goto err; } ts=i; } start=1; /* This is used to avoid multiplication etc * when there is only the value '1' in the Loading Loading @@ -787,18 +777,12 @@ int BN_mod_exp_simple(BIGNUM *r, BIGNUM *a, BIGNUM *p, BIGNUM *m, BN_init(&(val[0])); ts=1; if (!BN_mod(&(val[0]),a,m,ctx)) goto err; /* 1 */ window = BN_window_bits_for_exponent_size(bits); if (window > 1) { if (!BN_mod_mul(d,&(val[0]),&(val[0]),m,ctx)) goto err; /* 2 */ if (bits <= 17) /* This is probably 3 or 0x10001, so just do singles */ window=1; else if (bits >= 256) window=5; /* max size of window */ else if (bits >= 128) window=4; else window=3; j=1<<(window-1); for (i=1; i<j; i++) { Loading @@ -807,6 +791,7 @@ int BN_mod_exp_simple(BIGNUM *r, BIGNUM *a, BIGNUM *p, BIGNUM *m, goto err; } ts=i; } start=1; /* This is used to avoid multiplication etc * when there is only the value '1' in the Loading