summaryrefslogtreecommitdiff
path: root/ssh-add.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2010-02-12 09:21:02 +1100
committerDamien Miller <djm@mindrot.org>2010-02-12 09:21:02 +1100
commit7ea845e48df6d34a333ebbe79380cba0938d02a5 (patch)
tree44ab0d3fdfe0560b7ca92f5747e9dd5d012aea18 /ssh-add.c
parent17751bcab25681d341442fdc2386a30a6bea345e (diff)
- markus@cvs.openbsd.org 2010/02/08 10:50:20
[pathnames.h readconf.c readconf.h scp.1 sftp.1 ssh-add.1 ssh-add.c] [ssh-agent.c ssh-keygen.1 ssh-keygen.c ssh.1 ssh.c ssh_config.5] replace our obsolete smartcard code with PKCS#11. ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-11/v2-20/pkcs-11v2-20.pdf ssh(1) and ssh-keygen(1) use dlopen(3) directly to talk to a PKCS#11 provider (shared library) while ssh-agent(1) delegates PKCS#11 to a forked a ssh-pkcs11-helper process. PKCS#11 is currently a compile time option. feedback and ok djm@; inspired by patches from Alon Bar-Lev `
Diffstat (limited to 'ssh-add.c')
-rw-r--r--ssh-add.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/ssh-add.c b/ssh-add.c
index 084478d78..90e5be20b 100644
--- a/ssh-add.c
+++ b/ssh-add.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssh-add.c,v 1.91 2009/08/27 17:44:52 djm Exp $ */ 1/* $OpenBSD: ssh-add.c,v 1.92 2010/02/08 10:50:20 markus Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -211,7 +211,7 @@ update_card(AuthenticationConnection *ac, int add, const char *id)
211 char *pin; 211 char *pin;
212 int ret = -1; 212 int ret = -1;
213 213
214 pin = read_passphrase("Enter passphrase for smartcard: ", RP_ALLOW_STDIN); 214 pin = read_passphrase("Enter passphrase for PKCS#11: ", RP_ALLOW_STDIN);
215 if (pin == NULL) 215 if (pin == NULL)
216 return -1; 216 return -1;
217 217
@@ -317,10 +317,8 @@ usage(void)
317 fprintf(stderr, " -X Unlock agent.\n"); 317 fprintf(stderr, " -X Unlock agent.\n");
318 fprintf(stderr, " -t life Set lifetime (in seconds) when adding identities.\n"); 318 fprintf(stderr, " -t life Set lifetime (in seconds) when adding identities.\n");
319 fprintf(stderr, " -c Require confirmation to sign using identities\n"); 319 fprintf(stderr, " -c Require confirmation to sign using identities\n");
320#ifdef SMARTCARD 320 fprintf(stderr, " -s pkcs11 Add keys from PKCS#11 provider.\n");
321 fprintf(stderr, " -s reader Add key in smartcard reader.\n"); 321 fprintf(stderr, " -e pkcs11 Remove keys provided by PKCS#11 provider.\n");
322 fprintf(stderr, " -e reader Remove key in smartcard reader.\n");
323#endif
324} 322}
325 323
326int 324int
@@ -329,7 +327,7 @@ main(int argc, char **argv)
329 extern char *optarg; 327 extern char *optarg;
330 extern int optind; 328 extern int optind;
331 AuthenticationConnection *ac = NULL; 329 AuthenticationConnection *ac = NULL;
332 char *sc_reader_id = NULL; 330 char *pkcs11provider = NULL;
333 int i, ch, deleting = 0, ret = 0; 331 int i, ch, deleting = 0, ret = 0;
334 332
335 /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */ 333 /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
@@ -371,11 +369,11 @@ main(int argc, char **argv)
371 ret = 1; 369 ret = 1;
372 goto done; 370 goto done;
373 case 's': 371 case 's':
374 sc_reader_id = optarg; 372 pkcs11provider = optarg;
375 break; 373 break;
376 case 'e': 374 case 'e':
377 deleting = 1; 375 deleting = 1;
378 sc_reader_id = optarg; 376 pkcs11provider = optarg;
379 break; 377 break;
380 case 't': 378 case 't':
381 if ((lifetime = convtime(optarg)) == -1) { 379 if ((lifetime = convtime(optarg)) == -1) {
@@ -392,8 +390,8 @@ main(int argc, char **argv)
392 } 390 }
393 argc -= optind; 391 argc -= optind;
394 argv += optind; 392 argv += optind;
395 if (sc_reader_id != NULL) { 393 if (pkcs11provider != NULL) {
396 if (update_card(ac, !deleting, sc_reader_id) == -1) 394 if (update_card(ac, !deleting, pkcs11provider) == -1)
397 ret = 1; 395 ret = 1;
398 goto done; 396 goto done;
399 } 397 }