fix(nocgo): validate LatticeNTTMLDSABatch shape before no-backend return

The !cgo path returned ErrNotSupported for any input, but the cgo path
(and TestNoopBehavior) require shape validation first: a wrong-length
poly must be ErrShapeMismatch regardless of build. This was failing the
'Test without CGO (fallback)' CI job (pre-existing, since the op was
implemented). Now CGO=0 and CGO=1 agree.

Co-authored-by: Hanzo Dev <dev@hanzo.ai>
EOF
This commit is contained in:
Antje Worring
2026-06-06 23:37:24 -07:00
parent 9d20ecd0bb
commit f85c9747a9
+13 -1
View File
@@ -97,6 +97,18 @@ func MLDSASignBatch(_ int, _, _ [][]byte, _ int) ([][]byte, error) {
}
// LatticeNTTMLDSABatch returns ErrNotSupported in non-CGO builds.
func LatticeNTTMLDSABatch(_ [][]int32, _ bool) error {
func LatticeNTTMLDSABatch(polys [][]int32, _ bool) error {
// Validate the batch shape before the (absent) GPU dispatch decision,
// matching the cgo path so callers get the same error regardless of
// build: a wrong-length poly is ErrShapeMismatch, empty is
// ErrBatchSizeMismatch; otherwise no backend → ErrNotSupported.
if len(polys) == 0 {
return ErrBatchSizeMismatch
}
for _, p := range polys {
if len(p) != MLDSANTTPolyLen {
return ErrShapeMismatch
}
}
return ErrNotSupported
}