1b077aed3SPierre Pronchery /* 2*e0c4386eSCy Schubert * Copyright 2019-2024 The OpenSSL Project Authors. All Rights Reserved. 3b077aed3SPierre Pronchery * 4b077aed3SPierre Pronchery * Licensed under the Apache License 2.0 (the "License"). You may not use 5b077aed3SPierre Pronchery * this file except in compliance with the License. You can obtain a copy 6b077aed3SPierre Pronchery * in the file LICENSE in the source distribution or at 7b077aed3SPierre Pronchery * https://www.openssl.org/source/license.html 8b077aed3SPierre Pronchery */ 9b077aed3SPierre Pronchery 10b077aed3SPierre Pronchery #include <openssl/aes.h> 11b077aed3SPierre Pronchery #include "prov/ciphercommon.h" 12b077aed3SPierre Pronchery #include "crypto/aes_platform.h" 13b077aed3SPierre Pronchery 14b077aed3SPierre Pronchery typedef struct prov_aes_ctx_st { 15b077aed3SPierre Pronchery PROV_CIPHER_CTX base; /* Must be first */ 16b077aed3SPierre Pronchery union { 17b077aed3SPierre Pronchery OSSL_UNION_ALIGN; 18b077aed3SPierre Pronchery AES_KEY ks; 19b077aed3SPierre Pronchery } ks; 20b077aed3SPierre Pronchery 21b077aed3SPierre Pronchery /* Platform specific data */ 22b077aed3SPierre Pronchery union { 23b077aed3SPierre Pronchery int dummy; 24b077aed3SPierre Pronchery #if defined(OPENSSL_CPUID_OBJ) && defined(__s390__) 25b077aed3SPierre Pronchery struct { 26b077aed3SPierre Pronchery union { 27b077aed3SPierre Pronchery OSSL_UNION_ALIGN; 28b077aed3SPierre Pronchery /*- 29b077aed3SPierre Pronchery * KM-AES parameter block - begin 30b077aed3SPierre Pronchery * (see z/Architecture Principles of Operation >= SA22-7832-06) 31b077aed3SPierre Pronchery */ 32b077aed3SPierre Pronchery struct { 33b077aed3SPierre Pronchery unsigned char k[32]; 34b077aed3SPierre Pronchery } km; 35b077aed3SPierre Pronchery /* KM-AES parameter block - end */ 36b077aed3SPierre Pronchery /*- 37b077aed3SPierre Pronchery * KMO-AES/KMF-AES parameter block - begin 38b077aed3SPierre Pronchery * (see z/Architecture Principles of Operation >= SA22-7832-08) 39b077aed3SPierre Pronchery */ 40b077aed3SPierre Pronchery struct { 41b077aed3SPierre Pronchery unsigned char cv[16]; 42b077aed3SPierre Pronchery unsigned char k[32]; 43b077aed3SPierre Pronchery } kmo_kmf; 44b077aed3SPierre Pronchery /* KMO-AES/KMF-AES parameter block - end */ 45b077aed3SPierre Pronchery } param; 46b077aed3SPierre Pronchery unsigned int fc; 47b077aed3SPierre Pronchery } s390x; 48b077aed3SPierre Pronchery #endif /* defined(OPENSSL_CPUID_OBJ) && defined(__s390__) */ 49b077aed3SPierre Pronchery } plat; 50b077aed3SPierre Pronchery 51b077aed3SPierre Pronchery } PROV_AES_CTX; 52b077aed3SPierre Pronchery 53b077aed3SPierre Pronchery #define ossl_prov_cipher_hw_aes_ofb ossl_prov_cipher_hw_aes_ofb128 54b077aed3SPierre Pronchery #define ossl_prov_cipher_hw_aes_cfb ossl_prov_cipher_hw_aes_cfb128 55b077aed3SPierre Pronchery const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_ecb(size_t keybits); 56b077aed3SPierre Pronchery const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_cbc(size_t keybits); 57b077aed3SPierre Pronchery const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_ofb128(size_t keybits); 58b077aed3SPierre Pronchery const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_cfb128(size_t keybits); 59b077aed3SPierre Pronchery const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_cfb1(size_t keybits); 60b077aed3SPierre Pronchery const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_cfb8(size_t keybits); 61b077aed3SPierre Pronchery const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_ctr(size_t keybits); 62