aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/chunk.c
diff options
context:
space:
mode:
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.
*/