From 2132734b92f09c058c26fee0584e91b09f4f29a6 Mon Sep 17 00:00:00 2001 From: Lin Huang Date: Thu, 7 Sep 2023 07:50:52 -0400 Subject: [PATCH] check if public key string and signature string are invlid in conversion --- libraries/libfc/src/crypto/bls_public_key.cpp | 2 +- libraries/libfc/src/crypto/bls_signature.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/libfc/src/crypto/bls_public_key.cpp b/libraries/libfc/src/crypto/bls_public_key.cpp index d953d77be5..5fa51e81f6 100644 --- a/libraries/libfc/src/crypto/bls_public_key.cpp +++ b/libraries/libfc/src/crypto/bls_public_key.cpp @@ -15,7 +15,7 @@ namespace fc::crypto::blslib { std::array bytes = fc::crypto::blslib::deserialize_base64>(data_str); - constexpr bool check = false; // default + constexpr bool check = true; // check if base64str is invalid constexpr bool raw = true; std::optional g1 = bls12_381::g1::fromAffineBytesLE(bytes, check, raw); FC_ASSERT(g1); diff --git a/libraries/libfc/src/crypto/bls_signature.cpp b/libraries/libfc/src/crypto/bls_signature.cpp index 97bd8cc7b6..9e926910c0 100644 --- a/libraries/libfc/src/crypto/bls_signature.cpp +++ b/libraries/libfc/src/crypto/bls_signature.cpp @@ -17,7 +17,7 @@ namespace fc::crypto::blslib { std::array bytes = fc::crypto::blslib::deserialize_base64>(data_str); - constexpr bool check = false; // default + constexpr bool check = true; // check if base64str is invalid constexpr bool raw = true; std::optional g2 = bls12_381::g2::fromAffineBytesLE(bytes, check, raw); FC_ASSERT(g2);