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

Function swcr_authprepare

freebsd/opencrypto/cryptosoft.c:286–311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284}
285
286static void
287swcr_authprepare(struct auth_hash *axf, struct swcr_auth *sw,
288 const uint8_t *key, int klen)
289{
290
291 switch (axf->type) {
292 case CRYPTO_SHA1_HMAC:
293 case CRYPTO_SHA2_224_HMAC:
294 case CRYPTO_SHA2_256_HMAC:
295 case CRYPTO_SHA2_384_HMAC:
296 case CRYPTO_SHA2_512_HMAC:
297 case CRYPTO_NULL_HMAC:
298 case CRYPTO_RIPEMD160_HMAC:
299 hmac_init_ipad(axf, key, klen, sw->sw_ictx);
300 hmac_init_opad(axf, key, klen, sw->sw_octx);
301 break;
302 case CRYPTO_POLY1305:
303 case CRYPTO_BLAKE2B:
304 case CRYPTO_BLAKE2S:
305 axf->Setkey(sw->sw_ictx, key, klen);
306 axf->Init(sw->sw_ictx);
307 break;
308 default:
309 panic("%s: algorithm %d doesn't use keys", __func__, axf->type);
310 }
311}
312
313/*
314 * Compute or verify hash.

Callers 2

swcr_authcomputeFunction · 0.85
swcr_setup_authFunction · 0.85

Calls 4

hmac_init_ipadFunction · 0.85
hmac_init_opadFunction · 0.85
InitMethod · 0.80
panicFunction · 0.50

Tested by

no test coverage detected