diff options
author | Sander Vrijders <sander.vrijders@ugent.be> | 2017-07-12 14:30:27 +0000 |
---|---|---|
committer | dimitri staessens <dimitri.staessens@ugent.be> | 2017-07-12 14:30:27 +0000 |
commit | 0bcb3ab0804bbfd31d056c08548cb40591598f4b (patch) | |
tree | d1da4fcf7cc2875b077d767775359ad92dc10d7c /src/irmd | |
parent | 3e9ee89b3ccf48dcabf7de2ecafcfbf637595cfe (diff) | |
parent | d088c3395a28bce3e1530db5aeacbcf59ab16619 (diff) | |
download | ouroboros-0bcb3ab0804bbfd31d056c08548cb40591598f4b.tar.gz ouroboros-0bcb3ab0804bbfd31d056c08548cb40591598f4b.zip |
Merged in sandervrijders/ouroboros/be-hash (pull request #528)
ipcpd, lib, irmd: Hardcode shim hash algorithms
Approved-by: dimitri staessens <dimitri.staessens@ugent.be>
Diffstat (limited to 'src/irmd')
-rw-r--r-- | src/irmd/main.c | 18 |
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.", |