1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*
3  * Copyright (c) 2017-2020, Linaro Limited
4  */
5 
6 #ifndef __GHASH_CE_CORE_H
7 #define __GHASH_CE_CORE_H
8 
9 #include <inttypes.h>
10 
11 struct internal_ghash_key {
12 	uint64_t h[2];
13 	uint64_t h2[2];
14 	uint64_t h3[2];
15 	uint64_t h4[2];
16 };
17 
18 void pmull_ghash_update_p64(int blocks, uint64_t dg[2], const uint8_t *src,
19 			    const struct internal_ghash_key *ghash_key,
20 			    const uint8_t *head);
21 void pmull_ghash_update_p8(int blocks, uint64_t dg[2], const uint8_t *src,
22 			   const struct internal_ghash_key *ghash_key,
23 			   const uint8_t *head);
24 
25 void pmull_gcm_load_round_keys(const uint64_t rk[30], int rounds);
26 
27 void pmull_gcm_encrypt(int blocks, uint64_t dg[2], uint8_t dst[],
28 		       const uint8_t src[],
29 		       const struct internal_ghash_key *ghash_key,
30 		       uint64_t ctr[], const uint64_t rk[], int rounds,
31 		       uint8_t ks[]);
32 
33 
34 void pmull_gcm_decrypt(int blocks, uint64_t dg[2], uint8_t dst[],
35 		       const uint8_t src[],
36 		       const struct internal_ghash_key *ghash_key,
37 		       uint64_t ctr[], const uint64_t rk[], int rounds);
38 
39 uint32_t pmull_gcm_aes_sub(uint32_t input);
40 
41 void pmull_gcm_encrypt_block(uint8_t dst[], const uint8_t src[], int rounds);
42 
43 #endif /*__GHASH_CE_CORE_H*/
44