From 5ec5bc045f665b1ed807860c156c6f4a80c7a131 Mon Sep 17 00:00:00 2001 From: Jack Bond-Preston Date: Fri, 8 Mar 2024 11:36:30 +0000 Subject: [PATCH] Stub hmac_ipad_opad for aarch64 This method isn't supported on AArch64, but needs to be stubbed to have an implementation, in order to maintain ABI compatibility with x86_64 ipsec-mb library. Change-Id: I662ca65ab33b7ad4e4e094571563e02b97d82fc3 --- lib/Makefile | 3 +- lib/aarch64/hmac_ipad_opad_aarch64.c | 48 ++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 lib/aarch64/hmac_ipad_opad_aarch64.c diff --git a/lib/Makefile b/lib/Makefile index ab8cc65b..b54518d9 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -368,7 +368,8 @@ c_lib_objs := \ mb_mgr_snow3g_submit_flush_aarch64_sve256.o \ snow3g_aarch64_sve256.o \ cipher_suite_id.o \ - ooo_mgr_reset.o + ooo_mgr_reset.o \ + hmac_ipad_opad_aarch64.o asm_generic_lib_objs := \ lookup_16x8bit_neon.o \ snow3g_impl_aarch64_neon.o \ diff --git a/lib/aarch64/hmac_ipad_opad_aarch64.c b/lib/aarch64/hmac_ipad_opad_aarch64.c new file mode 100644 index 00000000..545526c6 --- /dev/null +++ b/lib/aarch64/hmac_ipad_opad_aarch64.c @@ -0,0 +1,48 @@ +/********************************************************************** + Copyright(c) 2024 Arm Corporation All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Arm Corporation nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +**********************************************************************/ +#include +#include + +#include + +IMB_DLL_EXPORT +__attribute((noreturn)) void +imb_hmac_ipad_opad(IMB_MGR *mb_mgr, const IMB_HASH_ALG sha_type, + const void *pkey, const size_t key_len, + void *ipad_hash, void *opad_hash) +{ + /* + * This method isn't supported on AArch64. However, it is stubbed to + * ensure ABI compatibility with the x86_64 ipsec-mb library. + * + * As this should never be called, it crashes. + */ + fprintf(stderr, "imb_hac_ipad_opad() is unimplemented for AArch64.\n"); + abort(); +} -- GitLab