summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bn
diff options
context:
space:
mode:
authorjsing <>2023-01-21 17:29:56 +0000
committerjsing <>2023-01-21 17:29:56 +0000
commitf0336de474be059a63ecd6670f0c82b4aa9f9888 (patch)
tree513370a4aef1ae3a8c678f90605b0bdaadb43cd1 /src/lib/libcrypto/bn
parent6835809fafaa0b82caa7bf8ad934ed0552c76bab (diff)
downloadopenbsd-f0336de474be059a63ecd6670f0c82b4aa9f9888.tar.gz
openbsd-f0336de474be059a63ecd6670f0c82b4aa9f9888.tar.bz2
openbsd-f0336de474be059a63ecd6670f0c82b4aa9f9888.zip
Provide an implementation of bn_sqr() that calls s2n-bignum's bignum_sqr().
ok tb@
Diffstat (limited to 'src/lib/libcrypto/bn')
-rw-r--r--src/lib/libcrypto/bn/arch/amd64/bn_arch.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/lib/libcrypto/bn/arch/amd64/bn_arch.c b/src/lib/libcrypto/bn/arch/amd64/bn_arch.c
new file mode 100644
index 0000000000..240575955c
--- /dev/null
+++ b/src/lib/libcrypto/bn/arch/amd64/bn_arch.c
@@ -0,0 +1,32 @@
1/* $OpenBSD: bn_arch.c,v 1.1 2023/01/21 17:29:56 jsing Exp $ */
2/*
3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18#include <openssl/bn.h>
19
20#include "bn_arch.h"
21#include "bn_local.h"
22#include "s2n_bignum.h"
23
24#ifdef HAVE_BN_SQR
25int
26bn_sqr(BIGNUM *r, const BIGNUM *a, int rn, BN_CTX *ctx)
27{
28 bignum_sqr(rn, (uint64_t *)r->d, a->top, (uint64_t *)a->d);
29
30 return 1;
31}
32#endif