File openssl-OpenSSL_add_all_digests.diff of Package openssl

diff -rNU 30 ../openssl-1.0.1u-o/apps/dgst.c ./apps/dgst.c
--- ../openssl-1.0.1u-o/apps/dgst.c	2016-09-22 12:29:27.000000000 +0200
+++ ./apps/dgst.c	2018-10-25 15:48:33.752553912 +0200
@@ -116,60 +116,62 @@
     int debug = 0;
     int keyform = FORMAT_PEM;
     const char *outfile = NULL, *keyfile = NULL;
     const char *sigfile = NULL, *randfile = NULL;
     int out_bin = -1, want_pub = 0, do_verify = 0;
     EVP_PKEY *sigkey = NULL;
     unsigned char *sigbuf = NULL;
     int siglen = 0;
     char *passargin = NULL, *passin = NULL;
 #ifndef OPENSSL_NO_ENGINE
     char *engine = NULL;
 #endif
     char *hmac_key = NULL;
     char *mac_name = NULL;
     int non_fips_allow = 0;
     STACK_OF(OPENSSL_STRING) *sigopts = NULL, *macopts = NULL;
 
     apps_startup();
 
     if ((buf = (unsigned char *)OPENSSL_malloc(BUFSIZE)) == NULL) {
         BIO_printf(bio_err, "out of memory\n");
         goto end;
     }
     if (bio_err == NULL)
         if ((bio_err = BIO_new(BIO_s_file())) != NULL)
             BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
 
     if (!load_config(bio_err, NULL))
         goto end;
 
+    OpenSSL_add_all_digests();
+
     /* first check the program name */
     program_name(argv[0], pname, sizeof pname);
 
     md = EVP_get_digestbyname(pname);
 
     argc--;
     argv++;
     while (argc > 0) {
         if ((*argv)[0] != '-')
             break;
         if (strcmp(*argv, "-c") == 0)
             separator = 1;
         else if (strcmp(*argv, "-r") == 0)
             separator = 2;
         else if (strcmp(*argv, "-rand") == 0) {
             if (--argc < 1)
                 break;
             randfile = *(++argv);
         } else if (strcmp(*argv, "-out") == 0) {
             if (--argc < 1)
                 break;
             outfile = *(++argv);
         } else if (strcmp(*argv, "-sign") == 0) {
             if (--argc < 1)
                 break;
             keyfile = *(++argv);
         } else if (!strcmp(*argv, "-passin")) {
             if (--argc < 1)
                 break;
             passargin = *++argv;
diff -rNU 30 ../openssl-1.0.1u-o/apps/req.c ./apps/req.c
--- ../openssl-1.0.1u-o/apps/req.c	2016-09-22 12:29:27.000000000 +0200
+++ ./apps/req.c	2018-10-25 15:49:23.629000333 +0200
@@ -188,60 +188,62 @@
     ASN1_INTEGER *serial = NULL;
     int modulus = 0;
     char *inrand = NULL;
     char *passargin = NULL, *passargout = NULL;
     char *passin = NULL, *passout = NULL;
     char *p;
     char *subj = NULL;
     int multirdn = 0;
     const EVP_MD *md_alg = NULL, *digest = NULL;
     unsigned long chtype = MBSTRING_ASC;
 #ifndef MONOLITH
     char *to_free;
     long errline;
 #endif
 
     req_conf = NULL;
 #ifndef OPENSSL_NO_DES
     cipher = EVP_des_ede3_cbc();
 #endif
     apps_startup();
 
     if (bio_err == NULL)
         if ((bio_err = BIO_new(BIO_s_file())) != NULL)
             BIO_set_fp(bio_err, stderr, BIO_NOCLOSE | BIO_FP_TEXT);
 
     infile = NULL;
     outfile = NULL;
     informat = FORMAT_PEM;
     outformat = FORMAT_PEM;
 
+    OpenSSL_add_all_digests();
+
     prog = argv[0];
     argc--;
     argv++;
     while (argc >= 1) {
         if (strcmp(*argv, "-inform") == 0) {
             if (--argc < 1)
                 goto bad;
             informat = str2fmt(*(++argv));
         } else if (strcmp(*argv, "-outform") == 0) {
             if (--argc < 1)
                 goto bad;
             outformat = str2fmt(*(++argv));
         }
 #ifndef OPENSSL_NO_ENGINE
         else if (strcmp(*argv, "-engine") == 0) {
             if (--argc < 1)
                 goto bad;
             engine = *(++argv);
         } else if (strcmp(*argv, "-keygen_engine") == 0) {
             if (--argc < 1)
                 goto bad;
             gen_eng = ENGINE_by_id(*(++argv));
             if (gen_eng == NULL) {
                 BIO_printf(bio_err, "Can't find keygen engine %s\n", *argv);
                 goto end;
             }
         }
 #endif
         else if (strcmp(*argv, "-key") == 0) {
             if (--argc < 1)
diff -rNU 30 ../openssl-1.0.1u-o/apps/x509.c ./apps/x509.c
--- ../openssl-1.0.1u-o/apps/x509.c	2016-09-22 12:29:27.000000000 +0200
+++ ./apps/x509.c	2018-10-25 15:50:11.189426021 +0200
@@ -202,60 +202,62 @@
     X509_REQ *rq = NULL;
     int fingerprint = 0;
     char buf[256];
     const EVP_MD *md_alg, *digest = NULL;
     CONF *extconf = NULL;
     char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL;
     int need_rand = 0;
     int checkend = 0, checkoffset = 0;
     unsigned long nmflag = 0, certflag = 0;
 #ifndef OPENSSL_NO_ENGINE
     char *engine = NULL;
 #endif
 
     reqfile = 0;
 
     apps_startup();
 
     if (bio_err == NULL)
         bio_err = BIO_new_fp(stderr, BIO_NOCLOSE);
 
     if (!load_config(bio_err, NULL))
         goto end;
     STDout = BIO_new_fp(stdout, BIO_NOCLOSE);
 #ifdef OPENSSL_SYS_VMS
     {
         BIO *tmpbio = BIO_new(BIO_f_linebuffer());
         STDout = BIO_push(tmpbio, STDout);
     }
 #endif
 
+    OpenSSL_add_all_digests();
+
     informat = FORMAT_PEM;
     outformat = FORMAT_PEM;
     keyformat = FORMAT_PEM;
     CAformat = FORMAT_PEM;
     CAkeyformat = FORMAT_PEM;
 
     ctx = X509_STORE_new();
     if (ctx == NULL)
         goto end;
     X509_STORE_set_verify_cb(ctx, callb);
 
     argc--;
     argv++;
     num = 0;
     while (argc >= 1) {
         if (strcmp(*argv, "-inform") == 0) {
             if (--argc < 1)
                 goto bad;
             informat = str2fmt(*(++argv));
         } else if (strcmp(*argv, "-outform") == 0) {
             if (--argc < 1)
                 goto bad;
             outformat = str2fmt(*(++argv));
         } else if (strcmp(*argv, "-keyform") == 0) {
             if (--argc < 1)
                 goto bad;
             keyformat = str2fmt(*(++argv));
         } else if (strcmp(*argv, "-req") == 0) {
             reqfile = 1;
             need_rand = 1;
diff -rNU 30 ../openssl-1.0.1u-o/crypto/evp/c_alld.c ./crypto/evp/c_alld.c
--- ../openssl-1.0.1u-o/crypto/evp/c_alld.c	2016-09-22 12:23:06.000000000 +0200
+++ ./crypto/evp/c_alld.c	2018-10-25 15:51:02.977889551 +0200
@@ -37,60 +37,63 @@
  * 4. If you include any Windows specific code (or a derivative thereof) from
  *    the apps directory (application code) you must include an acknowledgement:
  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
  *
  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
  * The licence and distribution terms for any publically available version or
  * derivative of this code cannot be changed.  i.e. this code cannot simply be
  * copied and put under another distribution licence
  * [including the GNU Public Licence.]
  */
 
 #include <stdio.h>
 #include "cryptlib.h"
 #include <openssl/evp.h>
 #include <openssl/pkcs12.h>
 #include <openssl/objects.h>
 
 void OpenSSL_add_all_digests(void)
 {
+#ifndef OPENSSL_NO_MD2
+       EVP_add_digest(EVP_md2());
+#endif
 #ifndef OPENSSL_NO_MD4
     EVP_add_digest(EVP_md4());
 #endif
 #ifndef OPENSSL_NO_MD5
     EVP_add_digest(EVP_md5());
     EVP_add_digest_alias(SN_md5, "ssl2-md5");
     EVP_add_digest_alias(SN_md5, "ssl3-md5");
 #endif
 #if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA0)
     EVP_add_digest(EVP_sha());
 # ifndef OPENSSL_NO_DSA
     EVP_add_digest(EVP_dss());
 # endif
 #endif
 #if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1)
     EVP_add_digest(EVP_sha1());
     EVP_add_digest_alias(SN_sha1, "ssl3-sha1");
     EVP_add_digest_alias(SN_sha1WithRSAEncryption, SN_sha1WithRSA);
 # ifndef OPENSSL_NO_DSA
     EVP_add_digest(EVP_dss1());
     EVP_add_digest_alias(SN_dsaWithSHA1, SN_dsaWithSHA1_2);
     EVP_add_digest_alias(SN_dsaWithSHA1, "DSS1");
     EVP_add_digest_alias(SN_dsaWithSHA1, "dss1");
 # endif
 # ifndef OPENSSL_NO_ECDSA
     EVP_add_digest(EVP_ecdsa());
 # endif
 #endif
 #if !defined(OPENSSL_NO_MDC2) && !defined(OPENSSL_NO_DES)
     EVP_add_digest(EVP_mdc2());