implement fast point multiplication with precomputation
[openssl.git] / apps / dgst.c
index 32e40c1f5368406796b6578bb38b1f4087b3d1e0..47d1309b14c1f601d90806985db26c6a4e00078f 100644 (file)
@@ -100,7 +100,9 @@ int MAIN(int argc, char **argv)
        EVP_PKEY *sigkey = NULL;
        unsigned char *sigbuf = NULL;
        int siglen = 0;
        EVP_PKEY *sigkey = NULL;
        unsigned char *sigbuf = NULL;
        int siglen = 0;
+#ifndef OPENSSL_NO_ENGINE
        char *engine=NULL;
        char *engine=NULL;
+#endif
 
        apps_startup();
 
 
        apps_startup();
 
@@ -117,7 +119,7 @@ int MAIN(int argc, char **argv)
                goto end;
 
        /* first check the program name */
                goto end;
 
        /* first check the program name */
-       program_name(argv[0],pname,PROG_NAME_SIZE);
+       program_name(argv[0],pname,sizeof pname);
 
        md=EVP_get_digestbyname(pname);
 
 
        md=EVP_get_digestbyname(pname);
 
@@ -166,11 +168,13 @@ int MAIN(int argc, char **argv)
                        if (--argc < 1) break;
                        keyform=str2fmt(*(++argv));
                        }
                        if (--argc < 1) break;
                        keyform=str2fmt(*(++argv));
                        }
+#ifndef OPENSSL_NO_ENGINE
                else if (strcmp(*argv,"-engine") == 0)
                        {
                        if (--argc < 1) break;
                        engine= *(++argv);
                        }
                else if (strcmp(*argv,"-engine") == 0)
                        {
                        if (--argc < 1) break;
                        engine= *(++argv);
                        }
+#endif
                else if (strcmp(*argv,"-hex") == 0)
                        out_bin = 0;
                else if (strcmp(*argv,"-binary") == 0)
                else if (strcmp(*argv,"-hex") == 0)
                        out_bin = 0;
                else if (strcmp(*argv,"-binary") == 0)
@@ -208,7 +212,9 @@ int MAIN(int argc, char **argv)
                BIO_printf(bio_err,"-keyform arg    key file format (PEM or ENGINE)\n");
                BIO_printf(bio_err,"-signature file signature to verify\n");
                BIO_printf(bio_err,"-binary         output in binary form\n");
                BIO_printf(bio_err,"-keyform arg    key file format (PEM or ENGINE)\n");
                BIO_printf(bio_err,"-signature file signature to verify\n");
                BIO_printf(bio_err,"-binary         output in binary form\n");
+#ifndef OPENSSL_NO_ENGINE
                BIO_printf(bio_err,"-engine e       use engine e, possibly a hardware device.\n");
                BIO_printf(bio_err,"-engine e       use engine e, possibly a hardware device.\n");
+#endif
 
                BIO_printf(bio_err,"-%3s to use the %s message digest algorithm (default)\n",
                        LN_md5,LN_md5);
 
                BIO_printf(bio_err,"-%3s to use the %s message digest algorithm (default)\n",
                        LN_md5,LN_md5);
@@ -228,7 +234,9 @@ int MAIN(int argc, char **argv)
                goto end;
                }
 
                goto end;
                }
 
+#ifndef OPENSSL_NO_ENGINE
         e = setup_engine(bio_err, engine, 0);
         e = setup_engine(bio_err, engine, 0);
+#endif
 
        in=BIO_new(BIO_s_file());
        bmd=BIO_new(BIO_f_md());
 
        in=BIO_new(BIO_s_file());
        bmd=BIO_new(BIO_f_md());
@@ -356,7 +364,7 @@ int MAIN(int argc, char **argv)
 end:
        if (buf != NULL)
                {
 end:
        if (buf != NULL)
                {
-               memset(buf,0,BUFSIZE);
+               OPENSSL_cleanse(buf,BUFSIZE);
                OPENSSL_free(buf);
                }
        if (in != NULL) BIO_free(in);
                OPENSSL_free(buf);
                }
        if (in != NULL) BIO_free(in);
@@ -365,7 +373,7 @@ end:
        if(sigbuf) OPENSSL_free(sigbuf);
        if (bmd != NULL) BIO_free(bmd);
        apps_shutdown();
        if(sigbuf) OPENSSL_free(sigbuf);
        if (bmd != NULL) BIO_free(bmd);
        apps_shutdown();
-       EXIT(err);
+       OPENSSL_EXIT(err);
        }
 
 int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,
        }
 
 int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout,