Submitted by:
Reviewed by:
PR:
diff --git a/CHANGES b/CHANGES
index 66e2673..163281c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -5,6 +5,14 @@
 
  Changes between 0.9.2b and 0.9.3
 
+  *) Bugfix: In test/testenc, don't test "openssl <cipher>" for
+     ciphers that were excluded, e.g. by -DNO_IDEA.  Also, test
+     all available cipers including rc5, which was forgotten until now.
+     In order to let the testing shell script know which algorithms
+     are available, a new (up to now undocumented) command
+     "openssl list-cipher-commands" is used.
+     [Bodo Moeller]
+
   *) Bugfix: s_client occasionally would sleep in select() when
      it should have checked SSL_pending() first.
      [Bodo Moeller]
diff --git a/apps/openssl.c b/apps/openssl.c
index dfa23d6..dd22aa7 100644
--- a/apps/openssl.c
+++ b/apps/openssl.c
@@ -254,6 +254,10 @@
 	EXIT(ret);
 	}
 
+#define LIST_STANDARD_COMMANDS "list-standard-commands"
+#define LIST_MESSAGE_DIGEST_COMMANDS "list-message-digest-commands"
+#define LIST_CIPHER_COMMANDS "list-cipher-commands"
+
 static int do_cmd(prog,argc,argv)
 LHASH *prog;
 int argc;
@@ -278,6 +282,28 @@
 		ret= -1;
 		goto end;
 		}
+	else if ((strcmp(argv[0],LIST_STANDARD_COMMANDS) == 0) ||
+		(strcmp(argv[0],LIST_MESSAGE_DIGEST_COMMANDS) == 0) ||
+		(strcmp(argv[0],LIST_CIPHER_COMMANDS) == 0))
+		{
+		int list_type;
+		BIO *bio_stdout;
+
+		if (strcmp(argv[0],LIST_STANDARD_COMMANDS) == 0)
+			list_type = FUNC_TYPE_GENERAL;
+		else if (strcmp(argv[0],LIST_MESSAGE_DIGEST_COMMANDS) == 0)
+			list_type = FUNC_TYPE_MD;
+		else /* strcmp(argv[0],LIST_CIPHER_COMMANDS) == 0 */
+			list_type = FUNC_TYPE_CIPHER;
+		bio_stdout = BIO_new_fp(stdout,BIO_NOCLOSE);
+		
+		for (fp=functions; fp->name != NULL; fp++)
+			if (fp->type == list_type)
+				BIO_printf(bio_stdout, "%s\n", fp->name);
+		BIO_free(bio_stdout);
+		ret=0;
+		goto end;
+		}
 	else
 		{
 		BIO_printf(bio_err,"openssl:Error: '%s' is an invalid command.\n",
diff --git a/test/testenc b/test/testenc
index f69ca37..0656c7f 100644
--- a/test/testenc
+++ b/test/testenc
@@ -27,15 +27,7 @@
 	/bin/rm $test.cipher $test.clear
 fi
 
-for i in rc4 \
-	des-cfb des-ede-cfb des-ede3-cfb \
-	des-ofb des-ede-ofb des-ede3-ofb \
-	des-ecb des-ede des-ede3 desx \
-	des-cbc des-ede-cbc des-ede3-cbc \
-	idea-ecb idea-cfb idea-ofb idea-cbc \
-	rc2-ecb rc2-cfb rc2-ofb rc2-cbc \
-	bf-ecb bf-cfb bf-ofb bf-cbc rc4 \
-	cast5-ecb cast5-cfb cast5-ofb cast5-cbc
+for i in `$cmd list-cipher-commands`
 do
 	echo $i
 	$cmd $i -bufsize 113 -e -k test < $test > $test.$i.cipher