summaryrefslogtreecommitdiffstats
path: root/crypto/objects/objxref.pl
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2006-04-18 23:36:07 +0000
committerDr. Stephen Henson <steve@openssl.org>2006-04-18 23:36:07 +0000
commitd20270980852968fcd8279f9c22d095935eca580 (patch)
tree4f1c614d0c45f04a4ad456c2c1f4ecc6db317ae3 /crypto/objects/objxref.pl
parent51ff0abb05d3e0e71b6666032b777c2c1f3fe5f1 (diff)
Add OID cross reference table.
Fix some typos in GOST OIDs. Update dependencies.
Diffstat (limited to 'crypto/objects/objxref.pl')
-rw-r--r--crypto/objects/objxref.pl91
1 files changed, 91 insertions, 0 deletions
diff --git a/crypto/objects/objxref.pl b/crypto/objects/objxref.pl
new file mode 100644
index 0000000000..0dd360b5b0
--- /dev/null
+++ b/crypto/objects/objxref.pl
@@ -0,0 +1,91 @@
+#!/usr/local/bin/perl
+
+open IN, "obj_mac.num";
+
+# Read in OID nid values for a lookup table.
+
+while (<IN>)
+ {
+ chomp;
+ my ($name, $num) = /^(\S+)\s+(\S+)$/;
+ $oid_tbl{$name} = $num;
+ }
+close IN;
+
+open IN, "obj_xref.txt";
+
+my $ln = 1;
+
+while (<IN>)
+ {
+ chomp;
+ s/#.*$//;
+ next if (/^\S*$/);
+ my ($xr, $p1, $p2) = /^(\S+)\s+(\S+)\s+(\S+)/;
+ check_oid($xr);
+ check_oid($p1);
+ check_oid($p2);
+ $xref_tbl{$xr} = [$p1, $p2, $ln];
+ }
+
+my @xrkeys = keys %xref_tbl;
+
+my @srt1 = sort { $oid_tbl{$a} <=> $oid_tbl{$b}} @xrkeys;
+
+for(my $i = 0; $i <= $#srt1; $i++)
+ {
+ $xref_tbl{$srt1[$i]}[2] = $i;
+ }
+
+my @srt2 = sort
+ {
+ my$ap1 = $oid_tbl{$xref_tbl{$a}[0]};
+ my$bp1 = $oid_tbl{$xref_tbl{$b}[0]};
+ return $ap1 - $bp1 if ($ap1 != $bp1);
+ my$ap2 = $oid_tbl{$xref_tbl{$a}[1]};
+ my$bp2 = $oid_tbl{$xref_tbl{$b}[1]};
+
+ return $ap2 - $bp2;
+ } @xrkeys;
+
+
+print <<EOF;
+
+typedef int nid_triple[3];
+
+static const nid_triple sigoid_srt[] =
+ {
+EOF
+
+foreach (@srt1)
+ {
+ my $xr = $_;
+ my ($p1, $p2) = @{$xref_tbl{$_}};
+ print "\t{NID_$xr, NID_$p1, NID_$p2},\n";
+ }
+
+print "\t};";
+print <<EOF;
+
+
+static const nid_triple * const sigoid_srt_xref[] =
+ {
+EOF
+
+foreach (@srt2)
+ {
+ my $x = $xref_tbl{$_}[2];
+ print "\t\&sigoid_srt\[$x\],\n";
+ }
+
+print "\t};\n\n";
+
+sub check_oid
+ {
+ my ($chk) = @_;
+ if (!exists $oid_tbl{$chk})
+ {
+ die "Not Found \"$chk\"\n";
+ }
+ }
+