| 280 | } |
| 281 | |
| 282 | static void |
| 283 | ccp_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 | |
| 310 | static bool |
| 311 | ccp_auth_supported(struct ccp_softc *sc, |
no test coverage detected