[test] ECC: make sure negative tests pass for the right reasons
[openssl.git] / apps / progs.pl
index ee6ce924745101e89c97982a82d2dd0b8a4f37fe..0d3b4469a1eabe732954dd224f62f8075ac1e6dd 100644 (file)
@@ -1,25 +1,32 @@
-#!/usr/bin/perl
-
-# Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.
+#! /usr/bin/env perl
+# Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
 #
-# Licensed under the OpenSSL licenses, (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
+# Licensed under the OpenSSL license (the "License").  You may not use
+# this file except in compliance with the License.  You can obtain a copy
+# in the file LICENSE in the source distribution or at
 # https://www.openssl.org/source/license.html
-# or in the file LICENSE in the source distribution.
 
 # Generate progs.h file by looking for command mains in list of C files
 # passed on the command line.
 
 use strict;
 use warnings;
-use configdata qw/@disablables/;
+use lib '.';
+use configdata qw/@disablables %unified_info/;
 
 my %commands = ();
 my $cmdre = qr/^\s*int\s+([a-z_][a-z0-9_]*)_main\(\s*int\s+argc\s*,/;
 
-foreach my $filename (@ARGV) {
-       open F, $filename or die "Coudn't open $_: $!\n";
+my $apps_openssl = shift @ARGV;
+# because the program apps/openssl has object files as sources, and
+# they then have the corresponding C files as source, we need to chain
+# the lookups in %unified_info
+my @openssl_source =
+    map { @{$unified_info{sources}->{$_}} }
+    @{$unified_info{sources}->{$apps_openssl}};
+
+foreach my $filename (@openssl_source) {
+       open F, $filename or die "Couldn't open $filename: $!\n";
        foreach (grep /$cmdre/, <F>) {
                my @foo = /$cmdre/;
                $commands{$1} = 1;
@@ -31,14 +38,15 @@ foreach my $filename (@ARGV) {
 
 print <<'EOF';
 /*
- * Automatically generated by progs.pl for openssl.c
- * Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * WARNING: do not edit!
+ * Generated by apps/progs.pl
  *
- * Licensed under the OpenSSL licenses, (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the OpenSSL license (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
  * https://www.openssl.org/source/license.html
- * or in the file LICENSE in the source distribution.
  */
 
 typedef enum FUNC_TYPE {
@@ -49,7 +57,7 @@ typedef enum FUNC_TYPE {
 typedef struct function_st {
     FUNC_TYPE type;
     const char *name;
-    int (*func)(int argc,char *argv[]);
+    int (*func)(int argc, char *argv[]);
     const OPTIONS *help;
 } FUNCTION;
 
@@ -94,11 +102,6 @@ foreach my $cmd (@ARGV) {
 }
 
 my %md_disabler = (
-    sha1       => "sha",
-    sha224     => "sha",
-    sha256     => "sha",
-    sha384     => "sha",
-    sha512     => "sha",
     blake2b512 => "blake2",
     blake2s256 => "blake2",
     );
@@ -114,7 +117,7 @@ foreach my $cmd (
         } elsif (my $disabler = $md_disabler{$cmd}) {
                 print "#ifndef OPENSSL_NO_".uc($disabler)."\n${str}#endif\n";
         } else {
-                print "#ifndef OPENSSL_NO_".uc($cmd)."\n${str}#endif\n";
+                print $str;
         }
 }