Print this page
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
*** 17,27 ****
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
! * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* digest.c
--- 17,27 ----
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
! * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* digest.c
*** 69,91 ****
#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 DIGEST_OPTIONS "lva:" /* for getopt */
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 char *keyfile = NULL; /* name of keyfile */
! static char *token_label = NULL;
! static char *key_label = NULL;
static CK_BYTE buf[BUFFERSIZE];
struct mech_alias {
CK_MECHANISM_TYPE type;
--- 69,92 ----
#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 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; /* -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 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];
struct mech_alias {
CK_MECHANISM_TYPE type;
*** 124,134 ****
int fd, CK_BYTE_PTR *pdigest, CK_ULONG_PTR pdigestlen);
int
main(int argc, char **argv)
{
-
extern char *optarg;
extern int optind;
int errflag = 0; /* We had an optstr parse error */
char c; /* current getopts flag */
char *algo_str; /* mechanism/algorithm string */
--- 125,134 ----
*** 428,438 ****
0, B_FALSE);
}
if (status != 0 || keylen == 0 || pkeydata == NULL) {
cryptoerror(LOG_STDERR,
! Kflag ? gettext("invalid passphrase.") :
gettext("invalid key."));
return (EXIT_FAILURE);
}
}
}
--- 428,439 ----
0, B_FALSE);
}
if (status != 0 || keylen == 0 || pkeydata == NULL) {
cryptoerror(LOG_STDERR,
! (Kflag || (keyfile == NULL)) ?
! gettext("invalid passphrase.") :
gettext("invalid key."));
return (EXIT_FAILURE);
}
}
}
*** 448,458 ****
/* Get slot count */
rv = C_GetSlotList(0, NULL_PTR, &slotcount);
if (rv != CKR_OK || slotcount == 0) {
cryptoerror(LOG_STDERR, gettext(
! "failed to find any cryptographic provider,"
"please check with your system administrator: %s"),
pkcs11_strerror(rv));
exitcode = EXIT_FAILURE;
goto cleanup;
}
--- 449,459 ----
/* Get slot count */
rv = C_GetSlotList(0, NULL_PTR, &slotcount);
if (rv != CKR_OK || slotcount == 0) {
cryptoerror(LOG_STDERR, gettext(
! "failed to find any cryptographic provider; "
"please check with your system administrator: %s"),
pkcs11_strerror(rv));
exitcode = EXIT_FAILURE;
goto cleanup;
}
*** 468,478 ****
}
/* Get the list of slots */
if ((rv = C_GetSlotList(0, pSlotList, &slotcount)) != CKR_OK) {
cryptoerror(LOG_STDERR, gettext(
! "failed to find any cryptographic provider,"
"please check with your system administrator: %s"),
pkcs11_strerror(rv));
exitcode = EXIT_FAILURE;
goto cleanup;
}
--- 469,479 ----
}
/* Get the list of slots */
if ((rv = C_GetSlotList(0, pSlotList, &slotcount)) != CKR_OK) {
cryptoerror(LOG_STDERR, gettext(
! "failed to find any cryptographic provider; "
"please check with your system administrator: %s"),
pkcs11_strerror(rv));
exitcode = EXIT_FAILURE;
goto cleanup;
}