2 # Copyright 1998-2020 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 # The year the output file is generated.
18 my $YEAR = [localtime()]->[5] + 1900;
20 open(IN, $mac_file) || die "Can't open $mac_file, $!\n";
22 # Read in OID nid values for a lookup table.
26 s|\R$||; # Better chomp
27 my ($name, $num) = /^(\S+)\s+(\S+)$/;
28 $oid_tbl{$name} = $num;
32 open(IN, $xref_file) || die "Can't open $xref_file, $!\n";
38 s|\R$||; # Better chomp
41 my ($xr, $p1, $p2) = /^(\S+)\s+(\S+)\s+(\S+)/;
45 $xref_tbl{$xr} = [$p1, $p2, $ln];
48 my @xrkeys = keys %xref_tbl;
50 my @srt1 = sort { $oid_tbl{$a} <=> $oid_tbl{$b}} @xrkeys;
53 for($i = 0; $i <= $#srt1; $i++)
55 $xref_tbl{$srt1[$i]}[2] = $i;
60 my$ap1 = $oid_tbl{$xref_tbl{$a}[0]};
61 my$bp1 = $oid_tbl{$xref_tbl{$b}[0]};
62 return $ap1 - $bp1 if ($ap1 != $bp1);
63 my$ap2 = $oid_tbl{$xref_tbl{$a}[1]};
64 my$bp2 = $oid_tbl{$xref_tbl{$b}[1]};
74 * WARNING: do not edit!
77 * Copyright 1998-$YEAR The OpenSSL Project Authors. All Rights Reserved.
79 * Licensed under the Apache License 2.0 (the "License"). You may not use
80 * this file except in compliance with the License. You can obtain a copy
81 * in the file LICENSE in the source distribution or at
82 * https://www.openssl.org/source/license.html
92 DEFINE_STACK_OF(nid_triple)
94 static const nid_triple sigoid_srt[] = {
100 my ($p1, $p2) = @{$xref_tbl{$_}};
101 my $o1 = " {NID_$xr, NID_$p1,";
102 my $o2 = "NID_$p2},";
103 if (length("$o1 $o2") < 78)
117 static const nid_triple *const sigoid_srt_xref[] = {
122 my ($p1, $p2, $x) = @{$xref_tbl{$_}};
123 # If digest or signature algorithm is "undef" then the algorithm
124 # needs special handling and is excluded from the cross reference table.
125 next if $p1 eq "undef" || $p2 eq "undef";
126 print " \&sigoid_srt\[$x\],\n";
134 if (!exists $oid_tbl{$chk})
136 die "Can't find \"$chk\"\n";