diff options
| author | djm <> | 2006-06-27 05:05:42 +0000 |
|---|---|---|
| committer | djm <> | 2006-06-27 05:05:42 +0000 |
| commit | f6198d4d0ab97685dc56be2d48715ed39fcc74b9 (patch) | |
| tree | 6e28360095ed5ba5ef1760a419c43eef4ef6946b /src/lib/libcrypto/bn/asm | |
| parent | 0ff0f9d99c40072de315264b0f602bd639e7f662 (diff) | |
| download | openbsd-f6198d4d0ab97685dc56be2d48715ed39fcc74b9.tar.gz openbsd-f6198d4d0ab97685dc56be2d48715ed39fcc74b9.tar.bz2 openbsd-f6198d4d0ab97685dc56be2d48715ed39fcc74b9.zip | |
import of openssl-0.9.7j
Diffstat (limited to 'src/lib/libcrypto/bn/asm')
| -rw-r--r-- | src/lib/libcrypto/bn/asm/ppc.pl | 23 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/asm/sparcv8plus.S | 16 |
2 files changed, 24 insertions, 15 deletions
diff --git a/src/lib/libcrypto/bn/asm/ppc.pl b/src/lib/libcrypto/bn/asm/ppc.pl index 307c7ccb35..08e0053473 100644 --- a/src/lib/libcrypto/bn/asm/ppc.pl +++ b/src/lib/libcrypto/bn/asm/ppc.pl | |||
| @@ -116,7 +116,7 @@ if ($opf =~ /32\.s/) { | |||
| 116 | $UDIV= "divwu"; # unsigned divide | 116 | $UDIV= "divwu"; # unsigned divide |
| 117 | $UCMPI= "cmplwi"; # unsigned compare with immediate | 117 | $UCMPI= "cmplwi"; # unsigned compare with immediate |
| 118 | $UCMP= "cmplw"; # unsigned compare | 118 | $UCMP= "cmplw"; # unsigned compare |
| 119 | $COUNTZ="cntlzw"; # count leading zeros | 119 | $CNTLZ= "cntlzw"; # count leading zeros |
| 120 | $SHL= "slw"; # shift left | 120 | $SHL= "slw"; # shift left |
| 121 | $SHR= "srw"; # unsigned shift right | 121 | $SHR= "srw"; # unsigned shift right |
| 122 | $SHRI= "srwi"; # unsigned shift right by immediate | 122 | $SHRI= "srwi"; # unsigned shift right by immediate |
| @@ -124,6 +124,7 @@ if ($opf =~ /32\.s/) { | |||
| 124 | $CLRU= "clrlwi"; # clear upper bits | 124 | $CLRU= "clrlwi"; # clear upper bits |
| 125 | $INSR= "insrwi"; # insert right | 125 | $INSR= "insrwi"; # insert right |
| 126 | $ROTL= "rotlwi"; # rotate left by immediate | 126 | $ROTL= "rotlwi"; # rotate left by immediate |
| 127 | $TR= "tw"; # conditional trap | ||
| 127 | } elsif ($opf =~ /64\.s/) { | 128 | } elsif ($opf =~ /64\.s/) { |
| 128 | $BITS= 64; | 129 | $BITS= 64; |
| 129 | $BNSZ= $BITS/8; | 130 | $BNSZ= $BITS/8; |
| @@ -139,7 +140,7 @@ if ($opf =~ /32\.s/) { | |||
| 139 | $UDIV= "divdu"; # unsigned divide | 140 | $UDIV= "divdu"; # unsigned divide |
| 140 | $UCMPI= "cmpldi"; # unsigned compare with immediate | 141 | $UCMPI= "cmpldi"; # unsigned compare with immediate |
| 141 | $UCMP= "cmpld"; # unsigned compare | 142 | $UCMP= "cmpld"; # unsigned compare |
| 142 | $COUNTZ="cntlzd"; # count leading zeros | 143 | $CNTLZ= "cntlzd"; # count leading zeros |
| 143 | $SHL= "sld"; # shift left | 144 | $SHL= "sld"; # shift left |
| 144 | $SHR= "srd"; # unsigned shift right | 145 | $SHR= "srd"; # unsigned shift right |
| 145 | $SHRI= "srdi"; # unsigned shift right by immediate | 146 | $SHRI= "srdi"; # unsigned shift right by immediate |
| @@ -147,6 +148,7 @@ if ($opf =~ /32\.s/) { | |||
| 147 | $CLRU= "clrldi"; # clear upper bits | 148 | $CLRU= "clrldi"; # clear upper bits |
| 148 | $INSR= "insrdi"; # insert right | 149 | $INSR= "insrdi"; # insert right |
| 149 | $ROTL= "rotldi"; # rotate left by immediate | 150 | $ROTL= "rotldi"; # rotate left by immediate |
| 151 | $TR= "td"; # conditional trap | ||
| 150 | } else { die "nonsense $opf"; } | 152 | } else { die "nonsense $opf"; } |
| 151 | 153 | ||
| 152 | ( defined shift || open STDOUT,">$opf" ) || die "can't open $opf: $!"; | 154 | ( defined shift || open STDOUT,">$opf" ) || die "can't open $opf: $!"; |
| @@ -1710,17 +1712,12 @@ Lppcasm_add_adios: | |||
| 1710 | bclr BO_ALWAYS,CR0_LT | 1712 | bclr BO_ALWAYS,CR0_LT |
| 1711 | Lppcasm_div1: | 1713 | Lppcasm_div1: |
| 1712 | xor r0,r0,r0 #r0=0 | 1714 | xor r0,r0,r0 #r0=0 |
| 1713 | $COUNTZ r7,r5 #r7 = num leading 0s in d. | 1715 | li r8,$BITS |
| 1714 | subfic r8,r7,$BITS #r8 = BN_num_bits_word(d) | 1716 | $CNTLZ. r7,r5 #r7 = num leading 0s in d. |
| 1715 | cmpi 0,0,r8,$BITS # | 1717 | bc BO_IF,CR0_EQ,Lppcasm_div2 #proceed if no leading zeros |
| 1716 | bc BO_IF,CR0_EQ,Lppcasm_div2 #proceed if (r8==$BITS) | 1718 | subf r8,r7,r8 #r8 = BN_num_bits_word(d) |
| 1717 | li r9,1 # r9=1 | 1719 | $SHR. r9,r3,r8 #are there any bits above r8'th? |
| 1718 | $SHL r10,r9,r8 # r9<<=r8 | 1720 | $TR 16,r9,r0 #if there're, signal to dump core... |
| 1719 | $UCMP 0,r3,r10 # | ||
| 1720 | bc BO_IF,CR0_GT,Lppcasm_div2 #or if (h > (1<<r8)) | ||
| 1721 | $UDIV r3,r3,r0 #if not assert(0) divide by 0! | ||
| 1722 | #that's how we signal overflow | ||
| 1723 | bclr BO_ALWAYS,CR0_LT #return. NEVER REACHED. | ||
| 1724 | Lppcasm_div2: | 1721 | Lppcasm_div2: |
| 1725 | $UCMP 0,r3,r5 #h>=d? | 1722 | $UCMP 0,r3,r5 #h>=d? |
| 1726 | bc BO_IF,CR0_LT,Lppcasm_div3 #goto Lppcasm_div3 if not | 1723 | bc BO_IF,CR0_LT,Lppcasm_div3 #goto Lppcasm_div3 if not |
diff --git a/src/lib/libcrypto/bn/asm/sparcv8plus.S b/src/lib/libcrypto/bn/asm/sparcv8plus.S index 0074dfdb75..8c56e2e7e7 100644 --- a/src/lib/libcrypto/bn/asm/sparcv8plus.S +++ b/src/lib/libcrypto/bn/asm/sparcv8plus.S | |||
| @@ -162,10 +162,14 @@ | |||
| 162 | * BN_ULONG w; | 162 | * BN_ULONG w; |
| 163 | */ | 163 | */ |
| 164 | bn_mul_add_words: | 164 | bn_mul_add_words: |
| 165 | sra %o2,%g0,%o2 ! signx %o2 | ||
| 165 | brgz,a %o2,.L_bn_mul_add_words_proceed | 166 | brgz,a %o2,.L_bn_mul_add_words_proceed |
| 166 | lduw [%o1],%g2 | 167 | lduw [%o1],%g2 |
| 167 | retl | 168 | retl |
| 168 | clr %o0 | 169 | clr %o0 |
| 170 | nop | ||
| 171 | nop | ||
| 172 | nop | ||
| 169 | 173 | ||
| 170 | .L_bn_mul_add_words_proceed: | 174 | .L_bn_mul_add_words_proceed: |
| 171 | srl %o3,%g0,%o3 ! clruw %o3 | 175 | srl %o3,%g0,%o3 ! clruw %o3 |
| @@ -260,10 +264,14 @@ bn_mul_add_words: | |||
| 260 | * BN_ULONG w; | 264 | * BN_ULONG w; |
| 261 | */ | 265 | */ |
| 262 | bn_mul_words: | 266 | bn_mul_words: |
| 267 | sra %o2,%g0,%o2 ! signx %o2 | ||
| 263 | brgz,a %o2,.L_bn_mul_words_proceeed | 268 | brgz,a %o2,.L_bn_mul_words_proceeed |
| 264 | lduw [%o1],%g2 | 269 | lduw [%o1],%g2 |
| 265 | retl | 270 | retl |
| 266 | clr %o0 | 271 | clr %o0 |
| 272 | nop | ||
| 273 | nop | ||
| 274 | nop | ||
| 267 | 275 | ||
| 268 | .L_bn_mul_words_proceeed: | 276 | .L_bn_mul_words_proceeed: |
| 269 | srl %o3,%g0,%o3 ! clruw %o3 | 277 | srl %o3,%g0,%o3 ! clruw %o3 |
| @@ -344,10 +352,14 @@ bn_mul_words: | |||
| 344 | * int n; | 352 | * int n; |
| 345 | */ | 353 | */ |
| 346 | bn_sqr_words: | 354 | bn_sqr_words: |
| 355 | sra %o2,%g0,%o2 ! signx %o2 | ||
| 347 | brgz,a %o2,.L_bn_sqr_words_proceeed | 356 | brgz,a %o2,.L_bn_sqr_words_proceeed |
| 348 | lduw [%o1],%g2 | 357 | lduw [%o1],%g2 |
| 349 | retl | 358 | retl |
| 350 | clr %o0 | 359 | clr %o0 |
| 360 | nop | ||
| 361 | nop | ||
| 362 | nop | ||
| 351 | 363 | ||
| 352 | .L_bn_sqr_words_proceeed: | 364 | .L_bn_sqr_words_proceeed: |
| 353 | andcc %o2,-4,%g0 | 365 | andcc %o2,-4,%g0 |
| @@ -445,6 +457,7 @@ bn_div_words: | |||
| 445 | * int n; | 457 | * int n; |
| 446 | */ | 458 | */ |
| 447 | bn_add_words: | 459 | bn_add_words: |
| 460 | sra %o3,%g0,%o3 ! signx %o3 | ||
| 448 | brgz,a %o3,.L_bn_add_words_proceed | 461 | brgz,a %o3,.L_bn_add_words_proceed |
| 449 | lduw [%o1],%o4 | 462 | lduw [%o1],%o4 |
| 450 | retl | 463 | retl |
| @@ -454,7 +467,6 @@ bn_add_words: | |||
| 454 | andcc %o3,-4,%g0 | 467 | andcc %o3,-4,%g0 |
| 455 | bz,pn %icc,.L_bn_add_words_tail | 468 | bz,pn %icc,.L_bn_add_words_tail |
| 456 | addcc %g0,0,%g0 ! clear carry flag | 469 | addcc %g0,0,%g0 ! clear carry flag |
| 457 | nop | ||
| 458 | 470 | ||
| 459 | .L_bn_add_words_loop: ! wow! 32 aligned! | 471 | .L_bn_add_words_loop: ! wow! 32 aligned! |
| 460 | dec 4,%o3 | 472 | dec 4,%o3 |
| @@ -523,6 +535,7 @@ bn_add_words: | |||
| 523 | * int n; | 535 | * int n; |
| 524 | */ | 536 | */ |
| 525 | bn_sub_words: | 537 | bn_sub_words: |
| 538 | sra %o3,%g0,%o3 ! signx %o3 | ||
| 526 | brgz,a %o3,.L_bn_sub_words_proceed | 539 | brgz,a %o3,.L_bn_sub_words_proceed |
| 527 | lduw [%o1],%o4 | 540 | lduw [%o1],%o4 |
| 528 | retl | 541 | retl |
| @@ -532,7 +545,6 @@ bn_sub_words: | |||
| 532 | andcc %o3,-4,%g0 | 545 | andcc %o3,-4,%g0 |
| 533 | bz,pn %icc,.L_bn_sub_words_tail | 546 | bz,pn %icc,.L_bn_sub_words_tail |
| 534 | addcc %g0,0,%g0 ! clear carry flag | 547 | addcc %g0,0,%g0 ! clear carry flag |
| 535 | nop | ||
| 536 | 548 | ||
| 537 | .L_bn_sub_words_loop: ! wow! 32 aligned! | 549 | .L_bn_sub_words_loop: ! wow! 32 aligned! |
| 538 | dec 4,%o3 | 550 | dec 4,%o3 |
