summaryrefslogtreecommitdiff
path: root/src/libstrongswan/crypto
diff options
context:
space:
mode:
authorRene Mayrhofer <rene@mayrhofer.eu.org>2009-10-21 11:14:02 +0000
committerRene Mayrhofer <rene@mayrhofer.eu.org>2009-10-21 11:14:02 +0000
commit7410d3c6d6a9a1cd7aa55083c938946af6ff9498 (patch)
tree3291beffa55649f9be28b4a98a7d503d334fbcf2 /src/libstrongswan/crypto
parent41787e147279ff0695e9d759487266a60b80867b (diff)
downloadvyos-strongswan-7410d3c6d6a9a1cd7aa55083c938946af6ff9498.tar.gz
vyos-strongswan-7410d3c6d6a9a1cd7aa55083c938946af6ff9498.zip
[svn-upgrade] Integrating new upstream version, strongswan (4.3.4)
Diffstat (limited to 'src/libstrongswan/crypto')
-rw-r--r--src/libstrongswan/crypto/crypto_factory.c2
-rw-r--r--src/libstrongswan/crypto/crypto_tester.c22
-rw-r--r--src/libstrongswan/crypto/hashers/hasher.c10
-rw-r--r--src/libstrongswan/crypto/hashers/hasher.h8
4 files changed, 27 insertions, 15 deletions
diff --git a/src/libstrongswan/crypto/crypto_factory.c b/src/libstrongswan/crypto/crypto_factory.c
index fea8d0793..e928e8cdf 100644
--- a/src/libstrongswan/crypto/crypto_factory.c
+++ b/src/libstrongswan/crypto/crypto_factory.c
@@ -746,7 +746,7 @@ crypto_factory_t *crypto_factory_create()
this->prfs = linked_list_create();
this->rngs = linked_list_create();
this->dhs = linked_list_create();
- this->lock = rwlock_create(RWLOCK_DEFAULT);
+ this->lock = rwlock_create(RWLOCK_TYPE_DEFAULT);
this->tester = crypto_tester_create();
this->test_on_add = lib->settings->get_bool(lib->settings,
"libstrongswan.crypto_test.on_add", FALSE);
diff --git a/src/libstrongswan/crypto/crypto_tester.c b/src/libstrongswan/crypto/crypto_tester.c
index b0b5aa969..4d13474a1 100644
--- a/src/libstrongswan/crypto/crypto_tester.c
+++ b/src/libstrongswan/crypto/crypto_tester.c
@@ -136,7 +136,7 @@ static bool test_crypter(private_crypto_tester_t *this,
crypter->destroy(crypter);
if (failed)
{
- DBG1("disabled %N: test vector %d failed",
+ DBG1("disabled %N: test vector %u failed",
encryption_algorithm_names, alg, tested);
break;
}
@@ -151,7 +151,7 @@ static bool test_crypter(private_crypto_tester_t *this,
}
if (!failed)
{
- DBG1("enabled %N: successfully passed %d test vectors",
+ DBG1("enabled %N: passed %u test vectors",
encryption_algorithm_names, alg, tested);
}
return !failed;
@@ -240,7 +240,7 @@ static bool test_signer(private_crypto_tester_t *this,
signer->destroy(signer);
if (failed)
{
- DBG1("disabled %N: test vector %d failed",
+ DBG1("disabled %N: test vector %u failed",
integrity_algorithm_names, alg, tested);
break;
}
@@ -255,7 +255,7 @@ static bool test_signer(private_crypto_tester_t *this,
}
if (!failed)
{
- DBG1("enabled %N: successfully passed %d test vectors",
+ DBG1("enabled %N: passed %u test vectors",
integrity_algorithm_names, alg, tested);
}
return !failed;
@@ -330,8 +330,8 @@ static bool test_hasher(private_crypto_tester_t *this, hash_algorithm_t alg,
hasher->destroy(hasher);
if (failed)
{
- DBG1("disabled %N: test vector %d failed",
- hash_algorithm_names, alg), tested;
+ DBG1("disabled %N: test vector %u failed",
+ hash_algorithm_names, alg, tested);
break;
}
}
@@ -345,7 +345,7 @@ static bool test_hasher(private_crypto_tester_t *this, hash_algorithm_t alg,
}
if (!failed)
{
- DBG1("enabled %N: successfully passed %d test vectors",
+ DBG1("enabled %N: passed %u test vectors",
hash_algorithm_names, alg, tested);
}
return !failed;
@@ -431,7 +431,7 @@ static bool test_prf(private_crypto_tester_t *this,
prf->destroy(prf);
if (failed)
{
- DBG1("disabled %N: test vector %d failed",
+ DBG1("disabled %N: test vector %u failed",
pseudo_random_function_names, alg, tested);
break;
}
@@ -446,7 +446,7 @@ static bool test_prf(private_crypto_tester_t *this,
}
if (!failed)
{
- DBG1("enabled %N: successfully passed %d test vectors",
+ DBG1("enabled %N: passed %u test vectors",
pseudo_random_function_names, alg, tested);
}
return !failed;
@@ -515,7 +515,7 @@ static bool test_rng(private_crypto_tester_t *this, rng_quality_t quality,
rng->destroy(rng);
if (failed)
{
- DBG1("disabled %N: test vector %d failed",
+ DBG1("disabled %N: test vector %u failed",
rng_quality_names, quality, tested);
break;
}
@@ -530,7 +530,7 @@ static bool test_rng(private_crypto_tester_t *this, rng_quality_t quality,
}
if (!failed)
{
- DBG1("enabled %N: successfully passed %d test vectors",
+ DBG1("enabled %N: passed %u test vectors",
rng_quality_names, quality, tested);
}
return !failed;
diff --git a/src/libstrongswan/crypto/hashers/hasher.c b/src/libstrongswan/crypto/hashers/hasher.c
index c58c2ad42..4d6904e47 100644
--- a/src/libstrongswan/crypto/hashers/hasher.c
+++ b/src/libstrongswan/crypto/hashers/hasher.c
@@ -26,6 +26,7 @@ ENUM(hash_algorithm_names, HASH_UNKNOWN, HASH_SHA512,
"HASH_MD4",
"HASH_MD5",
"HASH_SHA1",
+ "HASH_SHA224",
"HASH_SHA256",
"HASH_SHA384",
"HASH_SHA512"
@@ -47,6 +48,9 @@ hash_algorithm_t hasher_algorithm_from_oid(int oid)
case OID_SHA1:
case OID_SHA1_WITH_RSA:
return HASH_SHA1;
+ case OID_SHA224:
+ case OID_SHA224_WITH_RSA:
+ return HASH_SHA224;
case OID_SHA256:
case OID_SHA256_WITH_RSA:
return HASH_SHA256;
@@ -79,6 +83,9 @@ int hasher_algorithm_to_oid(hash_algorithm_t alg)
case HASH_SHA1:
oid = OID_SHA1;
break;
+ case HASH_SHA224:
+ oid = OID_SHA224;
+ break;
case HASH_SHA256:
oid = OID_SHA256;
break;
@@ -112,6 +119,9 @@ int hasher_signature_algorithm_to_oid(hash_algorithm_t alg)
case HASH_SHA1:
oid = OID_SHA1_WITH_RSA;
break;
+ case HASH_SHA224:
+ oid = OID_SHA224_WITH_RSA;
+ break;
case HASH_SHA256:
oid = OID_SHA256_WITH_RSA;
break;
diff --git a/src/libstrongswan/crypto/hashers/hasher.h b/src/libstrongswan/crypto/hashers/hasher.h
index 098739fa3..6deed37ab 100644
--- a/src/libstrongswan/crypto/hashers/hasher.h
+++ b/src/libstrongswan/crypto/hashers/hasher.h
@@ -40,15 +40,17 @@ enum hash_algorithm_t {
HASH_MD4 = 3,
HASH_MD5 = 4,
HASH_SHA1 = 5,
- HASH_SHA256 = 6,
- HASH_SHA384 = 7,
- HASH_SHA512 = 8
+ HASH_SHA224 = 6,
+ HASH_SHA256 = 7,
+ HASH_SHA384 = 8,
+ HASH_SHA512 = 9
};
#define HASH_SIZE_MD2 16
#define HASH_SIZE_MD4 16
#define HASH_SIZE_MD5 16
#define HASH_SIZE_SHA1 20
+#define HASH_SIZE_SHA224 28
#define HASH_SIZE_SHA256 32
#define HASH_SIZE_SHA384 48
#define HASH_SIZE_SHA512 64