@@ -1141,6 +1141,49 @@ then
11411141fi
11421142
11431143
1144+ # LMS
1145+ AC_ARG_ENABLE ( [ lms] ,
1146+ [ AS_HELP_STRING ( [ --enable-lms] ,[ Enable stateful LMS/HSS signatures (default: disabled)] ) ] ,
1147+ [ ENABLED_LMS=$enableval ] ,
1148+ [ ENABLED_LMS=no ]
1149+ )
1150+
1151+ ENABLED_WC_LMS=no
1152+ for v in `echo $ENABLED_LMS | tr "," " "`
1153+ do
1154+ case $v in
1155+ yes)
1156+ ;;
1157+ no)
1158+ ;;
1159+ verify-only)
1160+ LMS_VERIFY_ONLY=yes
1161+ AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_LMS_VERIFY_ONLY"
1162+ ;;
1163+ wolfssl)
1164+ ENABLED_WC_LMS=yes
1165+ AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_WC_LMS"
1166+ ;;
1167+ *)
1168+ AC_MSG_ERROR ( [ Invalid choice for LMS [ ] : $ENABLED_LMS.] )
1169+ break;;
1170+ esac
1171+ done
1172+
1173+ if test "$ENABLED_LMS" != "no"
1174+ then
1175+ AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_LMS"
1176+
1177+ if test "$ENABLED_WC_LMS" = "no";
1178+ then
1179+ # Default is to use hash-sigs LMS lib. Make sure it's enabled.
1180+ if test "$ENABLED_LIBLMS" = "no"; then
1181+ AC_MSG_ERROR ( [ The default implementation for LMS is the hash-sigs LMS/HSS lib.
1182+ Please use --with-liblms.] )
1183+ fi
1184+ fi
1185+ fi
1186+
11441187# liblms
11451188# Get the path to the hash-sigs LMS HSS lib.
11461189ENABLED_LIBLMS="no"
@@ -1160,10 +1203,21 @@ AC_ARG_WITH([liblms],
11601203 tryliblmsdir="/usr/local"
11611204 fi
11621205
1163- # 1. By default use the hash-sigs single-threaded static library.
1164- # 2. If 1 not found, then use the multi-threaded static lib.
1165- # 3. If 2 not found, then use the multi-threaded dynamic lib.
1166- if test -e $tryliblmsdir/hss_lib.a; then
1206+ # 1. If verify only build, use hss_verify.a
1207+ # 2. If normal build, by default use single-threaded hss_lib.a
1208+ # 3. If 2 not found, then use the multi-threaded hss_lib_thread.a
1209+ if test "$LMS_VERIFY_ONLY" = "yes"; then
1210+ if test -e $tryliblmsdir/hss_verify.a; then
1211+ CPPFLAGS="$AM_CPPFLAGS -DHAVE_LIBLMS -I$tryliblmsdir"
1212+ LIB_STATIC_ADD="$LIB_STATIC_ADD $tryliblmsdir/hss_verify.a"
1213+ enable_shared=no
1214+ enable_static=yes
1215+ liblms_linked=yes
1216+ else
1217+ AC_MSG_ERROR ( [ hss_verify.a isn't found.
1218+ If it's already installed, specify its path using --with-liblms=/dir/] )
1219+ fi
1220+ elif test -e $tryliblmsdir/hss_lib.a; then
11671221 CPPFLAGS="$AM_CPPFLAGS -DHAVE_LIBLMS -I$tryliblmsdir"
11681222 LIB_STATIC_ADD="$LIB_STATIC_ADD $tryliblmsdir/hss_lib.a"
11691223 enable_shared=no
@@ -1175,12 +1229,6 @@ AC_ARG_WITH([liblms],
11751229 enable_shared=no
11761230 enable_static=yes
11771231 liblms_linked=yes
1178- elif test -e $tryliblmsdir/lib/libhss.so; then
1179- LIBS="$LIBS -lhss"
1180- CPPFLAGS="$AM_CPPFLAGS -DHAVE_LIBLMS -I$tryliblmsdir/include/hss"
1181- LDFLAGS="$AM_LDFLAGS $LDFLAGS -L$tryliblmsdir/lib"
1182-
1183- AC_LINK_IFELSE ( [ AC_LANG_PROGRAM ( [ [ #include <hss.h>] ] , [ [ param_set_t lm_type; param_set_t lm_ots_type; hss_get_public_key_len(4, &lm_type, &lm_ots_type); ] ] ) ] , [ liblms_linked=yes ] ,[ liblms_linked=no ] )
11841232 else
11851233 AC_MSG_ERROR ( [ liblms isn't found.
11861234 If it's already installed, specify its path using --with-liblms=/dir/] )
@@ -1203,47 +1251,6 @@ AC_ARG_WITH([liblms],
12031251 ]
12041252)
12051253
1206-
1207- # LMS
1208- AC_ARG_ENABLE ( [ lms] ,
1209- [ AS_HELP_STRING ( [ --enable-lms] ,[ Enable stateful LMS/HSS signatures (default: disabled)] ) ] ,
1210- [ ENABLED_LMS=$enableval ] ,
1211- [ ENABLED_LMS=no ]
1212- )
1213-
1214- ENABLED_WC_LMS=no
1215- for v in `echo $ENABLED_LMS | tr "," " "`
1216- do
1217- case $v in
1218- yes)
1219- ;;
1220- no)
1221- ;;
1222- wolfssl)
1223- ENABLED_WC_LMS=yes
1224- AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_WC_LMS"
1225- ;;
1226- *)
1227- AC_MSG_ERROR ( [ Invalid choice for LMS [ ] : $ENABLED_LMS.] )
1228- break;;
1229- esac
1230- done
1231-
1232- if test "$ENABLED_LMS" != "no"
1233- then
1234- AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_HAVE_LMS"
1235-
1236- if test "$ENABLED_WC_LMS" = "no";
1237- then
1238- # Default is to use hash-sigs LMS lib. Make sure it's enabled.
1239- if test "$ENABLED_LIBLMS" = "no"; then
1240- AC_MSG_ERROR ( [ The default implementation for LMS is the hash-sigs LMS/HSS lib.
1241- Please use --with-liblms.] )
1242- fi
1243- fi
1244- fi
1245-
1246-
12471254# SINGLE THREADED
12481255AC_ARG_ENABLE ( [ singlethreaded] ,
12491256 [ AS_HELP_STRING ( [ --enable-singlethreaded] ,[ Enable wolfSSL single threaded (default: disabled)] ) ] ,
0 commit comments