Andreas Jellinghaus wrote:
Douglas,
I applied all your latest patches, please verify that I took the right ones
and nothing is missing.
Most of the patches look good, Thanks! I did send a patch for the opensc.conf.in
to include PIV in the comments, and PIV-II in the list of builtin emulators.
I also sent a note without a patch, where Windows did not compile, because the
pkcs11 had install-headers-dir. Both of these are included in the attachment.
Attached is a patch file to change the do_decompress* to sc_decompress*
and the initialize_* to sc_pkcs15emu_initialize_* in the new code.
I think this addressed all the concerns. I did not make any document
changes, as Thomas should do this.
The patch is against the SVN checkout this morning (its now 10:43 CDT here
in Chicago). I compiled on Ubuntu Edgy and Windows XP (VC 2005) both
with zlib, and ran the Heimdal PKINIT test with a card with a compressed
certificate. Looks good.
Once everyone is fine with the current svn,
I will create another release candidate, ok?
Regards, Andreas
p.s. we need to increase the default max_send/recv_size somewhere, right?
I suggest the SC_APDU_CHOP_SIZE be set to 256 in opensc.h as this
is only used by ctx.c to set the max_send/recv_size.
--
Douglas E. Engert <[EMAIL PROTECTED]>
Argonne National Laboratory
9700 South Cass Avenue
Argonne, Illinois 60439
(630) 252-5444
Index: src/pkcs11/Makefile.mak
===================================================================
--- src/pkcs11/Makefile.mak (revision 3125)
+++ src/pkcs11/Makefile.mak (working copy)
@@ -14,7 +14,7 @@
OBJECTS2 = libpkcs11.obj
OBJECTS3 = pkcs11-spy.obj pkcs11-display.obj libpkcs11.obj
-all: install-headers install-headers-dir $(TARGET) $(TARGET2) $(TARGET3)
+all: install-headers $(TARGET) $(TARGET2) $(TARGET3)
!INCLUDE $(TOPDIR)\win32\Make.rules.mak
Index: src/libopensc/compression.c
===================================================================
--- src/libopensc/compression.c (revision 3125)
+++ src/libopensc/compression.c (working copy)
@@ -58,7 +58,7 @@
}
}
-static int do_decompress_gzip(u8* out, size_t* outLen, const u8* in, size_t inLen) {
+static int sc_decompress_gzip(u8* out, size_t* outLen, const u8* in, size_t inLen) {
/* Since uncompress does not offer a way to make it uncompress gzip... manually set it up */
z_stream gz;
int err;
@@ -83,7 +83,7 @@
return zerr_to_opensc(err);
}
-int do_decompress(u8* out, size_t* outLen, const u8* in, size_t inLen, int method) {
+int sc_decompress(u8* out, size_t* outLen, const u8* in, size_t inLen, int method) {
if(method == COMPRESSION_AUTO) {
method = detect_method(in, inLen);
if(method == COMPRESSION_UNKNOWN) {
@@ -94,13 +94,13 @@
case COMPRESSION_ZLIB:
return zerr_to_opensc(uncompress(out, outLen, in, inLen));
case COMPRESSION_GZIP:
- return do_decompress_gzip(out, outLen, in, inLen);
+ return sc_decompress_gzip(out, outLen, in, inLen);
default:
return SC_ERROR_INVALID_ARGUMENTS;
}
}
-static int do_decompress_zlib_alloc(u8** out, size_t* outLen, const u8* in, size_t inLen, int gzip) {
+static int sc_decompress_zlib_alloc(u8** out, size_t* outLen, const u8* in, size_t inLen, int gzip) {
/* Since uncompress does not offer a way to make it uncompress gzip... manually set it up */
z_stream gz;
int err;
@@ -157,7 +157,7 @@
inflateEnd(&gz);
return zerr_to_opensc(err);
}
-int do_decompress_alloc(u8** out, size_t* outLen, const u8* in, size_t inLen, int method) {
+int sc_decompress_alloc(u8** out, size_t* outLen, const u8* in, size_t inLen, int method) {
if(method == COMPRESSION_AUTO) {
method = detect_method(in, inLen);
if(method == COMPRESSION_UNKNOWN) {
@@ -166,9 +166,9 @@
}
switch(method) {
case COMPRESSION_ZLIB:
- return do_decompress_zlib_alloc(out, outLen, in, inLen, 0);
+ return sc_decompress_zlib_alloc(out, outLen, in, inLen, 0);
case COMPRESSION_GZIP:
- return do_decompress_zlib_alloc(out, outLen, in, inLen, 1);
+ return sc_decompress_zlib_alloc(out, outLen, in, inLen, 1);
default:
return SC_ERROR_INVALID_ARGUMENTS;
}
Index: src/libopensc/card-piv.c
===================================================================
--- src/libopensc/card-piv.c (revision 3125)
+++ src/libopensc/card-piv.c (working copy)
@@ -678,7 +678,7 @@
#ifdef HAVE_ZLIB_H
size_t len = count;
u8* newBuf = NULL;
- if(SC_SUCCESS != do_decompress_alloc(&newBuf, &len, tag, taglen, COMPRESSION_AUTO)) {
+ if(SC_SUCCESS != sc_decompress_alloc(&newBuf, &len, tag, taglen, COMPRESSION_AUTO)) {
return SC_ERROR_OBJECT_NOT_VALID;
} else {
if(len < count + idx)
Index: src/libopensc/compression.h
===================================================================
--- src/libopensc/compression.h (revision 3125)
+++ src/libopensc/compression.h (working copy)
@@ -28,8 +28,8 @@
#define COMPRESSION_GZIP 2
#define COMPRESSION_UNKNOWN (-1)
-int do_decompress_alloc(u8** out, size_t* outLen, const u8* in, size_t inLen, int method);
-int do_decompress(u8* out, size_t* outLen, const u8* in, size_t inLen, int method);
+int sc_decompress_alloc(u8** out, size_t* outLen, const u8* in, size_t inLen, int method);
+int sc_decompress(u8* out, size_t* outLen, const u8* in, size_t inLen, int method);
#endif
Index: src/libopensc/pkcs15-piv.c
===================================================================
--- src/libopensc/pkcs15-piv.c (revision 3125)
+++ src/libopensc/pkcs15-piv.c (working copy)
@@ -204,7 +204,7 @@
sc_debug(card->ctx, "PIV-II adding objects...");
- r = initialize_all(p15card, &items);
+ r = sc_pkcs15emu_initialize_all(p15card, &items);
SC_FUNC_RETURN(card->ctx, 1, SC_SUCCESS);
}
Index: src/libopensc/p15card-helper.c
===================================================================
--- src/libopensc/p15card-helper.c (revision 3125)
+++ src/libopensc/p15card-helper.c (working copy)
@@ -29,7 +29,7 @@
#include <openssl/rsa.h>
#include <openssl/x509.h>
-int initialize_objects(sc_pkcs15_card_t *p15card, p15data_items *items) {
+int sc_pkcs15emu_initialize_objects(sc_pkcs15_card_t *p15card, p15data_items *items) {
sc_card_t* card = p15card->card;
const objdata* objects = items->objects;
int i, r;
@@ -202,7 +202,7 @@
SC_FUNC_RETURN(p15card->card->ctx, 1, r);
}
-int initialize_certificates(sc_pkcs15_card_t *p15card, p15data_items* items) {
+int sc_pkcs15emu_initialize_certificates(sc_pkcs15_card_t *p15card, p15data_items* items) {
/* set certs */
sc_card_t* card = p15card->card;
const cdata* certs = items->certs;
@@ -266,7 +266,7 @@
return SC_SUCCESS;
}
-int initialize_pins(sc_pkcs15_card_t *p15card, p15data_items* items) {
+int sc_pkcs15emu_initialize_pins(sc_pkcs15_card_t *p15card, p15data_items* items) {
/* set pins */
int i,r;
const pindata* pins = items->pins;
@@ -298,7 +298,7 @@
return SC_SUCCESS;
}
-int initialize_private_keys(sc_pkcs15_card_t *p15card, p15data_items* items) {
+int sc_pkcs15emu_initialize_private_keys(sc_pkcs15_card_t *p15card, p15data_items* items) {
const prdata *prkeys = items->private_keys;
int i, r;
if(!prkeys) return SC_SUCCESS;
@@ -311,7 +311,7 @@
return SC_SUCCESS;
}
-int initialize_public_keys(sc_pkcs15_card_t *p15card, p15data_items *items) {
+int sc_pkcs15emu_initialize_public_keys(sc_pkcs15_card_t *p15card, p15data_items *items) {
const pubdata *keys = items->public_keys;
int i, r;
if(!keys) return SC_SUCCESS;
@@ -325,18 +325,18 @@
}
-int initialize_all(sc_pkcs15_card_t *p15card, p15data_items* items) {
+int sc_pkcs15emu_initialize_all(sc_pkcs15_card_t *p15card, p15data_items* items) {
int r;
- if(SC_SUCCESS != (r = initialize_objects(p15card, items)))
+ if(SC_SUCCESS != (r = sc_pkcs15emu_initialize_objects(p15card, items)))
return r;
- if(SC_SUCCESS != (r = initialize_certificates(p15card, items)))
+ if(SC_SUCCESS != (r = sc_pkcs15emu_initialize_certificates(p15card, items)))
return r;
- if(SC_SUCCESS != (r = initialize_pins(p15card, items)))
+ if(SC_SUCCESS != (r = sc_pkcs15emu_initialize_pins(p15card, items)))
return r;
- if(items->forced_private && (SC_SUCCESS != (r = initialize_private_keys(p15card, items))))
+ if(items->forced_private && (SC_SUCCESS != (r = sc_pkcs15emu_initialize_private_keys(p15card, items))))
return r;
- if(items->forced_public && (SC_SUCCESS != (r = initialize_public_keys(p15card, items))))
+ if(items->forced_public && (SC_SUCCESS != (r = sc_pkcs15emu_initialize_public_keys(p15card, items))))
return r;
return SC_SUCCESS;
}
Index: src/libopensc/p15card-helper.h
===================================================================
--- src/libopensc/p15card-helper.h (revision 3125)
+++ src/libopensc/p15card-helper.h (working copy)
@@ -126,12 +126,12 @@
CERT_HANDLE_FUNCTION(default_cert_handle);
-int initialize_objects(sc_pkcs15_card_t *p15card, p15data_items* items);
-int initialize_certificates(sc_pkcs15_card_t *p15card, p15data_items* items);
-int initialize_pins(sc_pkcs15_card_t *p15card, p15data_items *items);
-int initialize_private_keys(sc_pkcs15_card_t *p15card, p15data_items *items);
-int initialize_public_keys(sc_pkcs15_card_t *p15card, p15data_items *items);
-int initialize_all(sc_pkcs15_card_t *p15card, p15data_items *items);
+int sc_pkcs15emu_initialize_objects(sc_pkcs15_card_t *p15card, p15data_items* items);
+int sc_pkcs15emu_initialize_certificates(sc_pkcs15_card_t *p15card, p15data_items* items);
+int sc_pkcs15emu_initialize_pins(sc_pkcs15_card_t *p15card, p15data_items *items);
+int sc_pkcs15emu_initialize_private_keys(sc_pkcs15_card_t *p15card, p15data_items *items);
+int sc_pkcs15emu_initialize_public_keys(sc_pkcs15_card_t *p15card, p15data_items *items);
+int sc_pkcs15emu_initialize_all(sc_pkcs15_card_t *p15card, p15data_items *items);
#endif
Index: etc/opensc.conf.in
===================================================================
--- etc/opensc.conf.in (revision 3125)
+++ etc/opensc.conf.in (working copy)
@@ -153,6 +153,7 @@
# oberthur Oberthur AuthentIC.v2/CosmopolIC.v4
# belpic Belpic cards
# emv EMV compatible cards
+ # piv U.S. NIST 800-73-1 PIV
# Generic format: card_atr <hex encoded ATR (case-sensitive!)>
@@ -228,7 +229,6 @@
# card_atr 3B:7D:96:00:00:80:31:80:65:B0:83:11:00:AC:83:00:90:00 {
# name = "PIV-II";
# driver = "piv";
- # pkcs15emu = "PIV-II";
# }
# Estonian ID card and Micardo driver currently play together with T=0
@@ -279,7 +279,7 @@
# Default: yes
# enable_builtin_emulation = yes;
# list of the builtin pkcs15 emulators to test
- builtin_emulators = esteid, openpgp, tcos, starcert, infocamere, postecert, actalis, atrust-acos, gemsafe, tccardos;
+ builtin_emulators = esteid, openpgp, tcos, starcert, infocamere, postecert, actalis, atrust-acos, gemsafe, tccardos, PIV-II;
# additional settings per driver
#
_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel