diff options
author | Werner Koch <wk@gnupg.org> | 2001-05-31 14:16:54 +0000 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2001-05-31 14:16:54 +0000 |
commit | 8bfa2df2135a1bd9823067debf0c8799bac4a936 (patch) | |
tree | b91075d39633de4f762dca14ae2323053ded62c8 /mpi | |
parent | 08e3fbb986bed2f39cc5dca806faca9654c3a6df (diff) | |
download | libgcrypt-8bfa2df2135a1bd9823067debf0c8799bac4a936.tar.gz |
The first libgcrypt only release.
Diffstat (limited to 'mpi')
90 files changed, 689 insertions, 735 deletions
diff --git a/mpi/ChangeLog b/mpi/ChangeLog index 2730fb1b..a97ccf40 100644 --- a/mpi/ChangeLog +++ b/mpi/ChangeLog @@ -1,3 +1,13 @@ +2001-05-31 Werner Koch <wk@gnupg.org> + + * mpih-cmp.c: Removed and moved mpihelp_cmp to .. + * mpi-inline.h: .. here. + + Major function renaming. All global functions are now prefixed + with _gcry_ or gcry_. Renamed also all mpihelp_ to just mpih_ so + that functions names are not getting to long an unreadable and for + better matching with the filenames. + 2001-05-28 Werner Koch <wk@gnupg.org> * mpicoder.c (mpi_fromstr): Made static and assume that all input diff --git a/mpi/Makefile.am b/mpi/Makefile.am index 35120063..8f684bd9 100644 --- a/mpi/Makefile.am +++ b/mpi/Makefile.am @@ -31,7 +31,6 @@ libmpi_la_SOURCES = longlong.h \ mpi-mpow.c \ mpi-scan.c \ mpicoder.c \ - mpih-cmp.c \ mpih-div.c \ mpih-mul.c \ mpiutil.c diff --git a/mpi/alpha/mpih-add1.S b/mpi/alpha/mpih-add1.S index a2ee8eb1..427d1abc 100644 --- a/mpi/alpha/mpih-add1.S +++ b/mpi/alpha/mpih-add1.S @@ -23,7 +23,7 @@ /******************* * mpi_limb_t - * mpihelp_add_n( mpi_ptr_t res_ptr, ($16) + * _gcry_mpih_add_n( mpi_ptr_t res_ptr, ($16) * mpi_ptr_t s1_ptr, ($17) * mpi_ptr_t s2_ptr, ($18) * mpi_size_t size) ($19) @@ -34,9 +34,9 @@ .set noat .text .align 3 - .globl mpihelp_add_n - .ent mpihelp_add_n -mpihelp_add_n: + .globl _gcry_mpih_add_n + .ent _gcry_mpih_add_n +_gcry_mpih_add_n: .frame $30,0,$26,0 ldq $3,0($17) @@ -120,5 +120,5 @@ mpihelp_add_n: or $0,$1,$0 ret $31,($26),1 - .end mpihelp_add_n + .end _gcry_mpih_add_n diff --git a/mpi/alpha/mpih-lshift.S b/mpi/alpha/mpih-lshift.S index 4ce4879a..54860e44 100644 --- a/mpi/alpha/mpih-lshift.S +++ b/mpi/alpha/mpih-lshift.S @@ -32,7 +32,7 @@ /******************* * mpi_limb_t - * mpihelp_lshift( mpi_ptr_t wp, (r16) + * _gcry_mpih_lshift( mpi_ptr_t wp, (r16) * mpi_ptr_t up, (r17) * mpi_size_t usize, (r18) * unsigned cnt) (r19) @@ -52,9 +52,9 @@ .set noat .text .align 3 - .globl mpihelp_lshift - .ent mpihelp_lshift -mpihelp_lshift: + .globl _gcry_mpih_lshift + .ent _gcry_mpih_lshift +_gcry_mpih_lshift: .frame $30,0,$26,0 s8addq $18,$17,$17 # make r17 point at end of s1 @@ -118,6 +118,6 @@ mpihelp_lshift: .Lend: sll $4,$19,$8 stq $8,-8($16) ret $31,($26),1 - .end mpihelp_lshift + .end _gcry_mpih_lshift diff --git a/mpi/alpha/mpih-mul1.S b/mpi/alpha/mpih-mul1.S index e62ccbdb..679d912e 100644 --- a/mpi/alpha/mpih-mul1.S +++ b/mpi/alpha/mpih-mul1.S @@ -24,7 +24,7 @@ /******************* * mpi_limb_t - * mpihelp_mul_1( mpi_ptr_t res_ptr, (r16) + * _gcry_mpih_mul_1( mpi_ptr_t res_ptr, (r16) * mpi_ptr_t s1_ptr, (r17) * mpi_size_t s1_size, (r18) * mpi_limb_t s2_limb) (r19) @@ -45,9 +45,9 @@ .set noat .text .align 3 - .globl mpihelp_mul_1 - .ent mpihelp_mul_1 2 -mpihelp_mul_1: + .globl _gcry_mpih_mul_1 + .ent _gcry_mpih_mul_1 2 +_gcry_mpih_mul_1: .frame $30,0,$26 ldq $2,0($17) # $2 = s1_limb @@ -85,6 +85,6 @@ Lend2: mulq $2,$19,$3 # $3 = prod_low Lend1: stq $3,0($16) ret $31,($26),1 - .end mpihelp_mul_1 + .end _gcry_mpih_mul_1 diff --git a/mpi/alpha/mpih-mul2.S b/mpi/alpha/mpih-mul2.S index 595af99d..b64f5819 100644 --- a/mpi/alpha/mpih-mul2.S +++ b/mpi/alpha/mpih-mul2.S @@ -24,7 +24,7 @@ /******************* * mpi_limb_t - * mpihelp_addmul_1( mpi_ptr_t res_ptr, (r16) + * _gcry_mpih_addmul_1( mpi_ptr_t res_ptr, (r16) * mpi_ptr_t s1_ptr, (r17) * mpi_size_t s1_size, (r18) * mpi_limb_t s2_limb) (r19) @@ -37,9 +37,9 @@ .set noat .text .align 3 - .globl mpihelp_addmul_1 - .ent mpihelp_addmul_1 2 -mpihelp_addmul_1: + .globl _gcry_mpih_addmul_1 + .ent _gcry_mpih_addmul_1 2 +_gcry_mpih_addmul_1: .frame $30,0,$26 ldq $2,0($17) # $2 = s1_limb @@ -93,5 +93,5 @@ mpihelp_addmul_1: addq $0,$5,$0 ret $31,($26),1 - .end mpihelp_addmul_1 + .end _gcry_mpih_addmul_1 diff --git a/mpi/alpha/mpih-mul3.S b/mpi/alpha/mpih-mul3.S index fa3df92a..f6d80f22 100644 --- a/mpi/alpha/mpih-mul3.S +++ b/mpi/alpha/mpih-mul3.S @@ -23,7 +23,7 @@ /******************* * mpi_limb_t - * mpihelp_submul_1( mpi_ptr_t res_ptr, (r16 ) + * _gcry_mpih_submul_1( mpi_ptr_t res_ptr, (r16 ) * mpi_ptr_t s1_ptr, (r17 ) * mpi_size_t s1_size, (r18 ) * mpi_limb_t s2_limb) (r19 ) @@ -35,9 +35,9 @@ .set noat .text .align 3 - .globl mpihelp_submul_1 - .ent mpihelp_submul_1 2 -mpihelp_submul_1: + .globl _gcry_mpih_submul_1 + .ent _gcry_mpih_submul_1 2 +_gcry_mpih_submul_1: .frame $30,0,$26 ldq $2,0($17) # $2 = s1_limb @@ -91,5 +91,5 @@ mpihelp_submul_1: addq $0,$5,$0 ret $31,($26),1 - .end mpihelp_submul_1 + .end _gcry_mpih_submul_1 diff --git a/mpi/alpha/mpih-rshift.S b/mpi/alpha/mpih-rshift.S index e15542de..8396b3cc 100644 --- a/mpi/alpha/mpih-rshift.S +++ b/mpi/alpha/mpih-rshift.S @@ -32,7 +32,7 @@ /******************* * mpi_limb_t - * mpihelp_rshift( mpi_ptr_t wp, (r16) + * _gcry_mpih_rshift( mpi_ptr_t wp, (r16) * mpi_ptr_t up, (r17) * mpi_size_t usize, (r18) * unsigned cnt) (r19) @@ -52,9 +52,9 @@ .set noat .text .align 3 - .globl mpihelp_rshift - .ent mpihelp_rshift -mpihelp_rshift: + .globl _gcry_mpih_rshift + .ent _gcry_mpih_rshift +_gcry_mpih_rshift: .frame $30,0,$26,0 ldq $4,0($17) # load first limb @@ -116,5 +116,5 @@ mpihelp_rshift: .Rend: srl $4,$19,$8 stq $8,0($16) ret $31,($26),1 - .end mpihelp_rshift + .end _gcry_mpih_rshift diff --git a/mpi/alpha/mpih-sub1.S b/mpi/alpha/mpih-sub1.S index a32b470e..f245e5ce 100644 --- a/mpi/alpha/mpih-sub1.S +++ b/mpi/alpha/mpih-sub1.S @@ -23,7 +23,7 @@ /******************* * mpi_limb_t - * mpihelp_sub_n( mpi_ptr_t res_ptr, (r16) + * _gcry_mpih_sub_n( mpi_ptr_t res_ptr, (r16) * mpi_ptr_t s1_ptr, (r17) * mpi_ptr_t s2_ptr, (r18) * mpi_size_t size) (r19) @@ -33,9 +33,9 @@ .set noat .text .align 3 - .globl mpihelp_sub_n - .ent mpihelp_sub_n -mpihelp_sub_n: + .globl _gcry_mpih_sub_n + .ent _gcry_mpih_sub_n +_gcry_mpih_sub_n: .frame $30,0,$26,0 ldq $3,0($17) @@ -119,6 +119,6 @@ mpihelp_sub_n: or $0,$1,$0 ret $31,($26),1 - .end mpihelp_sub_n + .end _gcry_mpih_sub_n diff --git a/mpi/generic/mpih-add1.c b/mpi/generic/mpih-add1.c index d9c3cbb6..9d6c4b6e 100644 --- a/mpi/generic/mpih-add1.c +++ b/mpi/generic/mpih-add1.c @@ -34,7 +34,7 @@ #include "longlong.h" mpi_limb_t -mpihelp_add_n( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, +_gcry_mpih_add_n( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_ptr_t s2_ptr, mpi_size_t size) { mpi_limb_t x, y, cy; diff --git a/mpi/generic/mpih-lshift.c b/mpi/generic/mpih-lshift.c index fba8c052..ed8d4033 100644 --- a/mpi/generic/mpih-lshift.c +++ b/mpi/generic/mpih-lshift.c @@ -41,7 +41,7 @@ */ mpi_limb_t -mpihelp_lshift( mpi_ptr_t wp, mpi_ptr_t up, mpi_size_t usize, +_gcry_mpih_lshift( mpi_ptr_t wp, mpi_ptr_t up, mpi_size_t usize, unsigned int cnt) { mpi_limb_t high_limb, low_limb; diff --git a/mpi/generic/mpih-mul1.c b/mpi/generic/mpih-mul1.c index 83a81add..61ecacb2 100644 --- a/mpi/generic/mpih-mul1.c +++ b/mpi/generic/mpih-mul1.c @@ -33,7 +33,7 @@ #include "longlong.h" mpi_limb_t -mpihelp_mul_1( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size, +_gcry_mpih_mul_1( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size, mpi_limb_t s2_limb) { mpi_limb_t cy_limb; diff --git a/mpi/generic/mpih-mul2.c b/mpi/generic/mpih-mul2.c index ff8f998f..4511b42b 100644 --- a/mpi/generic/mpih-mul2.c +++ b/mpi/generic/mpih-mul2.c @@ -34,7 +34,7 @@ mpi_limb_t -mpihelp_addmul_1( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, +_gcry_mpih_addmul_1( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size, mpi_limb_t s2_limb) { mpi_limb_t cy_limb; diff --git a/mpi/generic/mpih-mul3.c b/mpi/generic/mpih-mul3.c index 80eedcc4..76b73190 100644 --- a/mpi/generic/mpih-mul3.c +++ b/mpi/generic/mpih-mul3.c @@ -34,7 +34,7 @@ mpi_limb_t -mpihelp_submul_1( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, +_gcry_mpih_submul_1( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size, mpi_limb_t s2_limb) { mpi_limb_t cy_limb; diff --git a/mpi/generic/mpih-rshift.c b/mpi/generic/mpih-rshift.c index be73adfb..142dadb4 100644 --- a/mpi/generic/mpih-rshift.c +++ b/mpi/generic/mpih-rshift.c @@ -43,7 +43,7 @@ */ mpi_limb_t -mpihelp_rshift( mpi_ptr_t wp, mpi_ptr_t up, mpi_size_t usize, unsigned cnt) +_gcry_mpih_rshift( mpi_ptr_t wp, mpi_ptr_t up, mpi_size_t usize, unsigned cnt) { mpi_limb_t high_limb, low_limb; unsigned sh_1, sh_2; diff --git a/mpi/generic/mpih-sub1.c b/mpi/generic/mpih-sub1.c index c618fee4..cd3828c0 100644 --- a/mpi/generic/mpih-sub1.c +++ b/mpi/generic/mpih-sub1.c @@ -33,7 +33,7 @@ #include "longlong.h" mpi_limb_t -mpihelp_sub_n( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, +_gcry_mpih_sub_n( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_ptr_t s2_ptr, mpi_size_t size) { mpi_limb_t x, y, cy; diff --git a/mpi/hppa/mpih-add1.S b/mpi/hppa/mpih-add1.S index 7a2a2c2c..af2981c5 100644 --- a/mpi/hppa/mpih-add1.S +++ b/mpi/hppa/mpih-add1.S @@ -33,7 +33,7 @@ /******************* * mpi_limb_t - * mpihelp_add_n( mpi_ptr_t res_ptr, (gr26) + * _gcry_mpih_add_n( mpi_ptr_t res_ptr, (gr26) * mpi_ptr_t s1_ptr, (gr25) * mpi_ptr_t s2_ptr, (gr24) * mpi_size_t size) (gr23) @@ -44,8 +44,8 @@ */ .code - .export mpihelp_add_n - .label mpihelp_add_n + .export _gcry_mpih_add_n + .label _gcry_mpih_add_n .proc .callinfo frame=0,no_calls .entry diff --git a/mpi/hppa/mpih-lshift.S b/mpi/hppa/mpih-lshift.S index 6a8b2c4c..cec0554c 100644 --- a/mpi/hppa/mpih-lshift.S +++ b/mpi/hppa/mpih-lshift.S @@ -24,15 +24,15 @@ /******************* * mpi_limb_t - * mpihelp_lshift( mpi_ptr_t wp, (gr26) + * _gcry_mpih_lshift( mpi_ptr_t wp, (gr26) * mpi_ptr_t up, (gr25) * mpi_size_t usize, (gr24) * unsigned cnt) (gr23) */ .code - .export mpihelp_lshift - .label mpihelp_lshift + .export _gcry_mpih_lshift + .label _gcry_mpih_lshift .proc .callinfo frame=64,no_calls .entry diff --git a/mpi/hppa/mpih-rshift.S b/mpi/hppa/mpih-rshift.S index b1e6a679..ec020fc4 100644 --- a/mpi/hppa/mpih-rshift.S +++ b/mpi/hppa/mpih-rshift.S @@ -25,15 +25,15 @@ /******************* * mpi_limb_t - * mpihelp_rshift( mpi_ptr_t wp, (gr26) + * _gcry_mpih_rshift( mpi_ptr_t wp, (gr26) * mpi_ptr_t up, (gr25) * mpi_size_t usize, (gr24) * unsigned cnt) (gr23) */ .code - .export mpihelp_rshift - .label mpihelp_rshift + .export _gcry_mpih_rshift + .label _gcry_mpih_rshift .proc .callinfo frame=64,no_calls .entry diff --git a/mpi/hppa/mpih-sub1.S b/mpi/hppa/mpih-sub1.S index 870009e9..6ea1049a 100644 --- a/mpi/hppa/mpih-sub1.S +++ b/mpi/hppa/mpih-sub1.S @@ -36,7 +36,7 @@ /******************* * mpi_limb_t - * mpihelp_sub_n( mpi_ptr_t res_ptr, (gr26) + * _gcry_mpih_sub_n( mpi_ptr_t res_ptr, (gr26) * mpi_ptr_t s1_ptr, (gr25) * mpi_ptr_t s2_ptr, (gr24) * mpi_size_t size) (gr23) @@ -48,8 +48,8 @@ .code - .export mpihelp_sub_n - .label mpihelp_sub_n + .export _gcry_mpih_sub_n + .label _gcry_mpih_sub_n .proc .callinfo frame=0,no_calls .entry diff --git a/mpi/hppa1.1/mpih-mul1.S b/mpi/hppa1.1/mpih-mul1.S index ac9baced..b082ab16 100644 --- a/mpi/hppa1.1/mpih-mul1.S +++ b/mpi/hppa1.1/mpih-mul1.S @@ -32,7 +32,7 @@ /******************* * mpi_limb_t - * mpihelp_mul_1( mpi_ptr_t res_ptr, (r26) + * _gcry_mpih_mul_1( mpi_ptr_t res_ptr, (r26) * mpi_ptr_t s1_ptr, (r25) * mpi_size_t s1_size, (r24) * mpi_limb_t s2_limb) (r23) @@ -58,8 +58,8 @@ */ .code - .export mpihelp_mul_1 - .label mpihelp_mul_1 + .export _gcry_mpih_mul_1 + .label _gcry_mpih_mul_1 .proc .callinfo frame=64,no_calls .entry diff --git a/mpi/hppa1.1/mpih-mul2.S b/mpi/hppa1.1/mpih-mul2.S index c73397e3..6a5ba5b8 100644 --- a/mpi/hppa1.1/mpih-mul2.S +++ b/mpi/hppa1.1/mpih-mul2.S @@ -32,7 +32,7 @@ /******************* * mpi_limb_t - * mpihelp_addmul_1( mpi_ptr_t res_ptr, (r26) + * _gcry_mpih_addmul_1( mpi_ptr_t res_ptr, (r26) * mpi_ptr_t s1_ptr, (r25) * mpi_size_t s1_size, (r24) * mpi_limb_t s2_limb) (r23) @@ -48,8 +48,8 @@ */ .code - .export mpihelp_addmul_1 - .label mpihelp_addmul_1 + .export _gcry_mpih_addmul_1 + .label _gcry_mpih_addmul_1 .proc .callinfo frame=64,no_calls .entry diff --git a/mpi/hppa1.1/mpih-mul3.S b/mpi/hppa1.1/mpih-mul3.S index f9ccb1b5..61bbd2e0 100644 --- a/mpi/hppa1.1/mpih-mul3.S +++ b/mpi/hppa1.1/mpih-mul3.S @@ -32,7 +32,7 @@ /******************* * mpi_limb_t - * mpihelp_submul_1( mpi_ptr_t res_ptr, (r26) + * _gcry_mpih_submul_1( mpi_ptr_t res_ptr, (r26) * mpi_ptr_t s1_ptr, (r25) * mpi_size_t s1_size, (r24) * mpi_limb_t s2_limb) (r23) @@ -55,8 +55,8 @@ .code - .export mpihelp_submul_1 - .label mpihelp_submul_1 + .export _gcry_mpih_submul_1 + .label _gcry_mpih_submul_1 .proc .callinfo frame=64,no_calls .entry diff --git a/mpi/i386/mpih-add1.S b/mpi/i386/mpih-add1.S index 3b3b23c8..7bc1a1bf 100644 --- a/mpi/i386/mpih-add1.S +++ b/mpi/i386/mpih-add1.S @@ -36,7 +36,7 @@ /******************* * mpi_limb_t - * mpihelp_add_n( mpi_ptr_t res_ptr, (sp + 4) + * _gcry_mpih_add_n( mpi_ptr_t res_ptr, (sp + 4) * mpi_ptr_t s1_ptr, (sp + 8) * mpi_ptr_t s2_ptr, (sp + 12) * mpi_size_t size) (sp + 16) @@ -44,8 +44,8 @@ .text ALIGN (3) - .globl C_SYMBOL_NAME(mpihelp_add_n) -C_SYMBOL_NAME(mpihelp_add_n:) + .globl C_SYMBOL_NAME(_gcry_mpih_add_n) +C_SYMBOL_NAME(_gcry_mpih_add_n:) pushl %edi pushl %esi diff --git a/mpi/i386/mpih-lshift.S b/mpi/i386/mpih-lshift.S index 5e6387a4..fdca0252 100644 --- a/mpi/i386/mpih-lshift.S +++ b/mpi/i386/mpih-lshift.S @@ -34,7 +34,7 @@ /******************* * mpi_limb_t - * mpihelp_lshift( mpi_ptr_t wp, (sp + 4) + * _gcry_mpih_lshift( mpi_ptr_t wp, (sp + 4) * mpi_ptr_t up, (sp + 8) * mpi_size_t usize, (sp + 12) * unsigned cnt) (sp + 16) @@ -42,8 +42,8 @@ .text ALIGN (3) - .globl C_SYMBOL_NAME(mpihelp_lshift) -C_SYMBOL_NAME(mpihelp_lshift:) + .globl C_SYMBOL_NAME(_gcry_mpih_lshift) +C_SYMBOL_NAME(_gcry_mpih_lshift:) pushl %edi pushl %esi pushl %ebx diff --git a/mpi/i386/mpih-mul1.S b/mpi/i386/mpih-mul1.S index cf87046f..2a4426a9 100644 --- a/mpi/i386/mpih-mul1.S +++ b/mpi/i386/mpih-mul1.S @@ -35,7 +35,7 @@ /******************* * mpi_limb_t - * mpihelp_mul_1( mpi_ptr_t res_ptr, (sp + 4) + * _gcry_mpih_mul_1( mpi_ptr_t res_ptr, (sp + 4) * mpi_ptr_t s1_ptr, (sp + 8) * mpi_size_t s1_size, (sp + 12) * mpi_limb_t s2_limb) (sp + 16) @@ -48,8 +48,8 @@ TEXT ALIGN (3) - GLOBL C_SYMBOL_NAME(mpihelp_mul_1) -C_SYMBOL_NAME(mpihelp_mul_1:) + GLOBL C_SYMBOL_NAME(_gcry_mpih_mul_1) +C_SYMBOL_NAME(_gcry_mpih_mul_1:) INSN1(push,l ,R(edi)) INSN1(push,l ,R(esi)) diff --git a/mpi/i386/mpih-mul2.S b/mpi/i386/mpih-mul2.S index f134af70..842a5edb 100644 --- a/mpi/i386/mpih-mul2.S +++ b/mpi/i386/mpih-mul2.S @@ -36,7 +36,7 @@ /******************* * mpi_limb_t - * mpihelp_addmul_1( mpi_ptr_t res_ptr, (sp + 4) + * _gcry_mpih_addmul_1( mpi_ptr_t res_ptr, (sp + 4) * mpi_ptr_t s1_ptr, (sp + 8) * mpi_size_t s1_size, (sp + 12) * mpi_limb_t s2_limb) (sp + 16) @@ -49,8 +49,8 @@ TEXT ALIGN (3) - GLOBL C_SYMBOL_NAME(mpihelp_addmul_1) -C_SYMBOL_NAME(mpihelp_addmul_1:) + GLOBL C_SYMBOL_NAME(_gcry_mpih_addmul_1) +C_SYMBOL_NAME(_gcry_mpih_addmul_1:) INSN1(push,l ,R(edi)) INSN1(push,l ,R(esi)) diff --git a/mpi/i386/mpih-mul3.S b/mpi/i386/mpih-mul3.S index 2907ed03..8e091e04 100644 --- a/mpi/i386/mpih-mul3.S +++ b/mpi/i386/mpih-mul3.S @@ -36,7 +36,7 @@ /******************* * mpi_limb_t - * mpihelp_submul_1( mpi_ptr_t res_ptr, (sp + 4) + * _gcry_mpih_submul_1( mpi_ptr_t res_ptr, (sp + 4) * mpi_ptr_t s1_ptr, (sp + 8) * mpi_size_t s1_size, (sp + 12) * mpi_limb_t s2_limb) (sp + 16) @@ -49,8 +49,8 @@ TEXT ALIGN (3) - GLOBL C_SYMBOL_NAME(mpihelp_submul_1) -C_SYMBOL_NAME(mpihelp_submul_1:) + GLOBL C_SYMBOL_NAME(_gcry_mpih_submul_1) +C_SYMBOL_NAME(_gcry_mpih_submul_1:) INSN1(push,l ,R(edi)) INSN1(push,l ,R(esi)) diff --git a/mpi/i386/mpih-rshift.S b/mpi/i386/mpih-rshift.S index 9718204c..9d5e4ac9 100644 --- a/mpi/i386/mpih-rshift.S +++ b/mpi/i386/mpih-rshift.S @@ -35,7 +35,7 @@ /******************* * mpi_limb_t - * mpihelp_rshift( mpi_ptr_t wp, (sp + 4) + * _gcry_mpih_rshift( mpi_ptr_t wp, (sp + 4) * mpi_ptr_t up, (sp + 8) * mpi_size_t usize, (sp + 12) * unsigned cnt) (sp + 16) @@ -43,8 +43,8 @@ .text ALIGN (3) - .globl C_SYMBOL_NAME(mpihelp_rshift) -C_SYMBOL_NAME(mpihelp_rshift:) + .globl C_SYMBOL_NAME(_gcry_mpih_rshift) +C_SYMBOL_NAME(_gcry_mpih_rshift:) pushl %edi pushl %esi pushl %ebx diff --git a/mpi/i386/mpih-sub1.S b/mpi/i386/mpih-sub1.S index 169c5395..28e1fa09 100644 --- a/mpi/i386/mpih-sub1.S +++ b/mpi/i386/mpih-sub1.S @@ -36,7 +36,7 @@ /******************* * mpi_limb_t - * mpihelp_sub_n( mpi_ptr_t res_ptr, (sp + 4) + * _gcry_mpih_sub_n( mpi_ptr_t res_ptr, (sp + 4) * mpi_ptr_t s1_ptr, (sp + 8) * mpi_ptr_t s2_ptr, (sp + 12) * mpi_size_t size) (sp + 16) @@ -45,8 +45,8 @@ .text ALIGN (3) - .globl C_SYMBOL_NAME(mpihelp_sub_n) -C_SYMBOL_NAME(mpihelp_sub_n:) + .globl C_SYMBOL_NAME(_gcry_mpih_sub_n) +C_SYMBOL_NAME(_gcry_mpih_sub_n:) pushl %edi pushl %esi diff --git a/mpi/i586/mpih-add1.S b/mpi/i586/mpih-add1.S index 248b0c0b..cca32d91 100644 --- a/mpi/i586/mpih-add1.S +++ b/mpi/i586/mpih-add1.S @@ -28,7 +28,7 @@ /******************* * mpi_limb_t - * mpihelp_add_n( mpi_ptr_t res_ptr, (sp + 4) + * _gcry_mpih_add_n( mpi_ptr_t res_ptr, (sp + 4) * mpi_ptr_t s1_ptr, (sp + 8) * mpi_ptr_t s2_ptr, (sp + 12) * mpi_size_t size) (sp + 16) @@ -36,8 +36,8 @@ .text ALIGN (3) - .globl C_SYMBOL_NAME(mpihelp_add_n) -C_SYMBOL_NAME(mpihelp_add_n:) + .globl C_SYMBOL_NAME(_gcry_mpih_add_n) +C_SYMBOL_NAME(_gcry_mpih_add_n:) pushl %edi pushl %esi pushl %ebx diff --git a/mpi/i586/mpih-lshift.S b/mpi/i586/mpih-lshift.S index ed040912..dcdb4b06 100644 --- a/mpi/i586/mpih-lshift.S +++ b/mpi/i586/mpih-lshift.S @@ -35,7 +35,7 @@ /******************* * mpi_limb_t - * mpihelp_lshift( mpi_ptr_t wp, (sp + 4) + * _gcry_mpih_lshift( mpi_ptr_t wp, (sp + 4) * mpi_ptr_t up, (sp + 8) * mpi_size_t usize, (sp + 12) * unsigned cnt) (sp + 16) @@ -43,8 +43,8 @@ .text ALIGN (3) - .globl C_SYMBOL_NAME(mpihelp_lshift) -C_SYMBOL_NAME(mpihelp_lshift:) + .globl C_SYMBOL_NAME(_gcry_mpih_lshift) +C_SYMBOL_NAME(_gcry_mpih_lshift:) pushl %edi pushl %esi diff --git a/mpi/i586/mpih-mul1.S b/mpi/i586/mpih-mul1.S index 42bcde6b..ea85320b 100644 --- a/mpi/i586/mpih-mul1.S +++ b/mpi/i586/mpih-mul1.S @@ -36,7 +36,7 @@ /******************* * mpi_limb_t - * mpihelp_mul_1( mpi_ptr_t res_ptr, (sp + 4) + * _gcry_mpih_mul_1( mpi_ptr_t res_ptr, (sp + 4) * mpi_ptr_t s1_ptr, (sp + 8) * mpi_size_t s1_size, (sp + 12) * mpi_limb_t s2_limb) (sp + 16) @@ -49,8 +49,8 @@ TEXT ALIGN (3) - GLOBL C_SYMBOL_NAME(mpihelp_mul_1) -C_SYMBOL_NAME(mpihelp_mul_1:) + GLOBL C_SYMBOL_NAME(_gcry_mpih_mul_1) +C_SYMBOL_NAME(_gcry_mpih_mul_1:) INSN1(push,l ,R(edi)) INSN1(push,l ,R(esi)) diff --git a/mpi/i586/mpih-mul2.S b/mpi/i586/mpih-mul2.S index 54c5df96..4253ad77 100644 --- a/mpi/i586/mpih-mul2.S +++ b/mpi/i586/mpih-mul2.S @@ -36,7 +36,7 @@ /******************* * mpi_limb_t - * mpihelp_addmul_1( mpi_ptr_t res_ptr, (sp + 4) + * _gcry_mpih_addmul_1( mpi_ptr_t res_ptr, (sp + 4) * mpi_ptr_t s1_ptr, (sp + 8) * mpi_size_t s1_size, (sp + 12) * mpi_limb_t s2_limb) (sp + 16) @@ -49,8 +49,8 @@ TEXT ALIGN (3) - GLOBL C_SYMBOL_NAME(mpihelp_addmul_1) -C_SYMBOL_NAME(mpihelp_addmul_1:) + GLOBL C_SYMBOL_NAME(_gcry_mpih_addmul_1) +C_SYMBOL_NAME(_gcry_mpih_addmul_1:) INSN1(push,l ,R(edi)) INSN1(push,l ,R(esi)) diff --git a/mpi/i586/mpih-mul3.S b/mpi/i586/mpih-mul3.S index 0d61ff26..3f86d708 100644 --- a/mpi/i586/mpih-mul3.S +++ b/mpi/i586/mpih-mul3.S @@ -36,7 +36,7 @@ /******************* * mpi_limb_t - * mpihelp_submul_1( mpi_ptr_t res_ptr, (sp + 4) + * _gcry_mpih_submul_1( mpi_ptr_t res_ptr, (sp + 4) * mpi_ptr_t s1_ptr, (sp + 8) * mpi_size_t s1_size, (sp + 12) * mpi_limb_t s2_limb) (sp + 16) @@ -49,8 +49,8 @@ TEXT ALIGN (3) - GLOBL C_SYMBOL_NAME(mpihelp_submul_1) -C_SYMBOL_NAME(mpihelp_submul_1:) + GLOBL C_SYMBOL_NAME(_gcry_mpih_submul_1) +C_SYMBOL_NAME(_gcry_mpih_submul_1:) INSN1(push,l ,R(edi)) INSN1(push,l ,R(esi)) diff --git a/mpi/i586/mpih-rshift.S b/mpi/i586/mpih-rshift.S index 2e331621..3b1e8f47 100644 --- a/mpi/i586/mpih-rshift.S +++ b/mpi/i586/mpih-rshift.S @@ -36,7 +36,7 @@ /******************* * mpi_limb_t - * mpihelp_rshift( mpi_ptr_t wp, (sp + 4) + * _gcry_mpih_rshift( mpi_ptr_t wp, (sp + 4) * mpi_ptr_t up, (sp + 8) * mpi_size_t usize, (sp + 12) * unsigned cnt) (sp + 16) @@ -44,8 +44,8 @@ .text ALIGN (3) - .globl C_SYMBOL_NAME(mpihelp_rshift) -C_SYMBOL_NAME(mpihelp_rshift:) + .globl C_SYMBOL_NAME(_gcry_mpih_rshift) +C_SYMBOL_NAME(_gcry_mpih_rshift:) pushl %edi pushl %esi pushl %ebx diff --git a/mpi/i586/mpih-sub1.S b/mpi/i586/mpih-sub1.S index a54be0e9..0c4838bd 100644 --- a/mpi/i586/mpih-sub1.S +++ b/mpi/i586/mpih-sub1.S @@ -36,7 +36,7 @@ /******************* * mpi_limb_t - * mpihelp_sub_n( mpi_ptr_t res_ptr, (sp + 4) + * _gcry_mpih_sub_n( mpi_ptr_t res_ptr, (sp + 4) * mpi_ptr_t s1_ptr, (sp + 8) * mpi_ptr_t s2_ptr, (sp + 12) * mpi_size_t size) (sp + 16) @@ -45,8 +45,8 @@ .text ALIGN (3) - .globl C_SYMBOL_NAME(mpihelp_sub_n) -C_SYMBOL_NAME(mpihelp_sub_n:) + .globl C_SYMBOL_NAME(_gcry_mpih_sub_n) +C_SYMBOL_NAME(_gcry_mpih_sub_n:) pushl %edi pushl %esi diff --git a/mpi/m68k/mc68020/mpih-mul1.S b/mpi/m68k/mc68020/mpih-mul1.S index 4872b9ba..b4181a9c 100644 --- a/mpi/m68k/mc68020/mpih-mul1.S +++ b/mpi/m68k/mc68020/mpih-mul1.S @@ -37,7 +37,7 @@ /******************* * mpi_limb_t - * mpihelp_mul_1( mpi_ptr_t res_ptr, (sp + 4) + * _gcry_mpih_mul_1( mpi_ptr_t res_ptr, (sp + 4) * mpi_ptr_t s1_ptr, (sp + 8) * mpi_size_t s1_size, (sp + 12) * mpi_limb_t s2_limb) (sp + 16) @@ -46,10 +46,10 @@ TEXT ALIGN - GLOBL C_SYMBOL_NAME(mpihelp_mul_1) + GLOBL C_SYMBOL_NAME(_gcry_mpih_mul_1) -C_SYMBOL_NAME(mpihelp_mul_1:) -PROLOG(mpihelp_mul_1) +C_SYMBOL_NAME(_gcry_mpih_mul_1:) +PROLOG(_gcry_mpih_mul_1) #define res_ptr a0 #define s1_ptr a1 @@ -101,6 +101,6 @@ L(L1:) movel MEM_POSTINC(s1_ptr),R(d3) movel MEM_POSTINC(sp),R(d2) #endif rts -EPILOG(mpihelp_mul_1) +EPILOG(_gcry_mpih_mul_1) diff --git a/mpi/m68k/mc68020/mpih-mul2.S b/mpi/m68k/mc68020/mpih-mul2.S index 7c492ffb..b2f9e7cc 100644 --- a/mpi/m68k/mc68020/mpih-mul2.S +++ b/mpi/m68k/mc68020/mpih-mul2.S @@ -35,7 +35,7 @@ /******************* * mpi_limb_t - * mpihelp_addmul_1( mpi_ptr_t res_ptr, (sp + 4) + * _gcry_mpih_addmul_1( mpi_ptr_t res_ptr, (sp + 4) * mpi_ptr_t s1_ptr, (sp + 8) * mpi_size_t s1_size, (sp + 12) * mpi_limb_t s2_limb) (sp + 16) @@ -44,10 +44,10 @@ TEXT ALIGN - GLOBL C_SYMBOL_NAME(mpihelp_addmul_1) + GLOBL C_SYMBOL_NAME(_gcry_mpih_addmul_1) -C_SYMBOL_NAME(mpihelp_addmul_1:) -PROLOG(mpihelp_addmul_1) +C_SYMBOL_NAME(_gcry_mpih_addmul_1:) +PROLOG(_gcry_mpih_addmul_1) #define res_ptr a0 #define s1_ptr a1 @@ -92,5 +92,5 @@ L(L1:) movel MEM_POSTINC(s1_ptr),R(d3) moveml MEM_POSTINC(sp),R(d2)-R(d5) rts -EPILOG(mpihelp_addmul_1) +EPILOG(_gcry_mpih_addmul_1) diff --git a/mpi/m68k/mc68020/mpih-mul3.S b/mpi/m68k/mc68020/mpih-mul3.S index 1e4ac45d..f72a8120 100644 --- a/mpi/m68k/mc68020/mpih-mul3.S +++ b/mpi/m68k/mc68020/mpih-mul3.S @@ -37,7 +37,7 @@ /******************* * mpi_limb_t - * mpihelp_submul_1( mpi_ptr_t res_ptr, (sp + 4) + * _gcry_mpih_submul_1( mpi_ptr_t res_ptr, (sp + 4) * mpi_ptr_t s1_ptr, (sp + 8) * mpi_size_t s1_size, (sp + 12) * mpi_limb_t s2_limb) (sp + 16) @@ -46,10 +46,10 @@ TEXT ALIGN - GLOBL C_SYMBOL_NAME(mpihelp_submul_1) + GLOBL C_SYMBOL_NAME(_gcry_mpih_submul_1) -C_SYMBOL_NAME(mpihelp_submul_1:) -PROLOG(mpihelp_submul_1) +C_SYMBOL_NAME(_gcry_mpih_submul_1:) +PROLOG(_gcry_mpih_submul_1) #define res_ptr a0 #define s1_ptr a1 @@ -94,6 +94,6 @@ L(L1:) movel MEM_POSTINC(s1_ptr),R(d3) moveml MEM_POSTINC(sp),R(d2)-R(d5) rts -EPILOG(mpihelp_submul_1) +EPILOG(_gcry_mpih_submul_1) diff --git a/mpi/m68k/mpih-add1.S b/mpi/m68k/mpih-add1.S index 1e9cc640..e05f89cd 100644 --- a/mpi/m68k/mpih-add1.S +++ b/mpi/m68k/mpih-add1.S @@ -36,7 +36,7 @@ /******************* * mpi_limb_t - * mpihelp_add_n( mpi_ptr_t res_ptr, (sp + 4) + * _gcry_mpih_add_n( mpi_ptr_t res_ptr, (sp + 4) * mpi_ptr_t s1_ptr, (sp + 8) * mpi_ptr_t s2_ptr, (sp + 16) * mpi_size_t size) (sp + 12) @@ -45,10 +45,10 @@ TEXT ALIGN - GLOBL C_SYMBOL_NAME(mpihelp_add_n) + GLOBL C_SYMBOL_NAME(_gcry_mpih_add_n) -C_SYMBOL_NAME(mpihelp_add_n:) -PROLOG(mpihelp_add_n) +C_SYMBOL_NAME(_gcry_mpih_add_n:) +PROLOG(_gcry_mpih_add_n) /* Save used registers on the stack. */ movel R(d2),MEM_PREDEC(sp) movel R(a2),MEM_PREDEC(sp) @@ -89,6 +89,6 @@ L(L2:) movel MEM_POSTINC(sp),R(d2) rts -EPILOG(mpihelp_add_n) +EPILOG(_gcry_mpih_add_n) diff --git a/mpi/m68k/mpih-lshift.S b/mpi/m68k/mpih-lshift.S index cc9dfba6..c7e485a4 100644 --- a/mpi/m68k/mpih-lshift.S +++ b/mpi/m68k/mpih-lshift.S @@ -34,7 +34,7 @@ /******************* * mpi_limb_t - * mpihelp_lshift( mpi_ptr_t wp, (sp + 4) + * _gcry_mpih_lshift( mpi_ptr_t wp, (sp + 4) * mpi_ptr_t up, (sp + 8) * mpi_size_t usize, (sp + 12) * unsigned cnt) (sp + 16) @@ -47,10 +47,10 @@ TEXT ALIGN - GLOBL C_SYMBOL_NAME(mpihelp_lshift) + GLOBL C_SYMBOL_NAME(_gcry_mpih_lshift) -C_SYMBOL_NAME(mpihelp_lshift:) -PROLOG(mpihelp_lshift) +C_SYMBOL_NAME(_gcry_mpih_lshift:) +PROLOG(_gcry_mpih_lshift) /* Save used registers on the stack. */ moveml R(d2)-R(d6)/R(a2),MEM_PREDEC(sp) @@ -158,7 +158,7 @@ L(LLend:) /* Restore used registers from stack frame. */ moveml MEM_POSTINC(sp),R(d2)-R(d6)/R(a2) rts -EPILOG(mpihelp_lshift) +EPILOG(_gcry_mpih_lshift) diff --git a/mpi/m68k/mpih-rshift.S b/mpi/m68k/mpih-rshift.S index cc86166a..d9be3e0d 100644 --- a/mpi/m68k/mpih-rshift.S +++ b/mpi/m68k/mpih-rshift.S @@ -34,7 +34,7 @@ /******************* * mpi_limb_t - * mpihelp_rshift( mpi_ptr_t wp, (sp + 4) + * _gcry_mpih_rshift( mpi_ptr_t wp, (sp + 4) * mpi_ptr_t up, (sp + 8) * mpi_size_t usize, (sp + 12) * unsigned cnt) (sp + 16) @@ -47,10 +47,10 @@ TEXT ALIGN - GLOBL C_SYMBOL_NAME(mpihelp_rshift) + GLOBL C_SYMBOL_NAME(_gcry_mpih_rshift) -C_SYMBOL_NAME(mpihelp_rshift:) -PROLOG(mpihelp_rshift) +C_SYMBOL_NAME(_gcry_mpih_rshift:) +PROLOG(_gcry_mpih_rshift) /* Save used registers on the stack. */ moveml R(d2)-R(d6)/R(a2),MEM_PREDEC(sp) @@ -157,7 +157,7 @@ L(LRend:) /* Restore used registers from stack frame. */ moveml MEM_POSTINC(sp),R(d2)-R(d6)/R(a2) rts -EPILOG(mpihelp_rshift) +EPILOG(_gcry_mpih_rshift) diff --git a/mpi/m68k/mpih-sub1.S b/mpi/m68k/mpih-sub1.S index 1847fbd6..945b8d24 100644 --- a/mpi/m68k/mpih-sub1.S +++ b/mpi/m68k/mpih-sub1.S @@ -35,7 +35,7 @@ /******************* * mpi_limb_t - * mpihelp_sub_n( mpi_ptr_t res_ptr, (sp + 4) + * _gcry_mpih_sub_n( mpi_ptr_t res_ptr, (sp + 4) * mpi_ptr_t s1_ptr, (sp + 8) * mpi_ptr_t s2_ptr, (sp + 16) * mpi_size_t size) (sp + 12) @@ -44,10 +44,10 @@ TEXT ALIGN - GLOBL C_SYMBOL_NAME(mpihelp_sub_n) + GLOBL C_SYMBOL_NAME(_gcry_mpih_sub_n) -C_SYMBOL_NAME(mpihelp_sub_n:) -PROLOG(mpihelp_sub_n) +C_SYMBOL_NAME(_gcry_mpih_sub_n:) +PROLOG(_gcry_mpih_sub_n) /* Save used registers on the stack. */ movel R(d2),MEM_PREDEC(sp) movel R(a2),MEM_PREDEC(sp) @@ -88,6 +88,6 @@ L(L2:) movel MEM_POSTINC(sp),R(d2) rts -EPILOG(mpihelp_sub_n) +EPILOG(_gcry_mpih_sub_n) diff --git a/mpi/mips3/mpih-add1.S b/mpi/mips3/mpih-add1.S index a998420d..8b329240 100644 --- a/mpi/mips3/mpih-add1.S +++ b/mpi/mips3/mpih-add1.S @@ -24,7 +24,7 @@ /******************* * mpi_limb_t - * mpihelp_add_n( mpi_ptr_t res_ptr, ($4) + * _gcry_mpih_add_n( mpi_ptr_t res_ptr, ($4) * mpi_ptr_t s1_ptr, ($5) * mpi_ptr_t s2_ptr, ($6) * mpi_size_t size) ($7) @@ -32,9 +32,9 @@ .text .align 2 - .globl mpihelp_add_n - .ent mpihelp_add_n -mpihelp_add_n: + .globl _gcry_mpih_add_n + .ent _gcry_mpih_add_n +_gcry_mpih_add_n: .set noreorder .set nomacro @@ -120,5 +120,5 @@ mpihelp_add_n: j $31 or $2,$2,$8 - .end mpihelp_add_n + .end _gcry_mpih_add_n diff --git a/mpi/mips3/mpih-lshift.S b/mpi/mips3/mpih-lshift.S index 112383f9..421fe649 100644 --- a/mpi/mips3/mpih-lshift.S +++ b/mpi/mips3/mpih-lshift.S @@ -22,7 +22,7 @@ /******************* * mpi_limb_t - * mpihelp_lshift( mpi_ptr_t wp, ($4) + * _gcry_mpih_lshift( mpi_ptr_t wp, ($4) * mpi_ptr_t up, ($5) * mpi_size_t usize, ($6) * unsigned cnt) ($7) @@ -30,9 +30,9 @@ .text .align 2 - .globl mpihelp_lshift - .ent mpihelp_lshift -mpihelp_lshift: + .globl _gcry_mpih_lshift + .ent _gcry_mpih_lshift +_gcry_mpih_lshift: .set noreorder .set nomacro @@ -94,4 +94,4 @@ mpihelp_lshift: .Lend: dsll $8,$10,$7 j $31 sd $8,-8($4) - .end mpihelp_lshift + .end _gcry_mpih_lshift diff --git a/mpi/mips3/mpih-mul1.S b/mpi/mips3/mpih-mul1.S index 70409e8d..99557374 100644 --- a/mpi/mips3/mpih-mul1.S +++ b/mpi/mips3/mpih-mul1.S @@ -24,7 +24,7 @@ /******************* * mpi_limb_t - * mpihelp_mul_1( mpi_ptr_t res_ptr, (r4) + * _gcry_mpih_mul_1( mpi_ptr_t res_ptr, (r4) * mpi_ptr_t s1_ptr, (r5) * mpi_size_t s1_size, (r6) * mpi_limb_t s2_limb) (r7) @@ -32,9 +32,9 @@ .text .align 4 - .globl mpihelp_mul_1 - .ent mpihelp_mul_1 -mpihelp_mul_1: + .globl _gcry_mpih_mul_1 + .ent _gcry_mpih_mul_1 +_gcry_mpih_mul_1: .set noreorder .set nomacro @@ -85,5 +85,5 @@ $LC0: mflo $10 j $31 daddu $2,$9,$2 # add high product limb and carry from addition - .end mpihelp_mul_1 + .end _gcry_mpih_mul_1 diff --git a/mpi/mips3/mpih-mul2.S b/mpi/mips3/mpih-mul2.S index 1bddd053..a58e4446 100644 --- a/mpi/mips3/mpih-mul2.S +++ b/mpi/mips3/mpih-mul2.S @@ -24,7 +24,7 @@ /******************* * mpi_limb_t - * mpihelp_addmul_1( mpi_ptr_t res_ptr, (r4) + * _gcry_mpih_addmul_1( mpi_ptr_t res_ptr, (r4) * mpi_ptr_t s1_ptr, (r5) * mpi_size_t s1_size, (r6) * mpi_limb_t s2_limb) (r7) @@ -32,9 +32,9 @@ .text .align 4 - .globl mpihelp_addmul_1 - .ent mpihelp_addmul_1 -mpihelp_addmul_1: + .globl _gcry_mpih_addmul_1 + .ent _gcry_mpih_addmul_1 +_gcry_mpih_addmul_1: .set noreorder .set nomacro @@ -97,5 +97,5 @@ $LC0: ld $10,0($4) j $31 daddu $2,$9,$2 # add high product limb and carry from addition - .end mpihelp_addmul_1 + .end _gcry_mpih_addmul_1 diff --git a/mpi/mips3/mpih-mul3.S b/mpi/mips3/mpih-mul3.S index 82fe47d5..3410c009 100644 --- a/mpi/mips3/mpih-mul3.S +++ b/mpi/mips3/mpih-mul3.S @@ -24,7 +24,7 @@ /******************* * mpi_limb_t - * mpihelp_submul_1( mpi_ptr_t res_ptr, (r4) + * _gcry_mpih_submul_1( mpi_ptr_t res_ptr, (r4) * mpi_ptr_t s1_ptr, (r5) * mpi_size_t s1_size, (r6) * mpi_limb_t s2_limb) (r7) @@ -32,9 +32,9 @@ .text .align 4 - .globl mpihelp_submul_1 - .ent mpihelp_submul_1 -mpihelp_submul_1: + .globl _gcry_mpih_submul_1 + .ent _gcry_mpih_submul_1 +_gcry_mpih_submul_1: .set noreorder .set nomacro @@ -97,5 +97,5 @@ $LC0: ld $10,0($4) j $31 daddu $2,$9,$2 # add high product limb and carry from addition - .end mpihelp_submul_1 + .end _gcry_mpih_submul_1 diff --git a/mpi/mips3/mpih-rshift.S b/mpi/mips3/mpih-rshift.S index 74a6cc96..8b43aab5 100644 --- a/mpi/mips3/mpih-rshift.S +++ b/mpi/mips3/mpih-rshift.S @@ -22,7 +22,7 @@ /******************* * mpi_limb_t - * mpihelp_rshift( mpi_ptr_t wp, ($4) + * _gcry_mpih_rshift( mpi_ptr_t wp, ($4) * mpi_ptr_t up, ($5) * mpi_size_t usize, ($6) * unsigned cnt) ($7) @@ -30,9 +30,9 @@ .text .align 2 - .globl mpihelp_rshift - .ent mpihelp_rshift -mpihelp_rshift: + .globl _gcry_mpih_rshift + .ent _gcry_mpih_rshift +_gcry_mpih_rshift: .set noreorder .set nomacro @@ -91,5 +91,5 @@ mpihelp_rshift: .Lend: dsrl $8,$10,$7 j $31 sd $8,0($4) - .end mpihelp_rshift + .end _gcry_mpih_rshift diff --git a/mpi/mips3/mpih-sub1.S b/mpi/mips3/mpih-sub1.S index 72f506ea..5af10716 100644 --- a/mpi/mips3/mpih-sub1.S +++ b/mpi/mips3/mpih-sub1.S @@ -24,7 +24,7 @@ /******************* * mpi_limb_t - * mpihelp_sub_n( mpi_ptr_t res_ptr, (r4) + * _gcry_mpih_sub_n( mpi_ptr_t res_ptr, (r4) * mpi_ptr_t s1_ptr, (r5) * mpi_ptr_t s2_ptr, (r6) * mpi_size_t size) (r7) @@ -33,9 +33,9 @@ .text .align 2 - .globl mpihelp_sub_n - .ent mpihelp_sub_n -mpihelp_sub_n: + .globl _gcry_mpih_sub_n + .ent _gcry_mpih_sub_n +_gcry_mpih_sub_n: .set noreorder .set nomacro @@ -121,5 +121,5 @@ mpihelp_sub_n: j $31 or $2,$2,$8 - .end mpihelp_sub_n + .end _gcry_mpih_sub_n diff --git a/mpi/mpi-add.c b/mpi/mpi-add.c index 1cca9e34..cb9031b6 100644 --- a/mpi/mpi-add.c +++ b/mpi/mpi-add.c @@ -1,6 +1,5 @@ /* mpi-add.c - MPI functions - * Copyright (C) 1998 Free Software Foundation, Inc. - * Copyright (C) 1994, 1996 Free Software Foundation, Inc. + * Copyright (C) 1994, 1996, 1998, 2001 Free Software Foundation, Inc. * * This file is part of Libgcrypt. * @@ -39,7 +38,7 @@ * result in W. U and V may be the same. */ void -mpi_add_ui(MPI w, MPI u, unsigned long v ) +gcry_mpi_add_ui(MPI w, MPI u, unsigned long v ) { mpi_ptr_t wp, up; mpi_size_t usize, wsize; @@ -64,7 +63,7 @@ mpi_add_ui(MPI w, MPI u, unsigned long v ) } else if( !usign ) { /* mpi is not negative */ mpi_limb_t cy; - cy = mpihelp_add_1(wp, up, usize, v); + cy = _gcry_mpih_add_1(wp, up, usize, v); wp[usize] = cy; wsize = usize + cy; } @@ -75,7 +74,7 @@ mpi_add_ui(MPI w, MPI u, unsigned long v ) wsize = 1; } else { - mpihelp_sub_1(wp, up, usize, v); + _gcry_mpih_sub_1(wp, up, usize, v); /* Size can decrease with at most one limb. */ wsize = usize - (wp[usize-1]==0); wsign = 1; @@ -88,7 +87,7 @@ mpi_add_ui(MPI w, MPI u, unsigned long v ) void -mpi_add(MPI w, MPI u, MPI v) +gcry_mpi_add(MPI w, MPI u, MPI v) { mpi_ptr_t wp, up, vp; mpi_size_t usize, vsize, wsize; @@ -127,20 +126,20 @@ mpi_add(MPI w, MPI u, MPI v) else if( usign != vsign ) { /* different sign */ /* This test is right since USIZE >= VSIZE */ if( usize != vsize ) { - mpihelp_sub(wp, up, usize, vp, vsize); + _gcry_mpih_sub(wp, up, usize, vp, vsize); wsize = usize; MPN_NORMALIZE(wp, wsize); wsign = usign; } - else if( mpihelp_cmp(up, vp, usize) < 0 ) { - mpihelp_sub_n(wp, vp, up, usize); + else if( _gcry_mpih_cmp(up, vp, usize) < 0 ) { + _gcry_mpih_sub_n(wp, vp, up, usize); wsize = usize; MPN_NORMALIZE(wp, wsize); if( !usign ) wsign = 1; } else { - mpihelp_sub_n(wp, up, vp, usize); + _gcry_mpih_sub_n(wp, up, vp, usize); wsize = usize; MPN_NORMALIZE(wp, wsize); if( usign ) @@ -148,7 +147,7 @@ mpi_add(MPI w, MPI u, MPI v) } } else { /* U and V have same sign. Add them. */ - mpi_limb_t cy = mpihelp_add(wp, up, usize, vp, vsize); + mpi_limb_t cy = _gcry_mpih_add(wp, up, usize, vp, vsize); wp[usize] = cy; wsize = usize + cy; if( usign ) @@ -165,7 +164,7 @@ mpi_add(MPI w, MPI u, MPI v) * result in W. */ void -mpi_sub_ui(MPI w, MPI u, unsigned long v ) +gcry_mpi_sub_ui(MPI w, MPI u, unsigned long v ) { mpi_ptr_t wp, up; mpi_size_t usize, wsize; @@ -191,7 +190,7 @@ mpi_sub_ui(MPI w, MPI u, unsigned long v ) } else if( usign ) { /* mpi and v are negative */ mpi_limb_t cy; - cy = mpihelp_add_1(wp, up, usize, v); + cy = _gcry_mpih_add_1(wp, up, usize, v); wp[usize] = cy; wsize = usize + cy; } @@ -203,7 +202,7 @@ mpi_sub_ui(MPI w, MPI u, unsigned long v ) wsign = 1; } else { - mpihelp_sub_1(wp, up, usize, v); + _gcry_mpih_sub_1(wp, up, usize, v); /* Size can decrease with at most one limb. */ wsize = usize - (wp[usize-1]==0); } @@ -214,34 +213,34 @@ mpi_sub_ui(MPI w, MPI u, unsigned long v ) } void -mpi_sub(MPI w, MPI u, MPI v) +gcry_mpi_sub(MPI w, MPI u, MPI v) { if( w == v ) { MPI vv = mpi_copy(v); vv->sign = !vv->sign; - mpi_add( w, u, vv ); + gcry_mpi_add( w, u, vv ); mpi_free(vv); } else { /* fixme: this is not thread-save (we temp. modify v) */ v->sign = !v->sign; - mpi_add( w, u, v ); + gcry_mpi_add( w, u, v ); v->sign = !v->sign; } } void -mpi_addm( MPI w, MPI u, MPI v, MPI m) +gcry_mpi_addm( MPI w, MPI u, MPI v, MPI m) { - mpi_add(w, u, v); - mpi_fdiv_r( w, w, m ); + gcry_mpi_add(w, u, v); + _gcry_mpi_fdiv_r( w, w, m ); } void -mpi_subm( MPI w, MPI u, MPI v, MPI m) +gcry_mpi_subm( MPI w, MPI u, MPI v, MPI m) { - mpi_sub(w, u, v); - mpi_fdiv_r( w, w, m ); + gcry_mpi_sub(w, u, v); + _gcry_mpi_fdiv_r( w, w, m ); } diff --git a/mpi/mpi-bit.c b/mpi/mpi-bit.c index ff1dfe3b..d9c2f6c3 100644 --- a/mpi/mpi-bit.c +++ b/mpi/mpi-bit.c @@ -1,5 +1,5 @@ /* mpi-bit.c - MPI bit level fucntions - * Copyright (C) 1998, 1999 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. * * This file is part of Libgcrypt. * @@ -53,7 +53,7 @@ __clz_tab[] = * this is for some reasons not good, so this function removes them. */ void -mpi_normalize( MPI a ) +_gcry_mpi_normalize( MPI a ) { if( mpi_is_opaque(a) ) return; @@ -68,7 +68,7 @@ mpi_normalize( MPI a ) * Return the number of bits in A. */ unsigned int -mpi_get_nbits( MPI a ) +gcry_mpi_get_nbits( MPI a ) { unsigned n; @@ -76,7 +76,7 @@ mpi_get_nbits( MPI a ) return a->sign; /* which holds the number of bits */ } - mpi_normalize( a ); + _gcry_mpi_normalize( a ); if( a->nlimbs ) { mpi_limb_t alimb = a->d[a->nlimbs-1]; if( alimb ) @@ -90,19 +90,14 @@ mpi_get_nbits( MPI a ) return n; } -unsigned int -gcry_mpi_get_nbits( MPI a ) -{ - return mpi_get_nbits( a ); -} /**************** * Test whether bit N is set. */ int -mpi_test_bit( MPI a, unsigned n ) +gcry_mpi_test_bit( MPI a, unsigned int n ) { - unsigned limbno, bitno; + unsigned int limbno, bitno; mpi_limb_t limb; limbno = n / BITS_PER_MPI_LIMB; @@ -119,9 +114,9 @@ mpi_test_bit( MPI a, unsigned n ) * Set bit N of A. */ void -mpi_set_bit( MPI a, unsigned n ) +gcry_mpi_set_bit( MPI a, unsigned int n ) { - unsigned limbno, bitno; + unsigned int limbno, bitno; limbno = n / BITS_PER_MPI_LIMB; bitno = n % BITS_PER_MPI_LIMB; @@ -138,9 +133,9 @@ mpi_set_bit( MPI a, unsigned n ) * Set bit N of A. and clear all bits above */ void -mpi_set_highbit( MPI a, unsigned n ) +gcry_mpi_set_highbit( MPI a, unsigned int n ) { - unsigned limbno, bitno; + unsigned int limbno, bitno; limbno = n / BITS_PER_MPI_LIMB; bitno = n % BITS_PER_MPI_LIMB; @@ -160,9 +155,9 @@ mpi_set_highbit( MPI a, unsigned n ) * clear bit N of A and all bits above */ void -mpi_clear_highbit( MPI a, unsigned n ) +gcry_mpi_clear_highbit( MPI a, unsigned int n ) { - unsigned limbno, bitno; + unsigned int limbno, bitno; limbno = n / BITS_PER_MPI_LIMB; bitno = n % BITS_PER_MPI_LIMB; @@ -179,9 +174,9 @@ mpi_clear_highbit( MPI a, unsigned n ) * Clear bit N of A. */ void -mpi_clear_bit( MPI a, unsigned n ) +gcry_mpi_clear_bit( MPI a, unsigned int n ) { - unsigned limbno, bitno; + unsigned int limbno, bitno; limbno = n / BITS_PER_MPI_LIMB; bitno = n % BITS_PER_MPI_LIMB; @@ -197,7 +192,7 @@ mpi_clear_bit( MPI a, unsigned n ) * FIXME: should use alloc_limb if X and A are same. */ void -mpi_rshift( MPI x, MPI a, unsigned n ) +gcry_mpi_rshift( MPI x, MPI a, unsigned n ) { mpi_ptr_t xp; mpi_size_t xsize; @@ -208,7 +203,7 @@ mpi_rshift( MPI x, MPI a, unsigned n ) xp = x->d; if( xsize ) { - mpihelp_rshift( xp, a->d, xsize, n); + _gcry_mpih_rshift( xp, a->d, xsize, n); MPN_NORMALIZE( xp, xsize); } x->nlimbs = xsize; @@ -220,7 +215,7 @@ mpi_rshift( MPI x, MPI a, unsigned n ) * This is used only within the MPI library */ void -mpi_lshift_limbs( MPI a, unsigned int count ) +_gcry_mpi_lshift_limbs( MPI a, unsigned int count ) { mpi_ptr_t ap = a->d; int n = a->nlimbs; @@ -244,7 +239,7 @@ mpi_lshift_limbs( MPI a, unsigned int count ) * This is used only within the MPI library */ void -mpi_rshift_limbs( MPI a, unsigned int count ) +_gcry_mpi_rshift_limbs( MPI a, unsigned int count ) { mpi_ptr_t ap = a->d; mpi_size_t n = a->nlimbs; @@ -260,5 +255,3 @@ mpi_rshift_limbs( MPI a, unsigned int count ) ap[i] = 0; a->nlimbs -= count; } - - diff --git a/mpi/mpi-cmp.c b/mpi/mpi-cmp.c index 367855dd..485b147c 100644 --- a/mpi/mpi-cmp.c +++ b/mpi/mpi-cmp.c @@ -1,5 +1,5 @@ /* mpi-cmp.c - MPI functions - * Copyright (C) 1998, 1999 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. * * This file is part of Libgcrypt. * @@ -24,11 +24,11 @@ #include "mpi-internal.h" int -mpi_cmp_ui( MPI u, unsigned long v ) +gcry_mpi_cmp_ui( MPI u, unsigned long v ) { mpi_limb_t limb = v; - mpi_normalize( u ); + _gcry_mpi_normalize( u ); if( !u->nlimbs && !limb ) return 0; if( u->sign ) @@ -45,13 +45,13 @@ mpi_cmp_ui( MPI u, unsigned long v ) } int -mpi_cmp( MPI u, MPI v ) +gcry_mpi_cmp( MPI u, MPI v ) { mpi_size_t usize, vsize; int cmp; - mpi_normalize( u ); - mpi_normalize( v ); + _gcry_mpi_normalize( u ); + _gcry_mpi_normalize( v ); usize = u->nlimbs; vsize = v->nlimbs; if( !u->sign && v->sign ) @@ -64,7 +64,7 @@ mpi_cmp( MPI u, MPI v ) return vsize + usize; if( !usize ) return 0; - if( !(cmp=mpihelp_cmp( u->d, v->d, usize )) ) + if( !(cmp = _gcry_mpih_cmp( u->d, v->d, usize )) ) return 0; if( (cmp < 0?1:0) == (u->sign?1:0)) return 1; diff --git a/mpi/mpi-div.c b/mpi/mpi-div.c index e706c004..a439c46d 100644 --- a/mpi/mpi-div.c +++ b/mpi/mpi-div.c @@ -1,6 +1,5 @@ /* mpi-div.c - MPI functions - * Copyright (C) 1998 Free Software Foundation, Inc. - * Copyright (C) 1994, 1996 Free Software Foundation, Inc. + * Copyright (C) 1994, 1996, 1998, 2001 Free Software Foundation, Inc. * * This file is part of Libgcrypt. * @@ -32,11 +31,11 @@ #include <stdlib.h> #include "mpi-internal.h" #include "longlong.h" - +#include "g10lib.h" void -mpi_fdiv_r( MPI rem, MPI dividend, MPI divisor ) +_gcry_mpi_fdiv_r( MPI rem, MPI dividend, MPI divisor ) { int divisor_sign = divisor->sign; MPI temp_divisor = NULL; @@ -49,10 +48,10 @@ mpi_fdiv_r( MPI rem, MPI dividend, MPI divisor ) divisor = temp_divisor; } - mpi_tdiv_r( rem, dividend, divisor ); + _gcry_mpi_tdiv_r( rem, dividend, divisor ); if( ((divisor_sign?1:0) ^ (dividend->sign?1:0)) && rem->nlimbs ) - mpi_add( rem, rem, divisor); + gcry_mpi_add( rem, rem, divisor); if( temp_divisor ) mpi_free(temp_divisor); @@ -67,11 +66,11 @@ mpi_fdiv_r( MPI rem, MPI dividend, MPI divisor ) */ ulong -mpi_fdiv_r_ui( MPI rem, MPI dividend, ulong divisor ) +_gcry_mpi_fdiv_r_ui( MPI rem, MPI dividend, ulong divisor ) { mpi_limb_t rlimb; - rlimb = mpihelp_mod_1( dividend->d, dividend->nlimbs, divisor ); + rlimb = _gcry_mpih_mod_1( dividend->d, dividend->nlimbs, divisor ); if( rlimb && dividend->sign ) rlimb = divisor - rlimb; @@ -84,15 +83,15 @@ mpi_fdiv_r_ui( MPI rem, MPI dividend, ulong divisor ) void -mpi_fdiv_q( MPI quot, MPI dividend, MPI divisor ) +_gcry_mpi_fdiv_q( MPI quot, MPI dividend, MPI divisor ) { MPI tmp = mpi_alloc( mpi_get_nlimbs(quot) ); - mpi_fdiv_qr( quot, tmp, dividend, divisor); + _gcry_mpi_fdiv_qr( quot, tmp, dividend, divisor); mpi_free(tmp); } void -mpi_fdiv_qr( MPI quot, MPI rem, MPI dividend, MPI divisor ) +_gcry_mpi_fdiv_qr( MPI quot, MPI rem, MPI dividend, MPI divisor ) { int divisor_sign = divisor->sign; MPI temp_divisor = NULL; @@ -102,11 +101,11 @@ mpi_fdiv_qr( MPI quot, MPI rem, MPI dividend, MPI divisor ) divisor = temp_divisor; } - mpi_tdiv_qr( quot, rem, dividend, divisor ); + _gcry_mpi_tdiv_qr( quot, rem, dividend, divisor ); if( (divisor_sign ^ dividend->sign) && rem->nlimbs ) { - mpi_sub_ui( quot, quot, 1 ); - mpi_add( rem, rem, divisor); + gcry_mpi_sub_ui( quot, quot, 1 ); + gcry_mpi_add( rem, rem, divisor); } if( temp_divisor ) @@ -122,13 +121,13 @@ mpi_fdiv_qr( MPI quot, MPI rem, MPI dividend, MPI divisor ) */ void -mpi_tdiv_r( MPI rem, MPI num, MPI den) +_gcry_mpi_tdiv_r( MPI rem, MPI num, MPI den) { - mpi_tdiv_qr(NULL, rem, num, den ); + _gcry_mpi_tdiv_qr(NULL, rem, num, den ); } void -mpi_tdiv_qr( MPI quot, MPI rem, MPI num, MPI den) +_gcry_mpi_tdiv_qr( MPI quot, MPI rem, MPI num, MPI den) { mpi_ptr_t np, dp; mpi_ptr_t qp, rp; @@ -177,13 +176,13 @@ mpi_tdiv_qr( MPI quot, MPI rem, MPI num, MPI den) mpi_limb_t rlimb; if( quot ) { qp = quot->d; - rlimb = mpihelp_divmod_1( qp, np, nsize, dp[0] ); + rlimb = _gcry_mpih_divmod_1( qp, np, nsize, dp[0] ); qsize -= qp[qsize - 1] == 0; quot->nlimbs = qsize; quot->sign = sign_quotient; } else - rlimb = mpihelp_mod_1( np, nsize, dp[0] ); + rlimb = _gcry_mpih_mod_1( np, nsize, dp[0] ); rp[0] = rlimb; rsize = rlimb != 0?1:0; rem->nlimbs = rsize; @@ -219,13 +218,13 @@ mpi_tdiv_qr( MPI quot, MPI rem, MPI num, MPI den) * the most significant word. Use temporary storage not to clobber * the original contents of the denominator. */ tp = marker[markidx++] = mpi_alloc_limb_space(dsize,mpi_is_secure(den)); - mpihelp_lshift( tp, dp, dsize, normalization_steps ); + _gcry_mpih_lshift( tp, dp, dsize, normalization_steps ); dp = tp; /* Shift up the numerator, possibly introducing a new most * significant word. Move the shifted numerator in the remainder * meanwhile. */ - nlimb = mpihelp_lshift(rp, np, nsize, normalization_steps); + nlimb = _gcry_mpih_lshift(rp, np, nsize, normalization_steps); if( nlimb ) { rp[nsize] = nlimb; rsize = nsize + 1; @@ -251,7 +250,7 @@ mpi_tdiv_qr( MPI quot, MPI rem, MPI num, MPI den) rsize = nsize; } - q_limb = mpihelp_divrem( qp, 0, rp, rsize, dp, dsize ); + q_limb = _gcry_mpih_divrem( qp, 0, rp, rsize, dp, dsize ); if( quot ) { qsize = rsize - dsize; @@ -268,7 +267,7 @@ mpi_tdiv_qr( MPI quot, MPI rem, MPI num, MPI den) MPN_NORMALIZE (rp, rsize); if( normalization_steps && rsize ) { - mpihelp_rshift(rp, rp, rsize, normalization_steps); + _gcry_mpih_rshift(rp, rp, rsize, normalization_steps); rsize -= rp[rsize - 1] == 0?1:0; } @@ -279,7 +278,7 @@ mpi_tdiv_qr( MPI quot, MPI rem, MPI num, MPI den) } void -mpi_tdiv_q_2exp( MPI w, MPI u, unsigned count ) +_gcry_mpi_tdiv_q_2exp( MPI w, MPI u, unsigned int count ) { mpi_size_t usize, wsize; mpi_size_t limb_cnt; @@ -299,7 +298,7 @@ mpi_tdiv_q_2exp( MPI w, MPI u, unsigned count ) count %= BITS_PER_MPI_LIMB; if( count ) { - mpihelp_rshift( wp, up + limb_cnt, wsize, count ); + _gcry_mpih_rshift( wp, up + limb_cnt, wsize, count ); wsize -= !wp[wsize - 1]; } else { @@ -315,8 +314,8 @@ mpi_tdiv_q_2exp( MPI w, MPI u, unsigned count ) * (note: divisor must fit into a limb) */ int -mpi_divisible_ui(MPI dividend, ulong divisor ) +_gcry_mpi_divisible_ui(MPI dividend, ulong divisor ) { - return !mpihelp_mod_1( dividend->d, dividend->nlimbs, divisor ); + return !_gcry_mpih_mod_1( dividend->d, dividend->nlimbs, divisor ); } diff --git a/mpi/mpi-gcd.c b/mpi/mpi-gcd.c index 5576db20..5242adaf 100644 --- a/mpi/mpi-gcd.c +++ b/mpi/mpi-gcd.c @@ -1,5 +1,5 @@ /* mpi-gcd.c - MPI functions - * Copyright (C) 1998 Free Software Foundation, Inc. + * Copyright (C) 1998, 2001 Free Software Foundation, Inc. * * This file is part of Libgcrypt. * @@ -28,7 +28,7 @@ * Return: true if this 1, false in all other cases */ int -mpi_gcd( MPI g, MPI xa, MPI xb ) +gcry_mpi_gcd( MPI g, MPI xa, MPI xb ) { MPI a, b; @@ -38,8 +38,8 @@ mpi_gcd( MPI g, MPI xa, MPI xb ) /* TAOCP Vol II, 4.5.2, Algorithm A */ a->sign = 0; b->sign = 0; - while( mpi_cmp_ui( b, 0 ) ) { - mpi_fdiv_r( g, a, b ); /* g used as temorary variable */ + while( gcry_mpi_cmp_ui( b, 0 ) ) { + _gcry_mpi_fdiv_r( g, a, b ); /* g used as temorary variable */ mpi_set(a,b); mpi_set(b,g); } @@ -47,7 +47,7 @@ mpi_gcd( MPI g, MPI xa, MPI xb ) mpi_free(a); mpi_free(b); - return !mpi_cmp_ui( g, 1); + return !gcry_mpi_cmp_ui( g, 1); } diff --git a/mpi/mpi-inline.h b/mpi/mpi-inline.h index 2f246c87..6a53e721 100644 --- a/mpi/mpi-inline.h +++ b/mpi/mpi-inline.h @@ -1,6 +1,5 @@ /* mpi-inline.h - Internal to the Multi Precision Integers - * Copyright (C) 1998, 1999 Free Software Foundation, Inc. - * Copyright (C) 1994, 1996 Free Software Foundation, Inc. + * Copyright (C) 1994, 1996, 1998, 1999, 2001 Free Software Foundation, Inc. * * This file is part of Libgcrypt. * @@ -35,7 +34,7 @@ #endif G10_MPI_INLINE_DECL mpi_limb_t -mpihelp_add_1( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, +_gcry_mpih_add_1( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size, mpi_limb_t s2_limb) { mpi_limb_t x; @@ -65,23 +64,23 @@ mpihelp_add_1( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, G10_MPI_INLINE_DECL mpi_limb_t -mpihelp_add(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size, +_gcry_mpih_add(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size, mpi_ptr_t s2_ptr, mpi_size_t s2_size) { mpi_limb_t cy = 0; if( s2_size ) - cy = mpihelp_add_n( res_ptr, s1_ptr, s2_ptr, s2_size ); + cy = _gcry_mpih_add_n( res_ptr, s1_ptr, s2_ptr, s2_size ); if( s1_size - s2_size ) - cy = mpihelp_add_1( res_ptr + s2_size, s1_ptr + s2_size, + cy = _gcry_mpih_add_1( res_ptr + s2_size, s1_ptr + s2_size, s1_size - s2_size, cy); return cy; } G10_MPI_INLINE_DECL mpi_limb_t -mpihelp_sub_1(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, +_gcry_mpih_sub_1(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size, mpi_limb_t s2_limb ) { mpi_limb_t x; @@ -111,19 +110,46 @@ mpihelp_sub_1(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, G10_MPI_INLINE_DECL mpi_limb_t -mpihelp_sub( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size, +_gcry_mpih_sub( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size, mpi_ptr_t s2_ptr, mpi_size_t s2_size) { mpi_limb_t cy = 0; if( s2_size ) - cy = mpihelp_sub_n(res_ptr, s1_ptr, s2_ptr, s2_size); + cy = _gcry_mpih_sub_n(res_ptr, s1_ptr, s2_ptr, s2_size); if( s1_size - s2_size ) - cy = mpihelp_sub_1(res_ptr + s2_size, s1_ptr + s2_size, + cy = _gcry_mpih_sub_1(res_ptr + s2_size, s1_ptr + s2_size, s1_size - s2_size, cy); return cy; } +/**************** + * Compare OP1_PTR/OP1_SIZE with OP2_PTR/OP2_SIZE. + * There are no restrictions on the relative sizes of + * the two arguments. + * Return 1 if OP1 > OP2, 0 if they are equal, and -1 if OP1 < OP2. + */ +G10_MPI_INLINE_DECL int +_gcry_mpih_cmp( mpi_ptr_t op1_ptr, mpi_ptr_t op2_ptr, mpi_size_t size ) +{ + mpi_size_t i; + mpi_limb_t op1_word, op2_word; + + for( i = size - 1; i >= 0 ; i--) { + op1_word = op1_ptr[i]; + op2_word = op2_ptr[i]; + if( op1_word != op2_word ) + goto diff; + } + return 0; + + diff: + /* This can *not* be simplified to + * op2_word - op2_word + * since that expression might give signed overflow. */ + return (op1_word > op2_word) ? 1 : -1; +} + #endif /*G10_MPI_INLINE_H*/ diff --git a/mpi/mpi-internal.h b/mpi/mpi-internal.h index fe90521d..ec26ef30 100644 --- a/mpi/mpi-internal.h +++ b/mpi/mpi-internal.h @@ -172,41 +172,43 @@ typedef int mpi_size_t; /* (must be a signed type) */ /*-- mpiutil.c --*/ #ifdef M_DEBUG - #define mpi_alloc_limb_space(n,f) mpi_debug_alloc_limb_space((n),(f), M_DBGINFO( __LINE__ ) ) - #define mpi_free_limb_space(n) mpi_debug_free_limb_space((n), M_DBGINFO( __LINE__ ) ) - mpi_ptr_t mpi_debug_alloc_limb_space( unsigned nlimbs, int sec, const char *info ); - void mpi_debug_free_limb_space( mpi_ptr_t a, const char *info ); + #define mpi_alloc_limb_space(n,f) _gcry_mpi_debug_alloc_limb_space((n),(f), M_DBGINFO( __LINE__ ) ) + #define mpi_free_limb_space(n) _gcry_mpi_debug_free_limb_space((n), M_DBGINFO( __LINE__ ) ) + mpi_ptr_t _gcry_mpi_debug_alloc_limb_space( unsigned nlimbs, int sec, const char *info ); + void _gcry_mpi_debug_free_limb_space( mpi_ptr_t a, const char *info ); #else - mpi_ptr_t mpi_alloc_limb_space( unsigned nlimbs, int sec ); - void mpi_free_limb_space( mpi_ptr_t a ); + #define mpi_alloc_limb_space(n,f) _gcry_mpi_alloc_limb_space((n),(f)) + #define mpi_free_limb_space(n) _gcry_mpi_free_limb_space((n)) + mpi_ptr_t _gcry_mpi_alloc_limb_space( unsigned nlimbs, int sec ); + void _gcry_mpi_free_limb_space( mpi_ptr_t a ); #endif -void mpi_assign_limb_space( MPI a, mpi_ptr_t ap, unsigned nlimbs ); +void _gcry_mpi_assign_limb_space( MPI a, mpi_ptr_t ap, unsigned nlimbs ); /*-- mpi-bit.c --*/ -void mpi_rshift_limbs( MPI a, unsigned int count ); -void mpi_lshift_limbs( MPI a, unsigned int count ); +void _gcry_mpi_rshift_limbs( MPI a, unsigned int count ); +void _gcry_mpi_lshift_limbs( MPI a, unsigned int count ); -/*-- mpihelp-add.c --*/ -mpi_limb_t mpihelp_add_1(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, +/*-- mpih-add.c --*/ +mpi_limb_t _gcry_mpih_add_1(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size, mpi_limb_t s2_limb ); -mpi_limb_t mpihelp_add_n( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, +mpi_limb_t _gcry_mpih_add_n( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_ptr_t s2_ptr, mpi_size_t size); -mpi_limb_t mpihelp_add(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size, +mpi_limb_t _gcry_mpih_add(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size, mpi_ptr_t s2_ptr, mpi_size_t s2_size); -/*-- mpihelp-sub.c --*/ -mpi_limb_t mpihelp_sub_1( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, +/*-- mpih-sub.c --*/ +mpi_limb_t _gcry_mpih_sub_1( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size, mpi_limb_t s2_limb ); -mpi_limb_t mpihelp_sub_n( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, +mpi_limb_t _gcry_mpih_sub_n( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_ptr_t s2_ptr, mpi_size_t size); -mpi_limb_t mpihelp_sub(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size, +mpi_limb_t _gcry_mpih_sub(mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size, mpi_ptr_t s2_ptr, mpi_size_t s2_size); -/*-- mpihelp-cmp.c --*/ -int mpihelp_cmp( mpi_ptr_t op1_ptr, mpi_ptr_t op2_ptr, mpi_size_t size ); +/*-- mpih-cmp.c --*/ +int _gcry_mpih_cmp( mpi_ptr_t op1_ptr, mpi_ptr_t op2_ptr, mpi_size_t size ); -/*-- mpihelp-mul.c --*/ +/*-- mpih-mul.c --*/ struct karatsuba_ctx { struct karatsuba_ctx *next; @@ -216,44 +218,44 @@ struct karatsuba_ctx { mpi_size_t tp_size; }; -void mpihelp_release_karatsuba_ctx( struct karatsuba_ctx *ctx ); +void _gcry_mpih_release_karatsuba_ctx( struct karatsuba_ctx *ctx ); -mpi_limb_t mpihelp_addmul_1( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, +mpi_limb_t _gcry_mpih_addmul_1( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size, mpi_limb_t s2_limb); -mpi_limb_t mpihelp_submul_1( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, +mpi_limb_t _gcry_mpih_submul_1( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size, mpi_limb_t s2_limb); -void mpihelp_mul_n( mpi_ptr_t prodp, mpi_ptr_t up, mpi_ptr_t vp, +void _gcry_mpih_mul_n( mpi_ptr_t prodp, mpi_ptr_t up, mpi_ptr_t vp, mpi_size_t size); -mpi_limb_t mpihelp_mul( mpi_ptr_t prodp, mpi_ptr_t up, mpi_size_t usize, +mpi_limb_t _gcry_mpih_mul( mpi_ptr_t prodp, mpi_ptr_t up, mpi_size_t usize, mpi_ptr_t vp, mpi_size_t vsize); -void mpih_sqr_n_basecase( mpi_ptr_t prodp, mpi_ptr_t up, mpi_size_t size ); -void mpih_sqr_n( mpi_ptr_t prodp, mpi_ptr_t up, mpi_size_t size, +void _gcry_mpih_sqr_n_basecase( mpi_ptr_t prodp, mpi_ptr_t up, mpi_size_t size ); +void _gcry_mpih_sqr_n( mpi_ptr_t prodp, mpi_ptr_t up, mpi_size_t size, mpi_ptr_t tspace); -void mpihelp_mul_karatsuba_case( mpi_ptr_t prodp, +void _gcry_mpih_mul_karatsuba_case( mpi_ptr_t prodp, mpi_ptr_t up, mpi_size_t usize, mpi_ptr_t vp, mpi_size_t vsize, struct karatsuba_ctx *ctx ); -/*-- mpihelp-mul_1.c (or xxx/cpu/ *.S) --*/ -mpi_limb_t mpihelp_mul_1( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, +/*-- mpih-mul_1.c (or xxx/cpu/ *.S) --*/ +mpi_limb_t _gcry_mpih_mul_1( mpi_ptr_t res_ptr, mpi_ptr_t s1_ptr, mpi_size_t s1_size, mpi_limb_t s2_limb); -/*-- mpihelp-div.c --*/ -mpi_limb_t mpihelp_mod_1(mpi_ptr_t dividend_ptr, mpi_size_t dividend_size, +/*-- mpih-div.c --*/ +mpi_limb_t _gcry_mpih_mod_1(mpi_ptr_t dividend_ptr, mpi_size_t dividend_size, mpi_limb_t divisor_limb); -mpi_limb_t mpihelp_divrem( mpi_ptr_t qp, mpi_size_t qextra_limbs, +mpi_limb_t _gcry_mpih_divrem( mpi_ptr_t qp, mpi_size_t qextra_limbs, mpi_ptr_t np, mpi_size_t nsize, mpi_ptr_t dp, mpi_size_t dsize); -mpi_limb_t mpihelp_divmod_1( mpi_ptr_t quot_ptr, +mpi_limb_t _gcry_mpih_divmod_1( mpi_ptr_t quot_ptr, mpi_ptr_t dividend_ptr, mpi_size_t dividend_size, mpi_limb_t divisor_limb); -/*-- mpihelp-shift.c --*/ -mpi_limb_t mpihelp_lshift( mpi_ptr_t wp, mpi_ptr_t up, mpi_size_t usize, +/*-- mpih-shift.c --*/ +mpi_limb_t _gcry_mpih_lshift( mpi_ptr_t wp, mpi_ptr_t up, mpi_size_t usize, unsigned cnt); -mpi_limb_t mpihelp_rshift( mpi_ptr_t wp, mpi_ptr_t up, mpi_size_t usize, +mpi_limb_t _gcry_mpih_rshift( mpi_ptr_t wp, mpi_ptr_t up, mpi_size_t usize, unsigned cnt); @@ -278,3 +280,4 @@ mpi_limb_t mpihelp_rshift( mpi_ptr_t wp, mpi_ptr_t up, mpi_size_t usize, #endif #endif /*G10_MPI_INTERNAL_H*/ + diff --git a/mpi/mpi-inv.c b/mpi/mpi-inv.c index f8cb85a7..ab890a7a 100644 --- a/mpi/mpi-inv.c +++ b/mpi/mpi-inv.c @@ -1,5 +1,5 @@ /* mpi-inv.c - MPI functions - * Copyright (C) 1998 Free Software Foundation, Inc. + * Copyright (C) 1998, 2001 Free Software Foundation, Inc. * * This file is part of Libgcrypt. * @@ -22,7 +22,7 @@ #include <stdio.h> #include <stdlib.h> #include "mpi-internal.h" - +#include "g10lib.h" /**************** * Calculate the multiplicative inverse X of A mod N @@ -30,7 +30,7 @@ * 1 = (a*x) mod n */ void -mpi_invm( MPI x, MPI a, MPI n ) +_gcry_mpi_invm( MPI x, MPI a, MPI n ) { #if 0 MPI u, v, u1, u2, u3, v1, v2, v3, q, t1, t2, t3; diff --git a/mpi/mpi-mpow.c b/mpi/mpi-mpow.c index 9414844d..9df505e3 100644 --- a/mpi/mpi-mpow.c +++ b/mpi/mpi-mpow.c @@ -1,5 +1,5 @@ /* mpi-mpow.c - MPI functions - * Copyright (C) 1998, 1999 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2001 Free Software Foundation, Inc. * * This file is part of Libgcrypt. * @@ -23,8 +23,10 @@ #include <stdlib.h> #include "mpi-internal.h" #include "longlong.h" +#include "g10lib.h" #include <assert.h> + /* Barrett is slower than the classical way. It can be tweaked by * using partial multiplications */ @@ -37,7 +39,7 @@ static void barrett_mulm( MPI w, MPI u, MPI v, MPI m, MPI y, int k, MPI r1, MPI static MPI init_barrett( MPI m, int *k, MPI *r1, MPI *r2 ); static int calc_barrett( MPI r, MPI x, MPI m, MPI y, int k, MPI r1, MPI r2 ); #else -#define barrett_mulm( w, u, v, m, y, k, r1, r2 ) mpi_mulm( (w), (u), (v), (m) ) +#define barrett_mulm( w, u, v, m, y, k, r1, r2 ) gcry_mpi_mulm( (w), (u), (v), (m) ) #endif @@ -61,7 +63,7 @@ build_index( MPI *exparray, int k, int i, int t ) * RES = (BASE[0] ^ EXP[0]) * (BASE[1] ^ EXP[1]) * ... * mod M */ void -mpi_mulpowm( MPI res, MPI *basearray, MPI *exparray, MPI m) +_gcry_mpi_mulpowm( MPI res, MPI *basearray, MPI *exparray, MPI m) { int k; /* number of elements */ int t; /* bit size of largest exponent */ @@ -87,7 +89,7 @@ mpi_mulpowm( MPI res, MPI *basearray, MPI *exparray, MPI m) assert(t); assert( k < 10 ); - G = g10_xcalloc( (1<<k) , sizeof *G ); + G = gcry_xcalloc( (1<<k) , sizeof *G ); #ifdef USE_BARRETT barrett_y = init_barrett( m, &barrett_k, &barrett_r1, &barrett_r2 ); #endif @@ -128,7 +130,7 @@ mpi_mulpowm( MPI res, MPI *basearray, MPI *exparray, MPI m) #endif for(i=0; i < (1<<k); i++ ) mpi_free(G[i]); - g10_free(G); + gcry_free(G); } diff --git a/mpi/mpi-mul.c b/mpi/mpi-mul.c index 280e47a9..4a7dd7d6 100644 --- a/mpi/mpi-mul.c +++ b/mpi/mpi-mul.c @@ -1,6 +1,5 @@ /* mpi-mul.c - MPI functions - * Copyright (C) 1998 Free Software Foundation, Inc. - * Copyright (C) 1994, 1996 Free Software Foundation, Inc. + * Copyright (C) 1994, 1996, 1998, 2001 Free Software Foundation, Inc. * * This file is part of Libgcrypt. * @@ -34,7 +33,7 @@ void -mpi_mul_ui( MPI prod, MPI mult, unsigned long small_mult ) +gcry_mpi_mul_ui( MPI prod, MPI mult, unsigned long small_mult ) { mpi_size_t size, prod_size; mpi_ptr_t prod_ptr; @@ -55,7 +54,7 @@ mpi_mul_ui( MPI prod, MPI mult, unsigned long small_mult ) mpi_resize( prod, prod_size ); prod_ptr = prod->d; - cy = mpihelp_mul_1( prod_ptr, mult->d, size, (mpi_limb_t)small_mult ); + cy = _gcry_mpih_mul_1( prod_ptr, mult->d, size, (mpi_limb_t)small_mult ); if( cy ) prod_ptr[size++] = cy; prod->nlimbs = size; @@ -64,7 +63,7 @@ mpi_mul_ui( MPI prod, MPI mult, unsigned long small_mult ) void -mpi_mul_2exp( MPI w, MPI u, unsigned long cnt) +_gcry_mpi_mul_2exp( MPI w, MPI u, unsigned long cnt) { mpi_size_t usize, wsize, limb_cnt; mpi_ptr_t wp; @@ -90,7 +89,7 @@ mpi_mul_2exp( MPI w, MPI u, unsigned long cnt) cnt %= BITS_PER_MPI_LIMB; if( cnt ) { - wlimb = mpihelp_lshift( wp + limb_cnt, u->d, usize, cnt ); + wlimb = _gcry_mpih_lshift( wp + limb_cnt, u->d, usize, cnt ); if( wlimb ) { wp[wsize] = wlimb; wsize++; @@ -111,7 +110,7 @@ mpi_mul_2exp( MPI w, MPI u, unsigned long cnt) void -mpi_mul( MPI w, MPI u, MPI v) +gcry_mpi_mul( MPI w, MPI u, MPI v) { mpi_size_t usize, vsize, wsize; mpi_ptr_t up, vp, wp; @@ -185,7 +184,7 @@ mpi_mul( MPI w, MPI u, MPI v) if( !vsize ) wsize = 0; else { - cy = mpihelp_mul( wp, up, usize, vp, vsize ); + cy = _gcry_mpih_mul( wp, up, usize, vp, vsize ); wsize -= cy? 0:1; } @@ -197,7 +196,7 @@ mpi_mul( MPI w, MPI u, MPI v) mpi_free_limb_space (wp); wp = tmp_wp; } - mpi_assign_limb_space( w, wp, wsize ); + _gcry_mpi_assign_limb_space( w, wp, wsize ); } w->nlimbs = wsize; w->sign = sign_product; @@ -207,9 +206,9 @@ mpi_mul( MPI w, MPI u, MPI v) void -mpi_mulm( MPI w, MPI u, MPI v, MPI m) +gcry_mpi_mulm( MPI w, MPI u, MPI v, MPI m) { - mpi_mul(w, u, v); - mpi_fdiv_r( w, w, m ); + gcry_mpi_mul(w, u, v); + _gcry_mpi_fdiv_r( w, w, m ); } diff --git a/mpi/mpi-pow.c b/mpi/mpi-pow.c index c9322f1a..7538d3e1 100644 --- a/mpi/mpi-pow.c +++ b/mpi/mpi-pow.c @@ -1,6 +1,5 @@ /* mpi-pow.c - MPI functions - * Copyright (C) 1998 Free Software Foundation, Inc. - * Copyright (C) 1994, 1996, 2000 Free Software Foundation, Inc. + * Copyright (C) 1994, 1996, 1998, 2000 Free Software Foundation, Inc. * * This file is part of Libgcrypt. * @@ -89,7 +88,7 @@ gcry_mpi_powm( MPI res, MPI base, MPI exp, MPI mod) mp = mp_marker = mpi_alloc_limb_space(msize, msec); count_leading_zeros( mod_shift_cnt, mod->d[msize-1] ); if( mod_shift_cnt ) - mpihelp_lshift( mp, mod->d, msize, mod_shift_cnt ); + _gcry_mpih_lshift( mp, mod->d, msize, mod_shift_cnt ); else MPN_COPY( mp, mod->d, msize ); @@ -102,7 +101,7 @@ gcry_mpi_powm( MPI res, MPI base, MPI exp, MPI mod) MPN_COPY( bp, base->d, bsize ); /* We don't care about the quotient, store it above the remainder, * at BP + MSIZE. */ - mpihelp_divrem( bp + msize, 0, bp, bsize, mp, msize ); + _gcry_mpih_divrem( bp + msize, 0, bp, bsize, mp, msize ); bsize = msize; /* Canonicalize the base, since we are going to multiply with it * quite a few times. */ @@ -175,7 +174,7 @@ gcry_mpi_powm( MPI res, MPI base, MPI exp, MPI mod) * * Make the result be pointed to alternately by XP and RP. This * helps us avoid block copying, which would otherwise be necessary - * with the overlap restrictions of mpihelp_divmod. With 50% probability + * with the overlap restrictions of _gcry_mpih_divmod. With 50% probability * the result after this loop will be in the area originally pointed * by RP (==RES->d), and with 50% probability in the area originally * pointed to by XP. @@ -186,9 +185,9 @@ gcry_mpi_powm( MPI res, MPI base, MPI exp, MPI mod) mpi_ptr_t tp; mpi_size_t xsize; - /*mpihelp_mul_n(xp, rp, rp, rsize);*/ + /*mpih_mul_n(xp, rp, rp, rsize);*/ if( rsize < KARATSUBA_THRESHOLD ) - mpih_sqr_n_basecase( xp, rp, rsize ); + _gcry_mpih_sqr_n_basecase( xp, rp, rsize ); else { if( !tspace ) { tsize = 2 * rsize; @@ -199,12 +198,12 @@ gcry_mpi_powm( MPI res, MPI base, MPI exp, MPI mod) tsize = 2 * rsize; tspace = mpi_alloc_limb_space( tsize, 0 ); } - mpih_sqr_n( xp, rp, rsize, tspace ); + _gcry_mpih_sqr_n( xp, rp, rsize, tspace ); } xsize = 2 * rsize; if( xsize > msize ) { - mpihelp_divrem(xp + msize, 0, xp, xsize, mp, msize); + _gcry_mpih_divrem(xp + msize, 0, xp, xsize, mp, msize); xsize = msize; } @@ -212,18 +211,18 @@ gcry_mpi_powm( MPI res, MPI base, MPI exp, MPI mod) rsize = xsize; if( (mpi_limb_signed_t)e < 0 ) { - /*mpihelp_mul( xp, rp, rsize, bp, bsize );*/ + /*mpih_mul( xp, rp, rsize, bp, bsize );*/ if( bsize < KARATSUBA_THRESHOLD ) { - mpihelp_mul( xp, rp, rsize, bp, bsize ); + _gcry_mpih_mul( xp, rp, rsize, bp, bsize ); } else { - mpihelp_mul_karatsuba_case( + _gcry_mpih_mul_karatsuba_case( xp, rp, rsize, bp, bsize, &karactx ); } xsize = rsize + bsize; if( xsize > msize ) { - mpihelp_divrem(xp + msize, 0, xp, xsize, mp, msize); + _gcry_mpih_divrem(xp + msize, 0, xp, xsize, mp, msize); xsize = msize; } @@ -248,7 +247,7 @@ gcry_mpi_powm( MPI res, MPI base, MPI exp, MPI mod) * might be, see above). */ if( mod_shift_cnt ) { - carry_limb = mpihelp_lshift( res->d, rp, rsize, mod_shift_cnt); + carry_limb = _gcry_mpih_lshift( res->d, rp, rsize, mod_shift_cnt); rp = res->d; if( carry_limb ) { rp[rsize] = carry_limb; @@ -261,22 +260,22 @@ gcry_mpi_powm( MPI res, MPI base, MPI exp, MPI mod) } if( rsize >= msize ) { - mpihelp_divrem(rp + msize, 0, rp, rsize, mp, msize); + _gcry_mpih_divrem(rp + msize, 0, rp, rsize, mp, msize); rsize = msize; } /* Remove any leading zero words from the result. */ if( mod_shift_cnt ) - mpihelp_rshift( rp, rp, rsize, mod_shift_cnt); + _gcry_mpih_rshift( rp, rp, rsize, mod_shift_cnt); MPN_NORMALIZE (rp, rsize); - mpihelp_release_karatsuba_ctx( &karactx ); + _gcry_mpih_release_karatsuba_ctx( &karactx ); } if( negative_result && rsize ) { if( mod_shift_cnt ) - mpihelp_rshift( mp, mp, msize, mod_shift_cnt); - mpihelp_sub( rp, mp, msize, rp, rsize); + _gcry_mpih_rshift( mp, mp, msize, mod_shift_cnt); + _gcry_mpih_sub( rp, mp, msize, rp, rsize); rsize = msize; rsign = msign; MPN_NORMALIZE(rp, rsize); @@ -285,11 +284,11 @@ gcry_mpi_powm( MPI res, MPI base, MPI exp, MPI mod) res->sign = rsign; leave: - if( assign_rp ) mpi_assign_limb_space( res, rp, size ); - if( mp_marker ) mpi_free_limb_space( mp_marker ); - if( bp_marker ) mpi_free_limb_space( bp_marker ); - if( ep_marker ) mpi_free_limb_space( ep_marker ); - if( xp_marker ) mpi_free_limb_space( xp_marker ); - if( tspace ) mpi_free_limb_space( tspace ); + if( assign_rp ) _gcry_mpi_assign_limb_space( res, rp, size ); + if( mp_marker ) _gcry_mpi_free_limb_space( mp_marker ); + if( bp_marker ) _gcry_mpi_free_limb_space( bp_marker ); + if( ep_marker ) _gcry_mpi_free_limb_space( ep_marker ); + if( xp_marker ) _gcry_mpi_free_limb_space( xp_marker ); + if( tspace ) _gcry_mpi_free_limb_space( tspace ); } diff --git a/mpi/mpi-scan.c b/mpi/mpi-scan.c index 117f3751..c8b96ac0 100644 --- a/mpi/mpi-scan.c +++ b/mpi/mpi-scan.c @@ -1,5 +1,5 @@ /* mpi-scan.c - MPI functions - * Copyright (C) 1998 Free Software Foundation, Inc. + * Copyright (C) 1998, 2001 Free Software Foundation, Inc. * * This file is part of Libgcrypt. * @@ -32,7 +32,7 @@ * FIXME: This code is VERY ugly! */ int -mpi_getbyte( MPI a, unsigned idx ) +_gcry_mpi_getbyte( MPI a, unsigned idx ) { int i, j; unsigned n; @@ -54,7 +54,7 @@ mpi_getbyte( MPI a, unsigned idx ) * Put a value at position IDX into A. idx counts from lsb to msb */ void -mpi_putbyte( MPI a, unsigned idx, int xc ) +_gcry_mpi_putbyte( MPI a, unsigned idx, int xc ) { int i, j; unsigned n; @@ -110,7 +110,7 @@ mpi_putbyte( MPI a, unsigned idx, int xc ) * Count the number of zerobits at the low end of A */ unsigned -mpi_trailing_zeros( MPI a ) +_gcry_mpi_trailing_zeros( MPI a ) { unsigned n, count = 0; diff --git a/mpi/mpicoder.c b/mpi/mpicoder.c index aea641bb..d1f30b56 100644 --- a/mpi/mpicoder.c +++ b/mpi/mpicoder.c @@ -1,5 +1,5 @@ /* mpicoder.c - Coder for the external representation of MPIs - * Copyright (C) 1998 Free Software Foundation, Inc. + * Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc. * * This file is part of Libgcrypt. * @@ -188,9 +188,9 @@ mpi_print( FILE *fp, MPI a, int mode ) return n; } - +#warning We should move this function to elsewhere void -g10_log_mpidump( const char *text, MPI a ) +_gcry_log_mpidump( const char *text, MPI a ) { FILE *fp = stderr; /* used to be log_stream() */ @@ -219,8 +219,8 @@ do_get_buffer( MPI a, unsigned *nbytes, int *sign, int force_secure ) if( sign ) *sign = a->sign; *nbytes = a->nlimbs * BYTES_PER_MPI_LIMB; - p = buffer = force_secure || mpi_is_secure(a) ? g10_xmalloc_secure( *nbytes) - : g10_xmalloc( *nbytes ); + p = buffer = force_secure || mpi_is_secure(a) ? gcry_xmalloc_secure( *nbytes) + : gcry_xmalloc( *nbytes ); for(i=a->nlimbs-1; i >= 0; i-- ) { alimb = a->d[i]; @@ -254,13 +254,13 @@ do_get_buffer( MPI a, unsigned *nbytes, int *sign, int force_secure ) byte * -mpi_get_buffer( MPI a, unsigned *nbytes, int *sign ) +_gcry_mpi_get_buffer( MPI a, unsigned *nbytes, int *sign ) { return do_get_buffer( a, nbytes, sign, 0 ); } byte * -mpi_get_secure_buffer( MPI a, unsigned *nbytes, int *sign ) +_gcry_mpi_get_secure_buffer( MPI a, unsigned *nbytes, int *sign ) { return do_get_buffer( a, nbytes, sign, 1 ); } @@ -269,7 +269,7 @@ mpi_get_secure_buffer( MPI a, unsigned *nbytes, int *sign ) * Use BUFFER to update MPI. */ void -mpi_set_buffer( MPI a, const byte *buffer, unsigned nbytes, int sign ) +_gcry_mpi_set_buffer( MPI a, const byte *buffer, unsigned nbytes, int sign ) { const byte *p; mpi_limb_t alimb; @@ -351,7 +351,7 @@ gcry_mpi_scan( struct gcry_mpi **ret_mpi, enum gcry_mpi_format format, return GCRYERR_INTERNAL; } else - mpi_set_buffer( a, s, len, 0 ); + _gcry_mpi_set_buffer( a, s, len, 0 ); } if( ret_mpi ) { mpi_normalize ( a ); @@ -364,7 +364,7 @@ gcry_mpi_scan( struct gcry_mpi **ret_mpi, enum gcry_mpi_format format, else if( format == GCRYMPI_FMT_USG ) { a = mpi_alloc( (len+BYTES_PER_MPI_LIMB-1) / BYTES_PER_MPI_LIMB ); if( len ) /* not zero */ - mpi_set_buffer( a, buffer, len, 0 ); + _gcry_mpi_set_buffer( a, buffer, len, 0 ); if( ret_mpi ) { mpi_normalize ( a ); *ret_mpi = a; @@ -405,7 +405,7 @@ gcry_mpi_scan( struct gcry_mpi **ret_mpi, enum gcry_mpi_format format, return GCRYERR_INTERNAL; } else - mpi_set_buffer( a, s, n, 0 ); + _gcry_mpi_set_buffer( a, s, n, 0 ); } if( nbytes ) *nbytes = n+4; @@ -460,14 +460,14 @@ gcry_mpi_print( enum gcry_mpi_format format, char *buffer, size_t *nbytes, if( a->sign ) return GCRYERR_INTERNAL; /* can't handle it yet */ - tmp = mpi_get_buffer( a, &n, NULL ); + tmp = _gcry_mpi_get_buffer( a, &n, NULL ); if( n && (*tmp & 0x80) ) { n++; extra=1; } if( n > len && buffer ) { - g10_free(tmp); + gcry_free(tmp); return GCRYERR_TOO_SHORT; /* the provided buffer is too short */ } if( buffer ) { @@ -477,7 +477,7 @@ gcry_mpi_print( enum gcry_mpi_format format, char *buffer, size_t *nbytes, memcpy( s, tmp, n-extra ); } - g10_free(tmp); + gcry_free(tmp); *nbytes = n; return 0; } @@ -491,9 +491,9 @@ gcry_mpi_print( enum gcry_mpi_format format, char *buffer, size_t *nbytes, return GCRYERR_TOO_SHORT; /* the provided buffer is too short */ if( buffer ) { char *tmp; - tmp = mpi_get_buffer( a, &n, NULL ); + tmp = _gcry_mpi_get_buffer( a, &n, NULL ); memcpy( buffer, tmp, n ); - g10_free(tmp); + gcry_free(tmp); } *nbytes = n; return 0; @@ -512,9 +512,9 @@ gcry_mpi_print( enum gcry_mpi_format format, char *buffer, size_t *nbytes, s[0] = nbits >> 8; s[1] = nbits; - tmp = mpi_get_buffer( a, &n, NULL ); + tmp = _gcry_mpi_get_buffer( a, &n, NULL ); memcpy( s+2, tmp, n ); - g10_free(tmp); + gcry_free(tmp); } *nbytes = n+2; return 0; @@ -527,14 +527,14 @@ gcry_mpi_print( enum gcry_mpi_format format, char *buffer, size_t *nbytes, if( a->sign ) return GCRYERR_INTERNAL; /* can't handle it yet */ - tmp = mpi_get_buffer( a, &n, NULL ); + tmp = _gcry_mpi_get_buffer( a, &n, NULL ); if( n && (*tmp & 0x80) ) { n++; extra=1; } if( n+4 > len && buffer ) { - g10_free(tmp); + gcry_free(tmp); return GCRYERR_TOO_SHORT; /* the provided buffer is too short */ } if( buffer ) { @@ -548,7 +548,7 @@ gcry_mpi_print( enum gcry_mpi_format format, char *buffer, size_t *nbytes, memcpy( s, tmp, n-extra ); } - g10_free(tmp); + gcry_free(tmp); *nbytes = 4+n; return 0; } @@ -558,12 +558,12 @@ gcry_mpi_print( enum gcry_mpi_format format, char *buffer, size_t *nbytes, int extra = 0; unsigned int n=0; - tmp = mpi_get_buffer( a, &n, NULL ); + tmp = _gcry_mpi_get_buffer( a, &n, NULL ); if( !n || (*tmp & 0x80) ) extra=2; if( 2*n + extra + !!a->sign + 1 > len && buffer ) { - g10_free(tmp); + gcry_free(tmp); return GCRYERR_TOO_SHORT; /* the provided buffer is too short */ } if( buffer ) { @@ -587,7 +587,7 @@ gcry_mpi_print( enum gcry_mpi_format format, char *buffer, size_t *nbytes, else { *nbytes = 2*n + extra + !!a->sign + 1; } - g10_free(tmp); + gcry_free(tmp); return 0; } else @@ -610,10 +610,10 @@ gcry_mpi_aprint( enum gcry_mpi_format format, void **buffer, size_t *nbytes, rc = gcry_mpi_print( format, NULL, &n, a ); if( rc ) return rc; - *buffer = mpi_is_secure(a) ? g10_xmalloc_secure( n ) : g10_xmalloc( n ); + *buffer = mpi_is_secure(a) ? gcry_xmalloc_secure( n ) : gcry_xmalloc( n ); rc = gcry_mpi_print( format, *buffer, &n, a ); if( rc ) { - g10_free(*buffer); + gcry_free(*buffer); *buffer = NULL; } else if( nbytes ) diff --git a/mpi/mpih-cmp.c b/mpi/mpih-cmp.c deleted file mode 100644 index a7c5c9f7..00000000 --- a/mpi/mpih-cmp.c +++ /dev/null @@ -1,62 +0,0 @@ -/* mpihelp-sub.c - MPI helper functions - * Copyright (C) 1998 Free Software Foundation, Inc. - * Copyright (C) 1994, 1996 Free Software Foundation, Inc. - * - * This file is part of Libgcrypt. - * - * Libgcrypt is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * Libgcrypt is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - * - * Note: This code is heavily based on the GNU MP Library. - * Actually it's the same code with only minor changes in the - * way the data is stored; this is to support the abstraction - * of an optional secure memory allocation which may be used - * to avoid revealing of sensitive data due to paging etc. - * The GNU MP Library itself is published under the LGPL; - * however I decided to publish this code under the plain GPL. - */ - -#include <config.h> -#include <stdio.h> -#include <stdlib.h> - -#include "mpi-internal.h" - -/**************** - * Compare OP1_PTR/OP1_SIZE with OP2_PTR/OP2_SIZE. - * There are no restrictions on the relative sizes of - * the two arguments. - * Return 1 if OP1 > OP2, 0 if they are equal, and -1 if OP1 < OP2. - */ -int -mpihelp_cmp( mpi_ptr_t op1_ptr, mpi_ptr_t op2_ptr, mpi_size_t size ) -{ - mpi_size_t i; - mpi_limb_t op1_word, op2_word; - - for( i = size - 1; i >= 0 ; i--) { - op1_word = op1_ptr[i]; - op2_word = op2_ptr[i]; - if( op1_word != op2_word ) - goto diff; - } - return 0; - - diff: - /* This can *not* be simplified to - * op2_word - op2_word - * since that expression might give signed overflow. */ - return (op1_word > op2_word) ? 1 : -1; -} - diff --git a/mpi/mpih-div.c b/mpi/mpih-div.c index 3462ba6d..0a2f2a2a 100644 --- a/mpi/mpih-div.c +++ b/mpi/mpih-div.c @@ -1,6 +1,5 @@ -/* mpihelp-div.c - MPI helper functions - * Copyright (C) 1998 Free Software Foundation, Inc. - * Copyright (C) 1994, 1996, 2000 Free Software Foundation, Inc. +/* mpih-div.c - MPI helper functions + * Copyright (C) 1994, 1996, 1998, 2000, 2001 Free Software Foundation, Inc. * * This file is part of Libgcrypt. * @@ -45,7 +44,7 @@ */ mpi_limb_t -mpihelp_mod_1(mpi_ptr_t dividend_ptr, mpi_size_t dividend_size, +_gcry_mpih_mod_1(mpi_ptr_t dividend_ptr, mpi_size_t dividend_size, mpi_limb_t divisor_limb) { mpi_size_t i; @@ -206,9 +205,9 @@ mpihelp_mod_1(mpi_ptr_t dividend_ptr, mpi_size_t dividend_size, */ mpi_limb_t -mpihelp_divrem( mpi_ptr_t qp, mpi_size_t qextra_limbs, - mpi_ptr_t np, mpi_size_t nsize, - mpi_ptr_t dp, mpi_size_t dsize) +_gcry_mpih_divrem( mpi_ptr_t qp, mpi_size_t qextra_limbs, + mpi_ptr_t np, mpi_size_t nsize, + mpi_ptr_t dp, mpi_size_t dsize) { mpi_limb_t most_significant_q_limb = 0; @@ -320,8 +319,8 @@ mpihelp_divrem( mpi_ptr_t qp, mpi_size_t qextra_limbs, n0 = np[dsize - 1]; if( n0 >= dX ) { - if(n0 > dX || mpihelp_cmp(np, dp, dsize - 1) >= 0 ) { - mpihelp_sub_n(np, np, dp, dsize); + if(n0 > dX || _gcry_mpih_cmp(np, dp, dsize - 1) >= 0 ) { + _gcry_mpih_sub_n(np, np, dp, dsize); n0 = np[dsize - 1]; most_significant_q_limb = 1; } @@ -366,10 +365,10 @@ mpihelp_divrem( mpi_ptr_t qp, mpi_size_t qextra_limbs, /* Possible optimization: We already have (q * n0) and (1 * n1) * after the calculation of q. Taking advantage of that, we * could make this loop make two iterations less. */ - cy_limb = mpihelp_submul_1(np, dp, dsize, q); + cy_limb = _gcry_mpih_submul_1(np, dp, dsize, q); if( n2 != cy_limb ) { - mpihelp_add_n(np, np, dp, dsize); + _gcry_mpih_add_n(np, np, dp, dsize); q--; } @@ -393,9 +392,9 @@ mpihelp_divrem( mpi_ptr_t qp, mpi_size_t qextra_limbs, */ mpi_limb_t -mpihelp_divmod_1( mpi_ptr_t quot_ptr, - mpi_ptr_t dividend_ptr, mpi_size_t dividend_size, - mpi_limb_t divisor_limb) +_gcry_mpih_divmod_1( mpi_ptr_t quot_ptr, + mpi_ptr_t dividend_ptr, mpi_size_t dividend_size, + mpi_limb_t divisor_limb) { mpi_size_t i; mpi_limb_t n1, n0, r; diff --git a/mpi/mpih-mul.c b/mpi/mpih-mul.c index fa2d9d1f..d2b32b8e 100644 --- a/mpi/mpih-mul.c +++ b/mpi/mpih-mul.c @@ -1,5 +1,6 @@ -/* mpihelp-mul.c - MPI helper functions - * Copyright (C) 1994, 1996, 1998, 1999, 2000 Free Software Foundation, Inc. +/* mpih-mul.c - MPI helper functions + * Copyright (C) 1994, 1996, 1998, 1999, 2000, + * 2001 Free Software Foundation, Inc. * * This file is part of Libgcrypt. * @@ -32,8 +33,7 @@ #include <string.h> #include "mpi-internal.h" #include "longlong.h" -#include "g10lib.h" /* g10_is_secure() */ - +#include "g10lib.h" #define MPN_MUL_N_RECURSE(prodp, up, vp, size, tspace) \ do { \ @@ -46,9 +46,9 @@ #define MPN_SQR_N_RECURSE(prodp, up, size, tspace) \ do { \ if ((size) < KARATSUBA_THRESHOLD) \ - mpih_sqr_n_basecase (prodp, up, size); \ + _gcry_mpih_sqr_n_basecase (prodp, up, size); \ else \ - mpih_sqr_n (prodp, up, size, tspace); \ + _gcry_mpih_sqr_n (prodp, up, size, tspace); \ } while (0); @@ -90,7 +90,7 @@ mul_n_basecase( mpi_ptr_t prodp, mpi_ptr_t up, cy = 0; } else - cy = mpihelp_mul_1( prodp, up, size, v_limb ); + cy = _gcry_mpih_mul_1( prodp, up, size, v_limb ); prodp[size] = cy; prodp++; @@ -102,10 +102,10 @@ mul_n_basecase( mpi_ptr_t prodp, mpi_ptr_t up, if( v_limb <= 1 ) { cy = 0; if( v_limb == 1 ) - cy = mpihelp_add_n(prodp, prodp, up, size); + cy = _gcry_mpih_add_n(prodp, prodp, up, size); } else - cy = mpihelp_addmul_1(prodp, up, size, v_limb); + cy = _gcry_mpih_addmul_1(prodp, up, size, v_limb); prodp[size] = cy; prodp++; @@ -134,9 +134,9 @@ mul_n( mpi_ptr_t prodp, mpi_ptr_t up, mpi_ptr_t vp, mpi_limb_t cy_limb; MPN_MUL_N_RECURSE( prodp, up, vp, esize, tspace ); - cy_limb = mpihelp_addmul_1( prodp + esize, up, esize, vp[esize] ); + cy_limb = _gcry_mpih_addmul_1( prodp + esize, up, esize, vp[esize] ); prodp[esize + esize] = cy_limb; - cy_limb = mpihelp_addmul_1( prodp + esize, vp, size, up[esize] ); + cy_limb = _gcry_mpih_addmul_1( prodp + esize, vp, size, up[esize] ); prodp[esize + size] = cy_limb; } else { @@ -169,20 +169,20 @@ mul_n( mpi_ptr_t prodp, mpi_ptr_t up, mpi_ptr_t vp, /* Product M. ________________ * |_(U1-U0)(V0-V1)_| */ - if( mpihelp_cmp(up + hsize, up, hsize) >= 0 ) { - mpihelp_sub_n(prodp, up + hsize, up, hsize); + if( _gcry_mpih_cmp(up + hsize, up, hsize) >= 0 ) { + _gcry_mpih_sub_n(prodp, up + hsize, up, hsize); negflg = 0; } else { - mpihelp_sub_n(prodp, up, up + hsize, hsize); + _gcry_mpih_sub_n(prodp, up, up + hsize, hsize); negflg = 1; } - if( mpihelp_cmp(vp + hsize, vp, hsize) >= 0 ) { - mpihelp_sub_n(prodp + hsize, vp + hsize, vp, hsize); + if( _gcry_mpih_cmp(vp + hsize, vp, hsize) >= 0 ) { + _gcry_mpih_sub_n(prodp + hsize, vp + hsize, vp, hsize); negflg ^= 1; } else { - mpihelp_sub_n(prodp + hsize, vp, vp + hsize, hsize); + _gcry_mpih_sub_n(prodp + hsize, vp, vp + hsize, hsize); /* No change of NEGFLG. */ } /* Read temporary operands from low part of PROD. @@ -193,14 +193,14 @@ mul_n( mpi_ptr_t prodp, mpi_ptr_t up, mpi_ptr_t vp, /* Add/copy product H. */ MPN_COPY (prodp + hsize, prodp + size, hsize); - cy = mpihelp_add_n( prodp + size, prodp + size, + cy = _gcry_mpih_add_n( prodp + size, prodp + size, prodp + size + hsize, hsize); /* Add product M (if NEGFLG M is a negative number) */ if(negflg) - cy -= mpihelp_sub_n(prodp + hsize, prodp + hsize, tspace, size); + cy -= _gcry_mpih_sub_n(prodp + hsize, prodp + hsize, tspace, size); else - cy += mpihelp_add_n(prodp + hsize, prodp + hsize, tspace, size); + cy += _gcry_mpih_add_n(prodp + hsize, prodp + hsize, tspace, size); /* Product L. ________________ ________________ * |________________||____U0 x V0_____| @@ -212,20 +212,20 @@ mul_n( mpi_ptr_t prodp, mpi_ptr_t up, mpi_ptr_t vp, /* Add/copy Product L (twice) */ - cy += mpihelp_add_n(prodp + hsize, prodp + hsize, tspace, size); + cy += _gcry_mpih_add_n(prodp + hsize, prodp + hsize, tspace, size); if( cy ) - mpihelp_add_1(prodp + hsize + size, prodp + hsize + size, hsize, cy); + _gcry_mpih_add_1(prodp + hsize + size, prodp + hsize + size, hsize, cy); MPN_COPY(prodp, tspace, hsize); - cy = mpihelp_add_n(prodp + hsize, prodp + hsize, tspace + hsize, hsize); + cy = _gcry_mpih_add_n(prodp + hsize, prodp + hsize, tspace + hsize, hsize); if( cy ) - mpihelp_add_1(prodp + size, prodp + size, size, 1); + _gcry_mpih_add_1(prodp + size, prodp + size, size, 1); } } void -mpih_sqr_n_basecase( mpi_ptr_t prodp, mpi_ptr_t up, mpi_size_t size ) +_gcry_mpih_sqr_n_basecase( mpi_ptr_t prodp, mpi_ptr_t up, mpi_size_t size ) { mpi_size_t i; mpi_limb_t cy_limb; @@ -242,7 +242,7 @@ mpih_sqr_n_basecase( mpi_ptr_t prodp, mpi_ptr_t up, mpi_size_t size ) cy_limb = 0; } else - cy_limb = mpihelp_mul_1( prodp, up, size, v_limb ); + cy_limb = _gcry_mpih_mul_1( prodp, up, size, v_limb ); prodp[size] = cy_limb; prodp++; @@ -254,10 +254,10 @@ mpih_sqr_n_basecase( mpi_ptr_t prodp, mpi_ptr_t up, mpi_size_t size ) if( v_limb <= 1 ) { cy_limb = 0; if( v_limb == 1 ) - cy_limb = mpihelp_add_n(prodp, prodp, up, size); + cy_limb = _gcry_mpih_add_n(prodp, prodp, up, size); } else - cy_limb = mpihelp_addmul_1(prodp, up, size, v_limb); + cy_limb = _gcry_mpih_addmul_1(prodp, up, size, v_limb); prodp[size] = cy_limb; prodp++; @@ -266,7 +266,8 @@ mpih_sqr_n_basecase( mpi_ptr_t prodp, mpi_ptr_t up, mpi_size_t size ) void -mpih_sqr_n( mpi_ptr_t prodp, mpi_ptr_t up, mpi_size_t size, mpi_ptr_t tspace) +_gcry_mpih_sqr_n( mpi_ptr_t prodp, + mpi_ptr_t up, mpi_size_t size, mpi_ptr_t tspace) { if( size & 1 ) { /* The size is odd, and the code below doesn't handle that. @@ -283,9 +284,9 @@ mpih_sqr_n( mpi_ptr_t prodp, mpi_ptr_t up, mpi_size_t size, mpi_ptr_t tspace) mpi_limb_t cy_limb; MPN_SQR_N_RECURSE( prodp, up, esize, tspace ); - cy_limb = mpihelp_addmul_1( prodp + esize, up, esize, up[esize] ); + cy_limb = _gcry_mpih_addmul_1( prodp + esize, up, esize, up[esize] ); prodp[esize + esize] = cy_limb; - cy_limb = mpihelp_addmul_1( prodp + esize, up, size, up[esize] ); + cy_limb = _gcry_mpih_addmul_1( prodp + esize, up, size, up[esize] ); prodp[esize + size] = cy_limb; } @@ -303,10 +304,10 @@ mpih_sqr_n( mpi_ptr_t prodp, mpi_ptr_t up, mpi_size_t size, mpi_ptr_t tspace) /* Product M. ________________ * |_(U1-U0)(U0-U1)_| */ - if( mpihelp_cmp( up + hsize, up, hsize) >= 0 ) - mpihelp_sub_n( prodp, up + hsize, up, hsize); + if( _gcry_mpih_cmp( up + hsize, up, hsize) >= 0 ) + _gcry_mpih_sub_n( prodp, up + hsize, up, hsize); else - mpihelp_sub_n (prodp, up, up + hsize, hsize); + _gcry_mpih_sub_n (prodp, up, up + hsize, hsize); /* Read temporary operands from low part of PROD. * Put result in low part of TSPACE using upper part of TSPACE @@ -315,11 +316,11 @@ mpih_sqr_n( mpi_ptr_t prodp, mpi_ptr_t up, mpi_size_t size, mpi_ptr_t tspace) /* Add/copy product H */ MPN_COPY(prodp + hsize, prodp + size, hsize); - cy = mpihelp_add_n(prodp + size, prodp + size, + cy = _gcry_mpih_add_n(prodp + size, prodp + size, prodp + size + hsize, hsize); /* Add product M (if NEGFLG M is a negative number). */ - cy -= mpihelp_sub_n (prodp + hsize, prodp + hsize, tspace, size); + cy -= _gcry_mpih_sub_n (prodp + hsize, prodp + hsize, tspace, size); /* Product L. ________________ ________________ * |________________||____U0 x U0_____| @@ -329,33 +330,34 @@ mpih_sqr_n( mpi_ptr_t prodp, mpi_ptr_t up, mpi_size_t size, mpi_ptr_t tspace) MPN_SQR_N_RECURSE (tspace, up, hsize, tspace + size); /* Add/copy Product L (twice). */ - cy += mpihelp_add_n (prodp + hsize, prodp + hsize, tspace, size); + cy += _gcry_mpih_add_n (prodp + hsize, prodp + hsize, tspace, size); if( cy ) - mpihelp_add_1(prodp + hsize + size, prodp + hsize + size, + _gcry_mpih_add_1(prodp + hsize + size, prodp + hsize + size, hsize, cy); MPN_COPY(prodp, tspace, hsize); - cy = mpihelp_add_n (prodp + hsize, prodp + hsize, tspace + hsize, hsize); + cy = _gcry_mpih_add_n (prodp + hsize, prodp + hsize, tspace + hsize, hsize); if( cy ) - mpihelp_add_1 (prodp + size, prodp + size, size, 1); + _gcry_mpih_add_1 (prodp + size, prodp + size, size, 1); } } /* This should be made into an inline function in gmp.h. */ void -mpihelp_mul_n( mpi_ptr_t prodp, mpi_ptr_t up, mpi_ptr_t vp, mpi_size_t size) +_gcry_mpih_mul_n( mpi_ptr_t prodp, + mpi_ptr_t up, mpi_ptr_t vp, mpi_size_t size) { int secure; if( up == vp ) { if( size < KARATSUBA_THRESHOLD ) - mpih_sqr_n_basecase( prodp, up, size ); + _gcry_mpih_sqr_n_basecase( prodp, up, size ); else { mpi_ptr_t tspace; - secure = g10_is_secure( up ); + secure = gcry_is_secure( up ); tspace = mpi_alloc_limb_space( 2 * size, secure ); - mpih_sqr_n( prodp, up, size, tspace ); + _gcry_mpih_sqr_n( prodp, up, size, tspace ); mpi_free_limb_space( tspace ); } } @@ -364,7 +366,7 @@ mpihelp_mul_n( mpi_ptr_t prodp, mpi_ptr_t up, mpi_ptr_t vp, mpi_size_t size) mul_n_basecase( prodp, up, vp, size ); else { mpi_ptr_t tspace; - secure = g10_is_secure( up ) || g10_is_secure( vp ); + secure = gcry_is_secure( up ) || gcry_is_secure( vp ); tspace = mpi_alloc_limb_space( 2 * size, secure ); mul_n (prodp, up, vp, size, tspace); mpi_free_limb_space( tspace ); @@ -375,10 +377,10 @@ mpihelp_mul_n( mpi_ptr_t prodp, mpi_ptr_t up, mpi_ptr_t vp, mpi_size_t size) void -mpihelp_mul_karatsuba_case( mpi_ptr_t prodp, - mpi_ptr_t up, mpi_size_t usize, - mpi_ptr_t vp, mpi_size_t vsize, - struct karatsuba_ctx *ctx ) +_gcry_mpih_mul_karatsuba_case( mpi_ptr_t prodp, + mpi_ptr_t up, mpi_size_t usize, + mpi_ptr_t vp, mpi_size_t vsize, + struct karatsuba_ctx *ctx ) { mpi_limb_t cy; @@ -386,7 +388,7 @@ mpihelp_mul_karatsuba_case( mpi_ptr_t prodp, if( ctx->tspace ) mpi_free_limb_space( ctx->tspace ); ctx->tspace = mpi_alloc_limb_space( 2 * vsize, - g10_is_secure( up ) || g10_is_secure( vp ) ); + gcry_is_secure( up ) || gcry_is_secure( vp ) ); ctx->tspace_size = vsize; } @@ -399,15 +401,15 @@ mpihelp_mul_karatsuba_case( mpi_ptr_t prodp, if( !ctx->tp || ctx->tp_size < vsize ) { if( ctx->tp ) mpi_free_limb_space( ctx->tp ); - ctx->tp = mpi_alloc_limb_space( 2 * vsize, g10_is_secure( up ) - || g10_is_secure( vp ) ); + ctx->tp = mpi_alloc_limb_space( 2 * vsize, gcry_is_secure( up ) + || gcry_is_secure( vp ) ); ctx->tp_size = vsize; } do { MPN_MUL_N_RECURSE( ctx->tp, up, vp, vsize, ctx->tspace ); - cy = mpihelp_add_n( prodp, prodp, ctx->tp, vsize ); - mpihelp_add_1( prodp + vsize, ctx->tp + vsize, vsize, cy ); + cy = _gcry_mpih_add_n( prodp, prodp, ctx->tp, vsize ); + _gcry_mpih_add_1( prodp + vsize, ctx->tp + vsize, vsize, cy ); prodp += vsize; up += vsize; usize -= vsize; @@ -416,26 +418,26 @@ mpihelp_mul_karatsuba_case( mpi_ptr_t prodp, if( usize ) { if( usize < KARATSUBA_THRESHOLD ) { - mpihelp_mul( ctx->tspace, vp, vsize, up, usize ); + _gcry_mpih_mul( ctx->tspace, vp, vsize, up, usize ); } else { if( !ctx->next ) { - ctx->next = g10_xcalloc( 1, sizeof *ctx ); + ctx->next = gcry_xcalloc( 1, sizeof *ctx ); } - mpihelp_mul_karatsuba_case( ctx->tspace, + _gcry_mpih_mul_karatsuba_case( ctx->tspace, vp, vsize, up, usize, ctx->next ); } - cy = mpihelp_add_n( prodp, prodp, ctx->tspace, vsize); - mpihelp_add_1( prodp + vsize, ctx->tspace + vsize, usize, cy ); + cy = _gcry_mpih_add_n( prodp, prodp, ctx->tspace, vsize); + _gcry_mpih_add_1( prodp + vsize, ctx->tspace + vsize, usize, cy ); } } void -mpihelp_release_karatsuba_ctx( struct karatsuba_ctx *ctx ) +_gcry_mpih_release_karatsuba_ctx( struct karatsuba_ctx *ctx ) { struct karatsuba_ctx *ctx2; @@ -449,7 +451,7 @@ mpihelp_release_karatsuba_ctx( struct karatsuba_ctx *ctx ) mpi_free_limb_space( ctx->tp ); if( ctx->tspace ) mpi_free_limb_space( ctx->tspace ); - g10_free( ctx ); + gcry_free( ctx ); } } @@ -469,8 +471,8 @@ mpihelp_release_karatsuba_ctx( struct karatsuba_ctx *ctx ) */ mpi_limb_t -mpihelp_mul( mpi_ptr_t prodp, mpi_ptr_t up, mpi_size_t usize, - mpi_ptr_t vp, mpi_size_t vsize) +_gcry_mpih_mul( mpi_ptr_t prodp, mpi_ptr_t up, mpi_size_t usize, + mpi_ptr_t vp, mpi_size_t vsize) { mpi_ptr_t prod_endp = prodp + usize + vsize - 1; mpi_limb_t cy; @@ -494,7 +496,7 @@ mpihelp_mul( mpi_ptr_t prodp, mpi_ptr_t up, mpi_size_t usize, cy = 0; } else - cy = mpihelp_mul_1( prodp, up, usize, v_limb ); + cy = _gcry_mpih_mul_1( prodp, up, usize, v_limb ); prodp[usize] = cy; prodp++; @@ -506,10 +508,10 @@ mpihelp_mul( mpi_ptr_t prodp, mpi_ptr_t up, mpi_size_t usize, if( v_limb <= 1 ) { cy = 0; if( v_limb == 1 ) - cy = mpihelp_add_n(prodp, prodp, up, usize); + cy = _gcry_mpih_add_n(prodp, prodp, up, usize); } else - cy = mpihelp_addmul_1(prodp, up, usize, v_limb); + cy = _gcry_mpih_addmul_1(prodp, up, usize, v_limb); prodp[usize] = cy; prodp++; @@ -519,8 +521,8 @@ mpihelp_mul( mpi_ptr_t prodp, mpi_ptr_t up, mpi_size_t usize, } memset( &ctx, 0, sizeof ctx ); - mpihelp_mul_karatsuba_case( prodp, up, usize, vp, vsize, &ctx ); - mpihelp_release_karatsuba_ctx( &ctx ); + _gcry_mpih_mul_karatsuba_case( prodp, up, usize, vp, vsize, &ctx ); + _gcry_mpih_release_karatsuba_ctx( &ctx ); return *prod_endp; } diff --git a/mpi/mpiutil.c b/mpi/mpiutil.c index c38c0083..6946e20a 100644 --- a/mpi/mpiutil.c +++ b/mpi/mpiutil.c @@ -1,5 +1,5 @@ /* mpiutil.ac - Utility functions for MPI - * Copyright (C) 1998, 2000 Free Software Foundation, Inc. + * Copyright (C) 1998, 2000, 2001 Free Software Foundation, Inc. * * This file is part of Libgcrypt. * @@ -36,11 +36,11 @@ * But mpi_alloc is used in a lot of places :-) */ MPI -mpi_alloc( unsigned nlimbs ) +_gcry_mpi_alloc( unsigned nlimbs ) { MPI a; - a = g10_xmalloc( sizeof *a ); + a = gcry_xmalloc( sizeof *a ); a->d = nlimbs? mpi_alloc_limb_space( nlimbs, 0 ) : NULL; a->alloced = nlimbs; a->nlimbs = 0; @@ -50,18 +50,18 @@ mpi_alloc( unsigned nlimbs ) } void -mpi_m_check( MPI a ) +_gcry_mpi_m_check( MPI a ) { - g10_check_heap(a); - g10_check_heap(a->d); + _gcry_check_heap(a); + _gcry_check_heap(a->d); } MPI -mpi_alloc_secure( unsigned nlimbs ) +_gcry_mpi_alloc_secure( unsigned nlimbs ) { MPI a; - a = g10_xmalloc( sizeof *a ); + a = gcry_xmalloc( sizeof *a ); a->d = nlimbs? mpi_alloc_limb_space( nlimbs, 1 ) : NULL; a->alloced = nlimbs; a->flags = 1; @@ -73,27 +73,27 @@ mpi_alloc_secure( unsigned nlimbs ) mpi_ptr_t -mpi_alloc_limb_space( unsigned nlimbs, int secure ) +_gcry_mpi_alloc_limb_space( unsigned nlimbs, int secure ) { size_t len = nlimbs * sizeof(mpi_limb_t); mpi_ptr_t p; - p = secure? g10_xmalloc_secure( len ) : g10_xmalloc( len ); + p = secure? gcry_xmalloc_secure( len ) : gcry_xmalloc( len ); return p; } void -mpi_free_limb_space( mpi_ptr_t a ) +_gcry_mpi_free_limb_space( mpi_ptr_t a ) { if( !a ) return; - g10_free(a); + gcry_free(a); } void -mpi_assign_limb_space( MPI a, mpi_ptr_t ap, unsigned nlimbs ) +_gcry_mpi_assign_limb_space( MPI a, mpi_ptr_t ap, unsigned nlimbs ) { mpi_free_limb_space(a->d); a->d = ap; @@ -104,27 +104,27 @@ mpi_assign_limb_space( MPI a, mpi_ptr_t ap, unsigned nlimbs ) /**************** * Resize the array of A to NLIMBS. the additional space is cleared - * (set to 0) [done by g10_realloc()] + * (set to 0) [done by gcry_realloc()] */ void -mpi_resize( MPI a, unsigned nlimbs ) +_gcry_mpi_resize( MPI a, unsigned nlimbs ) { if( nlimbs <= a->alloced ) return; /* no need to do it */ /* Note: a->secure is not used - instead the realloc functions * take care of it. Maybe we should drop a->secure completely * and rely on a mpi_is_secure function, which would be - * a wrapper around g10_is_secure + * a wrapper around gcry_is_secure */ if( a->d ) - a->d = g10_xrealloc(a->d, nlimbs * sizeof(mpi_limb_t) ); + a->d = gcry_xrealloc(a->d, nlimbs * sizeof(mpi_limb_t) ); else /* FIXME: It may not be allocted in secure memory */ - a->d = g10_xcalloc( nlimbs , sizeof(mpi_limb_t) ); + a->d = gcry_xcalloc( nlimbs , sizeof(mpi_limb_t) ); a->alloced = nlimbs; } void -mpi_clear( MPI a ) +_gcry_mpi_clear( MPI a ) { a->nlimbs = 0; a->flags = 0; @@ -132,18 +132,18 @@ mpi_clear( MPI a ) void -mpi_free( MPI a ) +_gcry_mpi_free( MPI a ) { if( !a ) return; if( a->flags & 4 ) - g10_free( a->d ); + gcry_free( a->d ); else { mpi_free_limb_space(a->d); } if( a->flags & ~7 ) log_bug("invalid flag value in mpi\n"); - g10_free(a); + gcry_free(a); } static void @@ -174,7 +174,7 @@ gcry_mpi_set_opaque( MPI a, void *p, unsigned int nbits ) } if( a->flags & 4 ) - g10_free( a->d ); + gcry_free( a->d ); else { mpi_free_limb_space(a->d); } @@ -204,14 +204,14 @@ gcry_mpi_get_opaque( MPI a, unsigned int *nbits ) * but copy it transparently. */ MPI -mpi_copy( MPI a ) +_gcry_mpi_copy( MPI a ) { int i; MPI b; if( a && (a->flags & 4) ) { - void *p = g10_is_secure(a->d)? g10_xmalloc_secure( (a->sign+7)/8 ) - : g10_xmalloc( (a->sign+7)/8 ); + void *p = gcry_is_secure(a->d)? gcry_xmalloc_secure( (a->sign+7)/8 ) + : gcry_xmalloc( (a->sign+7)/8 ); memcpy( p, a->d, (a->sign+7)/8 ); b = gcry_mpi_set_opaque( NULL, p, a->sign ); } @@ -232,18 +232,18 @@ mpi_copy( MPI a ) /**************** * This function allocates an MPI which is optimized to hold - * a value as large as the one given in the arhgument and allocates it + * a value as large as the one given in the argument and allocates it * with the same flags as A. */ MPI -mpi_alloc_like( MPI a ) +_gcry_mpi_alloc_like( MPI a ) { MPI b; if( a && (a->flags & 4) ) { int n = (a->sign+7)/8; - void *p = g10_is_secure(a->d)? g10_malloc_secure( n ) - : g10_malloc( n ); + void *p = gcry_is_secure(a->d)? gcry_malloc_secure( n ) + : gcry_malloc( n ); memcpy( p, a->d, n ); b = gcry_mpi_set_opaque( NULL, p, a->sign ); } @@ -261,7 +261,7 @@ mpi_alloc_like( MPI a ) void -mpi_set( MPI w, MPI u) +_gcry_mpi_set( MPI w, MPI u) { mpi_ptr_t wp, up; mpi_size_t usize = u->nlimbs; @@ -278,7 +278,7 @@ mpi_set( MPI w, MPI u) void -mpi_set_ui( MPI w, unsigned long u) +_gcry_mpi_set_ui( MPI w, unsigned long u) { RESIZE_IF_NEEDED(w, 1); w->d[0] = u; @@ -289,7 +289,7 @@ mpi_set_ui( MPI w, unsigned long u) MPI -mpi_alloc_set_ui( unsigned long u) +_gcry_mpi_alloc_set_ui( unsigned long u) { MPI w = mpi_alloc(1); w->d[0] = u; @@ -300,7 +300,7 @@ mpi_alloc_set_ui( unsigned long u) void -mpi_swap( MPI a, MPI b) +_gcry_mpi_swap( MPI a, MPI b) { struct gcry_mpi tmp; @@ -311,34 +311,34 @@ mpi_swap( MPI a, MPI b) GCRY_MPI gcry_mpi_new( unsigned int nbits ) { - return mpi_alloc( (nbits+BITS_PER_MPI_LIMB-1) / BITS_PER_MPI_LIMB ); + return _gcry_mpi_alloc( (nbits+BITS_PER_MPI_LIMB-1) / BITS_PER_MPI_LIMB ); } GCRY_MPI gcry_mpi_snew( unsigned int nbits ) { - return mpi_alloc_secure( (nbits+BITS_PER_MPI_LIMB-1) / BITS_PER_MPI_LIMB ); + return _gcry_mpi_alloc_secure( (nbits+BITS_PER_MPI_LIMB-1) / BITS_PER_MPI_LIMB ); } void gcry_mpi_release( GCRY_MPI a ) { - mpi_free( a ); + _gcry_mpi_free( a ); } GCRY_MPI gcry_mpi_copy( const GCRY_MPI a ) { - return mpi_copy( (GCRY_MPI)a ); + return _gcry_mpi_copy( (GCRY_MPI)a ); } GCRY_MPI gcry_mpi_set( GCRY_MPI w, const GCRY_MPI u ) { if( !w ) - w = mpi_alloc( mpi_get_nlimbs(u) ); - mpi_set( w, (GCRY_MPI)u ); + w = _gcry_mpi_alloc( mpi_get_nlimbs(u) ); + _gcry_mpi_set( w, (GCRY_MPI)u ); return w; } @@ -346,33 +346,20 @@ GCRY_MPI gcry_mpi_set_ui( GCRY_MPI w, unsigned long u ) { if( !w ) - w = mpi_alloc(1); - mpi_set_ui( w, u ); + w = _gcry_mpi_alloc(1); + _gcry_mpi_set_ui( w, u ); return w; } -int -gcry_mpi_cmp( const GCRY_MPI u, const GCRY_MPI v ) -{ - return mpi_cmp( (GCRY_MPI)u, (GCRY_MPI)v ); -} - -int -gcry_mpi_cmp_ui( const GCRY_MPI u, unsigned long v ) -{ - return mpi_cmp_ui( (GCRY_MPI)u, v ); -} - - void gcry_mpi_randomize( GCRY_MPI w, unsigned int nbits, enum gcry_random_level level ) { char *p = mpi_is_secure(w) ? gcry_random_bytes( (nbits+7)/8, level ) : gcry_random_bytes_secure( (nbits+7)/8, level ); - mpi_set_buffer( w, p, (nbits+7)/8, 0 ); - g10_free(p); + _gcry_mpi_set_buffer( w, p, (nbits+7)/8, 0 ); + gcry_free(p); } @@ -406,4 +393,3 @@ gcry_mpi_get_flag( GCRY_MPI a, enum gcry_mpi_flag flag ) } } - diff --git a/mpi/pa7100/mpih-lshift.S b/mpi/pa7100/mpih-lshift.S index 76368fe7..acd3067e 100644 --- a/mpi/pa7100/mpih-lshift.S +++ b/mpi/pa7100/mpih-lshift.S @@ -25,15 +25,15 @@ /******************* * mpi_limb_t - * mpihelp_lshift( mpi_ptr_t wp, (gr26) + * _gcry_mpih_lshift( mpi_ptr_t wp, (gr26) * mpi_ptr_t up, (gr25) * mpi_size_t usize, (gr24) * unsigned cnt) (gr23) */ .code - .export mpihelp_lshift - .label mpihelp_lshift + .export _gcry_mpih_lshift + .label _gcry_mpih_lshift .proc .callinfo frame=64,no_calls .entry diff --git a/mpi/pa7100/mpih-rshift.S b/mpi/pa7100/mpih-rshift.S index 3bada7ce..4858c44a 100644 --- a/mpi/pa7100/mpih-rshift.S +++ b/mpi/pa7100/mpih-rshift.S @@ -25,15 +25,15 @@ /******************* * mpi_limb_t - * mpihelp_rshift( mpi_ptr_t wp, (gr26) + * _gcry_mpih_rshift( mpi_ptr_t wp, (gr26) * mpi_ptr_t up, (gr25) * mpi_size_t usize, (gr24) * unsigned cnt) (gr23) */ .code - .export mpihelp_rshift - .label mpihelp_rshift + .export _gcry_mpih_rshift + .label _gcry_mpih_rshift .proc .callinfo frame=64,no_calls .entry diff --git a/mpi/power/mpih-add1.S b/mpi/power/mpih-add1.S index 7313ac61..ee9571a6 100644 --- a/mpi/power/mpih-add1.S +++ b/mpi/power/mpih-add1.S @@ -31,17 +31,17 @@ */ .toc - .extern mpihelp_add_n[DS] - .extern .mpihelp_add_n + .extern _gcry_mpih_add_n[DS] + .extern ._gcry_mpih_add_n .csect [PR] .align 2 - .globl mpihelp_add_n - .globl .mpihelp_add_n - .csect mpihelp_add_n[DS] -mpihelp_add_n: - .long .mpihelp_add_n, TOC[tc0], 0 + .globl _gcry_mpih_add_n + .globl ._gcry_mpih_add_n + .csect _gcry_mpih_add_n[DS] +_gcry_mpih_add_n: + .long ._gcry_mpih_add_n, TOC[tc0], 0 .csect [PR] -.mpihelp_add_n: +._gcry_mpih_add_n: andil. 10,6,1 # odd or even number of limbs? l 8,0(4) # load least significant s1 limb l 0,0(5) # load least significant s2 limb diff --git a/mpi/power/mpih-lshift.S b/mpi/power/mpih-lshift.S index 20cf4535..a012a4e0 100644 --- a/mpi/power/mpih-lshift.S +++ b/mpi/power/mpih-lshift.S @@ -31,17 +31,17 @@ */ .toc - .extern mpihelp_lshift[DS] - .extern .mpihelp_lshift + .extern _gcry_mpih_lshift[DS] + .extern ._gcry_mpih_lshift .csect [PR] .align 2 - .globl mpihelp_lshift - .globl .mpihelp_lshift - .csect mpihelp_lshift[DS] -mpihelp_lshift: - .long .mpihelp_lshift, TOC[tc0], 0 + .globl _gcry_mpih_lshift + .globl ._gcry_mpih_lshift + .csect _gcry_mpih_lshift[DS] +_gcry_mpih_lshift: + .long ._gcry_mpih_lshift, TOC[tc0], 0 .csect [PR] -.mpihelp_lshift: +._gcry_mpih_lshift: sli 0,5,2 cax 9,3,0 cax 4,4,0 diff --git a/mpi/power/mpih-mul1.S b/mpi/power/mpih-mul1.S index 03fff4f9..e770e3b8 100644 --- a/mpi/power/mpih-mul1.S +++ b/mpi/power/mpih-mul1.S @@ -42,15 +42,15 @@ */ .toc - .csect .mpihelp_mul_1[PR] + .csect ._gcry_mpih_mul_1[PR] .align 2 - .globl mpihelp_mul_1 - .globl .mpihelp_mul_1 - .csect mpihelp_mul_1[DS] -mpihelp_mul_1: - .long .mpihelp_mul_1[PR], TOC[tc0], 0 - .csect .mpihelp_mul_1[PR] -.mpihelp_mul_1: + .globl _gcry_mpih_mul_1 + .globl ._gcry_mpih_mul_1 + .csect _gcry_mpih_mul_1[DS] +_gcry_mpih_mul_1: + .long ._gcry_mpih_mul_1[PR], TOC[tc0], 0 + .csect ._gcry_mpih_mul_1[PR] +._gcry_mpih_mul_1: cal 3,-4(3) l 0,0(4) diff --git a/mpi/power/mpih-mul2.S b/mpi/power/mpih-mul2.S index 3d7fc153..1fcb0333 100644 --- a/mpi/power/mpih-mul2.S +++ b/mpi/power/mpih-mul2.S @@ -44,15 +44,15 @@ */ .toc - .csect .mpihelp_addmul_1[PR] + .csect ._gcry_mpih_addmul_1[PR] .align 2 - .globl mpihelp_addmul_1 - .globl .mpihelp_addmul_1 - .csect mpihelp_addmul_1[DS] -mpihelp_addmul_1: - .long .mpihelp_addmul_1[PR], TOC[tc0], 0 - .csect .mpihelp_addmul_1[PR] -.mpihelp_addmul_1: + .globl _gcry_mpih_addmul_1 + .globl ._gcry_mpih_addmul_1 + .csect _gcry_mpih_addmul_1[DS] +_gcry_mpih_addmul_1: + .long ._gcry_mpih_addmul_1[PR], TOC[tc0], 0 + .csect ._gcry_mpih_addmul_1[PR] +._gcry_mpih_addmul_1: cal 3,-4(3) l 0,0(4) diff --git a/mpi/power/mpih-mul3.S b/mpi/power/mpih-mul3.S index f94018ca..92308df5 100644 --- a/mpi/power/mpih-mul3.S +++ b/mpi/power/mpih-mul3.S @@ -44,15 +44,15 @@ */ .toc - .csect .mpihelp_submul_1[PR] + .csect ._gcry_mpih_submul_1[PR] .align 2 - .globl mpihelp_submul_1 - .globl .mpihelp_submul_1 - .csect mpihelp_submul_1[DS] -mpihelp_submul_1: - .long .mpihelp_submul_1[PR], TOC[tc0], 0 - .csect .mpihelp_submul_1[PR] -.mpihelp_submul_1: + .globl _gcry_mpih_submul_1 + .globl ._gcry_mpih_submul_1 + .csect _gcry_mpih_submul_1[DS] +_gcry_mpih_submul_1: + .long ._gcry_mpih_submul_1[PR], TOC[tc0], 0 + .csect ._gcry_mpih_submul_1[PR] +._gcry_mpih_submul_1: cal 3,-4(3) l 0,0(4) diff --git a/mpi/power/mpih-rshift.S b/mpi/power/mpih-rshift.S index 04fb5942..848d764e 100644 --- a/mpi/power/mpih-rshift.S +++ b/mpi/power/mpih-rshift.S @@ -32,17 +32,17 @@ */ .toc - .extern mpihelp_rshift[DS] - .extern .mpihelp_rshift + .extern _gcry_mpih_rshift[DS] + .extern ._gcry_mpih_rshift .csect [PR] .align 2 - .globl mpihelp_rshift - .globl .mpihelp_rshift - .csect mpihelp_rshift[DS] -mpihelp_rshift: - .long .mpihelp_rshift, TOC[tc0], 0 + .globl _gcry_mpih_rshift + .globl ._gcry_mpih_rshift + .csect _gcry_mpih_rshift[DS] +_gcry_mpih_rshift: + .long ._gcry_mpih_rshift, TOC[tc0], 0 .csect [PR] -.mpihelp_rshift: +._gcry_mpih_rshift: sfi 8,6,32 mtctr 5 # put limb count in CTR loop register l 0,0(4) # read least significant limb diff --git a/mpi/power/mpih-sub1.S b/mpi/power/mpih-sub1.S index 375a5be8..14d9dbf6 100644 --- a/mpi/power/mpih-sub1.S +++ b/mpi/power/mpih-sub1.S @@ -32,17 +32,17 @@ */ .toc - .extern mpihelp_sub_n[DS] - .extern .mpihelp_sub_n + .extern _gcry_mpih_sub_n[DS] + .extern ._gcry_mpih_sub_n .csect [PR] .align 2 - .globl mpihelp_sub_n - .globl .mpihelp_sub_n - .csect mpihelp_sub_n[DS] -mpihelp_sub_n: - .long .mpihelp_sub_n, TOC[tc0], 0 + .globl _gcry_mpih_sub_n + .globl ._gcry_mpih_sub_n + .csect _gcry_mpih_sub_n[DS] +_gcry_mpih_sub_n: + .long ._gcry_mpih_sub_n, TOC[tc0], 0 .csect [PR] -.mpihelp_sub_n: +._gcry_mpih_sub_n: andil. 10,6,1 # odd or even number of limbs? l 8,0(4) # load least significant s1 limb l 0,0(5) # load least significant s2 limb diff --git a/mpi/powerpc32/mpih-add1.S b/mpi/powerpc32/mpih-add1.S index 81c4e20f..12841604 100644 --- a/mpi/powerpc32/mpih-add1.S +++ b/mpi/powerpc32/mpih-add1.S @@ -27,24 +27,24 @@ /******************* * mpi_limb_t - * mpihelp_add_n( mpi_ptr_t res_ptr, (r3) + * _gcry_mpih_add_n( mpi_ptr_t res_ptr, (r3) * mpi_ptr_t s1_ptr, (r4) * mpi_ptr_t s2_ptr, (r5) * mpi_size_t size) (r6) */ .toc - .extern mpihelp_add_n[DS] - .extern .mpihelp_add_n + .extern _gcry_mpih_add_n[DS] + .extern ._gcry_mpih_add_n .csect [PR] .align 2 - .globl mpihelp_add_n - .globl .mpihelp_add_n - .csect mpihelp_add_n[DS] -mpihelp_add_n: - .long .mpihelp_add_n, TOC[tc0], 0 + .globl _gcry_mpih_add_n + .globl ._gcry_mpih_add_n + .csect _gcry_mpih_add_n[DS] +_gcry_mpih_add_n: + .long ._gcry_mpih_add_n, TOC[tc0], 0 .csect [PR] -.mpihelp_add_n: +._gcry_mpih_add_n: mtctr 6 # copy size into CTR lwz 8,0(4) # load least significant s1 limb lwz 0,0(5) # load least significant s2 limb @@ -93,7 +93,7 @@ Lend: stw 7,4(3) # store ultimate result limb possible 2-unrolled inner loop will not be. Also, watch out for the alignment... */ -EALIGN(mpihelp_add_n,3,0) +EALIGN(_gcry_mpih_add_n,3,0) /* Set up for loop below. */ mtcrf 0x01,%r6 srwi. %r7,%r6,1 @@ -131,6 +131,6 @@ EALIGN(mpihelp_add_n,3,0) /* Return the carry. */ 1: addze %r3,%r10 blr -END(mpihelp_add_n) +END(_gcry_mpih_add_n) #endif diff --git a/mpi/powerpc32/mpih-lshift.S b/mpi/powerpc32/mpih-lshift.S index 20ca7f92..73b025a1 100644 --- a/mpi/powerpc32/mpih-lshift.S +++ b/mpi/powerpc32/mpih-lshift.S @@ -27,7 +27,7 @@ /******************* * mpi_limb_t - * mpihelp_lshift( mpi_ptr_t wp, (r3) + * _gcry_mpih_lshift( mpi_ptr_t wp, (r3) * mpi_ptr_t up, (r4) * mpi_size_t usize, (r5) * unsigned cnt) (r6) @@ -36,13 +36,13 @@ .toc .csect .text[PR] .align 2 - .globl mpihelp_lshift - .globl .mpihelp_lshift - .csect mpihelp_lshift[DS] -mpihelp_lshift: - .long .mpihelp_lshift, TOC[tc0], 0 + .globl _gcry_mpih_lshift + .globl ._gcry_mpih_lshift + .csect _gcry_mpih_lshift[DS] +_gcry_mpih_lshift: + .long ._gcry_mpih_lshift, TOC[tc0], 0 .csect .text[PR] -.mpihelp_lshift: +._gcry_mpih_lshift: mtctr 5 # copy size into CTR slwi 0,5,2 add 7,3,0 # make r7 point at end of res @@ -96,7 +96,7 @@ Lend2: slw 0,10,6 /* mp_limb_t mpn_lshift (mp_ptr wp, mp_srcptr up, mp_size_t usize, unsigned int cnt) */ -EALIGN(mpihelp_lshift,3,0) +EALIGN(_gcry_mpih_lshift,3,0) mtctr %r5 # copy size into CTR cmplwi %cr0,%r5,16 # is size < 16 slwi %r0,%r5,2 @@ -194,5 +194,5 @@ L(end2):slw %r0,%r10,%r6 DO_LSHIFT(30) DO_LSHIFT(31) -END(mpihelp_lshift) +END(_gcry_mpih_lshift) #endif diff --git a/mpi/powerpc32/mpih-mul1.S b/mpi/powerpc32/mpih-mul1.S index b3cb62f3..2ab7528a 100644 --- a/mpi/powerpc32/mpih-mul1.S +++ b/mpi/powerpc32/mpih-mul1.S @@ -29,7 +29,7 @@ /******************* * mpi_limb_t - * mpihelp_mul_1( mpi_ptr_t res_ptr, (r3) + * _gcry_mpih_mul_1( mpi_ptr_t res_ptr, (r3) * mpi_ptr_t s1_ptr, (r4) * mpi_size_t s1_size, (r5) * mpi_limb_t s2_limb) (r6) @@ -42,15 +42,15 @@ */ .toc - .csect .mpihelp_mul_1[PR] + .csect ._gcry_mpih_mul_1[PR] .align 2 - .globl mpihelp_mul_1 - .globl .mpihelp_mul_1 - .csect mpihelp_mul_1[DS] -mpihelp_mul_1: - .long .mpihelp_mul_1[PR], TOC[tc0], 0 - .csect .mpihelp_mul_1[PR] -.mpihelp_mul_1: + .globl _gcry_mpih_mul_1 + .globl ._gcry_mpih_mul_1 + .csect _gcry_mpih_mul_1[DS] +_gcry_mpih_mul_1: + .long ._gcry_mpih_mul_1[PR], TOC[tc0], 0 + .csect ._gcry_mpih_mul_1[PR] +._gcry_mpih_mul_1: mtctr 5 lwz 0,0(4) @@ -96,7 +96,7 @@ Lend: stw 7,4(3) mp_size_t s1_size, mp_limb_t s2_limb) Calculate s1*s2 and put result in res_ptr; return carry. */ -ENTRY(mpihelp_mul_1) +ENTRY(_gcry_mpih_mul_1) mtctr %r5 lwz %r0,0(%r4) @@ -116,5 +116,5 @@ ENTRY(mpihelp_mul_1) 1: stw %r7,4(%r3) addze %r3,%r10 blr -END(mpihelp_mul_1) +END(_gcry_mpih_mul_1) #endif diff --git a/mpi/powerpc32/mpih-mul2.S b/mpi/powerpc32/mpih-mul2.S index d3b39bc0..9c7793ed 100644 --- a/mpi/powerpc32/mpih-mul2.S +++ b/mpi/powerpc32/mpih-mul2.S @@ -28,7 +28,7 @@ /******************* * mpi_limb_t - * mpihelp_addmul_1( mpi_ptr_t res_ptr, (r3) + * _gcry_mpih_addmul_1( mpi_ptr_t res_ptr, (r3) * mpi_ptr_t s1_ptr, (r4) * mpi_size_t s1_size, (r5) * mpi_limb_t s2_limb) (r6) @@ -42,15 +42,15 @@ .toc - .csect .mpihelp_addmul_1[PR] + .csect ._gcry_mpih_addmul_1[PR] .align 2 - .globl mpihelp_addmul_1 - .globl .mpihelp_addmul_1 - .csect mpihelp_addmul_1[DS] -mpihelp_addmul_1: - .long .mpihelp_addmul_1[PR], TOC[tc0], 0 - .csect .mpihelp_addmul_1[PR] -.mpihelp_addmul_1: + .globl _gcry_mpih_addmul_1 + .globl ._gcry_mpih_addmul_1 + .csect _gcry_mpih_addmul_1[DS] +_gcry_mpih_addmul_1: + .long ._gcry_mpih_addmul_1[PR], TOC[tc0], 0 + .csect ._gcry_mpih_addmul_1[PR] +._gcry_mpih_addmul_1: mtctr 5 lwz 0,0(4) @@ -99,7 +99,7 @@ Lend: stw 8,4(3) /* mp_limb_t mpn_addmul_1 (mp_ptr res_ptr, mp_srcptr s1_ptr, mp_size_t s1_size, mp_limb_t s2_limb) Calculate res+s1*s2 and put result back in res; return carry. */ -ENTRY(mpihelp_addmul_1) +ENTRY(_gcry_mpih_addmul_1) mtctr %r5 lwz %r0,0(%r4) @@ -123,5 +123,5 @@ ENTRY(mpihelp_addmul_1) 1: stw %r8,4(%r3) addze %r3,%r10 blr -END(mpihelp_addmul_1) +END(_gcry_mpih_addmul_1) #endif diff --git a/mpi/powerpc32/mpih-mul3.S b/mpi/powerpc32/mpih-mul3.S index d84f853b..d3ffdb93 100644 --- a/mpi/powerpc32/mpih-mul3.S +++ b/mpi/powerpc32/mpih-mul3.S @@ -28,7 +28,7 @@ /******************* * mpi_limb_t - * mpihelp_submul_1( mpi_ptr_t res_ptr, (r3) + * _gcry_mpih_submul_1( mpi_ptr_t res_ptr, (r3) * mpi_ptr_t s1_ptr, (r4) * mpi_size_t s1_size, (r5) * mpi_limb_t s2_limb) (r6) @@ -41,15 +41,15 @@ */ .toc - .csect .mpihelp_submul_1[PR] + .csect ._gcry_mpih_submul_1[PR] .align 2 - .globl mpihelp_submul_1 - .globl .mpihelp_submul_1 - .csect mpihelp_submul_1[DS] -mpihelp_submul_1: - .long .mpihelp_submul_1[PR], TOC[tc0], 0 - .csect .mpihelp_submul_1[PR] -.mpihelp_submul_1: + .globl _gcry_mpih_submul_1 + .globl ._gcry_mpih_submul_1 + .csect _gcry_mpih_submul_1[DS] +_gcry_mpih_submul_1: + .long ._gcry_mpih_submul_1[PR], TOC[tc0], 0 + .csect ._gcry_mpih_submul_1[PR] +._gcry_mpih_submul_1: mtctr 5 lwz 0,0(4) @@ -100,7 +100,7 @@ Lend: stw 8,4(3) mp_size_t s1_size, mp_limb_t s2_limb) Calculate res-s1*s2 and put result back in res; return carry. */ -ENTRY(mpihelp_submul_1) +ENTRY(_gcry_mpih_submul_1) mtctr %r5 lwz %r0,0(%r4) @@ -126,5 +126,5 @@ ENTRY(mpihelp_submul_1) 1: stw %r8,4(%r3) addze %r3,%r10 blr -END(mpihelp_submul_1) +END(_gcry_mpih_submul_1) #endif diff --git a/mpi/powerpc32/mpih-rshift.S b/mpi/powerpc32/mpih-rshift.S index e9704db9..260691e7 100644 --- a/mpi/powerpc32/mpih-rshift.S +++ b/mpi/powerpc32/mpih-rshift.S @@ -28,7 +28,7 @@ /******************* * mpi_limb_t - * mpihelp_rshift( mpi_ptr_t wp, (r3) + * _gcry_mpih_rshift( mpi_ptr_t wp, (r3) * mpi_ptr_t up, (r4) * mpi_size_t usize, (r5) * unsigned cnt) (r6) @@ -37,13 +37,13 @@ .toc .csect .text[PR] .align 2 - .globl mpihelp_rshift - .globl .mpihelp_rshift - .csect mpihelp_rshift[DS] -mpihelp_rshift: - .long .mpihelp_rshift, TOC[tc0], 0 + .globl _gcry_mpih_rshift + .globl ._gcry_mpih_rshift + .csect _gcry_mpih_rshift[DS] +_gcry_mpih_rshift: + .long ._gcry_mpih_rshift, TOC[tc0], 0 .csect .text[PR] -.mpihelp_rshift: +._gcry_mpih_rshift: mtctr 5 # copy size into CTR addi 7,3,-4 # move adjusted res_ptr to free return reg subfic 8,6,32 @@ -99,7 +99,7 @@ Lend2: srw 0,10,6 size r5 cnt r6 */ -ENTRY(mpihelp_rshift) +ENTRY(_gcry_mpih_rshift) mtctr 5 # copy size into CTR addi 7,3,-4 # move adjusted res_ptr to free return reg subfic 8,6,32 @@ -127,5 +127,5 @@ ENTRY(mpihelp_rshift) 2: srw 0,10,6 stw 0,4(7) blr -END(mpihelp_rshift) +END(_gcry_mpih_rshift) #endif diff --git a/mpi/powerpc32/mpih-sub1.S b/mpi/powerpc32/mpih-sub1.S index 8c67d988..5499f0cc 100644 --- a/mpi/powerpc32/mpih-sub1.S +++ b/mpi/powerpc32/mpih-sub1.S @@ -28,24 +28,24 @@ /******************* * mpi_limb_t - * mpihelp_sub_n( mpi_ptr_t res_ptr, (r3) + * _gcry_mpih_sub_n( mpi_ptr_t res_ptr, (r3) * mpi_ptr_t s1_ptr, (r4) * mpi_ptr_t s2_ptr, (r5) * mpi_size_t size) (r6) */ .toc - .extern mpihelp_sub_n[DS] - .extern .mpihelp_sub_n + .extern _gcry_mpih_sub_n[DS] + .extern ._gcry_mpih_sub_n .csect [PR] .align 2 - .globl mpihelp_sub_n - .globl .mpihelp_sub_n - .csect mpihelp_sub_n[DS] -mpihelp_sub_n: - .long .mpihelp_sub_n, TOC[tc0], 0 + .globl _gcry_mpih_sub_n + .globl ._gcry_mpih_sub_n + .csect _gcry_mpih_sub_n[DS] +_gcry_mpih_sub_n: + .long ._gcry_mpih_sub_n, TOC[tc0], 0 .csect [PR] -.mpihelp_sub_n: +._gcry_mpih_sub_n: mtctr 6 # copy size into CTR lwz 8,0(4) # load least significant s1 limb lwz 0,0(5) # load least significant s2 limb @@ -90,7 +90,7 @@ Lend: stw 7,4(3) # store ultimate result limb possible 2-unrolled inner loop will not be. Also, watch out for the alignment... */ -EALIGN(mpihelp_sub_n,3,1) +EALIGN(_gcry_mpih_sub_n,3,1) /* Set up for loop below. */ mtcrf 0x01,%r6 srwi. %r7,%r6,1 @@ -128,5 +128,5 @@ EALIGN(mpihelp_sub_n,3,1) 1: subfe %r3,%r3,%r3 neg %r3,%r3 blr -END(mpihelp_sub_n) +END(_gcry_mpih_sub_n) #endif diff --git a/mpi/sparc32/mpih-add1.S b/mpi/sparc32/mpih-add1.S index b8faadb5..809e4d73 100644 --- a/mpi/sparc32/mpih-add1.S +++ b/mpi/sparc32/mpih-add1.S @@ -25,7 +25,7 @@ /******************* * mpi_limb_t - * mpihelp_add_n( mpi_ptr_t res_ptr, + * _gcry_mpih_add_n( mpi_ptr_t res_ptr, * mpi_ptr_t s1_ptr, * mpi_ptr_t s2_ptr, * mpi_size_t size) @@ -41,8 +41,8 @@ .text .align 4 - .global C_SYMBOL_NAME(mpihelp_add_n) -C_SYMBOL_NAME(mpihelp_add_n): + .global C_SYMBOL_NAME(_gcry_mpih_add_n) +C_SYMBOL_NAME(_gcry_mpih_add_n): xor s2_ptr,res_ptr,%g1 andcc %g1,4,%g0 bne L1 ! branch if alignment differs diff --git a/mpi/sparc32/mpih-lshift.S b/mpi/sparc32/mpih-lshift.S index b217d5e6..d5d064c0 100644 --- a/mpi/sparc32/mpih-lshift.S +++ b/mpi/sparc32/mpih-lshift.S @@ -31,8 +31,8 @@ .text .align 4 - .global C_SYMBOL_NAME(mpihelp_lshift) -C_SYMBOL_NAME(mpihelp_lshift): + .global C_SYMBOL_NAME(_gcry_mpih_lshift) +C_SYMBOL_NAME(_gcry_mpih_lshift): sll %o2,2,%g1 add %o1,%g1,%o1 ! make %o1 point at end of src ld [%o1-4],%g2 ! load first limb diff --git a/mpi/sparc32/mpih-rshift.S b/mpi/sparc32/mpih-rshift.S index 62902cbe..a517aa80 100644 --- a/mpi/sparc32/mpih-rshift.S +++ b/mpi/sparc32/mpih-rshift.S @@ -30,8 +30,8 @@ .text .align 4 - .global C_SYMBOL_NAME(mpihelp_rshift) -C_SYMBOL_NAME(mpihelp_rshift): + .global C_SYMBOL_NAME(_gcry_mpih_rshift) +C_SYMBOL_NAME(_gcry_mpih_rshift): ld [%o1],%g2 ! load first limb sub %g0,%o3,%o5 ! negate shift count add %o2,-1,%o2 diff --git a/mpi/sparc32v8/mpih-mul1.S b/mpi/sparc32v8/mpih-mul1.S index 55145006..21e8808c 100644 --- a/mpi/sparc32v8/mpih-mul1.S +++ b/mpi/sparc32v8/mpih-mul1.S @@ -41,8 +41,8 @@ .text .align 8 - .global C_SYMBOL_NAME(mpihelp_mul_1) -C_SYMBOL_NAME(mpihelp_mul_1): + .global C_SYMBOL_NAME(_gcry_mpih_mul_1) +C_SYMBOL_NAME(_gcry_mpih_mul_1): sll %o2,4,%g1 and %g1,(4-1)<<4,%g1 #if PIC diff --git a/mpi/sparc32v8/mpih-mul2.S b/mpi/sparc32v8/mpih-mul2.S index 55f37814..afe3723d 100644 --- a/mpi/sparc32v8/mpih-mul2.S +++ b/mpi/sparc32v8/mpih-mul2.S @@ -41,8 +41,8 @@ .text .align 4 - .global C_SYMBOL_NAME(mpihelp_addmul_1) -C_SYMBOL_NAME(mpihelp_addmul_1): + .global C_SYMBOL_NAME(_gcry_mpih_addmul_1) +C_SYMBOL_NAME(_gcry_mpih_addmul_1): orcc %g0,%g0,%g2 ld [%o1+0],%o4 ! 1 diff --git a/mpi/sparc32v8/mpih-mul3.S b/mpi/sparc32v8/mpih-mul3.S index cfd0a157..50bb59fb 100644 --- a/mpi/sparc32v8/mpih-mul3.S +++ b/mpi/sparc32v8/mpih-mul3.S @@ -40,8 +40,8 @@ .text .align 4 - .global C_SYMBOL_NAME(mpihelp_submul_1) -C_SYMBOL_NAME(mpihelp_submul_1): + .global C_SYMBOL_NAME(_gcry_mpih_submul_1) +C_SYMBOL_NAME(_gcry_mpih_submul_1): sub %g0,%o2,%o2 ! negate ... sll %o2,2,%o2 ! ... and scale size sub %o1,%o2,%o1 ! o1 is offset s1_ptr |