125 #ifndef OPENSSL_NO_ENGINE
133 #include <openssl/fips.h>
143 static void list_pkey(
BIO *out);
144 static void list_cipher(
BIO *out);
145 static void list_md(
BIO *out);
146 char *default_config_file=NULL;
155 static void lock_dbg_cb(
int mode,
int type,
const char *
file,
int line)
158 const char *errstr = NULL;
164 errstr =
"invalid mode";
170 errstr =
"type out of bounds";
178 errstr =
"already locked";
190 errstr =
"not locked";
194 if (modes[type] != rw)
197 "CRYPTO_r_unlock on write lock" :
198 "CRYPTO_w_unlock on read lock";
205 errstr =
"invalid mode";
213 fprintf(stderr,
"openssl (lock_dbg_cb): %s (mode=%d, type=%d) at %s:%d\n",
214 errstr, mode, type, file, line);
218 #if defined( OPENSSL_SYS_VMS) && (__INITIAL_POINTER_SIZE == 64)
227 #define PROG_NAME_SIZE 39
239 #if defined( OPENSSL_SYS_VMS) && (__INITIAL_POINTER_SIZE == 64)
263 if ((
sizeof( _Argv) < 8)
264 #
if !defined( VMS_TRUST_ARGV)
265 || (_Argv[ Argc] != NULL)
272 { ret = -1;
goto end; }
273 for(i = 0; i < Argc; i++)
283 Argv = (
char **)_Argv;
294 if (getenv(
"OPENSSL_DEBUG_MEMORY") != NULL)
296 if (!(0 == strcmp(getenv(
"OPENSSL_DEBUG_MEMORY"),
"off")))
310 if (getenv(
"OPENSSL_DEBUG_LOCKING") != NULL)
316 if(getenv(
"OPENSSL_FIPS")) {
324 fprintf(stderr,
"FIPS mode not supported.\n");
332 p=getenv(
"OPENSSL_CONF");
334 p=getenv(
"SSLEAY_CONF");
338 default_config_file=
p;
348 "WARNING: can't open config file: %s\n",p);
371 ret=fp->
func(Argc,Argv);
381 ret=do_cmd(prog,Argc,Argv);
399 else prompt=
"OpenSSL> ";
400 fputs(prompt,stdout);
402 if (!fgets(p,n,stdin))
404 if (p[0] ==
'\0')
goto end;
407 if (p[i-2] !=
'\\')
break;
414 ret=do_cmd(prog,argc,argv);
445 #if defined( OPENSSL_SYS_VMS) && (__INITIAL_POINTER_SIZE == 64)
455 #define LIST_STANDARD_COMMANDS "list-standard-commands"
456 #define LIST_MESSAGE_DIGEST_COMMANDS "list-message-digest-commands"
457 #define LIST_MESSAGE_DIGEST_ALGORITHMS "list-message-digest-algorithms"
458 #define LIST_CIPHER_COMMANDS "list-cipher-commands"
459 #define LIST_CIPHER_ALGORITHMS "list-cipher-algorithms"
460 #define LIST_PUBLIC_KEY_ALGORITHMS "list-public-key-algorithms"
468 if ((argc <= 0) || (argv[0] == NULL))
489 ret=fp->
func(argc,argv);
491 else if ((strncmp(argv[0],
"no-",3)) == 0)
494 #ifdef OPENSSL_SYS_VMS
497 bio_stdout =
BIO_push(tmpbio, bio_stdout);
509 else if ((strcmp(argv[0],
"quit") == 0) ||
510 (strcmp(argv[0],
"q") == 0) ||
511 (strcmp(argv[0],
"exit") == 0) ||
512 (strcmp(argv[0],
"bye") == 0))
540 #ifdef OPENSSL_SYS_VMS
543 bio_stdout =
BIO_push(tmpbio, bio_stdout);
551 list_pkey(bio_stdout);
555 list_cipher(bio_stdout);
559 if (fp->
type == list_type)
569 BIO_printf(bio_err,
"openssl:Error: '%s' is an invalid command.\n",
577 #ifdef OPENSSL_NO_CAMELLIA
578 if (((i++) % 5) == 0)
580 if (((i++) % 4) == 0)
594 "\nMessage Digest commands (see the `dgst' command for more details)\n");
599 BIO_printf(bio_err,
"\nCipher commands (see the `enc' command for more details)\n");
602 #ifdef OPENSSL_NO_CAMELLIA
615 static int SortFnByName(
const void *_f1,
const void *_f2)
625 static void list_pkey(
BIO *out)
631 int pkey_id, pkey_base_id, pkey_flags;
632 const char *pinfo, *pem_str;
635 &pinfo, &pem_str, ameth);
648 "External" :
"Builtin");
652 BIO_printf(out,
"\tPEM string: %s\n", pem_str);
658 static void list_cipher_fn(
const EVP_CIPHER *c,
659 const char *from,
const char *to,
void *
arg)
666 from =
"<undefined>";
673 static void list_cipher(
BIO *out)
678 static void list_md_fn(
const EVP_MD *m,
679 const char *from,
const char *to,
void *arg)
686 from =
"<undefined>";
693 static void list_md(
BIO *out)