mirror of
https://github.com/luxfi/crypto.git
synced 2026-10-30 16:59:13 +00:00
Closes the gap on the KEM side parallel to Comet on the signature side. HQC's hardness rests on Syndrome Decoding on random quasi-cyclic codes (NP-hard, no known classical or quantum polynomial-time attack), so a structural break against MLWE does not compromise HQC and vice-versa. Three modes pinned to NIST IR 8528 §4.1: HQC-128 (Cat 1), HQC-192 (Cat 3), HQC-256 (Cat 5). Shared secret is 64 B for all modes (distinct from ML-KEM's 32 B). Default build returns ErrBackendNotWired; activate via -tags=hqc_pqclean (cgo to PQClean) or -tags=hqc_circl (when Cloudflare CIRCL ships HQC).
31 lines
953 B
Go
31 lines
953 B
Go
// Copyright (C) 2026, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
//go:build !hqc_circl && !hqc_pqclean
|
|
|
|
package hqc
|
|
|
|
import "io"
|
|
|
|
// backend_stub.go — default build (no HQC backend wired).
|
|
//
|
|
// Every entry point returns ErrBackendNotWired. Build with one of:
|
|
// -tags=hqc_pqclean cgo binding to PQClean's HQC reference C
|
|
// -tags=hqc_circl Cloudflare CIRCL Go implementation (when shipped)
|
|
//
|
|
// The stub keeps the package buildable on hosts where the backend
|
|
// libraries aren't installed (same discipline as luxfi/accel's weak-stub
|
|
// fallback for native GPU libs).
|
|
|
|
func backendKeyGen(_ Mode, _ io.Reader) (*PrivateKey, error) {
|
|
return nil, ErrBackendNotWired
|
|
}
|
|
|
|
func backendEncapsulate(_ *PublicKey, _ io.Reader) (*Ciphertext, []byte, error) {
|
|
return nil, nil, ErrBackendNotWired
|
|
}
|
|
|
|
func backendDecapsulate(_ *PrivateKey, _ *Ciphertext) ([]byte, error) {
|
|
return nil, ErrBackendNotWired
|
|
}
|