[openssl] master update

Richard Levitte levitte at openssl.org
Mon Jun 17 14:14:57 UTC 2019


The branch master has been updated
       via  30478c97837a026ba56718f98d490adf7bce2760 (commit)
       via  3a561b06d9e897a7613843f2bd0752297ab56dd7 (commit)
       via  8c0098a8de9ad858f575a3aab3b94b1ada773b28 (commit)
       via  246b50605ff4c278c91c22b84bb7ed3f4bd677ec (commit)
       via  bcb7afe18a46462bb4fdb12c0ff2b4435b08cf78 (commit)
       via  a9bb7e9270d26416cc387bc0777c18f9690e2302 (commit)
       via  94707b0b68a16e806d27a06d9297732045319197 (commit)
       via  681c7e905dcc16ed8a0253580a303df4b60c3440 (commit)
       via  6fe56d84702cbaccf758c4faf6af28f2797ff1d8 (commit)
       via  2ffea443223a943efff0f642c37824b63b7e3e30 (commit)
       via  6b90902faf5c8ec6d8b5801d91bc1e87a179e3b7 (commit)
       via  e698cfe4450ddafe9199468692ce5ffd74124df3 (commit)
       via  edc7851a2cb8b53cc280cbfac9319c9b079c57e2 (commit)
       via  792ea008af17238d2af91301241973dc4f4f544c (commit)
       via  053d0b2226c224b8833d7d651428453ac65ee7ca (commit)
       via  cd42b9e9c275ab88515259da4eb3802ecda7fa7b (commit)
       via  d67d04f37833b0b2e60367f01f994252bf2e259c (commit)
       via  aa76ff26ce1d1f5404794c7529b419f3de8e06ae (commit)
       via  6e1ba4721906c0a8486ca5acfb75353fec6c582b (commit)
       via  d9dfeb940c9e0c99d5c41464ca1bc6aa40da4184 (commit)
       via  e6f98ae404344e4aff55c209dc0f91d76e69fb27 (commit)
       via  989b2ad786ee43438bbb8b33f857ba0ce6e10082 (commit)
       via  b19fe714e9d4c50dcb33259346f06d3924b337b7 (commit)
       via  0ee7b9fe7f9afadcf566d740e01043faeaa9476e (commit)
      from  26de4ec68f9c332c8d24376b986cd54954d7c6d2 (commit)


- Log -----------------------------------------------------------------
commit 30478c97837a026ba56718f98d490adf7bce2760
Author: Richard Levitte <levitte at openssl.org>
Date:   Sun Jun 16 23:01:10 2019 +0200

    Configure: final cleanup of asm related things
    
    Remove the *_asm templates in Configurations/00-base-templates.conf,
    all attempts to inherit them, and the asm() perl function.
    
    [extended tests]
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/9166)

commit 3a561b06d9e897a7613843f2bd0752297ab56dd7
Author: Richard Levitte <levitte at openssl.org>
Date:   Sun Jun 16 22:39:19 2019 +0200

    Move padlock_asm_src file information to build.info files
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/9166)

commit 8c0098a8de9ad858f575a3aab3b94b1ada773b28
Author: Richard Levitte <levitte at openssl.org>
Date:   Sun Jun 16 22:34:09 2019 +0200

    Move keccak1600_asm_src file information to build.info files
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/9166)

commit 246b50605ff4c278c91c22b84bb7ed3f4bd677ec
Author: Richard Levitte <levitte at openssl.org>
Date:   Sun Jun 16 22:28:32 2019 +0200

    Move poly1305_asm_src file information to build.info files
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/9166)

commit bcb7afe18a46462bb4fdb12c0ff2b4435b08cf78
Author: Richard Levitte <levitte at openssl.org>
Date:   Sun Jun 16 22:21:50 2019 +0200

    Move chacha_asm_src file information to build.info files
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/9166)

commit a9bb7e9270d26416cc387bc0777c18f9690e2302
Author: Richard Levitte <levitte at openssl.org>
Date:   Sun Jun 16 22:17:26 2019 +0200

    Move modes_asm_src file information to build.info files
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/9166)

commit 94707b0b68a16e806d27a06d9297732045319197
Author: Richard Levitte <levitte at openssl.org>
Date:   Sun Jun 16 22:06:43 2019 +0200

    Move cmll_asm_src file information to build.info files
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/9166)

commit 681c7e905dcc16ed8a0253580a303df4b60c3440
Author: Richard Levitte <levitte at openssl.org>
Date:   Sun Jun 16 22:03:00 2019 +0200

    Move wp_asm_src file information to build.info files
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/9166)

commit 6fe56d84702cbaccf758c4faf6af28f2797ff1d8
Author: Richard Levitte <levitte at openssl.org>
Date:   Sun Jun 16 21:57:13 2019 +0200

    Move rc5_asm_src file information to build.info files
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/9166)

commit 2ffea443223a943efff0f642c37824b63b7e3e30
Author: Richard Levitte <levitte at openssl.org>
Date:   Sun Jun 16 21:54:35 2019 +0200

    Move rmd160_asm_src file information to build.info files
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/9166)

commit 6b90902faf5c8ec6d8b5801d91bc1e87a179e3b7
Author: Richard Levitte <levitte at openssl.org>
Date:   Sun Jun 16 21:50:39 2019 +0200

    Move rc4_asm_src file information to build.info files
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/9166)

commit e698cfe4450ddafe9199468692ce5ffd74124df3
Author: Richard Levitte <levitte at openssl.org>
Date:   Sun Jun 16 21:46:38 2019 +0200

    Move cast_asm_src file information to build.info files
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/9166)

commit edc7851a2cb8b53cc280cbfac9319c9b079c57e2
Author: Richard Levitte <levitte at openssl.org>
Date:   Sun Jun 16 21:46:10 2019 +0200

    Move sha1_asm_src file information to build.info files
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/9166)

commit 792ea008af17238d2af91301241973dc4f4f544c
Author: Richard Levitte <levitte at openssl.org>
Date:   Sun Jun 16 21:25:52 2019 +0200

    Move md5_asm_src file information to build.info files
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/9166)

commit 053d0b2226c224b8833d7d651428453ac65ee7ca
Author: Richard Levitte <levitte at openssl.org>
Date:   Sun Jun 16 21:20:43 2019 +0200

    Move bf_asm_src file information to build.info files
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/9166)

commit cd42b9e9c275ab88515259da4eb3802ecda7fa7b
Author: Richard Levitte <levitte at openssl.org>
Date:   Sun Jun 16 21:03:07 2019 +0200

    Move aes_asm_src file information to build.info files
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/9166)

commit d67d04f37833b0b2e60367f01f994252bf2e259c
Author: Richard Levitte <levitte at openssl.org>
Date:   Sun Jun 16 20:21:48 2019 +0200

    Move des_asm_src file information to build.info files
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/9166)

commit aa76ff26ce1d1f5404794c7529b419f3de8e06ae
Author: Richard Levitte <levitte at openssl.org>
Date:   Sun Jun 16 19:57:52 2019 +0200

    Move ec_asm_src file information to build.info files
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/9166)

commit 6e1ba4721906c0a8486ca5acfb75353fec6c582b
Author: Richard Levitte <levitte at openssl.org>
Date:   Sun Jun 16 19:35:08 2019 +0200

    Move cpuid_asm_src file information to build.info files
    
    Also took away the internal 'debug-linux-ia32-aes' config target, as
    it's broken (refers to files that no longer exist).
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/9166)

commit d9dfeb940c9e0c99d5c41464ca1bc6aa40da4184
Author: Richard Levitte <levitte at openssl.org>
Date:   Sun Jun 16 16:56:25 2019 +0200

    Move bn_asm_src file information to build.info files
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/9166)

commit e6f98ae404344e4aff55c209dc0f91d76e69fb27
Author: Richard Levitte <levitte at openssl.org>
Date:   Sun Jun 16 13:32:58 2019 +0200

    Configure: add mechanism to specify asm target architecture
    
    As preparation for moving asm file specs to build.info files, we must
    make sure there is still some base information to help select the
    correct files.
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/9166)

commit 989b2ad786ee43438bbb8b33f857ba0ce6e10082
Author: Richard Levitte <levitte at openssl.org>
Date:   Sun Jun 16 12:56:21 2019 +0200

    Move uplink file information to build.info files
    
    This file information was hidden in config target files, when they
    should really be part of build.info like any other file we build
    from.  With build.info variables, the task became much easier.
    
    We take the opportunity to move apps_init_src and apps_aux_src to
    apps/build.info as well, and to clean up apps/build.info.
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/9166)

commit b19fe714e9d4c50dcb33259346f06d3924b337b7
Author: Richard Levitte <levitte at openssl.org>
Date:   Sun Jun 16 12:37:21 2019 +0200

    Configure: add mechanism to specify uplink target architecture
    
    As preparation for moving uplink file specs to build.info files, we
    must make sure there is still some base information to help select the
    correct files.
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/9166)

commit 0ee7b9fe7f9afadcf566d740e01043faeaa9476e
Author: Richard Levitte <levitte at openssl.org>
Date:   Sun Jun 16 11:38:30 2019 +0200

    Configure: allow conditions and variable values to have variable references
    
    This will allow building variables on other variables, and to have
    conditions based on variable contents.
    
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/9166)

-----------------------------------------------------------------------

Summary of changes:
 Configurations/00-base-templates.conf | 208 --------------------------
 Configurations/10-main.conf           | 274 ++++++++++++++++++++++------------
 Configurations/15-android.conf        |  19 ++-
 Configurations/15-ios.conf            |   6 +-
 Configurations/50-djgpp.conf          |   2 +-
 Configurations/50-haiku.conf          |   4 +-
 Configurations/50-masm.conf           |   7 +-
 Configurations/90-team.norelease.conf |  34 +----
 Configurations/README                 |  61 +-------
 Configure                             | 146 ++----------------
 NOTES.WIN                             |   2 -
 apps/build.info                       |  49 ++++--
 crypto/aes/build.info                 |  67 ++++++++-
 crypto/bf/build.info                  |  15 +-
 crypto/bn/build.info                  | 106 ++++++++++++-
 crypto/build.info                     |  57 ++++++-
 crypto/camellia/build.info            |  18 ++-
 crypto/cast/build.info                |  16 +-
 crypto/chacha/build.info              |  27 +++-
 crypto/des/build.info                 |  16 +-
 crypto/ec/build.info                  |  47 +++++-
 crypto/md5/build.info                 |  19 ++-
 crypto/modes/build.info               |  52 ++++++-
 crypto/poly1305/build.info            |  36 ++++-
 crypto/rc4/build.info                 |  21 ++-
 crypto/rc5/build.info                 |  15 +-
 crypto/ripemd/build.info              |  17 ++-
 crypto/sha/build.info                 |  78 +++++++++-
 crypto/whrlpool/build.info            |  21 ++-
 engines/build.info                    |  20 ++-
 test/build.info                       |  29 ++--
 31 files changed, 890 insertions(+), 599 deletions(-)

diff --git a/Configurations/00-base-templates.conf b/Configurations/00-base-templates.conf
index 20298c2..98200af 100644
--- a/Configurations/00-base-templates.conf
+++ b/Configurations/00-base-templates.conf
@@ -14,28 +14,6 @@ my %targets=(
 	thread_scheme	=> "(unknown)", # Assume we don't know
 	thread_defines	=> [],
 
-	apps_aux_src	=> "",
-	apps_init_src	=> "",
-	cpuid_asm_src	=> "mem_clr.c",
-	uplink_aux_src	=> "",
-	bn_asm_src	=> "bn_asm.c",
-	ec_asm_src	=> "",
-	des_asm_src	=> "des_enc.c fcrypt_b.c",
-	aes_asm_src	=> "aes_core.c aes_cbc.c",
-	bf_asm_src	=> "bf_enc.c",
-	md5_asm_src	=> "",
-	cast_asm_src	=> "c_enc.c",
-	rc4_asm_src	=> "rc4_enc.c rc4_skey.c",
-	rmd160_asm_src	=> "",
-	rc5_asm_src	=> "rc5_enc.c",
-	wp_asm_src	=> "wp_block.c",
-	cmll_asm_src	=> "camellia.c cmll_misc.c cmll_cbc.c",
-	modes_asm_src	=> "",
-	padlock_asm_src	=> "",
-	chacha_asm_src	=> "chacha_enc.c",
-	poly1305_asm_src	=> "",
-	keccak1600_asm_src	=> "keccak1600.c",
-
 	unistd		=> "<unistd.h>",
 	shared_target	=> "",
 	shared_cflag	=> "",
@@ -168,190 +146,4 @@ my %targets=(
 
         perl_platform    => 'VMS',
     },
-
-    uplink_common => {
-	template	=> 1,
-	apps_init_src	=> add("../ms/applink.c"),
-	uplink_aux_src	=> add("../ms/uplink.c"),
-	defines		=> add("OPENSSL_USE_APPLINK"),
-    },
-    x86_uplink => {
-	inherit_from	=> [ "uplink_common" ],
-	template	=> 1,
-	uplink_aux_src	=> add("uplink-x86.s"),
-    },
-    x86_64_uplink => {
-	inherit_from	=> [ "uplink_common" ],
-	template	=> 1,
-	uplink_aux_src	=> add("uplink-x86_64.s"),
-    },
-    ia64_uplink => {
-	inherit_from	=> [ "uplink_common" ],
-	template	=> 1,
-	uplink_aux_src	=> add("uplink-ia64.s"),
-    },
-
-    x86_asm => {
-	template	=> 1,
-	cpuid_asm_src	=> "x86cpuid.s",
-	bn_asm_src	=> "bn-586.s co-586.s x86-mont.s x86-gf2m.s",
-	ec_asm_src	=> "ecp_nistz256.c ecp_nistz256-x86.s",
-	des_asm_src	=> "des-586.s crypt586.s",
-	aes_asm_src	=> "aes-586.s vpaes-x86.s aesni-x86.s",
-	bf_asm_src	=> "bf-586.s",
-	md5_asm_src	=> "md5-586.s",
-	cast_asm_src	=> "cast-586.s",
-	sha1_asm_src	=> "sha1-586.s sha256-586.s sha512-586.s",
-	rc4_asm_src	=> "rc4-586.s",
-	rmd160_asm_src	=> "rmd-586.s",
-	rc5_asm_src	=> "rc5-586.s",
-	wp_asm_src	=> "wp_block.c wp-mmx.s",
-	cmll_asm_src	=> "cmll-x86.s",
-	modes_asm_src	=> "ghash-x86.s",
-	padlock_asm_src	=> "e_padlock-x86.s",
-	chacha_asm_src	=> "chacha-x86.s",
-	poly1305_asm_src=> "poly1305-x86.s",
-    },
-    x86_elf_asm => {
-	template	=> 1,
-	inherit_from	=> [ "x86_asm" ],
-	perlasm_scheme	=> "elf"
-    },
-    x86_64_asm => {
-	template	=> 1,
-	cpuid_asm_src   => "x86_64cpuid.s",
-	bn_asm_src      => "asm/x86_64-gcc.c x86_64-mont.s x86_64-mont5.s x86_64-gf2m.s rsaz_exp.c rsaz-x86_64.s rsaz-avx2.s",
-	ec_asm_src      => "ecp_nistz256.c ecp_nistz256-x86_64.s x25519-x86_64.s",
-	aes_asm_src     => "aes-x86_64.s vpaes-x86_64.s bsaes-x86_64.s aesni-x86_64.s aesni-sha1-x86_64.s aesni-sha256-x86_64.s aesni-mb-x86_64.s",
-	md5_asm_src     => "md5-x86_64.s",
-	sha1_asm_src    => "sha1-x86_64.s sha256-x86_64.s sha512-x86_64.s sha1-mb-x86_64.s sha256-mb-x86_64.s",
-	rc4_asm_src     => "rc4-x86_64.s rc4-md5-x86_64.s",
-	wp_asm_src      => "wp-x86_64.s",
-	cmll_asm_src    => "cmll-x86_64.s cmll_misc.c",
-	modes_asm_src   => "ghash-x86_64.s aesni-gcm-x86_64.s",
-	padlock_asm_src => "e_padlock-x86_64.s",
-	chacha_asm_src	=> "chacha-x86_64.s",
-	poly1305_asm_src=> "poly1305-x86_64.s",
-	keccak1600_asm_src	=> "keccak1600-x86_64.s",
-    },
-    ia64_asm => {
-	template	=> 1,
-	cpuid_asm_src   => "ia64cpuid.s",
-	bn_asm_src      => "bn-ia64.s ia64-mont.s",
-	aes_asm_src     => "aes_core.c aes_cbc.c aes-ia64.s",
-	sha1_asm_src    => "sha1-ia64.s sha256-ia64.s sha512-ia64.s",
-	modes_asm_src   => "ghash-ia64.s",
-	chacha_asm_src  => "chacha-ia64.S",
-	poly1305_asm_src=> "asm/poly1305-ia64.S",
-	perlasm_scheme	=> "void"
-    },
-    sparcv9_asm => {
-	template	=> 1,
-	cpuid_asm_src   => "sparcv9cap.c sparccpuid.S",
-	bn_asm_src      => "asm/sparcv8plus.S sparcv9-mont.S sparcv9a-mont.S vis3-mont.S sparct4-mont.S sparcv9-gf2m.S",
-	ec_asm_src      => "ecp_nistz256.c ecp_nistz256-sparcv9.S",
-	des_asm_src     => "des_enc-sparc.S fcrypt_b.c dest4-sparcv9.S",
-	aes_asm_src     => "aes_core.c aes_cbc.c aes-sparcv9.S aest4-sparcv9.S aesfx-sparcv9.S",
-	md5_asm_src     => "md5-sparcv9.S",
-	sha1_asm_src    => "sha1-sparcv9.S sha256-sparcv9.S sha512-sparcv9.S",
-	cmll_asm_src    => "camellia.c cmll_misc.c cmll_cbc.c cmllt4-sparcv9.S",
-	modes_asm_src   => "ghash-sparcv9.S",
-	poly1305_asm_src=> "poly1305-sparcv9.S",
-	perlasm_scheme	=> "void"
-    },
-    sparcv8_asm => {
-	template	=> 1,
-	cpuid_asm_src   => "",
-	bn_asm_src      => "asm/sparcv8.S",
-	des_asm_src     => "des_enc-sparc.S fcrypt_b.c",
-	perlasm_scheme	=> "void"
-    },
-    alpha_asm => {
-	template	=> 1,
-	cpuid_asm_src   => "alphacpuid.s",
-	bn_asm_src      => "bn_asm.c alpha-mont.S",
-	sha1_asm_src    => "sha1-alpha.S",
-	modes_asm_src   => "ghash-alpha.S",
-	perlasm_scheme	=> "void"
-    },
-    mips32_asm => {
-	template	=> 1,
-	bn_asm_src      => "bn-mips.S mips-mont.S",
-	aes_asm_src     => "aes_cbc.c aes-mips.S",
-	sha1_asm_src    => "sha1-mips.S sha256-mips.S",
-    },
-    mips64_asm => {
-	inherit_from	=> [ "mips32_asm" ],
-	template	=> 1,
-	sha1_asm_src    => add("sha512-mips.S"),
-	poly1305_asm_src=> "poly1305-mips.S",
-    },
-    s390x_asm => {
-	template	=> 1,
-	cpuid_asm_src   => "s390xcap.c s390xcpuid.S",
-	bn_asm_src      => "asm/s390x.S s390x-mont.S s390x-gf2m.s",
-	aes_asm_src     => "aes-s390x.S aes-ctr.fake aes-xts.fake",
-	sha1_asm_src    => "sha1-s390x.S sha256-s390x.S sha512-s390x.S",
-	rc4_asm_src     => "rc4-s390x.s",
-	modes_asm_src   => "ghash-s390x.S",
-	chacha_asm_src  => "chacha-s390x.S",
-	poly1305_asm_src=> "poly1305-s390x.S",
-	keccak1600_asm_src	=> "keccak1600-s390x.S",
-    },
-    armv4_asm => {
-	template	=> 1,
-	cpuid_asm_src   => "armcap.c armv4cpuid.S",
-	bn_asm_src      => "bn_asm.c armv4-mont.S armv4-gf2m.S",
-	ec_asm_src      => "ecp_nistz256.c ecp_nistz256-armv4.S",
-	aes_asm_src     => "aes_cbc.c aes-armv4.S bsaes-armv7.S aesv8-armx.S",
-	sha1_asm_src    => "sha1-armv4-large.S sha256-armv4.S sha512-armv4.S",
-	modes_asm_src   => "ghash-armv4.S ghashv8-armx.S",
-	chacha_asm_src  => "chacha-armv4.S",
-	poly1305_asm_src=> "poly1305-armv4.S",
-	keccak1600_asm_src	=> "keccak1600-armv4.S",
-	perlasm_scheme	=> "void"
-    },
-    aarch64_asm => {
-	template	=> 1,
-	cpuid_asm_src   => "armcap.c arm64cpuid.S",
-	ec_asm_src      => "ecp_nistz256.c ecp_nistz256-armv8.S",
-	bn_asm_src      => "bn_asm.c armv8-mont.S",
-	aes_asm_src     => "aes_core.c aes_cbc.c aesv8-armx.S vpaes-armv8.S",
-	sha1_asm_src    => "sha1-armv8.S sha256-armv8.S sha512-armv8.S",
-	modes_asm_src   => "ghashv8-armx.S",
-	chacha_asm_src  => "chacha-armv8.S",
-	poly1305_asm_src=> "poly1305-armv8.S",
-	keccak1600_asm_src	=> "keccak1600-armv8.S",
-    },
-    parisc11_asm => {
-	template	=> 1,
-	cpuid_asm_src   => "pariscid.s",
-	bn_asm_src      => "bn_asm.c parisc-mont.s",
-	aes_asm_src     => "aes_core.c aes_cbc.c aes-parisc.s",
-	sha1_asm_src    => "sha1-parisc.s sha256-parisc.s sha512-parisc.s",
-	rc4_asm_src     => "rc4-parisc.s",
-	modes_asm_src   => "ghash-parisc.s",
-	perlasm_scheme	=> "32"
-    },
-    parisc20_64_asm => {
-	template	=> 1,
-	inherit_from	=> [ "parisc11_asm" ],
-	perlasm_scheme	=> "64",
-    },
-    ppc32_asm => {
-	template	=> 1,
-	cpuid_asm_src   => "ppccpuid.s ppccap.c",
-	bn_asm_src      => "bn-ppc.s ppc-mont.s",
-	aes_asm_src     => "aes_core.c aes_cbc.c aes-ppc.s vpaes-ppc.s aesp8-ppc.s",
-	sha1_asm_src    => "sha1-ppc.s sha256-ppc.s sha512-ppc.s sha256p8-ppc.s sha512p8-ppc.s",
-	modes_asm_src   => "ghashp8-ppc.s",
-	chacha_asm_src	=> "chacha-ppc.s",
-	poly1305_asm_src=> "poly1305-ppc.s poly1305-ppcfp.s",
-    },
-    ppc64_asm => {
-	inherit_from	=> [ "ppc32_asm" ],
-	template	=> 1,
-	ec_asm_src	=> "ecp_nistz256.c ecp_nistz256-ppc64.s x25519-ppc64.s",
-	keccak1600_asm_src	=> "keccak1600-ppc64.s",
-    },
 );
diff --git a/Configurations/10-main.conf b/Configurations/10-main.conf
index 52b23ce..4f5e363 100644
--- a/Configurations/10-main.conf
+++ b/Configurations/10-main.conf
@@ -221,7 +221,7 @@ my %targets = (
         # NB. GNU C has to be configured to use GNU assembler, and not
         # /usr/ccs/bin/as. Failure to comply will result in compile
         # failures [at least] in 32-bit build.
-        inherit_from     => [ "solaris-common", asm("x86_elf_asm") ],
+        inherit_from     => [ "solaris-common" ],
         CC               => "gcc",
         CFLAGS           => add_before(picker(default => "-Wall",
                                               debug   => "-O0 -g",
@@ -232,6 +232,8 @@ my %targets = (
         bn_ops           => "BN_LLONG",
         shared_cflag     => "-fPIC",
         shared_ldflag    => add_before("-shared -static-libgcc"),
+        asm_arch         => 'x86',
+        perlasm_scheme   => 'elf',
     },
     "solaris64-x86_64-gcc" => {
         # -shared -static-libgcc might appear controversial, but modules
@@ -242,7 +244,7 @@ my %targets = (
         # code [thanks to inline assembler], I would actually recommend
         # to consider using gcc shared build even with vendor compiler:-)
         #                        -- <appro at openssl.org>
-        inherit_from     => [ "solaris-common", asm("x86_64_asm") ],
+        inherit_from     => [ "solaris-common" ],
         CC               => "gcc",
         CFLAGS           => add_before(picker(default => "-Wall",
                                               debug   => "-O0 -g",
@@ -251,6 +253,7 @@ my %targets = (
         lib_cppflags     => add("-DL_ENDIAN"),
         ex_libs          => add(threads("-pthread")),
         bn_ops           => "SIXTY_FOUR_BIT_LONG",
+        asm_arch         => 'x86_64',
         perlasm_scheme   => "elf",
         shared_cflag     => "-fPIC",
         shared_ldflag    => add_before("-shared -static-libgcc"),
@@ -271,7 +274,7 @@ my %targets = (
     # Consider switching to solaris64-x86_64-gcc even here...
     #
     "solaris64-x86_64-cc" => {
-        inherit_from     => [ "solaris-common", asm("x86_64_asm") ],
+        inherit_from     => [ "solaris-common" ],
         CC               => "cc",
         CFLAGS           => add_before(picker(debug   => "-g",
                                               release => "-xO5 -xdepend -xbuiltin")),
@@ -282,6 +285,7 @@ my %targets = (
         lflags           => add(threads("-mt")),
         ex_libs          => add(threads("-lpthread")),
         bn_ops           => "SIXTY_FOUR_BIT_LONG",
+        asm_arch         => 'x86_64',
         perlasm_scheme   => "elf",
         shared_cflag     => "-KPIC",
         shared_ldflag    => add_before("-G -dy -z text"),
@@ -303,14 +307,18 @@ my %targets = (
         shared_ldflag    => add_before("-shared"),
     },
     "solaris-sparcv8-gcc" => {
-        inherit_from     => [ "solaris-sparcv7-gcc", asm("sparcv8_asm") ],
+        inherit_from     => [ "solaris-sparcv7-gcc" ],
         cflags           => add_before("-mcpu=v8"),
+        asm_arch         => 'sparcv8',
+        perlasm_scheme   => 'void',
     },
     "solaris-sparcv9-gcc" => {
         # -m32 should be safe to add as long as driver recognizes
         # -mcpu=ultrasparc
-        inherit_from     => [ "solaris-sparcv7-gcc", asm("sparcv9_asm") ],
+        inherit_from     => [ "solaris-sparcv7-gcc" ],
         cflags           => add_before("-m32 -mcpu=ultrasparc"),
+        asm_arch         => 'sparcv9',
+        perlasm_scheme   => 'void',
     },
     "solaris64-sparcv9-gcc" => {
         inherit_from     => [ "solaris-sparcv9-gcc" ],
@@ -339,17 +347,23 @@ my %targets = (
     },
 ####
     "solaris-sparcv8-cc" => {
-        inherit_from     => [ "solaris-sparcv7-cc", asm("sparcv8_asm") ],
+        inherit_from     => [ "solaris-sparcv7-cc" ],
         cflags           => add_before("-xarch=v8"),
+        asm_arch         => 'sparcv8',
+        perlasm_scheme   => 'void',
     },
     "solaris-sparcv9-cc" => {
-        inherit_from     => [ "solaris-sparcv7-cc", asm("sparcv9_asm") ],
+        inherit_from     => [ "solaris-sparcv7-cc" ],
         cflags           => add_before("-xarch=v8plus"),
+        asm_arch         => 'sparcv9',
+        perlasm_scheme   => 'void',
     },
     "solaris64-sparcv9-cc" => {
-        inherit_from     => [ "solaris-sparcv7-cc", asm("sparcv9_asm") ],
+        inherit_from     => [ "solaris-sparcv7-cc" ],
         cflags           => add_before("-xarch=v9"),
         bn_ops           => "BN_LLONG RC4_CHAR",
+        asm_arch         => 'sparcv9',
+        perlasm_scheme   => 'void',
         multilib         => "/64",
     },
 
@@ -368,45 +382,49 @@ my %targets = (
         shared_sonameflag=> "-Wl,-soname,",
     },
     "irix-mips3-gcc" => {
-        inherit_from     => [ "irix-common", asm("mips64_asm") ],
+        inherit_from     => [ "irix-common" ],
         CC               => "gcc",
         CFLAGS           => picker(debug   => "-g -O0",
                                    release => "-O3"),
         LDFLAGS          => "-static-libgcc",
         cflags           => "-mabi=n32",
         bn_ops           => "RC4_CHAR SIXTY_FOUR_BIT",
+        asm_arch         => 'mips64',
         perlasm_scheme   => "n32",
         multilib         => "32",
     },
     "irix-mips3-cc" => {
-        inherit_from     => [ "irix-common", asm("mips64_asm") ],
+        inherit_from     => [ "irix-common" ],
         CC               => "cc",
         CFLAGS           => picker(debug   => "-g -O0",
                                    release => "-O2"),
         cflags           => "-n32 -mips3 -use_readonly_const -G0 -rdata_shared",
         bn_ops           => "RC4_CHAR SIXTY_FOUR_BIT",
+        asm_arch         => 'mips64',
         perlasm_scheme   => "n32",
         multilib         => "32",
     },
     # N64 ABI builds.
     "irix64-mips4-gcc" => {
-        inherit_from     => [ "irix-common", asm("mips64_asm") ],
+        inherit_from     => [ "irix-common" ],
         CC               => "gcc",
         CFLAGS           => picker(debug   => "-g -O0",
                                    release => "-O3"),
         LDFLAGS          => "-static-libgcc",
         cflags           => "-mabi=64 -mips4",
         bn_ops           => "RC4_CHAR SIXTY_FOUR_BIT_LONG",
+        asm_arch         => 'mips64',
         perlasm_scheme   => "64",
         multilib         => "64",
     },
     "irix64-mips4-cc" => {
-        inherit_from     => [ "irix-common", asm("mips64_asm") ],
+        inherit_from     => [ "irix-common" ],
         CC               => "cc",
         CFLAGS           => picker(debug   => "-g -O0",
                                    release => "-O2"),
         cflags           => "-64 -mips4 -use_readonly_const -G0 -rdata_shared",
         bn_ops           => "RC4_CHAR SIXTY_FOUR_BIT_LONG",
+        asm_arch         => 'mips64',
         perlasm_scheme   => "64",
         multilib         => "64",
     },
@@ -466,17 +484,21 @@ my %targets = (
         shared_extension => ".sl.\$(SHLIB_VERSION_NUMBER)",
     },
     "hpux-parisc1_1-gcc" => {
-        inherit_from     => [ "hpux-parisc-gcc", asm("parisc11_asm") ],
+        inherit_from     => [ "hpux-parisc-gcc" ],
+        asm_arch         => 'parisc11',
+        perlasm_scheme   => "32",
         multilib         => "/pa1.1",
     },
     "hpux64-parisc2-gcc" => {
-        inherit_from     => [ "hpux-common", asm("parisc20_64_asm") ],
+        inherit_from     => [ "hpux-common" ],
         CC               => "gcc",
         CFLAGS           => combine(picker(debug   => "-O0 -g",
                                            release => "-O3")),
         cflags           => add(threads("-pthread")),
         ex_libs          => add("-ldl", threads("-pthread")),
         bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
+        asm_arch         => 'parisc20_64',
+        perlasm_scheme   => "64",
         shared_cflag     => "-fpic",
         shared_ldflag    => add_before("-shared"),
         shared_extension => ".sl.\$(SHLIB_VERSION_NUMBER)",
@@ -500,12 +522,14 @@ my %targets = (
         shared_extension => ".sl.\$(SHLIB_VERSION_NUMBER)",
     },
     "hpux-parisc1_1-cc" => {
-        inherit_from     => [ "hpux-parisc-cc", asm("parisc11_asm") ],
+        inherit_from     => [ "hpux-parisc-cc" ],
         cflags           => add_before("+DA1.1"),
+        asm_arch         => 'parisc11',
+        perlasm_scheme   => "32",
         multilib         => "/pa1.1",
     },
     "hpux64-parisc2-cc" => {
-        inherit_from     => [ "hpux-common", asm("parisc20_64_asm") ],
+        inherit_from     => [ "hpux-common" ],
         CC               => "cc",
         CFLAGS           => picker(debug   => "+O0 +d -g",
                                    release => "+O3") ,
@@ -514,6 +538,8 @@ my %targets = (
         lib_cppflags     => add("-DMD32_XARRAY"),
         ex_libs          => add("-ldl", threads("-lpthread")),
         bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
+        asm_arch         => 'parisc20_64',
+        perlasm_scheme   => "64",
         shared_cflag     => "+Z",
         shared_ldflag    => add_before("-b"),
         shared_extension => ".sl.\$(SHLIB_VERSION_NUMBER)",
@@ -522,7 +548,7 @@ my %targets = (
 
     # HP/UX IA-64 targets
     "hpux-ia64-cc" => {
-        inherit_from     => [ "hpux-common", asm("ia64_asm") ],
+        inherit_from     => [ "hpux-common" ],
         CC               => "cc",
         CFLAGS           => picker(debug   => "+O0 +d -g",
                                    release => "+O2"),
@@ -530,12 +556,14 @@ my %targets = (
         cppflags         => add(threads("-D_REENTRANT")),
         ex_libs          => add("-ldl", threads("-lpthread")),
         bn_ops           => "SIXTY_FOUR_BIT",
+        asm_arch         => 'ia64',
+        perlasm_scheme   => 'void',
         shared_cflag     => "+Z",
         shared_ldflag    => add_before("-b"),
         multilib         => "/hpux32",
     },
     "hpux64-ia64-cc" => {
-        inherit_from     => [ "hpux-common", asm("ia64_asm") ],
+        inherit_from     => [ "hpux-common" ],
         CC               => "cc",
         CFLAGS           => picker(debug   => "+O0 +d -g",
                                    release => "+O3"),
@@ -543,31 +571,37 @@ my %targets = (
         cppflags         => threads("-D_REENTRANT"),
         ex_libs          => add("-ldl", threads("-lpthread")),
         bn_ops           => "SIXTY_FOUR_BIT_LONG",
+        asm_arch         => 'ia64',
+        perlasm_scheme   => 'void',
         shared_cflag     => "+Z",
         shared_ldflag    => add_before("-b"),
         multilib         => "/hpux64",
     },
     # GCC builds...
     "hpux-ia64-gcc" => {
-        inherit_from     => [ "hpux-common", asm("ia64_asm") ],
+        inherit_from     => [ "hpux-common" ],
         CC               => "gcc",
         CFLAGS           => picker(debug   => "-O0 -g",
                                    release => "-O3"),
         cflags           => add(threads("-pthread")),
         ex_libs          => add("-ldl", threads("-pthread")),
         bn_ops           => "SIXTY_FOUR_BIT",
+        asm_arch         => 'ia64',
+        perlasm_scheme   => 'void',
         shared_cflag     => "-fpic",
         shared_ldflag    => add_before("-shared"),
         multilib         => "/hpux32",
     },
     "hpux64-ia64-gcc" => {
-        inherit_from     => [ "hpux-common", asm("ia64_asm") ],
+        inherit_from     => [ "hpux-common" ],
         CC               => "gcc",
         CFLAGS           => picker(debug   => "-O0 -g",
                                    release => "-O3"),
         cflags           => combine("-mlp64", threads("-pthread")),
         ex_libs          => add("-ldl", threads("-pthread")),
         bn_ops           => "SIXTY_FOUR_BIT_LONG",
+        asm_arch         => 'ia64',
+        perlasm_scheme   => 'void',
         shared_cflag     => "-fpic",
         shared_ldflag    => add_before("-shared"),
         multilib         => "/hpux64",
@@ -593,20 +627,22 @@ my %targets = (
 #### there were even osf1-* configs targeting prior versions provided,
 #### but not anymore...
     "tru64-alpha-gcc" => {
-        inherit_from     => [ "BASE_unix", asm("alpha_asm") ],
+        inherit_from     => [ "BASE_unix" ],
         CC               => "gcc",
         CFLAGS           => "-O3",
         cflags           => add("-std=c9x", threads("-pthread")),
         cppflags         => "-D_XOPEN_SOURCE=500 -D_OSF_SOURCE",
         ex_libs          => add("-lrt", threads("-pthread")), # for mlock(2)
         bn_ops           => "SIXTY_FOUR_BIT_LONG",
+        asm_arch         => 'alpha',
+        perlasm_scheme   => "void",
         thread_scheme    => "pthreads",
         dso_scheme       => "dlfcn",
         shared_target    => "alpha-osf1-shared",
         shared_extension => ".so",
     },
     "tru64-alpha-cc" => {
-        inherit_from     => [ "BASE_unix", asm("alpha_asm") ],
+        inherit_from     => [ "BASE_unix" ],
         CC               => "cc",
         CFLAGS           => "-tune host -fast",
         cflags           => add("-std1 -readonly_strings",
@@ -614,6 +650,8 @@ my %targets = (
         cppflags         => "-D_XOPEN_SOURCE=500 -D_OSF_SOURCE",
         ex_libs          => add("-lrt", threads("-pthread")), # for mlock(2)
         bn_ops           => "SIXTY_FOUR_BIT_LONG",
+        asm_arch         => 'alpha',
+        perlasm_scheme   => "void",
         thread_scheme    => "pthreads",
         dso_scheme       => "dlfcn",
         shared_target    => "alpha-osf1-shared",
@@ -654,22 +692,25 @@ my %targets = (
     },
 
     "linux-ppc" => {
-        inherit_from     => [ "linux-generic32", asm("ppc32_asm") ],
+        inherit_from     => [ "linux-generic32" ],
+        asm_arch         => 'ppc32',
         perlasm_scheme   => "linux32",
     },
     "linux-ppc64" => {
-        inherit_from     => [ "linux-generic64", asm("ppc64_asm") ],
+        inherit_from     => [ "linux-generic64" ],
         cflags           => add("-m64"),
         cxxflags         => add("-m64"),
         lib_cppflags     => add("-DB_ENDIAN"),
+        asm_arch         => 'ppc64',
         perlasm_scheme   => "linux64",
         multilib         => "64",
     },
     "linux-ppc64le" => {
-        inherit_from     => [ "linux-generic64", asm("ppc64_asm") ],
+        inherit_from     => [ "linux-generic64" ],
         cflags           => add("-m64"),
         cxxflags         => add("-m64"),
         lib_cppflags     => add("-DL_ENDIAN"),
+        asm_arch         => 'ppc64',
         perlasm_scheme   => "linux64le",
     },
 
@@ -705,43 +746,49 @@ my %targets = (
         #
         # ./Configure linux-armv4 -march=armv6 -D__ARM_MAX_ARCH__=8
         #
-        inherit_from     => [ "linux-generic32", asm("armv4_asm") ],
+        inherit_from     => [ "linux-generic32" ],
+        asm_arch         => 'armv4',
         perlasm_scheme   => "linux32",
     },
     "linux-aarch64" => {
-        inherit_from     => [ "linux-generic64", asm("aarch64_asm") ],
+        inherit_from     => [ "linux-generic64" ],
+        asm_arch         => 'aarch64',
         perlasm_scheme   => "linux64",
     },
     "linux-arm64ilp32" => {  # https://wiki.linaro.org/Platform/arm64-ilp32
-        inherit_from     => [ "linux-generic32", asm("aarch64_asm") ],
+        inherit_from     => [ "linux-generic32" ],
         cflags           => add("-mabi=ilp32"),
         cxxflags         => add("-mabi=ilp32"),
         bn_ops           => "SIXTY_FOUR_BIT RC4_CHAR",
+        asm_arch         => 'aarch64',
         perlasm_scheme   => "linux64",
     },
 
     "linux-mips32" => {
         # Configure script adds minimally required -march for assembly
         # support, if no -march was specified at command line.
-        inherit_from     => [ "linux-generic32", asm("mips32_asm") ],
+        inherit_from     => [ "linux-generic32" ],
         cflags           => add("-mabi=32"),
         cxxflags         => add("-mabi=32"),
+        asm_arch         => 'mips32',
         perlasm_scheme   => "o32",
     },
     # mips32 and mips64 below refer to contemporary MIPS Architecture
     # specifications, MIPS32 and MIPS64, rather than to kernel bitness.
     "linux-mips64" => {
-        inherit_from     => [ "linux-generic32", asm("mips64_asm") ],
+        inherit_from     => [ "linux-generic32" ],
         cflags           => add("-mabi=n32"),
         cxxflags         => add("-mabi=n32"),
         bn_ops           => "SIXTY_FOUR_BIT RC4_CHAR",
+        asm_arch         => 'mips64',
         perlasm_scheme   => "n32",
         multilib         => "32",
     },
     "linux64-mips64" => {
-        inherit_from     => [ "linux-generic64", asm("mips64_asm") ],
+        inherit_from     => [ "linux-generic64" ],
         cflags           => add("-mabi=64"),
         cxxflags         => add("-mabi=64"),
+        asm_arch         => 'mips64',
         perlasm_scheme   => "64",
         multilib         => "64",
     },
@@ -750,13 +797,15 @@ my %targets = (
     #### These two targets are a bit aged and are to be used on older Linux
     #### machines where gcc doesn't understand -m32 and -m64
     "linux-elf" => {
-        inherit_from     => [ "linux-generic32", asm("x86_elf_asm") ],
+        inherit_from     => [ "linux-generic32" ],
         CFLAGS           => add(picker(release => "-fomit-frame-pointer")),
         lib_cppflags     => add("-DL_ENDIAN"),
         bn_ops           => "BN_LLONG",
+        asm_arch         => 'x86',
+        perlasm_scheme   => "elf",
     },
     "linux-aout" => {
-        inherit_from     => [ "BASE_unix", asm("x86_asm") ],
+        inherit_from     => [ "BASE_unix" ],
         CC               => "gcc",
         CFLAGS           => add(picker(default => "-Wall",
                                        debug   => "-O0 -g",
@@ -764,17 +813,19 @@ my %targets = (
         lib_cppflags     => add("-DL_ENDIAN"),
         bn_ops           => "BN_LLONG",
         thread_scheme    => "(unknown)",
+        asm_arch         => 'x86',
         perlasm_scheme   => "a.out",
     },
 
     #### X86 / X86_64 targets
     "linux-x86" => {
-        inherit_from     => [ "linux-generic32", asm("x86_asm") ],
+        inherit_from     => [ "linux-generic32" ],
         CFLAGS           => add(picker(release => "-fomit-frame-pointer")),
         cflags           => add("-m32"),
         cxxflags         => add("-m32"),
         lib_cppflags     => add("-DL_ENDIAN"),
         bn_ops           => "BN_LLONG",
+        asm_arch         => 'x86',
         perlasm_scheme   => "elf",
     },
     "linux-x86-clang" => {
@@ -783,11 +834,12 @@ my %targets = (
         CXX              => "clang++",
     },
     "linux-x86_64" => {
-        inherit_from     => [ "linux-generic64", asm("x86_64_asm") ],
+        inherit_from     => [ "linux-generic64" ],
         cflags           => add("-m64"),
         cxxflags         => add("-m64"),
         lib_cppflags     => add("-DL_ENDIAN"),
         bn_ops           => "SIXTY_FOUR_BIT_LONG",
+        asm_arch         => 'x86_64',
         perlasm_scheme   => "elf",
         multilib         => "64",
     },
@@ -797,25 +849,29 @@ my %targets = (
         CXX              => "clang++",
     },
     "linux-x32" => {
-        inherit_from     => [ "linux-generic32", asm("x86_64_asm") ],
+        inherit_from     => [ "linux-generic32" ],
         cflags           => add("-mx32"),
         cxxflags         => add("-mx32"),
         lib_cppflags     => add("-DL_ENDIAN"),
         bn_ops           => "SIXTY_FOUR_BIT",
+        asm_arch         => 'x86_64',
         perlasm_scheme   => "elf32",
         multilib         => "x32",
     },
 
     "linux-ia64" => {
-        inherit_from     => [ "linux-generic64", asm("ia64_asm") ],
+        inherit_from     => [ "linux-generic64" ],
         bn_ops           => "SIXTY_FOUR_BIT_LONG",
+        asm_arch         => 'ia64',
+        perlasm_scheme   => 'void',
     },
 
     "linux64-s390x" => {
-        inherit_from     => [ "linux-generic64", asm("s390x_asm") ],
+        inherit_from     => [ "linux-generic64" ],
         cflags           => add("-m64"),
         cxxflags         => add("-m64"),
         lib_cppflags     => add("-DB_ENDIAN"),
+        asm_arch         => 's390x',
         perlasm_scheme   => "64",
         multilib         => "64",
     },
@@ -836,44 +892,52 @@ my %targets = (
         # yet, because of couple of bugs in glibc
         # sysdeps/s390/dl-procinfo.c affecting ldconfig and ld.so.1...
         #
-        inherit_from     => [ "linux-generic32", asm("s390x_asm") ],
+        inherit_from     => [ "linux-generic32" ],
         cflags           => add("-m31 -Wa,-mzarch"),
         cxxflags         => add("-m31 -Wa,-mzarch"),
         lib_cppflags     => add("-DB_ENDIAN"),
-        bn_asm_src       => sub { my $r=join(" ", at _); $r=~s|asm/s390x\.S|bn_asm.c|; $r; },
+        asm_arch         => 's390x',
         perlasm_scheme   => "31",
         multilib         => "/highgprs",
     },
 
     #### SPARC Linux setups
     "linux-sparcv8" => {
-        inherit_from     => [ "linux-generic32", asm("sparcv8_asm") ],
+        inherit_from     => [ "linux-generic32" ],
         cflags           => add("-mcpu=v8"),
         cxxflags         => add("-mcpu=v8"),
         lib_cppflags     => add("-DB_ENDIAN -DBN_DIV2W"),
+        asm_arch         => 'sparcv8',
+        perlasm_scheme   => 'void',
     },
     "linux-sparcv9" => {
         # it's a real mess with -mcpu=ultrasparc option under Linux,
         # but -Wa,-Av8plus should do the trick no matter what.
-        inherit_from     => [ "linux-generic32", asm("sparcv9_asm") ],
+        inherit_from     => [ "linux-generic32" ],
         cflags           => add("-m32 -mcpu=ultrasparc -Wa,-Av8plus"),
         cxxflags         => add("-m32 -mcpu=ultrasparc -Wa,-Av8plus"),
         lib_cppflags     => add("-DB_ENDIAN -DBN_DIV2W"),
+        asm_arch         => 'sparcv9',
+        perlasm_scheme   => 'void',
     },
     "linux64-sparcv9" => {
         # GCC 3.1 is a requirement
-        inherit_from     => [ "linux-generic64", asm("sparcv9_asm") ],
+        inherit_from     => [ "linux-generic64" ],
         cflags           => add("-m64 -mcpu=ultrasparc"),
         cxxflags         => add("-m64 -mcpu=ultrasparc"),
         lib_cppflags     => add("-DB_ENDIAN"),
         bn_ops           => "BN_LLONG RC4_CHAR",
+        asm_arch         => 'sparcv9',
+        perlasm_scheme   => 'void',
         multilib         => "64",
     },
 
     "linux-alpha-gcc" => {
-        inherit_from     => [ "linux-generic64", asm("alpha_asm") ],
+        inherit_from     => [ "linux-generic64" ],
         lib_cppflags     => add("-DL_ENDIAN"),
         bn_ops           => "SIXTY_FOUR_BIT_LONG",
+        asm_arch         => 'alpha',
+        perlasm_scheme   => "void",
     },
     "linux-c64xplus" => {
         inherit_from     => [ "BASE_unix" ],
@@ -885,15 +949,8 @@ my %targets = (
         cppflags         => combine("-DOPENSSL_SMALL_FOOTPRINT",
                                     threads("-D_REENTRANT")),
         bn_ops           => "BN_LLONG",
-        cpuid_asm_src    => "c64xpluscpuid.s",
-        bn_asm_src       => "asm/bn-c64xplus.asm c64xplus-gf2m.s",
-        aes_asm_src      => "aes-c64xplus.s aes_cbc.c aes-ctr.fake",
-        sha1_asm_src     => "sha1-c64xplus.s sha256-c64xplus.s sha512-c64xplus.s",
-        rc4_asm_src      => "rc4-c64xplus.s",
-        modes_asm_src    => "ghash-c64xplus.s",
-        chacha_asm_src   => "chacha-c64xplus.s",
-        poly1305_asm_src => "poly1305-c64xplus.s",
         thread_scheme    => "pthreads",
+        asm_arch         => 'c64xplus',
         perlasm_scheme   => "void",
         dso_scheme       => "dlfcn",
         shared_target    => "linux-shared",
@@ -932,11 +989,12 @@ my %targets = (
     },
 
     "BSD-x86" => {
-        inherit_from     => [ "BSD-generic32", asm("x86_asm") ],
+        inherit_from     => [ "BSD-generic32" ],
         CFLAGS           => add(picker(release => "-fomit-frame-pointer")),
         lib_cppflags     => add("-DL_ENDIAN"),
         bn_ops           => "BN_LLONG",
         shared_target    => "bsd-shared",
+        asm_arch         => 'x86',
         perlasm_scheme   => "a.out",
     },
     "BSD-x86-elf" => {
@@ -945,39 +1003,48 @@ my %targets = (
     },
 
     "BSD-sparcv8" => {
-        inherit_from     => [ "BSD-generic32", asm("sparcv8_asm") ],
+        inherit_from     => [ "BSD-generic32" ],
         cflags           => add("-mcpu=v8"),
         lib_cppflags     => add("-DB_ENDIAN"),
+        asm_arch         => 'sparcv8',
+        perlasm_scheme   => 'void',
     },
     "BSD-sparc64" => {
         # -DMD32_REG_T=int doesn't actually belong in sparc64 target, it
         # simply *happens* to work around a compiler bug in gcc 3.3.3,
         # triggered by RIPEMD160 code.
-        inherit_from     => [ "BSD-generic64", asm("sparcv9_asm") ],
+        inherit_from     => [ "BSD-generic64" ],
         lib_cppflags     => add("-DB_ENDIAN -DMD32_REG_T=int"),
         bn_ops           => "BN_LLONG",
+        asm_arch         => 'sparcv9',
+        perlasm_scheme   => 'void',
     },
 
     "BSD-ia64" => {
-        inherit_from     => [ "BSD-generic64", asm("ia64_asm") ],
+        inherit_from     => [ "BSD-generic64" ],
         lib_cppflags     => add("-DL_ENDIAN"),
         bn_ops           => "SIXTY_FOUR_BIT_LONG",
+        asm_arch         => 'ia64',
+        perlasm_scheme   => 'void',
     },
 
     "BSD-x86_64" => {
-        inherit_from     => [ "BSD-generic64", asm("x86_64_asm") ],
+        inherit_from     => [ "BSD-generic64" ],
         lib_cppflags     => add("-DL_ENDIAN"),
         bn_ops           => "SIXTY_FOUR_BIT_LONG",
+        asm_arch         => 'x86_64',
         perlasm_scheme   => "elf",
     },
 
     "bsdi-elf-gcc" => {
-        inherit_from     => [ "BASE_unix", asm("x86_elf_asm") ],
+        inherit_from     => [ "BASE_unix" ],
         CC               => "gcc",
         CFLAGS           => "-fomit-frame-pointer -O3 -Wall",
         lib_cppflags     => "-DPERL5 -DL_ENDIAN",
         ex_libs          => add("-ldl"),
         bn_ops           => "BN_LLONG",
+        asm_arch         => 'x86',
+        perlasm_scheme   => "elf",
         thread_scheme    => "(unknown)",
         dso_scheme       => "dlfcn",
         shared_target    => "bsd-gcc-shared",
@@ -1030,7 +1097,7 @@ my %targets = (
         thread_scheme    => "uithreads",
     },
     "unixware-7" => {
-        inherit_from     => [ "BASE_unix", asm("x86_elf_asm") ],
+        inherit_from     => [ "BASE_unix" ],
         CC               => "cc",
         CFLAGS           => "-O",
         cflags           => combine("-Kalloca", threads("-Kthread")),
@@ -1038,13 +1105,14 @@ my %targets = (
         ex_libs          => add("-lsocket -lnsl"),
         thread_scheme    => "uithreads",
         bn_ops           => "BN_LLONG",
+        asm_arch         => 'x86',
         perlasm_scheme   => "elf-1",
         dso_scheme       => "dlfcn",
         shared_target    => "svr5-shared",
         shared_cflag     => "-Kpic",
     },
     "unixware-7-gcc" => {
-        inherit_from     => [ "BASE_unix", asm("x86_elf_asm") ],
+        inherit_from     => [ "BASE_unix" ],
         CC               => "gcc",
         CFLAGS           => "-O3 -fomit-frame-pointer -Wall",
         cppflags         => add(threads("-D_REENTRANT")),
@@ -1052,6 +1120,7 @@ my %targets = (
         ex_libs          => add("-lsocket -lnsl"),
         bn_ops           => "BN_LLONG",
         thread_scheme    => "pthreads",
+        asm_arch         => 'x86',
         perlasm_scheme   => "elf-1",
         dso_scheme       => "dlfcn",
         shared_target    => "gnu-shared",
@@ -1059,23 +1128,25 @@ my %targets = (
     },
 # SCO 5 - Ben Laurie says the -O breaks the SCO cc.
     "sco5-cc" => {
-        inherit_from     => [ "BASE_unix", asm("x86_elf_asm") ],
+        inherit_from     => [ "BASE_unix" ],
         cc               => "cc",
         cflags           => "-belf",
         ex_libs          => add("-lsocket -lnsl"),
         thread_scheme    => "(unknown)",
+        asm_arch         => 'x86',
         perlasm_scheme   => "elf-1",
         dso_scheme       => "dlfcn",
         shared_target    => "svr3-shared",
         shared_cflag     => "-Kpic",
     },
     "sco5-gcc" => {
-        inherit_from     => [ "BASE_unix", asm("x86_elf_asm") ],
+        inherit_from     => [ "BASE_unix" ],
         cc               => "gcc",
         cflags           => "-O3 -fomit-frame-pointer",
         ex_libs          => add("-lsocket -lnsl"),
         bn_ops           => "BN_LLONG",
         thread_scheme    => "(unknown)",
+        asm_arch         => 'x86',
         perlasm_scheme   => "elf-1",
         dso_scheme       => "dlfcn",
         shared_target    => "svr3-shared",
@@ -1103,26 +1174,28 @@ my %targets = (
         perl_platform    => 'AIX',
     },
     "aix-gcc" => {
-        inherit_from     => [ "aix-common", asm("ppc32_asm") ],
+        inherit_from     => [ "aix-common" ],
         CC               => "gcc",
         CFLAGS           => picker(debug   => "-O0 -g",
                                    release => "-O"),
         cflags           => add(threads("-pthread")),
         ex_libs          => threads("-pthread"),
         bn_ops           => "BN_LLONG RC4_CHAR",
+        asm_arch         => 'ppc32',
         perlasm_scheme   => "aix32",
         shared_ldflag    => add_before("-shared -static-libgcc"),
         AR               => add("-X32"),
         RANLIB           => add("-X32"),
     },
     "aix64-gcc" => {
-        inherit_from     => [ "aix-common", asm("ppc64_asm") ],
+        inherit_from     => [ "aix-common" ],
         CC               => "gcc",
         CFLAGS           => picker(debug   => "-O0 -g",
                                    release => "-O"),
         cflags           => combine("-maix64", threads("-pthread")),
         ex_libs          => threads("-pthread"),
         bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
+        asm_arch         => 'ppc64',
         perlasm_scheme   => "aix64",
         shared_ldflag    => add_before("-shared -static-libgcc"),
         shared_extension => "64.so.\$(SHLIB_VERSION_NUMBER)",
@@ -1130,7 +1203,7 @@ my %targets = (
         RANLIB           => add("-X64"),
     },
     "aix-cc" => {
-        inherit_from     => [ "aix-common", asm("ppc32_asm") ],
+        inherit_from     => [ "aix-common" ],
         CC               => "cc",
         CFLAGS           => picker(debug   => "-O0 -g",
                                    release => "-O"),
@@ -1139,13 +1212,14 @@ my %targets = (
         cppflags         => threads("-D_THREAD_SAFE"),
         ex_libs          => threads("-lpthreads"),
         bn_ops           => "BN_LLONG RC4_CHAR",
+        asm_arch         => 'ppc32',
         perlasm_scheme   => "aix32",
         shared_cflag     => "-qpic",
         AR               => add("-X32"),
         RANLIB           => add("-X32"),
     },
     "aix64-cc" => {
-        inherit_from     => [ "aix-common", asm("ppc64_asm") ],
+        inherit_from     => [ "aix-common" ],
         CC               => "cc",
         CFLAGS           => picker(debug   => "-O0 -g",
                                    release => "-O"),
@@ -1154,6 +1228,7 @@ my %targets = (
         cppflags         => threads("-D_THREAD_SAFE"),
         ex_libs          => threads("-lpthreads"),
         bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
+        asm_arch         => 'ppc64',
         perlasm_scheme   => "aix64",
         dso_scheme       => "dlfcn",
         shared_cflag     => "-qpic",
@@ -1216,7 +1291,6 @@ my %targets = (
         shared_target    => "win-shared", # meaningless except it gives Configure a hint
         thread_scheme    => "winthreads",
         dso_scheme       => "win32",
-        apps_aux_src     => add("win32_init.c"),
         bn_ops           => "EXPORT_VAR_AS_FN",
         perl_platform    => 'Windows::MSVC',
         # additional parameter to build_scheme denotes install-path "flavour"
@@ -1272,33 +1346,30 @@ my %targets = (
         bn_ops           => add("SIXTY_FOUR_BIT"),
     },
     "VC-WIN64I" => {
-        inherit_from     => [ "VC-WIN64-common", asm("ia64_asm"),
-                              sub { $disabled{uplink} ? () : "ia64_uplink" } ],
+        inherit_from     => [ "VC-WIN64-common" ],
         AS               => "ias",
         ASFLAGS          => "-d debug",
         asoutflag        => "-o ",
         sys_id           => "WIN64I",
-        bn_asm_src       => sub { return undef unless @_;
-                                  my $r=join(" ", at _); $r=~s|bn-ia64.s|bn_asm.c|; $r; },
+        uplink_arch      => 'ia64',
+        asm_arch         => 'ia64',
         perlasm_scheme   => "ias",
         multilib         => "-ia64",
     },
     "VC-WIN64A" => {
-        inherit_from     => [ "VC-WIN64-common", asm("x86_64_asm"),
-                              sub { $disabled{uplink} ? () : "x86_64_uplink" } ],
+        inherit_from     => [ "VC-WIN64-common" ],
         AS               => sub { vc_win64a_info()->{AS} },
         ASFLAGS          => sub { vc_win64a_info()->{ASFLAGS} },
         asoutflag        => sub { vc_win64a_info()->{asoutflag} },
         asflags          => sub { vc_win64a_info()->{asflags} },
         sys_id           => "WIN64A",
-        bn_asm_src       => sub { return undef unless @_;
-                                  my $r=join(" ", at _); $r=~s|asm/x86_64-gcc|bn_asm|; $r; },
+        uplink_arch      => 'x86_64',
+        asm_arch         => 'x86_64',
         perlasm_scheme   => "auto",
         multilib         => "-x64",
     },
     "VC-WIN32" => {
-        inherit_from     => [ "VC-noCE-common", asm("x86_asm"),
-                              sub { $disabled{uplink} ? () : "uplink_common" } ],
+        inherit_from     => [ "VC-noCE-common" ],
         CFLAGS           => add("/WX"),
         AS               => sub { vc_win32_info()->{AS} },
         ASFLAGS          => sub { vc_win32_info()->{ASFLAGS} },
@@ -1306,6 +1377,8 @@ my %targets = (
         asflags          => sub { vc_win32_info()->{asflags} },
         sys_id           => "WIN32",
         bn_ops           => add("BN_LLONG"),
+        uplink_arch      => 'common',
+        asm_arch         => 'x86',
         perlasm_scheme   => sub { vc_win32_info()->{perlasm_scheme} },
         # "WOW" stands for "Windows on Windows", and "VC-WOW" engages
         # some installation path heuristics in windows-makefile.tmpl...
@@ -1376,34 +1449,36 @@ my %targets = (
         shared_target    => "mingw-shared",
         shared_cppflags  => add("_WINDLL"),
         shared_ldflag    => "-static-libgcc",
-        apps_aux_src     => add("win32_init.c"),
 
         perl_platform    => 'mingw',
     },
     "mingw" => {
-        inherit_from     => [ "mingw-common", asm("x86_asm"),
-                              sub { $disabled{uplink} ? () : "x86_uplink" } ],
+        inherit_from     => [ "mingw-common" ],
         CFLAGS           => add(picker(release => "-fomit-frame-pointer")),
         cflags           => "-m32",
         sys_id           => "MINGW32",
         bn_ops           => add("BN_LLONG"),
+        asm_arch         => 'x86',
+        uplink_arch      => 'x86',
         perlasm_scheme   => "coff",
         shared_rcflag    => "--target=pe-i386",
         multilib         => "",
     },
     "mingw64" => {
-        # As for OPENSSL_USE_APPLINK. Applink makes it possible to use
+        # As for uplink_arch. Applink makes it possible to use
         # .dll compiled with one compiler with application compiled with
         # another compiler. It's possible to engage Applink support in
-        # mingw64 build, but it's not done, because till mingw64
+        # mingw64 build, but it's not done, because until mingw64
         # supports structured exception handling, one can't seriously
         # consider its binaries for using with non-mingw64 run-time
         # environment. And as mingw64 is always consistent with itself,
         # Applink is never engaged and can as well be omitted.
-        inherit_from     => [ "mingw-common", asm("x86_64_asm") ],
+        inherit_from     => [ "mingw-common" ],
         cflags           => "-m64",
         sys_id           => "MINGW64",
         bn_ops           => add("SIXTY_FOUR_BIT"),
+        asm_arch         => 'x86_64',
+        uplink_arch      => undef,
         perlasm_scheme   => "mingw64",
         shared_rcflag    => "--target=pe-x86-64",
         multilib         => "64",
@@ -1448,15 +1523,17 @@ my %targets = (
         perl_platform    => 'Cygwin',
     },
     "Cygwin-x86" => {
-        inherit_from     => [ "Cygwin-common", asm("x86_asm") ],
+        inherit_from     => [ "Cygwin-common" ],
         CFLAGS           => add(picker(release => "-O3 -fomit-frame-pointer")),
         bn_ops           => "BN_LLONG",
+        asm_arch         => 'x86',
         perlasm_scheme   => "coff",
     },
     "Cygwin-x86_64" => {
-        inherit_from     => [ "Cygwin-common", asm("x86_64_asm") ],
+        inherit_from     => [ "Cygwin-common" ],
         CC               => "gcc",
         bn_ops           => "SIXTY_FOUR_BIT_LONG",
+        asm_arch         => 'x86_64',
         perlasm_scheme   => "mingw64",
     },
     # Backward compatibility for those using this target
@@ -1500,46 +1577,51 @@ my %targets = (
     # with future defaults for below two targets, because MacOS X
     # for PPC has no future, it was discontinued by vendor in 2009.
     "darwin-ppc-cc" => {
-        inherit_from     => [ "darwin-common", asm("ppc32_asm") ],
+        inherit_from     => [ "darwin-common" ],
         cflags           => add("-arch ppc -std=gnu9x -Wa,-force_cpusubtype_ALL"),
         lib_cppflags     => add("-DB_ENDIAN"),
         shared_cflag     => add("-fno-common"),
+        asm_arch         => 'ppc32',
         perlasm_scheme   => "osx32",
     },
     "darwin64-ppc-cc" => {
-        inherit_from     => [ "darwin-common", asm("ppc64_asm") ],
+        inherit_from     => [ "darwin-common" ],
         cflags           => add("-arch ppc64 -std=gnu9x"),
         lib_cppflags     => add("-DB_ENDIAN"),
         bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
+        asm_arch         => 'ppc64',
         perlasm_scheme   => "osx64",
     },
     "darwin-i386-cc" => {
-        inherit_from     => [ "darwin-common", asm("x86_asm") ],
+        inherit_from     => [ "darwin-common" ],
         CFLAGS           => add(picker(release => "-fomit-frame-pointer")),
         cflags           => add("-arch i386"),
         lib_cppflags     => add("-DL_ENDIAN"),
         bn_ops           => "BN_LLONG RC4_INT",
+        asm_arch         => 'x86',
         perlasm_scheme   => "macosx",
     },
     "darwin64-x86_64-cc" => {
-        inherit_from     => [ "darwin-common", asm("x86_64_asm") ],
+        inherit_from     => [ "darwin-common" ],
         CFLAGS           => add("-Wall"),
         cflags           => add("-arch x86_64"),
         lib_cppflags     => add("-DL_ENDIAN"),
         bn_ops           => "SIXTY_FOUR_BIT_LONG",
+        asm_arch         => 'x86_64',
         perlasm_scheme   => "macosx",
     },
 
 ##### GNU Hurd
     "hurd-x86" => {
         inherit_from     => [ "BASE_unix" ],
-        inherit_from     => [ asm("x86_elf_asm") ],
         CC               => "gcc",
         CFLAGS           => "-O3 -fomit-frame-pointer -Wall",
         cflags           => threads("-pthread"),
         lib_cppflags     => "-DL_ENDIAN",
         ex_libs          => add("-ldl", threads("-pthread")),
         bn_ops           => "BN_LLONG",
+        asm_arch         => 'x86',
+        perlasm_scheme   => 'elf',
         thread_scheme    => "pthreads",
         dso_scheme       => "dlfcn",
         shared_target    => "linux-shared",
@@ -1629,7 +1711,7 @@ my %targets = (
         ranlib           => "ranlibpentium",
     },
     "vxworks-mips" => {
-        inherit_from     => [ "BASE_unix", asm("mips32_asm") ],
+        inherit_from     => [ "BASE_unix" ],
         CC               => "ccmips",
         CFLAGS           => "-O -G 0",
         cflags           => "-mrtp -mips2 -B\$(WIND_BASE)/host/\$(WIND_HOST_TYPE)/lib/gcc-lib/ -msoft-float -mno-branch-likely -fno-builtin -fno-defer-pop",
@@ -1644,6 +1726,7 @@ my %targets = (
         lflags           => add("-L \$(WIND_BASE)/target/usr/lib/mips/MIPSI32/sfcommon"),
         ex_libs          => add("-Wl,--defsym,__wrs_rtp_base=0xe0000000"),
         thread_scheme    => "pthreads",
+        asm_arch         => 'mips32',
         perlasm_scheme   => "o32",
         ranlib           => "ranlibmips",
     },
@@ -1725,8 +1808,6 @@ my %targets = (
 
         disable          => add('pinshared'),
 
-        apps_aux_src     => "vms_term_sock.c vms_decc_argv.c",
-        apps_init_src    => "vms_decc_init.c",
     },
 
     # From HELP CC/POINTER_SIZE:
@@ -1759,13 +1840,12 @@ my %targets = (
         pointer_size     => "64",
     },
     "vms-ia64" => {
-        inherit_from     => [ "vms-generic",
-                              sub { vms_info()->{AS}
-                                        ? asm("ia64_asm")->() : () } ],
+        inherit_from     => [ "vms-generic" ],
         bn_ops           => "SIXTY_FOUR_BIT RC4_INT",
+        asm_arch         => sub { vms_info()->{AS} ? 'ia64' : undef },
+        perlasm_scheme   => 'ias',
         pointer_size     => "",
 
-        modes_asm_src    => "", # Because ghash-ia64.s doesn't work on VMS
     },
     "vms-ia64-p32" => {
         inherit_from     => [ "vms-ia64" ],
diff --git a/Configurations/15-android.conf b/Configurations/15-android.conf
index 7b496a4..69c3693 100644
--- a/Configurations/15-android.conf
+++ b/Configurations/15-android.conf
@@ -199,18 +199,22 @@ my %targets = (
         # -march and/or -mfloat-abi flags. NDK defaults to armv5te.
         # Newer NDK versions reportedly require additional -latomic.
         #
-        inherit_from     => [ "android", asm("armv4_asm") ],
+        inherit_from     => [ "android" ],
         bn_ops           => add("RC4_CHAR"),
+        asm_arch         => 'armv4',
+        perlasm_scheme   => "void",
     },
     "android-arm64" => {
-        inherit_from     => [ "android", asm("aarch64_asm") ],
+        inherit_from     => [ "android" ],
         bn_ops           => add("RC4_CHAR"),
+        asm_arch         => 'aarch64',
         perlasm_scheme   => "linux64",
     },
 
     "android-mips" => {
-        inherit_from     => [ "android", asm("mips32_asm") ],
+        inherit_from     => [ "android" ],
         bn_ops           => add("RC4_CHAR"),
+        asm_arch         => 'mips32',
         perlasm_scheme   => "o32",
     },
     "android-mips64" => {
@@ -223,20 +227,23 @@ my %targets = (
         # with previous MIPS ISA versions, in sense that unlike
         # prior versions original MIPS binary code will fail.
         #
-        inherit_from     => [ "android", asm("mips64_asm") ],
+        inherit_from     => [ "android" ],
         bn_ops           => add("RC4_CHAR"),
+        asm_arch         => 'mips64',
         perlasm_scheme   => "64",
     },
 
     "android-x86" => {
-        inherit_from     => [ "android", asm("x86_asm") ],
+        inherit_from     => [ "android" ],
         CFLAGS           => add(picker(release => "-fomit-frame-pointer")),
         bn_ops           => add("RC4_INT"),
+        asm_arch         => 'x86',
         perlasm_scheme   => "android",
     },
     "android-x86_64" => {
-        inherit_from     => [ "android", asm("x86_64_asm") ],
+        inherit_from     => [ "android" ],
         bn_ops           => add("RC4_INT"),
+        asm_arch         => 'x86_64',
         perlasm_scheme   => "elf",
     },
 
diff --git a/Configurations/15-ios.conf b/Configurations/15-ios.conf
index 1bb9f48..a95f808 100644
--- a/Configurations/15-ios.conf
+++ b/Configurations/15-ios.conf
@@ -13,19 +13,21 @@ my %targets = (
         disable          => [ "engine", "async" ],
     },
     "ios-xcrun" => {
-        inherit_from     => [ "ios-common", asm("armv4_asm") ],
+        inherit_from     => [ "ios-common" ],
         # It should be possible to go below iOS 6 and even add -arch armv6,
         # thus targeting iPhone pre-3GS, but it's assumed to be irrelevant
         # at this point.
         CC               => "xcrun -sdk iphoneos cc",
         cflags           => add("-arch armv7 -mios-version-min=6.0.0 -fno-common"),
+        asm_arch         => 'armv4',
         perlasm_scheme   => "ios32",
     },
     "ios64-xcrun" => {
-        inherit_from     => [ "ios-common", asm("aarch64_asm") ],
+        inherit_from     => [ "ios-common" ],
         CC               => "xcrun -sdk iphoneos cc",
         cflags           => add("-arch arm64 -mios-version-min=7.0.0 -fno-common"),
         bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
+        asm_arch         => 'aarch64',
         perlasm_scheme   => "ios64",
     },
     "iossimulator-xcrun" => {
diff --git a/Configurations/50-djgpp.conf b/Configurations/50-djgpp.conf
index a8853a8..1688892 100644
--- a/Configurations/50-djgpp.conf
+++ b/Configurations/50-djgpp.conf
@@ -4,7 +4,6 @@
 
 my %targets = (
     "DJGPP" => {
-        inherit_from     => [ asm("x86_asm") ],
         CC               => "gcc",
         CFLAGS           => "-fomit-frame-pointer -O2 -Wall",
         cflags           => "-I/dev/env/WATT_ROOT/inc -DTERMIOS -DL_ENDIAN",
@@ -12,6 +11,7 @@ my %targets = (
         lflags           => add("-L/dev/env/WATT_ROOT/lib"),
         ex_libs          => add("-lwatt"),
         bn_ops           => "BN_LLONG",
+        asm_arch         => 'x86',
         perlasm_scheme   => "a.out",
     },
 );
diff --git a/Configurations/50-haiku.conf b/Configurations/50-haiku.conf
index 5bc4db5..d37ab83 100644
--- a/Configurations/50-haiku.conf
+++ b/Configurations/50-haiku.conf
@@ -18,9 +18,11 @@ my %targets = (
         perl_platform    => 'Unix',
     },
     "haiku-x86" => {
-        inherit_from     => [ "haiku-common", asm("x86_elf_asm") ],
+        inherit_from     => [ "haiku-common" ],
         CFLAGS           => add(picker(release => "-fomit-frame-pointer")),
         bn_ops           => "BN_LLONG",
+        asm_arch         => 'x86',
+        perlasm_scheme   => 'elf',
     },
     "haiku-x86_64" => {
         inherit_from     => [ "haiku-common" ],
diff --git a/Configurations/50-masm.conf b/Configurations/50-masm.conf
index 2c55ddd..587a1e7 100644
--- a/Configurations/50-masm.conf
+++ b/Configurations/50-masm.conf
@@ -9,15 +9,14 @@
 
 my %targets = (
     "VC-WIN64A-masm" => {
-        inherit_from    => [ "VC-WIN64-common", asm("x86_64_asm"),
-                             sub { $disabled{shared} ? () : "x86_64_uplink" } ],
+        inherit_from    => [ "VC-WIN64-common" ],
         AS              => "ml64",
         ASFLAGS         => "/nologo /Zi",
         asoutflag       => "/Fo",
         asflags         => "/c /Cp /Cx",
         sys_id          => "WIN64A",
-        bn_asm_src      => sub { return undef unless @_;
-                                 my $r=join(" ", at _); $r=~s|asm/x86_64-gcc|bn_asm|; $r; },
+        uplink_arch      => 'x86_64',
+        asm_arch         => 'x86_64',
         perlasm_scheme   => "masm",
     },
 );
diff --git a/Configurations/90-team.norelease.conf b/Configurations/90-team.norelease.conf
index 7f738e4..8ad05a6 100644
--- a/Configurations/90-team.norelease.conf
+++ b/Configurations/90-team.norelease.conf
@@ -24,6 +24,7 @@ my %targets = (
         ex_libs          => add(" ","-ldl"),
         bn_ops           => "SIXTY_FOUR_BIT_LONG",
         thread_scheme    => "pthreads",
+        asm_arch         => 'x86_64',
         perlasm_scheme   => "elf",
         dso_scheme       => "dlfcn",
         shared_target    => "linux-shared",
@@ -38,6 +39,8 @@ my %targets = (
                                     threads("-D_REENTRANT")),
         ex_libs          => add(" ","-ldl"),
         bn_ops           => "BN_LLONG",
+        asm_arch         => 'x86',
+        perlasm_scheme   => 'elf',
         thread_scheme    => "pthreads",
         dso_scheme       => "dlfcn",
     },
@@ -48,36 +51,11 @@ my %targets = (
                                     threads("-D_REENTRANT")),
         ex_libs          => add(" ","-ldl"),
         bn_ops           => "BN_LLONG",
+        asm_arch         => 'x86',
+        perlasm_scheme   => 'elf',
         thread_scheme    => "pthreads",
         dso_scheme       => "dlfcn",
     },
-    "debug-linux-ia32-aes" => {
-        inherit_from     => [ 'BASE_unix' ],
-        cc               => "gcc",
-        cflags           => combine("-DL_ENDIAN -O3 -fomit-frame-pointer -Wall",
-                                    threads("-D_REENTRANT")),
-        ex_libs          => add(" ","-ldl"),
-        bn_ops           => "BN_LLONG",
-        cpuid_asm_src    => "x86cpuid.s",
-        bn_asm_src       => "bn-586.s co-586.s x86-mont.s",
-        des_asm_src      => "des-586.s crypt586.s",
-        aes_asm_src      => "aes_x86core.s aes_cbc.s aesni-x86.s",
-        bf_asm_src       => "bf-586.s",
-        md5_asm_src      => "md5-586.s",
-        sha1_asm_src     => "sha1-586.s sha256-586.s sha512-586.s",
-        cast_asm_src     => "cast-586.s",
-        rc4_asm_src      => "rc4-586.s",
-        rmd160_asm_src   => "rmd-586.s",
-        rc5_asm_src      => "rc5-586.s",
-        wp_asm_src       => "wp_block.s wp-mmx.s",
-        modes_asm_src    => "ghash-x86.s",
-        padlock_asm_src  => "e_padlock-x86.s",
-        thread_scheme    => "pthreads",
-        perlasm_scheme   => "elf",
-        dso_scheme       => "dlfcn",
-        shared_target    => "linux-shared",
-        shared_cflag     => "-fPIC",
-    },
     "debug-test-64-clang" => {
         inherit_from     => [ 'BASE_unix', "x86_64_asm" ],
         cc               => "clang",
@@ -86,6 +64,7 @@ my %targets = (
                                     threads("${BSDthreads}")),
         bn_ops           => "SIXTY_FOUR_BIT_LONG",
         thread_scheme    => "pthreads",
+        asm_arch         => 'x86_64',
         perlasm_scheme   => "elf",
         dso_scheme       => "dlfcn",
         shared_target    => "bsd-gcc-shared",
@@ -101,6 +80,7 @@ my %targets = (
         sys_id           => "MACOSX",
         bn_ops           => "SIXTY_FOUR_BIT_LONG",
         thread_scheme    => "pthreads",
+        asm_arch         => 'x86_64',
         perlasm_scheme   => "macosx",
         dso_scheme       => "dlfcn",
         shared_target    => "darwin-shared",
diff --git a/Configurations/README b/Configurations/README
index 8efabb3..fa99539 100644
--- a/Configurations/README
+++ b/Configurations/README
@@ -165,6 +165,13 @@ In each table entry, the following keys are significant:
                            that use dlopen() et al but do not have
                            fcntl.h), "DL" (shl_load() et al), "WIN32"
                            and "VMS".
+        asm_arch        => The architecture to be used for compiling assembly
+                           source.  This acts as a selector in build.info files.
+        uplink_arch     => The architecture to be used for compiling uplink
+                           source.  This acts as a selector in build.info files.
+                           This is separate from asm_arch because it's compiled
+                           even when 'no-asm' is given, even though it contains
+                           assembler source.
         perlasm_scheme  => The perlasm method used to create the
                            assembler files used when compiling with
                            assembler implementations.
@@ -233,60 +240,6 @@ In each table entry, the following keys are significant:
                                                 export vars as
                                                 accessor functions.
 
-        apps_aux_src    => Extra source to build apps/openssl and other
-                           apps, as needed by the target and that can be
-                           collected in a library.
-        apps_init_src   => Init source to build apps/openssl and other
-                           apps, as needed by the target.  This code
-                           cannot be placed in a library, as the rest
-                           of the code isn't expected to link to it
-                           explicitly.
-        cpuid_asm_src   => assembler implementation of cpuid code as
-                           well as OPENSSL_cleanse().
-                           Default to mem_clr.c
-        bn_asm_src      => Assembler implementation of core bignum
-                           functions.
-                           Defaults to bn_asm.c
-        ec_asm_src      => Assembler implementation of core EC
-                           functions.
-        des_asm_src     => Assembler implementation of core DES
-                           encryption functions.
-                           Defaults to 'des_enc.c fcrypt_b.c'
-        aes_asm_src     => Assembler implementation of core AES
-                           functions.
-                           Defaults to 'aes_core.c aes_cbc.c'
-        bf_asm_src      => Assembler implementation of core BlowFish
-                           functions.
-                           Defaults to 'bf_enc.c'
-        md5_asm_src     => Assembler implementation of core MD5
-                           functions.
-        sha1_asm_src    => Assembler implementation of core SHA1,
-                           functions, and also possibly SHA256 and
-                           SHA512 ones.
-        cast_asm_src    => Assembler implementation of core CAST
-                           functions.
-                           Defaults to 'c_enc.c'
-        rc4_asm_src     => Assembler implementation of core RC4
-                           functions.
-                           Defaults to 'rc4_enc.c rc4_skey.c'
-        rmd160_asm_src  => Assembler implementation of core RMD160
-                           functions.
-        rc5_asm_src     => Assembler implementation of core RC5
-                           functions.
-                           Defaults to 'rc5_enc.c'
-        wp_asm_src      => Assembler implementation of core WHIRLPOOL
-                           functions.
-        cmll_asm_src    => Assembler implementation of core CAMELLIA
-                           functions.
-                           Defaults to 'camellia.c cmll_misc.c cmll_cbc.c'
-        modes_asm_src   => Assembler implementation of cipher modes,
-                           currently the functions gcm_gmult_4bit and
-                           gcm_ghash_4bit.
-        padlock_asm_src => Assembler implementation of core parts of
-                           the padlock engine.  This is mandatory on
-                           any platform where the padlock engine might
-                           actually be built.
-
 
 [1] as part of the target configuration, one can have a key called
     'inherit_from' that indicate what other configurations to inherit
diff --git a/Configure b/Configure
index c3f4f99..6d9451e 100755
--- a/Configure
+++ b/Configure
@@ -1135,6 +1135,12 @@ foreach my $feature (@{$target{enable}}) {
         delete $disabled{$feature};
     }
 }
+
+# If uplink_arch isn't defined, disable uplink
+$disabled{uplink} = 'no uplink_arch' unless (defined $target{uplink_arch});
+# If asm_arch isn't defined, disable asm
+$disabled{asm} = 'no asm_arch' unless (defined $target{asm_arch});
+
 disable();                      # Run a cascade now
 
 $target{CXXFLAGS}//=$target{CFLAGS} if $target{CXX};
@@ -1398,107 +1404,6 @@ if ($target{sys_id} ne "")
         }
 
 unless ($disabled{asm}) {
-    $target{cpuid_asm_src}=$table{DEFAULTS}->{cpuid_asm_src} if ($config{processor} eq "386");
-    if ($target{cpuid_asm_src} ne "mem_clr.c") {
-        push @{$config{lib_defines}}, "OPENSSL_CPUID_OBJ";
-        push @{$config{module_defines}}, "OPENSSL_CPUID_OBJ";
-    }
-
-    $target{bn_asm_src} =~ s/\w+-gf2m.c// if (defined($disabled{ec2m}));
-
-    # bn-586 is the only one implementing bn_*_part_words
-    if ($target{bn_asm_src} =~ /bn-586/) {
-        push @{$config{lib_defines}}, "OPENSSL_BN_ASM_PART_WORDS";
-        push @{$config{module_defines}}, "OPENSSL_BN_ASM_PART_WORDS";
-    }
-    if (!$disabled{sse2} && $target{bn_asm_src} =~ /86/) {
-        push @{$config{lib_defines}}, "OPENSSL_IA32_SSE2";
-        push @{$config{module_defines}}, "OPENSSL_IA32_SSE2";
-    }
-
-    if ($target{bn_asm_src} =~ /-mont/) {
-        push @{$config{lib_defines}}, "OPENSSL_BN_ASM_MONT";
-        push @{$config{module_defines}}, "OPENSSL_BN_ASM_MONT";
-    }
-    if ($target{bn_asm_src} =~ /-mont5/) {
-        push @{$config{lib_defines}}, "OPENSSL_BN_ASM_MONT5";
-        push @{$config{module_defines}}, "OPENSSL_BN_ASM_MONT5";
-    }
-    if ($target{bn_asm_src} =~ /-gf2m/) {
-        push @{$config{lib_defines}}, "OPENSSL_BN_ASM_GF2m";
-        push @{$config{module_defines}}, "OPENSSL_BN_ASM_GF2m";
-    }
-    if ($target{bn_asm_src} =~ /-div3w/) {
-        push @{$config{lib_defines}}, "BN_DIV3W";
-        push @{$config{module_defines}}, "BN_DIV3W";
-    }
-
-    if ($target{sha1_asm_src}) {
-        push @{$config{lib_defines}}, "SHA1_ASM"   if ($target{sha1_asm_src} =~ /sx86/ || $target{sha1_asm_src} =~ /sha1/);
-        push @{$config{lib_defines}}, "SHA256_ASM" if ($target{sha1_asm_src} =~ /sha256/);
-        push @{$config{lib_defines}}, "SHA512_ASM" if ($target{sha1_asm_src} =~ /sha512/);
-    }
-    if ($target{keccak1600_asm_src} ne $table{DEFAULTS}->{keccak1600_asm_src}) {
-        push @{$config{lib_defines}}, "KECCAK1600_ASM";
-    }
-    if ($target{rc4_asm_src} ne $table{DEFAULTS}->{rc4_asm_src}) {
-        push @{$config{lib_defines}}, "RC4_ASM";
-    }
-    if ($target{md5_asm_src}) {
-        push @{$config{lib_defines}}, "MD5_ASM";
-    }
-    $target{cast_asm_src}=$table{DEFAULTS}->{cast_asm_src} unless $disabled{pic}; # CAST assembler is not PIC
-    if ($target{rmd160_asm_src}) {
-        push @{$config{lib_defines}}, "RMD160_ASM";
-    }
-    if ($target{aes_asm_src}) {
-        if ($target{aes_asm_src} =~ m/\baes-/) {
-            push @{$config{lib_defines}}, "AES_ASM";
-            push @{$config{module_defines}}, "AES_ASM";
-        }
-        # aes-ctr.fake is not a real file, only indication that assembler
-        # module implements AES_ctr32_encrypt...
-        if ($target{aes_asm_src} =~ s/\s*aes-ctr\.fake//) {
-            push @{$config{lib_defines}}, "AES_CTR_ASM";
-            push @{$config{module_defines}}, "AES_CTR_ASM";
-        }
-        # aes-xts.fake indicates presence of AES_xts_[en|de]crypt...
-        if ($target{aes_asm_src} =~ s/\s*aes-xts\.fake//) {
-            push @{$config{lib_defines}}, "AES_XTS_ASM";
-            push @{$config{module_defines}}, "AES_XTS_ASM";
-        }
-        $target{aes_asm_src} =~ s/\s*(vpaes|aesni)-x86\.s//g if ($disabled{sse2});
-        if ($target{aes_asm_src} =~ m/vpaes/) {
-            push @{$config{lib_defines}}, "VPAES_ASM";
-            push @{$config{module_defines}}, "VPAES_ASM";
-        }
-        if ($target{aes_asm_src} =~ m/bsaes/) {
-            push @{$config{lib_defines}}, "BSAES_ASM";
-            push @{$config{module_defines}}, "BSAES_ASM";
-        }
-    }
-    if ($target{wp_asm_src} =~ /mmx/) {
-        if ($config{processor} eq "386") {
-            $target{wp_asm_src}=$table{DEFAULTS}->{wp_asm_src};
-        } elsif (!$disabled{"whirlpool"}) {
-            push @{$config{lib_defines}}, "WHIRLPOOL_ASM";
-        }
-    }
-    if ($target{modes_asm_src} =~ /ghash-/) {
-        push @{$config{lib_defines}}, "GHASH_ASM";
-    }
-    if ($target{ec_asm_src} =~ /ecp_nistz256/) {
-        push @{$config{lib_defines}}, "ECP_NISTZ256_ASM";
-    }
-    if ($target{ec_asm_src} =~ /x25519/) {
-        push @{$config{lib_defines}}, "X25519_ASM";
-    }
-    if ($target{padlock_asm_src} ne $table{DEFAULTS}->{padlock_asm_src}) {
-        push @{$config{dso_defines}}, "PADLOCK_ASM";
-    }
-    if ($target{poly1305_asm_src} ne "") {
-        push @{$config{lib_defines}}, "POLY1305_ASM";
-    }
 }
 
 my %predefined_C = compiler_predefined($config{CROSS_COMPILE}.$config{CC});
@@ -1881,7 +1786,7 @@ if ($builder eq "unified") {
             qr/^\s*IF\[((?:\\.|[^\\\]])*)\]\s*$/
             => sub {
                 if (! @skip || $skip[$#skip] > 0) {
-                    push @skip, !! $1;
+                    push @skip, !! $expand_variables->($1);
                 } else {
                     push @skip, -1;
                 }
@@ -1890,7 +1795,7 @@ if ($builder eq "unified") {
             => sub { die "ELSIF out of scope" if ! @skip;
                      die "ELSIF following ELSE" if abs($skip[$#skip]) == 2;
                      $skip[$#skip] = -1 if $skip[$#skip] != 0;
-                     $skip[$#skip] = !! $1
+                     $skip[$#skip] = !! $expand_variables->($1)
                          if $skip[$#skip] == 0; },
             qr/^\s*ELSE\s*$/
             => sub { die "ELSE out of scope" if ! @skip;
@@ -1902,7 +1807,9 @@ if ($builder eq "unified") {
             qr/^\s*${variable_re}\s*=\s*(.*?)\s*$/
             => sub {
                 if (!@skip || $skip[$#skip] > 0) {
-                    $variables{$1} = $2;
+                    my $n = $1;
+                    my $v = $2;
+                    $variables{$n} = $expand_variables->($v);
                 }
             },
             qr/^\s*SUBDIRS\s*=\s*(.*)\s*$/
@@ -2987,18 +2894,6 @@ _____
 # Thus, whenever there's mention of a returned value, it's about that
 # intended value.
 
-# Helper function to implement conditional inheritance depending on the
-# value of $disabled{asm}.  Used in inherit_from values as follows:
-#
-#      inherit_from => [ "template", asm("asm_tmpl") ]
-#
-sub asm {
-    my @x = @_;
-    sub {
-        $disabled{asm} ? () : @x;
-    }
-}
-
 # Helper function to implement conditional value variants, with a default
 # plus additional values based on the value of $config{build_type}.
 # Arguments are given in hash table form:
@@ -3425,25 +3320,6 @@ sub print_table_entry
         "loutflag",
         "ex_libs",
         "bn_ops",
-        "apps_aux_src",
-        "cpuid_asm_src",
-        "uplink_aux_src",
-        "bn_asm_src",
-        "ec_asm_src",
-        "des_asm_src",
-        "aes_asm_src",
-        "bf_asm_src",
-        "md5_asm_src",
-        "cast_asm_src",
-        "sha1_asm_src",
-        "rc4_asm_src",
-        "rmd160_asm_src",
-        "rc5_asm_src",
-        "wp_asm_src",
-        "cmll_asm_src",
-        "modes_asm_src",
-        "padlock_asm_src",
-        "chacha_asm_src",
         "poly1035_asm_src",
         "thread_scheme",
         "perlasm_scheme",
diff --git a/NOTES.WIN b/NOTES.WIN
index 0215733..ca03360 100644
--- a/NOTES.WIN
+++ b/NOTES.WIN
@@ -89,8 +89,6 @@
 
  - UWP targets only support building the static and dynamic libraries.
 
- - The "no-uplink" must be given in the "Configure" script.
-
  - You should define the platform type to "uwp" and the target arch via
    "vcvarsall.bat" before you compile. For example, if you want to build
    "arm64" builds, you should type "vcvarsall.bat x86_arm64 uwp".
diff --git a/apps/build.info b/apps/build.info
index cbb70fc..3b4ea25 100644
--- a/apps/build.info
+++ b/apps/build.info
@@ -1,4 +1,25 @@
-{- our @apps_openssl_src =
+# Program init source, that don't have direct linkage with the rest of the
+# source, and can therefore not be part of a library.
+IF[{- !$disabled{uplink} -}]
+  $INITSRC=../ms/applink.c
+ENDIF
+IF[{- $config{target} =~ /^vms-/ -}]
+  $INITSRC=vms_decc_init.c
+ENDIF
+
+# Auxilliary program source
+IF[{- $config{target} =~ /^(?:VC-|mingw)/ -}]
+  # It's called 'init', but doesn't have much 'init' in it...
+  $AUXLIBAPPSSRC=win32_init.c
+ENDIF
+IF[{- $config{target} =~ /^vms-/ -}]
+  $AUXLIBAPPSSRC=vms_term_sock.c vms_decc_argv.c
+ENDIF
+
+# Source for the 'openssl' program
+# We need the perl variable for the DEPEND generator further down.
+$OPENSSLSRC={-
+   our @opensslsrc =
        qw(openssl.c
           asn1pars.c ca.c ciphers.c cms.c crl.c crl2p7.c dgst.c dhparam.c
           dsa.c dsaparam.c ec.c ecparam.c enc.c engine.c errstr.c gendsa.c
@@ -7,30 +28,28 @@
           rsautl.c s_client.c s_server.c s_time.c sess_id.c smime.c speed.c
           spkac.c srp.c ts.c verify.c version.c x509.c rehash.c storeutl.c
           info.c);
-   our @apps_lib_src =
-       ( qw(apps.c apps_ui.c opt.c fmt.c s_cb.c s_socket.c app_rand.c
-            bf_prefix.c),
-         split(/\s+/, $target{apps_aux_src}) );
-   our @apps_init_src = split(/\s+/, $target{apps_init_src});
-   "" -}
+   join(' ', @opensslsrc); -}
+# Source for libapps
+$LIBAPPSSRC=apps.c apps_ui.c opt.c fmt.c s_cb.c s_socket.c app_rand.c \
+        bf_prefix.c
+
 IF[{- !$disabled{apps} -}]
   LIBS{noinst}=libapps.a
-  SOURCE[libapps.a]={- join(" ", @apps_lib_src) -}
+  SOURCE[libapps.a]=$LIBAPPSSRC $AUXLIBAPPSSRC
   INCLUDE[libapps.a]=.. ../include include
 
   PROGRAMS=openssl
-  SOURCE[openssl]={- join(" ", @apps_init_src) -}
-  SOURCE[openssl]={- join(" ", @apps_openssl_src) -}
+  SOURCE[openssl]=$INITSRC $OPENSSLSRC
   INCLUDE[openssl]=.. ../include include
   DEPEND[openssl]=libapps.a ../libssl
 
-IF[{- $config{target} =~ /^(?:Cygwin|mingw|VC-)/ -}]
-  GENERATE[openssl.rc]=../util/mkrc.pl openssl
-  SOURCE[openssl]=openssl.rc
-ENDIF
+  IF[{- $config{target} =~ /^(?:Cygwin|mingw|VC-)/ -}]
+    GENERATE[openssl.rc]=../util/mkrc.pl openssl
+    SOURCE[openssl]=openssl.rc
+  ENDIF
 
   {- join("\n  ", map { (my $x = $_) =~ s|\.c$|.o|; "DEPEND[$x]=progs.h" }
-                  @apps_openssl_src) -}
+                  @opensslsrc) -}
   GENERATE[progs.h]=progs.pl $(APPS_OPENSSL)
   DEPEND[progs.h]=../configdata.pm
 
diff --git a/crypto/aes/build.info b/crypto/aes/build.info
index 3a27d17..706ca58 100644
--- a/crypto/aes/build.info
+++ b/crypto/aes/build.info
@@ -1,9 +1,70 @@
 LIBS=../../libcrypto
 
-$COMMON=aes_misc.c aes_ecb.c {- $target{aes_asm_src} -}
-SOURCE[../../libcrypto]=$COMMON \
-        aes_cfb.c aes_ofb.c aes_ige.c aes_wrap.c
+$AESASM=aes_core.c aes_cbc.c
+IF[{- !$disabled{asm} -}]
+  $AESASM_x86=aes-586.s
+  $AESASM_x86_sse2=vpaes-x86.s aesni-x86.s
+  $AESDEF_x86_sse2=AES_ASM VPAES_ASM
+
+  $AESASM_x86_64=\
+        aes-x86_64.s bsaes-x86_64.s \
+        aesni-sha1-x86_64.s aesni-sha256-x86_64.s aesni-mb-x86_64.s
+  $AESDEF_x86_64=AES_ASM BSAES_ASM
+  $AESASM_x86_64_sse2=vpaes-x86_64.s aesni-x86_64.s
+  $AESDEF_x86_64_sse2=VPAES_ASM
+
+  $AESASM_ia64=aes_core.c aes_cbc.c aes-ia64.s
+  $AESDEF_ia64=AES_ASM
+
+  $AESASM_sparcv9=\
+        aes_core.c aes_cbc.c aes-sparcv9.S aest4-sparcv9.S aesfx-sparcv9.S
+  $AESDEF_sparcv9=AES_ASM
+
+  $AESASM_mips32=aes_cbc.c aes-mips.S
+  $AESDEF_mips32=AES_ASM
+  $AESASM_mips64=$AESASM_mips32
+  $AESDEF_mips64=$AESDEF_mips32
+
+  $AESASM_s390x=aes-s390x.S
+  # aes-390x.S implements AES_ctr32_encrypt and AES_xts_[en|de]crypt
+  $AESDEF_s390x=AES_ASM AES_CTR_ASM AES_XTS_ASM
+
+  $AESASM_armv4=aes_cbc.c aes-armv4.S bsaes-armv7.S aesv8-armx.S
+  $AESDEF_armv4=AES_ASM BSAES_ASM
+  $AESASM_aarch64=aes_core.c aes_cbc.c aesv8-armx.S vpaes-armv8.S
+  $AESDEF_aarch64=VPAES_ASM
+
+  $AESASM_parisc11=aes_core.c aes_cbc.c aes-parisc.s
+  $AESDEF_parisc11=AES_ASM
+  $AESASM_parisc20_64=$AESASM_parisc11
+  $AESDEF_parisc20_64=$AESDEF_parisc11
+
+  $AESASM_ppc32=aes_core.c aes_cbc.c aes-ppc.s vpaes-ppc.s aesp8-ppc.s
+  $AESDEF_ppc32=AES_ASM VPAES_ASM
+  $AESASM_ppc64=$AESASM_ppc32
+  $AESDEF_ppc64=$AESDEF_ppc32
+
+  $AESASM_c64xplus=aes-c64xplus.s aes_cbc.c
+  # aes-c64xplus.s implements AES_ctr32_encrypt
+  $AESDEF_c64xplus=AES_ASM AES_CTR_ASM
+
+  # Now that we have defined all the arch specific variables, use the
+  # appropriate one, and define the appropriate macros
+  IF[$AESASM_{- $target{asm_arch} -}]
+    $AESASM=$AESASM_{- $target{asm_arch} -}
+    $AESDEF=$AESDEF_{- $target{asm_arch} -}
+    IF[{- !$disabled{sse2} -}]
+      $AESASM=$AESASM $AESASM_{- $target{asm_arch} -}_sse2
+      $AESDEF=$AESDEF $AESDEF_{- $target{asm_arch} -}_sse2
+    ENDIF
+  ENDIF
+ENDIF
+
+$COMMON=aes_misc.c aes_ecb.c $AESASM
+SOURCE[../../libcrypto]=$COMMON aes_cfb.c aes_ofb.c aes_ige.c aes_wrap.c
+DEFINE[../../libcrypto]=$AESDEF
 SOURCE[../../providers/fips]=$COMMON
+DEFINE[../../providers/fips]=$AESDEF
 
 GENERATE[aes-ia64.s]=asm/aes-ia64.S
 
diff --git a/crypto/bf/build.info b/crypto/bf/build.info
index 29adc8c..cc06212 100644
--- a/crypto/bf/build.info
+++ b/crypto/bf/build.info
@@ -1,6 +1,17 @@
 LIBS=../../libcrypto
-SOURCE[../../libcrypto]=bf_skey.c bf_ecb.c bf_cfb64.c bf_ofb64.c \
-        {- $target{bf_asm_src} -}
+
+$BFASM=bf_enc.c
+IF[{- !$disabled{asm} -}]
+  $BFASM_x86=bf-586.s
+
+  # Now that we have defined all the arch specific variables, use the
+  # appropriate one
+  IF[$BFASM_{- $target{asm_arch} -}]
+    $BFASM=$BFASM_{- $target{asm_arch} -}
+  ENDIF
+ENDIF
+
+SOURCE[../../libcrypto]=bf_skey.c bf_ecb.c bf_cfb64.c bf_ofb64.c $BFASM
 
 GENERATE[bf-586.s]=asm/bf-586.pl \
         $(PERLASM_SCHEME) $(LIB_CFLAGS) $(LIB_CPPFLAGS) $(PROCESSOR)
diff --git a/crypto/bn/build.info b/crypto/bn/build.info
index 362a2da..8353b32 100644
--- a/crypto/bn/build.info
+++ b/crypto/bn/build.info
@@ -1,14 +1,116 @@
 LIBS=../../libcrypto
 
+$BNASM=bn_asm.c
+IF[{- !$disabled{asm} -}]
+  # Define source files and macros per asm architecture
+  # Known macros are:
+  #
+  # OPENSSL_BN_ASM_PART_WORDS     For any collection with /-586/ file names
+  # OPENSSL_BN_ASM_MONT           For any collection with /-mont/ file names
+  # OPENSSL_BN_ASM_MONT5          For any collection with /-mont5/ file names
+  # OPENSSL_BN_ASM_GF2m           For any collection with /-gf2m/ file names
+  # OPENSSL_IA32_SSE2             For any collection with /86/ file names
+  #                               when sse2 is enabled
+  # BN_DIV3W                      For any collection with /-div3w/ file names
+  #
+  # All variables are named in such a way that they can be "indexed" with
+  # $target{asm_arch}
+
+  $BNASM_x86=bn-586.s co-586.s x86-mont.s x86-gf2m.s
+  # bn-586 is the only one implementing bn_*_part_words
+  # => OPENSSL_BN_ASM_PART_WORDS
+  $BNDEF_x86=OPENSSL_BN_ASM_PART_WORDS OPENSSL_BN_ASM_MONT OPENSSL_BN_ASM_GF2m
+  $BNDEF_x86_sse2=OPENSSL_IA32_SSE2
+
+  $BNASM_x86_64=\
+          x86_64-mont.s x86_64-mont5.s x86_64-gf2m.s rsaz_exp.c rsaz-x86_64.s \
+          rsaz-avx2.s
+  IF[{- $config{target} !~ /^VC/ -}]
+    $BNASM_x86_64=asm/x86_64-gcc.c $BNASM_x86_64
+  ELSE
+    $BNASM_x86_64=bn_asm.c $BNASM_x86_64
+  ENDIF
+  $BNDEF_x86_64=OPENSSL_BN_ASM_MONT OPENSSL_BN_ASM_MONT5 OPENSSL_BN_ASM_GF2m
+  $BNDEF_x86_64_sse2=OPENSSL_IA32_SSE2
+
+  IF[{- $config{target} !~ /^VC/ -}]
+    $BNASM_ia64=bn-ia64.s ia64-mont.s
+  ELSE
+    $BNASM_ia64=bn_asm.c ia64-mont.s
+  ENDIF
+
+  $BNASM_sparcv9=asm/sparcv8plus.S sparcv9-mont.S sparcv9a-mont.S vis3-mont.S \
+          sparct4-mont.S
+  $BNDEF_sparcv9=OPENSSL_BN_ASM_MONT
+  $BNASM_sparcv9_ec2m=sparcv9-gf2m.S
+  $BNDEF_sparcv9_ec2m=OPENSSL_BN_ASM_GF2m
+
+  $BNASM_sparcv8=asm/sparcv8.S
+
+  $BNASM_alpha=bn_asm.c alpha-mont.S
+  $BNDEF_alpha=OPENSSL_BN_ASM_MONT
+
+  $BNASM_mips32=bn-mips.S mips-mont.S
+  $BNDEF_mips32=OPENSSL_BN_ASM_MONT
+  $BNASM_mips64=$BNASM_mips32
+  $BNDEF_mips64=$BNDEF_mips32
+
+  IF[{- ($target{perlasm_scheme} // '') eq '31' -}]
+    $BNASM_s390x=bn_asm.c s390x-mont.S
+  ELSE
+    $BNASM_s390x=asm/s390x.S s390x-mont.S
+  ENDIF
+  $BNDEF_s390x=OPENSSL_BN_ASM_MONT
+  $BNASM_s390x_ec2m=s390x-gf2m.s
+  $BNDEF_s390x_ec2m=OPENSSL_BN_ASM_GF2m
+
+  $BNASM_armv4=bn_asm.c armv4-mont.S
+  $BNDEF_armv4=OPENSSL_BN_ASM_MONT
+  $BNASM_armv4_ec2m=armv4-gf2m.S
+  $BNDEF_armv4_ec2m=OPENSSL_BN_ASM_GF2m
+
+  $BNASM_aarch64=bn_asm.c armv8-mont.S
+  $BNDEF_aarch64=OPENSSL_BN_ASM_MONT
+
+  $BNASM_parisc11=bn_asm.c parisc-mont.s
+  $BNDEF_parisc11=OPENSSL_BN_ASM_MONT
+  $BNASM_parisc20_64=$BNASM_parisc11
+  $BNDEF_parisc20_64=$BNDEF_parisc11
+
+  $BNASM_ppc32=bn-ppc.s ppc-mont.s
+  $BNDEF_ppc32=OPENSSL_BN_ASM_MONT
+  $BNASM_ppc64=$BNASM_ppc32
+  $BNDEF_ppc64=$BNDEF_ppc32
+
+  $BNASM_c64xplus=asm/bn-c64xplus.asm
+  $BNASM_c64xplus_ec2m=c64xplus-gf2m.s
+  $BNDEF_c64xplus_ec2m=OPENSSL_BN_ASM_GF2m
+
+  # Now that we have defined all the arch specific variables, use the
+  # appropriate ones, and define the appropriate macros
+  IF[$BNASM_{- $target{asm_arch} -}]
+    $BNASM=$BNASM_{- $target{asm_arch} -}
+    $BNDEF=$BNDEF_{- $target{asm_arch} -}
+    IF[{- !$disabled{ec2m} -}]
+      $BNASM=$BNASM $BNASM_{- $target{asm_arch} -}_ec2m
+      $BNDEF=$BNDEF $BNDEF_{- $target{asm_arch} -}_ec2m
+    ENDIF
+    IF[{- !$disabled{sse2} -}]
+      $BNDEF_sse2=$BNDEF $BNDEF_{- $target{asm_arch} -}_sse2
+    ENDIF
+  ENDIF
+ENDIF
+
 $COMMON=bn_add.c bn_div.c bn_exp.c bn_lib.c bn_ctx.c bn_mul.c \
         bn_mod.c bn_conv.c bn_rand.c bn_shift.c bn_word.c bn_blind.c \
         bn_kron.c bn_sqrt.c bn_gcd.c bn_prime.c bn_sqr.c \
         bn_recp.c bn_mont.c bn_mpi.c bn_exp2.c bn_gf2m.c bn_nist.c \
         bn_const.c bn_x931p.c bn_intern.c bn_dh.c \
-        bn_rsa_fips186_4.c {- $target{bn_asm_src} -}
+        bn_rsa_fips186_4.c $BNASM
 SOURCE[../../libcrypto]=$COMMON bn_print.c bn_err.c bn_depr.c bn_srp.c
+DEFINE[../../libcrypto]=$BNDEF
 SOURCE[../../providers/fips]=$COMMON
-
+DEFINE[../../providers/fips]=$BNDEF
 
 INCLUDE[../../libcrypto]=../../crypto/include
 
diff --git a/crypto/build.info b/crypto/build.info
index 849d468..cb8457a 100644
--- a/crypto/build.info
+++ b/crypto/build.info
@@ -8,6 +8,56 @@ SUBDIRS=objects buffer bio stack lhash rand evp asn1 pem x509 conf \
         err comp ocsp cms ts srp cmac ct async kmac ess crmf cmp
 
 LIBS=../libcrypto
+
+$UPLINKSRC=
+$UPLINKDEF=
+IF[{- !$disabled{uplink} -}]
+  $UPLINKSRC_common=../ms/uplink.c
+  $UPLINKSRC_x86=$UPLINKSRC_common uplink-x86.s
+  $UPLINKSRC_x86_64=$UPLINKSRC_common uplink-x86_64.s
+  $UPLINKSRC_ia64=$UPLINKSRC_common uplink-ia64.s
+
+  IF[$UPLINKSRC_{- $target{uplink_arch} -}]
+    $UPLINKSRC=$UPLINKSRC_{- $target{uplink_arch} -}
+    $UPLINKDEF=OPENSSL_USE_APPLINK
+  ENDIF
+ENDIF
+
+$CPUIDASM=mem_clr.c
+$CPUIDDEF=
+IF[{- !$disabled{asm} && $config{processor} ne '386' -}]
+  $CPUIDASM_x86=x86cpuid.s
+
+  $CPUIDASM_x86_64=x86_64cpuid.s
+
+  $CPUIDASM_ia64=ia64cpuid.s
+
+  $CPUIDASM_sparcv9=sparcv9cap.c sparccpuid.S
+
+  $CPUIDASM_alpha=alphacpuid.s
+
+  $CPUIDASM_s390x=s390xcap.c s390xcpuid.S
+
+  $CPUIDASM_armv4=armcap.c armv4cpuid.S
+
+  $CPUIDASM_aarch64=armcap.c arm64cpuid.S
+
+  $CPUIDASM_parisc11=pariscid.s
+  $CPUIDASM_parisc20_64=$CPUIDASM_parisc11
+
+  $CPUIDASM_ppc32=ppccpuid.s ppccap.c
+  $CPUIDASM_ppc64=$CPUIDASM_ppc32
+
+  $CPUIDASM_c64xplus=c64xpluscpuid.s
+
+  # Now that we have defined all the arch specific variables, use the
+  # appropriate one, and define the appropriate macros
+  IF[$CPUIDASM_{- $target{asm_arch} -}]
+    $CPUIDASM=$CPUIDASM_{- $target{asm_arch} -}
+    $CPUIDDEF=OPENSSL_CPUID_OBJ
+  ENDIF
+ENDIF
+
 # The Core
 $CORE_COMMON=provider_core.c provider_predefined.c core_fetch.c core_namemap.c
 
@@ -18,13 +68,16 @@ SOURCE[../providers/fips]=$CORE_COMMON
 $UTIL_COMMON=\
         cryptlib.c mem.c mem_sec.c params.c bsearch.c ex_data.c o_str.c \
         ctype.c threads_pthread.c threads_win.c threads_none.c context.c \
-        sparse_array.c {- $target{cpuid_asm_src} -}
+        sparse_array.c $CPUIDASM
+$UTIL_DEFINE=$CPUIDDEF
 
 SOURCE[../libcrypto]=$UTIL_COMMON \
         mem_dbg.c cversion.c info.c cpt_err.c ebcdic.c uid.c o_time.c o_dir.c \
         o_fopen.c getenv.c o_init.c o_fips.c init.c trace.c provider.c \
-        {- $target{uplink_aux_src} -}
+        $UPLINKSRC
+DEFINE[../libcrypto]=$UTIL_DEFINE $UPLINKDEF
 SOURCE[../providers/fips]=$UTIL_COMMON
+DEFINE[../providers/fips]=$UTIL_DEFINE
         
 
 
diff --git a/crypto/camellia/build.info b/crypto/camellia/build.info
index e36a19b..8d74b9f 100644
--- a/crypto/camellia/build.info
+++ b/crypto/camellia/build.info
@@ -1,7 +1,19 @@
 LIBS=../../libcrypto
-SOURCE[../../libcrypto]=\
-        cmll_ecb.c cmll_ofb.c cmll_cfb.c cmll_ctr.c \
-        {- $target{cmll_asm_src} -}
+
+$CMLLASM=camellia.c cmll_misc.c cmll_cbc.c
+IF[{- !$disabled{asm} -}]
+  $CMLLASM_x86=cmll-x86.s
+  $CMLLASM_x86_64=cmll-x86_64.s cmll_misc.c
+  $CMLLASM_sparcv9=camellia.c cmll_misc.c cmll_cbc.c cmllt4-sparcv9.S
+
+  # Now that we have defined all the arch specific variables, use the
+  # appropriate one
+  IF[$CMLLASM_{- $target{asm_arch} -}]
+    $CMLLASM=$CMLLASM_{- $target{asm_arch} -}
+  ENDIF
+ENDIF
+
+SOURCE[../../libcrypto]=cmll_ecb.c cmll_ofb.c cmll_cfb.c cmll_ctr.c $CMLLASM
 
 GENERATE[cmll-x86.s]=asm/cmll-x86.pl \
         $(PERLASM_SCHEME) $(LIB_CFLAGS) $(LIB_CPPFLAGS) \
diff --git a/crypto/cast/build.info b/crypto/cast/build.info
index b0f59f3..97779c2 100644
--- a/crypto/cast/build.info
+++ b/crypto/cast/build.info
@@ -1,6 +1,18 @@
 LIBS=../../libcrypto
-SOURCE[../../libcrypto]=\
-        c_skey.c c_ecb.c {- $target{cast_asm_src} -} c_cfb64.c c_ofb64.c
+
+$CASTASM=c_enc.c
+# CAST assembly source is not PIC
+IF[{- !$disabled{asm} && !$disabled{pic} -}]
+  $CASTASM_x86=cast-586.s
+
+  # Now that we have defined all the arch specific variables, use the
+  # appropriate one
+  IF[$CASTASM_{- $target{asm_arch} -}]
+    $CASTASM=$CASTASM_{- $target{asm_arch} -}
+  ENDIF
+ENDIF
+
+SOURCE[../../libcrypto]=c_skey.c c_ecb.c $CASTASM c_cfb64.c c_ofb64.c
 
 GENERATE[cast-586.s]=asm/cast-586.pl \
         $(PERLASM_SCHEME) $(LIB_CFLAGS) $(LIB_CPPFLAGS) $(PROCESSOR)
diff --git a/crypto/chacha/build.info b/crypto/chacha/build.info
index a741826..e8eeaf0 100644
--- a/crypto/chacha/build.info
+++ b/crypto/chacha/build.info
@@ -1,5 +1,30 @@
 LIBS=../../libcrypto
-SOURCE[../../libcrypto]={- $target{chacha_asm_src} -}
+
+$CHACHAASM=chacha_enc.c
+IF[{- !$disabled{asm} -}]
+  $CHACHAASM_x86=chacha-x86.s
+  $CHACHAASM_x86_64=chacha-x86_64.s
+
+  $CHACHAASM_ia64=chacha-ia64.S
+
+  $CHACHAASM_s390x=chacha-s390x.S
+
+  $CHACHAASM_armv4=chacha-armv4.S
+  $CHACHAASM_aarch64=chacha-armv8.S
+
+  $CHACHAASM_ppc32=chacha-ppc.s
+  $CHACHAASM_ppc64=$CHACHAASM_ppc32
+
+  $CHACHAASM_c64xplus=chacha-c64xplus.s
+
+  # Now that we have defined all the arch specific variables, use the
+  # appropriate one
+  IF[$CHACHAASM_{- $target{asm_arch} -}]
+    $CHACHAASM=$CHACHAASM_{- $target{asm_arch} -}
+  ENDIF
+ENDIF
+
+SOURCE[../../libcrypto]=$CHACHAASM
 
 GENERATE[chacha-x86.s]=asm/chacha-x86.pl \
         $(PERLASM_SCHEME) $(LIB_CFLAGS) $(LIB_CPPFLAGS) $(PROCESSOR)
diff --git a/crypto/des/build.info b/crypto/des/build.info
index 05cb154..474d14e 100644
--- a/crypto/des/build.info
+++ b/crypto/des/build.info
@@ -1,10 +1,24 @@
+$DESASM=des_enc.c fcrypt_b.c
+IF[{- !$disabled{asm} -}]
+  $DESASM_x86=des-586.s crypt586.s
+  $DESASM_ia64=ghash-ia64.s
+  $DESASM_sparcv9=des_enc-sparc.S fcrypt_b.c dest4-sparcv9.S
+  $DESASM_sparcv8=des_enc-sparc.S fcrypt_b.c
+
+  # Now that we have defined all the arch specific variables, use the
+  # appropriate one
+  IF[$DESASM_{- $target{asm_arch} -}]
+    $DESASM=$DESASM_{- $target{asm_arch} -}
+  ENDIF
+ENDIF
+
 LIBS=../../libcrypto
 SOURCE[../../libcrypto]=\
         set_key.c  ecb_enc.c  cbc_enc.c \
         ecb3_enc.c cfb64enc.c cfb64ede.c cfb_enc.c \
         ofb64ede.c ofb64enc.c ofb_enc.c \
         str2key.c  pcbc_enc.c qud_cksm.c rand_key.c \
-        {- $target{des_asm_src} -} \
+        $DESASM \
         fcrypt.c xcbc_enc.c cbc_cksm.c
 
 GENERATE[des_enc-sparc.S]=asm/des_enc.m4
diff --git a/crypto/ec/build.info b/crypto/ec/build.info
index dd1c891..5e9778d 100644
--- a/crypto/ec/build.info
+++ b/crypto/ec/build.info
@@ -1,3 +1,47 @@
+$ECASM=
+IF[{- !$disabled{asm} -}]
+  $ECASM_x86=ecp_nistz256.c ecp_nistz256-x86.s
+  $ECDEF_x86=ECP_NISTZ256_ASM
+
+  $ECASM_x86_64=ecp_nistz256.c ecp_nistz256-x86_64.s x25519-x86_64.s
+  $ECDEF_x86_64=ECP_NISTZ256_ASM X25519_ASM
+
+  $ECASM_ia64=
+
+  $ECASM_sparcv9=ecp_nistz256.c ecp_nistz256-sparcv9.S
+  $ECDEF_sparcv9=ECP_NISTZ256_ASM
+
+  $ECASM_sparcv8=
+
+  $ECASM_alpha=
+
+  $ECASM_mips32=
+  $ECASM_mips64=
+
+  $ECASM_s390x=
+
+  $ECASM_armv4=ecp_nistz256.c ecp_nistz256-armv4.S
+  $ECDEF_armv4=ECP_NISTZ256_ASM
+  $ECASM_aarch64=ecp_nistz256.c ecp_nistz256-armv8.S
+  $ECDEF_aarch64=ECP_NISTZ256_ASM
+
+  $ECASM_parisc11=
+  $ECASM_parisc20_64=
+
+  $ECASM_ppc32=
+  $ECASM_ppc64=ecp_nistz256.c ecp_nistz256-ppc64.s x25519-ppc64.s
+  $ECDEF_ppc64=ECP_NISTZ256_ASM X25519_ASM
+
+  $ECASM_c64xplus=
+
+  # Now that we have defined all the arch specific variables, use the
+  # appropriate one, and define the appropriate macros
+  IF[$ECASM_{- $target{asm_arch} -}]
+    $ECASM=$ECASM_{- $target{asm_arch} -}
+    $ECDEF=$ECDEF_{- $target{asm_arch} -}
+  ENDIF
+ENDIF
+
 LIBS=../../libcrypto
 SOURCE[../../libcrypto]=\
         ec_lib.c ecp_smpl.c ecp_mont.c ecp_nist.c ec_cvt.c ec_mult.c \
@@ -8,7 +52,8 @@ SOURCE[../../libcrypto]=\
         ecdsa_ossl.c ecdsa_sign.c ecdsa_vrf.c curve25519.c ecx_meth.c \
         curve448/arch_32/f_impl.c curve448/f_generic.c curve448/scalar.c \
         curve448/curve448_tables.c curve448/eddsa.c curve448/curve448.c \
-        {- $target{ec_asm_src} -}
+        $ECASM
+DEFINE[../../libcrypto]=$ECDEF
 
 GENERATE[ecp_nistz256-x86.s]=asm/ecp_nistz256-x86.pl \
         $(PERLASM_SCHEME) $(LIB_CFLAGS) $(LIB_CPPFLAGS) $(PROCESSOR)
diff --git a/crypto/md5/build.info b/crypto/md5/build.info
index 2b1444d..3b91abf 100644
--- a/crypto/md5/build.info
+++ b/crypto/md5/build.info
@@ -1,6 +1,21 @@
 LIBS=../../libcrypto
-SOURCE[../../libcrypto]=\
-        md5_dgst.c md5_one.c md5_sha1.c {- $target{md5_asm_src} -}
+
+$MD5ASM=
+IF[{- !$disabled{asm} -}]
+  $MD5ASM_x86=md5-586.s
+  $MD5ASM_x86_64=md5-x86_64.s
+  $MD5ASM_sparcv9=md5-sparcv9.S
+
+  # Now that we have defined all the arch specific variables, use the
+  # appropriate one, and define the appropriate macros
+  IF[$MD5ASM_{- $target{asm_arch} -}]
+    $MD5ASM=$MD5ASM_{- $target{asm_arch} -}
+    $MD5DEF=MD5_ASM
+  ENDIF
+ENDIF
+
+SOURCE[../../libcrypto]=md5_dgst.c md5_one.c md5_sha1.c $MD5ASM
+DEFINE[../../libcrypto]=$MD5DEF
 
 GENERATE[md5-586.s]=asm/md5-586.pl \
         $(PERLASM_SCHEME) $(LIB_CFLAGS) $(LIB_CPPFLAGS)
diff --git a/crypto/modes/build.info b/crypto/modes/build.info
index 4157af3..6024606 100644
--- a/crypto/modes/build.info
+++ b/crypto/modes/build.info
@@ -1,9 +1,59 @@
 LIBS=../../libcrypto
 
-$COMMON=cbc128.c ctr128.c cfb128.c ofb128.c {- $target{modes_asm_src} -}
+$MODESASM=
+IF[{- !$disabled{asm} -}]
+  $MODESASM_x86=ghash-x86.s
+  $MODESDEF_x86=GHASH_ASM
+  $MODESASM_x86_64=ghash-x86_64.s aesni-gcm-x86_64.s
+  $MODESDEF_x86_64=GHASH_ASM
+
+  # ghash-ia64.s doesn't work on VMS
+  IF[{- $config{target} !~ /^vms-/ -}]
+    $MODESASM_ia64=ghash-ia64.s
+    $MODESDEF_ia64=GHASH_ASM
+  ENDIF
+
+  $MODESASM_sparcv9=ghash-sparcv9.S
+  $MODESDEF_sparcv9=GHASH_ASM
+
+  $MODESASM_alpha=ghash-alpha.S
+  $MODESDEF_alpha=GHASH_ASM
+
+  $MODESASM_s390x=ghash-s390x.S
+  $MODESDEF_s390x=GHASH_ASM
+
+  $MODESASM_armv4=ghash-armv4.S ghashv8-armx.S
+  $MODESDEF_armv4=GHASH_ASM
+  $MODESASM_aarch64=ghashv8-armx.S
+  $MODESDEF_aarch64=GHASH_ASM
+
+  $MODESASM_parisc11=ghash-parisc.s
+  $MODESDEF_parisc11=GHASH_ASM
+  $MODESASM_parisc20_64=$MODESASM_parisc11
+  $MODESDEF_parisc20_64=$MODESDEF_parisc11
+
+  $MODESASM_ppc32=ghashp8-ppc.s
+  $MODESDEF_ppc32=
+  $MODESASM_ppc64=$MODESASM_ppc32
+  $MODESDEF_ppc64=$MODESDEF_ppc32
+
+  $MODESASM_c64xplus=ghash-c64xplus.s
+  $MODESDEF_c64xplus=GHASH_ASM
+
+  # Now that we have defined all the arch specific variables, use the
+  # appropriate one, and define the appropriate macros
+  IF[$MODESASM_{- $target{asm_arch} -}]
+    $MODESASM=$MODESASM_{- $target{asm_arch} -}
+    $MODESDEF=$MODESDEF_{- $target{asm_arch} -}
+  ENDIF
+ENDIF
+
+$COMMON=cbc128.c ctr128.c cfb128.c ofb128.c $MODESASM
 SOURCE[../../libcrypto]=$COMMON \
         cts128.c gcm128.c ccm128.c xts128.c wrap128.c ocb128.c siv128.c
+DEFINE[../../libcrypto]=$MODESDEF
 SOURCE[../../providers/fips]=$COMMON
+DEFINE[../../providers/fips]=$MODESDEF
 
 INCLUDE[gcm128.o]=..
 
diff --git a/crypto/poly1305/build.info b/crypto/poly1305/build.info
index 60eeeee..064c259 100644
--- a/crypto/poly1305/build.info
+++ b/crypto/poly1305/build.info
@@ -1,8 +1,36 @@
 LIBS=../../libcrypto
-SOURCE[../../libcrypto]=\
-        poly1305_ameth.c \
-        poly1305_meth.c \
-        poly1305.c {- $target{poly1305_asm_src} -}
+
+$POLY1305ASM=
+IF[{- !$disabled{asm} -}]
+  $POLY1305ASM_x86=poly1305-x86.s
+  $POLY1305ASM_x86_64=poly1305-x86_64.s
+
+  $POLY1305ASM_ia64=asm/poly1305-ia64.S
+
+  $POLY1305ASM_sparcv9=poly1305-sparcv9.S
+
+  $POLY1305ASM_mips64=poly1305-mips.S
+
+  $POLY1305ASM_s390x=poly1305-s390x.S
+
+  $POLY1305ASM_armv4=poly1305-armv4.S
+  $POLY1305ASM_aarch64=poly1305-armv8.S
+
+  $POLY1305ASM_ppc32=poly1305-ppc.s poly1305-ppcfp.s
+  $POLY1305ASM_ppc64=$POLY1305ASM_ppc32
+
+  $POLY1305ASM_c64xplus=poly1305-c64xplus.s
+
+  # Now that we have defined all the arch specific variables, use the
+  # appropriate one, and define the appropriate macros
+  IF[$POLY1305ASM_{- $target{asm_arch} -}]
+    $POLY1305ASM=$POLY1305ASM_{- $target{asm_arch} -}
+    $POLY1305DEF=POLY1305_ASM
+  ENDIF
+ENDIF
+
+SOURCE[../../libcrypto]=poly1305_ameth.c poly1305_meth.c poly1305.c $POLY1305ASM
+DEFINE[../../libcrypto]=$POLY1305DEF
 
 GENERATE[poly1305-sparcv9.S]=asm/poly1305-sparcv9.pl $(PERLASM_SCHEME)
 INCLUDE[poly1305-sparcv9.o]=..
diff --git a/crypto/rc4/build.info b/crypto/rc4/build.info
index 8d272e4..30e36ba 100644
--- a/crypto/rc4/build.info
+++ b/crypto/rc4/build.info
@@ -1,6 +1,23 @@
 LIBS=../../libcrypto
-SOURCE[../../libcrypto]=\
-        {- $target{rc4_asm_src} -}
+
+$RC4ASM=rc4_enc.c rc4_skey.c
+IF[{- !$disabled{asm} -}]
+  $RC4ASM_x86=rc4-586.s
+  $RC4ASM_x86_64=rc4-x86_64.s rc4-md5-x86_64.s
+  $RC4ASM_s390x=rc4-s390x.s
+  $RC4ASM_parisc11=rc4-parisc.s
+  $RC4ASM_parisc20_64=$RC4ASM_parisc11
+  $RC4ASM_c64xplus=rc4-c64xplus.s
+
+  # Now that we have defined all the arch specific variables, use the
+  # appropriate one, and define the appropriate macros
+  IF[$RC4ASM_{- $target{asm_arch} -}]
+    $RC4ASM=$RC4ASM_{- $target{asm_arch} -}
+    $RC4DEF=RC4_ASM
+  ENDIF
+ENDIF
+
+SOURCE[../../libcrypto]=$RC4ASM
 
 GENERATE[rc4-586.s]=asm/rc4-586.pl \
         $(PERLASM_SCHEME) $(LIB_CFLAGS) $(LIB_CPPFLAGS) $(PROCESSOR)
diff --git a/crypto/rc5/build.info b/crypto/rc5/build.info
index 928a62c..5780f3c 100644
--- a/crypto/rc5/build.info
+++ b/crypto/rc5/build.info
@@ -1,6 +1,19 @@
 LIBS=../../libcrypto
+
+$RC5ASM=rc5_enc.c
+IF[{- !$disabled{asm} -}]
+  $RC5ASM_x86=rc5-586.s
+
+  # Now that we have defined all the arch specific variables, use the
+  # appropriate one, and define the appropriate macros
+  IF[$RC5ASM_{- $target{asm_arch} -}]
+    $RC5ASM=$RC5ASM_{- $target{asm_arch} -}
+    $RC5DEF=RC5_ASM
+  ENDIF
+ENDIF
+
 SOURCE[../../libcrypto]=\
-        rc5_skey.c rc5_ecb.c {- $target{rc5_asm_src} -} rc5cfb64.c rc5ofb64.c
+        rc5_skey.c rc5_ecb.c $RC5ASM rc5cfb64.c rc5ofb64.c
 
 GENERATE[rc5-586.s]=asm/rc5-586.pl \
         $(PERLASM_SCHEME) $(LIB_CFLAGS) $(LIB_CPPFLAGS)
diff --git a/crypto/ripemd/build.info b/crypto/ripemd/build.info
index a4a894e..e2db293 100644
--- a/crypto/ripemd/build.info
+++ b/crypto/ripemd/build.info
@@ -1,6 +1,19 @@
 LIBS=../../libcrypto
-SOURCE[../../libcrypto]=\
-        rmd_dgst.c rmd_one.c {- $target{rmd160_asm_src} -}
+
+$RMD160ASM=
+IF[{- !$disabled{asm} -}]
+  $RMD160ASM_x86=rmd-586.s
+
+  # Now that we have defined all the arch specific variables, use the
+  # appropriate one, and define the appropriate macros
+  IF[$RMD160ASM_{- $target{asm_arch} -}]
+    $RMD160ASM=$RMD160ASM_{- $target{asm_arch} -}
+    $RMD160DEF=RMD160_ASM
+  ENDIF
+ENDIF
+
+SOURCE[../../libcrypto]=rmd_dgst.c rmd_one.c $RMD160ASM
+DEFINE[../../libcrypto]=$RMD160DEF
 
 GENERATE[rmd-586.s]=asm/rmd-586.pl \
         $(PERLASM_SCHEME) $(LIB_CFLAGS) $(LIB_CPPFLAGS)
diff --git a/crypto/sha/build.info b/crypto/sha/build.info
index fa2ec9b..187d0c4 100644
--- a/crypto/sha/build.info
+++ b/crypto/sha/build.info
@@ -1,9 +1,83 @@
 LIBS=../../libcrypto
 
-$COMMON=sha1dgst.c sha256.c sha512.c sha3.c \
-        {- $target{sha1_asm_src} -} {- $target{keccak1600_asm_src} -}
+$SHA1ASM=
+IF[{- !$disabled{asm} -}]
+  $SHA1ASM_x86=sha1-586.s sha256-586.s sha512-586.s
+  $SHA1DEF_x86=SHA1_ASM SHA256_ASM SHA512_ASM
+  $SHA1ASM_x86_64=\
+        sha1-x86_64.s sha256-x86_64.s sha512-x86_64.s sha1-mb-x86_64.s \
+        sha256-mb-x86_64.s
+  $SHA1DEF_x86_64=SHA1_ASM SHA256_ASM SHA512_ASM
+
+  $SHA1ASM_ia64=sha1-ia64.s sha256-ia64.s sha512-ia64.s
+  $SHA1DEF_ia64=SHA1_ASM SHA256_ASM SHA512_ASM
+
+  $SHA1ASM_sparcv9=sha1-sparcv9.S sha256-sparcv9.S sha512-sparcv9.S
+  $SHA1DEF_sparcv9=SHA1_ASM SHA256_ASM SHA512_ASM
+
+  $SHA1ASM_alpha=sha1-alpha.S
+  $SHA1DEF_alpha=SHA1_ASM
+
+  $SHA1ASM_mips32=sha1-mips.S sha256-mips.S
+  $SHA1DEF_mips32=SHA1_ASM SHA256_ASM
+  $SHA1ASM_mips64=$SHA1ASM_mips32 sha512-mips.S
+  $SHA1DEF_mips64=$SHA1DEF_mips32 SHA512_ASM
+
+  $SHA1ASM_s390x=sha1-s390x.S sha256-s390x.S sha512-s390x.S
+  $SHA1DEF_s390x=SHA1_ASM SHA256_ASM SHA512_ASM
+
+  $SHA1ASM_armv4=sha1-armv4-large.S sha256-armv4.S sha512-armv4.S
+  $SHA1DEF_armv4=SHA1_ASM SHA256_ASM SHA512_ASM
+  $SHA1ASM_aarch64=sha1-armv8.S sha256-armv8.S sha512-armv8.S
+  $SHA1DEF_aarch64=SHA1_ASM SHA256_ASM SHA512_ASM
+
+  $SHA1ASM_parisc11=sha1-parisc.s sha256-parisc.s sha512-parisc.s
+  $SHA1DEF_parisc11=SHA1_ASM SHA256_ASM SHA512_ASM
+  $SHA1ASM_parisc20_64=$SHA1ASM_parisc11
+  $SHA1DEF_parisc20_64=$SHA1DEF_parisc11
+
+  $SHA1ASM_ppc32=\
+        sha1-ppc.s sha256-ppc.s sha512-ppc.s sha256p8-ppc.s sha512p8-ppc.s
+  $SHA1DEF_ppc32=SHA1_ASM SHA256_ASM SHA512_ASM
+  $SHA1ASM_ppc64=$SHA1ASM_ppc32
+  $SHA1DEF_ppc64=$SHA1DEF_ppc32
+
+  $SHA1ASM_c64xplus=sha1-c64xplus.s sha256-c64xplus.s sha512-c64xplus.s
+  $SHA1DEF_c64xplus=SHA1_ASM SHA256_ASM SHA512_ASM
+
+  # Now that we have defined all the arch specific variables, use the
+  # appropriate one, and define the appropriate macros
+  IF[$SHA1ASM_{- $target{asm_arch} -}]
+    $SHA1ASM=$SHA1ASM_{- $target{asm_arch} -}
+    $SHA1DEF=$SHA1DEF_{- $target{asm_arch} -}
+  ENDIF
+ENDIF
+
+$KECCAK1600ASM=keccak1600.c
+IF[{- !$disabled{asm} -}]
+  $KECCAK1600ASM_x86=
+  $KECCAK1600ASM_x86_64=keccak1600-x86_64.s
+
+  $KECCAK1600ASM_s390x=keccak1600-s390x.S
+
+  $KECCAK1600ASM_armv4=keccak1600-armv4.S
+  $KECCAK1600ASM_aarch64=keccak1600-armv8.S
+
+  $KECCAK1600ASM_ppc64=keccak1600-ppc64.s
+
+  # Now that we have defined all the arch specific variables, use the
+  # appropriate one, and define the appropriate macros
+  IF[$KECCAK1600ASM_{- $target{asm_arch} -}]
+    $KECCAK1600ASM=$KECCAK1600ASM_{- $target{asm_arch} -}
+    $KECCAK1600DEF=KECCAK1600_ASM
+  ENDIF
+ENDIF
+
+$COMMON=sha1dgst.c sha256.c sha512.c sha3.c $SHA1ASM $KECCAK1600ASM
 SOURCE[../../libcrypto]=$COMMON sha1_one.c
+DEFINE[../../libcrypto]=$SHA1DEF $KECCAK1600DEF
 SOURCE[../../providers/fips]= $COMMON
+DEFINE[../../providers/fips]= $SHA1DEF $KECCAK1600DEF
 
 GENERATE[sha1-586.s]=asm/sha1-586.pl \
         $(PERLASM_SCHEME) $(LIB_CFLAGS) $(LIB_CPPFLAGS) $(PROCESSOR)
diff --git a/crypto/whrlpool/build.info b/crypto/whrlpool/build.info
index 4b167b5..f67bf41 100644
--- a/crypto/whrlpool/build.info
+++ b/crypto/whrlpool/build.info
@@ -1,5 +1,24 @@
 LIBS=../../libcrypto
-SOURCE[../../libcrypto]=wp_dgst.c {- $target{wp_asm_src} -}
+
+$WPASM=wp_block.c
+IF[{- !$disabled{asm} -}]
+  IF[{- $config{processor} ne "386" -}]
+    $WPASM_x86=wp_block.c wp-mmx.s
+    $WPDEF_x86=WHIRLPOOL_ASM
+  ENDIF
+  $WPASM_x86_64=wp-x86_64.s
+  $WPDEF_x86_64=WHIRLPOOL_ASM
+
+  # Now that we have defined all the arch specific variables, use the
+  # appropriate one, and define the appropriate macros
+  IF[$WPASM_{- $target{asm_arch} -}]
+    $WPASM=$WPASM_{- $target{asm_arch} -}
+    $WPDEF=$WPDEF_{- $target{asm_arch} -}
+  ENDIF
+ENDIF
+
+SOURCE[../../libcrypto]=wp_dgst.c $WPASM
+DEFINE[../../libcrypto]=$WPDEF
 
 GENERATE[wp-mmx.s]=asm/wp-mmx.pl \
         $(PERLASM_SCHEME) $(LIB_CFLAGS) $(LIB_CPPFLAGS) $(PROCESSOR)
diff --git a/engines/build.info b/engines/build.info
index 3189f9f..77aab6d 100644
--- a/engines/build.info
+++ b/engines/build.info
@@ -1,9 +1,22 @@
 IF[{- !$disabled{"engine"} -}]
+  $PADLOCKASM=
+  IF[{- !$disabled{asm} -}]
+    $PADLOCKASM_x86=e_padlock-x86.s
+    $PADLOCKASM_x86_64=e_padlock-x86_64.s
+
+    # Now that we have defined all the arch specific variables, use the
+    # appropriate one, and define the appropriate macros
+    IF[$PADLOCKASM_{- $target{asm_arch} -}]
+      $PADLOCKASM=$PADLOCKASM_{- $target{asm_arch} -}
+      $PADLOCKDEF=PADLOCK_ASM
+    ENDIF
+  ENDIF
+
   IF[{- $disabled{"dynamic-engine"} -}]
     LIBS=../libcrypto
     IF[{- !$disabled{padlockeng} -}]
-      SOURCE[../libcrypto]=\
-              e_padlock.c {- $target{padlock_asm_src} -}
+      SOURCE[../libcrypto]=e_padlock.c $PADLOCKASM
+      DEFINE[../libcrypto]=$PADLOCKDEF
     ENDIF
     IF[{- !$disabled{capieng} -}]
       SOURCE[../libcrypto]=e_capi.c
@@ -17,7 +30,8 @@ IF[{- !$disabled{"engine"} -}]
   ELSE
     IF[{- !$disabled{padlockeng} -}]
       MODULES{engine}=padlock
-      SOURCE[padlock]=e_padlock.c {- $target{padlock_asm_src} -}
+      SOURCE[padlock]=e_padlock.c $PADLOCKASM
+      DEFINE[padlock]=$PADLOCKDEF
       DEPEND[padlock]=../libcrypto
       INCLUDE[padlock]=../include
       IF[{- defined $target{shared_defflag} -}]
diff --git a/test/build.info b/test/build.info
index 7a777d1..8c0f606 100644
--- a/test/build.info
+++ b/test/build.info
@@ -1,15 +1,20 @@
 SUBDIRS=ossl_shim
-{-
-     use File::Spec::Functions;
-     sub rebase_files
-     {
-         my ($base, $files) = @_;
-         return join(" ", map { "$base/$_" } split(/\s+/, $files));
-     }
-     our $apps_aux_src =
-         join(' ', map { "../apps/$_" } split(/\s+/, $target{apps_aux_src}));
-     ""
--}
+
+# TODO: use ../apps/libapps.a instead of direct ../apps source.
+# This can't currently be done, because some of its units drag in too many
+# unresolved references that don't apply here.  Most of all, ../apps/apps.c
+# needs to be divided in smaller pieces to be useful here.
+#
+# Auxilliary program source (copied from ../apps/build.info)
+IF[{- $config{target} =~ /^(?:VC-|mingw)/ -}]
+  # It's called 'init', but doesn't have much 'init' in it...
+  $AUXLIBAPPSSRC=../apps/win32_init.c
+ENDIF
+IF[{- $config{target} =~ /^vms-/ -}]
+  $AUXLIBAPPSSRC=../apps/vms_term_sock.c ../apps/vms_decc_argv.c
+ENDIF
+$LIBAPPSSRC=../apps/opt.c $AUXLIBAPPSSRC
+
 IF[{- !$disabled{tests} -}]
   LIBS{noinst,has_main}=libtestutil.a
   SOURCE[libtestutil.a]=testutil/basic_output.c testutil/output_helpers.c \
@@ -17,7 +22,7 @@ IF[{- !$disabled{tests} -}]
           testutil/format_output.c testutil/tap_bio.c \
           testutil/test_cleanup.c testutil/main.c testutil/init.c \
           testutil/options.c testutil/test_options.c \
-          testutil/apps_mem.c ../apps/opt.c {- $apps_aux_src; -}
+          testutil/apps_mem.c $LIBAPPSSRC
   INCLUDE[libtestutil.a]=../include ../apps/include ..
   DEPEND[libtestutil.a]=../libcrypto
 


More information about the openssl-commits mailing list