/*1* Copyright (c) 2020 Netflix, Inc2*3* Redistribution and use in source and binary forms, with or without4* modification, are permitted provided that the following conditions5* are met:6* 1. Redistributions of source code must retain the above copyright7* notice, this list of conditions and the following disclaimer,8* without modification.9* 2. Redistributions in binary form must reproduce at minimum a disclaimer10* similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any11* redistribution must be conditioned upon including a substantially12* similar Disclaimer requirement for further binary redistribution.13*14* NO WARRANTY15* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS16* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT17* LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY18* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL19* THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,20* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF21* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS22* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER23* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)24* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF25* THE POSSIBILITY OF SUCH DAMAGES.26*/2728#ifndef __OSSL_H__29#define __OSSL_H__3031/* Compatibility shims. */32#define OPENSSL_cleanse explicit_bzero3334struct cryptop;35struct crypto_session_params;36struct ossl_softc;37struct ossl_session;3839int ossl_chacha20_poly1305_decrypt(struct cryptop *crp,40const struct crypto_session_params *csp);41int ossl_chacha20_poly1305_encrypt(struct cryptop *crp,42const struct crypto_session_params *csp);43void ossl_cpuid(struct ossl_softc *sc);4445struct ossl_softc {46int32_t sc_cid;47bool has_aes;48bool has_aes_gcm;49};5051/* Needs to be big enough to hold any hash context. */52struct ossl_hash_context {53uint32_t dummy[196];54} __aligned(32);5556struct ossl_cipher_context {57uint32_t dummy[196];58} __aligned(32);5960struct ossl_session_hash {61struct ossl_hash_context ictx;62struct ossl_hash_context octx;63struct auth_hash *axf;64u_int mlen;65};6667struct ossl_session_cipher {68struct ossl_cipher_context dec_ctx;69struct ossl_cipher_context enc_ctx;70struct ossl_cipher *cipher;71};7273struct ossl_session {74struct ossl_session_cipher cipher;75struct ossl_session_hash hash;76};7778extern struct auth_hash ossl_hash_poly1305;79extern struct auth_hash ossl_hash_sha1;80extern struct auth_hash ossl_hash_sha224;81extern struct auth_hash ossl_hash_sha256;82extern struct auth_hash ossl_hash_sha384;83extern struct auth_hash ossl_hash_sha512;8485extern struct ossl_cipher ossl_cipher_aes_cbc;86extern struct ossl_cipher ossl_cipher_aes_gcm;87extern struct ossl_cipher ossl_cipher_chacha20;8889#endif /* !__OSSL_H__ */909192