From 99f066b0e074e44bab8174651b96c62ac333cc64 Mon Sep 17 00:00:00 2001 From: jsing <> Date: Tue, 2 Sep 2025 14:18:38 +0000 Subject: Disable assembly bn_sqr_words() again for now. The old assembly bn_sqr_words() does not actually square words in the bignum sense. These will have to be renamed (once I come up with a name for whatever it actually does) before we can roll forward again. Found the hard way by Janne Johansson. --- src/lib/libcrypto/bn/bn_local.h | 4 ++-- src/lib/libcrypto/bn/bn_mod_words.c | 4 ++-- src/lib/libcrypto/bn/bn_sqr.c | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/lib') diff --git a/src/lib/libcrypto/bn/bn_local.h b/src/lib/libcrypto/bn/bn_local.h index 0df4b7f32e..853757d289 100644 --- a/src/lib/libcrypto/bn/bn_local.h +++ b/src/lib/libcrypto/bn/bn_local.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_local.h,v 1.58 2025/09/01 15:33:23 jsing Exp $ */ +/* $OpenBSD: bn_local.h,v 1.59 2025/09/02 14:18:38 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -248,7 +248,7 @@ void bn_mul_words(BN_ULONG *r, const BN_ULONG *a, int a_len, const BN_ULONG *b, void bn_sqr_comba4(BN_ULONG *r, const BN_ULONG *a); void bn_sqr_comba6(BN_ULONG *r, const BN_ULONG *a); void bn_sqr_comba8(BN_ULONG *r, const BN_ULONG *a); -void bn_sqr_words(BN_ULONG *r, const BN_ULONG *a, int a_len); +void bn_sqr_words_nonasm(BN_ULONG *r, const BN_ULONG *a, int a_len); int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, 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 93c6567364..1a2fe70b4e 100644 --- a/src/lib/libcrypto/bn/bn_mod_words.c +++ b/src/lib/libcrypto/bn/bn_mod_words.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_mod_words.c,v 1.5 2025/09/01 15:35:25 jsing Exp $ */ +/* $OpenBSD: bn_mod_words.c,v 1.6 2025/09/02 14:18:38 jsing Exp $ */ /* * Copyright (c) 2024 Joel Sing * @@ -103,7 +103,7 @@ bn_mod_sqr_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *m, } else if (n == 8) { bn_sqr_comba8(t, a); } else { - bn_sqr_words(t, a, n); + bn_sqr_words_nonasm(t, a, n); } bn_montgomery_reduce_words(r, t, m, m0, n); } diff --git a/src/lib/libcrypto/bn/bn_sqr.c b/src/lib/libcrypto/bn/bn_sqr.c index 64f275f9d4..ec9d5130a4 100644 --- a/src/lib/libcrypto/bn/bn_sqr.c +++ b/src/lib/libcrypto/bn/bn_sqr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_sqr.c,v 1.40 2025/08/30 07:54:27 jsing Exp $ */ +/* $OpenBSD: bn_sqr.c,v 1.41 2025/09/02 14:18:38 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -203,7 +203,7 @@ bn_sqr_comba8(BN_ULONG *r, const BN_ULONG *a) } #endif -#ifndef HAVE_BN_SQR_WORDS +#ifndef HAVE_BN_SQR_WORDS_NONASM /* * bn_sqr_add_words() computes (r[i*2+1]:r[i*2]) = (r[i*2+1]:r[i*2]) + a[i] * a[i]. */ @@ -244,7 +244,7 @@ bn_sqr_add_words(BN_ULONG *r, const BN_ULONG *a, int n) * bn_sqr_words() computes r[] = a[] * a[]. */ void -bn_sqr_words(BN_ULONG *r, const BN_ULONG *a, int a_len) +bn_sqr_words_nonasm(BN_ULONG *r, const BN_ULONG *a, int a_len) { const BN_ULONG *ap; BN_ULONG *rp; @@ -298,7 +298,7 @@ bn_sqr_words(BN_ULONG *r, const BN_ULONG *a, int a_len) static int bn_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) { - bn_sqr_words(r->d, a->d, a->top); + bn_sqr_words_nonasm(r->d, a->d, a->top); return 1; } -- cgit v1.2.3-55-g6feb