Changeset View
Changeset View
Standalone View
Standalone View
sys/opencrypto/crypto.c
Show First 20 Lines • Show All 1,283 Lines • ▼ Show 20 Lines | if (crp->crp_obuf.cb_type != CRYPTO_BUF_NONE) { | ||||
out = &crp->crp_obuf; | out = &crp->crp_obuf; | ||||
olen = crypto_buffer_len(out); | olen = crypto_buffer_len(out); | ||||
} | } | ||||
} else | } else | ||||
KASSERT(crp->crp_obuf.cb_type == CRYPTO_BUF_NONE, | KASSERT(crp->crp_obuf.cb_type == CRYPTO_BUF_NONE, | ||||
("incoming crp with separate output buffer " | ("incoming crp with separate output buffer " | ||||
"but no session support")); | "but no session support")); | ||||
if (CRYPTO_HAS_OUTPUT_BUFFER(crp)) { | |||||
if (crp->crp_obuf.cb_type == CRYPTO_BUF_MBUF || | |||||
crp->crp_obuf.cb_type == CRYPTO_BUF_SINGLE_MBUF) { | |||||
MPASS(M_WRITABLE(crp->crp_obuf.cb_mbuf)); | |||||
markj: IMHO it would be nice to use KASSERT() here, for consistency with the rest of the function. | |||||
} | |||||
} else { | |||||
if (crp->crp_buf.cb_type == CRYPTO_BUF_MBUF || | |||||
crp->crp_buf.cb_type == CRYPTO_BUF_SINGLE_MBUF) { | |||||
MPASS(M_WRITABLE(crp->crp_buf.cb_mbuf)); | |||||
} | |||||
} | |||||
switch (csp->csp_mode) { | switch (csp->csp_mode) { | ||||
case CSP_MODE_COMPRESS: | case CSP_MODE_COMPRESS: | ||||
KASSERT(crp->crp_op == CRYPTO_OP_COMPRESS || | KASSERT(crp->crp_op == CRYPTO_OP_COMPRESS || | ||||
crp->crp_op == CRYPTO_OP_DECOMPRESS, | crp->crp_op == CRYPTO_OP_DECOMPRESS, | ||||
("invalid compression op %x", crp->crp_op)); | ("invalid compression op %x", crp->crp_op)); | ||||
break; | break; | ||||
case CSP_MODE_CIPHER: | case CSP_MODE_CIPHER: | ||||
KASSERT(crp->crp_op == CRYPTO_OP_ENCRYPT || | KASSERT(crp->crp_op == CRYPTO_OP_ENCRYPT || | ||||
▲ Show 20 Lines • Show All 715 Lines • Show Last 20 Lines |
IMHO it would be nice to use KASSERT() here, for consistency with the rest of the function.