Rename flag to ML_DSA_NO_CTX_ENABLED
parent
408ac74e9a
commit
afcebbf946
|
|
@ -504,7 +504,7 @@ def build_ffi(local_wolfssl, features):
|
|||
int CHACHA20_POLY1305_ENABLED = {features["CHACHA20_POLY1305"]};
|
||||
int ML_KEM_ENABLED = {features["ML_KEM"]};
|
||||
int ML_DSA_ENABLED = {features["ML_DSA"]};
|
||||
int ML_DSA_NO_CTX = {features["ML_DSA_NO_CTX"]};
|
||||
int ML_DSA_NO_CTX_ENABLED = {features["ML_DSA_NO_CTX"]};
|
||||
int HKDF_ENABLED = {features["HKDF"]};
|
||||
"""
|
||||
|
||||
|
|
@ -546,7 +546,7 @@ def build_ffi(local_wolfssl, features):
|
|||
extern int CHACHA20_POLY1305_ENABLED;
|
||||
extern int ML_KEM_ENABLED;
|
||||
extern int ML_DSA_ENABLED;
|
||||
extern int ML_DSA_NO_CTX;
|
||||
extern int ML_DSA_NO_CTX_ENABLED;
|
||||
extern int HKDF_ENABLED;
|
||||
|
||||
typedef unsigned char byte;
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ if _lib.ML_DSA_ENABLED:
|
|||
ctx = b"This is a test context for ML-DSA signature"
|
||||
wrong_ctx = b"This is a wrong context for ML-DSA signature"
|
||||
|
||||
if _lib.ML_DSA_NO_CTX:
|
||||
if _lib.ML_DSA_NO_CTX_ENABLED:
|
||||
signature = mldsa_priv.sign(message, rng)
|
||||
assert len(signature) == mldsa_priv.sig_size
|
||||
|
||||
|
|
@ -153,11 +153,11 @@ if _lib.ML_DSA_ENABLED:
|
|||
# Verify the signature by MlDsaPublic
|
||||
assert mldsa_pub.verify(signature, message, ctx=ctx)
|
||||
|
||||
if _lib.ML_DSA_NO_CTX:
|
||||
if _lib.ML_DSA_NO_CTX_ENABLED:
|
||||
# Verify but do not provide a context
|
||||
assert not mldsa_pub.verify(signature, message, ctx=None)
|
||||
|
||||
if not _lib.ML_DSA_NO_CTX:
|
||||
if not _lib.ML_DSA_NO_CTX_ENABLED:
|
||||
with pytest.raises(WolfCryptError):
|
||||
mldsa_priv.sign(message)
|
||||
with pytest.raises(WolfCryptError):
|
||||
|
|
@ -168,7 +168,7 @@ if _lib.ML_DSA_ENABLED:
|
|||
# Verify with wrong context
|
||||
assert not mldsa_pub.verify(signature, message, ctx=wrong_ctx)
|
||||
|
||||
@pytest.mark.skipif(not _lib.ML_DSA_NO_CTX, reason="Requires support for signing without context")
|
||||
@pytest.mark.skipif(not _lib.ML_DSA_NO_CTX_ENABLED, reason="Requires support for signing without context")
|
||||
def test_sign_with_seed(mldsa_type, rng):
|
||||
signature_seed = rng.bytes(ML_DSA_SIGNATURE_SEED_LENGTH)
|
||||
mldsa_priv = MlDsaPrivate.make_key(mldsa_type, rng)
|
||||
|
|
|
|||
|
|
@ -2265,7 +2265,7 @@ if _lib.ML_DSA_ENABLED:
|
|||
)
|
||||
if ret < 0: # pragma: no cover
|
||||
raise WolfCryptApiError("wc_dilithium_verify_ctx_msg() error", ret)
|
||||
elif not _lib.ML_DSA_NO_CTX:
|
||||
elif not _lib.ML_DSA_NO_CTX_ENABLED:
|
||||
raise WolfCryptError("support for verifying without context is disabled")
|
||||
else:
|
||||
ret = _lib.wc_dilithium_verify_msg(
|
||||
|
|
@ -2444,7 +2444,7 @@ if _lib.ML_DSA_ENABLED:
|
|||
)
|
||||
if ret < 0: # pragma: no cover
|
||||
raise WolfCryptApiError("wc_dilithium_sign_ctx_msg() error", ret)
|
||||
elif not _lib.ML_DSA_NO_CTX:
|
||||
elif not _lib.ML_DSA_NO_CTX_ENABLED:
|
||||
raise WolfCryptError("support for signing without context is disabled")
|
||||
else:
|
||||
ret = _lib.wc_dilithium_sign_msg(
|
||||
|
|
@ -2511,7 +2511,7 @@ if _lib.ML_DSA_ENABLED:
|
|||
)
|
||||
if ret < 0: # pragma: no cover
|
||||
raise WolfCryptApiError("wc_dilithium_sign_ctx_msg_with_seed() error", ret)
|
||||
elif not _lib.ML_DSA_NO_CTX:
|
||||
elif not _lib.ML_DSA_NO_CTX_ENABLED:
|
||||
raise WolfCryptError("support for signing without context is disabled")
|
||||
else:
|
||||
ret = _lib.wc_dilithium_sign_msg_with_seed(
|
||||
|
|
|
|||
Loading…
Reference in New Issue