@@ -3943,6 +3943,7 @@ then
39433943 done
39443944
39453945 AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_PPC32_ASM"
3946+ AM_CCASFLAGS="$AM_CCASFLAGS -DEXTERNAL_OPTS_OPENVPN"
39463947 AC_MSG_NOTICE ( [ 32-bit PowerPC assembly for SHA-256] )
39473948 ENABLED_PPC32_ASM=yes
39483949
@@ -3951,6 +3952,11 @@ then
39513952 else
39523953 AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_PPC32_ASM"
39533954 fi
3955+ if test "$ENABLED_PPC32_ASM_INLINE_REG" = "yes"; then
3956+ # The inline-register variant names GPRs (r0..r31) in inline assembly,
3957+ # which the PowerPC assembler only accepts with -mregnames.
3958+ AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_PPC32_ASM_INLINE_REG -Wa,-mregnames"
3959+ fi
39543960 if test "$ENABLED_PPC32_ASM_SMALL" = "yes"; then
39553961 AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_PPC32_ASM_SMALL"
39563962 AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_PPC32_ASM_SMALL"
@@ -3986,8 +3992,14 @@ then
39863992 small)
39873993 ENABLED_PPC64_ASM_SMALL=yes
39883994 ;;
3995+ crypto)
3996+ ENABLED_PPC64_ASM_CRYPTO=yes
3997+ ;;
3998+ power8)
3999+ ENABLED_PPC64_ASM_POWER8=yes
4000+ ;;
39894001 *)
3990- AC_MSG_ERROR ( [ Invalid RISC-V option [ yes,inline,small] : $ENABLED_PPC64_ASM.] )
4002+ AC_MSG_ERROR ( [ Invalid PPC64 option [ yes,inline,small,crypto,power8 ] : $ENABLED_PPC64_ASM.] )
39914003 break
39924004 ;;
39934005 esac
@@ -4007,6 +4019,20 @@ if test "$ENABLED_PPC64_ASM_SMALL" = "yes"; then
40074019 AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_PPC64_ASM_SMALL"
40084020 AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_PPC64_ASM_SMALL"
40094021fi
4022+ # POWER8 vector-crypto (vshasigmaw) SHA-256, selected at run time. The
4023+ # generated code marks the relevant function/section as POWER8 itself, so no
4024+ # global -mcpu=power8 is needed and the rest of the library stays portable.
4025+ if test "$ENABLED_PPC64_ASM_CRYPTO" = "yes"; then
4026+ AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_PPC64_ASM_CRYPTO"
4027+ AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_PPC64_ASM_CRYPTO"
4028+ fi
4029+ # POWER8 VSX (vrld) SHA-3, selected at run time. Like the crypto variant the
4030+ # generated code marks its own function/section as POWER8, so no global
4031+ # -mcpu=power8 is needed and the rest of the library stays portable.
4032+ if test "$ENABLED_PPC64_ASM_POWER8" = "yes"; then
4033+ AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_PPC64_ASM_POWER8"
4034+ AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_PPC64_ASM_POWER8"
4035+ fi
40104036
40114037
40124038# Xilinx hardened crypto
46914717if test "$ENABLED_SHA512" = "yes"
46924718then
46934719 AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA512"
4720+ # The SHA-512 transform is asm on some targets (PPC); the .S is guarded by
4721+ # WOLFSSL_SHA512/WOLFSSL_SHA384 so the assembler needs the macro too.
4722+ AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SHA512"
46944723fi
46954724
46964725# SHA-256 Hash DRBG (SP 800-90A) -- sub-option of hashdrbg
47344763if test "$ENABLED_SHA384" = "yes"
47354764then
47364765 AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA384"
4766+ AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SHA384"
47374767fi
47384768
47394769
74317461if test "$ENABLED_SHA3" != "no"
74327462then
74337463 AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_SHA3"
7464+ # The SHA-3 block transform is asm on some targets (PPC); the .S is guarded
7465+ # by WOLFSSL_SHA3 so the assembler needs the macro too.
7466+ AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_SHA3"
74347467fi
74357468
74367469# Set SHAKE128 flags
@@ -11843,28 +11876,54 @@ then
1184311876 if test "$ENABLED_AESGCM" = "word32"
1184411877 then
1184511878 AM_CFLAGS="$AM_CFLAGS -DGCM_WORD32"
11879+ AM_CCASFLAGS="$AM_CCASFLAGS -DGCM_WORD32"
1184611880 ENABLED_AESGCM=yes
1184711881 fi
1184811882
1184911883 if test "$ENABLED_AESGCM" = "small" || test "$ENABLED_LOWRESOURCE" = "yes"
1185011884 then
1185111885 AM_CFLAGS="$AM_CFLAGS -DGCM_SMALL"
11886+ AM_CCASFLAGS="$AM_CCASFLAGS -DGCM_SMALL"
1185211887 ENABLED_AESGCM=yes
1185311888 fi
1185411889
1185511890 if test "$ENABLED_AESGCM" = "table"
1185611891 then
1185711892 AM_CFLAGS="$AM_CFLAGS -DGCM_TABLE"
11893+ AM_CCASFLAGS="$AM_CCASFLAGS -DGCM_TABLE"
1185811894 ENABLED_AESGCM=yes
1185911895 fi
1186011896
1186111897 if test "$ENABLED_AESGCM" = "4bit"
1186211898 then
1186311899 AM_CFLAGS="$AM_CFLAGS -DGCM_TABLE_4BIT"
11900+ AM_CCASFLAGS="$AM_CCASFLAGS -DGCM_TABLE_4BIT"
1186411901 ENABLED_AESGCM=yes
1186511902 fi
1186611903
11904+ # The GCM table layout macro must reach assembled (.S) sources too: the
11905+ # PPC asm GCM_gmult_len is a single file with both layouts guarded by
11906+ # GCM_TABLE / GCM_TABLE_4BIT. Default (no explicit table choice) is 4bit.
11907+ case " $AM_CCASFLAGS " in
11908+ *" -DGCM_TABLE "*|*" -DGCM_TABLE_4BIT "*|*" -DGCM_SMALL "*|*" -DGCM_WORD32 "*) ;;
11909+ *) AM_CCASFLAGS="$AM_CCASFLAGS -DGCM_TABLE_4BIT" ;;
11910+ esac
11911+
1186711912 AM_CFLAGS="$AM_CFLAGS -DHAVE_AESGCM"
11913+ AM_CCASFLAGS="$AM_CCASFLAGS -DHAVE_AESGCM"
11914+ fi
11915+ # AES-CTR may be turned on by many presets above; mirror the feature macro to
11916+ # the assembler flags so the AES_CTR_encrypt in the PPC asm is emitted.
11917+ if test "$ENABLED_AESCTR" = "yes"
11918+ then
11919+ AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_AES_COUNTER"
11920+ fi
11921+ # Asm sources include settings.h, which enforces that AES-XTS streaming
11922+ # requires AES-XTS. Mirror the base WOLFSSL_AES_XTS macro to the assembler
11923+ # flags so that check is satisfied (it is otherwise only set for C sources).
11924+ if test "$ENABLED_AESXTS" = "yes"
11925+ then
11926+ AM_CCASFLAGS="$AM_CCASFLAGS -DWOLFSSL_AES_XTS"
1186811927fi
1186911928if test "$ENABLED_AESGCM_STREAM" != "no"
1187011929then
@@ -12993,6 +13052,10 @@ if test "$ENABLED_PPC64_ASM_INLINE_REG" = "yes"
1299313052then
1299413053 ENABLED_PPC64_ASM="inline C Reg"
1299513054fi
13055+ if test "$ENABLED_PPC64_ASM_CRYPTO" = "yes"
13056+ then
13057+ ENABLED_PPC64_ASM="$ENABLED_PPC64_ASM + crypto"
13058+ fi
1299613059echo " * PPC64 ASM $ENABLED_PPC64_ASM"
1299713060echo " * Write duplicate: $ENABLED_WRITEDUP"
1299813061echo " * Xilinx Hardware Acc.: $ENABLED_XILINX"
0 commit comments