SPB Git

Repository Public

Package.swift 5.3 KB 106 lines swift

1// swift-tools-version: 6.22// =============================================================================3//                  SP BOUCHER | SOFTWARE & RESEARCH4//             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5// =============================================================================6//7// Project          : QYVORA8// File             : security/tests/Package.swift9// Module           : Tests10// Repository       : https://git.spboucher.ai/qyvora11// Project Website  : Not specified12// Created          : 2026-12-0413// Last Modified    : 2026-12-0414//15// Author           : Simon-Pierre Boucher16// Position         : Professor of Finance17// Institution      : Université du Québec en Outaouais (UQO)18// Organization     : SP Boucher19// Website          : https://spboucher.ai20// Git              : https://git.spboucher.ai21//22// Preferred Contact: contact@spboucher.ai23// Development      : dev@spboucher.ai24// Support          : support@spboucher.ai25// Security/Admin   : admin@spboucher.ai26//27// Copyright (c) 202628// Simon-Pierre Boucher29// All rights reserved where applicable. This file is governed by the30// applicable project license, copyright notices and relevant law.31// Existing third-party rights and notices remain unaffected.32//33// License          : None specified (no license file in this repository)34//35// Do not embed credentials, private keys, access tokens,36// certificates or confidential personal information.37//38// =============================================================================39// END OF SP BOUCHER SOURCE HEADER40// =============================================================================4142import Foundation43import PackageDescription4445// QYVORA security-audit package. It depends on the engine (the root package) by path and adds46// nothing to the production targets. Reference implementations (CryptoKit, CommonCrypto, the Rust47// library spb-quantum-crypto, Python oracles) are used here only, as independent oracles.48//49// Run through the orchestrator (`Scripts/security-audit.sh`) or directly:50//   swift test -c release --package-path security/tests --scratch-path /tmp/qy-audit51//52// The identity of a path dependency is the name of its directory, which differs between a normal53// checkout ("Qyvora") and a Git worktree: it is computed from this file's location.54let root = URL(fileURLWithPath: #filePath)55    .deletingLastPathComponent().deletingLastPathComponent().deletingLastPathComponent()56let rootIdentity = root.lastPathComponent.lowercased()5758func engine(_ names: String...) -> [Target.Dependency] {59    names.map { .product(name: $0, package: rootIdentity) }60}6162let allEngine: [Target.Dependency] = engine(63    "QyvoraMath", "QyvoraKeccak", "QyvoraSymmetric", "QyvoraMLKEM", "QyvoraMLDSA", "QyvoraSLHDSA",64    "QyvoraSecp256k1", "QyvoraCrypto", "QyvoraCore", "QyvoraBitcoin", "QyvoraEthereum", "QyvoraStorage",65    "QyvoraNetworking", "QyvoraVault", "QyvoraIdentity", "QyvoraRecovery", "QyvoraWallet",66    "QyvoraEd25519", "QyvoraSolana", "QyvoraTron")6768func auditTests(_ name: String) -> Target {69    .testTarget(name: name, dependencies: allEngine + ["AuditSupport"], path: "Tests/\(name)")70}7172// QY_AUDIT_ONLY="ConformanceAuditTests,qytiming" restricts the package to the listed targets (plus the73// support libraries): faster iteration, and one target under work does not block the others.74let only: Set<String>? = ProcessInfo.processInfo.environment["QY_AUDIT_ONLY"].map {75    let names = Set($0.split(separator: ",").map(String.init))76    let fuzz = !names.isDisjoint(with: ["qyfuzz", "FuzzReplayTests"])77    return names.union(fuzz ? ["AuditSupport", "CAuditDIT", "FuzzTargets"] : ["AuditSupport", "CAuditDIT"])78}7980let allTargets: [Target] = [81        .target(name: "AuditSupport", dependencies: engine("QyvoraMath"), path: "Sources/AuditSupport"),82        // Harness bodies shared by the fuzzer executable and by the tests that replay the corpus.83        .target(name: "FuzzTargets", dependencies: allEngine + ["AuditSupport"], path: "Sources/FuzzTargets"),84        .executableTarget(name: "qyfuzz", dependencies: ["FuzzTargets", "AuditSupport"], path: "Sources/qyfuzz"),85        // C shim giving the timing tool access to the processor's data-independent-timing flag (test environment only).86        .target(name: "CAuditDIT", path: "Sources/CAuditDIT"),87        // QY_TIMING_INTERNALS=1 (together with -Xswiftc -enable-testing) adds the timing targets that call internal88        // functions of the Ed25519 module with chosen scalars; the default build is the production one.89        .executableTarget(90            name: "qytiming", dependencies: allEngine + ["AuditSupport", "CAuditDIT"], path: "Sources/qytiming",91            swiftSettings: ProcessInfo.processInfo.environment["QY_TIMING_INTERNALS"] == "1" ? [.define("QY_TIMING_INTERNALS")] : []),92        auditTests("ConformanceAuditTests"),93        auditTests("WycheproofAuditTests"),94        auditTests("DifferentialAuditTests"),95        auditTests("PropertyAuditTests"),96        .testTarget(name: "FuzzReplayTests", dependencies: ["FuzzTargets", "AuditSupport"], path: "Tests/FuzzReplayTests"),97]9899let package = Package(100    name: "QyvoraSecurityAudit",101    platforms: [.macOS(.v26)],102    dependencies: [.package(path: "../..")],103    targets: allTargets.filter { only?.contains($0.name) ?? true },104    swiftLanguageModes: [.v6]105)106
Files main
Menu

Theme