Skip to content

armgit / xtool

Public Imported from GitHub
0

Cross-platform Xcode replacement. Build and deploy iOS apps with SwiftPM on Linux, Windows, macOS.

more cleanup

Kabir Oberaib78eaca5f23d
diff --git a/Supersign/Sources/CSupersign/include/mobileprovision.h b/Supersign/Sources/CSupersign/include/mobileprovision.h
index 4a60ce8..d06d6ee 100644
--- a/Supersign/Sources/CSupersign/include/mobileprovision.h
+++ b/Supersign/Sources/CSupersign/include/mobileprovision.h
@@ -20,15 +20,12 @@ typedef struct mobileprovision *mobileprovision_t;
/// create a profile from the given data
_Nullable mobileprovision_t mobileprovision_create_from_data(const void *data, size_t len);
-/// create a profile from the given file path
-_Nullable mobileprovision_t mobileprovision_create_from_path(const char *path);
-
/// free `profile`
void mobileprovision_free(mobileprovision_t profile);
// MARK: - Operations
-void * _Nullable mobileprovision_get_data(mobileprovision_t profile, size_t *len);
+void * _Nullable mobileprovision_copy_data(mobileprovision_t profile, size_t *len);
const void * _Nullable mobileprovision_get_digest(mobileprovision_t profile, size_t *len);
diff --git a/Supersign/Sources/CSupersign/mobileprovision.c b/Supersign/Sources/CSupersign/mobileprovision.c
index 0d7e29f..aa98cb6 100644
--- a/Supersign/Sources/CSupersign/mobileprovision.c
+++ b/Supersign/Sources/CSupersign/mobileprovision.c
@@ -30,24 +30,12 @@ mobileprovision_t mobileprovision_create_from_data(const void *data, size_t len)
return mobileprovision_create(raw);
}
-mobileprovision_t mobileprovision_create_from_path(const char *path) {
- BIO *file = BIO_new_file(path, "r");
- if (!file) return NULL;
-
- PKCS7 *raw = NULL;
- d2i_PKCS7_bio(file, &raw);
-
- BIO_free(file);
-
- return mobileprovision_create(raw);
-}
-
void mobileprovision_free(mobileprovision_t profile) {
PKCS7_free(profile->raw);
free(profile);
}
-void *mobileprovision_get_data(mobileprovision_t profile, size_t *len) {
+void *mobileprovision_copy_data(mobileprovision_t profile, size_t *len) {
unsigned char *data = NULL;
size_t data_len = i2d_PKCS7(profile->raw, &data);
if (data_len < 0) return NULL;
diff --git a/Supersign/Sources/Supersign/Model/Mobileprovision/Mobileprovision.swift b/Supersign/Sources/Supersign/Model/Mobileprovision/Mobileprovision.swift
index 2d0596b..61a037b 100644
--- a/Supersign/Sources/Supersign/Model/Mobileprovision/Mobileprovision.swift
+++ b/Supersign/Sources/Supersign/Model/Mobileprovision/Mobileprovision.swift
@@ -53,12 +53,6 @@ public final class Mobileprovision: Decodable {
self.raw = profile
}
- public init(contentsOf url: URL) throws {
- guard let profile = url.withUnsafeFileSystemRepresentation({ $0.flatMap(mobileprovision_create_from_path) })
- else { throw Error.invalidProfile }
- self.raw = profile
- }
-
public required init(from decoder: Decoder) throws {
let container = try decoder.singleValueContainer()
let data = try container.decode(Data.self)
@@ -86,7 +80,7 @@ public final class Mobileprovision: Decodable {
}
public func data() throws -> Data {
- try Data { mobileprovision_get_data(raw, &$0) }.orThrow(Error.invalidProfile)
+ try Data { mobileprovision_copy_data(raw, &$0) }.orThrow(Error.invalidProfile)
}
}