| 389 | } |
| 390 | |
| 391 | static int |
| 392 | cse_create(struct fcrypt *fcr, struct session2_op *sop) |
| 393 | { |
| 394 | struct crypto_session_params csp; |
| 395 | struct csession *cse; |
| 396 | struct enc_xform *txform; |
| 397 | struct auth_hash *thash; |
| 398 | void *key = NULL; |
| 399 | void *mackey = NULL; |
| 400 | crypto_session_t cses; |
| 401 | int crid, error; |
| 402 | |
| 403 | switch (sop->cipher) { |
| 404 | case 0: |
| 405 | txform = NULL; |
| 406 | break; |
| 407 | case CRYPTO_AES_CBC: |
| 408 | txform = &enc_xform_rijndael128; |
| 409 | break; |
| 410 | case CRYPTO_AES_XTS: |
| 411 | txform = &enc_xform_aes_xts; |
| 412 | break; |
| 413 | case CRYPTO_NULL_CBC: |
| 414 | txform = &enc_xform_null; |
| 415 | break; |
| 416 | case CRYPTO_CAMELLIA_CBC: |
| 417 | txform = &enc_xform_camellia; |
| 418 | break; |
| 419 | case CRYPTO_AES_ICM: |
| 420 | txform = &enc_xform_aes_icm; |
| 421 | break; |
| 422 | case CRYPTO_AES_NIST_GCM_16: |
| 423 | txform = &enc_xform_aes_nist_gcm; |
| 424 | break; |
| 425 | case CRYPTO_CHACHA20: |
| 426 | txform = &enc_xform_chacha20; |
| 427 | break; |
| 428 | case CRYPTO_AES_CCM_16: |
| 429 | txform = &enc_xform_ccm; |
| 430 | break; |
| 431 | default: |
| 432 | CRYPTDEB("invalid cipher"); |
| 433 | SDT_PROBE1(opencrypto, dev, ioctl, error, __LINE__); |
| 434 | return (EINVAL); |
| 435 | } |
| 436 | |
| 437 | switch (sop->mac) { |
| 438 | case 0: |
| 439 | thash = NULL; |
| 440 | break; |
| 441 | case CRYPTO_POLY1305: |
| 442 | thash = &auth_hash_poly1305; |
| 443 | break; |
| 444 | case CRYPTO_SHA1_HMAC: |
| 445 | thash = &auth_hash_hmac_sha1; |
| 446 | break; |
| 447 | case CRYPTO_SHA2_224_HMAC: |
| 448 | thash = &auth_hash_hmac_sha2_224; |
no test coverage detected