]> git.proxmox.com Git - ceph.git/blame - ceph/src/crypto/isa-l/isa-l_crypto/aes/gcm_pre.c
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / crypto / isa-l / isa-l_crypto / aes / gcm_pre.c
CommitLineData
7c673cae
FG
1/**********************************************************************
2 Copyright(c) 2011-2016 Intel Corporation All rights reserved.
3
4 Redistribution and use in source and binary forms, with or without
1e59de90 5 modification, are permitted provided that the following conditions
7c673cae
FG
6 are met:
7 * Redistributions of source code must retain the above copyright
8 notice, this list of conditions and the following disclaimer.
9 * Redistributions in binary form must reproduce the above copyright
10 notice, this list of conditions and the following disclaimer in
11 the documentation and/or other materials provided with the
12 distribution.
13 * Neither the name of Intel Corporation nor the names of its
14 contributors may be used to endorse or promote products derived
15 from this software without specific prior written permission.
16
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28**********************************************************************/
29
30#include <aes_gcm.h>
31#include <aes_keyexp.h>
32
1e59de90
TL
33void aes_keyexp_128_enc(const void *, uint8_t *);
34void aes_gcm_precomp_128(struct gcm_key_data *key_data);
35void aes_gcm_precomp_256(struct gcm_key_data *key_data);
7c673cae 36
1e59de90 37void aes_gcm_pre_128(const void *key, struct gcm_key_data *key_data)
7c673cae 38{
1e59de90
TL
39 aes_keyexp_128_enc(key, key_data->expanded_keys);
40 aes_gcm_precomp_128(key_data);
7c673cae
FG
41}
42
1e59de90 43void aes_gcm_pre_256(const void *key, struct gcm_key_data *key_data)
7c673cae 44{
1e59de90
TL
45 uint8_t tmp_exp_key[GCM_ENC_KEY_LEN * GCM_KEY_SETS];
46 aes_keyexp_256((const uint8_t *)key, (uint8_t *) key_data->expanded_keys, tmp_exp_key);
47 aes_gcm_precomp_256(key_data);
7c673cae
FG
48}
49
50struct slver {
51 uint16_t snum;
52 uint8_t ver;
53 uint8_t core;
54};
55
56// Version info
1e59de90
TL
57struct slver aes_gcm_pre_128_slver_000002c7;
58struct slver aes_gcm_pre_128_slver = { 0x02c7, 0x00, 0x00 };
7c673cae 59
1e59de90
TL
60struct slver aes_gcm_pre_256_slver_000002d7;
61struct slver aes_gcm_pre_256_slver = { 0x02d7, 0x00, 0x00 };