From e6b842ef89c5b4ea15a29242853a1d9f7a60c615 Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Tue, 23 Jul 2024 20:31:24 +0200 Subject: [PATCH] bindings/go: add AggregateWithRandomness(). --- bindings/go/blst.go | 18 ++++++++++++++++++ bindings/go/blst_minpk.tgo | 9 +++++++++ 2 files changed, 27 insertions(+) diff --git a/bindings/go/blst.go b/bindings/go/blst.go index 2e5119cf..77f22419 100644 --- a/bindings/go/blst.go +++ b/bindings/go/blst.go @@ -928,6 +928,15 @@ func (agg *P2Aggregate) Aggregate(elmts []*P2Affine, return agg.coreAggregate(getter, groupcheck, len(elmts)) } +func (agg *P2Aggregate) AggregateWithRandomness(pointsIf interface{}, + scalarsIf interface{}, nbits int, groupcheck bool) bool { + if groupcheck && !P2AffinesValidate(pointsIf) { + return false + } + agg.v = P2AffinesMult(pointsIf, scalarsIf, nbits) + return true +} + // Aggregate compressed elements func (agg *P2Aggregate) AggregateCompressed(elmts [][]byte, groupcheck bool) bool { @@ -1519,6 +1528,15 @@ func (agg *P1Aggregate) Aggregate(elmts []*P1Affine, return agg.coreAggregate(getter, groupcheck, len(elmts)) } +func (agg *P1Aggregate) AggregateWithRandomness(pointsIf interface{}, + scalarsIf interface{}, nbits int, groupcheck bool) bool { + if groupcheck && !P1AffinesValidate(pointsIf) { + return false + } + agg.v = P1AffinesMult(pointsIf, scalarsIf, nbits) + return true +} + // Aggregate compressed elements func (agg *P1Aggregate) AggregateCompressed(elmts [][]byte, groupcheck bool) bool { diff --git a/bindings/go/blst_minpk.tgo b/bindings/go/blst_minpk.tgo index b1eead55..7d329bbc 100644 --- a/bindings/go/blst_minpk.tgo +++ b/bindings/go/blst_minpk.tgo @@ -458,6 +458,15 @@ func (agg *P2Aggregate) Aggregate(elmts []*P2Affine, return agg.coreAggregate(getter, groupcheck, len(elmts)) } +func (agg *P2Aggregate) AggregateWithRandomness(pointsIf interface{}, + scalarsIf interface{}, nbits int, groupcheck bool) bool { + if groupcheck && !P2AffinesValidate(pointsIf) { + return false + } + agg.v = P2AffinesMult(pointsIf, scalarsIf, nbits) + return true +} + // Aggregate compressed elements func (agg *P2Aggregate) AggregateCompressed(elmts [][]byte, groupcheck bool) bool {