diff options
author | John Baldwin <jhb@FreeBSD.org> | 2020-06-10 21:18:19 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2020-06-10 21:18:19 +0000 |
commit | 9b6b2f8608e24fc824404e2b47e2cecc669b189b (patch) | |
tree | 446581e71c4631f97bb44d4c5e0e64e115ba1d14 /sys/opencrypto/cryptosoft.c | |
parent | f14f00511365d3ba794389a1a5382f02ed669c47 (diff) | |
download | src-9b6b2f8608e24fc824404e2b47e2cecc669b189b.tar.gz src-9b6b2f8608e24fc824404e2b47e2cecc669b189b.zip |
Adjust crypto_apply function callbacks for OCF.
- crypto_apply() is only used for reading a buffer to compute a
digest, so change the data pointer to a const pointer.
- To better match m_apply(), change the data pointer type to void *
and the length from uint16_t to u_int. The length field in
particular matters as none of the apply logic was splitting requests
larger than UINT16_MAX.
- Adjust the auth_xform Update callback to match the function
prototype passed to crypto_apply() and crypto_apply_buf(). This
removes the needs for casts when using the Update callback.
- Change the Reinit and Setkey callbacks to also use a u_int length
instead of uint16_t.
- Update auth transforms for the changes. While here, use C99
initializers for auth_hash structures and avoid casts on callbacks.
Reviewed by: cem
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D25171
Notes
Notes:
svn path=/head/; revision=362028
Diffstat (limited to 'sys/opencrypto/cryptosoft.c')
-rw-r--r-- | sys/opencrypto/cryptosoft.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c index b29161b130ac..8cdabfa7c37f 100644 --- a/sys/opencrypto/cryptosoft.c +++ b/sys/opencrypto/cryptosoft.c @@ -336,7 +336,7 @@ swcr_authcompute(struct swcr_session *ses, struct cryptop *crp) bcopy(sw->sw_ictx, &ctx, axf->ctxsize); err = crypto_apply(crp, crp->crp_aad_start, crp->crp_aad_length, - (int (*)(void *, void *, unsigned int))axf->Update, &ctx); + axf->Update, &ctx); if (err) return err; @@ -344,11 +344,10 @@ swcr_authcompute(struct swcr_session *ses, struct cryptop *crp) CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) err = crypto_apply_buf(&crp->crp_obuf, crp->crp_payload_output_start, crp->crp_payload_length, - (int (*)(void *, void *, unsigned int))axf->Update, &ctx); + axf->Update, &ctx); else err = crypto_apply(crp, crp->crp_payload_start, - crp->crp_payload_length, - (int (*)(void *, void *, unsigned int))axf->Update, &ctx); + crp->crp_payload_length, axf->Update, &ctx); if (err) return err; |