#include <plist/plist.h>
+#include "ldid.hpp"
+
#define _assert___(line) \
#line
#define _assert__(line) \
return value;
}
-static void resign(void *idata, size_t isize, std::streambuf &output, const Functor<size_t (size_t)> &allocate, const Functor<size_t (std::streambuf &output, size_t, const std::string &, const char *)> &save) {
+namespace ldid {
+
+static void Allocate(void *idata, size_t isize, std::streambuf &output, const Functor<size_t (size_t)> &allocate, const Functor<size_t (std::streambuf &output, size_t, const std::string &, const char *)> &save) {
FatHeader source(idata, isize);
size_t offset(0);
}
}
+}
+
typedef std::map<uint32_t, std::string> Blobs;
static void insert(Blobs &blobs, uint32_t slot, const std::stringbuf &buffer) {
}
};
-typedef std::map<uint32_t, std::string> Slots;
+namespace ldid {
-void resign(void *idata, size_t isize, std::streambuf &output, const std::string &name, const std::string &entitlements, const std::string &key, const Slots &slots) {
- resign(idata, isize, output, fun([&](size_t size) -> size_t {
+void Sign(void *idata, size_t isize, std::streambuf &output, const std::string &name, const std::string &entitlements, const std::string &key, const Slots &slots) {
+ Allocate(idata, isize, output, fun([&](size_t size) -> size_t {
size_t alloc(sizeof(struct SuperBlob));
uint32_t special(0);
}));
}
-static void resign(void *idata, size_t isize, std::streambuf &output) {
- resign(idata, isize, output, fun([](size_t size) -> size_t {
+static void Unsign(void *idata, size_t isize, std::streambuf &output) {
+ Allocate(idata, isize, output, fun([](size_t size) -> size_t {
return 0;
}), fun([](std::streambuf &output, size_t limit, const std::string &overlap, const char *top) -> size_t {
return 0;
}));
}
+}
+
int main(int argc, char *argv[]) {
OpenSSL_add_all_algorithms();
Map entitlements;
Map key;
- Slots slots;
+ ldid::Slots slots;
std::vector<std::string> files;
_assert(output.open(temp.c_str(), std::ios::out | std::ios::trunc | std::ios::binary) == &output);
if (flag_r)
- resign(input.data(), input.size(), output);
+ ldid::Unsign(input.data(), input.size(), output);
else {
const char *name(flag_I ?: base);
- resign(input.data(), input.size(), output, name, entitlements, key, slots);
+ ldid::Sign(input.data(), input.size(), output, name, entitlements, key, slots);
}
struct stat info;