git: 69e533c3ffcf - main - swcr_encdec: Rename blks to blksz.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 11 Jan 2022 22:38:12 UTC
The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=69e533c3ffcf272da76e6192bff0ecc10fa182ff commit 69e533c3ffcf272da76e6192bff0ecc10fa182ff Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2022-01-11 22:20:10 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2022-01-11 22:20:10 +0000 swcr_encdec: Rename blks to blksz. This better reflects the variables purpose and matches other functions in this file. Requested by: markj Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33755 --- sys/opencrypto/cryptosoft.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c index 78fa786f0f72..864873944fd4 100644 --- a/sys/opencrypto/cryptosoft.c +++ b/sys/opencrypto/cryptosoft.c @@ -106,7 +106,7 @@ swcr_encdec(const struct swcr_session *ses, struct cryptop *crp) const struct swcr_encdec *sw; void *ctx; size_t inlen, outlen, todo; - int blks, resid; + int blksz, resid; struct crypto_buffer_cursor cc_in, cc_out; const unsigned char *inblk; unsigned char *outblk; @@ -124,9 +124,9 @@ swcr_encdec(const struct swcr_session *ses, struct cryptop *crp) if ((crp->crp_payload_length % exf->blocksize) != 0) return (EINVAL); - blks = exf->blocksize; + blksz = exf->blocksize; } else - blks = exf->native_blocksize; + blksz = exf->native_blocksize; if (exf == &enc_xform_aes_icm && (crp->crp_flags & CRYPTO_F_IV_SEPARATE) == 0) @@ -162,23 +162,23 @@ swcr_encdec(const struct swcr_session *ses, struct cryptop *crp) * 'outlen' is the remaining length of current segment in the * output buffer. */ - for (resid = crp->crp_payload_length; resid >= blks; resid -= todo) { + for (resid = crp->crp_payload_length; resid >= blksz; resid -= todo) { /* * If the current block is not contained within the * current input/output segment, use 'blk' as a local * buffer. */ - if (inlen < blks) { - crypto_cursor_copydata(&cc_in, blks, blk); + if (inlen < blksz) { + crypto_cursor_copydata(&cc_in, blksz, blk); inblk = blk; - inlen = blks; + inlen = blksz; } - if (outlen < blks) { + if (outlen < blksz) { outblk = blk; - outlen = blks; + outlen = blksz; } - todo = rounddown2(MIN(resid, MIN(inlen, outlen)), blks); + todo = rounddown2(MIN(resid, MIN(inlen, outlen)), blksz); if (encrypting) exf->encrypt_multi(ctx, inblk, outblk, todo); @@ -196,7 +196,7 @@ swcr_encdec(const struct swcr_session *ses, struct cryptop *crp) } if (outblk == blk) { - crypto_cursor_copyback(&cc_out, blks, blk); + crypto_cursor_copyback(&cc_out, blksz, blk); outblk = crypto_cursor_segment(&cc_out, &outlen); } else { crypto_cursor_advance(&cc_out, todo); @@ -213,7 +213,7 @@ swcr_encdec(const struct swcr_session *ses, struct cryptop *crp) KASSERT(exf->native_blocksize != 0, ("%s: partial block of %d bytes for cipher %s", __func__, resid, exf->name)); - KASSERT(resid < blks, ("%s: partial block too big", __func__)); + KASSERT(resid < blksz, ("%s: partial block too big", __func__)); inblk = crypto_cursor_segment(&cc_in, &inlen); outblk = crypto_cursor_segment(&cc_out, &outlen);