From e1a3bf8805f712a0c99a8fa8fa1b2d8f3aa9428b Mon Sep 17 00:00:00 2001 From: Aleksey Samsonov Date: Sun, 24 Jan 2016 01:14:21 +0300 Subject: [PATCH 1/2] Rutoken ECP: set more universally 'Attempts' for RFS-files --- src/pkcs15init/pkcs15-rtecp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pkcs15init/pkcs15-rtecp.c b/src/pkcs15init/pkcs15-rtecp.c index 572b55e6..e13d2bfb 100644 --- a/src/pkcs15init/pkcs15-rtecp.c +++ b/src/pkcs15init/pkcs15-rtecp.c @@ -289,12 +289,12 @@ static int rtecp_create_key(sc_profile_t *profile, sc_pkcs15_card_t *p15card, sc_context_t *ctx; /* RSA_PRkey/ for Miller- * RSA_PUBkey Rabin test Attempts Reserve */ - const unsigned char prkey_prop[] = { 0x23, 0x1F, 0, 0xFF, 0, 0 }; - const unsigned char pbkey_prop[] = { 0x33, 0x1F, 0, 0xFF, 0, 0 }; + const unsigned char prkey_prop[] = { 0x23, 0x1F, 0, 0xAA, 0, 0 }; + const unsigned char pbkey_prop[] = { 0x33, 0x1F, 0, 0xAA, 0, 0 }; /* GOSTR3410_PRkey/ * GOSTR3410_PUBkey paramset Attempts Reserve */ - unsigned char prgkey_prop[] = { 0x03, '?', 0, 0xFF, 0, 0 }; - unsigned char pbgkey_prop[] = { 0x13, '?', 0, 0xFF, 0, 0 }; + unsigned char prgkey_prop[] = { 0x03, '?', 0, 0xAA, 0, 0 }; + unsigned char pbgkey_prop[] = { 0x13, '?', 0, 0xAA, 0, 0 }; /* AccessMode - Update Use - - - Delete */ unsigned char prkey_sec[15] = { 0x46, 0, '?', '?', 0, 0, 0, '?' }; unsigned char pbkey_sec[15] = { 0x46, 0, '?', 0, 0, 0, 0, '?' }; From 6b2fcf825f6e6203c51791f4a45f351b7c3a312f Mon Sep 17 00:00:00 2001 From: Aleksey Samsonov Date: Sun, 24 Jan 2016 01:30:59 +0300 Subject: [PATCH 2/2] Rutoken ECP: additional Miller-Rabin tests aren't needed Make universal properties at RSF-files. Additional Miller-Rabin tests aren't needed for 'Rutoken ECP' and for 'Rutoken ECP 2.0' fixes https://github.com/OpenSC/OpenSC/issues/648 : 'Incorrect parameters in APDU' at 'Rutoken ECP 2.0' when 'pkcs15-init -G rsa/1024 ...' --- src/pkcs15init/pkcs15-rtecp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pkcs15init/pkcs15-rtecp.c b/src/pkcs15init/pkcs15-rtecp.c index e13d2bfb..329704d3 100644 --- a/src/pkcs15init/pkcs15-rtecp.c +++ b/src/pkcs15init/pkcs15-rtecp.c @@ -287,10 +287,10 @@ static int rtecp_create_key(sc_profile_t *profile, sc_pkcs15_card_t *p15card, sc_pkcs15_object_t *obj) { sc_context_t *ctx; - /* RSA_PRkey/ for Miller- - * RSA_PUBkey Rabin test Attempts Reserve */ - const unsigned char prkey_prop[] = { 0x23, 0x1F, 0, 0xAA, 0, 0 }; - const unsigned char pbkey_prop[] = { 0x33, 0x1F, 0, 0xAA, 0, 0 }; + /* RSA_PRkey/ Adds Miller- + * RSA_PUBkey Rabin tests Attempts Reserve */ + const unsigned char prkey_prop[] = { 0x23, 0, 0, 0xAA, 0, 0 }; + const unsigned char pbkey_prop[] = { 0x33, 0, 0, 0xAA, 0, 0 }; /* GOSTR3410_PRkey/ * GOSTR3410_PUBkey paramset Attempts Reserve */ unsigned char prgkey_prop[] = { 0x03, '?', 0, 0xAA, 0, 0 };