fix return value of register_all_*()
This commit is contained in:
parent
d470f8a7ab
commit
152513477b
@ -16,13 +16,11 @@
|
||||
*/
|
||||
|
||||
#define REGISTER_CIPHER(h) do {\
|
||||
LTC_ARGCHK((err = register_cipher(h)) != -1); \
|
||||
LTC_ARGCHK(register_cipher(h) != -1); \
|
||||
} while(0)
|
||||
|
||||
int register_all_ciphers(void)
|
||||
{
|
||||
int err = CRYPT_NOP;
|
||||
|
||||
#ifdef LTC_RIJNDAEL
|
||||
#ifdef ENCRYPT_ONLY
|
||||
/* alternative would be
|
||||
@ -100,7 +98,7 @@ int register_all_ciphers(void)
|
||||
#ifdef LTC_SERPENT
|
||||
REGISTER_CIPHER(&serpent_desc);
|
||||
#endif
|
||||
return err;
|
||||
return CRYPT_OK;
|
||||
}
|
||||
|
||||
/* ref: $Format:%D$ */
|
||||
|
@ -16,12 +16,11 @@
|
||||
*/
|
||||
|
||||
#define REGISTER_HASH(h) do {\
|
||||
LTC_ARGCHK((err = register_hash(h)) != -1); \
|
||||
LTC_ARGCHK(register_hash(h) != -1); \
|
||||
} while(0)
|
||||
|
||||
int register_all_hashes(void)
|
||||
{
|
||||
int err = CRYPT_NOP;
|
||||
#ifdef LTC_TIGER
|
||||
REGISTER_HASH(&tiger_desc);
|
||||
#endif
|
||||
@ -90,9 +89,9 @@ int register_all_hashes(void)
|
||||
#endif
|
||||
#ifdef LTC_CHC_HASH
|
||||
REGISTER_HASH(&chc_desc);
|
||||
LTC_ARGCHK((err = chc_register(find_cipher_any("aes", 8, 16))) == CRYPT_OK);
|
||||
LTC_ARGCHK(chc_register(find_cipher_any("aes", 8, 16)) == CRYPT_OK);
|
||||
#endif
|
||||
return err;
|
||||
return CRYPT_OK;
|
||||
}
|
||||
|
||||
/* ref: $Format:%D$ */
|
||||
|
@ -16,12 +16,11 @@
|
||||
*/
|
||||
|
||||
#define REGISTER_PRNG(h) do {\
|
||||
LTC_ARGCHK((err = register_prng(h)) != -1); \
|
||||
LTC_ARGCHK(register_prng(h) != -1); \
|
||||
} while(0)
|
||||
|
||||
int register_all_prngs(void)
|
||||
{
|
||||
int err = CRYPT_NOP;
|
||||
#ifdef LTC_YARROW
|
||||
REGISTER_PRNG(&yarrow_desc);
|
||||
#endif
|
||||
@ -41,7 +40,7 @@ int register_all_prngs(void)
|
||||
REGISTER_PRNG(&sprng_desc);
|
||||
#endif
|
||||
|
||||
return err;
|
||||
return CRYPT_OK;
|
||||
}
|
||||
|
||||
/* ref: $Format:%D$ */
|
||||
|
15
tests/test.c
15
tests/test.c
@ -281,9 +281,18 @@ static void register_algs(void)
|
||||
#ifndef LTC_YARROW
|
||||
#error This demo requires Yarrow.
|
||||
#endif
|
||||
register_all_ciphers();
|
||||
register_all_hashes();
|
||||
register_all_prngs();
|
||||
if ((err = register_all_ciphers()) != CRYPT_OK) {
|
||||
fprintf(stderr, "register_all_ciphers err=%s\n", error_to_string(err));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if ((err = register_all_hashes()) != CRYPT_OK) {
|
||||
fprintf(stderr, "register_all_hashes err=%s\n", error_to_string(err));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if ((err = register_all_prngs()) != CRYPT_OK) {
|
||||
fprintf(stderr, "register_all_prngs err=%s\n", error_to_string(err));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if ((err = rng_make_prng(128, find_prng("yarrow"), &yarrow_prng, NULL)) != CRYPT_OK) {
|
||||
fprintf(stderr, "rng_make_prng failed: %s\n", error_to_string(err));
|
||||
|
Loading…
Reference in New Issue
Block a user