aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/utils/utils.h
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2015-04-14 11:57:17 +0200
committerMartin Willi <martin@revosec.ch>2015-04-14 12:02:51 +0200
commitaa9b74931f4639628b369ffb290721f5ec263f69 (patch)
treeb46293e2993cf75e44888b1bd8ef73d0e97e797e /src/libstrongswan/utils/utils.h
parentb17f0beda805a8096de6a381a4845711a64a500e (diff)
parent161a015782dbd7acf291f621d50cde24a6ed813d (diff)
downloadstrongswan-aa9b74931f4639628b369ffb290721f5ec263f69.tar.bz2
strongswan-aa9b74931f4639628b369ffb290721f5ec263f69.tar.xz
Merge branch 'const-memeq'
Introduce constant time memory comparing functions for cryptographic purposes, and a tool to test such functions or crypto transforms relying on them.
Diffstat (limited to 'src/libstrongswan/utils/utils.h')
-rw-r--r--src/libstrongswan/utils/utils.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/libstrongswan/utils/utils.h b/src/libstrongswan/utils/utils.h
index 7c48d949f..2675acae8 100644
--- a/src/libstrongswan/utils/utils.h
+++ b/src/libstrongswan/utils/utils.h
@@ -185,6 +185,11 @@ static inline bool memeq(const void *x, const void *y, size_t len)
}
/**
+ * Same as memeq(), but with a constant runtime, safe for cryptographic use.
+ */
+bool memeq_const(const void *x, const void *y, size_t len);
+
+/**
* Calling memcpy() with NULL pointers, even with n == 0, results in undefined
* behavior according to the C standard. This version is guaranteed to not
* access the pointers if n is 0.