fix(l1): Export PQXDH module and correct build linkage
- l1-identity/crypto.zig: Export pqxdh module for SDK consumption - build.zig: Define proper modules for PQXDH library and tests - Link liboqs to l1_pqxdh_mod and propagate dependency to l1_mod
This commit is contained in:
parent
d9adadd1d5
commit
3b3993bea6
23
build.zig
23
build.zig
|
|
@ -143,17 +143,36 @@ pub fn build(b: *std.Build) void {
|
|||
// L1 PQXDH tests (Phase 3)
|
||||
// ========================================================================
|
||||
const l1_pqxdh_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l1-identity/pqxdh.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
l1_pqxdh_mod.addIncludePath(b.path("vendor/liboqs/install/include"));
|
||||
l1_pqxdh_mod.addLibraryPath(b.path("vendor/liboqs/install/lib"));
|
||||
l1_pqxdh_mod.linkSystemLibrary("oqs", .{ .needed = true });
|
||||
// Consuming artifacts must linkLibC()
|
||||
|
||||
// Import PQXDH into main L1 module
|
||||
l1_mod.addImport("pqxdh", l1_pqxdh_mod);
|
||||
|
||||
// Tests (root is test_pqxdh.zig)
|
||||
const l1_pqxdh_tests_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l1-identity/test_pqxdh.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
// Tests import the library module 'pqxdh' (relative import works too, but module is cleaner if we use @import("pqxdh"))
|
||||
// But test_pqxdh.zig uses @import("pqxdh.zig") which is relative file import.
|
||||
// If we use relative import, the test module must be able to resolve pqxdh.zig.
|
||||
// Since they are in same dir, relative import works.
|
||||
// BUT the artifact compiled from test_pqxdh.zig needs to link liboqs because it effectively includes pqxdh.zig code.
|
||||
|
||||
const l1_pqxdh_tests = b.addTest(.{
|
||||
.root_module = l1_pqxdh_mod,
|
||||
.root_module = l1_pqxdh_tests_mod,
|
||||
});
|
||||
l1_pqxdh_tests.linkLibC();
|
||||
l1_pqxdh_tests.addIncludePath(b.path("vendor/liboqs/install/include"));
|
||||
l1_pqxdh_tests.addLibraryPath(b.path("vendor/liboqs/install/lib")); // For liboqs.a
|
||||
l1_pqxdh_tests.addLibraryPath(b.path("vendor/liboqs/install/lib"));
|
||||
l1_pqxdh_tests.linkSystemLibrary("oqs");
|
||||
const run_l1_pqxdh_tests = b.addRunArtifact(l1_pqxdh_tests);
|
||||
|
||||
|
|
|
|||
|
|
@ -11,10 +11,15 @@
|
|||
const std = @import("std");
|
||||
const crypto = std.crypto;
|
||||
|
||||
// Ensure crypto FFI exports are compiled when this module is used
|
||||
// This makes Zig-exported C functions available to C code
|
||||
// Ensure crypto FFI exports are compiled when this module is used
|
||||
// This makes Zig-exported C functions available to C code
|
||||
const _ = @import("crypto_exports");
|
||||
|
||||
// Post-Quantum XDH (RFC-0830)
|
||||
pub const pqxdh = @import("pqxdh");
|
||||
|
||||
/// RFC-0830 Section 2.6: WORLD_PUBLIC_KEY
|
||||
/// This is the well-known public key used for World Feed encryption.
|
||||
/// Everyone can decrypt World posts, but ISPs see only ciphertext.
|
||||
|
|
|
|||
Loading…
Reference in New Issue