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

Function ccp_aes_setkey

freebsd/crypto/ccp/ccp.c:282–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

280}
281
282static void
283ccp_aes_setkey(struct ccp_session *s, int alg, const void *key, int klen)
284{
285 unsigned kbits;
286
287 if (alg == CRYPTO_AES_XTS)
288 kbits = (klen / 2) * 8;
289 else
290 kbits = klen * 8;
291
292 switch (kbits) {
293 case 128:
294 s->blkcipher.cipher_type = CCP_AES_TYPE_128;
295 break;
296 case 192:
297 s->blkcipher.cipher_type = CCP_AES_TYPE_192;
298 break;
299 case 256:
300 s->blkcipher.cipher_type = CCP_AES_TYPE_256;
301 break;
302 default:
303 panic("should not get here");
304 }
305
306 s->blkcipher.key_len = klen;
307 memcpy(s->blkcipher.enckey, key, s->blkcipher.key_len);
308}
309
310static bool
311ccp_auth_supported(struct ccp_softc *sc,

Callers 2

ccp_newsessionFunction · 0.85
ccp_processFunction · 0.85

Calls 2

panicFunction · 0.50
memcpyFunction · 0.50

Tested by

no test coverage detected