Merge remote-tracking branch 'tuneinsight/main' into gosec_g115

This commit is contained in:
Jean-Philippe Bossuat
2025-02-17 15:48:55 +01:00
5 changed files with 20 additions and 18 deletions

View File

@@ -1,20 +1,22 @@
name: CI Checks name: CI Checks
on: on:
push: push:
pull_request:
workflow_dispatch:
jobs: jobs:
checks: checks:
name: Run static checks name: Run static checks
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
with: with:
fetch-depth: 1 fetch-depth: 1
- name: Setup Go - name: Setup Go
uses: actions/setup-go@v4 uses: actions/setup-go@v5
with: with:
go-version: '1.22.2' go-version: '1.23.6'
- uses: actions/cache@v3 - uses: actions/cache@v4
with: with:
path: ~/go/pkg/mod path: ~/go/pkg/mod
key: ${{ runner.os }}-go-tools-${{ hashFiles('**/go.sum') }} key: ${{ runner.os }}-go-tools-${{ hashFiles('**/go.sum') }}
@@ -32,17 +34,17 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
go: ['1.22.2', '1.21.9'] go: ['1.23.6', '1.22.11', '1.21.13']
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Setup Go - name: Setup Go
uses: actions/setup-go@v4 uses: actions/setup-go@v5
with: with:
go-version: ${{ matrix.go }} go-version: ${{ matrix.go }}
- uses: actions/cache@v3 - uses: actions/cache@v4
with: with:
path: | path: |
~/.cache/go-build ~/.cache/go-build

View File

@@ -35,7 +35,7 @@ checks: check_tools
false;\ false;\
fi fi
@STATICCHECKOUT=$$(staticcheck -go 1.22 -checks all ./...); \ @STATICCHECKOUT=$$(staticcheck -go 1.23 -checks all ./...); \
if [ -z "$$STATICCHECKOUT" ]; then\ if [ -z "$$STATICCHECKOUT" ]; then\
echo "staticcheck: OK";\ echo "staticcheck: OK";\
else \ else \
@@ -76,7 +76,7 @@ EXECUTABLES = goimports staticcheck govulncheck gosec
.PHONY: get_tools .PHONY: get_tools
get_tools: get_tools:
go install golang.org/x/tools/cmd/goimports@latest go install golang.org/x/tools/cmd/goimports@latest
go install honnef.co/go/tools/cmd/staticcheck@2023.1.7 go install honnef.co/go/tools/cmd/staticcheck@2024.1.1
go install golang.org/x/vuln/cmd/govulncheck@latest go install golang.org/x/vuln/cmd/govulncheck@latest
go install github.com/securego/gosec/v2/cmd/gosec@latest go install github.com/securego/gosec/v2/cmd/gosec@latest

View File

@@ -94,7 +94,7 @@ Lattigo package organization is given in the Figure above.
subpackage includes test files that further demonstrate the use of Lattigo subpackage includes test files that further demonstrate the use of Lattigo
primitives. primitives.
- `lattigo/utils`: Generic utility methods. This package also contains the following sub-pacakges: - `lattigo/utils`: Generic utility methods. This package also contains the following sub-packages:
- `bignum`: Arbitrary precision linear algebra and polynomial approximation. - `bignum`: Arbitrary precision linear algebra and polynomial approximation.
- `buffer`: Efficient methods to write/read on `io.Writer` and `io.Reader`. - `buffer`: Efficient methods to write/read on `io.Writer` and `io.Reader`.
- `factorization`: Various factorization algorithms for medium-sized integers. - `factorization`: Various factorization algorithms for medium-sized integers.

View File

@@ -61,7 +61,7 @@ func (rntt NumberTheoreticTransformerStandard) Forward(p1, p2 []uint64) {
} }
// ForwardLazy writes the forward NTT in Z[X]/(X^N+1) of p1 on p2. // ForwardLazy writes the forward NTT in Z[X]/(X^N+1) of p1 on p2.
// Returns values in the range [0, 2q-1]. // Returns values in the range [0, 6q-2].
func (rntt NumberTheoreticTransformerStandard) ForwardLazy(p1, p2 []uint64) { func (rntt NumberTheoreticTransformerStandard) ForwardLazy(p1, p2 []uint64) {
NTTStandardLazy(p1, p2, rntt.N, rntt.Modulus, rntt.MRedConstant, rntt.RootsForward) NTTStandardLazy(p1, p2, rntt.N, rntt.Modulus, rntt.MRedConstant, rntt.RootsForward)
} }
@@ -130,7 +130,7 @@ func (r Ring) NTT(p1, p2 Poly) {
} }
} }
// NTTLazy evaluates p2 = NTT(p1) with p2 in [0, 2*modulus-1]. // NTTLazy evaluates p2 = NTT(p1) with p2 in [0, 6*modulus-2].
func (r Ring) NTTLazy(p1, p2 Poly) { func (r Ring) NTTLazy(p1, p2 Poly) {
for i, s := range r.SubRings[:r.level+1] { for i, s := range r.SubRings[:r.level+1] {
s.NTTLazy(p1.Coeffs[i], p2.Coeffs[i]) s.NTTLazy(p1.Coeffs[i], p2.Coeffs[i])
@@ -176,7 +176,7 @@ func NTTStandard(p1, p2 []uint64, N int, Q, MRedConstant uint64, BRedConstant [2
reducevec(p2, p2, Q, BRedConstant) reducevec(p2, p2, Q, BRedConstant)
} }
// NTTStandardLazy computes the NTTStandard in the given SubRing with p2 in [0, 2*modulus-1]. // NTTStandardLazy computes the NTTStandard in the given SubRing with p2 in [0, 6*modulus-2].
func NTTStandardLazy(p1, p2 []uint64, N int, Q, MRedConstant uint64, roots []uint64) { func NTTStandardLazy(p1, p2 []uint64, N int, Q, MRedConstant uint64, roots []uint64) {
nttCoreLazy(p1, p2, N, Q, MRedConstant, roots) nttCoreLazy(p1, p2, N, Q, MRedConstant, roots)
} }
@@ -205,7 +205,7 @@ func INTTStandardLazy(p1, p2 []uint64, N int, NInv, Q, MRedConstant uint64, root
} }
} }
// nttCoreLazy computes the NTT on the input coefficients using the input parameters with output values in the range [0, 2*modulus-1]. // nttCoreLazy computes the NTT on the input coefficients using the input parameters with output values in the range [0, 6*modulus-2].
func nttCoreLazy(p1, p2 []uint64, N int, Q, MRedConstant uint64, roots []uint64) { func nttCoreLazy(p1, p2 []uint64, N int, Q, MRedConstant uint64, roots []uint64) {
// Sanity check // Sanity check
@@ -719,7 +719,7 @@ func NTTConjugateInvariant(p1, p2 []uint64, N int, Q, MRedConstant uint64, BRedC
reducevec(p2, p2, Q, BRedConstant) reducevec(p2, p2, Q, BRedConstant)
} }
// NTTConjugateInvariantLazy evaluates p2 = NTT(p1) in the sub-ring Z[X + X^-1]/(X^2N +1) of Z[X]/(X^2N+1) with p2 in the range [0, 2*modulus-1]. // NTTConjugateInvariantLazy evaluates p2 = NTT(p1) in the sub-ring Z[X + X^-1]/(X^2N +1) of Z[X]/(X^2N+1) with p2 in the range [0, 6*modulus-2].
func NTTConjugateInvariantLazy(p1, p2 []uint64, N int, Q, MRedConstant uint64, roots []uint64) { func NTTConjugateInvariantLazy(p1, p2 []uint64, N int, Q, MRedConstant uint64, roots []uint64) {
nttCoreConjugateInvariantLazy(p1, p2, N, Q, MRedConstant, roots) nttCoreConjugateInvariantLazy(p1, p2, N, Q, MRedConstant, roots)
} }
@@ -736,7 +736,7 @@ func INTTConjugateInvariantLazy(p1, p2 []uint64, N int, NInv, Q, MRedConstant ui
mulscalarmontgomerylazyvec(p2, NInv, p2, Q, MRedConstant) mulscalarmontgomerylazyvec(p2, NInv, p2, Q, MRedConstant)
} }
// nttCoreConjugateInvariantLazy evaluates p2 = NTT(p1) in the sub-ring Z[X + X^-1]/(X^2N +1) of Z[X]/(X^2N+1) with p2 [0, 2*modulus-1]. // nttCoreConjugateInvariantLazy evaluates p2 = NTT(p1) in the sub-ring Z[X + X^-1]/(X^2N +1) of Z[X]/(X^2N+1) with p2 [0, 6*modulus-2].
func nttCoreConjugateInvariantLazy(p1, p2 []uint64, N int, Q, MRedConstant uint64, roots []uint64) { func nttCoreConjugateInvariantLazy(p1, p2 []uint64, N int, Q, MRedConstant uint64, roots []uint64) {
// Sanity check // Sanity check

View File

@@ -236,7 +236,7 @@ func (s *SubRing) NTT(p1, p2 []uint64) {
s.ntt.Forward(p1, p2) s.ntt.Forward(p1, p2)
} }
// NTTLazy evaluates p2 = NTT(p1) with p2 in [0, 2*modulus-1]. // NTTLazy evaluates p2 = NTT(p1) with p2 in [0, 6*modulus-2].
func (s *SubRing) NTTLazy(p1, p2 []uint64) { func (s *SubRing) NTTLazy(p1, p2 []uint64) {
s.ntt.ForwardLazy(p1, p2) s.ntt.ForwardLazy(p1, p2)
} }