1# Use this to help generate the asm *.S files after an import. It is not 2# perfect by any means, but does what is needed. 3# Do a 'make -f Makefile.asm all' and it will generate *.S. Move them 4# to the arch subdir, and correct any exposed paths and $ FreeBSD $ tags. 5 6.include "Makefile.inc" 7 8.if defined(ASM_aarch64) 9 10.PATH: ${LCRYPTO_SRC}/crypto \ 11 ${LCRYPTO_SRC}/crypto/aes/asm \ 12 ${LCRYPTO_SRC}/crypto/bn/asm \ 13 ${LCRYPTO_SRC}/crypto/chacha/asm \ 14 ${LCRYPTO_SRC}/crypto/ec/asm \ 15 ${LCRYPTO_SRC}/crypto/modes/asm \ 16 ${LCRYPTO_SRC}/crypto/poly1305/asm \ 17 ${LCRYPTO_SRC}/crypto/sha/asm 18 19PERLPATH= -I${LCRYPTO_SRC}/crypto/perlasm 20 21# cpuid 22SRCS= arm64cpuid.pl 23 24# aes 25SRCS+= aesv8-armx.pl vpaes-armv8.pl 26 27# bn 28SRCS+= armv8-mont.pl 29 30# chacha 31SRCS+= chacha-armv8.pl 32 33# ec 34SRCS+= ecp_nistz256-armv8.pl 35 36# modes 37SRCS+= ghashv8-armx.pl aes-gcm-armv8_64.S 38 39# poly1305 40SRCS+= poly1305-armv8.pl 41 42# sha 43SRCS+= keccak1600-armv8.pl sha1-armv8.pl sha512-armv8.pl 44 45ASM= ${SRCS:R:S/$/.S/} sha256-armv8.S 46 47all: ${ASM} 48 49CLEANFILES= ${ASM} ${SRCS:R:S/$/.s/} sha256-armv8.s 50.SUFFIXES: .pl 51 52sha256-armv8.S: sha512-armv8.pl 53 env CC=cc perl ${.ALLSRC} linux64 ${.TARGET:R:S/$/.s/} 54 ( echo '/* $$'FreeBSD'$$ */' ;\ 55 echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T:R:S/$/.pl/}. */' ;\ 56 cat ${.TARGET:R:S/$/.s/}) > ${.TARGET} 57 58.pl.S: 59 env CC=cc perl ${.IMPSRC} linux64 ${.TARGET:R:S/$/.s/} 60 ( echo '/* $$'FreeBSD'$$ */' ;\ 61 echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T:R:S/$/.pl/}. */' ;\ 62 cat ${.TARGET:R:S/$/.s/}) > ${.TARGET} 63 64.elif defined(ASM_amd64) 65 66.PATH: ${LCRYPTO_SRC}/crypto \ 67 ${LCRYPTO_SRC}/crypto/aes/asm \ 68 ${LCRYPTO_SRC}/crypto/bn/asm \ 69 ${LCRYPTO_SRC}/crypto/camellia/asm \ 70 ${LCRYPTO_SRC}/crypto/chacha/asm \ 71 ${LCRYPTO_SRC}/crypto/ec/asm \ 72 ${LCRYPTO_SRC}/crypto/md5/asm \ 73 ${LCRYPTO_SRC}/crypto/modes/asm \ 74 ${LCRYPTO_SRC}/crypto/poly1305/asm \ 75 ${LCRYPTO_SRC}/crypto/rc4/asm \ 76 ${LCRYPTO_SRC}/crypto/sha/asm \ 77 ${LCRYPTO_SRC}/crypto/whrlpool/asm \ 78 ${LCRYPTO_SRC}/engines/asm 79 80# cpuid 81SRCS= x86_64cpuid.pl 82 83# aes 84SRCS+= aesni-mb-x86_64.pl aesni-sha1-x86_64.pl aesni-sha256-x86_64.pl \ 85 aesni-x86_64.pl vpaes-x86_64.pl 86 87# bn 88SRCS+= rsaz-avx2.pl rsaz-avx512.S rsaz-x86_64.pl x86_64-gf2m.pl \ 89 x86_64-mont.pl x86_64-mont5.pl 90 91# camellia 92SRCS+= cmll-x86_64.pl 93 94# chacha 95SRCS+= chacha-x86_64.pl 96 97# ec 98SRCS+= ecp_nistz256-x86_64.pl x25519-x86_64.pl 99 100# md5 101SRCS+= md5-x86_64.pl 102 103# modes 104SRCS+= aesni-gcm-x86_64.pl ghash-x86_64.pl 105 106# poly1305 107SRCS+= poly1305-x86_64.pl 108 109# rc4 110SRCS+= rc4-md5-x86_64.pl rc4-x86_64.pl 111 112# sha 113SRCS+= keccak1600-x86_64.pl sha1-mb-x86_64.pl sha1-x86_64.pl \ 114 sha256-mb-x86_64.pl 115 116# whrlpool 117SRCS+= wp-x86_64.pl 118 119# engines 120SRCS+= e_padlock-x86_64.pl 121 122SHA_ASM= sha256-x86_64 sha512-x86_64 123SHA_SRC= sha512-x86_64.pl 124SHA_TMP= ${SHA_ASM:S/$/.s/} 125 126ASM= ${SRCS:R:S/$/.S/} ${SHA_ASM:S/$/.S/} 127 128all: ${ASM} 129 130CLEANFILES= ${ASM} ${SHA_ASM:S/$/.s/} 131.SUFFIXES: .pl 132 133.pl.S: 134 ( echo '/* $$'FreeBSD'$$ */' ;\ 135 echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T}. */' ;\ 136 env CC=cc perl ${.IMPSRC} elf ) > ${.TARGET} 137 138${SHA_TMP}: ${SHA_SRC} 139 env CC=cc perl ${.ALLSRC} elf ${.TARGET} 140 141.for s in ${SHA_ASM} 142${s}.S: ${s}.s 143 ( echo '/* $$'FreeBSD'$$ */' ;\ 144 echo '/* Do not modify. This file is auto-generated from ${SHA_SRC}. */' ;\ 145 cat ${s}.s ) > ${.TARGET} 146.endfor 147 148.elif defined(ASM_arm) 149 150.PATH: ${LCRYPTO_SRC}/crypto \ 151 ${LCRYPTO_SRC}/crypto/aes/asm \ 152 ${LCRYPTO_SRC}/crypto/bn/asm \ 153 ${LCRYPTO_SRC}/crypto/chacha/asm \ 154 ${LCRYPTO_SRC}/crypto/ec/asm \ 155 ${LCRYPTO_SRC}/crypto/modes/asm \ 156 ${LCRYPTO_SRC}/crypto/poly1305/asm \ 157 ${LCRYPTO_SRC}/crypto/sha/asm 158 159PERLPATH= -I${LCRYPTO_SRC}/crypto/perlasm 160 161# cpuid 162SRCS= armv4cpuid.pl 163 164# aes 165SRCS+= aes-armv4.pl aesv8-armx.pl bsaes-armv7.pl 166 167# bn 168SRCS+= armv4-mont.pl armv4-gf2m.pl 169 170# chacha 171SRCS+= chacha-armv4.pl 172 173# ec 174SRCS+= ecp_nistz256-armv4.pl 175 176# modes 177SRCS+= ghash-armv4.pl ghashv8-armx.pl 178 179# poly1305 180SRCS+= poly1305-armv4.pl 181 182# sha 183SRCS+= keccak1600-armv4.pl sha1-armv4-large.pl sha256-armv4.pl sha512-armv4.pl 184 185ASM= aes-armv4.S ${SRCS:R:S/$/.S/} 186 187all: ${ASM} 188 189CLEANFILES= ${ASM} ${SRCS:R:S/$/.s/} 190.SUFFIXES: .pl 191 192aes-armv4.S: aes-armv4.pl 193 ( echo '/* $$'FreeBSD'$$ */' ;\ 194 echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T}. */' ;\ 195 env CC=cc perl ${.ALLSRC} linux32 ) > ${.TARGET} 196 197.pl.S: 198 env CC=cc perl ${.IMPSRC} linux32 ${.TARGET:R:S/$/.s/} 199 ( echo '/* $$'FreeBSD'$$ */' ;\ 200 echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T:R:S/$/.pl/}. */' ;\ 201 cat ${.TARGET:R:S/$/.s/}) > ${.TARGET} 202 203.elif defined(ASM_i386) 204 205.PATH: ${LCRYPTO_SRC}/crypto \ 206 ${LCRYPTO_SRC}/crypto/aes/asm \ 207 ${LCRYPTO_SRC}/crypto/bf/asm \ 208 ${LCRYPTO_SRC}/crypto/bn/asm \ 209 ${LCRYPTO_SRC}/crypto/camellia/asm \ 210 ${LCRYPTO_SRC}/crypto/cast/asm \ 211 ${LCRYPTO_SRC}/crypto/chacha/asm \ 212 ${LCRYPTO_SRC}/crypto/des/asm \ 213 ${LCRYPTO_SRC}/crypto/ec/asm \ 214 ${LCRYPTO_SRC}/crypto/md5/asm \ 215 ${LCRYPTO_SRC}/crypto/modes/asm \ 216 ${LCRYPTO_SRC}/crypto/poly1305/asm \ 217 ${LCRYPTO_SRC}/crypto/rc4/asm \ 218 ${LCRYPTO_SRC}/crypto/rc5/asm \ 219 ${LCRYPTO_SRC}/crypto/ripemd/asm \ 220 ${LCRYPTO_SRC}/crypto/sha/asm \ 221 ${LCRYPTO_SRC}/crypto/whrlpool/asm \ 222 ${LCRYPTO_SRC}/engines/asm 223 224#PERLPATH= -I${LCRYPTO_SRC}/crypto/des/asm -I${LCRYPTO_SRC}/crypto/perlasm 225 226# cpuid 227SRCS= x86cpuid.pl 228 229# aes 230SRCS+= aesni-x86.pl vpaes-x86.pl 231 232# blowfish 233SRCS+= bf-586.pl 234 235# bn 236SRCS+= bn-586.pl co-586.pl x86-gf2m.pl x86-mont.pl 237 238# camellia 239SRCS+= cmll-x86.pl 240 241# cast 242SRCS+= cast-586.pl 243 244# chacha 245SRCS+= chacha-x86.pl 246 247# des 248SRCS+= crypt586.pl des-586.pl 249 250# ec 251SRCS+= ecp_nistz256-x86.pl 252 253# md5 254SRCS+= md5-586.pl 255 256# modes 257SRCS+= ghash-x86.pl 258 259# poly1305 260SRCS+= poly1305-x86.pl 261 262# rc4 263SRCS+= rc4-586.pl 264 265# rc5 266SRCS+= rc5-586.pl 267 268# ripemd 269SRCS+= rmd-586.pl 270 271# sha 272SRCS+= sha1-586.pl sha256-586.pl sha512-586.pl 273 274# whrlpool 275SRCS+= wp-mmx.pl 276 277# engines 278SRCS+= e_padlock-x86.pl 279 280ASM= ${SRCS:R:S/$/.S/} 281 282all: ${ASM} 283 284CLEANFILES= ${ASM} ${SRCS:R:S/$/.s/} 285.SUFFIXES: .pl 286 287.pl.S: 288 ( echo '/* $$'FreeBSD'$$ */' ;\ 289 echo '/* Do not modify. This file is auto-generated from ${.IMPSRC:T}. */' ;\ 290 echo '#ifdef PIC' ;\ 291 env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} -fpic -DPIC ${.IMPSRC:R:S/$/.s/} ;\ 292 cat ${.IMPSRC:R:S/$/.s/} ;\ 293 echo '#else' ;\ 294 env CC=cc perl ${PERLPATH} ${.IMPSRC} elf ${CFLAGS} ${.IMPSRC:R:S/$/.s/} ;\ 295 cat ${.IMPSRC:R:S/$/.s/} ;\ 296 echo '#endif' ) > ${.TARGET} 297 298.elif defined(ASM_powerpc) 299 300.PATH: ${LCRYPTO_SRC}/crypto \ 301 ${LCRYPTO_SRC}/crypto/aes/asm \ 302 ${LCRYPTO_SRC}/crypto/bn/asm \ 303 ${LCRYPTO_SRC}/crypto/chacha/asm \ 304 ${LCRYPTO_SRC}/crypto/modes/asm \ 305 ${LCRYPTO_SRC}/crypto/poly1305/asm \ 306 ${LCRYPTO_SRC}/crypto/sha/asm 307 308PERLPATH= -I${LCRYPTO_SRC}/crypto/perlasm 309 310#cpuid 311SRCS= ppccpuid.pl 312 313#bn 314SRCS+= ppc.pl ppc-mont.pl 315 316#aes 317SRCS+= aes-ppc.pl vpaes-ppc.pl aesp8-ppc.pl 318 319#sha1 320SRCS+= sha1-ppc.pl sha512-ppc.pl sha512p8-ppc.pl 321 322#modes 323SRCS+= ghashp8-ppc.pl 324 325#chacha 326SRCS+= chacha-ppc.pl 327 328#poly1305 329SRCS+= poly1305-ppc.pl poly1305-ppcfp.pl 330 331ASM= ${SRCS:R:S/$/.S/} bn-ppc.S sha256-ppc.S sha256p8-ppc.S 332 333all: ${ASM} 334 335CLEANFILES= ${ASM} 336.SUFFIXES: .pl 337 338bn-ppc.S: ppc.pl 339 env CC=cc perl ${.ALLSRC} linux32 ${.TARGET:R:S/$/.s/} 340 ( echo '/* $$'FreeBSD'$$ */' ;\ 341 echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T:R:S/$/.pl/}. */' ;\ 342 cat ${.TARGET:R:S/$/.s/}) > ${.TARGET} 343 344sha256-ppc.S: sha512-ppc.pl 345 env CC=cc perl ${.ALLSRC} linux32 ${.TARGET:R:S/$/.s/} 346 ( echo '/* $$'FreeBSD'$$ */' ;\ 347 echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T:R:S/$/.pl/}. */' ;\ 348 cat ${.TARGET:R:S/$/.s/}) > ${.TARGET} 349 350sha256p8-ppc.S: sha512p8-ppc.pl 351 env CC=cc perl ${.ALLSRC} linux32 ${.TARGET:R:S/$/.s/} 352 ( echo '/* $$'FreeBSD'$$ */' ;\ 353 echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T:R:S/$/.pl/}. */' ;\ 354 cat ${.TARGET:R:S/$/.s/}) > ${.TARGET} 355 356.pl.S: 357 env CC=cc perl ${.IMPSRC} linux32 ${.TARGET:R:S/$/.s/} 358 ( echo '/* $$'FreeBSD'$$ */' ;\ 359 echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T:R:S/$/.pl/}. */' ;\ 360 cat ${.TARGET:R:S/$/.s/}) > ${.TARGET} 361 362.elif defined(ASM_powerpc64) 363 364.PATH: ${LCRYPTO_SRC}/crypto \ 365 ${LCRYPTO_SRC}/crypto/aes/asm \ 366 ${LCRYPTO_SRC}/crypto/bn/asm \ 367 ${LCRYPTO_SRC}/crypto/chacha/asm \ 368 ${LCRYPTO_SRC}/crypto/ec/asm \ 369 ${LCRYPTO_SRC}/crypto/modes/asm \ 370 ${LCRYPTO_SRC}/crypto/poly1305/asm \ 371 ${LCRYPTO_SRC}/crypto/sha/asm 372 373PERLPATH= -I${LCRYPTO_SRC}/crypto/perlasm 374 375#cpuid 376SRCS= ppccpuid.pl 377 378#bn 379SRCS+= ppc.pl ppc-mont.pl 380 381#aes 382SRCS+= aes-ppc.pl vpaes-ppc.pl aesp8-ppc.pl 383 384#sha1 385SRCS+= sha1-ppc.pl sha512-ppc.pl sha512p8-ppc.pl 386 387#modes 388SRCS+= ghashp8-ppc.pl 389 390#chacha 391SRCS+= chacha-ppc.pl 392 393#poly1305 394SRCS+= poly1305-ppc.pl poly1305-ppcfp.pl 395 396#ec 397SRCS+= ecp_nistp521-ppc64.pl ecp_nistz256-ppc64.pl x25519-ppc64.pl 398 399#keccak1600 400SRCS+= keccak1600-ppc64.pl 401 402ASM= ${SRCS:R:S/$/.S/} bn-ppc.S sha256-ppc.S sha256p8-ppc.S 403 404all: ${ASM} 405 406CLEANFILES= ${ASM} 407.SUFFIXES: .pl 408 409bn-ppc.S: ppc.pl 410 env CC=cc perl ${.ALLSRC} linux64v2 ${.TARGET:R:S/$/.s/} 411 ( echo '/* $$'FreeBSD'$$ */' ;\ 412 echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T:R:S/$/.pl/}. */' ;\ 413 cat ${.TARGET:R:S/$/.s/}) > ${.TARGET} 414 415sha256-ppc.S: sha512-ppc.pl 416 env CC=cc perl ${.ALLSRC} linux64v2 ${.TARGET:R:S/$/.s/} 417 ( echo '/* $$'FreeBSD'$$ */' ;\ 418 echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T:R:S/$/.pl/}. */' ;\ 419 cat ${.TARGET:R:S/$/.s/}) > ${.TARGET} 420 421sha256p8-ppc.S: sha512p8-ppc.pl 422 env CC=cc perl ${.ALLSRC} linux64v2 ${.TARGET:R:S/$/.s/} 423 ( echo '/* $$'FreeBSD'$$ */' ;\ 424 echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T:R:S/$/.pl/}. */' ;\ 425 cat ${.TARGET:R:S/$/.s/}) > ${.TARGET} 426 427.pl.S: 428 env CC=cc perl ${.IMPSRC} linux64v2 ${.TARGET:R:S/$/.s/} 429 ( echo '/* $$'FreeBSD'$$ */' ;\ 430 echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T:R:S/$/.pl/}. */' ;\ 431 cat ${.TARGET:R:S/$/.s/}) > ${.TARGET} 432 433.elif defined(ASM_powerpc64le) 434 435.PATH: ${LCRYPTO_SRC}/crypto \ 436 ${LCRYPTO_SRC}/crypto/aes/asm \ 437 ${LCRYPTO_SRC}/crypto/bn/asm \ 438 ${LCRYPTO_SRC}/crypto/chacha/asm \ 439 ${LCRYPTO_SRC}/crypto/ec/asm \ 440 ${LCRYPTO_SRC}/crypto/modes/asm \ 441 ${LCRYPTO_SRC}/crypto/poly1305/asm \ 442 ${LCRYPTO_SRC}/crypto/sha/asm 443 444PERLPATH= -I${LCRYPTO_SRC}/crypto/perlasm 445 446#cpuid 447SRCS= ppccpuid.pl 448 449#bn 450SRCS+= ppc.pl ppc-mont.pl 451 452#aes 453SRCS+= aes-ppc.pl vpaes-ppc.pl aesp8-ppc.pl 454 455#sha1 456SRCS+= sha1-ppc.pl sha512-ppc.pl sha512p8-ppc.pl 457 458#modes 459SRCS+= ghashp8-ppc.pl 460 461#chacha 462SRCS+= chacha-ppc.pl 463 464#poly1305 465SRCS+= poly1305-ppc.pl poly1305-ppcfp.pl 466 467#ec 468SRCS+= ecp_nistp521-ppc64.pl ecp_nistz256-ppc64.pl x25519-ppc64.pl 469 470#keccak1600 471SRCS+= keccak1600-ppc64.pl 472 473ASM= ${SRCS:R:S/$/.S/} bn-ppc.S sha256-ppc.S sha256p8-ppc.S 474 475all: ${ASM} 476 477CLEANFILES= ${ASM} 478.SUFFIXES: .pl 479 480bn-ppc.S: ppc.pl 481 env CC=cc perl ${.ALLSRC} linux64le ${.TARGET:R:S/$/.s/} 482 ( echo '/* $$'FreeBSD'$$ */' ;\ 483 echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T:R:S/$/.pl/}. */' ;\ 484 cat ${.TARGET:R:S/$/.s/}) > ${.TARGET} 485 486sha256-ppc.S: sha512-ppc.pl 487 env CC=cc perl ${.ALLSRC} linux64le ${.TARGET:R:S/$/.s/} 488 ( echo '/* $$'FreeBSD'$$ */' ;\ 489 echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T:R:S/$/.pl/}. */' ;\ 490 cat ${.TARGET:R:S/$/.s/}) > ${.TARGET} 491 492sha256p8-ppc.S: sha512p8-ppc.pl 493 env CC=cc perl ${.ALLSRC} linux64le ${.TARGET:R:S/$/.s/} 494 ( echo '/* $$'FreeBSD'$$ */' ;\ 495 echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T:R:S/$/.pl/}. */' ;\ 496 cat ${.TARGET:R:S/$/.s/}) > ${.TARGET} 497 498.pl.S: 499 env CC=cc perl ${.IMPSRC} linux64le ${.TARGET:R:S/$/.s/} 500 ( echo '/* $$'FreeBSD'$$ */' ;\ 501 echo '/* Do not modify. This file is auto-generated from ${.ALLSRC:T:R:S/$/.pl/}. */' ;\ 502 cat ${.TARGET:R:S/$/.s/}) > ${.TARGET} 503 504.endif 505 506.include <bsd.prog.mk> 507