1 | /*
|
---|
2 | * Copyright 2019-2024 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 | #include "crypto/aes_platform.h"
|
---|
13 |
|
---|
14 | typedef struct prov_aes_ctx_st {
|
---|
15 | PROV_CIPHER_CTX base; /* Must be first */
|
---|
16 | union {
|
---|
17 | OSSL_UNION_ALIGN;
|
---|
18 | AES_KEY ks;
|
---|
19 | } ks;
|
---|
20 |
|
---|
21 | /* Platform specific data */
|
---|
22 | union {
|
---|
23 | int dummy;
|
---|
24 | #if defined(OPENSSL_CPUID_OBJ) && defined(__s390__)
|
---|
25 | struct {
|
---|
26 | union {
|
---|
27 | OSSL_UNION_ALIGN;
|
---|
28 | /*-
|
---|
29 | * KM-AES parameter block - begin
|
---|
30 | * (see z/Architecture Principles of Operation >= SA22-7832-06)
|
---|
31 | */
|
---|
32 | struct {
|
---|
33 | unsigned char k[32];
|
---|
34 | } km;
|
---|
35 | /* KM-AES parameter block - end */
|
---|
36 | /*-
|
---|
37 | * KMO-AES/KMF-AES parameter block - begin
|
---|
38 | * (see z/Architecture Principles of Operation >= SA22-7832-08)
|
---|
39 | */
|
---|
40 | struct {
|
---|
41 | unsigned char cv[16];
|
---|
42 | unsigned char k[32];
|
---|
43 | } kmo_kmf;
|
---|
44 | /* KMO-AES/KMF-AES parameter block - end */
|
---|
45 | } param;
|
---|
46 | unsigned int fc;
|
---|
47 | } s390x;
|
---|
48 | #endif /* defined(OPENSSL_CPUID_OBJ) && defined(__s390__) */
|
---|
49 | } plat;
|
---|
50 |
|
---|
51 | } PROV_AES_CTX;
|
---|
52 |
|
---|
53 | #define ossl_prov_cipher_hw_aes_ofb ossl_prov_cipher_hw_aes_ofb128
|
---|
54 | #define ossl_prov_cipher_hw_aes_cfb ossl_prov_cipher_hw_aes_cfb128
|
---|
55 | const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_ecb(size_t keybits);
|
---|
56 | const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_cbc(size_t keybits);
|
---|
57 | const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_ofb128(size_t keybits);
|
---|
58 | const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_cfb128(size_t keybits);
|
---|
59 | const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_cfb1(size_t keybits);
|
---|
60 | const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_cfb8(size_t keybits);
|
---|
61 | const PROV_CIPHER_HW *ossl_prov_cipher_hw_aes_ctr(size_t keybits);
|
---|