aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/plugins/gcrypt
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstrongswan/plugins/gcrypt')
-rw-r--r--src/libstrongswan/plugins/gcrypt/gcrypt_crypter.c2
-rw-r--r--src/libstrongswan/plugins/gcrypt/gcrypt_dh.c9
-rw-r--r--src/libstrongswan/plugins/gcrypt/gcrypt_hasher.c2
-rw-r--r--src/libstrongswan/plugins/gcrypt/gcrypt_plugin.c2
-rw-r--r--src/libstrongswan/plugins/gcrypt/gcrypt_rsa_private_key.c30
-rw-r--r--src/libstrongswan/plugins/gcrypt/gcrypt_rsa_public_key.c28
6 files changed, 42 insertions, 31 deletions
diff --git a/src/libstrongswan/plugins/gcrypt/gcrypt_crypter.c b/src/libstrongswan/plugins/gcrypt/gcrypt_crypter.c
index 1eee6226d..5dbdde32c 100644
--- a/src/libstrongswan/plugins/gcrypt/gcrypt_crypter.c
+++ b/src/libstrongswan/plugins/gcrypt/gcrypt_crypter.c
@@ -234,7 +234,7 @@ gcrypt_crypter_t *gcrypt_crypter_create(encryption_algorithm_t algo,
err = gcry_cipher_open(&this->h, gcrypt_alg, mode, 0);
if (err)
{
- DBG1("grcy_cipher_open(%N) failed: %s",
+ DBG1(DBG_LIB, "grcy_cipher_open(%N) failed: %s",
encryption_algorithm_names, algo, gpg_strerror(err));
free(this);
return NULL;
diff --git a/src/libstrongswan/plugins/gcrypt/gcrypt_dh.c b/src/libstrongswan/plugins/gcrypt/gcrypt_dh.c
index 07e987d4d..ca730f9cd 100644
--- a/src/libstrongswan/plugins/gcrypt/gcrypt_dh.c
+++ b/src/libstrongswan/plugins/gcrypt/gcrypt_dh.c
@@ -89,7 +89,7 @@ static void set_other_public_value(private_gcrypt_dh_t *this, chunk_t value)
err = gcry_mpi_scan(&this->yb, GCRYMPI_FMT_USG, value.ptr, value.len, NULL);
if (err)
{
- DBG1("importing mpi yb failed: %s", gpg_strerror(err));
+ DBG1(DBG_LIB, "importing mpi yb failed: %s", gpg_strerror(err));
return;
}
@@ -110,7 +110,8 @@ static void set_other_public_value(private_gcrypt_dh_t *this, chunk_t value)
}
else
{
- DBG1("public DH value verification failed: y < 2 || y > p - 1 ");
+ DBG1(DBG_LIB, "public DH value verification failed:"
+ " y < 2 || y > p - 1 ");
}
gcry_mpi_release(p_min_1);
}
@@ -207,7 +208,7 @@ gcrypt_dh_t *gcrypt_dh_create(diffie_hellman_group_t group)
params->prime, params->prime_len, NULL);
if (err)
{
- DBG1("importing mpi modulus failed: %s", gpg_strerror(err));
+ DBG1(DBG_LIB, "importing mpi modulus failed: %s", gpg_strerror(err));
free(this);
return NULL;
}
@@ -222,7 +223,7 @@ gcrypt_dh_t *gcrypt_dh_create(diffie_hellman_group_t group)
chunk_clear(&random);
if (err)
{
- DBG1("importing mpi xa failed: %s", gpg_strerror(err));
+ DBG1(DBG_LIB, "importing mpi xa failed: %s", gpg_strerror(err));
gcry_mpi_release(this->p);
free(this);
return NULL;
diff --git a/src/libstrongswan/plugins/gcrypt/gcrypt_hasher.c b/src/libstrongswan/plugins/gcrypt/gcrypt_hasher.c
index d12fe11d5..39609c16c 100644
--- a/src/libstrongswan/plugins/gcrypt/gcrypt_hasher.c
+++ b/src/libstrongswan/plugins/gcrypt/gcrypt_hasher.c
@@ -137,7 +137,7 @@ gcrypt_hasher_t *gcrypt_hasher_create(hash_algorithm_t algo)
err = gcry_md_open(&this->hd, gcrypt_alg, 0);
if (err)
{
- DBG1("grcy_md_open(%N) failed: %s",
+ DBG1(DBG_LIB, "grcy_md_open(%N) failed: %s",
hash_algorithm_names, algo, gpg_strerror(err));
free(this);
return NULL;
diff --git a/src/libstrongswan/plugins/gcrypt/gcrypt_plugin.c b/src/libstrongswan/plugins/gcrypt/gcrypt_plugin.c
index c87f3b882..341ba51d7 100644
--- a/src/libstrongswan/plugins/gcrypt/gcrypt_plugin.c
+++ b/src/libstrongswan/plugins/gcrypt/gcrypt_plugin.c
@@ -126,7 +126,7 @@ plugin_t *gcrypt_plugin_create()
if (!gcry_check_version(GCRYPT_VERSION))
{
- DBG1("libgcrypt version mismatch");
+ DBG1(DBG_LIB, "libgcrypt version mismatch");
return NULL;
}
diff --git a/src/libstrongswan/plugins/gcrypt/gcrypt_rsa_private_key.c b/src/libstrongswan/plugins/gcrypt/gcrypt_rsa_private_key.c
index cd156961e..a1d237bcd 100644
--- a/src/libstrongswan/plugins/gcrypt/gcrypt_rsa_private_key.c
+++ b/src/libstrongswan/plugins/gcrypt/gcrypt_rsa_private_key.c
@@ -130,14 +130,15 @@ static bool sign_raw(private_gcrypt_rsa_private_key_t *this,
chunk_free(&em);
if (err)
{
- DBG1("building signature S-expression failed: %s", gpg_strerror(err));
+ DBG1(DBG_LIB, "building signature S-expression failed: %s",
+ gpg_strerror(err));
return FALSE;
}
err = gcry_pk_sign(&out, in, this->key);
gcry_sexp_release(in);
if (err)
{
- DBG1("creating pkcs1 signature failed: %s", gpg_strerror(err));
+ DBG1(DBG_LIB, "creating pkcs1 signature failed: %s", gpg_strerror(err));
return FALSE;
}
*signature = gcrypt_rsa_find_token(out, "s", this->key);
@@ -176,14 +177,14 @@ static bool sign_pkcs1(private_gcrypt_rsa_private_key_t *this,
chunk_free(&hash);
if (err)
{
- DBG1("building signature S-expression failed: %s", gpg_strerror(err));
+ DBG1(DBG_LIB, "building signature S-expression failed: %s", gpg_strerror(err));
return FALSE;
}
err = gcry_pk_sign(&out, in, this->key);
gcry_sexp_release(in);
if (err)
{
- DBG1("creating pkcs1 signature failed: %s", gpg_strerror(err));
+ DBG1(DBG_LIB, "creating pkcs1 signature failed: %s", gpg_strerror(err));
return FALSE;
}
*signature = gcrypt_rsa_find_token(out, "s", this->key);
@@ -222,7 +223,7 @@ static bool sign(private_gcrypt_rsa_private_key_t *this, signature_scheme_t sche
case SIGN_RSA_EMSA_PKCS1_MD5:
return sign_pkcs1(this, HASH_MD5, "md5", data, sig);
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;
}
@@ -243,14 +244,15 @@ static bool decrypt(private_gcrypt_rsa_private_key_t *this,
encrypted.len, encrypted.ptr);
if (err)
{
- DBG1("building decryption S-expression failed: %s", gpg_strerror(err));
+ DBG1(DBG_LIB, "building decryption S-expression failed: %s",
+ gpg_strerror(err));
return FALSE;
}
err = gcry_pk_decrypt(&out, in, this->key);
gcry_sexp_release(in);
if (err)
{
- DBG1("decrypting pkcs1 data failed: %s", gpg_strerror(err));
+ DBG1(DBG_LIB, "decrypting pkcs1 data failed: %s", gpg_strerror(err));
return FALSE;
}
padded.ptr = (u_char*)gcry_sexp_nth_data(out, 1, &padded.len);
@@ -269,7 +271,7 @@ static bool decrypt(private_gcrypt_rsa_private_key_t *this,
gcry_sexp_release(out);
if (!pos)
{
- DBG1("decrypted data has invalid pkcs1 padding");
+ DBG1(DBG_LIB, "decrypted data has invalid pkcs1 padding");
return FALSE;
}
return TRUE;
@@ -329,7 +331,7 @@ static bool get_encoding(private_gcrypt_rsa_private_key_t *this,
chunk_clear(&cp);
chunk_clear(&cq);
chunk_clear(&cd);
- DBG1("scanning mpi for export failed: %s", gpg_strerror(err));
+ DBG1(DBG_LIB, "scanning mpi for export failed: %s", gpg_strerror(err));
return FALSE;
}
@@ -352,7 +354,7 @@ static bool get_encoding(private_gcrypt_rsa_private_key_t *this,
if (err)
{
- DBG1("printing mpi for export failed: %s", gpg_strerror(err));
+ DBG1(DBG_LIB, "printing mpi for export failed: %s", gpg_strerror(err));
chunk_clear(&cp);
chunk_clear(&cq);
chunk_clear(&cd);
@@ -488,7 +490,7 @@ gcrypt_rsa_private_key_t *gcrypt_rsa_private_key_gen(key_type_t type,
err = gcry_sexp_build(&param, NULL, "(genkey(rsa(nbits %d)))", key_size);
if (err)
{
- DBG1("building S-expression failed: %s", gpg_strerror(err));
+ DBG1(DBG_LIB, "building S-expression failed: %s", gpg_strerror(err));
return NULL;
}
this = gcrypt_rsa_private_key_create_empty();
@@ -497,7 +499,7 @@ gcrypt_rsa_private_key_t *gcrypt_rsa_private_key_gen(key_type_t type,
if (err)
{
free(this);
- DBG1("generating RSA key failed: %s", gpg_strerror(err));
+ DBG1(DBG_LIB, "generating RSA key failed: %s", gpg_strerror(err));
return NULL;
}
return &this->public;
@@ -557,14 +559,14 @@ gcrypt_rsa_private_key_t *gcrypt_rsa_private_key_load(key_type_t type,
p.len, p.ptr, q.len, q.ptr, u.len, u.ptr);
if (err)
{
- DBG1("loading private key failed: %s", gpg_strerror(err));
+ DBG1(DBG_LIB, "loading private key failed: %s", gpg_strerror(err));
free(this);
return NULL;
}
err = gcry_pk_testkey(this->key);
if (err)
{
- DBG1("private key sanity check failed: %s", gpg_strerror(err));
+ DBG1(DBG_LIB, "private key sanity check failed: %s", gpg_strerror(err));
destroy(this);
return NULL;
}
diff --git a/src/libstrongswan/plugins/gcrypt/gcrypt_rsa_public_key.c b/src/libstrongswan/plugins/gcrypt/gcrypt_rsa_public_key.c
index e083fac94..5fd15d9a3 100644
--- a/src/libstrongswan/plugins/gcrypt/gcrypt_rsa_public_key.c
+++ b/src/libstrongswan/plugins/gcrypt/gcrypt_rsa_public_key.c
@@ -83,14 +83,16 @@ static bool verify_raw(private_gcrypt_rsa_public_key_t *this,
chunk_free(&em);
if (err)
{
- DBG1("building data S-expression failed: %s", gpg_strerror(err));
+ DBG1(DBG_LIB, "building data S-expression failed: %s",
+ gpg_strerror(err));
return FALSE;
}
err = gcry_sexp_build(&sig, NULL, "(sig-val(rsa(s %b)))",
signature.len, signature.ptr);
if (err)
{
- DBG1("building signature S-expression failed: %s", gpg_strerror(err));
+ DBG1(DBG_LIB, "building signature S-expression failed: %s",
+ gpg_strerror(err));
gcry_sexp_release(in);
return FALSE;
}
@@ -99,7 +101,8 @@ static bool verify_raw(private_gcrypt_rsa_public_key_t *this,
gcry_sexp_release(sig);
if (err)
{
- DBG1("RSA signature verification failed: %s", gpg_strerror(err));
+ DBG1(DBG_LIB, "RSA signature verification failed: %s",
+ gpg_strerror(err));
return FALSE;
}
return TRUE;
@@ -130,7 +133,8 @@ static bool verify_pkcs1(private_gcrypt_rsa_public_key_t *this,
chunk_free(&hash);
if (err)
{
- DBG1("building data S-expression failed: %s", gpg_strerror(err));
+ DBG1(DBG_LIB, "building data S-expression failed: %s",
+ gpg_strerror(err));
return FALSE;
}
@@ -138,7 +142,8 @@ static bool verify_pkcs1(private_gcrypt_rsa_public_key_t *this,
signature.len, signature.ptr);
if (err)
{
- DBG1("building signature S-expression failed: %s", gpg_strerror(err));
+ DBG1(DBG_LIB, "building signature S-expression failed: %s",
+ gpg_strerror(err));
gcry_sexp_release(in);
return FALSE;
}
@@ -147,7 +152,8 @@ static bool verify_pkcs1(private_gcrypt_rsa_public_key_t *this,
gcry_sexp_release(sig);
if (err)
{
- DBG1("RSA signature verification failed: %s", gpg_strerror(err));
+ DBG1(DBG_LIB, "RSA signature verification failed: %s",
+ gpg_strerror(err));
return FALSE;
}
return TRUE;
@@ -184,7 +190,7 @@ static bool verify(private_gcrypt_rsa_public_key_t *this,
case SIGN_RSA_EMSA_PKCS1_SHA512:
return verify_pkcs1(this, HASH_SHA512, "sha512", 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;
}
@@ -205,14 +211,16 @@ static bool encrypt_(private_gcrypt_rsa_public_key_t *this, chunk_t plain,
plain.len, plain.ptr);
if (err)
{
- DBG1("building encryption S-expression failed: %s", gpg_strerror(err));
+ DBG1(DBG_LIB, "building encryption S-expression failed: %s",
+ gpg_strerror(err));
return FALSE;
}
err = gcry_pk_encrypt(&out, in, this->key);
gcry_sexp_release(in);
if (err)
{
- DBG1("encrypting data using pkcs1 failed: %s", gpg_strerror(err));
+ DBG1(DBG_LIB, "encrypting data using pkcs1 failed: %s",
+ gpg_strerror(err));
return FALSE;
}
*encrypted = gcrypt_rsa_find_token(out, "a", this->key);
@@ -343,7 +351,7 @@ gcrypt_rsa_public_key_t *gcrypt_rsa_public_key_load(key_type_t type,
n.len, n.ptr, e.len, e.ptr);
if (err)
{
- DBG1("loading public key failed: %s", gpg_strerror(err));
+ DBG1(DBG_LIB, "loading public key failed: %s", gpg_strerror(err));
free(this);
return NULL;
}