1*b077aed3SPierre Pronchery /* 2*b077aed3SPierre Pronchery * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved. 3*b077aed3SPierre Pronchery * 4*b077aed3SPierre Pronchery * Licensed under the Apache License 2.0 (the "License"). You may not use 5*b077aed3SPierre Pronchery * this file except in compliance with the License. You can obtain a copy 6*b077aed3SPierre Pronchery * in the file LICENSE in the source distribution or at 7*b077aed3SPierre Pronchery * https://www.openssl.org/source/license.html 8*b077aed3SPierre Pronchery */ 9*b077aed3SPierre Pronchery 10*b077aed3SPierre Pronchery #include <openssl/aes.h> 11*b077aed3SPierre Pronchery #include "prov/ciphercommon.h" 12*b077aed3SPierre Pronchery #include "crypto/aes_platform.h" 13*b077aed3SPierre Pronchery 14*b077aed3SPierre Pronchery /* 15*b077aed3SPierre Pronchery * Available in cipher_fips.c, and compiled with different values depending 16*b077aed3SPierre Pronchery * on we're in the FIPS module or not. 17*b077aed3SPierre Pronchery */ 18*b077aed3SPierre Pronchery extern const int ossl_aes_xts_allow_insecure_decrypt; 19*b077aed3SPierre Pronchery 20*b077aed3SPierre Pronchery PROV_CIPHER_FUNC(void, xts_stream, 21*b077aed3SPierre Pronchery (const unsigned char *in, unsigned char *out, size_t len, 22*b077aed3SPierre Pronchery const AES_KEY *key1, const AES_KEY *key2, 23*b077aed3SPierre Pronchery const unsigned char iv[16])); 24*b077aed3SPierre Pronchery 25*b077aed3SPierre Pronchery typedef struct prov_aes_xts_ctx_st { 26*b077aed3SPierre Pronchery PROV_CIPHER_CTX base; /* Must be first */ 27*b077aed3SPierre Pronchery union { 28*b077aed3SPierre Pronchery OSSL_UNION_ALIGN; 29*b077aed3SPierre Pronchery AES_KEY ks; 30*b077aed3SPierre Pronchery } ks1, ks2; /* AES key schedules to use */ 31*b077aed3SPierre Pronchery XTS128_CONTEXT xts; 32*b077aed3SPierre Pronchery OSSL_xts_stream_fn stream; 33*b077aed3SPierre Pronchery } PROV_AES_XTS_CTX; 34*b077aed3SPierre Pronchery 35*b077aed3SPierre Pronchery const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_xts(size_t keybits); 36