aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/plugins/x509/x509_ocsp_request.c
diff options
context:
space:
mode:
authorMartin Willi <martin@strongswan.org>2008-04-07 08:28:35 +0000
committerMartin Willi <martin@strongswan.org>2008-04-07 08:28:35 +0000
commitb5dbcc6270f81967d2170a93017518d840083794 (patch)
tree3ee56d39de0fca1020282689949b417f9ca905c8 /src/libstrongswan/plugins/x509/x509_ocsp_request.c
parent9caadea8c8062d7a4c161de5f8ec1b497d96750a (diff)
downloadstrongswan-b5dbcc6270f81967d2170a93017518d840083794.tar.bz2
strongswan-b5dbcc6270f81967d2170a93017518d840083794.tar.xz
compare certificates against full encoding to allow equality check of untrusted certs
Diffstat (limited to 'src/libstrongswan/plugins/x509/x509_ocsp_request.c')
-rw-r--r--src/libstrongswan/plugins/x509/x509_ocsp_request.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/libstrongswan/plugins/x509/x509_ocsp_request.c b/src/libstrongswan/plugins/x509/x509_ocsp_request.c
index 957df2414..ce77359cd 100644
--- a/src/libstrongswan/plugins/x509/x509_ocsp_request.c
+++ b/src/libstrongswan/plugins/x509/x509_ocsp_request.c
@@ -424,6 +424,9 @@ static chunk_t get_encoding(private_x509_ocsp_request_t *this)
*/
static bool equals(private_x509_ocsp_request_t *this, certificate_t *other)
{
+ chunk_t encoding;
+ bool equal;
+
if (this == (private_x509_ocsp_request_t*)other)
{
return TRUE;
@@ -432,14 +435,14 @@ static bool equals(private_x509_ocsp_request_t *this, certificate_t *other)
{
return FALSE;
}
- /* check if we have the same X509 implementation */
if (other->equals == (void*)equals)
- {
- return chunk_equals(this->encoding,
- ((private_x509_ocsp_request_t*)other)->encoding);
+ { /* skip allocation if we have the same implementation */
+ return chunk_equals(this->encoding, ((private_x509_ocsp_request_t*)other)->encoding);
}
- /* TODO: compare against other implementation */
- return FALSE;
+ encoding = other->get_encoding(other);
+ equal = chunk_equals(this->encoding, encoding);
+ free(encoding.ptr);
+ return equal;
}
/**