summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libcrypto/Makefile5
-rw-r--r--src/lib/libcrypto/arch/amd64/Makefile.inc7
-rw-r--r--src/lib/libcrypto/bn/arch/amd64/bn_arch.c32
3 files changed, 41 insertions, 3 deletions
diff --git a/src/lib/libcrypto/Makefile b/src/lib/libcrypto/Makefile
index 9f223f5977..451a48091c 100644
--- a/src/lib/libcrypto/Makefile
+++ b/src/lib/libcrypto/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.92 2023/01/20 10:04:33 jsing Exp $ 1# $OpenBSD: Makefile,v 1.93 2023/01/21 17:29:56 jsing Exp $
2 2
3LIB= crypto 3LIB= crypto
4LIBREBUILD=y 4LIBREBUILD=y
@@ -733,13 +733,14 @@ SRCS+= x509spki.c
733SRCS+= x509type.c 733SRCS+= x509type.c
734SRCS+= x_all.c 734SRCS+= x_all.c
735 735
736.PATH: ${.CURDIR}/arch/${MACHINE_CPU} \ 736.PATH: ${LCRYPTO_SRC}/arch/${MACHINE_CPU} \
737 ${LCRYPTO_SRC} \ 737 ${LCRYPTO_SRC} \
738 ${LCRYPTO_SRC}/aes \ 738 ${LCRYPTO_SRC}/aes \
739 ${LCRYPTO_SRC}/asn1 \ 739 ${LCRYPTO_SRC}/asn1 \
740 ${LCRYPTO_SRC}/bf \ 740 ${LCRYPTO_SRC}/bf \
741 ${LCRYPTO_SRC}/bio \ 741 ${LCRYPTO_SRC}/bio \
742 ${LCRYPTO_SRC}/bn \ 742 ${LCRYPTO_SRC}/bn \
743 ${LCRYPTO_SRC}/bn/arch/${MACHINE_CPU} \
743 ${LCRYPTO_SRC}/bn/asm \ 744 ${LCRYPTO_SRC}/bn/asm \
744 ${LCRYPTO_SRC}/buffer \ 745 ${LCRYPTO_SRC}/buffer \
745 ${LCRYPTO_SRC}/bytestring \ 746 ${LCRYPTO_SRC}/bytestring \
diff --git a/src/lib/libcrypto/arch/amd64/Makefile.inc b/src/lib/libcrypto/arch/amd64/Makefile.inc
index dc615ece1c..1fd9f68919 100644
--- a/src/lib/libcrypto/arch/amd64/Makefile.inc
+++ b/src/lib/libcrypto/arch/amd64/Makefile.inc
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile.inc,v 1.9 2023/01/14 15:45:43 jsing Exp $ 1# $OpenBSD: Makefile.inc,v 1.10 2023/01/21 17:29:56 jsing Exp $
2 2
3# amd64-specific libcrypto build rules 3# amd64-specific libcrypto build rules
4 4
@@ -26,6 +26,11 @@ CFLAGS+= -DOPENSSL_BN_ASM_MONT5
26SSLASM+= bn x86_64-mont5 26SSLASM+= bn x86_64-mont5
27CFLAGS+= -DOPENSSL_BN_ASM_GF2m 27CFLAGS+= -DOPENSSL_BN_ASM_GF2m
28SSLASM+= bn x86_64-gf2m 28SSLASM+= bn x86_64-gf2m
29
30# bn s2n-bignum
31SRCS += bn_arch.c
32SRCS += bignum_sqr.S
33
29# camellia 34# camellia
30SRCS+= cmll_misc.c 35SRCS+= cmll_misc.c
31SSLASM+= camellia cmll-x86_64 36SSLASM+= camellia cmll-x86_64
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