moved chunk_skip_zero to chunk.h
This commit is contained in:
@@ -833,7 +833,7 @@ static void stroke_list_certs(linked_list_t *list, char *label,
|
||||
|
||||
fprintf(out, " subject: \"%Y\"\n", cert->get_subject(cert));
|
||||
fprintf(out, " issuer: \"%Y\"\n", cert->get_issuer(cert));
|
||||
serial = x509->get_serial(x509);
|
||||
serial = chunk_skip_zero(x509->get_serial(x509));
|
||||
fprintf(out, " serial: %#B\n", &serial);
|
||||
|
||||
/* list validity */
|
||||
@@ -1015,13 +1015,14 @@ static void stroke_list_crls(linked_list_t *list, bool utc, FILE *out)
|
||||
fprintf(out, " issuer: \"%Y\"\n", cert->get_issuer(cert));
|
||||
|
||||
/* list optional crlNumber */
|
||||
chunk = crl->get_serial(crl);
|
||||
chunk = chunk_skip_zero(crl->get_serial(crl));
|
||||
if (chunk.ptr)
|
||||
{
|
||||
fprintf(out, " serial: %#B\n", &chunk);
|
||||
}
|
||||
if (crl->is_delta_crl(crl, &chunk))
|
||||
{
|
||||
chunk = chunk_skip_zero(chunk);
|
||||
fprintf(out, " delta for: %#B\n", &chunk);
|
||||
}
|
||||
|
||||
|
||||
@@ -234,6 +234,24 @@ static inline chunk_t chunk_skip(chunk_t chunk, size_t bytes)
|
||||
return chunk_empty;
|
||||
}
|
||||
|
||||
/**
|
||||
* Skip a leading zero-valued byte
|
||||
*/
|
||||
static inline chunk_t chunk_skip_zero(chunk_t chunk)
|
||||
{
|
||||
if (chunk.len && *chunk.ptr == 0x00)
|
||||
{
|
||||
if (chunk.len == 1)
|
||||
{
|
||||
return chunk_empty;
|
||||
}
|
||||
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
|
||||
|
||||
@@ -23,23 +23,6 @@
|
||||
|
||||
#include <time.h>
|
||||
|
||||
/**
|
||||
* Print a chunk without leading zero byte
|
||||
*/
|
||||
static chunk_t chunk_skip_zero(chunk_t chunk)
|
||||
{
|
||||
if (chunk.len && *chunk.ptr == 0x00)
|
||||
{
|
||||
if (chunk.len == 1)
|
||||
{
|
||||
return chunk_empty;
|
||||
}
|
||||
chunk.ptr++;
|
||||
chunk.len--;
|
||||
}
|
||||
return chunk;
|
||||
}
|
||||
|
||||
/**
|
||||
* Print public key information
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user