2 # Copyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
4 # Licensed under the Apache License 2.0 (the "License"). You may not use
5 # this file except in compliance with the License. You can obtain a copy
6 # in the file LICENSE in the source distribution or at
7 # https://www.openssl.org/source/license.html
11 use lib "$FindBin::Bin/../../util/perl";
12 use OpenSSL::copyright;
17 # The year the output file is generated.
18 my $YEAR = OpenSSL::copyright::latest(($0, $ARGV[1], $ARGV[0]));
20 open (NUMIN,"$ARGV[1]") || die "Can't open number file $ARGV[1]";
30 ($Cname,$mynum) = split;
32 if (defined($nidn{$mynum}))
33 { die "$ARGV[1]:$o:There's already an object with NID ",$mynum," on line ",$order{$mynum},"\n"; }
34 if (defined($nid{$Cname}))
35 { die "$ARGV[1]:$o:There's already an object with name ",$Cname," on line ",$order{$nid{$Cname}},"\n"; }
36 $nid{$Cname} = $mynum;
37 $nidn{$mynum} = $Cname;
39 $max_nid = $mynum if $mynum > $max_nid;
43 open (IN,"$ARGV[0]") || die "Can't open input file $ARGV[0]";
50 if (/^!module\s+(.*)$/)
58 if (/^!Cname\s+(.*)$/)
60 if (/^!Alias\s+(.+?)\s+(.*)$/)
64 $myoid = &process_oid($myoid);
68 $obj{$Cname} = $myoid;
75 ($myoid,$mysn,$myln) = split ':';
84 $myoid = &process_oid($myoid);
87 if ($Cname eq "" && ($myln =~ /^[_A-Za-z][\w.-]*$/ ))
92 if ($Cname ne "" && defined($ln{$module.$Cname}))
93 { die "objects.txt:$o:There's already an object with long name ",$ln{$module.$Cname}," on line ",$order{$module.$Cname},"\n"; }
99 if ($Cname ne "" && defined($sn{$module.$Cname}))
100 { die "objects.txt:$o:There's already an object with short name ",$sn{$module.$Cname}," on line ",$order{$module.$Cname},"\n"; }
108 if ($Cname ne "" && defined($ln{$module.$Cname}))
109 { die "objects.txt:$o:There's already an object with long name ",$ln{$module.$Cname}," on line ",$order{$module.$Cname},"\n"; }
113 $Cname = $module.$Cname;
114 $ordern{$o} = $Cname;
118 $obj{$Cname} = $myoid;
119 if (!defined($nid{$Cname}))
122 $nid{$Cname} = $max_nid;
123 $nidn{$max_nid} = $Cname;
124 print STDERR "Added OID $Cname\n";
131 foreach (sort { $a <=> $b } keys %nidn)
133 print $nidn{$_},"\t\t",$_,"\n";
140 * WARNING: do not edit!
141 * Generated by crypto/objects/objects.pl
143 * Copyright 2000-$YEAR The OpenSSL Project Authors. All Rights Reserved.
144 * Licensed under the Apache License 2.0 (the "License"). You may not use
145 * this file except in compliance with the License. You can obtain a copy
146 * in the file LICENSE in the source distribution or at
147 * https://www.openssl.org/source/license.html
150 #ifndef OPENSSL_OBJ_MAC_H
151 # define OPENSSL_OBJ_MAC_H
154 #define SN_undef "UNDEF"
155 #define LN_undef "undefined"
164 1 while $string =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e;
169 foreach (sort { $a <=> $b } keys %ordern)
173 print expand("#define SN_$Cname\t\t\"$sn{$Cname}\"\n") if $sn{$Cname} ne "";
174 print expand("#define LN_$Cname\t\t\"$ln{$Cname}\"\n") if $ln{$Cname} ne "";
175 print expand("#define NID_$Cname\t\t$nid{$Cname}\n") if $nid{$Cname} ne "";
176 print expand("#define OBJ_$Cname\t\t$obj{$Cname}\n") if $obj{$Cname} ne "";
181 #endif /* OPENSSL_OBJ_MAC_H */
189 @a = split(/\s+/,$myoid);
192 if (!($a[0] =~ /^[0-9]+$/))
195 if (!defined($obj{$a[0]}))
196 { die "$ARGV[0]:$o:Undefined identifier ",$a[0],"\n"; }
197 $pref_oid = "OBJ_" . $a[0];
201 $oids = join('L,',@a) . "L";
204 $oids = $pref_oid . $pref_sep . $oids;