fixed wrong return value interpretation of register_crypt/hash/prng function calls
This commit is contained in:
parent
2b0ce25778
commit
8859f6e73d
@ -19,7 +19,6 @@
|
|||||||
/* format is ltc_mp, cipher_desc, [cipher_desc], NULL, hash_desc, [hash_desc], NULL, prng_desc, [prng_desc], NULL */
|
/* format is ltc_mp, cipher_desc, [cipher_desc], NULL, hash_desc, [hash_desc], NULL, prng_desc, [prng_desc], NULL */
|
||||||
int crypt_fsa(void *mp, ...)
|
int crypt_fsa(void *mp, ...)
|
||||||
{
|
{
|
||||||
int err;
|
|
||||||
va_list args;
|
va_list args;
|
||||||
void *p;
|
void *p;
|
||||||
|
|
||||||
@ -29,23 +28,23 @@ int crypt_fsa(void *mp, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
while ((p = va_arg(args, void*)) != NULL) {
|
while ((p = va_arg(args, void*)) != NULL) {
|
||||||
if ((err = register_cipher(p)) != CRYPT_OK) {
|
if (register_cipher(p) == -1) {
|
||||||
va_end(args);
|
va_end(args);
|
||||||
return err;
|
return CRYPT_INVALID_CIPHER;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((p = va_arg(args, void*)) != NULL) {
|
while ((p = va_arg(args, void*)) != NULL) {
|
||||||
if ((err = register_hash(p)) != CRYPT_OK) {
|
if (register_hash(p) == -1) {
|
||||||
va_end(args);
|
va_end(args);
|
||||||
return err;
|
return CRYPT_INVALID_HASH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((p = va_arg(args, void*)) != NULL) {
|
while ((p = va_arg(args, void*)) != NULL) {
|
||||||
if ((err = register_prng(p)) != CRYPT_OK) {
|
if (register_prng(p) == -1) {
|
||||||
va_end(args);
|
va_end(args);
|
||||||
return err;
|
return CRYPT_INVALID_PRNG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user