better split up of library files "types.h" & "definitions.h"

centralized all printf specifier character definitions
reuse of arginfo handlers
more cleanups
fixed more AMD64 issues
added DEBUG_LEVEL compile flag to exclude DBGn() statements
This commit is contained in:
Martin Willi
2006-10-31 12:27:59 +00:00
parent de8b8a8c44
commit db7ef62494
151 changed files with 1094 additions and 1061 deletions
+11 -3
View File
@@ -19,8 +19,8 @@
#include "asn1.h"
#include <types.h>
#include <library.h>
#include <debug.h>
/* some common prefabricated ASN.1 constants */
static u_char ASN1_INTEGER_0_str[] = { 0x02, 0x00 };
@@ -98,7 +98,7 @@ chunk_t asn1_algorithmIdentifier(int oid)
case OID_SHA1:
return ASN1_sha1_id;
default:
return CHUNK_INITIALIZER;
return chunk_empty;
}
}
@@ -320,9 +320,13 @@ static void debug_asn1_simple_object(chunk_t object, asn1_t type, bool private)
break;
}
if (private)
{
DBG4("%B", &object);
}
else
{
DBG3("%B", &object);
}
}
/**
@@ -335,7 +339,7 @@ bool extract_object(asn1Object_t const *objects, u_int *objectID, chunk_t *objec
chunk_t *blob1;
u_char *start_ptr;
*object = CHUNK_INITIALIZER;
*object = chunk_empty;
if (obj.flags & ASN1_END) /* end of loop or option found */
{
@@ -447,9 +451,13 @@ bool extract_object(asn1Object_t const *objects, u_int *objectID, chunk_t *objec
object->ptr = start_ptr;
object->len = (size_t)(blob->ptr - start_ptr);
if (ctx->private)
{
DBG4("%B", object);
}
else
{
DBG3("%B", object);
}
}
else if (obj.flags & ASN1_BODY)
{
+1 -1
View File
@@ -19,7 +19,7 @@
#include <stdarg.h>
#include <gmp.h>
#include <types.h>
#include <library.h>
#include <asn1/oid.h>
+6 -5
View File
@@ -23,6 +23,7 @@
#include "pem.h"
#include <library.h>
#include <debug.h>
#include <asn1/asn1.h>
#include <asn1/ttodata.h>
@@ -53,7 +54,7 @@ static bool present(const char* pattern, chunk_t* ch)
*/
static bool find_boundary(const char* tag, chunk_t *line)
{
chunk_t name = CHUNK_INITIALIZER;
chunk_t name = chunk_empty;
if (!present("-----", line))
return FALSE;
@@ -162,8 +163,8 @@ err_t pem_to_bin(chunk_t *blob, chunk_t *passphrase, bool *pgp)
chunk_t src = *blob;
chunk_t dst = *blob;
chunk_t line = CHUNK_INITIALIZER;
chunk_t iv = CHUNK_INITIALIZER;
chunk_t line = chunk_empty;
chunk_t iv = chunk_empty;
u_char iv_buf[16]; /* MD5 digest size */
@@ -198,8 +199,8 @@ err_t pem_to_bin(chunk_t *blob, chunk_t *passphrase, bool *pgp)
if (state == PEM_HEADER)
{
err_t ugh = NULL;
chunk_t name = CHUNK_INITIALIZER;
chunk_t value = CHUNK_INITIALIZER;
chunk_t name = chunk_empty;
chunk_t value = chunk_empty;
/* an empty line separates HEADER and BODY */
if (line.len == 0)
+1 -1
View File
@@ -17,7 +17,7 @@
#include <stdio.h>
#include <types.h>
#include <library.h>
err_t pem_to_bin(chunk_t *blob, chunk_t *passphrase, bool *pgp);
+1 -1
View File
@@ -16,7 +16,7 @@
#ifndef TTODATA_H_
#define TTODATA_H_
#include <types.h>
#include <library.h>
#define TTODATAV_BUF 40 /* ttodatav's largest non-literal message */
#define TTODATAV_IGNORESPACE (1<<1) /* ignore spaces in base64 encodings*/