diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | ssh-keygen.c | 39 |
2 files changed, 24 insertions, 20 deletions
@@ -121,6 +121,9 @@ | |||
121 | - markus@cvs.openbsd.org 2001/07/02 22:29:20 | 121 | - markus@cvs.openbsd.org 2001/07/02 22:29:20 |
122 | [readpass.c] | 122 | [readpass.c] |
123 | do not return NULL, use "" instead. | 123 | do not return NULL, use "" instead. |
124 | - markus@cvs.openbsd.org 2001/07/02 22:40:18 | ||
125 | [ssh-keygen.c] | ||
126 | update for sectok.h interface changes. | ||
124 | 127 | ||
125 | 20010629 | 128 | 20010629 |
126 | - (bal) Removed net_aton() since we don't use it any more | 129 | - (bal) Removed net_aton() since we don't use it any more |
@@ -5948,4 +5951,4 @@ | |||
5948 | - Wrote replacements for strlcpy and mkdtemp | 5951 | - Wrote replacements for strlcpy and mkdtemp |
5949 | - Released 1.0pre1 | 5952 | - Released 1.0pre1 |
5950 | 5953 | ||
5951 | $Id: ChangeLog,v 1.1374 2001/07/04 05:19:27 mouring Exp $ | 5954 | $Id: ChangeLog,v 1.1375 2001/07/04 05:24:27 mouring Exp $ |
diff --git a/ssh-keygen.c b/ssh-keygen.c index bcb7ab2c3..8b0b4d8dd 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" |
15 | RCSID("$OpenBSD: ssh-keygen.c,v 1.71 2001/06/29 07:11:01 markus Exp $"); | 15 | RCSID("$OpenBSD: ssh-keygen.c,v 1.72 2001/07/02 22:40:18 markus Exp $"); |
16 | 16 | ||
17 | #include <openssl/evp.h> | 17 | #include <openssl/evp.h> |
18 | #include <openssl/pem.h> | 18 | #include <openssl/pem.h> |
@@ -400,10 +400,10 @@ 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]; | 403 | u_char atr[256]; |
404 | u_char AUT0[] = {0xad, 0x9f, 0x61, 0xfe, 0xfa, 0x20, 0xce, 0x63}; | 404 | u_char AUT0[] = {0xad, 0x9f, 0x61, 0xfe, 0xfa, 0x20, 0xce, 0x63}; |
405 | int len, status = 1, i, fd = -1, ret; | 405 | int len, status = 1, i, fd = -1, ret; |
406 | int r1 = 0, r2 = 0, cla = 0x00; | 406 | int sw = 0, cla = 0x00; |
407 | 407 | ||
408 | for (i = 0; i < NUM_RSA_KEY_ELEMENTS; i++) | 408 | for (i = 0; i < NUM_RSA_KEY_ELEMENTS; i++) |
409 | elements[i] = NULL; | 409 | elements[i] = NULL; |
@@ -425,16 +425,16 @@ do_upload(struct passwd *pw, int reader) | |||
425 | COPY_RSA_KEY(dmp1, 4); | 425 | COPY_RSA_KEY(dmp1, 4); |
426 | COPY_RSA_KEY(n, 5); | 426 | COPY_RSA_KEY(n, 5); |
427 | len = BN_num_bytes(prv->rsa->n); | 427 | len = BN_num_bytes(prv->rsa->n); |
428 | fd = scopen(reader, 0, NULL); | 428 | fd = sectok_open(reader, 0, NULL); |
429 | if (fd < 0) { | 429 | if (fd < 0) { |
430 | error("scopen failed"); | 430 | error("sectok_open failed"); |
431 | goto done; | 431 | goto done; |
432 | } | 432 | } |
433 | ret = screset(fd, atr, NULL); | 433 | ret = sectok_reset(fd, 0, atr, &sw); |
434 | if (ret <= 0) { | 434 | if (ret <= 0) { |
435 | error("screset failed"); | 435 | error("sectok_reset failed"); |
436 | goto done; | 436 | goto done; |
437 | } | 437 | } |
438 | if ((cla = cyberflex_inq_class(fd)) < 0) { | 438 | if ((cla = cyberflex_inq_class(fd)) < 0) { |
439 | error("cyberflex_inq_class failed"); | 439 | error("cyberflex_inq_class failed"); |
440 | goto done; | 440 | goto done; |
@@ -446,21 +446,21 @@ do_upload(struct passwd *pw, int reader) | |||
446 | key_fid[0] = 0x00; | 446 | key_fid[0] = 0x00; |
447 | key_fid[1] = 0x12; | 447 | key_fid[1] = 0x12; |
448 | if (cyberflex_load_rsa_priv(fd, cla, key_fid, 5, 8*len, elements, | 448 | if (cyberflex_load_rsa_priv(fd, cla, key_fid, 5, 8*len, elements, |
449 | &r1, &r2) < 0) { | 449 | &sw) < 0) { |
450 | error("cyberflex_load_rsa_priv failed: %s", get_r1r2s(r1, r1)); | 450 | error("cyberflex_load_rsa_priv failed: %s", sectok_get_sw(sw)); |
451 | goto done; | 451 | goto done; |
452 | } | 452 | } |
453 | if (r1 != 0x90 && r1 != 0x61) | 453 | if (!sectok_swOK(sw)) |
454 | goto done; | 454 | goto done; |
455 | log("cyberflex_load_rsa_priv done"); | 455 | log("cyberflex_load_rsa_priv done"); |
456 | key_fid[0] = 0x73; | 456 | key_fid[0] = 0x73; |
457 | key_fid[1] = 0x68; | 457 | key_fid[1] = 0x68; |
458 | if (cyberflex_load_rsa_pub(fd, cla, key_fid, len, elements[5], | 458 | if (cyberflex_load_rsa_pub(fd, cla, key_fid, len, elements[5], |
459 | &r1, &r2) < 0) { | 459 | &sw) < 0) { |
460 | error("cyberflex_load_rsa_pub failed: %s", get_r1r2s(r1, r1)); | 460 | error("cyberflex_load_rsa_pub failed: %s", sectok_get_sw(sw)); |
461 | goto done; | 461 | goto done; |
462 | } | 462 | } |
463 | if (r1 != 0x90 && r1 != 0x61) | 463 | if (!sectok_swOK(sw)) |
464 | goto done; | 464 | goto done; |
465 | log("cyberflex_load_rsa_pub done"); | 465 | log("cyberflex_load_rsa_pub done"); |
466 | status = 0; | 466 | status = 0; |
@@ -469,9 +469,10 @@ done: | |||
469 | if (prv) | 469 | if (prv) |
470 | key_free(prv); | 470 | key_free(prv); |
471 | for (i = 0; i < NUM_RSA_KEY_ELEMENTS; i++) | 471 | for (i = 0; i < NUM_RSA_KEY_ELEMENTS; i++) |
472 | xfree(elements[i]); | 472 | if (elements[i]) |
473 | xfree(elements[i]); | ||
473 | if (fd != -1) | 474 | if (fd != -1) |
474 | scclose(fd); | 475 | sectok_close(fd); |
475 | exit(status); | 476 | exit(status); |
476 | #endif | 477 | #endif |
477 | } | 478 | } |