Skip to content

Commit 9134057

Browse files
committed
bsdkm: review cleanup.
1 parent 1f57011 commit 9134057

File tree

5 files changed

+16
-28
lines changed

5 files changed

+16
-28
lines changed

Makefile.am

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,12 +248,6 @@ if BUILD_BSDKM
248248
AM_CCASFLAGS CCASFLAGS \
249249
src_libwolfssl_la_OBJECTS ENABLED_CRYPT_TESTS
250250

251-
module:
252-
+$(MAKE) -C bsdkm libwolfssl.ko
253-
254-
clean_module:
255-
+$(MAKE) -C bsdkm clean
256-
257251
endif
258252

259253

bsdkm/Makefile

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,20 @@ KMOD=libwolfssl
33
SRCS=wolfkmod.c
44
WOLFSSL_DIR=../
55

6-
CFLAGS+=-I/usr/include/sys
76
CFLAGS+=-I${WOLFSSL_DIR}
87
CFLAGS+=-DWOLFSSL_IGNORE_FILE_WARN -DHAVE_CONFIG_H
98
CFLAGS+=-DNO_MAIN_DRIVER
109
# debug mode
1110
CFLAGS+=-DWOLFSSL_BSDKM_VERBOSE_DEBUG
1211
CFLAGS+=$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS)
1312

14-
# FreeBSD make does not support GNU make's patsubst and related.
15-
# Just include everything under wolfcrypt/src/ except port, and let
16-
# define flags filter the rest.
17-
OBJS != find ${WOLFSSL_DIR}/wolfcrypt/src -path \
18-
'${WOLFSSL_DIR}/wolfcrypt/src/port' -prune -o -name \
19-
'*.c' -print | sed 's,\.c$$,.o,'
13+
# FreeBSD make does not support GNU make's patsubst and related. Filter
14+
# through sed instead.
15+
OBJS != echo ${src_libwolfssl_la_OBJECTS} | sed 's|src_libwolfssl_la-||g' | \
16+
sed 's|\.lo|.o|g' | sed 's|wolfcrypt/src/|${WOLFSSL_DIR}/wolfcrypt/src/|g'
2017

2118
.if ${ENABLED_CRYPT_TESTS} == "yes"
2219
OBJS += ${WOLFSSL_DIR}/wolfcrypt/test/test.o
23-
# freebsd kernel compiler insists fiducial line vars are unused.
24-
CFLAGS+=-Wno-error=unused-const-variable
2520
.else
2621
CFLAGS+=-DNO_CRYPT_TEST
2722
.endif
@@ -42,7 +37,10 @@ OBJS != find ${WOLFSSL_DIR}/wolfcrypt/src -path \
4237
.endif
4338
.include "${SYSDIR}/conf/kmod.mk"
4439

45-
# Suppress wolfcrypt/src/misc.c drops const qualifier, and similar.
40+
# Smooth out a few inconsistencies between FreeBSD default compiler flags
41+
# in /usr/src/sys/conf/kern.mk, vs wolfssl harden flags in
42+
# m4/ax_harden_compiler_flags.m4. E.g. some FreeBSD header files shorten
43+
# 64 to 32 bit, and some wolfcrypt functions cast away const.
4644
CFLAGS+= -Wno-unused-function
4745
CFLAGS+= -Wno-cast-qual
4846
CFLAGS+= -Wno-error=cast-qual

bsdkm/bsdkm_wc_port.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ extern struct malloc_type M_WOLFSSL[1];
105105
#endif /* !SINGLE_THREADED */
106106

107107
#if defined(WOLFSSL_HAVE_ATOMIC_H) && !defined(WOLFSSL_NO_ATOMICS)
108-
/* todo: add FreeBSD implementation in wc_port.c */
109108
#include <machine/atomic.h>
110109
typedef volatile int wolfSSL_Atomic_Int;
111110
typedef volatile unsigned int wolfSSL_Atomic_Uint;

wolfcrypt/test/test.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10439,9 +10439,8 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t des3_test(void)
1043910439
}
1044010440
#endif /* NO_DES3 */
1044110441

10442-
static const int fiducial1 = WC_TEST_RET_LN; /* source code reference point --
10443-
* see print_fiducials() below.
10444-
*/
10442+
/* source code reference point -- see print_fiducials() below. */
10443+
static WC_MAYBE_UNUSED const int fiducial1 = WC_TEST_RET_LN;
1044510444

1044610445
#ifndef NO_AES
1044710446

@@ -30100,9 +30099,8 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t tls13_kdf_test(void)
3010030099

3010130100
#endif /* WOLFSSL_TLS13 && !NO_HMAC */
3010230101

30103-
static const int fiducial2 = WC_TEST_RET_LN; /* source code reference point --
30104-
* see print_fiducials() below.
30105-
*/
30102+
/* source code reference point -- see print_fiducials() below. */
30103+
static WC_MAYBE_UNUSED const int fiducial2 = WC_TEST_RET_LN;
3010630104

3010730105
#if defined(HAVE_ECC) && defined(HAVE_X963_KDF)
3010830106

@@ -49880,9 +49878,8 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t lms_test_verify_only(void)
4988049878
#endif
4988149879
#endif /* if defined(WOLFSSL_HAVE_LMS) && !defined(WOLFSSL_SMALL_STACK) */
4988249880

49883-
static const int fiducial3 = WC_TEST_RET_LN; /* source code reference point --
49884-
* see print_fiducials() below.
49885-
*/
49881+
/* source code reference point -- see print_fiducials() below. */
49882+
static WC_MAYBE_UNUSED const int fiducial3 = WC_TEST_RET_LN;
4988649883

4988749884
#ifdef WOLFCRYPT_HAVE_ECCSI
4988849885
static wc_test_ret_t eccsi_api_test(WC_RNG* rng, EccsiKey* key, mp_int* ssk,
@@ -62831,7 +62828,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t aes_siv_test(void)
6283162828

6283262829
#undef ERROR_OUT
6283362830

62834-
static const int fiducial4 = WC_TEST_RET_LN;
62831+
static WC_MAYBE_UNUSED const int fiducial4 = WC_TEST_RET_LN;
6283562832

6283662833
/* print the fiducial line numbers assigned above, allowing confirmation of
6283762834
* source code version match when in doubt.

wolfssl/wolfcrypt/types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ enum {
725725

726726
#elif defined(WOLFSSL_LINUXKM)
727727

728-
/* definitions are in linuxkm/linuxkm_wc_port.h. */
728+
/* definitions are in linuxkm/linuxkm_wc_port.h */
729729

730730
#elif defined(WOLFSSL_BSDKM)
731731

0 commit comments

Comments
 (0)