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
74 changes: 74 additions & 0 deletions .github/workflows/lean-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,18 @@ jobs:
-DWOLFCOSE_ENABLE_DEPRECATED_ALGS
build_cfg "deprecated RFC 9053 alg IDs, Ed448 only" \
-DWOLFCOSE_ENABLE_DEPRECATED_ALGS -DWOLFCOSE_NO_EDDSA
build_cfg "WOLFCOSE_NO_LOCAL_SIGN (external signer only)" \
-DWOLFCOSE_ENABLE_EXT_SIGN -DWOLFCOSE_NO_LOCAL_SIGN
build_cfg "WOLFCOSE_LEAN + WOLFCOSE_NO_LOCAL_SIGN" -DWOLFCOSE_LEAN \
-DWOLFCOSE_ENABLE_EXT_SIGN -DWOLFCOSE_NO_LOCAL_SIGN
echo "All lean configurations compiled clean."

- name: External signer only (WOLFCOSE_NO_LOCAL_SIGN)
run: |
export WOLFSSL_DIR=$HOME/wolfssl-install
export LD_LIBRARY_PATH=$WOLFSSL_DIR/lib
make no-local-sign-test WOLFSSL_PREFIX=$WOLFSSL_DIR PKG_CONFIG=false

- name: Check PSA/EAT opt-in feature matrix
run: |
export WOLFSSL_DIR=$HOME/wolfssl-install
Expand Down Expand Up @@ -268,3 +278,67 @@ jobs:
run: |
size examples/sign1_mldsa || true
size examples/sign1_verify_mldsa || true

no-asn:
name: ECDSA sign + verify against NO_ASN wolfSSL
runs-on: ubuntu-latest
container:
image: ghcr.io/wolfssl/wolfcose-ci@sha256:c073c7afb4cd3f296b8c1a305db2f718530b7a8aca899482629aee3a5cf8bfbc

steps:
- uses: actions/checkout@v4

- name: Trust workspace
if: runner.os == 'Linux'
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"

- name: Resolve wolfSSL master commit
id: wolfssl-rev
run: echo "sha=$(git ls-remote https://github.com/wolfSSL/wolfssl.git HEAD | cut -f1)" >> "$GITHUB_OUTPUT"

- name: Cache wolfSSL (NO_ASN)
id: cache-wolfssl
uses: actions/cache@v4
with:
path: ~/wolfssl-noasn
key: wolfcose-ci-v1-wolfssl-noasn-v1-${{ steps.wolfssl-rev.outputs.sha }}

# Deterministic k lets the suite reproduce the ES256 known-answer vector,
# proving NO_ASN signing is byte-identical to the DER path.
- name: Build NO_ASN wolfSSL
if: steps.cache-wolfssl.outputs.cache-hit != 'true'
run: |
cd ~
git clone --depth 1 https://github.com/wolfSSL/wolfssl.git wolfssl-noasn-src
cd wolfssl-noasn-src
./autogen.sh
./configure --enable-cryptonly --enable-ecc --enable-sha384 --enable-sha512 \
--enable-keygen --enable-asn=no --disable-rsa --disable-dh \
CPPFLAGS="-DWOLFSSL_ECDSA_DETERMINISTIC_K -DWOLFSSL_NO_MALLOC" \
--prefix=$HOME/wolfssl-noasn
make -j$(nproc)
make install

- name: Test suite (local ECDSA sign + verify, known-answer vector)
run: |
export LD_LIBRARY_PATH=$HOME/wolfssl-noasn/lib
make test WOLFSSL_PREFIX=$HOME/wolfssl-noasn PKG_CONFIG=false \
EXTRA_CFLAGS="-DWOLFCOSE_ENABLE_DETERMINISTIC_ECDSA"

- name: Assert no DER signature conversion is referenced
run: |
if nm -u src/*.o | grep -E "wc_ecc_(sig_to_rs|rs_raw_to_sig)$"; then
echo "FAIL: DER conversion referenced in a NO_ASN build"; exit 1
fi
echo "OK: raw r||s used directly"

- name: Delegated signing suite
run: |
export LD_LIBRARY_PATH=$HOME/wolfssl-noasn/lib
make clean
make ext-sign-test WOLFSSL_PREFIX=$HOME/wolfssl-noasn PKG_CONFIG=false

- name: External signer only (WOLFCOSE_NO_LOCAL_SIGN)
run: |
export LD_LIBRARY_PATH=$HOME/wolfssl-noasn/lib
make no-local-sign-test WOLFSSL_PREFIX=$HOME/wolfssl-noasn PKG_CONFIG=false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ experimental-check.err
tests/test_wolfcose
tests/test_wolfcose_eat_psa
tests/test_wolfcose_eat_psa_limits
tests/test_no_local_sign
tools/wolfcose_tool
examples/lifecycle_demo
tests/interop/t_cose/interop_tcose
Expand Down
33 changes: 30 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ SCEN_IOTFLEET = examples/scenarios/iot_fleet_config
SCEN_SENSOR = examples/scenarios/sensor_attestation
SCEN_BROADCAST = examples/scenarios/group_broadcast_mac

.PHONY: all shared test pkg-config-test ecdsa-policy-test rsapss-policy-test countersign-config-test zero-alloc-check force-zero-check zeroize-test deprecated-algs-test ecc-import-policy-test ext-sign-test ext-sign-demo ext-sign-force-failure coverage eat-psa-test eat-psa-float-test eat-psa-min-buffers-test eat-psa-claim-limits-test eat-psa-profile-test eat-psa-config-check eat-psa-ext-sign-test eat-psa-ext-sign-force-failure eat-psa-coverage eat-psa-coverage-force-failure hpke-coverage-force-failure generic-reduced-alg-test tool tool-test cmdline-test demo demos hpke-demo lean-verify psa-eat-lean-verify psa-eat-demo mldsa-demo mldsa-verify lms-demo lms-verify comprehensive scenarios release-scenarios release-coverage cxx-check valgrind-check release-validate release-artifacts interop-tcose tcose-upstream interop-go-cose interop-python-cwt interop-rust-coset c99-check c99-check-lms c99-hpke-check experimental-check clean FORCE
.PHONY: all shared test pkg-config-test ecdsa-policy-test rsapss-policy-test countersign-config-test zero-alloc-check force-zero-check zeroize-test deprecated-algs-test ecc-import-policy-test ext-sign-test no-local-sign-test ext-sign-demo ext-sign-force-failure coverage eat-psa-test eat-psa-float-test eat-psa-min-buffers-test eat-psa-claim-limits-test eat-psa-profile-test eat-psa-config-check eat-psa-ext-sign-test eat-psa-ext-sign-force-failure eat-psa-coverage eat-psa-coverage-force-failure hpke-coverage-force-failure generic-reduced-alg-test tool tool-test cmdline-test demo demos hpke-demo lean-verify psa-eat-lean-verify psa-eat-demo mldsa-demo mldsa-verify lms-demo lms-verify comprehensive scenarios release-scenarios release-coverage cxx-check valgrind-check release-validate release-artifacts interop-tcose tcose-upstream interop-go-cose interop-python-cwt interop-rust-coset c99-check c99-check-lms c99-hpke-check experimental-check clean FORCE

# --- Core library ---
all: $(LIB_A)
Expand Down Expand Up @@ -222,7 +222,8 @@ ECDSA_POLICY_NO_SUPPORT_FLAGS = $(CFLAGS) $(WOLFCOSE_POLICY_DISABLE_HPKE_FLAGS)
-UWOLFCOSE_LEAN_VERIFY_MLDSA \
-UWOLFCOSE_LEAN_MLDSA \
-UWOLFCOSE_LEAN_VERIFY_LMS \
-UWOLFCOSE_LEAN_LMS
-UWOLFCOSE_LEAN_LMS \
-UWOLFCOSE_NO_LOCAL_SIGN
ECDSA_POLICY_FLAGS = $(ECDSA_POLICY_BASE_FLAGS) \
-DWOLFSSL_ECDSA_DETERMINISTIC_K \
-DWOLFCOSE_ENABLE_DETERMINISTIC_ECDSA
Expand Down Expand Up @@ -251,6 +252,14 @@ ecdsa-policy-test:
echo "FAIL: deterministic ECDSA probe failed unexpectedly"; \
exit 1; \
fi; \
if ! $(CC) $(ECDSA_POLICY_NO_SUPPORT_FLAGS) \
-DWOLFCOSE_ENABLE_DETERMINISTIC_ECDSA \
-DWOLFCOSE_ENABLE_EXT_SIGN -DWOLFCOSE_NO_LOCAL_SIGN \
$(ECDSA_POLICY_HEADER) >"$$log_file" 2>&1; then \
cat "$$log_file"; \
echo "FAIL: external-signer-only build rejected for deterministic ECDSA"; \
exit 1; \
fi; \
if ! $(CC) $(ECDSA_POLICY_FLAGS) $(ECDSA_POLICY_HEADER) \
>"$$log_file" 2>&1; then \
cat "$$log_file"; \
Expand Down Expand Up @@ -763,6 +772,22 @@ ext-sign-test:
-o $(TEST_BIN) $(SRC) $(TEST_SRC) $(LDFLAGS) $(LDLIBS)
./$(TEST_BIN)

# --- External signer only: local signing compiled out ---
# The nm check proves the library references no wolfCrypt signing primitive,
# which a --gc-sections link would otherwise hide.
NO_LOCAL_SIGN_FLAGS = -DWOLFCOSE_ENABLE_EXT_SIGN -DWOLFCOSE_NO_LOCAL_SIGN
NO_LOCAL_SIGN_TEST_BIN = tests/test_no_local_sign
no-local-sign-test:
$(MAKE) clean
$(MAKE) $(LIB_A) EXTRA_CFLAGS='$(EXTRA_CFLAGS) $(NO_LOCAL_SIGN_FLAGS)'
$(CC) $(CFLAGS) $(NO_LOCAL_SIGN_FLAGS) -o $(NO_LOCAL_SIGN_TEST_BIN) \
tests/test_no_local_sign.c $(LIB_A) $(LDFLAGS) $(LDLIBS)
./$(NO_LOCAL_SIGN_TEST_BIN)
@if nm -u $(OBJ) | grep -E 'wc_(ecc_sign_hash|ed25519_sign_msg|ed448_sign_msg|RsaPSS_Sign_ex|MlDsaKey_SignCtx|LmsKey_Sign)$$'; then \
echo "FAIL: local signing primitive referenced"; exit 1; \
fi
@echo "PASS: no local signing primitive referenced"

eat-psa-ext-sign-test:
$(CC) $(CFLAGS) $(EAT_PSA_FULL_FLAGS) -DWOLFCOSE_ENABLE_EXT_SIGN \
-o $(TEST_BIN) $(SRC) $(TEST_SRC) $(LDFLAGS) $(LDLIBS)
Expand Down Expand Up @@ -1238,6 +1263,8 @@ c99-check:
-DWOLFCOSE_EAT_PSA_MAX_CLAIMS=10u \
-DWOLFCOSE_EAT_PSA_MAX_COMPONENT_CLAIMS=5u -fsyntax-only \
tests/test_eat_psa_limits.c
$(CC) $(C99_FLAGS) $(NO_LOCAL_SIGN_FLAGS) -fsyntax-only $(SRC) \
tests/test_no_local_sign.c
@echo "PASS: all sources conform to ISO C99 (-pedantic-errors)"

# Strict C99 gate for the LMS-gated branches and profiles. Needs an
Expand Down Expand Up @@ -1333,7 +1360,7 @@ c99-hpke-check:
# --- Cleanup ---
clean:
rm -f $(OBJ) $(TEST_BIN) $(TOOL_BIN) $(DEMO_BIN) $(ENC_DEMO) $(HPKE_DEMO) $(MAC_DEMO) \
$(EAT_PSA_TEST_BIN) $(EAT_PSA_LIMITS_TEST_BIN) \
$(EAT_PSA_TEST_BIN) $(EAT_PSA_LIMITS_TEST_BIN) $(NO_LOCAL_SIGN_TEST_BIN) \
$(EXTSIGN_DEMO) $(SIGN1_DEMO) $(LEANV_DEMO) $(EAT_LEANV_DEMO) \
$(EAT_DEMO) $(MLDSA_DEMO) $(MLDSAV_DEMO) $(LMS_DEMO) $(LMSV_DEMO) $(CXX_SMOKE) \
$(COMP_SIGN) $(COMP_ENCRYPT) $(COMP_MAC) $(COMP_ERRORS) \
Expand Down
11 changes: 11 additions & 0 deletions docs/Macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ encryption.
| Define | Description | Default |
|--------|-------------|---------|
| `WOLFCOSE_ENABLE_EXT_SIGN` | Opt in `wc_CoseKey_SetExtSigner()`, which delegates signing to a caller-supplied callback | off |
| `WOLFCOSE_NO_LOCAL_SIGN` | Compile out every local wolfCrypt signing call (`wc_ecc_sign_hash`, `wc_ed25519_sign_msg`, RSA-PSS, ML-DSA, HSS-LMS) so only the callback signs. Requires `WOLFCOSE_ENABLE_EXT_SIGN` | off |

Off in every build unless explicitly enabled, lean or not. Resolved internally as the read-only `WOLFCOSE_EXT_SIGN` gate.

Expand All @@ -432,6 +433,14 @@ It returns the raw COSE signature; wolfCOSE checks the returned length against t

A delegated key needs no local *private* key, but it must declare enough for wolfCOSE to know the expected signature length: ES* and ML-DSA need nothing beyond `alg`; EdDSA needs `kty`/`crv`; PS* needs `kty` plus a local `RsaKey` attached via `wc_CoseKey_SetRsa()` for its modulus size; HSS-LMS needs an initialized `LmsKey` attached via `wc_CoseKey_SetLms()`, because its length follows the key's parameter set.

With `WOLFCOSE_NO_LOCAL_SIGN`, a key without a signer is rejected with `WOLFCOSE_E_COSE_KEY_TYPE` even if it holds private material, and the signing primitives are not linked. Use it when every key lives behind the callback:

```bash
make EXTRA_CFLAGS="-DWOLFCOSE_ENABLE_EXT_SIGN -DWOLFCOSE_NO_LOCAL_SIGN"
```

`WOLFCOSE_ENABLE_DETERMINISTIC_ECDSA` does not apply to such a build, so the wolfSSL backend need not support deterministic signing. `make no-local-sign-test` covers the option: ES256 Sign1, Sign and countersignatures and Ed25519 Sign1 through the callback, the refusal of local private keys, and a check that no signing primitive is linked. The main test suites sign with local keys, so they stop with an error under it.

Pass a NULL callback to detach. Attaching local key material with `wc_CoseKey_SetEcc()` and friends detaches implicitly, so always call `wc_CoseKey_SetExtSigner()` last. `wc_CoseKey_Decode()` is rejected on a key that has a signer attached, rather than silently importing private material and signing locally with it.

For a key that has no local wolfCrypt object at all, set `kty` (and `crv` for EdDSA) on the `WOLFCOSE_KEY` directly before attaching the signer — there is no setter for declaring a key type without attaching one.
Expand Down Expand Up @@ -638,6 +647,8 @@ wolfCOSE requires these wolfSSL features for full functionality:
| `HAVE_HKDF` | ECDH-ES key derivation |
| `HAVE_HPKE` + `HAVE_ECC` P-256 + SHA-256 + `HAVE_AESGCM` | Experimental COSE-HPKE P0 |

wolfSSL built with `NO_ASN` (`--enable-asn=no`) is supported for ECDSA signing and verification: `wc_ecc_sign_hash` and `wc_ecc_verify_hash` then use the fixed-width `r || s` form COSE needs, so wolfCOSE skips the DER conversion and does not link `wc_ecc_sig_to_rs` or `wc_ecc_rs_raw_to_sig`. The COSE signature encoding is the same as in an ASN build; signatures are byte-for-byte identical only with deterministic ECDSA, since a random nonce differs per run.

---

## Test and Example Gates
Expand Down
18 changes: 8 additions & 10 deletions include/wolfcose/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -527,17 +527,10 @@ extern "C" {
#error "wolfCOSE RSA-PSS key validation requires WOLFSSL_EXPORT_INT"
#endif

/* The local ECDSA signing path converts a wolfCrypt DER signature to the
* fixed-width COSE representation. NO_ASN is supported for verification
* builds only. */
#if defined(NO_ASN) && defined(WOLFCOSE_HAVE_ECDSA) && \
(defined(WOLFCOSE_SIGN1_SIGN) || defined(WOLFCOSE_SIGN_SIGN))
#error "wolfCOSE ECDSA signing requires ASN support"
#endif

/* Optional RFC 6979 deterministic ECDSA signing. */
/* Optional RFC 6979 deterministic ECDSA signing; an external-signer-only
* build never signs locally, so the backend need not support it. */
#if defined(WOLFCOSE_ENABLE_DETERMINISTIC_ECDSA) && \
defined(WOLFCOSE_HAVE_ECDSA) && \
defined(WOLFCOSE_HAVE_ECDSA) && !defined(WOLFCOSE_NO_LOCAL_SIGN) && \
(defined(WOLFCOSE_SIGN1_SIGN) || defined(WOLFCOSE_SIGN_SIGN) || \
defined(WOLFCOSE_COUNTERSIGN_SIGN)) && \
!defined(WOLFCOSE_HAVE_DETERMINISTIC_ECDSA)
Expand Down Expand Up @@ -1031,6 +1024,11 @@ extern "C" {
#error "WOLFCOSE_ENABLE_EXT_SIGN needs a signing op, which needs at least one local signature algorithm; the LEAN_VERIFY profiles are incompatible"
#endif

/* WOLFCOSE_NO_LOCAL_SIGN: every signature comes from the external signer. */
#if defined(WOLFCOSE_NO_LOCAL_SIGN) && !defined(WOLFCOSE_EXT_SIGN)
#error "WOLFCOSE_NO_LOCAL_SIGN requires WOLFCOSE_ENABLE_EXT_SIGN"
#endif

#ifdef __cplusplus
}
#endif
Expand Down
6 changes: 6 additions & 0 deletions src/wolfcose_countersign.c
Original file line number Diff line number Diff line change
Expand Up @@ -676,9 +676,13 @@ static int wolfCose_CounterSignTbs(WOLFCOSE_KEY* key, int32_t alg,
*sigLen = 0u;
}
#if defined(WOLFCOSE_EXT_SIGN)
#if !defined(WOLFCOSE_NO_LOCAL_SIGN)
if ((ret == WOLFCOSE_SUCCESS) && (key->signCb == NULL) && (rng == NULL)) {
ret = WOLFCOSE_E_INVALID_ARG;
}
#else
(void)rng;
#endif
#else
if ((ret == WOLFCOSE_SUCCESS) && (rng == NULL)) {
ret = WOLFCOSE_E_INVALID_ARG;
Expand Down Expand Up @@ -707,6 +711,7 @@ static int wolfCose_CounterSignTbs(WOLFCOSE_KEY* key, int32_t alg,
}
else
#endif
#ifndef WOLFCOSE_NO_LOCAL_SIGN
#ifdef WOLFCOSE_HAVE_ECDSA
if ((ret == WOLFCOSE_SUCCESS) && (wolfCose_AlgIsEcdsa(alg) != 0)) {
enum wc_HashType hashType = WC_HASH_TYPE_NONE;
Expand Down Expand Up @@ -878,6 +883,7 @@ static int wolfCose_CounterSignTbs(WOLFCOSE_KEY* key, int32_t alg,
}
else
#endif
#endif /* !WOLFCOSE_NO_LOCAL_SIGN */
if (ret == WOLFCOSE_SUCCESS) {
ret = WOLFCOSE_E_COSE_BAD_ALG;
}
Expand Down
24 changes: 20 additions & 4 deletions src/wolfcose_ecc.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
/* ----- Internal: ECC DER <-> raw r||s conversion ----- */

#ifdef WOLFCOSE_HAVE_ECDSA
#if defined(WOLFCOSE_SIGN1_SIGN) || defined(WOLFCOSE_SIGN_SIGN) || \
defined(WOLFCOSE_COUNTERSIGN_SIGN)
#if (defined(WOLFCOSE_SIGN1_SIGN) || defined(WOLFCOSE_SIGN_SIGN) || \
defined(WOLFCOSE_COUNTERSIGN_SIGN)) && !defined(WOLFCOSE_NO_LOCAL_SIGN)
int wolfCose_EccSignRaw(const uint8_t* hash, size_t hashLen,
uint8_t* sigBuf, size_t* sigLen,
size_t coordSz, enum wc_HashType hashType,
Expand All @@ -59,8 +59,10 @@ int wolfCose_EccSignRaw(const uint8_t* hash, size_t hashLen,
int ret;
uint8_t derSig[ECC_MAX_SIG_SIZE];
word32 derSigLen = (word32)sizeof(derSig);
#ifndef NO_ASN
word32 rLen;
word32 sLen;
#endif
#ifdef WOLFCOSE_HAVE_DETERMINISTIC_ECDSA
byte savedDeterministic = 0u;
enum wc_HashType savedHashType = WC_HASH_TYPE_NONE;
Expand All @@ -85,7 +87,7 @@ int wolfCose_EccSignRaw(const uint8_t* hash, size_t hashLen,
(void)hashType;
ret = WOLFCOSE_SUCCESS;
#endif
/* Sign producing DER-encoded signature */
/* DER-encoded signature, or fixed-width r||s under NO_ASN */
if (ret == WOLFCOSE_SUCCESS) {
INJECT_FAILURE(WOLF_FAIL_ECC_SIGN, -1,
ret = wc_ecc_sign_hash(hash, (word32)hashLen, derSig,
Expand All @@ -94,6 +96,19 @@ int wolfCose_EccSignRaw(const uint8_t* hash, size_t hashLen,
ret = WOLFCOSE_E_CRYPTO;
}
}
#ifdef NO_ASN
/* Older wolfCrypt releases write 2 * curve size without checking
* outlen, so sign into the local buffer and copy out an exact fit. */
if (ret == WOLFCOSE_SUCCESS) {
if ((size_t)derSigLen != (coordSz * 2u)) {
ret = WOLFCOSE_E_CRYPTO;
}
else {
(void)XMEMCPY(sigBuf, derSig, coordSz * 2u);
*sigLen = coordSz * 2u;
}
}
#else
if (ret == WOLFCOSE_SUCCESS) {
/* Extract raw r and s from DER */
rLen = (word32)coordSz;
Expand Down Expand Up @@ -127,6 +142,7 @@ int wolfCose_EccSignRaw(const uint8_t* hash, size_t hashLen,
*sigLen = coordSz * 2u;
}
}
#endif /* NO_ASN */
(void)wolfCose_ForceZero(derSig, sizeof(derSig));
#ifdef WOLFCOSE_HAVE_DETERMINISTIC_ECDSA
(void)wc_ecc_set_deterministic_ex(eccKey, savedDeterministic,
Expand All @@ -135,7 +151,7 @@ int wolfCose_EccSignRaw(const uint8_t* hash, size_t hashLen,
}
return ret;
}
#endif /* signature creation */
#endif /* signature creation && !WOLFCOSE_NO_LOCAL_SIGN */

int wolfCose_EccVerifyRaw(const uint8_t* sigBuf, size_t sigLen,
const uint8_t* hash, size_t hashLen,
Expand Down
9 changes: 5 additions & 4 deletions src/wolfcose_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,8 @@ WOLFCOSE_LOCAL int wolfCose_HmacType(int32_t alg,
#ifdef WOLFCOSE_HAVE_ECDSA
/**
* \brief Sign a hash with ECC, producing raw r||s output.
* Wraps wolfCrypt DER signature -> fixed-width r||s conversion.
* Converts the wolfCrypt DER signature to fixed-width r||s; a
* NO_ASN wolfCrypt already returns r||s.
* \param hash Hash to sign.
* \param hashLen Hash length.
* \param sigBuf Output: raw r||s signature.
Expand All @@ -462,14 +463,14 @@ WOLFCOSE_LOCAL int wolfCose_HmacType(int32_t alg,
* \param eccKey Caller-owned ECC key with private key.
* \return WOLFCOSE_SUCCESS or negative error code.
*/
#if defined(WOLFCOSE_SIGN1_SIGN) || defined(WOLFCOSE_SIGN_SIGN) || \
defined(WOLFCOSE_COUNTERSIGN_SIGN)
#if (defined(WOLFCOSE_SIGN1_SIGN) || defined(WOLFCOSE_SIGN_SIGN) || \
defined(WOLFCOSE_COUNTERSIGN_SIGN)) && !defined(WOLFCOSE_NO_LOCAL_SIGN)
WOLFCOSE_LOCAL int wolfCose_EccSignRaw(const uint8_t* hash, size_t hashLen,
uint8_t* sigBuf, size_t* sigLen,
size_t coordSz,
enum wc_HashType hashType,
WC_RNG* rng, ecc_key* eccKey);
#endif /* WOLFCOSE_SIGN1_SIGN || WOLFCOSE_SIGN_SIGN || COUNTERSIGN_SIGN */
#endif /* signature creation && !WOLFCOSE_NO_LOCAL_SIGN */


/**
Expand Down
2 changes: 2 additions & 0 deletions src/wolfcose_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,11 @@ int wolfCose_KeyCanSign(const WOLFCOSE_KEY* key)
{
int can = 0;

#ifndef WOLFCOSE_NO_LOCAL_SIGN
if (key->hasPrivate == 1u) {
can = 1;
}
#endif
#if defined(WOLFCOSE_EXT_SIGN)
if (key->signCb != NULL) {
can = 1;
Expand Down
Loading
Loading