1*197ff4c3SKornel Duleba /*- 2*197ff4c3SKornel Duleba * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3*197ff4c3SKornel Duleba * 4*197ff4c3SKornel Duleba * Copyright (c) 2021 Stormshield. 5*197ff4c3SKornel Duleba * Copyright (c) 2021 Semihalf. 6*197ff4c3SKornel Duleba * 7*197ff4c3SKornel Duleba * Redistribution and use in source and binary forms, with or without 8*197ff4c3SKornel Duleba * modification, are permitted provided that the following conditions 9*197ff4c3SKornel Duleba * are met: 10*197ff4c3SKornel Duleba * 1. Redistributions of source code must retain the above copyright 11*197ff4c3SKornel Duleba * notice, this list of conditions and the following disclaimer. 12*197ff4c3SKornel Duleba * 2. Redistributions in binary form must reproduce the above copyright 13*197ff4c3SKornel Duleba * notice, this list of conditions and the following disclaimer in the 14*197ff4c3SKornel Duleba * documentation and/or other materials provided with the distribution. 15*197ff4c3SKornel Duleba * 16*197ff4c3SKornel Duleba * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17*197ff4c3SKornel Duleba * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18*197ff4c3SKornel Duleba * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19*197ff4c3SKornel Duleba * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20*197ff4c3SKornel Duleba * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21*197ff4c3SKornel Duleba * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22*197ff4c3SKornel Duleba * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23*197ff4c3SKornel Duleba * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24*197ff4c3SKornel Duleba * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25*197ff4c3SKornel Duleba * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26*197ff4c3SKornel Duleba */ 27*197ff4c3SKornel Duleba 28*197ff4c3SKornel Duleba #ifndef __OSSL_CIPHER_H__ 29*197ff4c3SKornel Duleba #define __OSSL_CIPHER_H__ 30*197ff4c3SKornel Duleba 31*197ff4c3SKornel Duleba struct ossl_session_cipher; 32*197ff4c3SKornel Duleba struct cryptop; 33*197ff4c3SKornel Duleba struct crypto_session_params; 34*197ff4c3SKornel Duleba 35*197ff4c3SKornel Duleba typedef int (ossl_cipher_setkey_t)(const unsigned char*, int, void*); 36*197ff4c3SKornel Duleba typedef int (ossl_cipher_process_t)(struct ossl_session_cipher*, struct cryptop*, 37*197ff4c3SKornel Duleba const struct crypto_session_params*); 38*197ff4c3SKornel Duleba typedef void (ossl_cipher_encrypt_t)(const unsigned char*, unsigned char*, size_t, 39*197ff4c3SKornel Duleba const void*, unsigned char*, int); 40*197ff4c3SKornel Duleba 41*197ff4c3SKornel Duleba ossl_cipher_encrypt_t ossl_aes_cbc_encrypt; 42*197ff4c3SKornel Duleba 43*197ff4c3SKornel Duleba struct ossl_cipher { 44*197ff4c3SKornel Duleba int type; 45*197ff4c3SKornel Duleba uint16_t blocksize; 46*197ff4c3SKornel Duleba uint16_t ivsize; 47*197ff4c3SKornel Duleba 48*197ff4c3SKornel Duleba ossl_cipher_setkey_t *set_encrypt_key; 49*197ff4c3SKornel Duleba ossl_cipher_setkey_t *set_decrypt_key; 50*197ff4c3SKornel Duleba ossl_cipher_process_t *process; 51*197ff4c3SKornel Duleba }; 52*197ff4c3SKornel Duleba 53*197ff4c3SKornel Duleba #endif 54