OASIS PKCS 11 TC

 View Only
  • 1.  Questions about the "Hash ML-DSA Signature" and "Hash SLH-DSA Signature".

    Posted 02-06-2025 20:16

    For "Hash ML-DSA Signature", we have the following structure defined:

    typedef struct CK_HASH_SIGN_ADDITIONAL_CONTEXT {

      CK_HEDGE_TYPE      hedgeVariant;

      CK_BYTE_PTR        pContext;

      CK_ULONG           ulContextLen;

      CK_MECHANISM_TYPE  hash   

    } CK_HASH_SIGN_ADDITIONAL_CONTEXT;

    The "hash" field is used to specify the type of hash or XOF algorithm that was used.  The NIST specs allows any approved hash or XOF function; specifically SHAKE128/SHAKE256.  Unless I missed it, PKCS#11 v3.2 doesn't define any SHAKE128 or SHAKE256 mechanisms that support the hash operation; we only define mechanisms that support the derive operation.  Specifically CKM_SHAKE_128_KEY_DERIVATION and CKM_SHAKE_256_KEY_DERIVATION.  What is our intent here, what CKM_xxx value should be specified so that SHAKE128 or SHAKE 256 can be used?

    • Not support SHAKE128 and SHAKE256 with Hash ML-DSA?  This would seem wrong and a short coming of the spec.
    • allow these existing SHAKE derivation mechanisms to be used to specify that SHAKE is the pre-hash algorithm that was used?  This could work, but also seems odd/wrong in many ways.
    • do we need to define mechanisms for SHAKE128 or SHAKE256 that support hashing (with and/or without variable output length)?  I like this option as it is clearer/cleaner.  But this is obviously a bigger spec change.

    Other solutions?

    Thanks

    Darren



    ------------------------------
    Darren Johnson
    THALES
    ------------------------------


  • 2.  RE: Questions about the "Hash ML-DSA Signature" and "Hash SLH-DSA Signature".

    Posted 02-10-2025 05:54

    Hi Darren,

    good catch. 

    I agree that defining mechanisms for SHAKE128 and SHAKE256 is the best option. Defining at least the fixed-length variants SHAKE128(𝑀, 256) and SHAKE256(𝑀, 512) is enough to support FIPS 204 and FIPS 205, and limits the specification changes. We may then add variable-length SHAKE in a future version if needed.



    ------------------------------
    Best regards,
    Dieter
    ------------------------------



  • 3.  RE: Questions about the "Hash ML-DSA Signature" and "Hash SLH-DSA Signature".

    Posted 02-10-2025 09:31
    I am not sure we should open this box.

    For ML-DSA and SLH-DSA own implementation we do not need public SHAKE
    functions, and adding SHAKE requires thinking about how to deal with
    the fact these mechanisms need to return variable length output. I do
    not think having separate mechanisms for "fixed size" vs "arbitrary
    length" is necessarily a good thing, and I am not sure it should be
    hastily added at the last minute (lets discuss at the next meeting).

    Given that SHA3, let alone SHAKE, has not seen a lot of actual use in
    protocols except within the code of these signature algorithms, I would
    rather punt and address SHAKE comprehensively after 3.2.

    Simo.

    On Mon, 2025-02-10 at 10:53 +0000, Dieter Bong via OASIS wrote:
    > Hi Darren,
    >
    >
    > good catch.
    >
    >
    > I agree that defining mechanisms for SHAKE128 and SHAKE256 is the best option. Defining at least the fixed-length variants SHAKE128(𝑀, 256) and SHAKE256(𝑀, 512) is enough to support FIPS 204 and FIPS 205, and limits the specification changes. We may then add variable-length SHAKE in a future version if needed.
    >
    >
    > ------------------------------
    > Best regards,
    > Dieter
    > ------------------------------
    > -------------------------------------------
    > Original Message:
    > Sent: 02-06-2025 20:15
    > From: Darren Johnson
    > Subject: Questions about the "Hash ML-DSA Signature" and "Hash SLH-DSA Signature".
    >
    > For "Hash ML-DSA Signature", we have the following structure defined:
    > typedef struct CK_HASH_SIGN_ADDITIONAL_CONTEXT {
    > CK_HEDGE_TYPE hedgeVariant;
    > CK_BYTE_PTR pContext;
    > CK_ULONG ulContextLen;
    > CK_MECHANISM_TYPE hash
    > } CK_HASH_SIGN_ADDITIONAL_CONTEXT;
    >
    > The "hash" field is used to specify the type of hash or XOF algorithm that was used. The NIST specs allows any approved hash or XOF function; specifically SHAKE128/SHAKE256. Unless I missed it, PKCS#11 v3.2 doesn't define any SHAKE128 or SHAKE256 mechanisms that support the hash operation; we only define mechanisms that support the derive operation. Specifically CKM_SHAKE_128_KEY_DERIVATION and CKM_SHAKE_256_KEY_DERIVATION. What is our intent here, what CKM_xxx value should be specified so that SHAKE128 or SHAKE 256 can be used?
    > Not support SHAKE128 and SHAKE256 with Hash ML-DSA? This would seem wrong and a short coming of the spec.allow these existing SHAKE derivation mechanisms to be used to specify that SHAKE is the pre-hash algorithm that was used? This could work, but also seems odd/wrong in many ways.do we need to define mechanisms for SHAKE128 or SHAKE256 that support hashing (with and/or without variable output length)? I like this option as it is clearer/cleaner. But this is obviously a bigger spec change.Other solutions?
    >
    > Thanks
    > Darren
    >
    >
    > ------------------------------
    > Darren Johnson
    > THALES
    > ------------------------------
    >
    >
    > Reply to Sender : https://groups.oasis-open.org/eGroups/PostReply/?GroupId=2731&MID=528759&SenderKey=97d8a78d-2de9-475c-9055-018dc8275370
    >
    > Reply to Discussion : https://groups.oasis-open.org/eGroups/PostReply/?GroupId=2731&MID=528759
    >
    >
    >
    > You are subscribed to "OASIS PKCS 11 TC" as simo@redhat.com. To change your subscriptions, go to http://oasis.connectedcommunity.org/preferences?section=Subscriptions. To unsubscribe from this community discussion, go to http://oasis.connectedcommunity.org/HigherLogic/eGroups/Unsubscribe.aspx?UserKey=bc41eb59-01f8-48d1-b3ab-01910465bdb5&sKey=KeyRemoved&GroupKey=663447a7-9ffe-4dea-940e-018dce2b3da9.

    --
    Simo Sorce
    Distinguished Engineer
    RHEL Crypto Team
    Red Hat, Inc




  • 4.  RE: Questions about the "Hash ML-DSA Signature" and "Hash SLH-DSA Signature".

    Posted 02-14-2025 16:43
    On 2/10/25 6:31 AM, Simo Sorce via OASIS wrote:
    01000194f0458cc5-2224055f-1697-4986-8d78-3e381aec9332-000000@email.amazonses.com">I am not sure we should open this box.

    For ML-DSA and SLH-DSA own implementation we do not need public SHAKE
    functions, and adding SHAKE requires thinking about how to deal with
    the fact these mechanisms need to return variable length output. I do
    not think having separate mechanisms for "fixed size" vs "arbitrary
    length" is necessarily a good thing, and I am not sure it should be
    hastily added at the last minute (lets discuss at the next meeting).

    Given that SHA3, let alone SHAKE, has not seen a lot of actual use in
    protocols except within the code of these signature algorithms, I would
    rather punt and address SHAKE comprehensively after 3.2.

    Simo.

    Hi Darren,

    As Simo pointed out, Defining SHAKE is more than just defining SHAKE len, SHAKE is a prf with lots more parameters that need to defined to use it in a pure hash mode. We took a poll in the meeting and found no one needed it, so we decided to push this off to 3.3. Unfortunately, you weren't at the meeting, and as you brought it up I wanted to highlighted the decisions, so if you feel strongly about it you can push back here.


    bob

    01000194f0458cc5-2224055f-1697-4986-8d78-3e381aec9332-000000@email.amazonses.com">
    On Mon, 2025-02-10 at 10:53 +0000, Dieter Bong via OASIS wrote:
    > Hi Darren,
    >
    >
    > good catch.
    >
    >
    > I agree that defining mechanisms for SHAKE128 and SHAKE256 is the best option. Defining at least the fixed-length variants SHAKE128(��, 256) and SHAKE256(��, 512) is enough to support FIPS 204 and FIPS 205, and limits the specification changes. We may then add variable-length SHAKE in a future version if needed.
    >
    >
    > ------------------------------
    > Best regards,
    > Dieter
    > ------------------------------
    > -------------------------------------------
    > Original Message:
    > Sent: 02-06-2025 20:15
    > From: Darren Johnson
    > Subject: Questions about the "Hash ML-DSA Signature" and "Hash SLH-DSA Signature".
    >
    > For "Hash ML-DSA Signature", we have the following structure defined:
    > typedef struct CK_HASH_SIGN_ADDITIONAL_CONTEXT {
    > CK_HEDGE_TYPE hedgeVariant;
    > CK_BYTE_PTR pContext;
    > CK_ULONG ulContextLen;
    > CK_MECHANISM_TYPE hash
    > } CK_HASH_SIGN_ADDITIONAL_CONTEXT;
    >
    > The "hash" field is used to specify the type of hash or XOF algorithm that was used. The NIST specs allows any approved hash or XOF function; specifically SHAKE128/SHAKE256. Unless I missed it, PKCS#11 v3.2 doesn't define any SHAKE128 or SHAKE256 mechanisms that support the hash operation; we only define mechanisms that support the derive operation. Specifically CKM_SHAKE_128_KEY_DERIVATION and CKM_SHAKE_256_KEY_DERIVATION. What is our intent here, what CKM_xxx value should be specified so that SHAKE128 or SHAKE 256 can be used?
    > Not support SHAKE128 and SHAKE256 with Hash ML-DSA? This would seem wrong and a short coming of the spec.allow these existing SHAKE derivation mechanisms to be used to specify that SHAKE is the pre-hash algorithm that was used? This could work, but also seems odd/wrong in many ways.do we need to define mechanisms for SHAKE128 or SHAKE256 that support hashing (with and/or without variable output length)? I like this option as it is clearer/cleaner. But this is obviously a bigger spec change.Other solutions?
    >
    > Thanks
    > Darren
    >
    >
    > ------------------------------
    > Darren Johnson
    > THALES
    > ------------------------------
    >
    >
    > Reply to Sender : groups.oasis-open.org/eGroups/PostReply/...
    >
    > Reply to Discussion : groups.oasis-open.org/eGroups/PostReply/...
    >
    >
    >
    > You are subscribed to "OASIS PKCS 11 TC" as simo@redhat.com. To change your subscriptions, go to oasis.connectedcommunity.org/... To unsubscribe from this community discussion, go to oasis.connectedcommunity.org/HigherLogic/eGroups/...

    --
    Simo Sorce
    Distinguished Engineer
    RHEL Crypto Team
    Red Hat, Inc







  • 5.  RE: Questions about the "Hash ML-DSA Signature" and "Hash SLH-DSA Signature".

    Posted 28 days ago

    THALES GROUP LIMITED DISTRIBUTION to email recipients

     

    Hi,

    thanks for the update.

    I have no problems with pushing it to 3.3.  Just wanted to make sure we all saw the inconsistency between section "6.67.7 Hash ML-DSA Signature with hashing" where we do support SHAKE, and section "6.67.6 Hash ML-DSA Signature" where we do not support SHAKE.

     

    We can sort it all out in 3.3.

     

    Thanks

     






  • 6.  RE: Questions about the "Hash ML-DSA Signature" and "Hash SLH-DSA Signature".

    Posted 25 days ago
    I have added this to : https://wiki.oasis-open.org/pkcs11/3.3WorkItems

    (There are a few more items that need to get added there.... But didn't want the pile to keep growing)

    Valerie

    On Feb 18, 2025, at 7:03 AM, Darren Johnson via OASIS <Mail@mail.groups.oasis-open.org> wrote:







  • 7.  RE: Questions about the "Hash ML-DSA Signature" and "Hash SLH-DSA Signature".

    Posted 15 days ago

    Hi,

    Hopefully, this isn't too late for the discussion on ML-DSA (Draft 08/09/10), specifically 6.67.6 HashML-DSA Signature (a.k.a FIPS 204 §5.4 prehash) and 6.67.7 HashML-DSA Signature with hashing, which I believe is not part of FIPS 204.

    1. ML-DSA (Draft 08/09/10) – 6.67.6 HashML-DSA Signature (a.k.a. FIPS 204 §5.4 Prehash), Regarding SHAKE128 and SHAKE256

    In FIPS 204, Algorithm 4, lines 17–20:

    17: case SHAKE128:  
    18: OID ← 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x0B  ▷ 2.16.840.1.101.3.4.2.11  
    19: PH𝑀 ← SHAKE128(𝑀, 256)  

    20: case …  

    Q: SHAKE256 in FIPS 204: FIPS 204 does not provide pseudocode for SHAKE256.

      1. Can we safely assume it should be PH𝑀 ← SHAKE256(𝑀, 512)?
      2. Does FIPS 204 only require fixed-length SHAKE, such as SHAKE128(M, 256) and SHAKE256(M, 512)?
      3. If variable-length SHAKE is allowed, should we introduce a new field  CK_HASH_SIGN_ADDITIONAL_CONTEXT to specify the output length dynamically?

    typedef struct CK_HASH_SIGN_ADDITIONAL_CONTEXT {  
        CK_HEDGE_TYPE      hedgeVariant;  
        CK_BYTE_PTR        pContext;  
        CK_ULONG           ulContextLen;  
        CK_MECHANISM_TYPE  hash;  
        CK_ULONG           ulShakeOutputLen;  
    } CK_HASH_SIGN_ADDITIONAL_CONTEXT;

    2. Understanding 6.67.7 HashML-DSA Signature with Hashing (Not Part of FIPS 204)

    It is unclear how the 6.67.7 HashML-DSA Signature with Hashing differs from the 6.67.6 HashML-DSA Signature (Prehash, FIPS 204 §5.4).

    Mechanism: CKM_HASH_ML_DSA_<hash>

    My understanding about this is as follows:

    1. Hashes the Original Message (M) First

    Unlike prehash ML-DSA, which signs a processed message M', this mode directly hashes the original message M using the specified hash function. <hash> (e.g., SHA-256, SHA3-256).

    2. Uses the Hash Output for ML-DSA Sign/Verify (Pure Sign/Verify, Not PH Sign/Verify)

      • The resulting Hₘ = HASH<hash>(M) is passed to ML-DSA-SIGN / VERIFY.
      • For verification, the verifier hashes M the same way and checks it against the signature.
      • Important: Inside ML-DSA-SIGN/VERIFY, the hashed message Hₘ must be processed before being fed into FIPS 204 Algorithm 7 & 8:

    <math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><msup><mi>M</mi><mo mathvariant="normal" lspace="0em" rspace="0em">′</mo></msup><mo>←</mo><mtext>BytesToBits</mtext><mo stretchy="false">(</mo><mtext>IntegerToBytes</mtext><mo stretchy="false">(</mo><mn>0</mn><mo separator="true">,</mo><mn>1</mn><mo stretchy="false">)</mo><mo>∥</mo><mtext>IntegerToBytes</mtext><mo stretchy="false">(</mo><mi mathvariant="normal">∣</mi><mi>c</mi><mi>t</mi><mi>x</mi><mi mathvariant="normal">∣</mi><mo separator="true">,</mo><mn>1</mn><mo stretchy="false">)</mo><mo>∥</mo><mi>c</mi><mi>t</mi><mi>x</mi><mo stretchy="false">)</mo><mo>∥</mo><mi>H</mi><mi>m</mi></mrow><annotation encoding="application/x-tex">M' \gets \text{BytesToBits}(\text{IntegerToBytes}(0, 1) \parallel \text{IntegerToBytes}(|ctx|, 1) \parallel ctx) \parallel Hm</annotation></semantics></math>

    The PKCS#11 v3.2 draft (08/09/10) describes CKM_HASH_ML_DSA_<hash> as:

    "A mechanism for single- and multiple-part signatures and verification for pre-hash ML-DSA signatures as defined in FIPS 204 §5.4, Algorithm 4 (HashML-DSA.Sign) and Algorithm 5 (HashML-DSA.Verify). This mechanism computes the entire HashML-DSA specification, including hashing on-token. The data passed in is the original message M."

    However, this description (from my understanding) suggests a double hashing process:

    1. First, the input message M is hashed using <hash>: <math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><msub><mi>H</mi><mi>m</mi></msub><mo>=</mo><mtext>HASH</mtext><mo><</mo><mi>h</mi><mi>a</mi><mi>s</mi><mi>h</mi><mo>></mo><mo stretchy="false">(</mo><mi>M</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">Hₘ = \text{HASH}<hash>(M)</annotation></semantics></math>
    2. Then, Hₘ is passed to Algorithm 4 (HashML-DSA.Sign) and Algorithm 5 (HashML-DSA.Verify).
    3. Inside HashML-DSA.Sign/Verify, Hₘ undergoes an additional hash operation: <math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mi>P</mi><msub><mi>H</mi><mi>m</mi></msub><mo>←</mo><mtext>HASH</mtext><mo><</mo><mi>h</mi><mi>a</mi><mi>s</mi><mi>h</mi><mo>></mo><mo stretchy="false">(</mo><msub><mi>H</mi><mi>m</mi></msub><mo stretchy="false">)</mo><mspace width="1em"></mspace><mi mathvariant="normal">/</mi><mi mathvariant="normal">/</mi><mtext>Double hash using the same </mtext><mo><</mo><mi>h</mi><mi>a</mi><mi>s</mi><mi>h</mi><mo>></mo></mrow><annotation encoding="application/x-tex">PHₘ \gets \text{HASH}<hash>(Hₘ) \quad // \text{Double hash using the same } <hash></annotation></semantics></math>
    4. The processed message M' is then constructed as: <math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><msup><mi>M</mi><mo mathvariant="normal" lspace="0em" rspace="0em">′</mo></msup><mo>←</mo><mtext>BytesToBits</mtext><mo stretchy="false">(</mo><mtext>IntegerToBytes</mtext><mo stretchy="false">(</mo><mn>1</mn><mo separator="true">,</mo><mn>1</mn><mo stretchy="false">)</mo><mo>∥</mo><mtext>IntegerToBytes</mtext><mo stretchy="false">(</mo><mi mathvariant="normal">∣</mi><mi>c</mi><mi>t</mi><mi>x</mi><mi mathvariant="normal">∣</mi><mo separator="true">,</mo><mn>1</mn><mo stretchy="false">)</mo><mo>∥</mo><mi>c</mi><mi>t</mi><mi>x</mi><mo>∥</mo><mi>O</mi><mi>I</mi><mi>D</mi><mo>∥</mo><mi>P</mi><msub><mi>H</mi><mi>m</mi></msub><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">M' \gets \text{BytesToBits}(\text{IntegerToBytes}(1, 1) \parallel \text{IntegerToBytes}(|ctx|, 1) \parallel ctx \parallel OID \parallel PHₘ)</annotation></semantics></math>
    5. Finally, M' is fed into FIPS 204 Algorithm 7 & 8 for signing and verification.

    Q1: Key Questions & Next Steps?

      1. Is the intention of CKM_HASH_ML_DSA_<hash> indeed a double hashing process?
      2. Should PKCS#11 explicitly differentiate this from standard ML-DSA prehash (FIPS 204 §5.4)?
      3. Does this behavior align with real-world FIPS 204 test cases (FIPS 204 approved)?

    Q2: Key Considerations for SHAKE128/SHAKE256:

      1. If <hash> is SHAKE128 or SHAKE256, what should the output length (outputLen) be?
      2. Should SHAKE output length be fixed or variable?
      3. How do we specify this variable length within the mechanism?

    Thanks,
    Hui

    1.  



    ------------------------------
    Hui Zhang
    THALES
    ------------------------------



  • 8.  RE: Questions about the "Hash ML-DSA Signature" and "Hash SLH-DSA Signature".

    Posted 15 days ago

    Hi,
    Please disregard Message 7, which I posted earlier, as it contains a replacement for my math equation. Instead, please refer to this one. My apologies for the confusion !!!

    Hopefully, this isn't too late for the discussion on ML-DSA (Draft 08/09/10), specifically 6.67.6 HashML-DSA Signature (a.k.a FIPS 204 §5.4 prehash) and 6.67.7 HashML-DSA Signature with hashing, which I believe is not part of FIPS 204.

    1. ML-DSA (Draft 08/09/10) – 6.67.6 HashML-DSA Signature (a.k.a. FIPS 204 §5.4 Prehash), Regarding SHAKE128 and SHAKE256

    In FIPS 204, Algorithm 4, lines 17–20:

    17: case SHAKE128:  
    18: OID ← 0x06, 0x09, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x0B  ▷ 2.16.840.1.101.3.4.2.11  
    19: PH𝑀 ← SHAKE128(𝑀, 256)  

    20: case …  

    Q: SHAKE256 in FIPS 204: FIPS 204 does not provide pseudocode for SHAKE256.

      1. Can we safely assume it should be PH𝑀 ← SHAKE256(𝑀, 512)?
      2. Does FIPS 204 only require fixed-length SHAKE, such as SHAKE128(M, 256) and SHAKE256(M, 512)?
      3. If variable-length SHAKE is allowed, should we introduce a new field  CK_HASH_SIGN_ADDITIONAL_CONTEXT to specify the output length dynamically?

    typedef struct CK_HASH_SIGN_ADDITIONAL_CONTEXT {  
        CK_HEDGE_TYPE      hedgeVariant;  
        CK_BYTE_PTR        pContext;  
        CK_ULONG           ulContextLen;  
        CK_MECHANISM_TYPE  hash;  
        CK_ULONG           ulShakeOutputLen;  
    } CK_HASH_SIGN_ADDITIONAL_CONTEXT;

    2. Understanding 6.67.7 HashML-DSA Signature with Hashing (Not Part of FIPS 204)

    It is unclear how the 6.67.7 HashML-DSA Signature with Hashing differs from the 6.67.6 HashML-DSA Signature (Prehash, FIPS 204 §5.4).

    Mechanism: CKM_HASH_ML_DSA_<hash>

    My understanding about this is as follows:

    1. Hashes the Original Message (M) First

    Unlike prehash ML-DSA, which signs a processed message M', this mode directly hashes the original message M using the specified hash function. <hash> (e.g., SHA-256, SHA3-256).

    2. Uses the Hash Output for ML-DSA Sign/Verify (Pure Sign/Verify, Not PH Sign/Verify)

      • The resulting Hₘ = HASH<hash>(M) is passed to ML-DSA-SIGN / VERIFY.
      • For verification, the verifier hashes M the same way and checks it against the signature.
      • Important: Inside ML-DSA-SIGN/VERIFY, the hashed message Hₘ must be processed before being fed into FIPS 204 Algorithm 7 & 8:

    M' ← BytesToBits(IntegerToBytes(0, 1) || IntegerToBytes(|ctx|, 1) || ctx) || Hm

    The PKCS#11 v3.2 draft (08/09/10) describes CKM_HASH_ML_DSA_<hash> as:

    "A mechanism for single- and multiple-part signatures and verification for pre-hash ML-DSA signatures as defined in FIPS 204 §5.4, Algorithm 4 (HashML-DSA.Sign) and Algorithm 5 (HashML-DSA.Verify). This mechanism computes the entire HashML-DSA specification, including hashing on-token. The data passed in is the original message M."

    However, this description (from my understanding) suggests a double hashing process:

    1. First, the input message M is hashed using <hash>: Hm = HASH<hash>(M)
    2. Then, Hₘ is passed to Algorithm 4 (HashML-DSA.Sign) and Algorithm 5 (HashML-DSA.Verify).
    3. Inside HashML-DSA.Sign/Verify, Hₘ undergoes an additional hash operation: PHm ← HASH<hash>(Hm)
    4. The processed message M' is then constructed as:
      M' ← BytesToBits(IntegerToBytes(1, 1) || IntegerToBytes(|ctx|, 1) || ctx || OID || PHm)
    5. Finally, M' is fed into FIPS 204 Algorithm 7 & 8 for signing and verification.

    Q1: Key Questions & Next Steps?

      1. Is the intention  CKM_HASH_ML_DSA_<hash> indeed a double hashing process?
      2. Should PKCS#11 explicitly differentiate this from standard ML-DSA prehash (FIPS 204 §5.4)?
      3. Does this behavior align with real-world FIPS 204 test cases (FIPS 204 approved)?

    Q2: Key Considerations for SHAKE128/SHAKE256:

      1. If <hash> is SHAKE128 or SHAKE256, what should the output length (outputLen) be?
      2. Should SHAKE output length be fixed or variable?
      3. How do we specify this variable length within the mechanism?

    Thanks,
    Hui



    ------------------------------
    Hui Zhang
    THALES
    ------------------------------



  • 9.  RE: Questions about the "Hash ML-DSA Signature" and "Hash SLH-DSA Signature".

    Posted 15 days ago

    THALES GROUP LIMITED DISTRIBUTION to email recipients

     

    Hi,

    Thank you for your questions. I have provided responses to both of your questions which should clear things up.  Let me know if you have any other follow-up questions. 

     

    Point 1: regarding SHAKE128 and SHAKE 256

     

    Yes, it is safe to assume PHm <- SHAKE256(M, 512).  The pseudo code for SHAKE128 uses OID .11 which is the OID that identifies the fixed length variant of SHAKE128.  And footnote 5 on page 19 also states that for XOFs, the OID will include the output length.  This means that for SKAKE256, OID .12 should be used which is the fixed length variant of SHAKE256.  If variable length SHAKE128 and SHAKE256 were supported, OIDS .17 and .18 would need to be used and the output length would need to be explicitly encoded, which would be in contradiction with footnote 5.

     

    Point 2: HashML-DSA Signature with Hashing

     

    Both CKM_HASH_ML_DSA and CKM_HASH_ML_DSA_<hash> directly map to Algorithm 4 and 5 of FIPS 204.  The only difference is where PHm is computed.

     

    As you quoted below, the CKM_HASH_ML_DSA_<hash> mechanisms are defined as follows:

    "is a mechanism for single- and multiple-part signatures and verification for pre-hash ML-DSA signatures as defined in section 5.4 of [FIPS 204], Algorithm 4 HashML-DSA.Sign and Algorithm 5 HashML-DSA.Verify. This mechanism computes the entire HashML-DSA specification, including the hashing on token. The data passed in is the message M."

    There is no intention of double hashing.  The message M is passed in and is used to compute PHm.  PHm is used to construct M'.  As per Algorithm 4 and 5.  The hash algorithm defined by <hash> is the hash that is used to compute PHm and defines the hash OID that must be encoded when M' is constructed.

     

    CKM_HASH_ML_DSA is defined as follows:

    "a single part mechanism for generating and verifying pre-hash ML-DSA signatures as defined in section 5.4 of [FIPS 204], Algorithm 4 HashML-DSA.Sign and Algorithm 5 HashML-DSA.Verify, using the hash function specified in CK_HASH_SIGN_ADDITIONAL_CONTEXT. The data passed in is an already hashed message PHM."

    In this case, PHm is passed in along with the CK_MECHANISM type for the hash algorithm that was used to compute PHm.  PHm and the hash type are used to construct M'.

     

    Thanks

    Darren