MCPcopy Create free account
hub / github.com/F-Stack/f-stack / cb_sanity

Function cb_sanity

freebsd/opencrypto/crypto.c:1234–1258  ·  view source on GitHub ↗

Various sanity checks on crypto requests. */

Source from the content-addressed store, hash-verified

1232#ifdef INVARIANTS
1233/* Various sanity checks on crypto requests. */
1234static void
1235cb_sanity(struct crypto_buffer *cb, const char *name)
1236{
1237 KASSERT(cb->cb_type > CRYPTO_BUF_NONE && cb->cb_type <= CRYPTO_BUF_LAST,
1238 ("incoming crp with invalid %s buffer type", name));
1239 switch (cb->cb_type) {
1240 case CRYPTO_BUF_CONTIG:
1241 KASSERT(cb->cb_buf_len >= 0,
1242 ("incoming crp with -ve %s buffer length", name));
1243 break;
1244 case CRYPTO_BUF_VMPAGE:
1245 KASSERT(CRYPTO_HAS_VMPAGE,
1246 ("incoming crp uses dmap on supported arch"));
1247 KASSERT(cb->cb_vm_page_len >= 0,
1248 ("incoming crp with -ve %s buffer length", name));
1249 KASSERT(cb->cb_vm_page_offset >= 0,
1250 ("incoming crp with -ve %s buffer offset", name));
1251 KASSERT(cb->cb_vm_page_offset < PAGE_SIZE,
1252 ("incoming crp with %s buffer offset greater than page size"
1253 , name));
1254 break;
1255 default:
1256 break;
1257 }
1258}
1259
1260static void
1261crp_sanity(struct cryptop *crp)

Callers 1

crp_sanityFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected