EVP_MD-ML-DSA-MU(7SSL)
π EVP_MD-ML-DSA-MU β the ML-DSA-MU EVP_MD implementation π
okay so bestie, this is the EVP_MD-ML-DSA-MU(7SSL) page from the OpenSSL manual, and it's genuinely so cool. let's get into it π«Ά
β¨ NAME β¨
EVP_MD-ML-DSA-MU β the ML-DSA-MU EVP_MD implementation π
πΈ DESCRIPTION πΈ
So basically this gives you support for computing the value of external mu for ML-DSA using the EVP_MD API. iconic.
Normally the value of "mu" gets calculated internally, as part of an ML-DSA sign or verify operation β like it just happens, no thoughts. And "mu" is defined as:
mu = SHAKE256(tr || M', 64)
Where tr is the hash of the encoded public key, and, for Pure (ML-DSA):
M' = 0x00 || ctx_len || ctx || message
Now, in cases where prehashing the message is required, FIPS 204 says it's fine to do the "mu" calculation externally, and then pass that "mu" into ML-DSA sign or verify operations. slay.
PreHash (HASH-ML-DSA) is also supported and uses:
M' = 0x01 || ctx_len || ctx || OID || HashedMessage
The output "mu" value can then be supplied as an input to EVP_SIGNATURE-ML-DSA(7) using the ML-DSA Signature Parameter OSSL_SIGNATURE_PARAM_MU (i.e. "mu"). β¨ This lets larger messages get hashed (or hidden) before they're passed to pure ML-DSA sign or verify operations. the way that just works.
π Identities π
This implementation is available with the FIPS provider as well as the default provider, and it's identified with the name "ML-DSA-MU".
π¦ Parameters π¦
This implementation supports the following settable OSSL_PARAM(3) parameters:
"pub"(OSSL_DIGEST_PARAM_MU_PUB_KEY)<octet string>β An ML-DSA encoded public key value of size1312,1952or2592bytes, depending on the respective key type of ML-DSA-44, ML-DSA-65 or ML-DSA-87. You can retrieve this from anEVP_PKEY-ML-DSA(7)key by callingEVP_PKEY_get_octet_string_param(key, OSSL_PKEY_PARAM_PUB_KEY, pub, sizeof(pub), &publen). This parameter MUST be set or an error will occur β no cap, it's mandatory bestie π¨"context-string"(OSSL_DIGEST_PARAM_MU_CONTEXT_STRING)<octet string>β An optional string of octets with length at most255. By default it's the empty string."digest"(OSSL_DIGEST_PARAM_MU_DIGEST)<utf8 string>β An optional parameter related to"HASH-ML-DSA". If used, it determines the OID in the definition of PreHashM'above.
When this parameter is not specified, pure ML-DSA "mu" is computed, and the input data is expected to be the full message. Otherwise the input data must be the result of prehashing the message with the corresponding digest algorithm.
The HASH-ML-DSA variant is available to enable specialised use-cases, in which signing the full message with pure ML-DSA is not practical, and the external-mu API is a viable alternative. HASH-ML-DSA is not used in protocols such as X509 & CMS (See RFC 9981 and 9982), and is not presently implemented as an independent OpenSSL signature algorithm. iykyk.
It is the users responsibility to chose a digest that has the minimum required security strength. To match the security category for ML-DSA-44, ML-DSA-65 and ML-DSA-87 the user should chose a digest that has a security strength of at least 128 bits, 192 bits and 256 bits respectively.
OpenSSL accepts the following digest names:
"SHA-224"and"SHA3-224"β These digests have a security strength of112bits."SHA-256"and"SHA3-256"β These digests have a security strength of128bits."SHA-384"and"SHA3-384"β These digests have a security strength of192bits."SHA-512"and"SHA3-512"β These digests have a security strength of256bits."SHAKE-128"and"SHAKE-256"β For SHAKE-128 and SHAKE-256 the expected XOF digest lengths are32and64respectively, which correspond to a security strength of128and256bits respectively.
The total size of the "HashedMessage" passed to EVP_DigestUpdate() MUST match the size of the digest. π
"properties"(OSSL_DIGEST_PARAM_MU_PROPERTIES)<utf8 string>β Sets the properties to be queried when trying to fetch the underlying digest.
β Gettable Parameters β
This implementation supports the common gettable parameters described in EVP_MD-common(7). easy.
π CONFORMING TO π
FIPS 204 and https://csrc.nist.gov/csrc/media/Projects/post-quantum-cryptography/documents/faq/fips204-sec6-03192025.pdf
π EXAMPLES π
To generate external 'mu' given an existing ML-DSA key and a large message:
calculate_mu(EVP_PKEY *pkey, const unsigned char *msg, size_t msglen,
const unsigned char *ctx, size_t ctxlen, unsigned char mu[64])
{
unsigned char pub[2592];
size_t publen = 0, chunk;
OSSL_PARAM params[4], *p = params;
/* Retrieve the ML-DSA encoded public key */
EVP_PKEY_get_octet_string_param(pkey, OSSL_PKEY_PARAM_PUB_KEY,
pub, sizeof(pub), &publen);
*p++ = OSSL_PARAM_construct_octet_string(OSSL_DIGEST_PARAM_MU_PUB_KEY, pub, publen);
/* This is an optional parameter */
if (ctx != NULL && ctxlen != 0)
*p++ = OSSL_PARAM_construct_octet_string(OSSL_DIGEST_PARAM_MU_CONTEXT_STRING, ctx, ctxlen);
/*
* Optionally we could also set the digest name for HASH-ML-DSA
* *p++ = OSSL_PARAM_construct_utf8_string(OSSL_DIGEST_PARAM_MU_DIGEST, "SHA-512", 0);
*/
*p = OSSL_PARAM_construct_end();
mdctx = EVP_MD_CTX_new();
md = EVP_MD_fetch(libctx, "ML-DSA-MU", NULL);
EVP_DigestInit_ex2(mdctx, md, params);
/* Call EVP_DigestUpdate() multiple times to stream the message */
while (msglen != 0) {
/* Account for the last chunk being less than 64 */
chunk = (msglen >= 64) ? 64 : msglen;
EVP_DigestUpdate(mdctx, msg, chunk);
msg += chunk;
msglen -= chunk;
}
EVP_DigestFinalXOF(mdctx, mu, sizeof(mu))
}
like look at that streaming loop, main character energy fr π₯
π«Ά SEE ALSO π«Ά
EVP_SIGNATURE-ML-DSA(7), EVP_PKEY-ML-DSA(7), provider-digest(7), OSSL_PROVIDER-FIPS(7), OSSL_PROVIDER-default(7)
π HISTORY π
The ML-DSA-MU pseudo-digest was added in OpenSSL 4.0.0. new era behavior β¨
π COPYRIGHT π
Copyright 2025-2026 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
and that's the whole page bestie π you just read the OpenSSL 4.0.3 documentation for EVP_MD-ML-DSA-MU(7SSL), dated 2026-09-29. go forth and compute some external mu, you ate π
πΈβ¨
π¦ where this page comes from
- ubuntu stonking: openssl 4.0.3-1ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms