At least one of our bn_mul_words() assembly implementation fails to handle
n = 0 correctly... *sigh*
-/* $OpenBSD: bn_sqr.c,v 1.33 2023/06/24 16:19:52 jsing Exp $ */
+/* $OpenBSD: bn_sqr.c,v 1.34 2023/06/24 17:06:54 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
/* Compute initial product - r[n:1] = a[n:1] * a[0] */
n = a_len - 1;
- rp[n] = bn_mul_words(rp, ap, n, w);
+ if (n > 0) {
+ rp[n] = bn_mul_words(rp, ap, n, w);
+ }
rp += 2;
n--;