diff options
author | Zack Weinberg <zackw@panix.com> | 2018-07-04 21:42:36 -0400 |
---|---|---|
committer | Zack Weinberg <zackw@panix.com> | 2018-07-04 22:17:51 -0400 |
commit | ed4be6afa7b34fe0d827cc3f7f9608de0d9325cd (patch) | |
tree | 23fb4ca2da70f3f8fda79bb7968f34ba4e9125ae /test-crypt-des.c | |
parent | 1a51a81abc609c1a48edb2f4c0887e892e9e968f (diff) | |
download | libxcrypt-ed4be6afa7b34fe0d827cc3f7f9608de0d9325cd.tar.gz libxcrypt-ed4be6afa7b34fe0d827cc3f7f9608de0d9325cd.tar.bz2 libxcrypt-ed4be6afa7b34fe0d827cc3f7f9608de0d9325cd.zip |
Make it possible to disable individual hashes at configure time.
The table of supported hash algorithms now lives in hashes.lst.
The configure script accepts an option --enable-hashes which takes a
comma-separated list of hash algorithms to include. We generate a
header that defines INCLUDE_ macros for each hash that is enabled,
and all of the code is conditionalized appropriately.
The default is --enable-hashes=all. --enable-hashes=strong is the
equivalent of the old --disable-weak-hashes. You could even do
--enable-hashes=bcrypt,des to get a binary-compatible libcrypt.so.1
that still supports almost nothing other than bcrypt.
Diffstat (limited to 'test-crypt-des.c')
-rw-r--r-- | test-crypt-des.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/test-crypt-des.c b/test-crypt-des.c index e541885..1b5463e 100644 --- a/test-crypt-des.c +++ b/test-crypt-des.c @@ -3,6 +3,8 @@ #include <stdio.h> +#if INCLUDE_des || INCLUDE_des_xbsd || INCLUDE_des_big + static const struct { const char *salt; @@ -10,6 +12,7 @@ static const struct const char *input; } tests[] = { +#if INCLUDE_des /* traditional-DES test vectors from John the Ripper */ { "CC", "CCNf8Sbh3HDfQ", "U*U*U*U*" }, { "CC", "CCNf8Sbh3HDfQ", "U*U*U*U*ignored" }, @@ -19,8 +22,9 @@ static const struct { "CC", "CC4rMpbg9AMZ.", "\xd5\xaa\xd5\xaa\xaa\xaa\xd5\xaa" }, { "XX", "XXxzOu6maQKqQ", "*U*U*U*U" }, { "SD", "SDbsugeBiC58A", "" }, +#endif -#if ENABLE_WEAK_NON_GLIBC_HASHES +#if INCLUDE_des_xbsd /* BSDI-extended-DES, ditto */ { "_J9..CCCC", "_J9..CCCCXBrJUJV154M", "U*U*U*U*" }, { "_J9..CCCC", "_J9..CCCCXUhOBTXzaiE", "U*U***U" }, @@ -38,7 +42,9 @@ static const struct { "_J9..SDiz", "_J9..SDizxmRI1GjnQuE", "zxyDPWgydbQjgq" }, { "_K9..Salt", "_K9..SaltNrQgIYUAeoY", "726 even" }, { "_J9..SDSD", "_J9..SDSD5YGyRCr4W4c", "" }, +#endif +#if INCLUDE_des_big /* 10 bigcrypt test vectors from pw-fake-unix.gz from the openwall wiki. All have two blocks. The salt is padded with dots because crypt_r will only use bigcrypt if the setting string begins with @@ -100,3 +106,13 @@ main (void) return result; } + +#else + +int +main (void) +{ + return 77; /* UNSUPPORTED */ +} + +#endif |