PRNG self-test @return CRYPT_OK if successful, CRYPT_NOP if self-testing has been disabled */
| 319 | @return CRYPT_OK if successful, CRYPT_NOP if self-testing has been disabled |
| 320 | */ |
| 321 | int yarrow_test(void) |
| 322 | { |
| 323 | #ifndef LTC_TEST |
| 324 | return CRYPT_NOP; |
| 325 | #else |
| 326 | int err; |
| 327 | prng_state prng; |
| 328 | |
| 329 | if ((err = yarrow_start(&prng)) != CRYPT_OK) { |
| 330 | return err; |
| 331 | } |
| 332 | |
| 333 | /* now let's test the hash/cipher that was chosen */ |
| 334 | if (cipher_descriptor[prng.yarrow.cipher].test && |
| 335 | ((err = cipher_descriptor[prng.yarrow.cipher].test()) != CRYPT_OK)) { |
| 336 | return err; |
| 337 | } |
| 338 | if (hash_descriptor[prng.yarrow.hash].test && |
| 339 | ((err = hash_descriptor[prng.yarrow.hash].test()) != CRYPT_OK)) { |
| 340 | return err; |
| 341 | } |
| 342 | |
| 343 | return CRYPT_OK; |
| 344 | #endif |
| 345 | } |
| 346 | |
| 347 | #endif |
| 348 |
nothing calls this directly
no test coverage detected