Compare commits
8 Commits
v5.9.2-sta
...
master
| Author | SHA1 | Date |
|---|---|---|
|
|
cb9885ba53 | |
|
|
d4b8fbad0e | |
|
|
58520ace10 | |
|
|
e1bdcab5ea | |
|
|
ef980e4d09 | |
|
|
b297f8a00b | |
|
|
2fea30cd32 | |
|
|
8bb46362b7 |
|
|
@ -144,8 +144,8 @@ ML-DSA
|
|||
>>>
|
||||
>>> msg = b"This is an example message"
|
||||
>>>
|
||||
>>> sig = mldsa_priv.sign(msg)
|
||||
>>> mldsa_pub.verify(sig, msg)
|
||||
>>> sig = mldsa_priv.sign(msg, ctx=b"")
|
||||
>>> mldsa_pub.verify(sig, msg, ctx=b"")
|
||||
True
|
||||
>>>
|
||||
>>> ######## Export and Import Keys
|
||||
|
|
@ -160,6 +160,6 @@ True
|
|||
>>> mldsa_pub2 = MlDsaPublic(mldsa_type)
|
||||
>>> mldsa_pub2.decode_key(exported_pub_key)
|
||||
>>>
|
||||
>>> sig2 = mldsa_priv2.sign(msg)
|
||||
>>> mldsa_pub2.verify(sig2, msg)
|
||||
>>> sig2 = mldsa_priv2.sign(msg, ctx=b"")
|
||||
>>> mldsa_pub2.verify(sig2, msg, ctx=b"")
|
||||
True
|
||||
|
|
@ -31,7 +31,9 @@ dependencies = [
|
|||
Homepage = "https://github.com/wolfssl/wolfcrypt-py"
|
||||
|
||||
[build-system]
|
||||
requires = ["setuptools", "cffi>=1.17"]
|
||||
# setuptools >= 77 is required for the PEP 639 `license` expression and
|
||||
# `license-files` above; 76 and older reject them.
|
||||
requires = ["setuptools>=77", "cffi>=1.17"]
|
||||
build-backend = "setuptools.build_meta:__legacy__"
|
||||
|
||||
[dependency-groups]
|
||||
|
|
|
|||
|
|
@ -1350,7 +1350,7 @@ def build_ffi(local_wolfssl, features):
|
|||
int wc_dilithium_import_public(const byte* in, word32 inLen, dilithium_key* key);
|
||||
int wc_dilithium_sign_ctx_msg(const byte* ctx, byte ctxLen, const byte* msg, word32 msgLen, byte* sig, word32* sigLen, dilithium_key* key, WC_RNG* rng);
|
||||
int wc_dilithium_sign_ctx_msg_with_seed(const byte* ctx, byte ctxLen, const byte* msg, word32 msgLen, byte* sig, word32* sigLen, dilithium_key* key, const byte* seed);
|
||||
int wc_dilithium_verify_ctx_msg(const byte* sig, word32 sigLen, const byte* ctx, word32 ctxLen, const byte* msg, word32 msgLen, int* res, dilithium_key* key);
|
||||
int wc_dilithium_verify_ctx_msg(const byte* sig, word32 sigLen, const byte* ctx, byte ctxLen, const byte* msg, word32 msgLen, int* res, dilithium_key* key);
|
||||
typedef dilithium_key MlDsaKey;
|
||||
int wc_MlDsaKey_GetPrivLen(MlDsaKey* key, int* len);
|
||||
int wc_MlDsaKey_GetPubLen(MlDsaKey* key, int* len);
|
||||
|
|
|
|||
|
|
@ -2364,6 +2364,10 @@ if _lib.ML_DSA_ENABLED:
|
|||
|
||||
if ctx is not None:
|
||||
ctx_bytestype = t2b(ctx)
|
||||
if len(ctx_bytestype) > 255:
|
||||
raise ValueError(
|
||||
f"context length {len(ctx_bytestype)} too large: must be 255 or less"
|
||||
)
|
||||
ret = _lib.wc_dilithium_verify_ctx_msg(
|
||||
sig_bytestype,
|
||||
len(sig_bytestype),
|
||||
|
|
|
|||
Loading…
Reference in New Issue