1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*
* SPDX-License-Identifier: MIT
*
* Rivide Post-Quantum Cryptography Library
* Copyright (C) 2026 Moh. Ananda Firmansyah Putra
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*/
/**
* @file ghash.c
* @brief GHASH multiplication in Galois Field GF(2^128) implementation.
*
* Implements field multiplication modulo the reduction polynomial
* f(x) = x^128 + x^7 + x^2 + x + 1 (reduction constant 0xE1) for AES-GCM
* authentication tag computation specified in NIST SP 800-38D.
*/
/**
* @brief Multiply two 128-bit blocks in GF(2^128).
*
* Computes x = x * y in GF(2^128) using bitwise multiplication and reduction
* with polynomial constant 0xE1.
*
* @param[in,out] x First 128-bit block (in/out).
* @param[in] y Second 128-bit block.
*/
void
/**
* @brief Accumulate data blocks into the GHASH authentication tag.
*
* Pads incomplete final blocks with zeroes and updates the tag iteratively.
*
* @param[in] h 128-bit hash key H = AES_K(0^128).
* @param[in] data Data buffer to authenticate.
* @param[in] len Length of data in bytes.
* @param[in,out] tag Accumulated 128-bit tag buffer.
*/
void