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