-
Notifications
You must be signed in to change notification settings - Fork 8
Exclude crypto algorithms according to user_settings.h #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
144e123
Enforce clean build with algorithms excluded
danielinux 5a5fc42
Fixed copilot's comment
danielinux 2c4a9b8
Added missing cases: AES-ECB / DSA-ECB
danielinux aeecbcf
addressed copilot's comments
danielinux 97057ec
Addressed robots comments
danielinux File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| name: Build Config Matrix | ||
|
|
||
| on: | ||
| push: | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| build-config-matrix: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - name: baseline | ||
| modifiers: "" | ||
| - name: md5 | ||
| modifiers: "-WOLFSSL_MD5 +NO_MD5" | ||
| - name: ripemd | ||
| modifiers: "-WOLFSSL_RIPEMD" | ||
| - name: sha1 | ||
| modifiers: "+NO_SHA" | ||
| - name: sha224 | ||
| modifiers: "-WOLFSSL_SHA224" | ||
| - name: sha384 | ||
| modifiers: "-WOLFSSL_SHA384" | ||
| - name: sha512-family | ||
| modifiers: "-WOLFSSL_SHA512 -WOLFSSL_SHA384 -HAVE_ED25519 -WOLFSSL_ED25519_STREAMING_VERIFY -HAVE_ED448 -WOLFSSL_ED448_STREAMING_VERIFY +NO_SHA512" | ||
| - name: sha3-ed448 | ||
| modifiers: "-WOLFSSL_SHA3 -HAVE_ED448 -WOLFSSL_ED448_STREAMING_VERIFY" | ||
| - name: des3 | ||
| modifiers: "-WOLFSSL_DES3 -WOLFSSL_DES_ECB +NO_DES3" | ||
| - name: aes-gcm | ||
| modifiers: "-HAVE_AESGCM" | ||
| - name: aes-ccm | ||
| modifiers: "-HAVE_AESCCM" | ||
| - name: aes-ctr | ||
| modifiers: "-WOLFSSL_AES_COUNTER" | ||
| - name: aes-cfb | ||
| modifiers: "-WOLFSSL_AES_CFB" | ||
| - name: aes-ofb | ||
| modifiers: "-WOLFSSL_AES_OFB" | ||
| - name: aes-ecb | ||
| modifiers: "-HAVE_AES_ECB" | ||
| - name: des-ecb | ||
| modifiers: "-WOLFSSL_DES_ECB" | ||
| - name: cmac | ||
| modifiers: "-WOLFSSL_CMAC" | ||
| - name: chacha20-poly1305 | ||
| modifiers: "-HAVE_CHACHA -HAVE_POLY1305" | ||
| - name: curve25519 | ||
| modifiers: "-HAVE_CURVE25519" | ||
| - name: ed25519 | ||
| modifiers: "-HAVE_ED25519 -WOLFSSL_ED25519_STREAMING_VERIFY" | ||
| - name: curve448 | ||
| modifiers: "-HAVE_CURVE448" | ||
| - name: ed448 | ||
| modifiers: "-HAVE_ED448 -WOLFSSL_ED448_STREAMING_VERIFY" | ||
| - name: hkdf | ||
| modifiers: "-HAVE_HKDF -HAVE_ECC_ENCRYPT" | ||
| - name: tls-prf | ||
| modifiers: "-WOLFSSL_HAVE_PRF" | ||
| - name: pbkdf2 | ||
| modifiers: "-HAVE_PBKDF2 +NO_PBKDF2" | ||
| - name: ecc384 | ||
| modifiers: "-WOLFSSL_SP_384 -HAVE_ECC384" | ||
| - name: rsa-1024 | ||
|
danielinux marked this conversation as resolved.
|
||
| modifiers: "-WOLFSSL_SP_1024 -RSA_MIN_SIZE +RSA_MIN_SIZE=2048" | ||
|
|
||
| steps: | ||
| - name: Check out wolfPSA | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install build dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y build-essential | ||
|
|
||
| - name: Clone sibling wolfSSL | ||
| run: git clone --depth 1 https://github.com/wolfSSL/wolfssl ../wolfssl | ||
|
danielinux marked this conversation as resolved.
|
||
|
|
||
| - name: Build ${{ matrix.name }} | ||
| run: ./build-test/build-variant.sh "${{ matrix.name }}" ${{ matrix.modifiers }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,3 +18,4 @@ wolfcrypt-benchmark/wolfcrypt-psa-benchmark | |
| wolfcrypt-psa-benchmark | ||
| .store/ | ||
| *.log | ||
| .codex | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,106 @@ | ||
| #!/bin/sh | ||
| # | ||
| # Build a wolfPSA variant with a baseline set of wolfcrypt-native defines, | ||
| # optionally modified by lane-specific +/- tokens. | ||
| # | ||
| # Usage: build-variant.sh <lane-name> [modifier ...] | ||
| # | ||
| # A modifier is one of: | ||
| # +FLAG add -DFLAG to the compile flags | ||
| # +FLAG=VALUE add -DFLAG=VALUE | ||
| # -FLAG remove -DFLAG (or -DFLAG=...) from the baseline | ||
| # | ||
| # The baseline below must list every wolfcrypt-native knob wolfPSA needs for | ||
| # a full build. Keep the names in sync with wolfssl/wolfcrypt/settings.h. | ||
|
|
||
| set -eu | ||
|
|
||
| script_dir=$(CDPATH= cd -- "$(dirname "$0")" && pwd) | ||
| repo_root=$(CDPATH= cd -- "${script_dir}/.." && pwd) | ||
| variant_name=${1:?usage: build-variant.sh <lane-name> [modifier ...]} | ||
| shift | ||
|
|
||
| # Baseline — every feature enabled. Listed one per line for easy grep/edit. | ||
| BASELINE=" | ||
| WOLFSSL_SP_MATH_ALL | ||
| WOLFSSL_HAVE_SP_RSA | ||
| WOLFSSL_HAVE_SP_ECC | ||
| HAVE_SP_ECC | ||
| WOLFSSL_KEY_GEN | ||
| WC_NO_HARDEN | ||
| HAVE_ECC | ||
| HAVE_ECC_KEY_EXPORT | ||
| HAVE_ECC_KEY_IMPORT | ||
| WOLFSSL_ECDSA_DETERMINISTIC_K | ||
| WC_RSA_PSS | ||
| WOLFSSL_PSS_SALT_LEN_DISCOVER | ||
| WOLFSSL_RSA_OAEP | ||
| WOLFSSL_SP_1024 | ||
| RSA_MIN_SIZE=1024 | ||
| WOLFSSL_SP_384 | ||
| HAVE_ECC384 | ||
| WOLFSSL_HAVE_PRF | ||
| HAVE_HKDF | ||
| HAVE_ECC_ENCRYPT | ||
| HAVE_PBKDF2 | ||
| WOLFSSL_MD5 | ||
| WOLFSSL_RIPEMD | ||
| WOLFSSL_SHA224 | ||
| WOLFSSL_SHA384 | ||
| WOLFSSL_SHA512 | ||
| WOLFSSL_SHA3 | ||
| WOLFSSL_DES3 | ||
| WOLFSSL_DES_ECB | ||
| HAVE_AESGCM | ||
| HAVE_AESCCM | ||
| HAVE_AES_ECB | ||
| WOLFSSL_AES_COUNTER | ||
| WOLFSSL_AES_CFB | ||
| WOLFSSL_AES_OFB | ||
| WOLFSSL_CMAC | ||
| HAVE_CHACHA | ||
| HAVE_POLY1305 | ||
| HAVE_CURVE25519 | ||
| HAVE_ED25519 | ||
| WOLFSSL_ED25519_STREAMING_VERIFY | ||
| HAVE_CURVE448 | ||
| HAVE_ED448 | ||
| WOLFSSL_ED448_STREAMING_VERIFY | ||
| " | ||
|
|
||
| flags="${BASELINE}" | ||
|
|
||
| for mod in "$@"; do | ||
| case "${mod}" in | ||
| +*) | ||
| token=${mod#+} | ||
| flags="${flags} | ||
| ${token}" | ||
| ;; | ||
| -*) | ||
| name=${mod#-} | ||
| # Drop any line that is either exactly "name" or "name=...". | ||
| flags=$(printf '%s\n' "${flags}" | awk -v n="${name}" ' | ||
| $0 == n { next } | ||
| index($0, n "=") == 1 { next } | ||
| { print }') | ||
| ;; | ||
| *) | ||
| printf 'build-variant.sh: unknown modifier %s\n' "${mod}" >&2 | ||
| exit 2 | ||
| ;; | ||
| esac | ||
| done | ||
|
|
||
| cppflags="-DWOLFSSL_USER_SETTINGS" | ||
| for tok in ${flags}; do | ||
| [ -z "${tok}" ] && continue | ||
| cppflags="${cppflags} -D${tok}" | ||
| done | ||
|
|
||
| make -C "${repo_root}" clean BUILD_DIR="${repo_root}/build-test/out/${variant_name}" >/dev/null | ||
| make -C "${repo_root}" \ | ||
| BUILD_DIR="${repo_root}/build-test/out/${variant_name}" \ | ||
| USER_SETTINGS_PATH="${repo_root}/build-test" \ | ||
| WOLFSSL_CPPFLAGS="${cppflags}" \ | ||
| libwolfpsa.a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| /* user_settings.h | ||
| * | ||
| * Copyright (C) 2026 wolfSSL Inc. | ||
| * | ||
| * This file is part of wolfSSL. | ||
| * | ||
| * wolfSSL is free software; you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License as published by | ||
| * the Free Software Foundation; either version 2 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * wolfSSL is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program; if not, write to the Free Software | ||
| * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA | ||
| */ | ||
|
|
||
| #ifndef WOLFSSL_USER_SETTINGS_H | ||
| #define WOLFSSL_USER_SETTINGS_H | ||
|
|
||
| /* The build-config-matrix harness drives every algorithm feature via | ||
| * wolfcrypt-native defines passed on the compiler command line by | ||
| * build-test/build-variant.sh. This file only sets up invariants that are | ||
| * always required (or always forbidden) regardless of the lane. */ | ||
|
|
||
| #define WOLFCRYPT_ONLY | ||
| #define SINGLE_THREADED | ||
| #define WOLFSSL_PSA_ENGINE | ||
| #define NO_DSA | ||
|
|
||
| #endif /* WOLFSSL_USER_SETTINGS_H */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.