[PATCH 1/4] camellia: add bulk CBC decryption selftest
Werner Koch
wk at gnupg.org
Tue May 21 15:13:03 CEST 2013
On Sun, 5 May 2013 16:36, jussi.kivilinna at iki.fi said:
> * cipher/camellia-glue.c: (selftest_cbc_128): New selftest function for
> bulk CBC decryption.
I general I am fine with factoring the selftest code out to a separate
module. However there are two problems:
The minor one is that selftest_help.c has an underscore in the name,
which should be replaced by a dash. For easier grepping the source tree
I also suggest to use a different name; for example "cipher-selftest.c"
The other problem is that code like
static char error_str[128];
[...]
snprintf (error_str, sizeof(error_str),
"%s-128-CBC test failed (plaintext mismatch)", cipher);
[...]
return error_str;
is not thread-safe and should not be done this way. To avoid the
overhead of adding static memory management code, what about this:
#ifdef HAVE_SYSLOG
syslog (LOG_USER|LOG_WARNING, "Libgcrypt warning: "
"%s-128-CBC test failed (plaintext mismatch)", cipher)
#endif /*HAVE_SYSLOG*/
return "selftest for 128 bit CBC failed - see syslog for details";
Shalom-Salam,
Werner
--
Die Gedanken sind frei. Ausnahmen regelt ein Bundesgesetz.
More information about the Gcrypt-devel
mailing list