1e1051a39Sopenharmony_ci/*
2e1051a39Sopenharmony_ci * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
3e1051a39Sopenharmony_ci *
4e1051a39Sopenharmony_ci * Licensed under the Apache License 2.0 (the "License").  You may not use
5e1051a39Sopenharmony_ci * this file except in compliance with the License.  You can obtain a copy
6e1051a39Sopenharmony_ci * in the file LICENSE in the source distribution or at
7e1051a39Sopenharmony_ci * https://www.openssl.org/source/license.html
8e1051a39Sopenharmony_ci */
9e1051a39Sopenharmony_ci
10e1051a39Sopenharmony_ci#include <openssl/aes.h>
11e1051a39Sopenharmony_ci#include "prov/ciphercommon.h"
12e1051a39Sopenharmony_ci#include "prov/ciphercommon_gcm.h"
13e1051a39Sopenharmony_ci#include "crypto/aes_platform.h"
14e1051a39Sopenharmony_ci
15e1051a39Sopenharmony_citypedef struct prov_aes_gcm_ctx_st {
16e1051a39Sopenharmony_ci    PROV_GCM_CTX base;          /* must be first entry in struct */
17e1051a39Sopenharmony_ci    union {
18e1051a39Sopenharmony_ci        OSSL_UNION_ALIGN;
19e1051a39Sopenharmony_ci        AES_KEY ks;
20e1051a39Sopenharmony_ci    } ks;                       /* AES key schedule to use */
21e1051a39Sopenharmony_ci
22e1051a39Sopenharmony_ci    /* Platform specific data */
23e1051a39Sopenharmony_ci    union {
24e1051a39Sopenharmony_ci        int dummy;
25e1051a39Sopenharmony_ci#if defined(OPENSSL_CPUID_OBJ) && defined(__s390__)
26e1051a39Sopenharmony_ci        struct {
27e1051a39Sopenharmony_ci            union {
28e1051a39Sopenharmony_ci                OSSL_UNION_ALIGN;
29e1051a39Sopenharmony_ci                S390X_KMA_PARAMS kma;
30e1051a39Sopenharmony_ci            } param;
31e1051a39Sopenharmony_ci            unsigned int fc;
32e1051a39Sopenharmony_ci            unsigned int hsflag;    /* hash subkey set flag */
33e1051a39Sopenharmony_ci            unsigned char ares[16];
34e1051a39Sopenharmony_ci            unsigned char mres[16];
35e1051a39Sopenharmony_ci            unsigned char kres[16];
36e1051a39Sopenharmony_ci            int areslen;
37e1051a39Sopenharmony_ci            int mreslen;
38e1051a39Sopenharmony_ci            int kreslen;
39e1051a39Sopenharmony_ci            int res;
40e1051a39Sopenharmony_ci        } s390x;
41e1051a39Sopenharmony_ci#endif /* defined(OPENSSL_CPUID_OBJ) && defined(__s390__) */
42e1051a39Sopenharmony_ci    } plat;
43e1051a39Sopenharmony_ci} PROV_AES_GCM_CTX;
44e1051a39Sopenharmony_ci
45e1051a39Sopenharmony_ciconst PROV_GCM_HW *ossl_prov_aes_hw_gcm(size_t keybits);
46