Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions crypto/dh.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,35 @@ static int dh_compute_value(struct kpp_request *req)

/* SP800-56A rev 3 5.6.2.1.3 key check */
} else {
MPI val_pct;

if (dh_is_pubkey_valid(ctx, val)) {
ret = -EAGAIN;
goto err_free_val;
}

/*
* SP800-56Arev3, 5.6.2.1.4: ("Owner Assurance
* of Pair-wise Consistency"): recompute the
* public key and check if the results match.
*/
val_pct = mpi_alloc(0);
if (!val_pct) {
ret = -ENOMEM;
goto err_free_val;
}

ret = _compute_val(ctx, base, val_pct);
if (ret) {
mpi_free(val_pct);
goto err_free_val;
}

if (mpi_cmp(val, val_pct) != 0) {
fips_fail_notify();
panic("dh: pair-wise consistency test failed\n");
}
mpi_free(val_pct);
}
}

Expand Down
15 changes: 14 additions & 1 deletion crypto/seqiv.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,19 @@ static int seqiv_aead_decrypt(struct aead_request *req)
return crypto_aead_decrypt(subreq);
}

static int aead_init_seqiv(struct crypto_aead *aead)
{
int err;

err = aead_init_geniv(aead);
if (err)
return err;

crypto_aead_set_flags(aead, CRYPTO_TFM_FIPS_COMPLIANCE);

return 0;
}

static int seqiv_aead_create(struct crypto_template *tmpl, struct rtattr **tb)
{
struct aead_instance *inst;
Expand All @@ -149,7 +162,7 @@ static int seqiv_aead_create(struct crypto_template *tmpl, struct rtattr **tb)
inst->alg.encrypt = seqiv_aead_encrypt;
inst->alg.decrypt = seqiv_aead_decrypt;

inst->alg.init = aead_init_geniv;
inst->alg.init = aead_init_seqiv;
inst->alg.exit = aead_exit_geniv;

inst->alg.base.cra_ctxsize = sizeof(struct aead_geniv_ctx);
Expand Down
2 changes: 2 additions & 0 deletions include/linux/crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@
#define CRYPTO_TFM_REQ_MAY_BACKLOG 0x00000400
#define CRYPTO_TFM_REQ_NEED_RESEED 0x00000800

#define CRYPTO_TFM_FIPS_COMPLIANCE 0x80000000

/*
* Miscellaneous stuff.
*/
Expand Down