summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjsing <>2025-09-07 05:21:29 +0000
committerjsing <>2025-09-07 05:21:29 +0000
commit9283c4361ce1f1a39a1f03c588c3d1a3da64025e (patch)
tree9001b6a21a25032046dc09da51ff2828b36e1d11 /src
parent6dd87e766b900133746524ad2d5599160de6f5c8 (diff)
downloadopenbsd-9283c4361ce1f1a39a1f03c588c3d1a3da64025e.tar.gz
openbsd-9283c4361ce1f1a39a1f03c588c3d1a3da64025e.tar.bz2
openbsd-9283c4361ce1f1a39a1f03c588c3d1a3da64025e.zip
Re-enable bn_sqr_words() assembly.
This is now only on amd64.
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/bn/bn_local.h4
-rw-r--r--src/lib/libcrypto/bn/bn_mod_words.c4
-rw-r--r--src/lib/libcrypto/bn/bn_sqr.c8
3 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/libcrypto/bn/bn_local.h b/src/lib/libcrypto/bn/bn_local.h
index 853757d289..a7d61f1b03 100644
--- a/src/lib/libcrypto/bn/bn_local.h
+++ b/src/lib/libcrypto/bn/bn_local.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_local.h,v 1.59 2025/09/02 14:18:38 jsing Exp $ */ 1/* $OpenBSD: bn_local.h,v 1.60 2025/09/07 05:21:29 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -248,7 +248,7 @@ void bn_mul_words(BN_ULONG *r, const BN_ULONG *a, int a_len, const BN_ULONG *b,
248void bn_sqr_comba4(BN_ULONG *r, const BN_ULONG *a); 248void bn_sqr_comba4(BN_ULONG *r, const BN_ULONG *a);
249void bn_sqr_comba6(BN_ULONG *r, const BN_ULONG *a); 249void bn_sqr_comba6(BN_ULONG *r, const BN_ULONG *a);
250void bn_sqr_comba8(BN_ULONG *r, const BN_ULONG *a); 250void bn_sqr_comba8(BN_ULONG *r, const BN_ULONG *a);
251void bn_sqr_words_nonasm(BN_ULONG *r, const BN_ULONG *a, int a_len); 251void bn_sqr_words(BN_ULONG *r, const BN_ULONG *a, int a_len);
252 252
253int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, 253int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,
254 const BN_ULONG *np, const BN_ULONG *n0, int num); 254 const BN_ULONG *np, const BN_ULONG *n0, int num);
diff --git a/src/lib/libcrypto/bn/bn_mod_words.c b/src/lib/libcrypto/bn/bn_mod_words.c
index 1a2fe70b4e..f368e074db 100644
--- a/src/lib/libcrypto/bn/bn_mod_words.c
+++ b/src/lib/libcrypto/bn/bn_mod_words.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_mod_words.c,v 1.6 2025/09/02 14:18:38 jsing Exp $ */ 1/* $OpenBSD: bn_mod_words.c,v 1.7 2025/09/07 05:21:29 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2024 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -103,7 +103,7 @@ bn_mod_sqr_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *m,
103 } else if (n == 8) { 103 } else if (n == 8) {
104 bn_sqr_comba8(t, a); 104 bn_sqr_comba8(t, a);
105 } else { 105 } else {
106 bn_sqr_words_nonasm(t, a, n); 106 bn_sqr_words(t, a, n);
107 } 107 }
108 bn_montgomery_reduce_words(r, t, m, m0, n); 108 bn_montgomery_reduce_words(r, t, m, m0, n);
109} 109}
diff --git a/src/lib/libcrypto/bn/bn_sqr.c b/src/lib/libcrypto/bn/bn_sqr.c
index ec9d5130a4..27e08bdf13 100644
--- a/src/lib/libcrypto/bn/bn_sqr.c
+++ b/src/lib/libcrypto/bn/bn_sqr.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_sqr.c,v 1.41 2025/09/02 14:18:38 jsing Exp $ */ 1/* $OpenBSD: bn_sqr.c,v 1.42 2025/09/07 05:21:29 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -203,7 +203,7 @@ bn_sqr_comba8(BN_ULONG *r, const BN_ULONG *a)
203} 203}
204#endif 204#endif
205 205
206#ifndef HAVE_BN_SQR_WORDS_NONASM 206#ifndef HAVE_BN_SQR_WORDS
207/* 207/*
208 * bn_sqr_add_words() computes (r[i*2+1]:r[i*2]) = (r[i*2+1]:r[i*2]) + a[i] * a[i]. 208 * bn_sqr_add_words() computes (r[i*2+1]:r[i*2]) = (r[i*2+1]:r[i*2]) + a[i] * a[i].
209 */ 209 */
@@ -244,7 +244,7 @@ bn_sqr_add_words(BN_ULONG *r, const BN_ULONG *a, int n)
244 * bn_sqr_words() computes r[] = a[] * a[]. 244 * bn_sqr_words() computes r[] = a[] * a[].
245 */ 245 */
246void 246void
247bn_sqr_words_nonasm(BN_ULONG *r, const BN_ULONG *a, int a_len) 247bn_sqr_words(BN_ULONG *r, const BN_ULONG *a, int a_len)
248{ 248{
249 const BN_ULONG *ap; 249 const BN_ULONG *ap;
250 BN_ULONG *rp; 250 BN_ULONG *rp;
@@ -298,7 +298,7 @@ bn_sqr_words_nonasm(BN_ULONG *r, const BN_ULONG *a, int a_len)
298static int 298static int
299bn_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 299bn_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
300{ 300{
301 bn_sqr_words_nonasm(r->d, a->d, a->top); 301 bn_sqr_words(r->d, a->d, a->top);
302 302
303 return 1; 303 return 1;
304} 304}