mirror of
https://github.com/tuneinsight/lattigo.git
synced 2025-09-13 03:27:14 +00:00
Merge remote-tracking branch 'tuneinsight/main' into gosec_g115
This commit is contained in:
18
.github/workflows/ci.yml
vendored
18
.github/workflows/ci.yml
vendored
@@ -1,20 +1,22 @@
|
||||
name: CI Checks
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
jobs:
|
||||
checks:
|
||||
name: Run static checks
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 1
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v4
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.22.2'
|
||||
go-version: '1.23.6'
|
||||
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-tools-${{ hashFiles('**/go.sum') }}
|
||||
@@ -32,17 +34,17 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
go: ['1.22.2', '1.21.9']
|
||||
go: ['1.23.6', '1.22.11', '1.21.13']
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v4
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ matrix.go }}
|
||||
|
||||
- uses: actions/cache@v3
|
||||
- uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.cache/go-build
|
||||
|
||||
4
Makefile
4
Makefile
@@ -35,7 +35,7 @@ checks: check_tools
|
||||
false;\
|
||||
fi
|
||||
|
||||
@STATICCHECKOUT=$$(staticcheck -go 1.22 -checks all ./...); \
|
||||
@STATICCHECKOUT=$$(staticcheck -go 1.23 -checks all ./...); \
|
||||
if [ -z "$$STATICCHECKOUT" ]; then\
|
||||
echo "staticcheck: OK";\
|
||||
else \
|
||||
@@ -76,7 +76,7 @@ EXECUTABLES = goimports staticcheck govulncheck gosec
|
||||
.PHONY: get_tools
|
||||
get_tools:
|
||||
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 github.com/securego/gosec/v2/cmd/gosec@latest
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ Lattigo package organization is given in the Figure above.
|
||||
subpackage includes test files that further demonstrate the use of Lattigo
|
||||
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.
|
||||
- `buffer`: Efficient methods to write/read on `io.Writer` and `io.Reader`.
|
||||
- `factorization`: Various factorization algorithms for medium-sized integers.
|
||||
|
||||
12
ring/ntt.go
12
ring/ntt.go
@@ -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.
|
||||
// Returns values in the range [0, 2q-1].
|
||||
// Returns values in the range [0, 6q-2].
|
||||
func (rntt NumberTheoreticTransformerStandard) ForwardLazy(p1, p2 []uint64) {
|
||||
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) {
|
||||
for i, s := range r.SubRings[:r.level+1] {
|
||||
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)
|
||||
}
|
||||
|
||||
// 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) {
|
||||
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) {
|
||||
|
||||
// Sanity check
|
||||
@@ -719,7 +719,7 @@ func NTTConjugateInvariant(p1, p2 []uint64, N int, Q, MRedConstant uint64, BRedC
|
||||
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) {
|
||||
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)
|
||||
}
|
||||
|
||||
// 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) {
|
||||
|
||||
// Sanity check
|
||||
|
||||
@@ -236,7 +236,7 @@ func (s *SubRing) NTT(p1, p2 []uint64) {
|
||||
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) {
|
||||
s.ntt.ForwardLazy(p1, p2)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user