]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Also log PGP parsing in ASN log group.
authorTobias Brunner <tobias@strongswan.org>
Fri, 16 Dec 2011 15:34:56 +0000 (16:34 +0100)
committerTobias Brunner <tobias@strongswan.org>
Fri, 16 Dec 2011 15:44:38 +0000 (16:44 +0100)
src/libstrongswan/plugins/pgp/pgp_cert.c
src/libstrongswan/plugins/pgp/pgp_utils.c

index dea183ce2707ccfa2b8af77031efe402f9156527..5b2ec63fcad4d90d4b5f296a2e47b027a2a07869 100644 (file)
@@ -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;
 }
 
index 2d85cc0c8670266b9b702b0537fb8c8a57b38e79..7fd905ce4ea07c8e6175a9b2b5cd1a6c8fc73d5b 100644 (file)
@@ -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;
 }