Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src-draft/trunk]: src/sys/dev/pci/qat qat(4): Simplify iv generation logic w...
details: https://anonhg.NetBSD.org/src-all/rev/37ab55ad6474
branches: trunk
changeset: 934599:37ab55ad6474
user: Taylor R Campbell <riastradh%NetBSD.org@localhost>
date: Sun Jun 14 21:17:37 2020 +0000
description:
qat(4): Simplify iv generation logic with cprng_fast.
XXX Compile-tested only.
diffstat:
sys/dev/pci/qat/qat.c | 13 +------------
1 files changed, 1 insertions(+), 12 deletions(-)
diffs (29 lines):
diff -r d5614d7171f0 -r 37ab55ad6474 sys/dev/pci/qat/qat.c
--- a/sys/dev/pci/qat/qat.c Sun Jun 14 19:41:37 2020 +0000
+++ b/sys/dev/pci/qat/qat.c Sun Jun 14 21:17:37 2020 +0000
@@ -1577,24 +1577,13 @@
qat_crypto_load_iv(struct qat_sym_cookie *qsc, struct cryptop *crp,
struct cryptodesc *crde, struct qat_crypto_desc const *desc)
{
- uint32_t rand;
uint32_t ivlen = desc->qcd_cipher_blk_sz;
- int i;
if (crde->crd_flags & CRD_F_IV_EXPLICIT) {
memcpy(qsc->qsc_iv_buf, crde->crd_iv, ivlen);
} else {
if (crde->crd_flags & CRD_F_ENCRYPT) {
- for (i = 0; i + sizeof(rand) <= ivlen;
- i += sizeof(rand)) {
- rand = cprng_fast32();
- memcpy(qsc->qsc_iv_buf + i, &rand, sizeof(rand));
- }
- if (sizeof(qsc->qsc_iv_buf) % sizeof(rand) != 0) {
- rand = cprng_fast32();
- memcpy(qsc->qsc_iv_buf + i, &rand,
- sizeof(qsc->qsc_iv_buf) - i);
- }
+ cprng_fast(qsc->qsc_iv_buf, ivlen);
} else if (crp->crp_flags & CRYPTO_F_IMBUF) {
/* get iv from buf */
m_copydata(qsc->qsc_buf, crde->crd_inject, ivlen,
Home |
Main Index |
Thread Index |
Old Index