aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2011-12-16 16:34:56 +0100
committerTobias Brunner <tobias@strongswan.org>2011-12-16 16:44:38 +0100
commitcc4b48e886c6112d46759b00be847e237cec0a72 (patch)
tree062f8db4642702f6a33d2f6c6f9e2d954549b7eb
parentb6e07843858edbdde903f8666113abbae073b5af (diff)
downloadstrongswan-cc4b48e886c6112d46759b00be847e237cec0a72.tar.bz2
strongswan-cc4b48e886c6112d46759b00be847e237cec0a72.tar.xz
Also log PGP parsing in ASN log group.
-rw-r--r--src/libstrongswan/plugins/pgp/pgp_cert.c20
-rw-r--r--src/libstrongswan/plugins/pgp/pgp_utils.c18
2 files changed, 19 insertions, 19 deletions
diff --git a/src/libstrongswan/plugins/pgp/pgp_cert.c b/src/libstrongswan/plugins/pgp/pgp_cert.c
index dea183ce2..5b2ec63fc 100644
--- a/src/libstrongswan/plugins/pgp/pgp_cert.c
+++ b/src/libstrongswan/plugins/pgp/pgp_cert.c
@@ -286,18 +286,18 @@ static bool parse_public_key(private_pgp_cert_t *this, chunk_t packet)
}
break;
default:
- DBG1(DBG_LIB, "PGP packet version V%d not supported",
+ DBG1(DBG_ASN, "PGP packet version V%d not supported",
this->version);
return FALSE;
}
if (this->valid)
{
- DBG2(DBG_LIB, "L2 - created %T, valid %d days", &this->created, FALSE,
+ DBG2(DBG_ASN, "L2 - created %T, valid %d days", &this->created, FALSE,
this->valid);
}
else
{
- DBG2(DBG_LIB, "L2 - created %T, never expires", &this->created, FALSE);
+ DBG2(DBG_ASN, "L2 - created %T, never expires", &this->created, FALSE);
}
DESTROY_IF(this->key);
this->key = lib->creds->create(lib->creds, CRED_PUBLIC_KEY, KEY_ANY,
@@ -318,13 +318,13 @@ static bool parse_public_key(private_pgp_cert_t *this, chunk_t packet)
hasher = lib->crypto->create_hasher(lib->crypto, HASH_SHA1);
if (hasher == NULL)
{
- DBG1(DBG_LIB, "no SHA-1 hasher available");
+ DBG1(DBG_ASN, "no SHA-1 hasher available");
return FALSE;
}
hasher->allocate_hash(hasher, pubkey_packet_header, NULL);
hasher->allocate_hash(hasher, pubkey_packet, &this->fingerprint);
hasher->destroy(hasher);
- DBG2(DBG_LIB, "L2 - v4 fingerprint %#B", &this->fingerprint);
+ DBG2(DBG_ASN, "L2 - v4 fingerprint %#B", &this->fingerprint);
}
else
{
@@ -335,7 +335,7 @@ static bool parse_public_key(private_pgp_cert_t *this, chunk_t packet)
return FALSE;
}
this->fingerprint = chunk_clone(this->fingerprint);
- DBG2(DBG_LIB, "L2 - v3 fingerprint %#B", &this->fingerprint);
+ DBG2(DBG_ASN, "L2 - v3 fingerprint %#B", &this->fingerprint);
}
return TRUE;
}
@@ -355,7 +355,7 @@ static bool parse_signature(private_pgp_cert_t *this, chunk_t packet)
/* we parse only v3 or v4 signature packets */
if (version != 3 && version != 4)
{
- DBG2(DBG_LIB, "L2 - v%d signature ignored", version);
+ DBG2(DBG_ASN, "L2 - v%d signature ignored", version);
return TRUE;
}
if (version == 4)
@@ -364,7 +364,7 @@ static bool parse_signature(private_pgp_cert_t *this, chunk_t packet)
{
return FALSE;
}
- DBG2(DBG_LIB, "L2 - v%d signature of type 0x%02x", version, type);
+ DBG2(DBG_ASN, "L2 - v%d signature of type 0x%02x", version, type);
}
else
{
@@ -377,7 +377,7 @@ static bool parse_signature(private_pgp_cert_t *this, chunk_t packet)
{
return FALSE;
}
- DBG2(DBG_LIB, "L2 - v3 signature of type 0x%02x, created %T", type,
+ DBG2(DBG_ASN, "L2 - v3 signature of type 0x%02x, created %T", type,
&created, FALSE);
}
/* TODO: parse and save signature to a list */
@@ -391,7 +391,7 @@ static bool parse_user_id(private_pgp_cert_t *this, chunk_t packet)
{
DESTROY_IF(this->user_id);
this->user_id = identification_create_from_encoding(ID_KEY_ID, packet);
- DBG2(DBG_LIB, "L2 - '%Y'", this->user_id);
+ DBG2(DBG_ASN, "L2 - '%Y'", this->user_id);
return TRUE;
}
diff --git a/src/libstrongswan/plugins/pgp/pgp_utils.c b/src/libstrongswan/plugins/pgp/pgp_utils.c
index 2d85cc0c8..7fd905ce4 100644
--- a/src/libstrongswan/plugins/pgp/pgp_utils.c
+++ b/src/libstrongswan/plugins/pgp/pgp_utils.c
@@ -79,7 +79,7 @@ bool pgp_read_scalar(chunk_t *blob, size_t bytes, u_int32_t *scalar)
if (bytes > blob->len)
{
- DBG1(DBG_LIB, "PGP data too short to read %d byte scalar", bytes);
+ DBG1(DBG_ASN, "PGP data too short to read %d byte scalar", bytes);
return FALSE;
}
while (bytes-- > 0)
@@ -100,13 +100,13 @@ bool pgp_read_mpi(chunk_t *blob, chunk_t *mpi)
if (!pgp_read_scalar(blob, 2, &bits))
{
- DBG1(DBG_LIB, "PGP data too short to read MPI length");
+ DBG1(DBG_ASN, "PGP data too short to read MPI length");
return FALSE;
}
bytes = (bits + 7) / 8;
if (bytes > blob->len)
{
- DBG1(DBG_LIB, "PGP data too short to read %d byte MPI", bytes);
+ DBG1(DBG_ASN, "PGP data too short to read %d byte MPI", bytes);
return FALSE;
}
*mpi = chunk_create(blob->ptr, bytes);
@@ -146,7 +146,7 @@ bool pgp_read_packet(chunk_t *blob, chunk_t *data, pgp_packet_tag_t *tag)
if (!blob->len)
{
- DBG1(DBG_LIB, "missing input");
+ DBG1(DBG_ASN, "missing input");
return FALSE;
}
t = blob->ptr[0];
@@ -154,27 +154,27 @@ bool pgp_read_packet(chunk_t *blob, chunk_t *data, pgp_packet_tag_t *tag)
/* bit 7 must be set */
if (!(t & 0x80))
{
- DBG1(DBG_LIB, "invalid packet tag");
+ DBG1(DBG_ASN, "invalid packet tag");
return FALSE;
}
/* bit 6 set defines new packet format */
if (t & 0x40)
{
- DBG1(DBG_LIB, "new PGP packet format not supported");
+ DBG1(DBG_ASN, "new PGP packet format not supported");
return FALSE;
}
t = (t & 0x3C) >> 2;
if (!pgp_old_packet_length(blob, &len) || len > blob->len)
{
- DBG1(DBG_LIB, "invalid packet length");
+ DBG1(DBG_ASN, "invalid packet length");
return FALSE;
}
*data = chunk_create(blob->ptr, len);
*blob = chunk_skip(*blob, len);
*tag = t;
- DBG2(DBG_LIB, "L1 - PGP %N (%u bytes)", pgp_packet_tag_names, t, len);
- DBG3(DBG_LIB, "%B", data);
+ DBG2(DBG_ASN, "L1 - PGP %N (%u bytes)", pgp_packet_tag_names, t, len);
+ DBG3(DBG_ASN, "%B", data);
return TRUE;
}