summaryrefslogtreecommitdiff
path: root/ssh-keygen.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-keygen.c')
-rw-r--r--ssh-keygen.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/ssh-keygen.c b/ssh-keygen.c
index 88b97efe1..f1e6d53c7 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.69 2001/06/28 19:57:35 stevesk Exp $"); 15RCSID("$OpenBSD: ssh-keygen.c,v 1.70 2001/06/29 07:06:34 markus Exp $");
16 16
17#include <openssl/evp.h> 17#include <openssl/evp.h>
18#include <openssl/pem.h> 18#include <openssl/pem.h>
@@ -385,7 +385,7 @@ do_print_public(struct passwd *pw)
385 do { \ 385 do { \
386 len = BN_num_bytes(prv->rsa->x); \ 386 len = BN_num_bytes(prv->rsa->x); \
387 elements[i] = xmalloc(len); \ 387 elements[i] = xmalloc(len); \
388error("#bytes %d", len); \ 388 debug("#bytes %d", len); \
389 if (BN_bn2bin(prv->rsa->x, elements[i]) < 0) \ 389 if (BN_bn2bin(prv->rsa->x, elements[i]) < 0) \
390 goto done; \ 390 goto done; \
391 } while(0) 391 } while(0)
@@ -403,7 +403,7 @@ do_upload(struct passwd *pw, int reader)
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 cla = 0x00; 406 int r1 = 0, r2 = 0, cla = 0x00;
407 407
408 if (!have_identity) 408 if (!have_identity)
409 ask_filename(pw, "Enter file in which the key is"); 409 ask_filename(pw, "Enter file in which the key is");
@@ -427,12 +427,12 @@ do_upload(struct passwd *pw, int reader)
427 len = BN_num_bytes(prv->rsa->n); 427 len = BN_num_bytes(prv->rsa->n);
428 fd = scopen(reader, 0, NULL); 428 fd = scopen(reader, 0, NULL);
429 if (fd < 0) { 429 if (fd < 0) {
430 error("scopen failed %d.", fd); 430 error("scopen failed");
431 goto done; 431 goto done;
432 } 432 }
433 ret = screset(fd, atr, NULL); 433 ret = screset(fd, atr, NULL);
434 if (ret <= 0) { 434 if (ret <= 0) {
435 error("screset failed."); 435 error("screset 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) {
@@ -445,12 +445,22 @@ do_upload(struct passwd *pw, int reader)
445 } 445 }
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) < 0) 448 if (cyberflex_load_rsa_priv(fd, cla, key_fid, 5, 8*len, elements,
449 &r1, &r2) < 0) {
450 error("cyberflex_load_rsa_priv failed: %s", get_r1r2s(r1, r1));
451 goto done;
452 }
453 if (r1 != 0x90 && r1 != 0x61)
449 goto done; 454 goto done;
450 log("cyberflex_load_rsa_priv done"); 455 log("cyberflex_load_rsa_priv done");
451 key_fid[0] = 0x73; 456 key_fid[0] = 0x73;
452 key_fid[1] = 0x68; 457 key_fid[1] = 0x68;
453 if (cyberflex_load_rsa_pub(fd, cla, key_fid, len, elements[5]) < 0) 458 if (cyberflex_load_rsa_pub(fd, cla, key_fid, len, elements[5],
459 &r1, &r2) < 0) {
460 error("cyberflex_load_rsa_pub failed: %s", get_r1r2s(r1, r1));
461 goto done;
462 }
463 if (r1 != 0x90 && r1 != 0x61)
454 goto done; 464 goto done;
455 log("cyberflex_load_rsa_pub done"); 465 log("cyberflex_load_rsa_pub done");
456 status = 0; 466 status = 0;