- added openssl debug code to ccid emulator

- fixed some bugs due to changes in recent opensc version
- added support for changing pin via standard leser


git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@511 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
frankmorgner
2011-08-30 15:55:40 +00:00
parent 9aa24f9e4a
commit 495022b38a
10 changed files with 124 additions and 34 deletions

View File

@@ -2,7 +2,7 @@ EXTRA_DIST = $(shell find $(top_srcdir)/src/opensc -path '*/.svn' -prune -o -typ
AM_CPPFLAGS = -I$(top_srcdir)/src/npa -I$(top_srcdir)/src/opensc/src
libnpa_la_SOURCES = sm.c scutil.c npa.c
libnpa_la_SOURCES = sm.c scutil.c npa.c sslutil.c
libnpa_la_LIBADD = $(OPENSSL_LIBS) $(OPENSC_LIBS)
libnpa_la_CFLAGS = $(OPENSSL_CFLAGS)
@@ -16,6 +16,7 @@ bin_PROGRAMS = npa-tool
lib_LTLIBRARIES = libnpa.la
noinst_HEADERS = \
sslutil.h \
binutil.h
nobase_include_HEADERS = \

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2010 Frank Morgner
* Copyright (C) 2011 Frank Morgner
*
* This file is part of ccid.
*
@@ -19,6 +19,7 @@
#include "npa.h"
#include "sm.h"
#include "scutil.h"
#include "sslutil.h"
#include <libopensc/asn1.h>
#include <libopensc/log.h>
#include <libopensc/opensc.h>
@@ -906,15 +907,6 @@ get_psec(sc_card_t *card, const char *pin, size_t length_pin, enum s_type pin_id
return r;
}
void ssl_error(sc_context_t *ctx) {
unsigned long r;
ERR_load_crypto_strings();
for (r = ERR_get_error(); r; r = ERR_get_error()) {
sc_debug(ctx, SC_LOG_DEBUG_VERBOSE, ERR_error_string(r, NULL));
}
ERR_free_strings();
}
int EstablishPACEChannel(struct sm_ctx *oldnpactx, sc_card_t *card,
struct establish_pace_channel_input pace_input,
struct establish_pace_channel_output *pace_output,

30
npa/src/sslutil.c Normal file
View File

@@ -0,0 +1,30 @@
/*
* Copyright (C) 2011 Frank Morgner
*
* This file is part of ccid.
*
* ccid is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* ccid is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* ccid. If not, see <http://www.gnu.org/licenses/>.
*/
#include "sslutil.h"
#include <openssl/err.h>
#include <libopensc/log.h>
void ssl_error(sc_context_t *ctx) {
unsigned long r;
ERR_load_crypto_strings();
for (r = ERR_get_error(); r; r = ERR_get_error()) {
sc_debug(ctx, SC_LOG_DEBUG_VERBOSE, ERR_error_string(r, NULL));
}
ERR_free_strings();
}

26
npa/src/sslutil.h Normal file
View File

@@ -0,0 +1,26 @@
/*
* Copyright (C) 2011 Frank Morgner
*
* This file is part of ccid.
*
* ccid is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* ccid is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* ccid. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _CCID_SSLUTIL_H
#define _CCID_SSLUTIL_H
#include <libopensc/opensc.h>
void ssl_error(sc_context_t *ctx);
#endif