1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00
samba-mirror/lib/crypto/wscript_build
Jeremy Allison 53ac0f7c59 lib: crypto: Plumb in the Intel AES instructions.
Causes:

AES_set_encrypt_key()
AES_set_decrypt_key()
AES_encrypt()
AES_decrypt()

to probe for the Intel AES instructions at runtime (only once)
and then call the hardware implementations if so, otherwise
fall back to the software implementations.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13008

Based on original work by Justin Maggard <jmaggard@netgear.com>

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2017-09-07 02:01:08 +02:00

38 lines
1.1 KiB
Python

#!/usr/bin/env python
extra_source = ''
extra_deps = ''
if bld.CONFIG_SET('HAVE_BSD_MD5_H'):
extra_deps += ' bsd'
elif bld.CONFIG_SET('HAVE_SYS_MD5_H') and bld.CONFIG_SET('HAVE_LIBMD5'):
extra_deps += ' md5'
elif bld.CONFIG_SET('HAVE_SYS_MD5_H') and bld.CONFIG_SET('HAVE_LIBMD'):
extra_deps += ' md'
elif not bld.CONFIG_SET('HAVE_SYS_MD5_H') and not bld.CONFIG_SET('HAVE_COMMONCRYPTO_COMMONDIGEST_H'):
extra_source += ' md5.c'
if bld.CONFIG_SET("HAVE_AESNI_INTEL"):
extra_deps += ' aesni-intel'
bld.SAMBA_SUBSYSTEM('LIBCRYPTO',
source='''crc32.c hmacmd5.c md4.c arcfour.c sha256.c sha512.c hmacsha256.c
aes.c rijndael-alg-fst.c aes_cmac_128.c aes_ccm_128.c aes_gcm_128.c
''' + extra_source,
deps='talloc' + extra_deps
)
bld.SAMBA_SUBSYSTEM('TORTURE_LIBCRYPTO',
source='''md4test.c md5test.c hmacmd5test.c
aes_cmac_128_test.c aes_ccm_128_test.c aes_gcm_128_test.c
''',
autoproto='test_proto.h',
deps='LIBCRYPTO'
)
for env in bld.gen_python_environments():
bld.SAMBA_PYTHON('python_crypto',
source='py_crypto.c',
deps='LIBCRYPTO',
realname='samba/crypto.so'
)