Re-organize SM4/GCM related source files

This commit is contained in:
Zhi Guan
2024-04-11 22:19:50 +08:00
parent e4502ddd24
commit b777fbafdb
13 changed files with 454 additions and 193 deletions

View File

@@ -13,9 +13,7 @@
#include <stdlib.h>
#include <assert.h>
#include <gmssl/mem.h>
#include <gmssl/gf128.h>
#include <gmssl/ghash.h>
#include <gmssl/oid.h>
#include <gmssl/error.h>
#include <gmssl/endian.h>
@@ -79,11 +77,10 @@ void ghash(const uint8_t h[16], const uint8_t *aad, size_t aadlen, const uint8_t
}
gf128_add(X, X, L);
gf128_mul(H, H, X);
gf128_mul(H, X, H); // clear secrets in H
gf128_to_bytes(H, out);
}
void ghash_init(GHASH_CTX *ctx, const uint8_t h[16], const uint8_t *aad, size_t aadlen)
{
gf128_t A;