aboutsummaryrefslogtreecommitdiffstats
path: root/providers
diff options
context:
space:
mode:
authorPauli <ppzgs1@gmail.com>2024-07-11 10:50:16 +1000
committerPauli <ppzgs1@gmail.com>2024-07-17 10:43:21 +1000
commit924321a519861c3e78826c68909c2fe3481421c7 (patch)
tree9e8e7834aee032207b2e3d59ff056a60b8c7e7c2 /providers
parent2dd74d3acb9425251a2028504f07623bd97bfe87 (diff)
downloadopenssl-924321a519861c3e78826c68909c2fe3481421c7.tar.gz
Add FIPS indicator for TEST-RAND
The indicator is always non-FIPS, since this is used for internal tasks and hasn't been validated. Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com> (Merged from https://github.com/openssl/openssl/pull/24851)
Diffstat (limited to 'providers')
-rw-r--r--providers/implementations/rands/test_rng.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/providers/implementations/rands/test_rng.c b/providers/implementations/rands/test_rng.c
index 57b36469ca..72e815bebf 100644
--- a/providers/implementations/rands/test_rng.c
+++ b/providers/implementations/rands/test_rng.c
@@ -20,6 +20,7 @@
#include "prov/provider_ctx.h"
#include "prov/provider_util.h"
#include "prov/implementations.h"
+#include "prov/fipsindicator.h"
static OSSL_FUNC_rand_newctx_fn test_rng_new;
static OSSL_FUNC_rand_freectx_fn test_rng_free;
@@ -196,8 +197,14 @@ static int test_rng_get_ctx_params(void *vtest, OSSL_PARAM params[])
return 0;
p = OSSL_PARAM_locate(params, OSSL_RAND_PARAM_GENERATE);
- if (p != NULL && OSSL_PARAM_set_uint(p, t->generate))
+ if (p != NULL && !OSSL_PARAM_set_uint(p, t->generate))
return 0;
+
+#ifdef FIPS_MODULE
+ p = OSSL_PARAM_locate(params, OSSL_RAND_PARAM_FIPS_APPROVED_INDICATOR);
+ if (p != NULL && !OSSL_PARAM_set_int(p, 0))
+ return 0;
+#endif /* FIPS_MODULE */
return 1;
}
@@ -209,6 +216,7 @@ static const OSSL_PARAM *test_rng_gettable_ctx_params(ossl_unused void *vtest,
OSSL_PARAM_uint(OSSL_RAND_PARAM_STRENGTH, NULL),
OSSL_PARAM_size_t(OSSL_RAND_PARAM_MAX_REQUEST, NULL),
OSSL_PARAM_uint(OSSL_RAND_PARAM_GENERATE, NULL),
+ OSSL_FIPS_IND_GETTABLE_CTX_PARAM()
OSSL_PARAM_END
};
return known_gettable_ctx_params;