aboutsummaryrefslogtreecommitdiff
path: root/helper.c
diff options
context:
space:
mode:
authorFranklin Wei <me@fwei.tk>2018-06-04 21:37:57 -0400
committerFranklin Wei <me@fwei.tk>2018-06-04 21:37:57 -0400
commit040a9bab4cafb4dd6ec44485a5c421d99a00cffe (patch)
treedd0f95ae3d2f6215c0b5380046c8a1d675e3c52e /helper.c
parent35d085feee188ef5b6910fe67222fb297c5c6ea6 (diff)
downloadcsaa-040a9bab4cafb4dd6ec44485a5c421d99a00cffe.zip
csaa-040a9bab4cafb4dd6ec44485a5c421d99a00cffe.tar.gz
csaa-040a9bab4cafb4dd6ec44485a5c421d99a00cffe.tar.bz2
csaa-040a9bab4cafb4dd6ec44485a5c421d99a00cffe.tar.xz
Restructure; test file creation
sp_test() now shows a bare minimum example of creating a file. Further improvements are definitely needed.
Diffstat (limited to '')
-rw-r--r--helper.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/helper.c b/helper.c
new file mode 100644
index 0000000..1a751e1
--- /dev/null
+++ b/helper.c
@@ -0,0 +1,25 @@
+/* Functions to help with certificate generation (untrusted). */
+
+/* Some of the certificate generation routines require multiple other
+ * certificates to function. This file provides various helper
+ * functions to handle the generation of these needed certificates. */
+
+#include "crypto.h"
+#include "trusted_module.h"
+
+struct tm_cert cert_ru(struct trusted_module *tm,
+ const struct iomt_node *node, hash_t new_val,
+ const hash_t *comp, const int *orders, size_t n,
+ hash_t *hmac_out)
+{
+ struct iomt_node new_node = *node;
+ new_node.val = new_val;
+ hash_t nu_hmac;
+ struct tm_cert nu = tm_cert_node_update(tm,
+ hash_node(node),
+ hash_node(&new_node),
+ comp, orders, n,
+ &nu_hmac);
+
+ return tm_cert_record_update(tm, &nu, nu_hmac, node, new_val, hmac_out);
+}