-
Notifications
You must be signed in to change notification settings - Fork 2
/
Package.swift
133 lines (119 loc) · 3.76 KB
/
Package.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// swift-tools-version:5.0
import PackageDescription
enum Sources {
static let libargon2: [String] = [
"src/argon2.c",
"src/core.c",
"src/blake2/blake2b.c",
"src/thread.c",
"src/encoding.c",
"src/ref.c",
].map({ "Dependencies/argon2/\($0)" })
static let libecc: [String] = [
// These are enumerated by combining `libecc` and `libsig` from the "Compiling with environments without GNU make" section of the README.
"src/curves/aff_pt.c",
"src/curves/curves.c",
"src/curves/ec_params.c",
"src/curves/ec_params.o",
"src/curves/ec_shortw.c",
"src/curves/prj_pt.c",
"src/curves/prj_pt_monty.c",
"src/fp/fp.c",
"src/fp/fp_add.c",
"src/fp/fp_montgomery.c",
"src/fp/fp_mul.c",
"src/fp/fp_mul_redc1.c",
"src/fp/fp_pow.c",
"src/fp/fp_rand.c",
"src/hash/hash_algs.c",
"src/hash/sha224.c",
"src/hash/sha256.c",
"src/hash/sha3-224.c",
"src/hash/sha3-256.c",
"src/hash/sha3-384.c",
"src/hash/sha3-512.c",
"src/hash/sha3.c",
"src/hash/sha384.c",
"src/hash/sha512.c",
"src/nn/nn.c",
"src/nn/nn_add.c",
"src/nn/nn_div.c",
"src/nn/nn_logical.c",
"src/nn/nn_modinv.c",
"src/nn/nn_mul.c",
"src/nn/nn_mul_redc1.c",
"src/nn/nn_rand.c",
"src/sig/ec_key.c",
"src/sig/ecdsa.c",
"src/sig/ecfsdsa.c",
"src/sig/ecgdsa.c",
"src/sig/eckcdsa.c",
"src/sig/ecosdsa.c",
"src/sig/ecrdsa.c",
"src/sig/ecsdsa.c",
"src/sig/ecsdsa_common.c",
"src/sig/sig_algs.c",
"src/utils/print_curves.c",
"src/utils/print_fp.c",
"src/utils/print_keys.c",
"src/utils/print_nn.c",
"src/utils/utils.c",
].map({ "Dependencies/libecc/\($0)" })
static let tweetNaCl: [String] = [
"Dependencies/tweetnacl/tweetnacl.c"
]
}
enum Settings {
static let libargon2: [CSetting] = [
.headerSearchPath("Sources/CLibOpaque/Dependencies/argon2/include"),
.headerSearchPath("Dependencies/argon2/include")
]
static let libecc: [CSetting] = [
.headerSearchPath("Sources/CLibOpaque/Dependencies/libecc/src"),
.headerSearchPath("Dependencies/libecc/src"),
]
static let tweetNaCl: [CSetting] = [
.headerSearchPath("Sources/CLibOpaque/Dependencies/tweetnacl"),
.headerSearchPath("Dependencies/tweetnacl")
]
}
let package = Package(
name: "Opaque",
products: [
.library(
name: "libopaque",
targets: ["CLibOpaque"]),
.library(
name: "Opaque",
targets: ["Opaque"]),
.executable(
name: "WebAssemblyTestCompanion",
targets: ["WebAssemblyTestCompanion"])
],
targets: [
// Swift Sources
.target(
name: "PlatformDependencies"),
.target(
name: "CLibOpaque",
dependencies: ["PlatformDependencies"],
sources: Array([
Sources.libargon2,
Sources.libecc,
Sources.tweetNaCl,
["dependencies.c", "opaque.c"]
].joined()),
cSettings: Settings.libargon2 + Settings.libecc + Settings.tweetNaCl),
.target(
name: "Opaque",
dependencies: ["CLibOpaque"]),
.testTarget(
name: "OpaqueTests",
dependencies: ["Opaque"]),
// WebAssembly Test Companion
.target(
name: "WebAssemblyTestCompanion",
dependencies: ["Opaque"],
path: "Sources/WebAssembly/TestCompanion")
]
)