X-Git-Url: http://andersk.mit.edu/gitweb/openssh.git/blobdiff_plain/4e842b5e4128e9cea25419483e0f4e47265e939a..b2bab0595c6a00d00c7c3208fc7ee4f84d2a5151:/scard.c diff --git a/scard.c b/scard.c index f67f7e7e..e8319314 100644 --- a/scard.c +++ b/scard.c @@ -24,7 +24,7 @@ #include "includes.h" #ifdef SMARTCARD -RCSID("$OpenBSD: scard.c,v 1.14 2001/09/17 20:22:14 markus Exp $"); +RCSID("$OpenBSD: scard.c,v 1.17 2001/12/27 18:22:16 markus Exp $"); #include #include @@ -48,7 +48,7 @@ static int cla = 0x00; /* class */ /* interface to libsectok */ -static int +static int sc_open(void) { int sw; @@ -79,7 +79,7 @@ sc_open(void) return sc_fd; } -static int +static int sc_enable_applet(void) { static u_char aid[] = {0xfc, 0x53, 0x73, 0x68, 0x2e, 0x62, 0x69, 0x6e}; @@ -95,7 +95,7 @@ sc_enable_applet(void) return 0; } -static int +static int sc_init(void) { int status; @@ -115,7 +115,7 @@ sc_init(void) return 0; } -static int +static int sc_read_pubkey(Key * k) { u_char buf[2], *n; @@ -123,6 +123,7 @@ sc_read_pubkey(Key * k) int len, sw, status = -1; len = sw = 0; + n = NULL; if (sc_fd < 0) { status = sc_init(); @@ -132,7 +133,7 @@ sc_read_pubkey(Key * k) /* get key size */ sectok_apdu(sc_fd, CLA_SSH, INS_GET_KEYLENGTH, 0, 0, 0, NULL, - sizeof(buf), buf, &sw); + sizeof(buf), buf, &sw); if (!sectok_swOK(sw)) { error("could not obtain key length: %s", sectok_get_sw(sw)); goto err; @@ -203,7 +204,7 @@ sc_private_decrypt(int flen, u_char *from, u_char *to, RSA *rsa, int padding) goto err; } sectok_apdu(sc_fd, CLA_SSH, INS_GET_RESPONSE, 0, 0, 0, NULL, - len, padded, &sw); + len, padded, &sw); if (!sectok_swOK(sw)) { error("sc_private_decrypt: INS_GET_RESPONSE failed: %s", sectok_get_sw(sw)); @@ -248,7 +249,7 @@ sc_private_encrypt(int flen, u_char *from, u_char *to, RSA *rsa, int padding) goto err; } sectok_apdu(sc_fd, CLA_SSH, INS_GET_RESPONSE, 0, 0, 0, NULL, - len, to, &sw); + len, to, &sw); if (!sectok_swOK(sw)) { error("sc_private_decrypt: INS_GET_RESPONSE failed: %s", sectok_get_sw(sw)); @@ -319,7 +320,8 @@ sc_get_engine(void) smart_rsa.rsa_sign = def->rsa_sign; smart_rsa.rsa_verify = def->rsa_verify; - smart_engine = ENGINE_new(); + if ((smart_engine = ENGINE_new()) == NULL) + fatal("ENGINE_new failed"); ENGINE_set_id(smart_engine, "sectok"); ENGINE_set_name(smart_engine, "libsectok");