]> Cypherpunks repositories - gostls13.git/commitdiff
crypto/internal/mlkem768: unexport encryptionKey.A
authorFilippo Valsorda <filippo@golang.org>
Mon, 21 Oct 2024 13:29:32 +0000 (15:29 +0200)
committerGopher Robot <gobot@golang.org>
Tue, 19 Nov 2024 18:50:44 +0000 (18:50 +0000)
Change-Id: I001e48dbb476e590cd84194f386bf5ea4cc1a1b3
Reviewed-on: https://go-review.googlesource.com/c/go/+/621976
Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Reviewed-by: Russ Cox <rsc@golang.org>
Auto-Submit: Filippo Valsorda <filippo@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
src/crypto/internal/mlkem768/mlkem768.go

index 5217da2d95e8e3aec3f15f1da326f32b23947d94..527c93ffe36f4099202274d59f8c8797498731f9 100644 (file)
@@ -100,7 +100,7 @@ func (dk *DecapsulationKey) encapsulationKey(b []byte) []byte {
 // encryptionKey is the parsed and expanded form of a PKE encryption key.
 type encryptionKey struct {
        t [k]nttElement     // ByteDecode₁₂(ek[:384k])
-       A [k * k]nttElement // A[i*k+j] = sampleNTT(ρ, j, i)
+       a [k * k]nttElement // A[i*k+j] = sampleNTT(ρ, j, i)
 }
 
 // decryptionKey is the parsed and expanded form of a PKE decryption key.
@@ -164,7 +164,7 @@ func kemKeyGen(dk *DecapsulationKey, d, z *[32]byte) *DecapsulationKey {
        ρ, σ := G[:32], G[32:]
        dk.ρ = [32]byte(ρ)
 
-       A := &dk.A
+       A := &dk.a
        for i := byte(0); i < k; i++ {
                for j := byte(0); j < k; j++ {
                        A[i*k+j] = sampleNTT(ρ, j, i)
@@ -266,7 +266,7 @@ func parseEK(ex *encryptionKey, ekPKE []byte) error {
 
        for i := byte(0); i < k; i++ {
                for j := byte(0); j < k; j++ {
-                       ex.A[i*k+j] = sampleNTT(ρ, j, i)
+                       ex.a[i*k+j] = sampleNTT(ρ, j, i)
                }
        }
 
@@ -295,7 +295,7 @@ func pkeEncrypt(cc *[CiphertextSize]byte, ex *encryptionKey, m *[messageSize]byt
                u[i] = e1[i]
                for j := range r {
                        // Note that i and j are inverted, as we need the transposed of A.
-                       u[i] = polyAdd(u[i], inverseNTT(nttMul(ex.A[j*k+i], r[j])))
+                       u[i] = polyAdd(u[i], inverseNTT(nttMul(ex.a[j*k+i], r[j])))
                }
        }