]> git.ipfire.org Git - thirdparty/nettle.git/commit
Refactor GCM C implementation.
authorNiels Möller <nisse@lysator.liu.se>
Fri, 18 Feb 2022 20:14:49 +0000 (21:14 +0100)
committerNiels Möller <nisse@lysator.liu.se>
Fri, 18 Feb 2022 20:14:49 +0000 (21:14 +0100)
commit1d438ad40aa983cf9dc3c0f41cabb6bea70af977
tree9e3c83c277738045adb111c08a5a740dbb5ad373
parentbdf820df0b90f210222ef56a27f95e0710c36c92
Refactor GCM C implementation.

Assembly implementations not yet updated.

* Makefile.in (nettle_SOURCES): Add ghash-set-key.c ghash-update.c.
(DISTFILES): Replaced gcm-internal.h with ghash-internal.h.

* testsuite/gcm-test.c (test_ghash_internal): Updated to use
_ghash_set_key and _ghash_update.

* gcm.c (INC32): Deleted macro, used in only one place.
(gcm_set_key): Update to use _ghash_set_key.
(gcm_hash): Renamed, was _gcm_hash, and implemented in terms of
_ghash_update.
(bswap_if_le): New function (copied from nist-keywrap.c).
(gcm_hash_sizes): Use bswap_if_le and _ghash_update.
(gcm_set_iv): Updated to use gcm_hash and block16_zero.
(gcm_digest): Use _ghash_digest.

* ghash-internal.h: New file, declaring new internal ghash interface.
* gcm-internal.h: Deleted file.
* ghash-update.c (gcm_gf_shift_8): Moved here (from gcm.c)
(gcm_gf_mul): Likewise.
(_ghash_update): New function, extracted from _nettle_gcm_hash_c.
(_ghash_digest): New function.
* ghash-set-key.c (_ghash_set_key): New file and function.
Extracted from _nettle_gcm_init_key_c and _nettle_gcm_set_key.
ChangeLog
Makefile.in
gcm-internal.h [deleted file]
gcm.c
ghash-internal.h [new file with mode: 0644]
ghash-set-key.c [new file with mode: 0644]
ghash-update.c [new file with mode: 0644]
testsuite/gcm-test.c