diff options
author | Yves-Alexis Perez <corsac@corsac.net> | 2012-06-28 21:16:07 +0200 |
---|---|---|
committer | Yves-Alexis Perez <corsac@corsac.net> | 2012-06-28 21:16:07 +0200 |
commit | b34738ed08c2227300d554b139e2495ca5da97d6 (patch) | |
tree | 62f33b52820f2e49f0e53c0f8c636312037c8054 /src/libstrongswan/chunk.h | |
parent | 0a9d51a49042a68daa15b0c74a2b7f152f52606b (diff) | |
download | vyos-strongswan-b34738ed08c2227300d554b139e2495ca5da97d6.tar.gz vyos-strongswan-b34738ed08c2227300d554b139e2495ca5da97d6.zip |
Imported Upstream version 4.6.4
Diffstat (limited to 'src/libstrongswan/chunk.h')
-rw-r--r-- | src/libstrongswan/chunk.h | 16 |
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); |