summaryrefslogtreecommitdiff
path: root/src/libstrongswan/chunk.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstrongswan/chunk.h')
-rw-r--r--src/libstrongswan/chunk.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/libstrongswan/chunk.h b/src/libstrongswan/chunk.h
index 63644ac78..3de02eee7 100644
--- a/src/libstrongswan/chunk.h
+++ b/src/libstrongswan/chunk.h
@@ -235,6 +235,20 @@ static inline chunk_t chunk_skip(chunk_t chunk, size_t bytes)
}
/**
+ * Skip a leading zero-valued byte
+ */
+static inline chunk_t chunk_skip_zero(chunk_t chunk)
+{
+ if (chunk.len > 1 && *chunk.ptr == 0x00)
+ {
+ chunk.ptr++;
+ chunk.len--;
+ }
+ return chunk;
+}
+
+
+/**
* Compare two chunks, returns zero if a equals b
* or negative/positive if a is small/greater than b
*/
@@ -254,7 +268,7 @@ static inline bool chunk_equals(chunk_t a, chunk_t b)
* Increment a chunk, as it would reprensent a network order integer.
*
* @param chunk chunk to increment
- * @return TRUE if an overflow occured
+ * @return TRUE if an overflow occurred
*/
bool chunk_increment(chunk_t chunk);