xref: /freebsd/crypto/openssl/providers/implementations/ciphers/cipher_aes_gcm.h (revision 02e9120893770924227138ba49df1edb3896112a)
1 /*
2  * Copyright 2019-2021 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 "prov/ciphercommon_gcm.h"
13 #include "crypto/aes_platform.h"
14 
15 typedef struct prov_aes_gcm_ctx_st {
16     PROV_GCM_CTX base;          /* must be first entry in struct */
17     union {
18         OSSL_UNION_ALIGN;
19         AES_KEY ks;
20     } ks;                       /* AES key schedule to use */
21 
22     /* Platform specific data */
23     union {
24         int dummy;
25 #if defined(OPENSSL_CPUID_OBJ) && defined(__s390__)
26         struct {
27             union {
28                 OSSL_UNION_ALIGN;
29                 S390X_KMA_PARAMS kma;
30             } param;
31             unsigned int fc;
32             unsigned int hsflag;    /* hash subkey set flag */
33             unsigned char ares[16];
34             unsigned char mres[16];
35             unsigned char kres[16];
36             int areslen;
37             int mreslen;
38             int kreslen;
39             int res;
40         } s390x;
41 #endif /* defined(OPENSSL_CPUID_OBJ) && defined(__s390__) */
42     } plat;
43 } PROV_AES_GCM_CTX;
44 
45 const PROV_GCM_HW *ossl_prov_aes_hw_gcm(size_t keybits);
46