Lines Matching defs:cmd_info
98 } cmd_info;
164 cmd_info.cert = NULL;
165 cmd_info.elfobj = NULL;
166 cmd_info.elfcnt = 0;
167 cmd_info.es_action = ES_GET;
168 cmd_info.ess = NULL;
169 cmd_info.extracnt = 0;
170 cmd_info.field = FLD_UNKNOWN;
171 cmd_info.internal_req = '\0';
172 cmd_info.pinpath = NULL;
173 cmd_info.privpath = NULL;
174 cmd_info.token_label = NULL;
175 cmd_info.verbose = B_FALSE;
178 cmd_info.cmd = ES_SIGN;
182 cmd_info.es_action = ES_UPDATE_RSA_SHA1;
184 cmd_info.cmd = ES_VERIFY;
189 cmd_info.cmd = ES_REQUEST;
194 cmd_info.cmd = ES_LIST;
217 cmd_info.cert = optarg;
220 cmd_info.elfcnt++;
221 cmd_info.elfobj = (char **)realloc(cmd_info.elfobj,
222 sizeof (char *) * cmd_info.elfcnt);
223 if (cmd_info.elfobj == NULL) {
228 cmd_info.elfobj[cmd_info.elfcnt - 1] = optarg;
233 cmd_info.field = FLD_UNKNOWN;
236 cmd_info.field = fp->field;
240 if (cmd_info.field == FLD_UNKNOWN) {
248 cmd_info.es_action = ES_UPDATE_RSA_MD5_SHA1;
250 cmd_info.es_action = ES_UPDATE_RSA_SHA1;
257 cmd_info.internal_req = *optarg;
260 cmd_info.privpath = optarg;
261 if (cmd_info.token_label != NULL ||
262 cmd_info.pinpath != NULL)
266 cmd_info.pinpath = optarg;
267 if (cmd_info.privpath != NULL)
271 cmd_info.cert = optarg;
274 cmd_info.token_label = optarg;
275 if (cmd_info.privpath != NULL)
279 cmd_info.verbose = B_TRUE;
287 cmd_info.extracnt = argc - optind;
289 if (cmd_info.extracnt != 0 &&
290 cmd_info.cmd != ES_SIGN && cmd_info.cmd != ES_VERIFY) {
296 switch (cmd_info.cmd) {
298 if (cmd_info.elfcnt + argc - optind == 0) {
305 if (((cmd_info.privpath == NULL) &&
306 (cmd_info.token_label == NULL)) ||
307 (cmd_info.cert == NULL) ||
308 (cmd_info.elfcnt + argc - optind == 0)) {
315 if (((cmd_info.privpath == NULL) &&
316 (cmd_info.token_label == NULL)) ||
317 (cmd_info.cert == NULL)) {
323 if ((cmd_info.cert != NULL) == (cmd_info.elfcnt > 0)) {
335 switch (cmd_info.cmd) {
347 for (i = 0; i < cmd_info.elfcnt &&
348 (ret == EXIT_OKAY || cmd_info.cmd != ES_SIGN); i++) {
349 iret = action(cmd_info.elfobj[i]);
354 (ret == EXIT_OKAY || cmd_info.cmd != ES_SIGN); i++) {
363 if (cmd_info.elfobj != NULL)
364 free(cmd_info.elfobj);
402 estatus = elfsign_begin(elfpath, cmd_info.es_action, &(cmd_info.ess));
415 if (cmd_info.cmd == ES_SIGN) {
417 } else if (cmd_info.cmd == ES_VERIFY) {
431 if (cmd_info.cert == NULL)
433 estatus = elfsign_setcertpath(cmd_info.ess, cmd_info.cert);
439 if (cmd_info.cert != NULL) {
441 cmd_info.cert);
446 es_error(gettext("unusable certificate: %s"), cmd_info.cert);
447 if (cmd_info.cmd == ES_SIGN) {
449 } else if (cmd_info.cmd == ES_VERIFY) {
467 if (cmd_info.pinpath == NULL)
470 if ((pinfile = fopen(cmd_info.pinpath, "r")) == NULL) {
472 cmd_info.pinpath);
480 cmd_info.pinpath);
511 if (cmd_info.token_label &&
512 !elfcertlib_settoken(cmd_info.ess, cmd_info.token_label)) {
514 cmd_info.token_label);
522 if (!elfcertlib_getcert(cmd_info.ess, cmd_info.cert, NULL, &cert,
523 cmd_info.es_action)) {
525 cmd_info.cert);
530 if (cmd_info.privpath != NULL) {
531 if (!elfcertlib_loadprivatekey(cmd_info.ess, cert,
532 cmd_info.privpath)) {
534 cmd_info.privpath);
545 if (!elfcertlib_loadtokenkey(cmd_info.ess, cert,
546 cmd_info.token_label, pin)) {
548 "in token %s"), cmd_info.token_label);
559 cmd_info.cert);
566 elfstat = elfsign_signatures(cmd_info.ess, &fssp, &fs_len, ES_GET);
579 if (elfsign_signatures(cmd_info.ess, &fssp, &fs_len,
580 cmd_info.es_action) != ELFSIGN_SUCCESS) {
589 if (elfsign_hash(cmd_info.ess, hash, &hash_len) != ELFSIGN_SUCCESS) {
597 if (!elfcertlib_sign(cmd_info.ess, cert,
600 object, cmd_info.privpath ?
601 cmd_info.privpath : cmd_info.token_label);
615 fssp = elfsign_insert_dso(cmd_info.ess, fssp,
623 if (elfsign_signatures(cmd_info.ess, &fssp, &fs_len,
624 cmd_info.es_action) != ELFSIGN_SUCCESS) {
630 if (cmd_info.verbose || (cmd_info.elfcnt + cmd_info.extracnt) > 1) {
635 if (cmd_info.verbose) {
652 elfcertlib_releasecert(cmd_info.ess, cert);
653 if (cmd_info.ess != NULL)
654 elfsign_end(cmd_info.ess);
677 elfsign_end(cmd_info.ess);
681 res = elfsign_verify_signature(cmd_info.ess, &esip);
687 if (cmd_info.verbose)
695 if (cmd_info.verbose)
713 if (cmd_info.ess != NULL)
714 elfsign_end(cmd_info.ess);
762 if (cmd_info.privpath != NULL) {
767 /* args checking verified (cmd_info.token_label != NULL) */
784 KMF_TOKEN_LABEL_ATTR, cmd_info.token_label,
785 strlen(cmd_info.token_label));
819 KMF_KEY_FILENAME_ATTR, cmd_info.privpath,
820 strlen(cmd_info.privpath));
856 cmd_info.cert);
871 * Generate a certificate request into the file named cmd_info.cert
905 switch (cmd_info.internal_req) {
969 if (cmd_info.elfcnt > 0) {
975 if ((retval = getelfobj(cmd_info.elfobj[0])) != EXIT_OKAY)
977 elfstat = elfsign_signatures(cmd_info.ess,
982 switch (cmd_info.field) {
1004 elfsign_end(cmd_info.ess);
1011 if (elfsign_begin(NULL, ES_GET, &(cmd_info.ess)) !=
1015 if (elfcertlib_getcert(cmd_info.ess, cmd_info.cert, NULL,
1016 &cert, cmd_info.es_action)) {
1018 switch (cmd_info.field) {
1028 elfcertlib_releasecert(cmd_info.ess, cert);
1031 elfsign_end(cmd_info.ess);