2 # Copyright 1998-2018 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
15 my ($mac_file, $xref_file) = @ARGV;
17 # Output year depends on the year of the script and the input file.
18 my $YEAR = [localtime([stat($0)]->[9])]->[5] + 1900;
19 my $iYEAR = [localtime([stat($mac_file)]->[9])]->[5] + 1900;
20 $YEAR = $iYEAR if $iYEAR > $YEAR;
21 $iYEAR = [localtime([stat($xref_file)]->[9])]->[5] + 1900;
22 $YEAR = $iYEAR if $iYEAR > $YEAR;
24 open(IN, $mac_file) || die "Can't open $mac_file, $!\n";
26 # Read in OID nid values for a lookup table.
30 s|\R$||; # Better chomp
31 my ($name, $num) = /^(\S+)\s+(\S+)$/;
32 $oid_tbl{$name} = $num;
36 open(IN, $xref_file) || die "Can't open $xref_file, $!\n";
42 s|\R$||; # Better chomp
45 my ($xr, $p1, $p2) = /^(\S+)\s+(\S+)\s+(\S+)/;
49 $xref_tbl{$xr} = [$p1, $p2, $ln];
52 my @xrkeys = keys %xref_tbl;
54 my @srt1 = sort { $oid_tbl{$a} <=> $oid_tbl{$b}} @xrkeys;
57 for($i = 0; $i <= $#srt1; $i++)
59 $xref_tbl{$srt1[$i]}[2] = $i;
64 my$ap1 = $oid_tbl{$xref_tbl{$a}[0]};
65 my$bp1 = $oid_tbl{$xref_tbl{$b}[0]};
66 return $ap1 - $bp1 if ($ap1 != $bp1);
67 my$ap2 = $oid_tbl{$xref_tbl{$a}[1]};
68 my$bp2 = $oid_tbl{$xref_tbl{$b}[1]};
78 * WARNING: do not edit!
81 * Copyright 1998-$YEAR The OpenSSL Project Authors. All Rights Reserved.
83 * Licensed under the Apache License 2.0 (the "License"). You may not use
84 * this file except in compliance with the License. You can obtain a copy
85 * in the file LICENSE in the source distribution or at
86 * https://www.openssl.org/source/license.html
96 DEFINE_STACK_OF(nid_triple)
98 static const nid_triple sigoid_srt[] = {
104 my ($p1, $p2) = @{$xref_tbl{$_}};
105 my $o1 = " {NID_$xr, NID_$p1,";
106 my $o2 = "NID_$p2},";
107 if (length("$o1 $o2") < 78)
121 static const nid_triple *const sigoid_srt_xref[] = {
126 my ($p1, $p2, $x) = @{$xref_tbl{$_}};
127 # If digest or signature algorithm is "undef" then the algorithm
128 # needs special handling and is excluded from the cross reference table.
129 next if $p1 eq "undef" || $p2 eq "undef";
130 print " \&sigoid_srt\[$x\],\n";
138 if (!exists $oid_tbl{$chk})
140 die "Can't find \"$chk\"\n";