summaryrefslogtreecommitdiff
path: root/trust/oid.c
diff options
context:
space:
mode:
authorStef Walter <stef@thewalter.net>2013-07-04 15:43:26 +0200
committerStef Walter <stef@thewalter.net>2013-07-04 15:47:32 +0200
commit2be55821c1ffab99b91c76c43c91dd95db1c21c7 (patch)
treefeee6926f5046fc6942ee508eed923a36c98cdd3 /trust/oid.c
parentec7c2ff2011d774217c1e35d664072d0487853c7 (diff)
downloadp11-kit-2be55821c1ffab99b91c76c43c91dd95db1c21c7.tar.gz
trust: Add p11_oid_hash() and various oid strings
Diffstat (limited to 'trust/oid.c')
-rw-r--r--trust/oid.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/trust/oid.c b/trust/oid.c
index b4b0bf6..dff4148 100644
--- a/trust/oid.c
+++ b/trust/oid.c
@@ -34,10 +34,12 @@
#include "config.h"
+#include "hash.h"
#include "oid.h"
#include <assert.h>
#include <stdlib.h>
+#include <stdint.h>
#include <string.h>
/*
@@ -60,6 +62,17 @@ p11_oid_simple (const unsigned char *oid,
(size_t)oid[1] == len - 2); /* matches length */
}
+unsigned int
+p11_oid_hash (const void *oid)
+{
+ uint32_t hash;
+ int len;
+
+ len = p11_oid_length (oid);
+ p11_hash_murmur3 (&hash, oid, len, NULL);
+ return hash;
+}
+
bool
p11_oid_equal (const void *oid_one,
const void *oid_two)