2 # Copyright 1998-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 my ($mac_file, $xref_file) = @ARGV;
19 # The year the output file is generated.
20 my $YEAR = OpenSSL::copyright::latest(($0, $mac_file, $xref_file));
22 open(IN, $mac_file) || die "Can't open $mac_file, $!\n";
24 # Read in OID nid values for a lookup table.
28 s|\R$||; # Better chomp
29 my ($name, $num) = /^(\S+)\s+(\S+)$/;
30 $oid_tbl{$name} = $num;
34 open(IN, $xref_file) || die "Can't open $xref_file, $!\n";
40 s|\R$||; # Better chomp
43 my ($xr, $p1, $p2) = /^(\S+)\s+(\S+)\s+(\S+)/;
47 $xref_tbl{$xr} = [$p1, $p2, $ln];
50 my @xrkeys = keys %xref_tbl;
52 my @srt1 = sort { $oid_tbl{$a} <=> $oid_tbl{$b}} @xrkeys;
55 for($i = 0; $i <= $#srt1; $i++)
57 $xref_tbl{$srt1[$i]}[2] = $i;
62 my$ap1 = $oid_tbl{$xref_tbl{$a}[0]};
63 my$bp1 = $oid_tbl{$xref_tbl{$b}[0]};
64 return $ap1 - $bp1 if ($ap1 != $bp1);
65 my$ap2 = $oid_tbl{$xref_tbl{$a}[1]};
66 my$bp2 = $oid_tbl{$xref_tbl{$b}[1]};
76 * WARNING: do not edit!
79 * Copyright 1998-$YEAR The OpenSSL Project Authors. All Rights Reserved.
81 * Licensed under the Apache License 2.0 (the "License"). You may not use
82 * this file except in compliance with the License. You can obtain a copy
83 * in the file LICENSE in the source distribution or at
84 * https://www.openssl.org/source/license.html
94 DEFINE_STACK_OF(nid_triple)
96 static const nid_triple sigoid_srt[] = {
102 my ($p1, $p2) = @{$xref_tbl{$_}};
103 my $o1 = " {NID_$xr, NID_$p1,";
104 my $o2 = "NID_$p2},";
105 if (length("$o1 $o2") < 78)
119 static const nid_triple *const sigoid_srt_xref[] = {
124 my ($p1, $p2, $x) = @{$xref_tbl{$_}};
125 # If digest or signature algorithm is "undef" then the algorithm
126 # needs special handling and is excluded from the cross reference table.
127 next if $p1 eq "undef" || $p2 eq "undef";
128 print " \&sigoid_srt\[$x\],\n";
136 if (!exists $oid_tbl{$chk})
138 die "Can't find \"$chk\"\n";