Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion yacl/crypto/ecc/openssl/openssl_group.cc
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,13 @@ EcPoint OpensslGroup::HashToCurve(HashToCurveStrategy strategy,
HashAlgorithm hash_algorithm;
switch (strategy) {
case HashToCurveStrategy::TryAndRehash_SHA2:
YACL_THROW("HashToCurveStrategy::TryAndRehash_SHA2 has been deprecated.");
YACL_THROW(
"HashToCurveStrategy::TryAndRehash_SHA2 has been deprecated.\n"
"It is recommended to use curve-specific, standard-compliant "
"strategies for better security and interoperability.\n\n"
"For example:\n"
" - For NIST curves like P-256: Use SHA256_SSWU_RO_.\n"
" - For the SM2 curve: Use TryAndRehash_SM.");
break;
case HashToCurveStrategy::TryAndRehash_SHA3:
if (bits <= 256) {
Expand Down
6 changes: 0 additions & 6 deletions yacl/crypto/ecc/openssl/openssl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,8 @@ TEST(OpensslTest, HashToCurveWorks) {
};

for (int i = 0; i < 1000; ++i) {
// is_unique(curve->HashToCurve(HashToCurveStrategy::TryAndRehash_SHA2,
// fmt::format("id{}", i)));
is_unique(curve->HashToCurve(HashToCurveStrategy::TryAndRehash_SM,
fmt::format("id{}", i)));
// is_unique(curve->HashToCurve(HashToCurveStrategy::TryAndRehash_BLAKE3,
// fmt::format("id{}", i)));
// Same strategy as above TryAndRehash_BLAKE3
// is_unique(curve->HashToCurve(fmt::format("id{}", i)));
}
}

Expand Down
Loading