diff options
Diffstat (limited to 'crypto/objects/objxref.pl')
-rwxr-xr-x | crypto/objects/objxref.pl | 44 |
1 files changed, 35 insertions, 9 deletions
diff --git a/crypto/objects/objxref.pl b/crypto/objects/objxref.pl index 1913b9d133c2..0ec63f067e3c 100755 --- a/crypto/objects/objxref.pl +++ b/crypto/objects/objxref.pl @@ -1,4 +1,11 @@ -#!/usr/local/bin/perl +#! /usr/bin/env perl +# Copyright 1998-2018 The OpenSSL Project Authors. All Rights Reserved. +# +# Licensed under the OpenSSL license (the "License"). You may not use +# this file except in compliance with the License. You can obtain a copy +# in the file LICENSE in the source distribution or at +# https://www.openssl.org/source/license.html + use strict; @@ -7,25 +14,32 @@ my %oid_tbl; my ($mac_file, $xref_file) = @ARGV; -open(IN, $mac_file) || die "Can't open $mac_file"; +# Output year depends on the year of the script and the input file. +my $YEAR = [localtime([stat($0)]->[9])]->[5] + 1900; +my $iYEAR = [localtime([stat($mac_file)]->[9])]->[5] + 1900; +$YEAR = $iYEAR if $iYEAR > $YEAR; +$iYEAR = [localtime([stat($xref_file)]->[9])]->[5] + 1900; +$YEAR = $iYEAR if $iYEAR > $YEAR; + +open(IN, $mac_file) || die "Can't open $mac_file, $!\n"; # Read in OID nid values for a lookup table. while (<IN>) { - chomp; + s|\R$||; # Better chomp my ($name, $num) = /^(\S+)\s+(\S+)$/; $oid_tbl{$name} = $num; } close IN; -open(IN, $xref_file) || die "Can't open $xref_file"; +open(IN, $xref_file) || die "Can't open $xref_file, $!\n"; my $ln = 1; while (<IN>) { - chomp; + s|\R$||; # Better chomp s/#.*$//; next if (/^\S*$/); my ($xr, $p1, $p2) = /^(\S+)\s+(\S+)\s+(\S+)/; @@ -57,11 +71,21 @@ my @srt2 = sort } @xrkeys; my $pname = $0; - -$pname =~ s|^.[^/]/||; +$pname =~ s|.*/||; print <<EOF; -/* AUTOGENERATED BY $pname, DO NOT EDIT */ +/* + * WARNING: do not edit! + * Generated by $pname + * + * Copyright 1998-$YEAR The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + typedef struct { int sign_id; @@ -69,6 +93,8 @@ typedef struct { int pkey_id; } nid_triple; +DEFINE_STACK_OF(nid_triple) + static const nid_triple sigoid_srt[] = { EOF @@ -111,6 +137,6 @@ sub check_oid my ($chk) = @_; if (!exists $oid_tbl{$chk}) { - die "Not Found \"$chk\"\n"; + die "Can't find \"$chk\"\n"; } } |