Skip to content

Commit 1ed21d7

Browse files
Added TomCrypt as a Swift Package. Lots taken from libtom/libtomcrypt#575
0 parents  commit 1ed21d7

File tree

9 files changed

+353
-0
lines changed

9 files changed

+353
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/xcuserdata/*

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "vendor"]
2+
path = vendor
3+
url = git@github.com:libtom/libtomcrypt.git

.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Headers/module.modulemap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module TomCrypt [extern_c] {
2+
header "tomcrypt.h"
3+
export *
4+
}

Headers/tomcrypt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "../vendor/src/headers/tomcrypt.h"

Package.resolved

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"object": {
3+
"pins": [
4+
{
5+
"package": "TomMath",
6+
"repositoryURL": "https://github.com/DavidSouthgate/TomMathSPM.git",
7+
"state": {
8+
"branch": "main",
9+
"revision": "d14f446ea2f0de6cf9d907f408a50133ed53bdd9",
10+
"version": null
11+
}
12+
}
13+
]
14+
},
15+
"version": 1
16+
}

Package.swift

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// swift-tools-version:5.0
2+
import PackageDescription
3+
4+
let package = Package(
5+
name: "TomCrypt",
6+
platforms: [
7+
.macOS(.v10_10), .iOS(.v9), .tvOS(.v9), .watchOS(.v4)
8+
],
9+
products: [
10+
.library(
11+
name: "TomCrypt",
12+
targets: [ "TomCrypt" ])
13+
],
14+
dependencies: [
15+
.package(url: "https://github.com/DavidSouthgate/TomMathSPM.git", .branchItem("main"))
16+
],
17+
targets: [
18+
.target(name: "TomCrypt",
19+
dependencies: [
20+
.product(name: "TomMath", package: "TomMathSPM")
21+
],
22+
path: ".",
23+
sources: [
24+
"vendor/src"
25+
],
26+
publicHeadersPath: "Headers",
27+
cSettings: [
28+
.headerSearchPath("vendor/src/headers"),
29+
.define("USE_LTM"),
30+
.define("LTM_DESC"),
31+
.define("LTC_NO_TEST"),
32+
.unsafeFlags(["-flto=thin"]) // for Dead Code Elimination
33+
]),
34+
.testTarget(name: "TomCryptTests",
35+
dependencies: [
36+
"TomCrypt"
37+
],
38+
path: "Tests")
39+
],
40+
cLanguageStandard: .gnu11,
41+
cxxLanguageStandard: .gnucxx14
42+
)

Tests/TomCryptTests.swift

Lines changed: 278 additions & 0 deletions
Large diffs are not rendered by default.

vendor

Submodule vendor added at fae62af

0 commit comments

Comments
 (0)