summaryrefslogtreecommitdiff
path: root/src/irmd/main.c
diff options
context:
space:
mode:
authorSander Vrijders <[email protected]>2017-07-12 15:18:15 +0200
committerSander Vrijders <[email protected]>2017-07-12 16:12:50 +0200
commitd088c3395a28bce3e1530db5aeacbcf59ab16619 (patch)
treed1da4fcf7cc2875b077d767775359ad92dc10d7c /src/irmd/main.c
parent3e9ee89b3ccf48dcabf7de2ecafcfbf637595cfe (diff)
downloadouroboros-d088c3395a28bce3e1530db5aeacbcf59ab16619.tar.gz
ouroboros-d088c3395a28bce3e1530db5aeacbcf59ab16619.zip
ipcpd, lib, irmd: Hardcode shim hash algorithms
This will hardcode the shim hash algorithms as they don't have an enrollment phase. Fixes #44
Diffstat (limited to 'src/irmd/main.c')
-rw-r--r--src/irmd/main.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/irmd/main.c b/src/irmd/main.c
index db6f33de..63ae6b13 100644
--- a/src/irmd/main.c
+++ b/src/irmd/main.c
@@ -58,6 +58,10 @@
#define SHM_SAN_HOLDOFF 1000 /* ms */
#define IPCP_HASH_LEN(e) hash_len(e->dir_hash_algo)
+#define SHIM_ETH_LLC_HASH_ALGO HASH_SHA3_256
+#define SHIM_UDP_HASH_ALGO HASH_MD5
+#define LOCAL_HASH_ALGO HASH_SHA3_256
+
struct ipcp_entry {
struct list_head next;
@@ -417,6 +421,18 @@ static int bootstrap_ipcp(pid_t api,
return -1;
}
+ if (entry->type == IPCP_LOCAL)
+ entry->dir_hash_algo = conf->dif_info->dir_hash_algo
+ = LOCAL_HASH_ALGO;
+ else if (entry->type == IPCP_SHIM_ETH_LLC)
+ entry->dir_hash_algo = conf->dif_info->dir_hash_algo
+ = SHIM_ETH_LLC_HASH_ALGO;
+ else if (entry->type == IPCP_SHIM_UDP)
+ entry->dir_hash_algo = conf->dif_info->dir_hash_algo
+ = SHIM_UDP_HASH_ALGO;
+ else
+ entry->dir_hash_algo = conf->dif_info->dir_hash_algo;
+
if (ipcp_bootstrap(entry->api, conf)) {
pthread_rwlock_unlock(&irmd.reg_lock);
log_err("Could not bootstrap IPCP.");
@@ -430,8 +446,6 @@ static int bootstrap_ipcp(pid_t api,
return -ENOMEM;
}
- entry->dir_hash_algo = conf->dif_info->dir_hash_algo;
-
pthread_rwlock_unlock(&irmd.reg_lock);
log_info("Bootstrapped IPCP %d in DIF %s.",