Skip to content

Commit

Permalink
crypto: drbg - Use str_true_false() and str_enabled_disabled() helpers
Browse files Browse the repository at this point in the history
Remove hard-coded strings by using the helper functions str_true_false()
and str_enabled_disabled().

Signed-off-by: Thorsten Blum <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
toblux authored and herbertx committed Oct 28, 2024
1 parent 5a61fd6 commit a1ba229
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions crypto/drbg.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
#include <crypto/internal/cipher.h>
#include <linux/kernel.h>
#include <linux/jiffies.h>
#include <linux/string_choices.h>

/***************************************************************
* Backend cipher definitions available to DRBG
Expand Down Expand Up @@ -1412,7 +1413,7 @@ static int drbg_generate(struct drbg_state *drbg,
if (drbg->pr || drbg->seeded == DRBG_SEED_STATE_UNSEEDED) {
pr_devel("DRBG: reseeding before generation (prediction "
"resistance: %s, state %s)\n",
drbg->pr ? "true" : "false",
str_true_false(drbg->pr),
(drbg->seeded == DRBG_SEED_STATE_FULL ?
"seeded" : "unseeded"));
/* 9.3.1 steps 7.1 through 7.3 */
Expand Down Expand Up @@ -1562,7 +1563,7 @@ static int drbg_instantiate(struct drbg_state *drbg, struct drbg_string *pers,
bool reseed = true;

pr_devel("DRBG: Initializing DRBG core %d with prediction resistance "
"%s\n", coreref, pr ? "enabled" : "disabled");
"%s\n", coreref, str_enabled_disabled(pr));
mutex_lock(&drbg->drbg_mutex);

/* 9.1 step 1 is implicit with the selected DRBG type */
Expand Down

0 comments on commit a1ba229

Please sign in to comment.