Index: sys/crypto/openssl/ossl.c =================================================================== --- sys/crypto/openssl/ossl.c +++ sys/crypto/openssl/ossl.c @@ -192,6 +192,12 @@ return (EINVAL); } break; + case CSP_MODE_ETA: + if ((!sc->has_aes && csp->csp_cipher_alg != CRYPTO_CHACHA20) || + ossl_lookup_hash(csp) == NULL || + ossl_lookup_cipher(csp) == NULL) + return (EINVAL); + break; case CSP_MODE_AEAD: switch (csp->csp_cipher_alg) { case CRYPTO_CHACHA20_POLY1305: @@ -292,6 +298,10 @@ return (EINVAL); error = ossl_newsession_cipher(s, csp); break; + case CSP_MODE_ETA: + ossl_newsession_hash(s, csp); + error = ossl_newsession_cipher(s, csp); + break; } return (error); @@ -475,6 +485,25 @@ return (0); } +static int +ossl_process_eta(struct ossl_session *s, struct cryptop *crp, + const struct crypto_session_params *csp) +{ + int error; + + if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) { + error = ossl_process_cipher(s, crp, csp); + if (error == 0) + error = ossl_process_hash(s, crp, csp); + } else { + error = ossl_process_hash(s, crp, csp); + if (error == 0) + error = ossl_process_cipher(s, crp, csp); + } + + return (error); +} + static int ossl_process(device_t dev, struct cryptop *crp, int hint) { @@ -500,6 +529,9 @@ case CSP_MODE_CIPHER: error = ossl_process_cipher(s, crp, csp); break; + case CSP_MODE_ETA: + error = ossl_process_eta(s, crp, csp); + break; case CSP_MODE_AEAD: if (CRYPTO_OP_IS_ENCRYPT(crp->crp_op)) error = ossl_chacha20_poly1305_encrypt(crp, csp);