Skip to contentSkip to conversation

tests: add functional tests for ecb/cbc helpers

PATCH Superseded Srish Srinivasan 1 participant 1 message Jan 2

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 tests: add functional tests for ecb/cbc helpers

Test the following helper functions using AES with 128, 192, and 256 bit keys:

grub_crypto_ecb_encrypt
grub_crypto_ecb_decrypt
grub_crypto_cbc_encrypt
grub_crypto_cbc_decrypt

---
 docs/grub.texi                               |   5 +
 grub-core/Makefile.core.def                  |   5 +
 grub-core/tests/crypto_cipher_mode_test.c    | 197 +++++++++++++++++++
 grub-core/tests/crypto_cipher_mode_vectors.h | 135 +++++++++++++
 grub-core/tests/lib/functional_test.c        |   1 +
 5 files changed, 343 insertions(+)
 create mode 100644 grub-core/tests/crypto_cipher_mode_test.c
 create mode 100644 grub-core/tests/crypto_cipher_mode_vectors.h
docs/grub.texi +5 -0
index 7181009b6..48584068b 100644
@@ -4092,6 +4092,7 @@ Modules can be loaded via the @command{insmod} (@pxref{insmod}) command.
 * dm_nv_module::
 * drivemap_module::
 * dsa_sexp_test_module::
+* crypto_cipher_mode_test_module::
 * echo_module::
 * efi_gop_module::
 * efi_uga_module::
@@ -4677,6 +4678,10 @@ mappings. @xref{drivemap} for more information.
 @section dsa_sexp_test
 This module provides a test of the libgcrypt DSA functionality in GRUB.
 
+@node crypto_cipher_mode_test_module
+@section crypto_cipher_mode_test
+This module performs various cipher mode encryption/decryption tests
+
 @node echo_module
 @section echo
 This module provides support for the @command{echo} to display a line of text.
grub-core/Makefile.core.def +5 -0
index fa4bc54aa..0cf155128 100644
@@ -2272,6 +2272,11 @@ module = {
   common = tests/argon2_test.c;
 };
 
+module = {
+  name = crypto_cipher_mode_test;
+  common = tests/crypto_cipher_mode_test.c;
+};
+
 module = {
   name = legacy_password_test;
   common = tests/legacy_password_test.c;
grub-core/tests/crypto_cipher_mode_test.c new file +197 -0

197 lines not on this page · raw message

grub-core/tests/crypto_cipher_mode_vectors.h new file +135 -0

135 lines not on this page · raw message

grub-core/tests/lib/functional_test.c +1 -0
index 776934e1f..4214332df 100644
@@ -82,6 +82,7 @@ grub_functional_all_tests (grub_extcmd_context_t ctxt __attribute__ ((unused)),
   grub_dl_load ("shift_test");
   grub_dl_load ("asn1_test");
   grub_dl_load ("argon2_test");
+  grub_dl_load ("crypto_cipher_mode_test");
 
   FOR_LIST_ELEMENTS (test, grub_test_list)
     ok = !grub_test_run (test) && ok;
Signature · 7 lines
2.52.0


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel