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