aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libstrongswan/asn1/asn1.c1
-rwxr-xr-xsrc/libstrongswan/crypto/crl.c8
-rw-r--r--src/libstrongswan/crypto/hashers/md5_hasher.c16
-rw-r--r--src/libstrongswan/crypto/hashers/sha1_hasher.c3
-rw-r--r--src/libstrongswan/crypto/rsa/rsa_public_key.c3
-rwxr-xr-xsrc/libstrongswan/crypto/x509.c18
-rw-r--r--src/libstrongswan/types.c2
-rw-r--r--src/libstrongswan/types.h5
8 files changed, 26 insertions, 30 deletions
diff --git a/src/libstrongswan/asn1/asn1.c b/src/libstrongswan/asn1/asn1.c
index 7fb6a58d9..0523b8ae8 100644
--- a/src/libstrongswan/asn1/asn1.c
+++ b/src/libstrongswan/asn1/asn1.c
@@ -303,7 +303,6 @@ void asn1_init(asn1_ctx_t *ctx, chunk_t blob, u_int level0, bool implicit)
static void debug_asn1_simple_object(chunk_t object, asn1_t type)
{
int oid;
- time_t time;
switch (type)
{
diff --git a/src/libstrongswan/crypto/crl.c b/src/libstrongswan/crypto/crl.c
index f7e172c57..1b50fcf9c 100755
--- a/src/libstrongswan/crypto/crl.c
+++ b/src/libstrongswan/crypto/crl.c
@@ -40,6 +40,9 @@
#define CRL_WARNING_INTERVAL 7 /* days */
static logger_t *logger;
+extern char* check_expiry(time_t expiration_date, int warning_interval, bool strict);
+extern time_t parse_time(chunk_t blob, int level0);
+extern void parse_authorityKeyIdentifier(chunk_t blob, int level0 , chunk_t *authKeyID, chunk_t *authKeySerialNumber);
/* access structure for a revoked certificate */
@@ -213,7 +216,6 @@ static crl_reason_t parse_crl_reasonCode(chunk_t object)
*/
bool parse_x509crl(chunk_t blob, u_int level0, private_crl_t *crl)
{
- u_char buf[BUF_LEN];
asn1_ctx_t ctx;
bool critical;
chunk_t extnID;
@@ -440,14 +442,10 @@ static void destroy(private_crl_t *this)
static void log_crl(const private_crl_t *this, logger_t *logger, bool utc, bool strict)
{
identification_t *issuer = this->issuer;
- linked_list_t *crlDistributionPoints = this->crlDistributionPoints;
linked_list_t *revokedCertificates = this->revokedCertificates;
char buf[BUF_LEN];
- /* determine the current time */
- time_t now = time(NULL);
-
timetoa(buf, BUF_LEN, &this->installed, utc);
logger->log(logger, CONTROL, "%s, revoked certs: %d",
buf, revokedCertificates->get_count(revokedCertificates));
diff --git a/src/libstrongswan/crypto/hashers/md5_hasher.c b/src/libstrongswan/crypto/hashers/md5_hasher.c
index b0bc2f638..bc806c22e 100644
--- a/src/libstrongswan/crypto/hashers/md5_hasher.c
+++ b/src/libstrongswan/crypto/hashers/md5_hasher.c
@@ -334,7 +334,7 @@ static void allocate_hash(private_md5_hasher_t *this, chunk_t chunk, chunk_t *ha
MD5Update(this, chunk.ptr, chunk.len);
if (hash != NULL)
- {
+ {
allocated_hash.ptr = malloc(BLOCK_SIZE_MD5);
allocated_hash.len = BLOCK_SIZE_MD5;
@@ -358,12 +358,12 @@ static size_t get_hash_size(private_md5_hasher_t *this)
*/
static void reset(private_md5_hasher_t *this)
{
- this->state[0] = 0x67452301;
- this->state[1] = 0xefcdab89;
- this->state[2] = 0x98badcfe;
- this->state[3] = 0x10325476;
- this->count[0] = 0;
- this->count[1] = 0;
+ this->state[0] = 0x67452301;
+ this->state[1] = 0xefcdab89;
+ this->state[2] = 0x98badcfe;
+ this->state[3] = 0x10325476;
+ this->count[0] = 0;
+ this->count[1] = 0;
}
/**
@@ -388,7 +388,7 @@ md5_hasher_t *md5_hasher_create(void)
this->public.hasher_interface.destroy = (void (*) (hasher_t*))destroy;
/* initialize */
- this->public.hasher_interface.reset(&(this->public.hasher_interface));
+ reset(this);
return &(this->public);
}
diff --git a/src/libstrongswan/crypto/hashers/sha1_hasher.c b/src/libstrongswan/crypto/hashers/sha1_hasher.c
index 0dda019d0..2ae04f1c1 100644
--- a/src/libstrongswan/crypto/hashers/sha1_hasher.c
+++ b/src/libstrongswan/crypto/hashers/sha1_hasher.c
@@ -248,7 +248,6 @@ static void destroy(private_sha1_hasher_t *this)
free(this);
}
-
/*
* Described in header.
*/
@@ -263,7 +262,7 @@ sha1_hasher_t *sha1_hasher_create(void)
this->public.hasher_interface.destroy = (void (*) (hasher_t*))destroy;
/* initialize */
- this->public.hasher_interface.reset(&(this->public.hasher_interface));
+ reset(this);
return &(this->public);
}
diff --git a/src/libstrongswan/crypto/rsa/rsa_public_key.c b/src/libstrongswan/crypto/rsa/rsa_public_key.c
index cc714b0ea..9dfac3b5e 100644
--- a/src/libstrongswan/crypto/rsa/rsa_public_key.c
+++ b/src/libstrongswan/crypto/rsa/rsa_public_key.c
@@ -30,6 +30,7 @@
#include <crypto/hashers/hasher.h>
#include <asn1/asn1.h>
+#include <asn1/pem.h>
/*
* For simplicity, we use these predefined values for hash algorithm OIDs
@@ -323,7 +324,7 @@ static status_t save_key(const private_rsa_public_key_t *this, char *file)
*/
static mpz_t *get_modulus(const private_rsa_public_key_t *this)
{
- return &this->n;
+ return (mpz_t*)&this->n;
}
/**
diff --git a/src/libstrongswan/crypto/x509.c b/src/libstrongswan/crypto/x509.c
index 2a25ac179..79804bd64 100755
--- a/src/libstrongswan/crypto/x509.c
+++ b/src/libstrongswan/crypto/x509.c
@@ -473,7 +473,6 @@ parse_otherName(chunk_t blob, int level0)
*/
static identification_t *parse_generalName(chunk_t blob, int level0)
{
- u_char buf[BUF_LEN];
asn1_ctx_t ctx;
chunk_t object;
int objectID = 0;
@@ -1087,18 +1086,19 @@ static void destroy(private_x509_t *this)
*/
char* check_expiry(time_t expiration_date, int warning_interval, bool strict)
{
- time_t now;
int time_left;
if (expiration_date == UNDEFINED_TIME)
+ {
return "ok (expires never)";
-
+ }
time_left = (expiration_date - time(NULL));
if (time_left < 0)
- return strict? "fatal (expired)" : "warning (expired)";
-
{
- static char buf[35]; /* temporary storage */
+ return strict? "fatal (expired)" : "warning (expired)";
+ }
+/* {
+ static char buf[35];
const char* unit = "second";
if (time_left > 86400*warning_interval)
@@ -1120,7 +1120,11 @@ char* check_expiry(time_t expiration_date, int warning_interval, bool strict)
unit = "minute";
}
snprintf(buf, sizeof(buf), "warning (expires in %d %s%s)", time_left, unit, (time_left == 1)?"":"s");
- }
+} */
+ /* TODO: check_expiry from pluto is a hack: it returns a buffer to its stack.
+ * this is dangerous and may cause crashes! Reimplement this another way!!!
+ */
+ return "warning (expires in under 30days)";
}
/**
diff --git a/src/libstrongswan/types.c b/src/libstrongswan/types.c
index d61ed8bd5..b7c9361cf 100644
--- a/src/libstrongswan/types.c
+++ b/src/libstrongswan/types.c
@@ -22,6 +22,7 @@
#include <string.h>
#include <time.h>
+#include <stdio.h>
#include "types.h"
@@ -41,7 +42,6 @@ mapping_t status_m[] = {
{VERIFY_ERROR, "VERIFY_ERROR"},
{INVALID_STATE, "INVALID_STATE"},
{DESTROY_ME, "DESTROY_ME"},
- {CREATED, "CREATED"},
{MAPPING_END, NULL}
};
diff --git a/src/libstrongswan/types.h b/src/libstrongswan/types.h
index e18010561..14b2abebb 100644
--- a/src/libstrongswan/types.h
+++ b/src/libstrongswan/types.h
@@ -102,11 +102,6 @@ enum status_t {
* Destroy object which called method belongs to.
*/
DESTROY_ME,
-
- /**
- * An object got created.
- */
- CREATED,
};
/**