libkcapi/002-remove-ansi_cprng-test.patch
Zoltan Fridrich 8a3bf3733b Remove ansi_cprng test as new kernels don't support it
Resolves: RHEL-242707

Signed-off-by: Zoltan Fridrich <zfridric@redhat.com>
2026-08-18 12:40:17 +02:00

58 lines
1.6 KiB
Diff

diff --git a/test/kcapi-main.c b/test/kcapi-main.c
index 67fb53f..7556796 100644
--- a/test/kcapi-main.c
+++ b/test/kcapi-main.c
@@ -637,23 +637,9 @@ static int aux_test_rng(const char *name, const uint8_t *seed, uint32_t seedlen)
return 0;
}
-static int is_fips_mode(void)
-{
- char c;
- FILE *f = fopen("/proc/sys/crypto/fips_enabled", "r");
- if (!f)
- return 0;
- if (fread(&c, 1, 1, f) < 1)
- c = '0';
- fclose(f);
- return c == '1';
-}
-
static int auxiliary_tests(void)
{
struct kcapi_handle *handle = NULL;
- const char *ansi_cprng_name = is_fips_mode() ? "fips(ansi_cprng)"
- : "ansi_cprng";
int ret = 0;
if (kcapi_aead_init(&handle, "ccm(aes)", 0)) {
@@ -711,28 +697,5 @@ static int auxiliary_tests(void)
if (aux_test_rng("drbg_nopr_ctr_aes256", NULL, 0))
ret++;
- /* X9.31 RNG must require seed */
- printf("X9.31 missing seeding: ");
- if (!aux_test_rng(ansi_cprng_name, NULL, 0))
- ret++;
- /* X9.31 seed too short */
- printf("X9.31 insufficient seeding: ");
- if (!aux_test_rng(ansi_cprng_name,
- (uint8_t *)
- "\x00\x01\x02\x03\x04\x05\x06\x07\x08"
- "\x00\x01\x02\x03\x04\x05\x06\x07\x08", 16))
- ret++;
- /* X9.31 seed right sized short */
- if (aux_test_rng(ansi_cprng_name,
- (uint8_t *)
- "\x00\x01\x02\x03\x04\x05\x06\x07\x08"
- "\x00\x01\x02\x03\x04\x05\x06\x07\x08"
- "\x00\x01\x02\x03\x04\x05\x06\x07\x08"
- "\x00\x01\x02\x03\x04\x05\x06\x07\x08", 32)) {
- printf("Error for %s: kernel module ansi_cprng present?\n",
- ansi_cprng_name);
- ret++;
- }
-
return ret;
}