From 6e3a09fa7b61571e45ed01b279e4619928ace2b9 Mon Sep 17 00:00:00 2001 From: aet Date: Thu, 21 Mar 2002 23:45:03 +0000 Subject: [PATCH] Remove bogus "len = len;" statement from pkcs15-cert Other minor cleanups git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@368 c6295689-39f2-0310-b995-f0e70906c6a9 --- src/libopensc/pkcs15-cert.c | 1 - src/scam/p15_eid.c | 7 ++----- src/scam/p15_ldap.c | 6 ++++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/libopensc/pkcs15-cert.c b/src/libopensc/pkcs15-cert.c index cf722bb3..2e34e471 100644 --- a/src/libopensc/pkcs15-cert.c +++ b/src/libopensc/pkcs15-cert.c @@ -143,7 +143,6 @@ int sc_pkcs15_read_certificate(struct sc_pkcs15_card *p15card, free(data); return r; } - len = len; sc_unlock(p15card->card); } cert = malloc(sizeof(struct sc_pkcs15_cert)); diff --git a/src/scam/p15_eid.c b/src/scam/p15_eid.c index 365b2c92..6a7ca569 100644 --- a/src/scam/p15_eid.c +++ b/src/scam/p15_eid.c @@ -284,7 +284,7 @@ static int get_certificate(const char *user, X509 ** cert_out) goto end; *cert_out = cert; err = SCAM_SUCCESS; - end: +end: if (in) BIO_free(in); if (dir) @@ -297,7 +297,6 @@ static int get_certificate(const char *user, X509 ** cert_out) int p15_eid_auth(int argc, const char **argv, const char *user, const char *password) { - struct sc_pkcs15_cert *p15cert = NULL; u8 random_data[20], chg[256], txt[256]; int r, err = SCAM_FAILED, chglen; EVP_PKEY *pubkey = NULL; @@ -349,13 +348,11 @@ int p15_eid_auth(int argc, const char **argv, if (r == sizeof(random_data) && !memcmp(txt, random_data, r)) { err = SCAM_SUCCESS; } - end: +end: if (pubkey) EVP_PKEY_free(pubkey); if (cert) X509_free(cert); - if (p15cert) - sc_pkcs15_free_certificate(p15cert); return err; } diff --git a/src/scam/p15_ldap.c b/src/scam/p15_ldap.c index 8db7c629..96b4cd36 100644 --- a/src/scam/p15_ldap.c +++ b/src/scam/p15_ldap.c @@ -234,6 +234,7 @@ int p15_ldap_auth(int argc, const char **argv, int r, err = SCAM_FAILED, chglen; EVP_PKEY *pubkey = NULL; X509 *cert = NULL; + unsigned char *ptr = NULL; if (!lctx || !ctx) return SCAM_FAILED; @@ -243,7 +244,8 @@ int p15_ldap_auth(int argc, const char **argv, goto end; } cert = X509_new(); - if (!d2i_X509(&cert, &p15cert->data, p15cert->data_len)) { + ptr = p15cert->data; + if (!d2i_X509(&cert, &ptr, p15cert->data_len)) { scam_fw_p15_ldap.logmsg("Invalid certificate. (user %s)\n", user); goto end; } @@ -281,7 +283,7 @@ int p15_ldap_auth(int argc, const char **argv, if (r == sizeof(random_data) && !memcmp(txt, random_data, r)) { err = SCAM_SUCCESS; } - end: +end: if (pubkey) EVP_PKEY_free(pubkey); if (cert)