randombit / botan

Cryptography Toolkit
https://botan.randombit.net
BSD 2-Clause "Simplified" License
2.6k stars 570 forks source link

Feature request: add an option to automatically include the appropriate hardware support given the requested modules #2923

Open oviano opened 2 years ago

oviano commented 2 years ago

At the moment, I only want: tls, system_rng, bcrypt.

I am achieving this using --minimized and --enable-modules=tls,system_rng,bcrypt

I do something like this (1)

./configure.py --minimized --enable-modules=tls,system_rng,bcrypt --amalgamation --os=macos --cpu=x86_64 --cc=clang --cc-min-version=13.0 --cc-abi-flags="-arch x86_64" --disable-shared

However, this does not include any hardware accelerated modules, even when the os, cpu, compiler version etc are specified and it would be nice if it did or there was an option to tell it to do so.

At the moment, my workaround is to simply request all hardware accelerated modules like this (2)

./configure.py --minimized --enable-modules=tls,system_rng,bcrypt,aes_armv8,aes_ni,aes_power8,aes_vperm,chacha_avx2,ghash_cpu,ghash_vperm,idea_sse2,processor_rng,,rdrand_rng,rdseed,serpent_avx2,sha1_armv8,sha1_sse2,sha1_x86,sha2_32_armv8,sha2_32_bmi2,sha2_32_x86,sha2_64_bmi2,sha3_bmi2,shacal2_avx2,shacal2_x86,simd,simd_avx2,sm4_armv8,threefish_512_avx2 --amalgamation --os=macos --cpu=x86_64 --cc=clang --cc-min-version=13.0 --cc-abi-flags="-arch x86_64" --disable-shared

I do similarly for other platforms/architectures, and it skips the modules not relevant for the platform, so I can just repeat the list of hardware-specific modules rather than have to manually figure out which ones apply to which target.

I'd like to be able to specify a command line like (1) and have it include the relevant modules so I don't need to list them and be concerned about any that are removed/added/renamed etc (for example, I just tested 3.0 alpha and had to remove rdrand_rng from the list above).

If necessary this could be optional, --enable-hardware-modules or something.

If I've missed a way of already achieving this, then please advise!

randombit commented 2 years ago

There currently isn't a mechanism for this but it would be useful to have.