[PATCH 1/4] camellia: add bulk CBC decryption selftest
jussi.kivilinna at iki.fi
Tue May 21 15:51:37 CEST 2013
On 21.05.2013 16:13, Werner Koch wrote:
> 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"
Ok, I'll make the changes.
> The other problem is that code like
> static char error_str;
> snprintf (error_str, sizeof(error_str),
> "%s-128-CBC test failed (plaintext mismatch)", cipher);
> return error_str;
Agreed, that's not good.
> 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";
I like the idea.. avoids introducing additional overhead for the error-paths.
More information about the Gcrypt-devel