also check for cipher descriptors

This commit is contained in:
Steffen Jaeckel 2017-05-12 16:48:44 +02:00
parent 1c4c84e7f9
commit 0a23c6d32e
3 changed files with 26 additions and 12 deletions

View File

@ -81,7 +81,7 @@ sub check_defines {
return $fails; return $fails;
} }
sub check_hashes { sub check_descriptors {
my @src; my @src;
my @descriptors; my @descriptors;
find({ wanted => sub { push @src, $_ if $_ =~ /\.c$/ }, no_chdir=>1 }, './src/hashes/'); find({ wanted => sub { push @src, $_ if $_ =~ /\.c$/ }, no_chdir=>1 }, './src/hashes/');
@ -89,6 +89,11 @@ sub check_hashes {
my @n = map { my $x = $_; $x =~ s/^.*?ltc_hash_descriptor\s+(\S+).*$/$1/; $x } grep { $_ =~ /ltc_hash_descriptor/ } split /\n/, read_file($f); my @n = map { my $x = $_; $x =~ s/^.*?ltc_hash_descriptor\s+(\S+).*$/$1/; $x } grep { $_ =~ /ltc_hash_descriptor/ } split /\n/, read_file($f);
push @descriptors, @n if @n; push @descriptors, @n if @n;
} }
find({ wanted => sub { push @src, $_ if $_ =~ /\.c$/ }, no_chdir=>1 }, './src/ciphers/');
for my $f (@src) {
my @n = map { my $x = $_; $x =~ s/^.*?ltc_cipher_descriptor\s+(\S+).*$/$1/; $x } grep { $_ =~ /ltc_cipher_descriptor/ } split /\n/, read_file($f);
push @descriptors, @n if @n;
}
my $fails = 0; my $fails = 0;
for my $d (@descriptors) { for my $d (@descriptors) {
for my $f (qw{ testprof/common.c }) { for my $f (qw{ testprof/common.c }) {
@ -291,14 +296,14 @@ sub die_usage {
MARKER MARKER
} }
GetOptions( "s|check-source" => \my $check_source, GetOptions( "s|check-source" => \my $check_source,
"d|check-defines" => \my $check_defines, "c|check-descriptors" => \my $check_descriptors,
"h|check-hashes" => \my $check_hashes, "d|check-defines" => \my $check_defines,
"m|check-makefiles" => \my $check_makefiles, "m|check-makefiles" => \my $check_makefiles,
"a|check-all" => \my $check_all, "a|check-all" => \my $check_all,
"u|update-makefiles" => \my $update_makefiles, "u|update-makefiles" => \my $update_makefiles,
"f|fixupind=s" => \my $fixupind, "f|fixupind=s" => \my $fixupind,
"h|help" => \my $help "h|help" => \my $help
) or die_usage; ) or die_usage;
if ($fixupind) { if ($fixupind) {
@ -311,7 +316,7 @@ if ($fixupind) {
my $failure; my $failure;
$failure ||= check_source() if $check_all || $check_source; $failure ||= check_source() if $check_all || $check_source;
$failure ||= check_defines() if $check_all || $check_defines; $failure ||= check_defines() if $check_all || $check_defines;
$failure ||= check_hashes() if $check_all || $check_hashes; $failure ||= check_descriptors() if $check_all || $check_descriptors;
$failure ||= process_makefiles(0) if $check_all || $check_makefiles; $failure ||= process_makefiles(0) if $check_all || $check_makefiles;
$failure ||= process_makefiles(1) if $update_makefiles; $failure ||= process_makefiles(1) if $update_makefiles;

View File

@ -35,8 +35,7 @@
#define __LTC_SAFER_TAB_C__ #define __LTC_SAFER_TAB_C__
#include "safer_tab.c" #include "safer_tab.c"
const struct ltc_cipher_descriptor const struct ltc_cipher_descriptor safer_k64_desc = {
safer_k64_desc = {
"safer-k64", "safer-k64",
8, 8, 8, 8, LTC_SAFER_K64_DEFAULT_NOF_ROUNDS, 8, 8, 8, 8, LTC_SAFER_K64_DEFAULT_NOF_ROUNDS,
&safer_k64_setup, &safer_k64_setup,

View File

@ -250,8 +250,18 @@ void register_algs(void)
atexit(_unregister_all); atexit(_unregister_all);
#ifdef LTC_RIJNDAEL #ifdef LTC_RIJNDAEL
#ifdef ENCRYPT_ONLY
/* alternative would be
* register_cipher (&rijndael_enc_desc);
*/
register_cipher (&aes_enc_desc);
#else
/* alternative would be
* register_cipher (&rijndael_desc);
*/
register_cipher (&aes_desc); register_cipher (&aes_desc);
#endif #endif
#endif
#ifdef LTC_BLOWFISH #ifdef LTC_BLOWFISH
register_cipher (&blowfish_desc); register_cipher (&blowfish_desc);
#endif #endif