• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * \file gcm.h
3  *
4  * \brief This file contains GCM definitions and functions.
5  *
6  * The Galois/Counter Mode (GCM) for 128-bit block ciphers is defined
7  * in <em>D. McGrew, J. Viega, The Galois/Counter Mode of Operation
8  * (GCM), Natl. Inst. Stand. Technol.</em>
9  *
10  * For more information on GCM, see <em>NIST SP 800-38D: Recommendation for
11  * Block Cipher Modes of Operation: Galois/Counter Mode (GCM) and GMAC</em>.
12  *
13  */
14 /*
15  *  Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved
16  *  SPDX-License-Identifier: Apache-2.0
17  *
18  *  Licensed under the Apache License, Version 2.0 (the "License"); you may
19  *  not use this file except in compliance with the License.
20  *  You may obtain a copy of the License at
21  *
22  *  http://www.apache.org/licenses/LICENSE-2.0
23  *
24  *  Unless required by applicable law or agreed to in writing, software
25  *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
26  *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
27  *  See the License for the specific language governing permissions and
28  *  limitations under the License.
29  *
30  *  This file is part of Mbed TLS (https://tls.mbed.org)
31  */
32 
33 #ifndef MBEDTLS_GCM_ALT_H
34 #define MBEDTLS_GCM_ALT_H
35 
36 #if defined(MBEDTLS_GCM_ALT)
37 
38 /**
39  * \brief          The GCM context structure.
40  */
41 typedef struct mbedtls_gcm_context
42 {
43     mbedtls_cipher_context_t cipher_ctx;  /*!< The cipher context used. */
44     uint64_t HL[16];                      /*!< Precalculated HTable low. */
45     uint64_t HH[16];                      /*!< Precalculated HTable high. */
46     uint64_t len;                         /*!< The total length of the encrypted data. */
47     uint64_t add_len;                     /*!< The total length of the additional data. */
48     unsigned char base_ectr[16];          /*!< The first ECTR for tag. */
49     unsigned char y[16];                  /*!< The Y working value. */
50     unsigned char buf[16];                /*!< The buf working value. */
51     int mode;                             /*!< The operation to perform:
52                                                #MBEDTLS_GCM_ENCRYPT or
53                                                #MBEDTLS_GCM_DECRYPT. */
54 }
55 mbedtls_gcm_context;
56 
57 #endif /* !MBEDTLS_GCM_ALT */
58 
59 #endif /* gcm_alt.h */
60