diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2017-01-26 18:32:12 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2017-01-26 18:32:12 +0000 |
commit | 5315173646e65b5025be33013edc33eb9658e683 (patch) | |
tree | 06e2ebfcb3177eeb3cba0775d8e3ed98577e77da /crypto/bn | |
parent | e656c34a188598ebce6423c4fbc4860921d41be4 (diff) | |
download | src-5315173646e65b5025be33013edc33eb9658e683.tar.gz src-5315173646e65b5025be33013edc33eb9658e683.zip |
Import OpenSSL 1.0.2k.vendor/openssl/1.0.2k
Notes
Notes:
svn path=/vendor-crypto/openssl/dist/; revision=312823
svn path=/vendor-crypto/openssl/1.0.2k/; revision=312824; tag=vendor/openssl/1.0.2k
Diffstat (limited to 'crypto/bn')
-rwxr-xr-x | crypto/bn/asm/x86_64-mont.pl | 5 | ||||
-rwxr-xr-x | crypto/bn/asm/x86_64-mont5.pl | 16 | ||||
-rw-r--r-- | crypto/bn/bn_exp.c | 5 | ||||
-rw-r--r-- | crypto/bn/bn_mul.c | 5 | ||||
-rw-r--r-- | crypto/bn/bn_prime.c | 3 | ||||
-rw-r--r-- | crypto/bn/bn_sqr.c | 5 |
6 files changed, 20 insertions, 19 deletions
diff --git a/crypto/bn/asm/x86_64-mont.pl b/crypto/bn/asm/x86_64-mont.pl index 044fd7ecc0fd..80492d8e6381 100755 --- a/crypto/bn/asm/x86_64-mont.pl +++ b/crypto/bn/asm/x86_64-mont.pl @@ -1148,18 +1148,17 @@ $code.=<<___; mulx 2*8($aptr),%r15,%r13 # ... adox -3*8($tptr),%r11 adcx %r15,%r12 - adox $zero,%r12 + adox -2*8($tptr),%r12 adcx $zero,%r13 + adox $zero,%r13 mov $bptr,8(%rsp) # off-load &b[i] - .byte 0x67 mov $mi,%r15 imulq 24(%rsp),$mi # "t[0]"*n0 xor %ebp,%ebp # xor $zero,$zero # cf=0, of=0 mulx 3*8($aptr),%rax,%r14 mov $mi,%rdx - adox -2*8($tptr),%r12 adcx %rax,%r13 adox -1*8($tptr),%r13 adcx $zero,%r14 diff --git a/crypto/bn/asm/x86_64-mont5.pl b/crypto/bn/asm/x86_64-mont5.pl index f1fbb45b532b..3bb0cdf5bd39 100755 --- a/crypto/bn/asm/x86_64-mont5.pl +++ b/crypto/bn/asm/x86_64-mont5.pl @@ -1925,6 +1925,7 @@ __bn_sqr8x_reduction: .align 32 .L8x_tail_done: + xor %rax,%rax add (%rdx),%r8 # can this overflow? adc \$0,%r9 adc \$0,%r10 @@ -1932,10 +1933,8 @@ __bn_sqr8x_reduction: adc \$0,%r12 adc \$0,%r13 adc \$0,%r14 - adc \$0,%r15 # can't overflow, because we - # started with "overhung" part - # of multiplication - xor %rax,%rax + adc \$0,%r15 + adc \$0,%rax neg $carry .L8x_no_tail: @@ -3375,6 +3374,7 @@ __bn_sqrx8x_reduction: .align 32 .Lsqrx8x_tail_done: + xor %rax,%rax add 24+8(%rsp),%r8 # can this overflow? adc \$0,%r9 adc \$0,%r10 @@ -3382,10 +3382,8 @@ __bn_sqrx8x_reduction: adc \$0,%r12 adc \$0,%r13 adc \$0,%r14 - adc \$0,%r15 # can't overflow, because we - # started with "overhung" part - # of multiplication - mov $carry,%rax # xor %rax,%rax + adc \$0,%r15 + adc \$0,%rax sub 16+8(%rsp),$carry # mov 16(%rsp),%cf .Lsqrx8x_no_tail: # %cf is 0 if jumped here @@ -3400,7 +3398,7 @@ __bn_sqrx8x_reduction: adc 8*5($tptr),%r13 adc 8*6($tptr),%r14 adc 8*7($tptr),%r15 - adc %rax,%rax # top-most carry + adc \$0,%rax # top-most carry mov 32+8(%rsp),%rbx # n0 mov 8*8($tptr,%rcx),%rdx # modulo-scheduled "%r8" diff --git a/crypto/bn/bn_exp.c b/crypto/bn/bn_exp.c index 1670f01d1d8c..195a7867a46b 100644 --- a/crypto/bn/bn_exp.c +++ b/crypto/bn/bn_exp.c @@ -180,8 +180,9 @@ int BN_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) goto err; } } - if (r != rr) - BN_copy(r, rr); + if (r != rr && BN_copy(r, rr) == NULL) + goto err; + ret = 1; err: BN_CTX_end(ctx); diff --git a/crypto/bn/bn_mul.c b/crypto/bn/bn_mul.c index b174850b6bb1..3c618dc30708 100644 --- a/crypto/bn/bn_mul.c +++ b/crypto/bn/bn_mul.c @@ -1083,8 +1083,9 @@ int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) end: #endif bn_correct_top(rr); - if (r != rr) - BN_copy(r, rr); + if (r != rr && BN_copy(r, rr) == NULL) + goto err; + ret = 1; err: bn_check_top(r); diff --git a/crypto/bn/bn_prime.c b/crypto/bn/bn_prime.c index 1d256874c9d2..8177fd294772 100644 --- a/crypto/bn/bn_prime.c +++ b/crypto/bn/bn_prime.c @@ -283,7 +283,8 @@ int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, BIGNUM *t; if ((t = BN_CTX_get(ctx)) == NULL) goto err; - BN_copy(t, a); + if (BN_copy(t, a) == NULL) + goto err; t->neg = 0; A = t; } else diff --git a/crypto/bn/bn_sqr.c b/crypto/bn/bn_sqr.c index 3ca69879ee2d..256d26e8dbec 100644 --- a/crypto/bn/bn_sqr.c +++ b/crypto/bn/bn_sqr.c @@ -143,8 +143,9 @@ int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) rr->top = max - 1; else rr->top = max; - if (rr != r) - BN_copy(r, rr); + if (r != rr && BN_copy(r, rr) == NULL) + goto err; + ret = 1; err: bn_check_top(rr); |