Thursday, March 31, 2022

[sparc64] security/polarssl build fix

Two small things to fix. -Werror chokes on

/usr/obj/ports/mbedtls-2.28.0/mbedtls-mbedtls-2.28.0/library/timing.c:141:2:
error: #warning OpenBSD does not allow access to tick register using software version instead [-Werror=cpp]
#warning OpenBSD does not allow access to tick register using software version instead
^~~~~~~

and then there's a for( size_t i; ...) that isn't accepted by gcc4
outside of C99 mode.

Use the usual fixes. All tests pass.

PS: setting -DUNSAFE_BUILD=ON instead of growing the CMakeLists.txt
patch doesn't work since gcc doesn't understand -Werror=cpp.

Index: Makefile
===================================================================
RCS file: /cvs/ports/security/polarssl/Makefile,v
retrieving revision 1.44
diff -u -p -r1.44 Makefile
--- Makefile 21 Mar 2022 04:32:57 -0000 1.44
+++ Makefile 31 Mar 2022 17:00:41 -0000
@@ -38,4 +38,9 @@ post-install:
echo "should not be relied upon by the normal end-user.") \
> ${PREFIX}/share/examples/mbedtls/README

+.include <bsd.port.arch.mk>
+.if !${PROPERTIES:Mclang}
+CFLAGS += -std=gnu99
+.endif
+
.include <bsd.port.mk>
Index: patches/patch-CMakeLists_txt
===================================================================
RCS file: /cvs/ports/security/polarssl/patches/patch-CMakeLists_txt,v
retrieving revision 1.11
diff -u -p -r1.11 patch-CMakeLists_txt
--- patches/patch-CMakeLists_txt 21 Mar 2022 04:32:57 -0000 1.11
+++ patches/patch-CMakeLists_txt 31 Mar 2022 16:50:08 -0000
@@ -19,3 +19,12 @@ Index: CMakeLists.txt
set(CMAKE_C_FLAGS_COVERAGE "-O0 -g3 --coverage")
set(CMAKE_C_FLAGS_ASAN "-fsanitize=address -fno-common -fsanitize=undefined -fno-sanitize-recover=all -O3")
set(CMAKE_C_FLAGS_ASANDBG "-fsanitize=address -fno-common -fsanitize=undefined -fno-sanitize-recover=all -O1 -g3 -fno-omit-frame-pointer -fno-optimize-sibling-calls")
+@@ -236,7 +232,7 @@ if(MBEDTLS_FATAL_WARNINGS)
+ endif(CMAKE_COMPILER_IS_MSVC)
+
+ if(CMAKE_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_GNU)
+- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
++ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
+ if(UNSAFE_BUILD)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=cpp")
+ set(CMAKE_C_FLAGS_ASAN "${CMAKE_C_FLAGS_ASAN} -Wno-error=cpp")

No comments:

Post a Comment