From b25255c3dabfc7451ac1f6e20be73c2aa1d63451 Mon Sep 17 00:00:00 2001 From: Sidnei Teixeira Date: Mon, 30 Mar 2026 17:41:26 +0100 Subject: [PATCH 1/5] #296 allow skipping validation for TEDecryptionSHare constructor --- threshold_encryption/TEDecryptionShare.cpp | 12 ++++++++---- threshold_encryption/TEDecryptionShare.h | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/threshold_encryption/TEDecryptionShare.cpp b/threshold_encryption/TEDecryptionShare.cpp index 465f3aef..3254b734 100644 --- a/threshold_encryption/TEDecryptionShare.cpp +++ b/threshold_encryption/TEDecryptionShare.cpp @@ -26,15 +26,19 @@ along with libBLS. If not, see . namespace libBLS { -TEDecryptionShare::TEDecryptionShare( const algebra::G2Point& _share, size_t _signerIndex ) +TEDecryptionShare::TEDecryptionShare( const algebra::G2Point& _share, size_t _signerIndex, bool _validate ) : signerIndex( _signerIndex ), share( _share ) { - share.validate(); + if ( _validate ) { + share.validate(); + } } -TEDecryptionShare::TEDecryptionShare( const std::string& _hexaEncoded, size_t _signerIndex ) +TEDecryptionShare::TEDecryptionShare( const std::string& _hexaEncoded, size_t _signerIndex, bool _validate ) : signerIndex( _signerIndex ) { share = algebra::G2Point::fromString( _hexaEncoded, Base::HEXA ); - share.validate(); + if ( _validate ) { + share.validate(); + } } size_t TEDecryptionShare::getSignerIndex() const { diff --git a/threshold_encryption/TEDecryptionShare.h b/threshold_encryption/TEDecryptionShare.h index e852e5d0..189a69d9 100644 --- a/threshold_encryption/TEDecryptionShare.h +++ b/threshold_encryption/TEDecryptionShare.h @@ -44,14 +44,14 @@ class TEDecryptionShare { * @param _share Decryption share * @note Validates that the share is well formed and non-zero. */ - TEDecryptionShare( const algebra::G2Point& _share, size_t _signerIndex ); + TEDecryptionShare( const algebra::G2Point& _share, size_t _signerIndex, bool _validate = true ); /** * @param _signerIndex Index of the signer * @param _hexaEncoded Hexa encoded string of the share * @note Used when building from serialized decription share */ - TEDecryptionShare( const std::string& _hexaEncoded, size_t _signerIndex ); + TEDecryptionShare( const std::string& _hexaEncoded, size_t _signerIndex, bool _validate = true ); size_t getSignerIndex() const; From 0a16cb4b6c790ed74d893b392e26e68575dfc54f Mon Sep 17 00:00:00 2001 From: Sidnei Teixeira Date: Mon, 30 Mar 2026 17:44:33 +0100 Subject: [PATCH 2/5] #296 format --- threshold_encryption/TEDecryptionShare.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/threshold_encryption/TEDecryptionShare.cpp b/threshold_encryption/TEDecryptionShare.cpp index 3254b734..f0705b85 100644 --- a/threshold_encryption/TEDecryptionShare.cpp +++ b/threshold_encryption/TEDecryptionShare.cpp @@ -26,14 +26,16 @@ along with libBLS. If not, see . namespace libBLS { -TEDecryptionShare::TEDecryptionShare( const algebra::G2Point& _share, size_t _signerIndex, bool _validate ) +TEDecryptionShare::TEDecryptionShare( + const algebra::G2Point& _share, size_t _signerIndex, bool _validate ) : signerIndex( _signerIndex ), share( _share ) { if ( _validate ) { share.validate(); } } -TEDecryptionShare::TEDecryptionShare( const std::string& _hexaEncoded, size_t _signerIndex, bool _validate ) +TEDecryptionShare::TEDecryptionShare( + const std::string& _hexaEncoded, size_t _signerIndex, bool _validate ) : signerIndex( _signerIndex ) { share = algebra::G2Point::fromString( _hexaEncoded, Base::HEXA ); if ( _validate ) { From 5a90249e0902f04b7ca6982b4b5aa6cb0f493f75 Mon Sep 17 00:00:00 2001 From: Sidnei Teixeira Date: Mon, 30 Mar 2026 17:46:44 +0100 Subject: [PATCH 3/5] #296 format --- threshold_encryption/TEDecryptionShare.cpp | 4 ++-- threshold_encryption/TEDecryptionShare.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/threshold_encryption/TEDecryptionShare.cpp b/threshold_encryption/TEDecryptionShare.cpp index f0705b85..01d9c6aa 100644 --- a/threshold_encryption/TEDecryptionShare.cpp +++ b/threshold_encryption/TEDecryptionShare.cpp @@ -26,7 +26,7 @@ along with libBLS. If not, see . namespace libBLS { -TEDecryptionShare::TEDecryptionShare( +TEDecryptionShare::TEDecryptionShare( const algebra::G2Point& _share, size_t _signerIndex, bool _validate ) : signerIndex( _signerIndex ), share( _share ) { if ( _validate ) { @@ -34,7 +34,7 @@ TEDecryptionShare::TEDecryptionShare( } } -TEDecryptionShare::TEDecryptionShare( +TEDecryptionShare::TEDecryptionShare( const std::string& _hexaEncoded, size_t _signerIndex, bool _validate ) : signerIndex( _signerIndex ) { share = algebra::G2Point::fromString( _hexaEncoded, Base::HEXA ); diff --git a/threshold_encryption/TEDecryptionShare.h b/threshold_encryption/TEDecryptionShare.h index 189a69d9..22e27fbb 100644 --- a/threshold_encryption/TEDecryptionShare.h +++ b/threshold_encryption/TEDecryptionShare.h @@ -51,7 +51,8 @@ class TEDecryptionShare { * @param _hexaEncoded Hexa encoded string of the share * @note Used when building from serialized decription share */ - TEDecryptionShare( const std::string& _hexaEncoded, size_t _signerIndex, bool _validate = true ); + TEDecryptionShare( + const std::string& _hexaEncoded, size_t _signerIndex, bool _validate = true ); size_t getSignerIndex() const; From 86c01ca8377da8d60d3b22db866c4bbd37c2a3f0 Mon Sep 17 00:00:00 2001 From: Sidnei Teixeira Date: Mon, 30 Mar 2026 17:51:58 +0100 Subject: [PATCH 4/5] #296 update doc comments --- threshold_encryption/TEDecryptionShare.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/threshold_encryption/TEDecryptionShare.h b/threshold_encryption/TEDecryptionShare.h index 22e27fbb..6106eb40 100644 --- a/threshold_encryption/TEDecryptionShare.h +++ b/threshold_encryption/TEDecryptionShare.h @@ -40,16 +40,18 @@ class TEDecryptionShare { public: /** - * @param _signerIndex Index of the signer * @param _share Decryption share - * @note Validates that the share is well formed and non-zero. + * @param _signerIndex Index of the signer + * @param _validate Whether to validate the share or not (Optional, default: true) + * Note: Validation is a costly operation, so it can be skipped if the share is already known to be valid. */ TEDecryptionShare( const algebra::G2Point& _share, size_t _signerIndex, bool _validate = true ); /** - * @param _signerIndex Index of the signer * @param _hexaEncoded Hexa encoded string of the share - * @note Used when building from serialized decription share + * @param _signerIndex Index of the signer + * @param _validate Whether to validate the share or not (Optional, default: true) + * Note: Validation is a costly operation, so it can be skipped if the share is already known to be valid. */ TEDecryptionShare( const std::string& _hexaEncoded, size_t _signerIndex, bool _validate = true ); From 67db4a7e2cd881c6119f2007bfb868205c456322 Mon Sep 17 00:00:00 2001 From: Sidnei Teixeira Date: Mon, 30 Mar 2026 18:01:38 +0100 Subject: [PATCH 5/5] #296 format --- threshold_encryption/TEDecryptionShare.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/threshold_encryption/TEDecryptionShare.h b/threshold_encryption/TEDecryptionShare.h index 6106eb40..46dff9e3 100644 --- a/threshold_encryption/TEDecryptionShare.h +++ b/threshold_encryption/TEDecryptionShare.h @@ -43,7 +43,8 @@ class TEDecryptionShare { * @param _share Decryption share * @param _signerIndex Index of the signer * @param _validate Whether to validate the share or not (Optional, default: true) - * Note: Validation is a costly operation, so it can be skipped if the share is already known to be valid. + * Note: Validation is a costly operation, so it can be skipped if the share is already known to + * be valid. */ TEDecryptionShare( const algebra::G2Point& _share, size_t _signerIndex, bool _validate = true ); @@ -51,7 +52,8 @@ class TEDecryptionShare { * @param _hexaEncoded Hexa encoded string of the share * @param _signerIndex Index of the signer * @param _validate Whether to validate the share or not (Optional, default: true) - * Note: Validation is a costly operation, so it can be skipped if the share is already known to be valid. + * Note: Validation is a costly operation, so it can be skipped if the share is already known to + * be valid. */ TEDecryptionShare( const std::string& _hexaEncoded, size_t _signerIndex, bool _validate = true );