1e1051a39Sopenharmony_ciLIBS=../../libcrypto
2e1051a39Sopenharmony_ci
3e1051a39Sopenharmony_ci$BNASM=bn_asm.c
4e1051a39Sopenharmony_ciIF[{- !$disabled{asm} -}]
5e1051a39Sopenharmony_ci  # Define source files and macros per asm architecture
6e1051a39Sopenharmony_ci  # Known macros are:
7e1051a39Sopenharmony_ci  #
8e1051a39Sopenharmony_ci  # OPENSSL_BN_ASM_PART_WORDS     For any collection with /-586/ file names
9e1051a39Sopenharmony_ci  # OPENSSL_BN_ASM_MONT           For any collection with /-mont/ file names
10e1051a39Sopenharmony_ci  # OPENSSL_BN_ASM_MONT5          For any collection with /-mont5/ file names
11e1051a39Sopenharmony_ci  # OPENSSL_BN_ASM_GF2m           For any collection with /-gf2m/ file names
12e1051a39Sopenharmony_ci  # OPENSSL_IA32_SSE2             For any collection with /86/ file names
13e1051a39Sopenharmony_ci  #                               when sse2 is enabled
14e1051a39Sopenharmony_ci  # BN_DIV3W                      For any collection with /-div3w/ file names
15e1051a39Sopenharmony_ci  #
16e1051a39Sopenharmony_ci  # All variables are named in such a way that they can be "indexed" with
17e1051a39Sopenharmony_ci  # $target{asm_arch}
18e1051a39Sopenharmony_ci
19e1051a39Sopenharmony_ci  $BNASM_x86=bn-586.S co-586.S x86-mont.S x86-gf2m.S
20e1051a39Sopenharmony_ci  # bn-586 is the only one implementing bn_*_part_words
21e1051a39Sopenharmony_ci  # => OPENSSL_BN_ASM_PART_WORDS
22e1051a39Sopenharmony_ci  $BNDEF_x86=OPENSSL_BN_ASM_PART_WORDS OPENSSL_BN_ASM_MONT OPENSSL_BN_ASM_GF2m
23e1051a39Sopenharmony_ci  $BNDEF_x86_sse2=OPENSSL_IA32_SSE2
24e1051a39Sopenharmony_ci
25e1051a39Sopenharmony_ci  $BNASM_x86_64=\
26e1051a39Sopenharmony_ci          x86_64-mont.s x86_64-mont5.s x86_64-gf2m.s rsaz_exp.c rsaz-x86_64.s \
27e1051a39Sopenharmony_ci          rsaz-avx2.s rsaz_exp_x2.c rsaz-avx512.s
28e1051a39Sopenharmony_ci  IF[{- $config{target} !~ /^VC/ -}]
29e1051a39Sopenharmony_ci    $BNASM_x86_64=asm/x86_64-gcc.c $BNASM_x86_64
30e1051a39Sopenharmony_ci  ELSE
31e1051a39Sopenharmony_ci    $BNASM_x86_64=bn_asm.c $BNASM_x86_64
32e1051a39Sopenharmony_ci  ENDIF
33e1051a39Sopenharmony_ci  $BNDEF_x86_64=OPENSSL_BN_ASM_MONT OPENSSL_BN_ASM_MONT5 OPENSSL_BN_ASM_GF2m
34e1051a39Sopenharmony_ci  $BNDEF_x86_64_sse2=OPENSSL_IA32_SSE2
35e1051a39Sopenharmony_ci
36e1051a39Sopenharmony_ci  IF[{- $config{target} !~ /^VC/ -}]
37e1051a39Sopenharmony_ci    $BNASM_ia64=bn-ia64.s ia64-mont.s
38e1051a39Sopenharmony_ci  ELSE
39e1051a39Sopenharmony_ci    $BNASM_ia64=bn_asm.c ia64-mont.s
40e1051a39Sopenharmony_ci  ENDIF
41e1051a39Sopenharmony_ci
42e1051a39Sopenharmony_ci  $BNASM_sparcv9=asm/sparcv8plus.S sparcv9-mont.S sparcv9a-mont.S vis3-mont.S \
43e1051a39Sopenharmony_ci          sparct4-mont.S bn_sparc.c
44e1051a39Sopenharmony_ci  $BNDEF_sparcv9=OPENSSL_BN_ASM_MONT
45e1051a39Sopenharmony_ci  $BNASM_sparcv9_ec2m=sparcv9-gf2m.S
46e1051a39Sopenharmony_ci  $BNDEF_sparcv9_ec2m=OPENSSL_BN_ASM_GF2m
47e1051a39Sopenharmony_ci
48e1051a39Sopenharmony_ci  $BNASM_sparcv8=asm/sparcv8.S
49e1051a39Sopenharmony_ci
50e1051a39Sopenharmony_ci  $BNASM_alpha=bn_asm.c alpha-mont.S
51e1051a39Sopenharmony_ci  $BNDEF_alpha=OPENSSL_BN_ASM_MONT
52e1051a39Sopenharmony_ci
53e1051a39Sopenharmony_ci  $BNASM_mips32=bn-mips.S mips-mont.S
54e1051a39Sopenharmony_ci  $BNDEF_mips32=OPENSSL_BN_ASM_MONT
55e1051a39Sopenharmony_ci  $BNASM_mips64=$BNASM_mips32
56e1051a39Sopenharmony_ci  $BNDEF_mips64=$BNDEF_mips32
57e1051a39Sopenharmony_ci
58e1051a39Sopenharmony_ci  IF[{- ($target{perlasm_scheme} // '') eq '31' -}]
59e1051a39Sopenharmony_ci    $BNASM_s390x=bn_asm.c s390x-mont.S
60e1051a39Sopenharmony_ci  ELSE
61e1051a39Sopenharmony_ci    $BNASM_s390x=asm/s390x.S s390x-mont.S
62e1051a39Sopenharmony_ci  ENDIF
63e1051a39Sopenharmony_ci  $BNDEF_s390x=OPENSSL_BN_ASM_MONT
64e1051a39Sopenharmony_ci  $BNASM_s390x_ec2m=s390x-gf2m.s
65e1051a39Sopenharmony_ci  $BNDEF_s390x_ec2m=OPENSSL_BN_ASM_GF2m
66e1051a39Sopenharmony_ci
67e1051a39Sopenharmony_ci  $BNASM_armv4=bn_asm.c armv4-mont.S
68e1051a39Sopenharmony_ci  $BNDEF_armv4=OPENSSL_BN_ASM_MONT
69e1051a39Sopenharmony_ci  $BNASM_armv4_ec2m=armv4-gf2m.S
70e1051a39Sopenharmony_ci  $BNDEF_armv4_ec2m=OPENSSL_BN_ASM_GF2m
71e1051a39Sopenharmony_ci
72e1051a39Sopenharmony_ci  $BNASM_aarch64=bn_asm.c armv8-mont.S
73e1051a39Sopenharmony_ci  $BNDEF_aarch64=OPENSSL_BN_ASM_MONT
74e1051a39Sopenharmony_ci
75e1051a39Sopenharmony_ci  $BNASM_parisc11=bn_asm.c parisc-mont.s
76e1051a39Sopenharmony_ci  $BNDEF_parisc11=OPENSSL_BN_ASM_MONT
77e1051a39Sopenharmony_ci  $BNASM_parisc20_64=$BNASM_parisc11
78e1051a39Sopenharmony_ci  $BNDEF_parisc20_64=$BNDEF_parisc11
79e1051a39Sopenharmony_ci
80e1051a39Sopenharmony_ci  $BNASM_ppc32=bn_ppc.c bn-ppc.s ppc-mont.s
81e1051a39Sopenharmony_ci  $BNDEF_ppc32=OPENSSL_BN_ASM_MONT
82e1051a39Sopenharmony_ci  $BNASM_ppc64=$BNASM_ppc32
83e1051a39Sopenharmony_ci  $BNDEF_ppc64=$BNDEF_ppc32
84e1051a39Sopenharmony_ci
85e1051a39Sopenharmony_ci  $BNASM_c64xplus=asm/bn-c64xplus.asm
86e1051a39Sopenharmony_ci  $BNASM_c64xplus_ec2m=c64xplus-gf2m.s
87e1051a39Sopenharmony_ci  $BNDEF_c64xplus_ec2m=OPENSSL_BN_ASM_GF2m
88e1051a39Sopenharmony_ci
89e1051a39Sopenharmony_ci  # Now that we have defined all the arch specific variables, use the
90e1051a39Sopenharmony_ci  # appropriate ones, and define the appropriate macros
91e1051a39Sopenharmony_ci  IF[$BNASM_{- $target{asm_arch} -}]
92e1051a39Sopenharmony_ci    $BNASM=$BNASM_{- $target{asm_arch} -}
93e1051a39Sopenharmony_ci    $BNDEF=$BNDEF_{- $target{asm_arch} -}
94e1051a39Sopenharmony_ci    IF[{- !$disabled{ec2m} -}]
95e1051a39Sopenharmony_ci      $BNASM=$BNASM $BNASM_{- $target{asm_arch} -}_ec2m
96e1051a39Sopenharmony_ci      $BNDEF=$BNDEF $BNDEF_{- $target{asm_arch} -}_ec2m
97e1051a39Sopenharmony_ci    ENDIF
98e1051a39Sopenharmony_ci    IF[{- !$disabled{sse2} -}]
99e1051a39Sopenharmony_ci      $BNDEF=$BNDEF $BNDEF_{- $target{asm_arch} -}_sse2
100e1051a39Sopenharmony_ci    ENDIF
101e1051a39Sopenharmony_ci  ENDIF
102e1051a39Sopenharmony_ciENDIF
103e1051a39Sopenharmony_ci
104e1051a39Sopenharmony_ci$COMMON=bn_add.c bn_div.c bn_exp.c bn_lib.c bn_ctx.c bn_mul.c \
105e1051a39Sopenharmony_ci        bn_mod.c bn_conv.c bn_rand.c bn_shift.c bn_word.c bn_blind.c \
106e1051a39Sopenharmony_ci        bn_kron.c bn_sqrt.c bn_gcd.c bn_prime.c bn_sqr.c \
107e1051a39Sopenharmony_ci        bn_recp.c bn_mont.c bn_mpi.c bn_exp2.c bn_gf2m.c bn_nist.c \
108e1051a39Sopenharmony_ci        bn_intern.c bn_dh.c bn_rsa_fips186_4.c bn_const.c
109e1051a39Sopenharmony_ciSOURCE[../../libcrypto]=$COMMON $BNASM bn_print.c bn_err.c bn_srp.c
110e1051a39Sopenharmony_ciDEFINE[../../libcrypto]=$BNDEF
111e1051a39Sopenharmony_ciIF[{- !$disabled{'deprecated-0.9.8'} -}]
112e1051a39Sopenharmony_ci  SOURCE[../../libcrypto]=bn_depr.c
113e1051a39Sopenharmony_ciENDIF
114e1051a39Sopenharmony_ciIF[{- !$disabled{'deprecated-3.0'} -}]
115e1051a39Sopenharmony_ci  SOURCE[../../libcrypto]=bn_x931p.c
116e1051a39Sopenharmony_ciENDIF
117e1051a39Sopenharmony_ciSOURCE[../../providers/libfips.a]=$COMMON $BNASM
118e1051a39Sopenharmony_ciDEFINE[../../providers/libfips.a]=$BNDEF
119e1051a39Sopenharmony_ci# Implementations are now spread across several libraries, so the defines
120e1051a39Sopenharmony_ci# need to be applied to all affected libraries and modules.
121e1051a39Sopenharmony_ciDEFINE[../../providers/libcommon.a]=$BNDEF
122e1051a39Sopenharmony_ci
123e1051a39Sopenharmony_ciINCLUDE[bn_exp.o]=..
124e1051a39Sopenharmony_ci
125e1051a39Sopenharmony_ciGENERATE[bn-586.S]=asm/bn-586.pl
126e1051a39Sopenharmony_ciDEPEND[bn-586.S]=../perlasm/x86asm.pl
127e1051a39Sopenharmony_ciGENERATE[co-586.S]=asm/co-586.pl
128e1051a39Sopenharmony_ciDEPEND[co-586.S]=../perlasm/x86asm.pl
129e1051a39Sopenharmony_ciGENERATE[x86-mont.S]=asm/x86-mont.pl
130e1051a39Sopenharmony_ciDEPEND[x86-mont.S]=../perlasm/x86asm.pl
131e1051a39Sopenharmony_ciGENERATE[x86-gf2m.S]=asm/x86-gf2m.pl
132e1051a39Sopenharmony_ciDEPEND[x86-gf2m.S]=../perlasm/x86asm.pl
133e1051a39Sopenharmony_ci
134e1051a39Sopenharmony_ciGENERATE[sparcv9a-mont.S]=asm/sparcv9a-mont.pl
135e1051a39Sopenharmony_ciINCLUDE[sparcv9a-mont.o]=..
136e1051a39Sopenharmony_ciGENERATE[sparcv9-mont.S]=asm/sparcv9-mont.pl
137e1051a39Sopenharmony_ciINCLUDE[sparcv9-mont.o]=..
138e1051a39Sopenharmony_ciGENERATE[vis3-mont.S]=asm/vis3-mont.pl
139e1051a39Sopenharmony_ciINCLUDE[vis3-mont.o]=..
140e1051a39Sopenharmony_ciGENERATE[sparct4-mont.S]=asm/sparct4-mont.pl
141e1051a39Sopenharmony_ciINCLUDE[sparct4-mont.o]=..
142e1051a39Sopenharmony_ciGENERATE[sparcv9-gf2m.S]=asm/sparcv9-gf2m.pl
143e1051a39Sopenharmony_ciINCLUDE[sparcv9-gf2m.o]=..
144e1051a39Sopenharmony_ci
145e1051a39Sopenharmony_ciGENERATE[bn-mips.S]=asm/mips.pl
146e1051a39Sopenharmony_ciINCLUDE[bn-mips.o]=..
147e1051a39Sopenharmony_ciGENERATE[mips-mont.S]=asm/mips-mont.pl
148e1051a39Sopenharmony_ciINCLUDE[mips-mont.o]=..
149e1051a39Sopenharmony_ci
150e1051a39Sopenharmony_ciGENERATE[s390x-mont.S]=asm/s390x-mont.pl
151e1051a39Sopenharmony_ciGENERATE[s390x-gf2m.s]=asm/s390x-gf2m.pl
152e1051a39Sopenharmony_ci
153e1051a39Sopenharmony_ciGENERATE[x86_64-mont.s]=asm/x86_64-mont.pl
154e1051a39Sopenharmony_ciGENERATE[x86_64-mont5.s]=asm/x86_64-mont5.pl
155e1051a39Sopenharmony_ciGENERATE[x86_64-gf2m.s]=asm/x86_64-gf2m.pl
156e1051a39Sopenharmony_ciGENERATE[rsaz-x86_64.s]=asm/rsaz-x86_64.pl
157e1051a39Sopenharmony_ciGENERATE[rsaz-avx2.s]=asm/rsaz-avx2.pl
158e1051a39Sopenharmony_ciGENERATE[rsaz-avx512.s]=asm/rsaz-avx512.pl
159e1051a39Sopenharmony_ci
160e1051a39Sopenharmony_ciGENERATE[bn-ia64.s]=asm/ia64.S
161e1051a39Sopenharmony_ciGENERATE[ia64-mont.s]=asm/ia64-mont.pl
162e1051a39Sopenharmony_ci
163e1051a39Sopenharmony_ciGENERATE[parisc-mont.s]=asm/parisc-mont.pl
164e1051a39Sopenharmony_ci
165e1051a39Sopenharmony_ci# ppc - AIX, Linux, MacOS X...
166e1051a39Sopenharmony_ciGENERATE[bn-ppc.s]=asm/ppc.pl
167e1051a39Sopenharmony_ciGENERATE[ppc-mont.s]=asm/ppc-mont.pl
168e1051a39Sopenharmony_ciGENERATE[ppc64-mont.s]=asm/ppc64-mont.pl
169e1051a39Sopenharmony_ci
170e1051a39Sopenharmony_ciGENERATE[alpha-mont.S]=asm/alpha-mont.pl
171e1051a39Sopenharmony_ci
172e1051a39Sopenharmony_ciGENERATE[armv4-mont.S]=asm/armv4-mont.pl
173e1051a39Sopenharmony_ciINCLUDE[armv4-mont.o]=..
174e1051a39Sopenharmony_ciGENERATE[armv4-gf2m.S]=asm/armv4-gf2m.pl
175e1051a39Sopenharmony_ciINCLUDE[armv4-gf2m.o]=..
176e1051a39Sopenharmony_ciGENERATE[armv8-mont.S]=asm/armv8-mont.pl
177e1051a39Sopenharmony_ciINCLUDE[armv8-mont.o]=..
178