Additional sanity check.
[openssl.git] / crypto / objects / objects.pl
index 41fa4147e31a7a41f313f4bbde691e2877994132..9bb26e2909f28464b45b3df759a092bd71df38fe 100644 (file)
@@ -14,6 +14,8 @@ while(<NUMIN>)
        $Cname =~ s/^X//;
        if (defined($nidn{$mynum}))
                { die "$ARGV[1]:$o:There's already an object with NID ",$mynum," on line ",$order{$mynum},"\n"; }
+       if (defined($nid{$Cname}))
+               { die "$ARGV[1]:$o:There's already an object with name ",$mynum," on line ",$order{$nid{$Cname}},"\n"; }
        $nid{$Cname} = $mynum;
        $nidn{$mynum} = $Cname;
        $order{$mynum} = $o;
@@ -116,7 +118,13 @@ close NUMOUT;
 
 open (OUT,">$ARGV[2]") || die "Can't open output file $ARGV[2]";
 print OUT <<'EOF';
-/* lib/obj/obj_mac.h */
+/* crypto/objects/obj_mac.h */
+
+/* THIS FILE IS GENERATED FROM objects.txt by objects.pl via the
+ * following command:
+ * perl objects.pl objects.txt obj_mac.num obj_mac.h
+ */
+
 /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
@@ -174,11 +182,6 @@ print OUT <<'EOF';
  * [including the GNU Public Licence.]
  */
 
-/* THIS FILE IS GENERATED FROM objects.txt by objects.pl via the
- * following command:
- * perl objects.pl objects.txt obj_mac.num obj_mac.h
- */
-
 #define SN_undef                       "UNDEF"
 #define LN_undef                       "undefined"
 #define NID_undef                      0
@@ -209,6 +212,8 @@ sub process_oid
        if (!($a[0] =~ /^[0-9]+$/))
                {
                $a[0] =~ s/-/_/g;
+               if (!defined($obj{$a[0]}))
+                       { die "$ARGV[0]:$o:Undefined identifier ",$a[0],"\n"; }
                $pref_oid = "OBJ_" . $a[0];
                $pref_sep = ",";
                shift @a;