@@ -1421,79 +1421,6 @@ int wc_XmssKey_GetPrivLen(const XmssKey* key, word32* len)
14211421 return ret ;
14221422}
14231423
1424- /* Compute the digest of msg using the hash function dictated by the XMSS
1425- * parameter set. Crypto-callback / HSM backends that follow PKCS#11 v3.2
1426- * CKM_XMSS / CKM_XMSSMT semantics (pre-computed digest input, see section
1427- * 6.66.8 "XMSS and XMSSMT without hashing") can call this from within
1428- * their callback; backends that take the raw message (e.g. wolfHSM) can
1429- * ignore it. *hashSz is in/out: it must be at least params->n on entry
1430- * and is set to the actual digest length on success.
1431- *
1432- * @param [in] key XMSS key (must have a parameter set bound).
1433- * @param [in] msg Message to hash.
1434- * @param [in] msgSz Length of msg in bytes.
1435- * @param [out] hash Buffer receiving the digest.
1436- * @param [in,out] hashSz On entry, size of hash buffer. On success,
1437- * the digest length.
1438- * @return 0 on success.
1439- * @return BAD_FUNC_ARG when an argument is NULL or the buffer is too
1440- * small for the digest.
1441- * @return NOT_COMPILED_IN when the param set's hash family is disabled.
1442- */
1443- int wc_XmssKey_HashMsg (const XmssKey * key , const byte * msg , word32 msgSz ,
1444- byte * hash , word32 * hashSz )
1445- {
1446- int ret = 0 ;
1447- word32 needSz ;
1448-
1449- if ((key == NULL ) || (msg == NULL ) || (hash == NULL ) || (hashSz == NULL ))
1450- return BAD_FUNC_ARG ;
1451- if (key -> params == NULL )
1452- return BAD_FUNC_ARG ;
1453- needSz = (word32 )key -> params -> n ;
1454- if (* hashSz < needSz )
1455- return BAD_FUNC_ARG ;
1456-
1457- switch (key -> params -> hash ) {
1458- #ifdef WC_XMSS_SHA256
1459- case WC_HASH_TYPE_SHA256 : {
1460- /* SHA2_*_192 variants set n=24, but wc_Hash rejects an output
1461- * smaller than WC_SHA256_DIGEST_SIZE. Hash to a full buffer and
1462- * copy the requested prefix. */
1463- byte full [WC_SHA256_DIGEST_SIZE ];
1464- ret = wc_Sha256Hash (msg , msgSz , full );
1465- if (ret == 0 )
1466- XMEMCPY (hash , full , needSz );
1467- break ;
1468- }
1469- #endif
1470- #ifdef WC_XMSS_SHA512
1471- case WC_HASH_TYPE_SHA512 :
1472- ret = wc_Hash (WC_HASH_TYPE_SHA512 , msg , msgSz , hash , needSz );
1473- break ;
1474- #endif
1475- #ifdef WC_XMSS_SHAKE128
1476- case WC_HASH_TYPE_SHAKE128 :
1477- ret = wc_Shake128Hash (msg , msgSz , hash , needSz );
1478- break ;
1479- #endif
1480- #ifdef WC_XMSS_SHAKE256
1481- case WC_HASH_TYPE_SHAKE256 :
1482- ret = wc_Shake256Hash (msg , msgSz , hash , needSz );
1483- break ;
1484- #endif
1485- default :
1486- WOLFSSL_MSG ("XMSS: unsupported hash for HashMsg" );
1487- ret = NOT_COMPILED_IN ;
1488- break ;
1489- }
1490-
1491- if (ret == 0 )
1492- * hashSz = needSz ;
1493-
1494- return ret ;
1495- }
1496-
14971424/* Sign the message using the XMSS secret key.
14981425 *
14991426 * @param [in] key XMSS key to use to sign.
0 commit comments