From f6519378b46e1a3401d938a2f916f8c97032fdd4 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Wed, 9 Jul 2014 20:24:04 -0700 Subject: [PATCH] + --enable-minimal to build a smaller library without less-used functions. --- configure.ac | 15 +++++++++ src/libsodium/Makefile.am | 68 +++++++++++++++++++++------------------ test/default/Makefile.am | 8 +++-- 3 files changed, 57 insertions(+), 34 deletions(-) diff --git a/configure.ac b/configure.ac index 9888fc17..053d05b4 100644 --- a/configure.ac +++ b/configure.ac @@ -86,6 +86,21 @@ AC_ARG_ENABLE(blocking-random, ]) ]) +AC_ARG_ENABLE(minimal, +[AS_HELP_STRING(--enable-minimal, + [Do not compile salsa208, salsa2012, edwards25519sha512batch and aes256estream])], +[ + AS_IF([test "x$enableval" = "xyes"], [ + enable_minimal="yes" + ], [ + enable_minimal="no" + ]) +], +[ + enable_minimal="no" +]) +AM_CONDITIONAL([MINIMAL], [test x$enable_minimal = xyes]) + AC_ARG_WITH(safecode, [AS_HELP_STRING(--with-safecode,For maintainers only - please do not use)], [AS_IF([test "x$withval" = "xyes"], [ diff --git a/src/libsodium/Makefile.am b/src/libsodium/Makefile.am index f2cae237..fd2c4f25 100644 --- a/src/libsodium/Makefile.am +++ b/src/libsodium/Makefile.am @@ -30,12 +30,6 @@ libsodium_la_SOURCES = \ crypto_core/salsa20/ref/core_salsa20.c \ crypto_core/salsa20/core_salsa20_api.c \ crypto_core/salsa20/ref/api.h \ - crypto_core/salsa2012/ref/core_salsa2012.c \ - crypto_core/salsa2012/core_salsa2012_api.c \ - crypto_core/salsa2012/ref/api.h \ - crypto_core/salsa208/ref/core_salsa208.c \ - crypto_core/salsa208/core_salsa208_api.c \ - crypto_core/salsa208/ref/api.h \ crypto_generichash/crypto_generichash.c \ crypto_generichash/blake2/generichash_blake2_api.c \ crypto_generichash/blake2/ref/api.h \ @@ -136,15 +130,6 @@ libsodium_la_SOURCES = \ crypto_sign/ed25519/ref10/sc_reduce.c \ crypto_sign/ed25519/ref10/sign.c \ crypto_sign/ed25519/ref10/sqrtm1.h \ - crypto_sign/edwards25519sha512batch/sign_edwards25519sha512batch_api.c \ - crypto_sign/edwards25519sha512batch/ref/api.h \ - crypto_sign/edwards25519sha512batch/ref/fe25519.h \ - crypto_sign/edwards25519sha512batch/ref/fe25519_edwards25519sha512batch.c \ - crypto_sign/edwards25519sha512batch/ref/ge25519.h \ - crypto_sign/edwards25519sha512batch/ref/ge25519_edwards25519sha512batch.c \ - crypto_sign/edwards25519sha512batch/ref/sc25519.h \ - crypto_sign/edwards25519sha512batch/ref/sc25519_edwards25519sha512batch.c \ - crypto_sign/edwards25519sha512batch/ref/sign_edwards25519sha512batch.c \ crypto_stream/crypto_stream.c \ crypto_stream/aes128ctr/portable/afternm_aes128ctr.c \ crypto_stream/aes128ctr/stream_aes128ctr_api.c \ @@ -159,26 +144,10 @@ libsodium_la_SOURCES = \ crypto_stream/aes128ctr/portable/stream_aes128ctr.c \ crypto_stream/aes128ctr/portable/types.h \ crypto_stream/aes128ctr/portable/xor_afternm_aes128ctr.c \ - crypto_stream/aes256estream/hongjun/aes-table.h \ - crypto_stream/aes256estream/hongjun/aes-table-be.h \ - crypto_stream/aes256estream/hongjun/aes-table-le.h \ - crypto_stream/aes256estream/hongjun/aes256-ctr.c \ - crypto_stream/aes256estream/hongjun/aes256.h \ - crypto_stream/aes256estream/stream_aes256estream_api.c \ - crypto_stream/aes256estream/hongjun/api.h \ - crypto_stream/aes256estream/hongjun/ecrypt-sync.h \ crypto_stream/chacha20/stream_chacha20_api.c \ crypto_stream/chacha20/ref/api.h \ crypto_stream/chacha20/ref/stream_chacha20_ref.c \ crypto_stream/salsa20/stream_salsa20_api.c \ - crypto_stream/salsa2012/stream_salsa2012_api.c \ - crypto_stream/salsa2012/ref/api.h \ - crypto_stream/salsa2012/ref/stream_salsa2012.c \ - crypto_stream/salsa2012/ref/xor_salsa2012.c \ - crypto_stream/salsa208/stream_salsa208_api.c \ - crypto_stream/salsa208/ref/api.h \ - crypto_stream/salsa208/ref/stream_salsa208.c \ - crypto_stream/salsa208/ref/xor_salsa208.c \ crypto_stream/xsalsa20/stream_xsalsa20_api.c \ crypto_stream/xsalsa20/ref/api.h \ crypto_stream/xsalsa20/ref/stream_xsalsa20.c \ @@ -195,7 +164,6 @@ libsodium_la_SOURCES = \ randombytes/randombytes.c \ randombytes/salsa20/randombytes_salsa20_random.c \ randombytes/sysrandom/randombytes_sysrandom.c \ - sodium/compat.c \ sodium/core.c \ sodium/runtime.c \ sodium/utils.c \ @@ -239,6 +207,42 @@ libsodium_la_SOURCES += \ crypto_stream/salsa20/ref/xor_salsa20_ref.c endif +if !MINIMAL +libsodium_la_SOURCES += \ + crypto_core/salsa2012/ref/core_salsa2012.c \ + crypto_core/salsa2012/core_salsa2012_api.c \ + crypto_core/salsa2012/ref/api.h \ + crypto_core/salsa208/ref/core_salsa208.c \ + crypto_core/salsa208/core_salsa208_api.c \ + crypto_core/salsa208/ref/api.h \ + crypto_sign/edwards25519sha512batch/sign_edwards25519sha512batch_api.c \ + crypto_sign/edwards25519sha512batch/ref/api.h \ + crypto_sign/edwards25519sha512batch/ref/fe25519.h \ + crypto_sign/edwards25519sha512batch/ref/fe25519_edwards25519sha512batch.c \ + crypto_sign/edwards25519sha512batch/ref/ge25519.h \ + crypto_sign/edwards25519sha512batch/ref/ge25519_edwards25519sha512batch.c \ + crypto_sign/edwards25519sha512batch/ref/sc25519.h \ + crypto_sign/edwards25519sha512batch/ref/sc25519_edwards25519sha512batch.c \ + crypto_sign/edwards25519sha512batch/ref/sign_edwards25519sha512batch.c \ + crypto_stream/aes256estream/hongjun/aes-table.h \ + crypto_stream/aes256estream/hongjun/aes-table-be.h \ + crypto_stream/aes256estream/hongjun/aes-table-le.h \ + crypto_stream/aes256estream/hongjun/aes256-ctr.c \ + crypto_stream/aes256estream/hongjun/aes256.h \ + crypto_stream/aes256estream/stream_aes256estream_api.c \ + crypto_stream/aes256estream/hongjun/api.h \ + crypto_stream/aes256estream/hongjun/ecrypt-sync.h \ + crypto_stream/salsa2012/stream_salsa2012_api.c \ + crypto_stream/salsa2012/ref/api.h \ + crypto_stream/salsa2012/ref/stream_salsa2012.c \ + crypto_stream/salsa2012/ref/xor_salsa2012.c \ + crypto_stream/salsa208/stream_salsa208_api.c \ + crypto_stream/salsa208/ref/api.h \ + crypto_stream/salsa208/ref/stream_salsa208.c \ + crypto_stream/salsa208/ref/xor_salsa208.c \ + sodium/compat.c +endif + libsodium_la_LDFLAGS = \ $(AM_LDFLAGS) \ -export-dynamic \ diff --git a/test/default/Makefile.am b/test/default/Makefile.am index ee1eb43c..8ad3c1fc 100644 --- a/test/default/Makefile.am +++ b/test/default/Makefile.am @@ -173,10 +173,14 @@ TESTS_TARGETS = \ stream2 \ stream3 \ stream4 \ - stream5 \ - stream6 \ verify1 +if !MINIMAL +TESTS_TARGETS += \ + stream5 \ + stream6 +endif + check_PROGRAMS = $(TESTS_TARGETS) TESTS = $(TESTS_TARGETS)