Skip to content

Commit de3e485

Browse files
jallisonciqbmastbergen
authored andcommitted
Restore CRYPTO_TFM_FIPS_COMPLIANCE flag as an indicator to differentiate between internal and external IV generation when AES-GCM
encryption is performed. Required by lab. Signed-off-by: Jeremy Allison <jallison@ciq.com>
1 parent 556794c commit de3e485

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

crypto/seqiv.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,19 @@ static int seqiv_aead_decrypt(struct aead_request *req)
123123
return crypto_aead_decrypt(subreq);
124124
}
125125

126+
static int aead_init_seqiv(struct crypto_aead *aead)
127+
{
128+
int err;
129+
130+
err = aead_init_geniv(aead);
131+
if (err)
132+
return err;
133+
134+
crypto_aead_set_flags(aead, CRYPTO_TFM_FIPS_COMPLIANCE);
135+
136+
return 0;
137+
}
138+
126139
static int seqiv_aead_create(struct crypto_template *tmpl, struct rtattr **tb)
127140
{
128141
struct aead_instance *inst;
@@ -140,7 +153,7 @@ static int seqiv_aead_create(struct crypto_template *tmpl, struct rtattr **tb)
140153
inst->alg.encrypt = seqiv_aead_encrypt;
141154
inst->alg.decrypt = seqiv_aead_decrypt;
142155

143-
inst->alg.init = aead_init_geniv;
156+
inst->alg.init = aead_init_seqiv;
144157
inst->alg.exit = aead_exit_geniv;
145158

146159
inst->alg.base.cra_ctxsize = sizeof(struct aead_geniv_ctx);

include/linux/crypto.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,8 @@
153153
#define CRYPTO_TFM_REQ_ON_STACK 0x00000800
154154
#define CRYPTO_TFM_REQ_NEED_RESEED 0x00001000
155155

156+
#define CRYPTO_TFM_FIPS_COMPLIANCE 0x80000000
157+
156158
/*
157159
* Miscellaneous stuff.
158160
*/

0 commit comments

Comments
 (0)