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/criov.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/criov.c')
-rw-r--r-- | sys/opencrypto/criov.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/opencrypto/criov.c b/sys/opencrypto/criov.c index 636ca9a4a4d5..0ef39eac1eb2 100644 --- a/sys/opencrypto/criov.c +++ b/sys/opencrypto/criov.c @@ -385,8 +385,8 @@ crypto_cursor_copydata_noadv(struct crypto_buffer_cursor *cc, int size, * the beginning, continuing for "len" bytes. */ static int -cuio_apply(struct uio *uio, int off, int len, int (*f)(void *, void *, u_int), - void *arg) +cuio_apply(struct uio *uio, int off, int len, + int (*f)(void *, const void *, u_int), void *arg) { struct iovec *iov = uio->uio_iov; int iol = uio->uio_iovcnt; @@ -461,13 +461,14 @@ crypto_copydata(struct cryptop *crp, int off, int size, void *dst) int crypto_apply_buf(struct crypto_buffer *cb, int off, int len, - int (*f)(void *, void *, u_int), void *arg) + int (*f)(void *, const void *, u_int), void *arg) { int error; switch (cb->cb_type) { case CRYPTO_BUF_MBUF: - error = m_apply(cb->cb_mbuf, off, len, f, arg); + error = m_apply(cb->cb_mbuf, off, len, + (int (*)(void *, void *, u_int))f, arg); break; case CRYPTO_BUF_UIO: error = cuio_apply(cb->cb_uio, off, len, f, arg); @@ -488,7 +489,7 @@ crypto_apply_buf(struct crypto_buffer *cb, int off, int len, int crypto_apply(struct cryptop *crp, int off, int len, - int (*f)(void *, void *, u_int), void *arg) + int (*f)(void *, const void *, u_int), void *arg) { return (crypto_apply_buf(&crp->crp_buf, off, len, f, arg)); } |