diff options
author | Dan OpenSolaris Anderson <opensolaris@drydog.com> | 2010-01-08 13:30:02 -0800 |
---|---|---|
committer | Dan OpenSolaris Anderson <opensolaris@drydog.com> | 2010-01-08 13:30:02 -0800 |
commit | ddcb637016537d200651b05908187af72d7babd3 (patch) | |
tree | b047d58663bcfb7b90bb56455908b9628eda95c1 /usr/src/cmd/cmd-crypto/digest/digest.c | |
parent | 9e3469d3db608feb0e43d9955cbf406c22025463 (diff) | |
download | illumos-joyent-ddcb637016537d200651b05908187af72d7babd3.tar.gz |
6862532 "cryptoadm: failed to parse configuration" error
6353443 domestic (crypt) source build leaves stuff it shouldn't
6818180 mac(1) printed "invalid key" error message when user input an invalid passphrase
Diffstat (limited to 'usr/src/cmd/cmd-crypto/digest/digest.c')
-rw-r--r-- | usr/src/cmd/cmd-crypto/digest/digest.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/usr/src/cmd/cmd-crypto/digest/digest.c b/usr/src/cmd/cmd-crypto/digest/digest.c index e2971efad2..6115876358 100644 --- a/usr/src/cmd/cmd-crypto/digest/digest.c +++ b/usr/src/cmd/cmd-crypto/digest/digest.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2010 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -70,20 +70,21 @@ #define EXIT_USAGE 2 /* usage/syntax error */ #define MAC_NAME "mac" /* name of mac command */ -#define MAC_OPTIONS "lva:k:T:K:" /* for getopt */ -#define DIGEST_NAME "digest" /* name of mac command */ +#define MAC_OPTIONS "lva:k:T:K:" /* for getopt */ +#define DIGEST_NAME "digest" /* name of digest command */ #define DIGEST_OPTIONS "lva:" /* for getopt */ +/* Saved command line options */ static boolean_t vflag = B_FALSE; /* -v (verbose) flag, optional */ static boolean_t aflag = B_FALSE; /* -a <algorithm> flag, required */ static boolean_t lflag = B_FALSE; /* -l flag, for mac and digest */ -static boolean_t kflag = B_FALSE; -static boolean_t Tflag = B_FALSE; -static boolean_t Kflag = B_FALSE; +static boolean_t kflag = B_FALSE; /* -k keyfile */ +static boolean_t Tflag = B_FALSE; /* -T token_spec */ +static boolean_t Kflag = B_FALSE; /* -K key_label */ -static char *keyfile = NULL; /* name of keyfile */ -static char *token_label = NULL; -static char *key_label = NULL; +static char *keyfile = NULL; /* name of file containing key value */ +static char *token_label = NULL; /* tokensSpec: tokenName[:manufId[:serial]] */ +static char *key_label = NULL; /* PKCS#11 symmetric token key label */ static CK_BYTE buf[BUFFERSIZE]; @@ -126,7 +127,6 @@ static CK_RV do_digest(CK_SESSION_HANDLE hSession, CK_MECHANISM_PTR pmech, int main(int argc, char **argv) { - extern char *optarg; extern int optind; int errflag = 0; /* We had an optstr parse error */ @@ -430,7 +430,8 @@ execute_cmd(char *algo_str, int filecount, char **filelist, boolean_t mac_cmd) if (status != 0 || keylen == 0 || pkeydata == NULL) { cryptoerror(LOG_STDERR, - Kflag ? gettext("invalid passphrase.") : + (Kflag || (keyfile == NULL)) ? + gettext("invalid passphrase.") : gettext("invalid key.")); return (EXIT_FAILURE); } @@ -450,7 +451,7 @@ execute_cmd(char *algo_str, int filecount, char **filelist, boolean_t mac_cmd) rv = C_GetSlotList(0, NULL_PTR, &slotcount); if (rv != CKR_OK || slotcount == 0) { cryptoerror(LOG_STDERR, gettext( - "failed to find any cryptographic provider," + "failed to find any cryptographic provider; " "please check with your system administrator: %s"), pkcs11_strerror(rv)); exitcode = EXIT_FAILURE; @@ -470,7 +471,7 @@ execute_cmd(char *algo_str, int filecount, char **filelist, boolean_t mac_cmd) /* Get the list of slots */ if ((rv = C_GetSlotList(0, pSlotList, &slotcount)) != CKR_OK) { cryptoerror(LOG_STDERR, gettext( - "failed to find any cryptographic provider," + "failed to find any cryptographic provider; " "please check with your system administrator: %s"), pkcs11_strerror(rv)); exitcode = EXIT_FAILURE; |