mirror of
https://github.com/luxfi/fhe.git
synced 2026-07-26 23:16:08 +00:00
Drop local SecurityProfile, ProfileClassical128, ProfileStrictPQ, ProfileStrictPQHighValue, IsPostQuantum, String, ProfileFromPQFlag. The strict-PQ Mode vocabulary lives in github.com/luxfi/pq as the single source of truth across warp, dex, evm, fhe, zap. DefaultParamsForProfile (local enum) → DefaultParamsForMode (pq.Mode): strict-PQ ⇒ PN9QP27_STD128Q (NIST FIPS 203 / 204 LMKCDEY); classical / hybrid ⇒ PN10QP27 (~128-bit classical, dev-only). The FHE gate is parameter SELECTION, not refusal — no classical ciphertext to refuse at the parameter layer, so the ValidateMode call doesn't apply here. ProfileStrictPQHighValue dropped: it was a no-op tier returning the same PQ literal as the base strict-PQ profile. Once STD192Q_LMKCDEY-aligned ParametersLiterals land, callers pick them explicitly — the mode vocabulary stays single-purpose.
38 lines
1.3 KiB
Go
38 lines
1.3 KiB
Go
// Copyright (C) 2019-2026, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package fhe
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/luxfi/pq"
|
|
)
|
|
|
|
// TestDefaultParamsForMode_StrictPQReturnsPQLiteral pins the
|
|
// security guarantee: pq.ModeStrictPQ MUST return a PQ
|
|
// ParametersLiteral, never a classical one. A regression that
|
|
// pointed strict-PQ at PN10QP27 would silently weaken every Liquid
|
|
// FHE chain. The test asserts byte-identity, not just "some PQ
|
|
// literal", so swapping the underlying PQ literal name requires an
|
|
// explicit test update.
|
|
func TestDefaultParamsForMode_StrictPQReturnsPQLiteral(t *testing.T) {
|
|
got := DefaultParamsForMode(pq.ModeStrictPQ)
|
|
if got != PN9QP27_STD128Q {
|
|
t.Errorf("DefaultParamsForMode(StrictPQ) = %+v, want PN9QP27_STD128Q", got)
|
|
}
|
|
}
|
|
|
|
// TestDefaultParamsForMode_ClassicalReturnsClassicalLiteral pins
|
|
// the converse: classical mode returns the classical literal.
|
|
// Hybrid also returns classical params — the gate is selection, not
|
|
// refusal, and FHE parameter sets don't have a hybrid mid-tier.
|
|
func TestDefaultParamsForMode_ClassicalReturnsClassicalLiteral(t *testing.T) {
|
|
for _, m := range []pq.Mode{pq.ModeClassical, pq.ModeHybrid} {
|
|
got := DefaultParamsForMode(m)
|
|
if got != PN10QP27 {
|
|
t.Errorf("DefaultParamsForMode(%s) = %+v, want PN10QP27", m, got)
|
|
}
|
|
}
|
|
}
|