summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-08-06 21:10:52 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-08-06 21:10:52 +0000
commit60df8e4f7d9f7c36b5fac87d10d9edb217d2d6e7 (patch)
treef97b34f4fb3c1efeb20a80bd986696707dd3f3fa
parent794325ac7a490d02c9ce5c0ad3093e1874df59a0 (diff)
- rees@cvs.openbsd.org 2001/07/26 20:04:27
[scard.c ssh-keygen.c] Inquire Cyberflex class for 0xf0 cards change aid to conform to 7816-5 remove gratuitous fid selects
-rw-r--r--ChangeLog7
-rw-r--r--scard.c33
-rw-r--r--ssh-keygen.c7
3 files changed, 17 insertions, 30 deletions
diff --git a/ChangeLog b/ChangeLog
index 7008ff9d3..59e54f05c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -40,6 +40,11 @@
40 [sshd.8 sshd.c] 40 [sshd.8 sshd.c]
41 add -t option to test configuration file and keys; pekkas@netcore.fi 41 add -t option to test configuration file and keys; pekkas@netcore.fi
42 ok markus@ 42 ok markus@
43 - rees@cvs.openbsd.org 2001/07/26 20:04:27
44 [scard.c ssh-keygen.c]
45 Inquire Cyberflex class for 0xf0 cards
46 change aid to conform to 7816-5
47 remove gratuitous fid selects
43 48
4420010803 4920010803
45 - (djm) Fix interrupted read in entropy gatherer. Spotted by markus@ on 50 - (djm) Fix interrupted read in entropy gatherer. Spotted by markus@ on
@@ -6150,4 +6155,4 @@
6150 - Wrote replacements for strlcpy and mkdtemp 6155 - Wrote replacements for strlcpy and mkdtemp
6151 - Released 1.0pre1 6156 - Released 1.0pre1
6152 6157
6153$Id: ChangeLog,v 1.1437 2001/08/06 21:09:07 mouring Exp $ 6158$Id: ChangeLog,v 1.1438 2001/08/06 21:10:52 mouring Exp $
diff --git a/scard.c b/scard.c
index 25776d2e6..b8640b890 100644
--- a/scard.c
+++ b/scard.c
@@ -24,7 +24,7 @@
24 24
25#ifdef SMARTCARD 25#ifdef SMARTCARD
26#include "includes.h" 26#include "includes.h"
27RCSID("$OpenBSD: scard.c,v 1.6 2001/07/25 11:59:35 markus Exp $"); 27RCSID("$OpenBSD: scard.c,v 1.7 2001/07/26 20:04:27 rees Exp $");
28 28
29#include <openssl/engine.h> 29#include <openssl/engine.h>
30#include <sectok.h> 30#include <sectok.h>
@@ -51,7 +51,6 @@ static int cla = 0x00; /* class */
51static int 51static int
52sc_open(void) 52sc_open(void)
53{ 53{
54 u_char atr[256];
55 int sw; 54 int sw;
56 55
57 if (sc_fd >= 0) 56 if (sc_fd >= 0)
@@ -62,11 +61,13 @@ sc_open(void)
62 error("sectok_open failed: %s", sectok_get_sw(sw)); 61 error("sectok_open failed: %s", sectok_get_sw(sw));
63 return -1; 62 return -1;
64 } 63 }
65 if (sectok_reset(sc_fd, 0, atr, &sw) <= 0) { 64 if (sectok_reset(sc_fd, 0, NULL, &sw) <= 0) {
66 error("sectok_reset failed: %s", sectok_get_sw(sw)); 65 error("sectok_reset failed: %s", sectok_get_sw(sw));
67 sc_fd = -1; 66 sc_fd = -1;
68 return sc_fd; 67 return sc_fd;
69 } 68 }
69 if ((cla = cyberflex_inq_class(sc_fd)) < 0)
70 cla = 0;
70 71
71 debug("sc_open ok %d", sc_fd); 72 debug("sc_open ok %d", sc_fd);
72 return sc_fd; 73 return sc_fd;
@@ -75,29 +76,11 @@ sc_open(void)
75static int 76static int
76sc_enable_applet(void) 77sc_enable_applet(void)
77{ 78{
78 u_char contID[2], aid[MAX_BUF_SIZE]; 79 static u_char aid[] = {0xfc, 0x53, 0x73, 0x68, 0x2e, 0x62, 0x69, 0x6e};
79 int i, len, sw, aid_len; 80 int sw = 0;
80 81
81 len = sw = 0; 82 /* select applet id */
82 contID[0] = 0x77; 83 sectok_apdu(sc_fd, cla, 0xa4, 0x04, 0, sizeof aid, aid, 0, NULL, &sw);
83 contID[1] = 0x78;
84
85 if (sectok_selectfile(sc_fd, cla, root_fid, &sw) < 0) {
86 error("sectok_selectfile root_fid failed: %s",
87 sectok_get_sw(sw));
88 sc_close();
89 return -1;
90 }
91 if (sectok_selectfile(sc_fd, cla, contID, &sw) < 0) {
92 error("sectok_selectfile failed: %s", sectok_get_sw(sw));
93 sc_close();
94 return -1;
95 }
96 /* send applet id */
97 for (i = 0; i < sizeof(aid); i++)
98 aid[i] = 0x77;
99 aid_len = 5;
100 sectok_apdu(sc_fd, cla, 0xa4, 0x04, 0, aid_len, aid, 0, NULL, &sw);
101 if (!sectok_swOK(sw)) { 84 if (!sectok_swOK(sw)) {
102 error("sectok_apdu failed: %s", sectok_get_sw(sw)); 85 error("sectok_apdu failed: %s", sectok_get_sw(sw));
103 sc_close(); 86 sc_close();
diff --git a/ssh-keygen.c b/ssh-keygen.c
index 8b0b4d8dd..003357321 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$OpenBSD: ssh-keygen.c,v 1.72 2001/07/02 22:40:18 markus Exp $"); 15RCSID("$OpenBSD: ssh-keygen.c,v 1.73 2001/07/26 20:04:27 rees Exp $");
16 16
17#include <openssl/evp.h> 17#include <openssl/evp.h>
18#include <openssl/pem.h> 18#include <openssl/pem.h>
@@ -400,7 +400,6 @@ do_upload(struct passwd *pw, int reader)
400 struct stat st; 400 struct stat st;
401 u_char *elements[NUM_RSA_KEY_ELEMENTS]; 401 u_char *elements[NUM_RSA_KEY_ELEMENTS];
402 u_char key_fid[2]; 402 u_char key_fid[2];
403 u_char atr[256];
404 u_char AUT0[] = {0xad, 0x9f, 0x61, 0xfe, 0xfa, 0x20, 0xce, 0x63}; 403 u_char AUT0[] = {0xad, 0x9f, 0x61, 0xfe, 0xfa, 0x20, 0xce, 0x63};
405 int len, status = 1, i, fd = -1, ret; 404 int len, status = 1, i, fd = -1, ret;
406 int sw = 0, cla = 0x00; 405 int sw = 0, cla = 0x00;
@@ -425,12 +424,12 @@ do_upload(struct passwd *pw, int reader)
425 COPY_RSA_KEY(dmp1, 4); 424 COPY_RSA_KEY(dmp1, 4);
426 COPY_RSA_KEY(n, 5); 425 COPY_RSA_KEY(n, 5);
427 len = BN_num_bytes(prv->rsa->n); 426 len = BN_num_bytes(prv->rsa->n);
428 fd = sectok_open(reader, 0, NULL); 427 fd = sectok_open(reader, 0, &sw);
429 if (fd < 0) { 428 if (fd < 0) {
430 error("sectok_open failed"); 429 error("sectok_open failed");
431 goto done; 430 goto done;
432 } 431 }
433 ret = sectok_reset(fd, 0, atr, &sw); 432 ret = sectok_reset(fd, 0, NULL, &sw);
434 if (ret <= 0) { 433 if (ret <= 0) {
435 error("sectok_reset failed"); 434 error("sectok_reset failed");
436 goto done; 435 goto done;