Home GnuPG

cmac: Add selftest.

Description

cmac: Add selftest.

* cipher/mac-cmac.c (check_one, selftests_cmac_3des): New.
(selftests_cmac_aes, cmac_selftest): New.
(cmac_ops): Add cmac_selftest.
* src/fips.c (run_mac_selftests): Add CMAC selftests.

Original work was libgcrypt-1.8.3-cmac-selftest.patch from Red Hat.

API of check_one function is taken from cipher/hmac-tests.c of
libgcrypt 1.8, copyrighted by Free Software Foundation, Inc., then
modified for CMAC.

Covering the test vectors of original work, we use exactly same test
vectors from tests/basic.c.

  • Co-authored-by: Tomáš Mráz <tm@t8m.info>
  • Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>

Details

Provenance
gniibeAuthored on Jan 13 2021, 3:00 AM
Parents
rC00d7c1c63201: sexp: Raise an error when an integer is negative with USG.
Branches
Unknown
Tags
Unknown