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 */
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);
}
}
/**
+ * 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
*/
#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
*/
static void print_pubkey(public_key_t *key)