aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/chunk.c
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2009-08-26 14:07:26 +0200
committerMartin Willi <martin@strongswan.org>2009-08-26 14:07:26 +0200
commit500f515a64311d3c07d163d24da9730aefc967bd (patch)
tree536de869fe28db45a1e8c75b69a2a3393e067837 /src/libstrongswan/chunk.c
parentd4df33f255837852b4cf5f483ad82071fc2f2442 (diff)
downloadstrongswan-500f515a64311d3c07d163d24da9730aefc967bd.tar.bz2
strongswan-500f515a64311d3c07d163d24da9730aefc967bd.tar.xz
moved chunk_increment() function to libstrongswan
Diffstat (limited to 'src/libstrongswan/chunk.c')
-rw-r--r--src/libstrongswan/chunk.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/libstrongswan/chunk.c b/src/libstrongswan/chunk.c
index bdea31188..acf3db1f4 100644
--- a/src/libstrongswan/chunk.c
+++ b/src/libstrongswan/chunk.c
@@ -449,6 +449,24 @@ int chunk_compare(chunk_t a, chunk_t b)
return memcmp(a.ptr, b.ptr, len);
};
+
+/**
+ * Described in header.
+ */
+bool chunk_increment(chunk_t chunk)
+{
+ int i;
+
+ for (i = chunk.len - 1; i >= 0; i--)
+ {
+ if (++chunk.ptr[i] != 0)
+ {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
/**
* Remove non-printable characters from a chunk.
*/