Go to the documentation of this file.
32 #define TRACE_LEVEL CRYPTO_TRACE_LEVEL
40 #if (MLDSA44_SUPPORT == ENABLED || MLDSA65_SUPPORT == ENABLED || \
41 MLDSA87_SUPPORT == ENABLED)
47 const uint8_t
MLDSA44_OID[9] = {0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x03, 0x11};
49 const uint8_t
MLDSA65_OID[9] = {0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x03, 0x12};
51 const uint8_t
MLDSA87_OID[9] = {0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x03, 0x13};
117 if(key->
seed != NULL)
145 const uint8_t *input,
size_t length)
150 if(key == NULL || input == NULL)
153 #if (MLDSA44_SUPPORT == ENABLED)
162 #if (MLDSA65_SUPPORT == ENABLED)
171 #if (MLDSA87_SUPPORT == ENABLED)
234 if(key != NULL && written != NULL)
248 *written = key->
pkLen;
277 const uint8_t *input,
size_t length)
282 if(key == NULL || input == NULL)
285 #if (MLDSA44_SUPPORT == ENABLED)
294 #if (MLDSA65_SUPPORT == ENABLED)
303 #if (MLDSA87_SUPPORT == ENABLED)
366 if(key != NULL && written != NULL)
380 *written = key->
skLen;
409 const uint8_t *input,
size_t length)
414 if(key == NULL || input == NULL)
417 #if (MLDSA44_SUPPORT == ENABLED)
426 #if (MLDSA65_SUPPORT == ENABLED)
435 #if (MLDSA87_SUPPORT == ENABLED)
455 if(key->
seed != NULL)
466 if(key->
seed == NULL)
498 if(key != NULL && written != NULL)
543 size_t messageLen,
const void *context, uint8_t contextLen,
546 #if (MLDSA44_SUPPORT == ENABLED)
551 status = OQS_SIG_ml_dsa_44_sign_with_ctx_str(signature, &signatureLen,
message,
552 messageLen, context, contextLen, secretKey);
575 size_t messageLen,
const void *context, uint8_t contextLen,
578 #if (MLDSA65_SUPPORT == ENABLED)
583 status = OQS_SIG_ml_dsa_65_sign_with_ctx_str(signature, &signatureLen,
message,
584 messageLen, context, contextLen, secretKey);
605 size_t messageLen,
const void *context, uint8_t contextLen,
608 #if (MLDSA87_SUPPORT == ENABLED)
613 status = OQS_SIG_ml_dsa_87_sign_with_ctx_str(signature, &signatureLen,
message,
614 messageLen, context, contextLen, secretKey);
637 size_t messageLen,
const void *context, uint8_t contextLen,
638 const uint8_t *signature)
640 #if (MLDSA44_SUPPORT == ENABLED)
644 status = OQS_SIG_ml_dsa_44_verify_with_ctx_str(
message, messageLen, signature,
668 size_t messageLen,
const void *context, uint8_t contextLen,
669 const uint8_t *signature)
671 #if (MLDSA65_SUPPORT == ENABLED)
675 status = OQS_SIG_ml_dsa_65_verify_with_ctx_str(
message, messageLen, signature,
699 size_t messageLen,
const void *context, uint8_t contextLen,
700 const uint8_t *signature)
702 #if (MLDSA87_SUPPORT == ENABLED)
706 status = OQS_SIG_ml_dsa_87_verify_with_ctx_str(
message, messageLen, signature,
error_t mldsaImportPrivateKey(MldsaPrivateKey *key, uint_t level, const uint8_t *input, size_t length)
Import an ML-DSA private key.
const uint8_t MLDSA44_OID[9]
error_t mldsaExportPrivateKey(const MldsaPrivateKey *key, uint8_t *output, size_t *written)
Export an ML-DSA private key.
error_t mldsa87VerifySignature(const uint8_t *publicKey, const void *message, size_t messageLen, const void *context, uint8_t contextLen, const uint8_t *signature)
ML-DSA-87 signature verification.
void mldsaInitPublicKey(MldsaPublicKey *key)
Initialize an ML-DSA public key.
#define MLDSA65_SIGNATURE_LEN
const uint8_t MLDSA65_OID[9]
void mldsaFreePrivateKey(MldsaPrivateKey *key)
Release an ML-DSA private key.
void mldsaFreePublicKey(MldsaPublicKey *key)
Release an ML-DSA public key.
error_t mldsa87GenerateSignature(const uint8_t *secretKey, const void *message, size_t messageLen, const void *context, uint8_t contextLen, uint8_t *signature)
ML-DSA-87 signature generation.
error_t mldsaImportSeed(MldsaPrivateKey *key, uint_t level, const uint8_t *input, size_t length)
Import an ML-DSA seed.
error_t mldsaExportSeed(const MldsaPrivateKey *key, uint8_t *output, size_t *written)
Export an ML-DSA seed.
uint_t level
Security level.
#define MLDSA87_SECURITY_LEVEL
error_t mldsa65VerifySignature(const uint8_t *publicKey, const void *message, size_t messageLen, const void *context, uint8_t contextLen, const uint8_t *signature)
ML-DSA-65 signature verification.
#define MLDSA65_SECURITY_LEVEL
#define MLDSA65_PRIVATE_KEY_LEN
#define MLDSA44_SECURITY_LEVEL
size_t seedLen
Length of the seed, in bytes.
@ ERROR_INVALID_PARAMETER
Invalid parameter.
#define osMemcpy(dest, src, length)
@ ERROR_FAILURE
Generic error code.
error_t mldsaExportPublicKey(const MldsaPublicKey *key, uint8_t *output, size_t *written)
Export an ML-DSA public key.
#define MLDSA44_SIGNATURE_LEN
General definitions for cryptographic algorithms.
ML-DSA (Edwards-Curve Digital Signature Algorithm)
#define MLDSA44_PUBLIC_KEY_LEN
void mldsaInitPrivateKey(MldsaPrivateKey *key)
Initialize an ML-DSA private key.
#define MLDSA44_PRIVATE_KEY_LEN
size_t pkLen
Length of the public key, in bytes.
#define MLDSA65_PUBLIC_KEY_LEN
error_t mldsa65GenerateSignature(const uint8_t *secretKey, const void *message, size_t messageLen, const void *context, uint8_t contextLen, uint8_t *signature)
ML-DSA-65 signature generation.
#define cryptoAllocMem(size)
size_t skLen
Length of the secret key, in bytes.
error_t mldsa44VerifySignature(const uint8_t *publicKey, const void *message, size_t messageLen, const void *context, uint8_t contextLen, const uint8_t *signature)
ML-DSA-44 signature verification.
const uint8_t MLDSA87_OID[9]
#define osMemset(p, value, length)
uint_t level
Security level.
error_t mldsa44GenerateSignature(const uint8_t *secretKey, const void *message, size_t messageLen, const void *context, uint8_t contextLen, uint8_t *signature)
ML-DSA-44 signature generation.
@ ERROR_INVALID_SIGNATURE
error_t mldsaImportPublicKey(MldsaPublicKey *key, uint_t level, const uint8_t *input, size_t length)
Import an ML-DSA public key.
#define MLDSA87_PUBLIC_KEY_LEN
#define MLDSA87_SIGNATURE_LEN
#define MLDSA87_PRIVATE_KEY_LEN