mirror of
https://github.com/luxfi/pulsar.git
synced 2026-09-24 00:25:52 +00:00
Single repo, one canonical impl + spec + proofs + KAT + cut tool.
Per "ONE and ONLY ONE way to do things" the prior dual-repo split
(luxfi/pulsar = production library, luxfi/pulsar-mptc = NIST MPTC
submission framework) is collapsed into a single canonical home at
github.com/luxfi/pulsar. SINGLE-IMPL-PLAN.md (now marked COMPLETED)
describes the steps; this commit lands the final step.
Files moved (89 new):
16 submission docs (SUBMISSION, NIST-SUBMISSION, SPEC, SUITE,
PATENTS, AXIOM-INVENTORY, PROOF-CLAIMS, FIPS-TRACEABILITY,
TRUSTED-COMPUTING-BASE, HANZO-CRYPTO-SUITE, INFORMATION-
ARCHITECTURE, ROADMAP, CHANGELOG, SYNC-STATUS, STATUS-
SUBMISSION-READINESS, SINGLE-IMPL-PLAN)
10 docs/ supplements (ietf-draft-skeleton, magnetar, evaluation,
patent-claims, x-wing-sig, design-decisions, family-architecture,
threat-model, nist-mptc-category, patent-notes-draft)
19 proofs/ (13 EC theories + 2 EC lemmas + 4 metadata/READMEs +
lean-easycrypt-bridge.md)
14 jasmin/ (lib/* + ml-dsa-65 fetch + threshold/{combine,round1,
round2}.jazz + READMEs)
10 ct/dudect/ (Makefile, combine_ct.go, dudect_combine.c,
dudect_compat.h, dudect_verify.c, fetch.sh, README, run-
submission.sh, verify_ct.go) + ct/jasmin-ct-libjade.md
1 .github/workflows/ci.yml
1 test/interoperability/n1_class_test.go (19/19 N1 subtests)
1 bench/results/REPORT.md
11 scripts/ (cut-submission, check-high-assurance, check-lean-
bridge, nightly, extract-jasmin-ec, checks/{ec-admits, ec-
compile, ec-refinement-scaffold, ec-regressions, extraction,
jasmin}, checks/test/{go-unit, interop, kat, no-secret-logs})
Files merged (16 overlapping, mptc-canonical chosen because newer +
post-rewire-correct; pulsar versions still bore stale "Pulsar-M" /
"pulsarm" branding):
README.md, BLOCKERS.md, CONTRIBUTING.md, LICENSE, LICENSING.md,
SECURITY.md, .gitignore, bench/run_all.sh, vectors/dkg.json (v1.0.7
regen), scripts/{bench,build,gen_vectors,sbom,test}.sh,
spec/{pulsar,parameters,system-model}.tex,
CRYPTOGRAPHER-SIGN-OFF.md (path refs).
Pulsar-only spec supplements preserved:
spec/{blockers,design-decisions,family-architecture,nist-mptc-
category,patent-notes,threat-model}.tex.
Path rewrites applied: 158 occurrences across 26 files
github.com/luxfi/pulsar-mptc -> github.com/luxfi/pulsar
~/work/lux/pulsar-mptc/ -> ~/work/lux/pulsar/
luxfi/pulsar-mptc -> luxfi/pulsar
pulsar-mptc/ -> ./
Narrative collapses (no more two-repo framing):
SUBMISSION.md "At a glance" — single Repository row
SYNC-STATUS.md — rewritten to single-repo state
SINGLE-IMPL-PLAN.md — marked COMPLETED 2026-05-18
HANZO-CRYPTO-SUITE.md — tier 1 row = single canonical home
scripts/cut-submission.sh — replace/vendor dance removed; cuts
directly from in-tree canonical sources
go.mod: dropped mptc's replace directive (no longer needed since this
IS the canonical pulsar repo). Module path is github.com/luxfi/pulsar.
Deps: cloudflare/circl v1.6.3, golang.org/x/crypto v0.32.0.
Verification:
GOWORK=off go build ./... PASS
GOWORK=off go test -count=1 ./... PASS (1.4s)
GOWORK=off go test -race ./ref/... PASS (14.7s)
go test ./test/interoperability/ PASS (19/19 N1 subtests)
scripts/check-high-assurance.sh PASS
scripts/check-lean-bridge.sh PASS (5/5 bridges)
scripts/gen_vectors.sh byte-identical replay
scripts/cut-submission.sh --help PASS
98 lines
3.0 KiB
C
98 lines
3.0 KiB
C
/*
|
||
* Copyright (C) 2025-2026, Lux Industries Inc. All rights reserved.
|
||
* See the file LICENSE for licensing terms.
|
||
*
|
||
* dudect_compat.h — minimal x86-intrinsic compatibility shim for
|
||
* AArch64 hosts.
|
||
*
|
||
* Upstream dudect.h (https://github.com/oreparaz/dudect) hard-codes
|
||
* x86 intrinsics for cycle counting:
|
||
*
|
||
* _mm_mfence() — memory barrier
|
||
* __rdtsc() — read time-stamp counter
|
||
*
|
||
* On AArch64 hosts (Apple Silicon, AWS Graviton, etc.), these are
|
||
* not available. This shim supplies equivalents.
|
||
*
|
||
* Counter source by OS:
|
||
* - Linux/AArch64: CNTVCT_EL0 — the AArch64 generic timer counter.
|
||
* Readable from EL0 on every supported kernel. Monotonic.
|
||
* Frequency from CNTFRQ_EL0 (typically 50-100 MHz; the resulting
|
||
* resolution is coarser than RDTSC but the t-test is dimensionless
|
||
* in counter units so the constant-time verdict is unchanged.)
|
||
* - Darwin/AArch64 (Apple Silicon): CNTVCT_EL0 is exposed but reads
|
||
* in user mode have been observed to return non-monotonic values
|
||
* (the timer is virtualised differently per-process). We use
|
||
* mach_absolute_time() instead, which the XNU kernel guarantees is
|
||
* monotonic and high-resolution. The tick frequency is exposed via
|
||
* mach_timebase_info but we don't normalise — dudect operates on
|
||
* raw deltas only.
|
||
*
|
||
* The shim is included BEFORE dudect.h via -include, so it intercepts
|
||
* the x86 headers (<emmintrin.h>, <x86intrin.h>) by providing the
|
||
* symbols dudect needs without ever pulling in the SSE/AVX
|
||
* headerset.
|
||
*/
|
||
|
||
#ifndef DUDECT_COMPAT_H
|
||
#define DUDECT_COMPAT_H
|
||
|
||
#if defined(__aarch64__)
|
||
|
||
#include <stdint.h>
|
||
|
||
/*
|
||
* Replace x86 intrinsic headers with empty stubs on ARM64 so dudect.h
|
||
* can include them as written.
|
||
*/
|
||
#define _EMMINTRIN_H_INCLUDED
|
||
#define __EMMINTRIN_H
|
||
#define _IMMINTRIN_H_INCLUDED
|
||
#define _X86INTRIN_H_INCLUDED
|
||
#define __X86INTRIN_H
|
||
|
||
/*
|
||
* Full data + instruction barrier. dudect calls this immediately
|
||
* before reading the cycle counter to keep memory operations ordered
|
||
* with respect to the counter read.
|
||
*/
|
||
static inline void _mm_mfence(void) {
|
||
__asm__ __volatile__("dsb sy" ::: "memory");
|
||
}
|
||
|
||
#if defined(__APPLE__)
|
||
|
||
#include <mach/mach_time.h>
|
||
|
||
/*
|
||
* Apple Silicon: use mach_absolute_time(). High-resolution, monotonic,
|
||
* kernel-virtualised. Resolution is typically 1 ns (24 MHz timer with
|
||
* 41.667 ns per tick × scaler — varies by Mac model; XNU normalises
|
||
* via mach_timebase_info).
|
||
*
|
||
* mach_absolute_time() is observably free of the non-monotonic
|
||
* artefacts CNTVCT_EL0 has in EL0 on macOS.
|
||
*/
|
||
static inline uint64_t __rdtsc(void) {
|
||
return mach_absolute_time();
|
||
}
|
||
|
||
#else /* Linux / *BSD on AArch64 */
|
||
|
||
/*
|
||
* Read the AArch64 virtual count register (CNTVCT_EL0). Readable
|
||
* from EL0 by default on Linux. ISB before the read ensures the
|
||
* counter read is not speculated past the preceding fence.
|
||
*/
|
||
static inline uint64_t __rdtsc(void) {
|
||
uint64_t v;
|
||
__asm__ __volatile__("isb; mrs %0, cntvct_el0" : "=r" (v));
|
||
return v;
|
||
}
|
||
|
||
#endif /* __APPLE__ */
|
||
|
||
#endif /* __aarch64__ */
|
||
|
||
#endif /* DUDECT_COMPAT_H */
|