Adding DBG_LIB to all calls of libstrongswan's version of DBG*.

This commit is contained in:
Tobias Brunner
2010-04-06 12:47:40 +02:00
parent 9ed6341d3f
commit 8b0e09103b
82 changed files with 660 additions and 576 deletions
@@ -103,7 +103,7 @@ static void set_other_public_value(private_openssl_diffie_hellman_t *this,
len = DH_compute_key(this->shared_secret.ptr, this->pub_key, this->dh);
if (len < 0)
{
DBG1("DH shared secret computation failed");
DBG1(DBG_LIB, "DH shared secret computation failed");
return;
}
this->shared_secret.len = len;
@@ -187,7 +187,8 @@ openssl_diffie_hellman_t *openssl_diffie_hellman_create(diffie_hellman_group_t g
destroy(this);
return NULL;
}
DBG2("size of DH secret exponent: %d bits", BN_num_bits(this->dh->priv_key));
DBG2(DBG_LIB, "size of DH secret exponent: %d bits",
BN_num_bits(this->dh->priv_key));
return &this->public;
}
@@ -212,14 +212,14 @@ static void set_other_public_value(private_openssl_ec_diffie_hellman_t *this, ch
{
if (!chunk2ecp(this->ec_group, value, this->pub_key))
{
DBG1("ECDH public value is malformed");
DBG1(DBG_LIB, "ECDH public value is malformed");
return;
}
chunk_free(&this->shared_secret);
if (!compute_shared_key(this, &this->shared_secret)) {
DBG1("ECDH shared secret computation failed");
DBG1(DBG_LIB, "ECDH shared secret computation failed");
return;
}
@@ -84,14 +84,14 @@ static bool build_curve_signature(private_openssl_ec_private_key_t *this,
req_group = EC_GROUP_new_by_curve_name(nid_curve);
if (!req_group)
{
DBG1("signature scheme %N not supported in EC (required curve "
DBG1(DBG_LIB, "signature scheme %N not supported in EC (required curve "
"not supported)", signature_scheme_names, scheme);
return FALSE;
}
my_group = EC_KEY_get0_group(this->ec);
if (EC_GROUP_cmp(my_group, req_group, NULL) != 0)
{
DBG1("signature scheme %N not supported by private key",
DBG1(DBG_LIB, "signature scheme %N not supported by private key",
signature_scheme_names, scheme);
return FALSE;
}
@@ -162,7 +162,7 @@ static bool sign(private_openssl_ec_private_key_t *this,
return build_curve_signature(this, scheme, NID_sha512,
NID_secp521r1, data, signature);
default:
DBG1("signature scheme %N not supported",
DBG1(DBG_LIB, "signature scheme %N not supported",
signature_scheme_names, scheme);
return FALSE;
}
@@ -174,7 +174,7 @@ static bool sign(private_openssl_ec_private_key_t *this,
static bool decrypt(private_openssl_ec_private_key_t *this,
chunk_t crypto, chunk_t *plain)
{
DBG1("EC private key decryption not implemented");
DBG1(DBG_LIB, "EC private key decryption not implemented");
return FALSE;
}
@@ -348,13 +348,13 @@ openssl_ec_private_key_t *openssl_ec_private_key_gen(key_type_t type,
this->ec = EC_KEY_new_by_curve_name(NID_secp521r1);
break;
default:
DBG1("EC private key size %d not supported", key_size);
DBG1(DBG_LIB, "EC private key size %d not supported", key_size);
destroy(this);
return NULL;
}
if (EC_KEY_generate_key(this->ec) != 1)
{
DBG1("EC private key generation failed", key_size);
DBG1(DBG_LIB, "EC private key generation failed", key_size);
destroy(this);
return NULL;
}
@@ -82,14 +82,14 @@ static bool verify_curve_signature(private_openssl_ec_public_key_t *this,
req_group = EC_GROUP_new_by_curve_name(nid_curve);
if (!req_group)
{
DBG1("signature scheme %N not supported in EC (required curve "
DBG1(DBG_LIB, "signature scheme %N not supported in EC (required curve "
"not supported)", signature_scheme_names, scheme);
return FALSE;
}
my_group = EC_KEY_get0_group(this->ec);
if (EC_GROUP_cmp(my_group, req_group, NULL) != 0)
{
DBG1("signature scheme %N not supported by private key",
DBG1(DBG_LIB, "signature scheme %N not supported by private key",
signature_scheme_names, scheme);
return FALSE;
}
@@ -162,7 +162,7 @@ static bool verify(private_openssl_ec_public_key_t *this,
return verify_curve_signature(this, scheme, NID_sha512,
NID_secp521r1, data, signature);
default:
DBG1("signature scheme %N not supported in EC",
DBG1(DBG_LIB, "signature scheme %N not supported in EC",
signature_scheme_names, scheme);
return FALSE;
}
@@ -174,7 +174,7 @@ static bool verify(private_openssl_ec_public_key_t *this,
static bool encrypt_(private_openssl_ec_public_key_t *this,
chunk_t crypto, chunk_t *plain)
{
DBG1("EC public key encryption not implemented");
DBG1(DBG_LIB, "EC public key encryption not implemented");
return FALSE;
}
@@ -217,7 +217,7 @@ bool openssl_ec_fingerprint(EC_KEY *ec, key_encoding_type_t type, chunk_t *fp)
hasher = lib->crypto->create_hasher(lib->crypto, HASH_SHA1);
if (!hasher)
{
DBG1("SHA1 hash algorithm not supported, fingerprinting failed");
DBG1(DBG_LIB, "SHA1 hash algorithm not supported, fingerprinting failed");
free(key.ptr);
return FALSE;
}
@@ -160,7 +160,7 @@ static bool sign(private_openssl_rsa_private_key_t *this, signature_scheme_t sch
case SIGN_RSA_EMSA_PKCS1_MD5:
return build_emsa_pkcs1_signature(this, NID_md5, data, signature);
default:
DBG1("signature scheme %N not supported in RSA",
DBG1(DBG_LIB, "signature scheme %N not supported in RSA",
signature_scheme_names, scheme);
return FALSE;
}
@@ -172,7 +172,7 @@ static bool sign(private_openssl_rsa_private_key_t *this, signature_scheme_t sch
static bool decrypt(private_openssl_rsa_private_key_t *this,
chunk_t crypto, chunk_t *plain)
{
DBG1("RSA private key decryption not implemented");
DBG1(DBG_LIB, "RSA private key decryption not implemented");
return FALSE;
}
@@ -480,18 +480,18 @@ openssl_rsa_private_key_t *openssl_rsa_private_key_connect(key_type_t type,
engine = ENGINE_by_id(engine_id);
if (!engine)
{
DBG1("engine '%s' is not available", engine_id);
DBG1(DBG_LIB, "engine '%s' is not available", engine_id);
return NULL;
}
if (!ENGINE_init(engine))
{
DBG1("failed to initialize engine '%s'", engine_id);
DBG1(DBG_LIB, "failed to initialize engine '%s'", engine_id);
ENGINE_free(engine);
return NULL;
}
if (!ENGINE_ctrl_cmd_string(engine, "PIN", pin, 0))
{
DBG1("failed to set PIN on engine '%s'", engine_id);
DBG1(DBG_LIB, "failed to set PIN on engine '%s'", engine_id);
ENGINE_free(engine);
return NULL;
}
@@ -499,8 +499,8 @@ openssl_rsa_private_key_t *openssl_rsa_private_key_connect(key_type_t type,
key = ENGINE_load_private_key(engine, keyid, NULL, NULL);
if (!key)
{
DBG1("failed to load private key with ID '%s' from engine '%s'",
keyid, engine_id);
DBG1(DBG_LIB, "failed to load private key with ID '%s' from "
"engine '%s'", keyid, engine_id);
ENGINE_free(engine);
return NULL;
}
@@ -145,7 +145,7 @@ static bool verify(private_openssl_rsa_public_key_t *this, signature_scheme_t sc
case SIGN_RSA_EMSA_PKCS1_MD5:
return verify_emsa_pkcs1_signature(this, NID_md5, data, signature);
default:
DBG1("signature scheme %N not supported in RSA",
DBG1(DBG_LIB, "signature scheme %N not supported in RSA",
signature_scheme_names, scheme);
return FALSE;
}
@@ -157,7 +157,7 @@ static bool verify(private_openssl_rsa_public_key_t *this, signature_scheme_t sc
static bool encrypt_(private_openssl_rsa_public_key_t *this,
chunk_t crypto, chunk_t *plain)
{
DBG1("RSA public key encryption not implemented");
DBG1(DBG_LIB, "RSA public key encryption not implemented");
return FALSE;
}
@@ -200,7 +200,7 @@ bool openssl_rsa_fingerprint(RSA *rsa, key_encoding_type_t type, chunk_t *fp)
hasher = lib->crypto->create_hasher(lib->crypto, HASH_SHA1);
if (!hasher)
{
DBG1("SHA1 hash algorithm not supported, fingerprinting failed");
DBG1(DBG_LIB, "SHA1 hash algorithm not supported, fingerprinting failed");
free(key.ptr);
return FALSE;
}