summaryrefslogtreecommitdiffstats
path: root/src/openvpn/ssl_verify_polarssl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/openvpn/ssl_verify_polarssl.c')
-rw-r--r--src/openvpn/ssl_verify_polarssl.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/src/openvpn/ssl_verify_polarssl.c b/src/openvpn/ssl_verify_polarssl.c
index 4852243..fa313ac 100644
--- a/src/openvpn/ssl_verify_polarssl.c
+++ b/src/openvpn/ssl_verify_polarssl.c
@@ -134,17 +134,12 @@ backend_x509_get_serial (openvpn_x509_cert_t *cert, struct gc_arena *gc)
char *buf = NULL;
size_t buflen = 0;
mpi serial_mpi = { 0 };
- int retval = 0;
/* Transform asn1 integer serial into PolarSSL MPI */
mpi_init(&serial_mpi);
- retval = mpi_read_binary(&serial_mpi, cert->serial.p, cert->serial.len);
- if (retval < 0)
+ if (!polar_ok(mpi_read_binary(&serial_mpi, cert->serial.p, cert->serial.len)))
{
- char errbuf[128];
- polarssl_strerror(retval, errbuf, sizeof(errbuf));
-
- msg(M_WARN, "Failed to retrieve serial from certificate: %s.", errbuf);
+ msg(M_WARN, "Failed to retrieve serial from certificate.");
return NULL;
}
@@ -153,13 +148,9 @@ backend_x509_get_serial (openvpn_x509_cert_t *cert, struct gc_arena *gc)
buf = gc_malloc(buflen, true, gc);
/* Write MPI serial as decimal string into buffer */
- retval = mpi_write_string(&serial_mpi, 10, buf, &buflen);
- if (retval < 0)
+ if (!polar_ok(mpi_write_string(&serial_mpi, 10, buf, &buflen)))
{
- char errbuf[128];
- polarssl_strerror(retval, errbuf, sizeof(errbuf));
-
- msg(M_WARN, "Failed to write serial to string: %s.", errbuf);
+ msg(M_WARN, "Failed to write serial to string.");
return NULL;
}
@@ -376,12 +367,9 @@ x509_verify_crl(const char *crl_file, x509_crt *cert, const char *subject)
struct gc_arena gc = gc_new();
char *serial;
- int polar_retval = x509_crl_parse_file(&crl, crl_file);
- if (polar_retval != 0)
+ if (!polar_ok(x509_crl_parse_file(&crl, crl_file)))
{
- char errstr[128];
- polarssl_strerror(polar_retval, errstr, sizeof(errstr));
- msg (M_WARN, "CRL: cannot read CRL from file %s (%s)", crl_file, errstr);
+ msg (M_WARN, "CRL: cannot read CRL from file %s", crl_file);
goto end;
}
@@ -394,7 +382,7 @@ x509_verify_crl(const char *crl_file, x509_crt *cert, const char *subject)
goto end;
}
- if (0 != x509_crt_revoked(cert, &crl))
+ if (!polar_ok(x509_crt_revoked(cert, &crl)))
{
serial = backend_x509_get_serial_hex(cert, &gc);
msg (D_HANDSHAKE, "CRL CHECK FAILED: %s (serial %s) is REVOKED", subject, (serial ? serial : "NOT AVAILABLE"));