pluto and scepclient now use chunk_t from libstrongswan

This commit is contained in:
Andreas Steffen
2009-04-17 16:41:26 +00:00
parent 9b91b81870
commit a376e44577
5 changed files with 21 additions and 87 deletions
-36
View File
@@ -29,27 +29,6 @@
#include "log.h"
#include "whack.h" /* for RC_LOG_SERIOUS */
/**
* Empty chunk.
*/
const chunk_t chunk_empty = { NULL, 0 };
/**
* Create a clone of a chunk pointing to "ptr"
*/
chunk_t chunk_create_clone(u_char *ptr, chunk_t chunk)
{
chunk_t clone = chunk_empty;
if (chunk.ptr && chunk.len > 0)
{
clone.ptr = ptr;
clone.len = chunk.len;
memcpy(clone.ptr, chunk.ptr, chunk.len);
}
return clone;
}
bool
all_zero(const unsigned char *m, size_t len)
{
@@ -102,21 +81,6 @@ concatenate_paths(const char *a, const char *b)
return c;
}
/* compare two chunks, returns zero if a equals b
* negative/positive if a is earlier/later in the alphabet than b
*/
int chunk_compare(chunk_t a, chunk_t b)
{
int compare_len = a.len - b.len;
int len = (compare_len < 0)? a.len : b.len;
if (compare_len != 0 || len == 0)
{
return compare_len;
}
return memcmp(a.ptr, b.ptr, len);
}
/* moves a chunk to a memory position, chunk is freed afterwards
* position pointer is advanced after the insertion point
*/