aboutsummaryrefslogtreecommitdiff
path: root/secure
diff options
context:
space:
mode:
authorPiotr Kubaj <pkubaj@FreeBSD.org>2021-11-22 02:28:46 +0000
committerPiotr Kubaj <pkubaj@FreeBSD.org>2021-12-29 13:45:29 +0000
commitce35a3bc852d25cb989bc1f3dc4ddb723d7d5117 (patch)
treec8b1a34bb036e3c854069a754d690acc3518ee79 /secure
parenta7e7700fa741d64a31e9d7596175fc0461687b86 (diff)
downloadsrc-ce35a3bc852d25cb989bc1f3dc4ddb723d7d5117.tar.gz
src-ce35a3bc852d25cb989bc1f3dc4ddb723d7d5117.zip
Diffstat (limited to 'secure')
-rw-r--r--secure/lib/libcrypto/Makefile50
-rw-r--r--secure/lib/libcrypto/Makefile.asm189
-rw-r--r--secure/lib/libcrypto/Makefile.inc35
3 files changed, 272 insertions, 2 deletions
diff --git a/secure/lib/libcrypto/Makefile b/secure/lib/libcrypto/Makefile
index ff9303c9edae..cf9259a19e16 100644
--- a/secure/lib/libcrypto/Makefile
+++ b/secure/lib/libcrypto/Makefile
@@ -28,6 +28,12 @@ SRCS+= x86_64cpuid.S
SRCS+= armv4cpuid.S armcap.c
.elif defined(ASM_i386)
SRCS+= x86cpuid.S
+.elif defined(ASM_powerpc)
+SRCS+= ppccpuid.S ppccap.c
+.elif defined(ASM_powerpc64)
+SRCS+= ppccpuid.S ppccap.c
+.elif defined(ASM_powerpc64le)
+SRCS+= ppccpuid.S ppccap.c
.else
SRCS+= mem_clr.c
.endif
@@ -44,6 +50,12 @@ SRCS+= aesni-x86_64.S vpaes-x86_64.S
SRCS+= aes-armv4.S aesv8-armx.S bsaes-armv7.S
.elif defined(ASM_i386)
SRCS+= aes_core.c aesni-x86.S vpaes-x86.S
+.elif defined(ASM_powerpc)
+SRCS+= aes_core.c aes-ppc.S vpaes-ppc.S aesp8-ppc.S
+.elif defined(ASM_powerpc64)
+SRCS+= aes_core.c aes-ppc.S vpaes-ppc.S aesp8-ppc.S
+.elif defined(ASM_powerpc64le)
+SRCS+= aes_core.c aes-ppc.S vpaes-ppc.S aesp8-ppc.S
.else
SRCS+= aes_core.c
.endif
@@ -99,6 +111,12 @@ SRCS+= x86_64-mont.S x86_64-mont5.S
SRCS+= armv4-gf2m.S armv4-mont.S bn_asm.c
.elif defined(ASM_i386)
SRCS+= bn-586.S co-586.S x86-gf2m.S x86-mont.S
+.elif defined(ASM_powerpc)
+SRCS+= ppc.S ppc-mont.S
+.elif defined(ASM_powerpc64)
+SRCS+= ppc.S ppc-mont.S
+.elif defined(ASM_powerpc64le)
+SRCS+= ppc.S ppc-mont.S
.else
SRCS+= bn_asm.c
.endif
@@ -128,6 +146,12 @@ SRCS+= chacha-x86_64.S
SRCS+= chacha-armv4.S
.elif defined(ASM_i386)
SRCS+= chacha-x86.S
+.elif defined(ASM_powerpc)
+SRCS+= chacha-ppc.S
+.elif defined(ASM_powerpc64)
+SRCS+= chacha-ppc.S
+.elif defined(ASM_powerpc64le)
+SRCS+= chacha-ppc.S
.else
SRCS+= chacha_enc.c
.endif
@@ -189,6 +213,10 @@ SRCS+= ecp_nistz256-x86_64.S ecp_nistz256.c x25519-x86_64.S
SRCS+= ecp_nistz256-armv4.S ecp_nistz256.c
.elif defined(ASM_i386)
SRCS+= ecp_nistz256-x86.S ecp_nistz256.c
+.elif defined(ASM_powerpc64)
+SRCS+= ecp_nistz256-ppc64.S ecp_nistz256.c x25519-ppc64.S
+.elif defined(ASM_powerpc64le)
+SRCS+= ecp_nistz256-ppc64.S ecp_nistz256.c x25519-ppc64.S
.endif
# engine
@@ -250,6 +278,12 @@ SRCS+= aesni-gcm-x86_64.S ghash-x86_64.S
SRCS+= ghash-armv4.S ghashv8-armx.S
.elif defined(ASM_i386)
SRCS+= ghash-x86.S
+.elif defined(ASM_powerpc)
+SRCS+= ghashp8-ppc.S
+.elif defined(ASM_powerpc64)
+SRCS+= ghashp8-ppc.S
+.elif defined(ASM_powerpc64le)
+SRCS+= ghashp8-ppc.S
.endif
# objects
@@ -282,6 +316,12 @@ SRCS+= poly1305-x86_64.S
SRCS+= poly1305-armv4.S
.elif defined(ASM_i386)
SRCS+= poly1305-x86.S
+.elif defined(ASM_powerpc)
+SRCS+= poly1305-ppc.S poly1305-ppcfp.S
+.elif defined(ASM_powerpc64)
+SRCS+= poly1305-ppc.S poly1305-ppcfp.S
+.elif defined(ASM_powerpc64le)
+SRCS+= poly1305-ppc.S poly1305-ppcfp.S
.endif
# rand
@@ -333,6 +373,12 @@ SRCS+= sha256-mb-x86_64.S sha256-x86_64.S sha512-x86_64.S
SRCS+= keccak1600-armv4.S sha1-armv4-large.S sha256-armv4.S sha512-armv4.S
.elif defined(ASM_i386)
SRCS+= keccak1600.c sha1-586.S sha256-586.S sha512-586.S
+.elif defined(ASM_powerpc)
+SRCS+= keccak1600.c sha1-ppc.S sha256-ppc.S sha512-ppc.S sha256p8-ppc.S sha512p8-ppc.S
+.elif defined(ASM_powerpc64)
+SRCS+= keccak1600-ppc64.S sha1-ppc.S sha256-ppc.S sha512-ppc.S sha256p8-ppc.S sha512p8-ppc.S
+.elif defined(ASM_powerpc64le)
+SRCS+= keccak1600-ppc64.S sha1-ppc.S sha256-ppc.S sha512-ppc.S sha256p8-ppc.S sha512p8-ppc.S
.else
SRCS+= keccak1600.c
.endif
@@ -430,7 +476,7 @@ SRCS+= buildinf.h
CLEANDIRS= openssl
CLEANFILES= buildinf.h opensslconf.h opensslconf.h.tmp
-.if defined(ASM_${MACHINE_CPUARCH})
+.if defined(ASM_${MACHINE_CPUARCH}) || defined(ASM_${MACHINE_ARCH})
_cmd1=/%%NO_ASM%%/d
.else
_cmd1=s/%%NO_ASM%%//
@@ -471,6 +517,8 @@ PICFLAG+= -DOPENSSL_PIC
.if defined(ASM_amd64)
.PATH: ${LCRYPTO_SRC}/crypto/bn/asm
.endif
+.elif defined(ASM_${MACHINE_ARCH})
+.PATH: ${SRCTOP}/sys/crypto/openssl/${MACHINE_ARCH}
.endif
.PATH: ${LCRYPTO_SRC}/crypto \
diff --git a/secure/lib/libcrypto/Makefile.asm b/secure/lib/libcrypto/Makefile.asm
index 9480c3a59833..5e44285de0d9 100644
--- a/secure/lib/libcrypto/Makefile.asm
+++ b/secure/lib/libcrypto/Makefile.asm
@@ -295,6 +295,195 @@ CLEANFILES= ${ASM} ${SRCS:R:S/$/.s/}
env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} ${.IMPSRC:R:S/$/.s/} ;\
cat ${.IMPSRC:R:S/$/.s/} ;\
echo '#endif' ) > ${.TARGET}
+
+.elif defined(ASM_powerpc)
+
+.PATH: ${LCRYPTO_SRC}/crypto \
+ ${LCRYPTO_SRC}/crypto/aes/asm \
+ ${LCRYPTO_SRC}/crypto/bn/asm \
+ ${LCRYPTO_SRC}/crypto/chacha/asm \
+ ${LCRYPTO_SRC}/crypto/modes/asm \
+ ${LCRYPTO_SRC}/crypto/poly1305/asm \
+ ${LCRYPTO_SRC}/crypto/sha/asm
+
+PERLPATH= -I${LCRYPTO_SRC}/crypto/perlasm
+
+#cpuid
+SRCS= ppccpuid.pl
+
+#bn
+SRCS+= ppc.pl ppc-mont.pl
+
+#aes
+SRCS+= aes-ppc.pl vpaes-ppc.pl aesp8-ppc.pl
+
+#sha1
+SRCS+= sha1-ppc.pl sha512-ppc.pl sha512p8-ppc.pl
+
+#modes
+SRCS+= ghashp8-ppc.pl
+
+#chacha
+SRCS+= chacha-ppc.pl
+
+#poly1305
+SRCS+= poly1305-ppc.pl poly1305-ppcfp.pl
+
+ASM= ${SRCS:R:S/$/.S/} sha256-ppc.S sha256p8-ppc.S
+
+all: ${ASM}
+
+CLEANFILES= ${ASM}
+.SUFFIXES: .pl
+
+sha256-ppc.S: sha512-ppc.pl
+ env CC=cc perl ${.ALLSRC} linux32 ${.TARGET:R:S/$/.s/}
+ ( echo '/* $$'FreeBSD'$$ */' ;\
+ echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T:R:S/$/.pl/}. */' ;\
+ cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
+
+sha256p8-ppc.S: sha512p8-ppc.pl
+ env CC=cc perl ${.ALLSRC} linux32 ${.TARGET:R:S/$/.s/}
+ ( echo '/* $$'FreeBSD'$$ */' ;\
+ echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T:R:S/$/.pl/}. */' ;\
+ cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
+
+.pl.S:
+ env CC=cc perl ${.IMPSRC} linux32 ${.TARGET:R:S/$/.s/}
+ ( echo '/* $$'FreeBSD'$$ */' ;\
+ echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T:R:S/$/.pl/}. */' ;\
+ cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
+
+.elif defined(ASM_powerpc64)
+
+.PATH: ${LCRYPTO_SRC}/crypto \
+ ${LCRYPTO_SRC}/crypto/aes/asm \
+ ${LCRYPTO_SRC}/crypto/bn/asm \
+ ${LCRYPTO_SRC}/crypto/chacha/asm \
+ ${LCRYPTO_SRC}/crypto/ec/asm \
+ ${LCRYPTO_SRC}/crypto/modes/asm \
+ ${LCRYPTO_SRC}/crypto/poly1305/asm \
+ ${LCRYPTO_SRC}/crypto/sha/asm
+
+PERLPATH= -I${LCRYPTO_SRC}/crypto/perlasm
+
+#cpuid
+SRCS= ppccpuid.pl
+
+#bn
+SRCS+= ppc.pl ppc-mont.pl
+
+#aes
+SRCS+= aes-ppc.pl vpaes-ppc.pl aesp8-ppc.pl
+
+#sha1
+SRCS+= sha1-ppc.pl sha512-ppc.pl sha512p8-ppc.pl
+
+#modes
+SRCS+= ghashp8-ppc.pl
+
+#chacha
+SRCS+= chacha-ppc.pl
+
+#poly1305
+SRCS+= poly1305-ppc.pl poly1305-ppcfp.pl
+
+#ec
+SRCS+= ecp_nistz256-ppc64.pl x25519-ppc64.pl
+
+#keccak1600
+SRCS+= keccak1600-ppc64.pl
+
+ASM= ${SRCS:R:S/$/.S/} sha256-ppc.S sha256p8-ppc.S
+
+all: ${ASM}
+
+CLEANFILES= ${ASM}
+.SUFFIXES: .pl
+
+sha256-ppc.S: sha512-ppc.pl
+ env CC=cc perl ${.ALLSRC} linux64v2 ${.TARGET:R:S/$/.s/}
+ ( echo '/* $$'FreeBSD'$$ */' ;\
+ echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T:R:S/$/.pl/}. */' ;\
+ cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
+
+sha256p8-ppc.S: sha512p8-ppc.pl
+ env CC=cc perl ${.ALLSRC} linux64v2 ${.TARGET:R:S/$/.s/}
+ ( echo '/* $$'FreeBSD'$$ */' ;\
+ echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T:R:S/$/.pl/}. */' ;\
+ cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
+
+.pl.S:
+ env CC=cc perl ${.IMPSRC} linux64v2 ${.TARGET:R:S/$/.s/}
+ ( echo '/* $$'FreeBSD'$$ */' ;\
+ echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T:R:S/$/.pl/}. */' ;\
+ cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
+
+.elif defined(ASM_powerpc64le)
+
+.PATH: ${LCRYPTO_SRC}/crypto \
+ ${LCRYPTO_SRC}/crypto/aes/asm \
+ ${LCRYPTO_SRC}/crypto/bn/asm \
+ ${LCRYPTO_SRC}/crypto/chacha/asm \
+ ${LCRYPTO_SRC}/crypto/ec/asm \
+ ${LCRYPTO_SRC}/crypto/modes/asm \
+ ${LCRYPTO_SRC}/crypto/poly1305/asm \
+ ${LCRYPTO_SRC}/crypto/sha/asm
+
+PERLPATH= -I${LCRYPTO_SRC}/crypto/perlasm
+
+#cpuid
+SRCS= ppccpuid.pl
+
+#bn
+SRCS+= ppc.pl ppc-mont.pl
+
+#aes
+SRCS+= aes-ppc.pl vpaes-ppc.pl aesp8-ppc.pl
+
+#sha1
+SRCS+= sha1-ppc.pl sha512-ppc.pl sha512p8-ppc.pl
+
+#modes
+SRCS+= ghashp8-ppc.pl
+
+#chacha
+SRCS+= chacha-ppc.pl
+
+#poly1305
+SRCS+= poly1305-ppc.pl poly1305-ppcfp.pl
+
+#ec
+SRCS+= ecp_nistz256-ppc64.pl x25519-ppc64.pl
+
+#keccak1600
+SRCS+= keccak1600-ppc64.pl
+
+ASM= ${SRCS:R:S/$/.S/} sha256-ppc.S sha256p8-ppc.S
+
+all: ${ASM}
+
+CLEANFILES= ${ASM}
+.SUFFIXES: .pl
+
+sha256-ppc.S: sha512-ppc.pl
+ env CC=cc perl ${.ALLSRC} linux64le ${.TARGET:R:S/$/.s/}
+ ( echo '/* $$'FreeBSD'$$ */' ;\
+ echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T:R:S/$/.pl/}. */' ;\
+ cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
+
+sha256p8-ppc.S: sha512p8-ppc.pl
+ env CC=cc perl ${.ALLSRC} linux64le ${.TARGET:R:S/$/.s/}
+ ( echo '/* $$'FreeBSD'$$ */' ;\
+ echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T:R:S/$/.pl/}. */' ;\
+ cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
+
+.pl.S:
+ env CC=cc perl ${.IMPSRC} linux64le ${.TARGET:R:S/$/.s/}
+ ( echo '/* $$'FreeBSD'$$ */' ;\
+ echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T:R:S/$/.pl/}. */' ;\
+ cat ${.TARGET:R:S/$/.s/}) > ${.TARGET}
+
.endif
.include <bsd.prog.mk>
diff --git a/secure/lib/libcrypto/Makefile.inc b/secure/lib/libcrypto/Makefile.inc
index 19bdf834dcad..c944e3242caa 100644
--- a/secure/lib/libcrypto/Makefile.inc
+++ b/secure/lib/libcrypto/Makefile.inc
@@ -23,9 +23,12 @@ CFLAGS+= -DB_ENDIAN
.if ${MACHINE_CPUARCH} == "aarch64" || ${MACHINE_CPUARCH} == "amd64" || \
${MACHINE_CPUARCH} == "arm" || ${MACHINE_CPUARCH} == "i386"
ASM_${MACHINE_CPUARCH}=
+.elif ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "powerpc64" || \
+ ${MACHINE_ARCH} == "powerpc64le"
+ASM_${MACHINE_ARCH}=
.endif
-.if defined(ASM_${MACHINE_CPUARCH})
+.if defined(ASM_${MACHINE_CPUARCH}) || defined(ASM_${MACHINE_ARCH})
CFLAGS+= -DOPENSSL_CPUID_OBJ
.if defined(ASM_aarch64)
CFLAGS+= -DOPENSSL_BN_ASM_MONT
@@ -69,6 +72,36 @@ CFLAGS+= -DGHASH_ASM
CFLAGS+= -DECP_NISTZ256_ASM
CFLAGS+= -DPADLOCK_ASM
CFLAGS+= -DPOLY1305_ASM
+.elif defined(ASM_powerpc)
+CFLAGS+= -DOPENSSL_BN_ASM_MONT
+CFLAGS+= -DAES_ASM
+CFLAGS+= -DVPAES_ASM
+CFLAGS+= -DSHA1_ASM
+CFLAGS+= -DSHA256_ASM
+CFLAGS+= -DSHA512_ASM
+CFLAGS+= -DPOLY1305_ASM
+.elif defined(ASM_powerpc64)
+CFLAGS+= -DOPENSSL_BN_ASM_MONT
+CFLAGS+= -DAES_ASM
+CFLAGS+= -DVPAES_ASM
+CFLAGS+= -DSHA1_ASM
+CFLAGS+= -DSHA256_ASM
+CFLAGS+= -DSHA512_ASM
+CFLAGS+= -DPOLY1305_ASM
+CFLAGS+= -DECP_NISTZ256_ASM
+CFLAGS+= -DX25519_ASM
+CFLAGS+= -DKECCAK1600_ASM
+.elif defined(ASM_powerpc64le)
+CFLAGS+= -DOPENSSL_BN_ASM_MONT
+CFLAGS+= -DAES_ASM
+CFLAGS+= -DVPAES_ASM
+CFLAGS+= -DSHA1_ASM
+CFLAGS+= -DSHA256_ASM
+CFLAGS+= -DSHA512_ASM
+CFLAGS+= -DPOLY1305_ASM
+CFLAGS+= -DECP_NISTZ256_ASM
+CFLAGS+= -DX25519_ASM
+CFLAGS+= -DKECCAK1600_ASM
.endif
.endif