aboutsummaryrefslogtreecommitdiff
path: root/service_provider.c
diff options
context:
space:
mode:
authorFranklin Wei <me@fwei.tk>2018-05-30 22:45:20 -0400
committerFranklin Wei <me@fwei.tk>2018-05-30 22:45:20 -0400
commitfbd47093d2e71e4d6a58b4c23ac57e357a26ab2a (patch)
tree31c6b84dd6d0d8931cb093c7a2b2c86c4ab7e760 /service_provider.c
parent8ff48e0c8e4f4012527083bf072db385b57fc222 (diff)
downloadcsaa-fbd47093d2e71e4d6a58b4c23ac57e357a26ab2a.zip
csaa-fbd47093d2e71e4d6a58b4c23ac57e357a26ab2a.tar.gz
csaa-fbd47093d2e71e4d6a58b4c23ac57e357a26ab2a.tar.bz2
csaa-fbd47093d2e71e4d6a58b4c23ac57e357a26ab2a.tar.xz
work on various things
Diffstat (limited to 'service_provider.c')
-rw-r--r--service_provider.c51
1 files changed, 50 insertions, 1 deletions
diff --git a/service_provider.c b/service_provider.c
index 5b9c00f..a05e223 100644
--- a/service_provider.c
+++ b/service_provider.c
@@ -1,10 +1,59 @@
/* implementation of a basic service provider for use with the trusted
* module */
+#include <stdlib.h>
+
+#include "crypto.h"
#include "service_provider.h"
#include "trusted_module.h"
-#include "crypto.h"
+
+struct file_version {
+ hash_t k; /* h(key, f_idx) */
+ hash_t l; /* h(encrypted contents, k) */
+ hash_t enc_key; /* XOR'd with h(k, module secret) */
+
+ struct tm_cert cert; /* VR certificate */
+ hash_t cert_hmac;
+
+ void *contents;
+ size_t len;
+};
+
+struct file_record {
+ int version;
+ int counter;
+
+ struct iomt_node *acl;
+ int acl_nodes;
+
+ struct tm_cert cert; /* FR cert */
+ hash_t cert_hmac;
+
+ struct file_version *versions;
+ int n_versions;
+};
struct service_provider {
struct trusted_module *tm;
+
+ struct file_record *records;
+ int n_records;
+
+ struct iomt_node *mt; /* leaves of CDI-IOMT, value is counter */
+ int mt_nodes;
};
+
+struct service_provider *sp_new(const void *key, size_t keylen)
+{
+ struct service_provider *sp = calloc(1, sizeof(*sp));
+
+ sp->tm = tm_new(key, keylen);
+
+ /* everything else is already zeroed by calloc */
+ return sp;
+}
+
+void sp_request(struct service_provider *sp, const struct user_request *req, hmac_t hmac)
+{
+
+}