Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/linux-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,17 @@ jobs:
run: |
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/build-dir/lib" >> "$GITHUB_ENV"

# Only copy appropriate makefile for platform currently being tested
# Only copy appropriate makefile for platform currently being tested.
# Use 'cat > ' rather than 'cp': macOS runners intermittently fail 'cp'
# with "fcopyfile failed: Illegal byte sequence" when copyfile() tries to
# replicate the source's extended attributes (e.g. com.apple.provenance).
# Redirecting content copies only the file data and avoids that path.
- name: Copy makefile
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
cp makefile.linux makefile
cat makefile.linux > makefile
elif [ "$RUNNER_OS" == "macOS" ]; then
cp makefile.macosx makefile
cat makefile.macosx > makefile
else
echo "$RUNNER_OS not supported"
exit 1
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,38 @@ jobs:
jdk_version: ${{ matrix.jdk_version }}
wolfssl_configure: ${{ matrix.wolfssl_configure }}

# ----------------------- LMS / HSS (RFC 8554) ------------------------
# LMS/HSS is verify-only in wolfJCE and requires wolfSSL to be built with
# --enable-lms. It is not pulled in by --enable-all, so it is enabled
# explicitly. The --enable-lms option is comma-separated and selects the
# build variant and hash/parameter families:
# (default) SHA-256/256 parameter sets, sign + verify
# verify-only -> WOLFSSL_LMS_VERIFY_ONLY (wolfJCE production posture)
# small -> WOLFSSL_WC_LMS_SMALL (low-memory, slower codepath)
# sha256-192 -> WOLFSSL_LMS_SHA256_192 (RFC 9858 SHA-256/192 sets)
# shake256 -> WOLFSSL_LMS_SHAKE256 (RFC 9858 SHAKE256 sets)
# The LMS JUnit tests skip per hash family not compiled in (the JNI import
# returns NOT_COMPILED_IN), so each permutation runs the KATs it can and
# skips the rest. SHAKE parameter sets additionally require --enable-sha3.
linux-zulu-lms:
strategy:
matrix:
os: [ 'ubuntu-latest', 'macos-latest' ]
jdk_version: [ '11', '21', '24' ]
wolfssl_configure:
- '--enable-jni --enable-lms'
- '--enable-jni --enable-lms=verify-only'
- '--enable-jni --enable-lms=verify-only,small'
- '--enable-jni --enable-lms=sha256-192,shake256 --enable-sha3'
- '--enable-jni --enable-all --enable-lms'
name: ${{ matrix.os }} (Zulu JDK ${{ matrix.jdk_version }}, ${{ matrix.wolfssl_configure }})
uses: ./.github/workflows/linux-common.yml
with:
os: ${{ matrix.os }}
jdk_distro: "zulu"
jdk_version: ${{ matrix.jdk_version }}
wolfssl_configure: ${{ matrix.wolfssl_configure }}

# ------------------ Facebook Infer static analysis -------------------
# Run Facebook infer over PR code, only running on Linux with one
# JDK/version for now.
Expand Down
10 changes: 7 additions & 3 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,17 @@ jobs:
run: |
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/build-dir/lib" >> "$GITHUB_ENV"

# Only copy appropriate makefile for platform currently being tested
# Only copy appropriate makefile for platform currently being tested.
# Use 'cat > ' rather than 'cp': macOS runners intermittently fail 'cp'
# with "fcopyfile failed: Illegal byte sequence" when copyfile() tries to
# replicate the source's extended attributes (e.g. com.apple.provenance).
# Redirecting content copies only the file data and avoids that path.
- name: Copy makefile
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
cp makefile.linux makefile
cat makefile.linux > makefile
elif [ "$RUNNER_OS" == "macOS" ]; then
cp makefile.macosx makefile
cat makefile.macosx > makefile
else
echo "$RUNNER_OS not supported"
exit 1
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/stable-wolfssl-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,16 @@ jobs:
# it is enabled explicitly. On stable releases older than 5.9.2 the XMSS
# JUnit tests skip gracefully (FeatureDetect.XmssEnabled() returns
# false), becoming real coverage once 5.9.2-stable rotates in.
# LMS/HSS is verify-only in wolfJCE and is not pulled in by
# --enable-all, so it is enabled explicitly. On stable releases that
# predate a given LMS parameter family the LMS JUnit tests skip
# gracefully (per-hash NOT_COMPILED_IN, or FeatureDetect.LmsEnabled()
# returning false).
wolfssl_configure:
- '--enable-jni'
- '--enable-jni --enable-all'
- '--enable-jni --enable-all --enable-xmss'
- '--enable-jni --enable-all --enable-lms'
name: wolfSSL ${{ matrix.wolfssl_version }} (JDK ${{ matrix.jdk_version }}, ${{ matrix.wolfssl_configure }})
steps:
- uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions IDE/Android/app/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ add_library(wolfcryptjni SHARED
${wolfcryptjni_DIR}/jni/jni_fips.c
${wolfcryptjni_DIR}/jni/jni_hmac.c
${wolfcryptjni_DIR}/jni/jni_jce_wolfsslkeystore.c
${wolfcryptjni_DIR}/jni/jni_lms.c
${wolfcryptjni_DIR}/jni/jni_logging.c
${wolfcryptjni_DIR}/jni/jni_md5.c
${wolfcryptjni_DIR}/jni/jni_mldsa.c
Expand Down
1 change: 1 addition & 0 deletions IDE/WIN/wolfcryptjni.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
<ClCompile Include="..\..\jni\jni_fips.c" />
<ClCompile Include="..\..\jni\jni_hmac.c" />
<ClCompile Include="..\..\jni\jni_jce_wolfsslkeystore.c" />
<ClCompile Include="..\..\jni\jni_lms.c" />
<ClCompile Include="..\..\jni\jni_logging.c" />
<ClCompile Include="..\..\jni\jni_md5.c" />
<ClCompile Include="..\..\jni\jni_mldsa.c" />
Expand Down
3 changes: 3 additions & 0 deletions IDE/WIN/wolfcryptjni.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@
<ClCompile Include="..\..\jni\jni_hmac.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\jni\jni_lms.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\..\jni\jni_logging.c">
<Filter>Source Files</Filter>
</ClCompile>
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ signing belongs in hardware (NIST SP 800-208). When `--enable-xmss` is missing
or the native wolfSSL is older than 5.9.2, wolfJCE still compiles and runs
normally but the XMSS services are not registered.

**Note on LMS/HSS (RFC 8554):** LMS support is **not** enabled by
`--enable-jni` alone. Add `--enable-lms` (or `--enable-lms=verify-only`) to the
native wolfSSL `./configure` line (for the SHAKE256 parameter sets also add
`--enable-sha3`). wolfJCE provides **verify-only** LMS/HSS support, matching the
JDK SUN provider: it registers the LMS `Signature` (verification) and
`KeyFactory` (public-key) services. wolfJCE does not generate LMS keys or sign,
since stateful hash-based signing belongs in hardware (NIST SP 800-208).

**wolfSSL Standard Build**:
```
$ cd wolfssl-x.x.x
Expand Down
3 changes: 3 additions & 0 deletions README_JCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ The JCE provider currently supports the following algorithms:
OID: 1.3.6.1.5.5.7.6.34
XMSSMT (verify-only)
OID: 1.3.6.1.5.5.7.6.35
LMS (also registered as HSS/LMS)
OID: 1.2.840.113549.1.9.16.3.17

KeyAgreement Class
DiffieHellman
Expand Down Expand Up @@ -279,6 +281,7 @@ The JCE provider currently supports the following algorithms:
ML-KEM-1024 (alias OID: 2.16.840.1.101.3.4.4.3)
XMSS (verify-only, alias OID: 1.3.6.1.5.5.7.6.34)
XMSSMT (verify-only, alias OID: 1.3.6.1.5.5.7.6.35)
LMS (also HSS/LMS, OID 1.2.840.113549.1.9.16.3.17)

KEM Class (javax.crypto.KEM, requires JDK 21 or later)
ML-KEM
Expand Down
Binary file added examples/certs/lms/bc_lms_native_bc_root.der
Binary file not shown.
20 changes: 20 additions & 0 deletions examples/certs/update-certs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ xmssCertList=(
"xmss/xmss_root_cert.der"
)

lmsCertList=(
"lms/bc_lms_native_bc_root.der"
)

for i in ${!certList[@]};
do
printf "Updating: ${certList[$i]}\n"
Expand Down Expand Up @@ -140,6 +144,22 @@ else
printf "local copies\n"
fi

if [ -d "$CERT_LOCATION/lms" ]; then
for i in ${!lmsCertList[@]};
do
printf "Updating: ${lmsCertList[$i]}\n"
cp $CERT_LOCATION/${lmsCertList[$i]} ./${lmsCertList[$i]}
if [ $? -ne 0 ]; then
printf "Warning: skipped missing LMS cert: "
printf "${lmsCertList[$i]}\n"
fi
done
else
printf "Notice: $CERT_LOCATION/lms not found, skipping LMS\n"
printf "certs (provided wolfSSL predates them), keeping existing\n"
printf "local copies\n"
fi

# Generate ca-keyPkcs8.der, used by examples/X509CertificateGeneration.java
openssl pkcs8 -topk8 -inform DER -outform DER -in ca-key.der -out ca-keyPkcs8.der -nocrypt
if [ $? -ne 0 ]; then
Expand Down
71 changes: 71 additions & 0 deletions jni/include/com_wolfssl_wolfcrypt_Lms.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion jni/jni_feature_detect.c
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,11 @@ JNIEXPORT jboolean JNICALL Java_com_wolfssl_wolfcrypt_FeatureDetect_LmsEnabled
{
(void)env;
(void)jcl;
#ifdef WOLFSSL_HAVE_LMS
/* wolfCrypt JNI/JCE LMS support requires wolfSSL >= 5.9.2, the first
* release providing the wc_LmsKey_GetParameters_ex() hash-family API used
* by the LMS JNI layer. Report disabled on older wolfSSL so callers and
* tests treat LMS as not compiled in. */
#if defined(WOLFSSL_HAVE_LMS) && (LIBWOLFSSL_VERSION_HEX >= 0x05009002)
return JNI_TRUE;
#else
return JNI_FALSE;
Expand Down
Loading
Loading