mirror of
https://github.com/strongswan/strongswan.git
synced 2025-10-04 00:00:14 -04:00
pki: Fix build with DEBUG_LEVEL < 1
This commit is contained in:
parent
72f8794d83
commit
3804b2adf9
@ -34,7 +34,7 @@ typedef enum {
|
|||||||
CERT_TYPE_RA
|
CERT_TYPE_RA
|
||||||
} pki_cert_type_t;
|
} pki_cert_type_t;
|
||||||
|
|
||||||
static char *cert_type_label[] = { "Root CA", "Sub CA", "RA" };
|
static char *cert_type_label[] DBG_UNUSED = { "Root CA", "Sub CA", "RA" };
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine certificate type based on X.509 certificate flags
|
* Determine certificate type based on X.509 certificate flags
|
||||||
@ -73,7 +73,7 @@ static bool print_cert_info(certificate_t *cert, pki_cert_type_t cert_type)
|
|||||||
char digest_buf[HASH_SIZE_SHA256];
|
char digest_buf[HASH_SIZE_SHA256];
|
||||||
char base64_buf[HASH_SIZE_SHA256];
|
char base64_buf[HASH_SIZE_SHA256];
|
||||||
chunk_t cert_digest = {digest_buf, HASH_SIZE_SHA256};
|
chunk_t cert_digest = {digest_buf, HASH_SIZE_SHA256};
|
||||||
chunk_t cert_id, serial, encoding = chunk_empty;
|
chunk_t cert_id DBG_UNUSED, serial DBG_UNUSED, encoding = chunk_empty;
|
||||||
x509_t *x509;
|
x509_t *x509;
|
||||||
bool success = FALSE;
|
bool success = FALSE;
|
||||||
|
|
||||||
@ -207,8 +207,7 @@ static bool write_cert(certificate_t *cert, pki_cert_type_t cert_type,
|
|||||||
bool force)
|
bool force)
|
||||||
{
|
{
|
||||||
chunk_t encoding = chunk_empty;
|
chunk_t encoding = chunk_empty;
|
||||||
time_t until;
|
bool written;
|
||||||
bool written, valid;
|
|
||||||
|
|
||||||
if (path)
|
if (path)
|
||||||
{
|
{
|
||||||
@ -240,12 +239,14 @@ static bool write_cert(certificate_t *cert, pki_cert_type_t cert_type,
|
|||||||
path = "stdout";
|
path = "stdout";
|
||||||
}
|
}
|
||||||
|
|
||||||
valid = cert->get_validity(cert, NULL, NULL, &until);
|
#if DEBUG_LEVEL >= 1
|
||||||
|
time_t until;
|
||||||
|
bool valid = cert->get_validity(cert, NULL, NULL, &until);
|
||||||
DBG1(DBG_APP, "%s cert is %strusted, %s %T, %s'%s'",
|
DBG1(DBG_APP, "%s cert is %strusted, %s %T, %s'%s'",
|
||||||
cert_type_label[cert_type], trusted ? "" : "un",
|
cert_type_label[cert_type], trusted ? "" : "un",
|
||||||
valid ? "valid until" : "invalid since", &until, FALSE,
|
valid ? "valid until" : "invalid since", &until, FALSE,
|
||||||
path ? "written to " : "", path ? path : "not written");
|
path ? "written to " : "", path ? path : "not written");
|
||||||
|
#endif
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -466,16 +467,15 @@ bool pki_cert_extract_cert(chunk_t data, cred_encoding_type_t form)
|
|||||||
x509_t *x509 = (x509_t*)cert;
|
x509_t *x509 = (x509_t*)cert;
|
||||||
certificate_t *cert_found = NULL;
|
certificate_t *cert_found = NULL;
|
||||||
enumerator_t *certs;
|
enumerator_t *certs;
|
||||||
chunk_t serial;
|
bool trusted DBG_UNUSED;
|
||||||
time_t from, until;
|
|
||||||
bool trusted, valid;
|
|
||||||
|
|
||||||
if (!(x509->get_flags(x509) & X509_CA))
|
if (!(x509->get_flags(x509) & X509_CA))
|
||||||
{
|
{
|
||||||
DBG1(DBG_APP, "Issued certificate \"%Y\"", cert->get_subject(cert));
|
DBG1(DBG_APP, "Issued certificate \"%Y\"", cert->get_subject(cert));
|
||||||
serial = x509->get_serial(x509);
|
#if DEBUG_LEVEL >= 1
|
||||||
|
chunk_t serial = x509->get_serial(x509);
|
||||||
DBG1(DBG_APP, " serial: %#B", &serial);
|
DBG1(DBG_APP, " serial: %#B", &serial);
|
||||||
|
#endif
|
||||||
if (stored)
|
if (stored)
|
||||||
{
|
{
|
||||||
DBG1(DBG_APP, "multiple certs received, only first stored");
|
DBG1(DBG_APP, "multiple certs received, only first stored");
|
||||||
@ -490,12 +490,14 @@ bool pki_cert_extract_cert(chunk_t data, cred_encoding_type_t form)
|
|||||||
(cert_found == cert);
|
(cert_found == cert);
|
||||||
certs->destroy(certs);
|
certs->destroy(certs);
|
||||||
|
|
||||||
valid = cert->get_validity(cert, NULL, &from, &until);
|
#if DEBUG_LEVEL >= 1
|
||||||
|
time_t from, until;
|
||||||
|
bool valid = cert->get_validity(cert, NULL, &from, &until);
|
||||||
DBG1(DBG_APP, "Issued certificate is %strusted, "
|
DBG1(DBG_APP, "Issued certificate is %strusted, "
|
||||||
"valid from %T until %T (currently %svalid)",
|
"valid from %T until %T (currently %svalid)",
|
||||||
trusted ? "" : "not ", &from, FALSE, &until, FALSE,
|
trusted ? "" : "not ", &from, FALSE, &until, FALSE,
|
||||||
valid ? "" : "not ");
|
valid ? "" : "not ");
|
||||||
|
#endif
|
||||||
if (!cert->get_encoding(cert, form, &cert_encoding))
|
if (!cert->get_encoding(cert, form, &cert_encoding))
|
||||||
{
|
{
|
||||||
DBG1(DBG_APP, "encoding certificate failed");
|
DBG1(DBG_APP, "encoding certificate failed");
|
||||||
|
@ -38,7 +38,7 @@ static const char *operations[] = {
|
|||||||
|
|
||||||
static const char *pkiStatus_values[] = { "0", "2", "3" };
|
static const char *pkiStatus_values[] = { "0", "2", "3" };
|
||||||
|
|
||||||
static const char *pkiStatus_names[] = {
|
static const char *pkiStatus_names[] DBG_UNUSED = {
|
||||||
"SUCCESS",
|
"SUCCESS",
|
||||||
"FAILURE",
|
"FAILURE",
|
||||||
"PENDING",
|
"PENDING",
|
||||||
@ -47,7 +47,7 @@ static const char *pkiStatus_names[] = {
|
|||||||
|
|
||||||
static const char *msgType_values[] = { "3", "17", "19", "20", "21", "22" };
|
static const char *msgType_values[] = { "3", "17", "19", "20", "21", "22" };
|
||||||
|
|
||||||
static const char *msgType_names[] = {
|
static const char *msgType_names[] DBG_UNUSED = {
|
||||||
"CertRep",
|
"CertRep",
|
||||||
"RenewalReq",
|
"RenewalReq",
|
||||||
"PKCSReq",
|
"PKCSReq",
|
||||||
@ -57,7 +57,7 @@ static const char *msgType_names[] = {
|
|||||||
"Unknown"
|
"Unknown"
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *failInfo_reasons[] = {
|
static const char *failInfo_reasons[] DBG_UNUSED = {
|
||||||
"badAlg - unrecognized or unsupported algorithm identifier",
|
"badAlg - unrecognized or unsupported algorithm identifier",
|
||||||
"badMessageCheck - integrity check failed",
|
"badMessageCheck - integrity check failed",
|
||||||
"badRequest - transaction not permitted or supported",
|
"badRequest - transaction not permitted or supported",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user