You've already forked linux-packaging-mono
Imported Upstream version 4.8.0.309
Former-commit-id: 5f9c6ae75f295e057a7d2971f3a6df4656fa8850
This commit is contained in:
parent
ee1447783b
commit
94b2861243
23
external/boringssl/crypto/obj/CMakeLists.txt
vendored
Normal file
23
external/boringssl/crypto/obj/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
include_directories(../../include)
|
||||
|
||||
add_library(
|
||||
obj
|
||||
|
||||
OBJECT
|
||||
|
||||
obj.c
|
||||
obj_xref.c
|
||||
)
|
||||
|
||||
if(ENABLE_TESTS)
|
||||
add_executable(
|
||||
obj_test
|
||||
|
||||
obj_test.cc
|
||||
|
||||
$<TARGET_OBJECTS:test_support>
|
||||
)
|
||||
|
||||
target_link_libraries(obj_test crypto)
|
||||
add_dependencies(all_tests obj_test)
|
||||
endif()
|
||||
37
external/boringssl/crypto/obj/README
vendored
Normal file
37
external/boringssl/crypto/obj/README
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
OID information is generated via a series of perl scripts. In order, the full
|
||||
list of commands to run are:
|
||||
|
||||
perl objects.pl objects.txt obj_mac.num ../../include/openssl/nid.h
|
||||
perl obj_dat.pl ../../include/openssl/nid.h obj_dat.h
|
||||
perl obj_xref.pl obj_mac.num obj_xref.txt > obj_xref.h
|
||||
|
||||
objects.txt contains the list of all built-in OIDs. It is processed by
|
||||
objects.pl to output obj_mac.num and nid.h. obj_mac.num is the list of NID
|
||||
values for each OID. This is an input/output parameter so NID values are stable
|
||||
across regenerations. nid.h is the header which defines macros for all the
|
||||
built-in OIDs in C.
|
||||
|
||||
nid.h is read by obj_dat.pl to generate obj_dat.h. obj_dat.h contains the
|
||||
ASN1_OBJECTs corresponding to built-in OIDs themselves along with lookup tables
|
||||
for search by short name, OID, etc.
|
||||
|
||||
obj_mac.num and obj_xref.txt are read by obj_xref.pl to generate
|
||||
obj_xref.h. obj_xref.txt links signature OIDs to corresponding public key
|
||||
algorithms and digests. obj_xref.h contains lookup tables for querying this
|
||||
information in both directions.
|
||||
|
||||
Dependency graph:
|
||||
|
||||
objects.txt
|
||||
|
|
||||
V
|
||||
[objects.pl] <--+
|
||||
/ \ |
|
||||
V V |
|
||||
nid.h obj_mac.num obj_xref.txt
|
||||
| \ /
|
||||
V V V
|
||||
[obj_dat.pl] [obj_xref.pl]
|
||||
| |
|
||||
V V
|
||||
obj_dat.h obj_xref.h
|
||||
664
external/boringssl/crypto/obj/obj.c
vendored
Normal file
664
external/boringssl/crypto/obj/obj.c
vendored
Normal file
File diff suppressed because it is too large
Load Diff
1
external/boringssl/crypto/obj/obj_dat.h.REMOVED.git-id
vendored
Normal file
1
external/boringssl/crypto/obj/obj_dat.h.REMOVED.git-id
vendored
Normal file
@@ -0,0 +1 @@
|
||||
1d779de67cfa59075f036966689c181d7e048889
|
||||
309
external/boringssl/crypto/obj/obj_dat.pl
vendored
Normal file
309
external/boringssl/crypto/obj/obj_dat.pl
vendored
Normal file
@@ -0,0 +1,309 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
# fixes bug in floating point emulation on sparc64 when
|
||||
# this script produces off-by-one output on sparc64
|
||||
use integer;
|
||||
|
||||
if (scalar @ARGV != 2)
|
||||
{
|
||||
print "Usage: perl obj_dat.pl ../../include/openssl/nid.h obj_dat.h\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
sub obj_cmp
|
||||
{
|
||||
local(@a,@b,$_,$r);
|
||||
|
||||
$A=$obj_len{$obj{$nid{$a}}};
|
||||
$B=$obj_len{$obj{$nid{$b}}};
|
||||
|
||||
$r=($A-$B);
|
||||
return($r) if $r != 0;
|
||||
|
||||
$A=$obj_der{$obj{$nid{$a}}};
|
||||
$B=$obj_der{$obj{$nid{$b}}};
|
||||
|
||||
return($A cmp $B);
|
||||
}
|
||||
|
||||
sub expand_obj
|
||||
{
|
||||
local(*v)=@_;
|
||||
local($k,$d);
|
||||
local($i);
|
||||
|
||||
do {
|
||||
$i=0;
|
||||
foreach $k (keys %v)
|
||||
{
|
||||
if (($v{$k} =~ s/(OBJ_[^,]+),/$v{$1},/))
|
||||
{ $i++; }
|
||||
}
|
||||
} while($i);
|
||||
foreach $k (keys %v)
|
||||
{
|
||||
@a=split(/,/,$v{$k});
|
||||
$objn{$k}=$#a+1;
|
||||
}
|
||||
return(%objn);
|
||||
}
|
||||
|
||||
open (IN,"$ARGV[0]") || die "Can't open input file $ARGV[0]";
|
||||
open (OUT,">$ARGV[1]") || die "Can't open output file $ARGV[1]";
|
||||
|
||||
while (<IN>)
|
||||
{
|
||||
next unless /^\#define\s+(\S+)\s+(.*)$/;
|
||||
$v=$1;
|
||||
$d=$2;
|
||||
$d =~ s/^\"//;
|
||||
$d =~ s/\"$//;
|
||||
if ($v =~ /^SN_(.*)$/)
|
||||
{
|
||||
if(defined $snames{$d})
|
||||
{
|
||||
print "WARNING: Duplicate short name \"$d\"\n";
|
||||
}
|
||||
else
|
||||
{ $snames{$d} = "X"; }
|
||||
$sn{$1}=$d;
|
||||
}
|
||||
elsif ($v =~ /^LN_(.*)$/)
|
||||
{
|
||||
if(defined $lnames{$d})
|
||||
{
|
||||
print "WARNING: Duplicate long name \"$d\"\n";
|
||||
}
|
||||
else
|
||||
{ $lnames{$d} = "X"; }
|
||||
$ln{$1}=$d;
|
||||
}
|
||||
elsif ($v =~ /^NID_(.*)$/)
|
||||
{ $nid{$d}=$1; }
|
||||
elsif ($v =~ /^OBJ_(.*)$/)
|
||||
{
|
||||
$obj{$1}=$v;
|
||||
$objd{$v}=$d;
|
||||
}
|
||||
}
|
||||
close IN;
|
||||
|
||||
%ob=&expand_obj(*objd);
|
||||
|
||||
@a=sort { $a <=> $b } keys %nid;
|
||||
$n=$a[$#a]+1;
|
||||
|
||||
@lvalues=();
|
||||
$lvalues=0;
|
||||
|
||||
for ($i=0; $i<$n; $i++)
|
||||
{
|
||||
if (!defined($nid{$i}))
|
||||
{
|
||||
push(@out,"{NULL,NULL,NID_undef,0,NULL,0},\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
$sn=defined($sn{$nid{$i}})?"$sn{$nid{$i}}":"NULL";
|
||||
$ln=defined($ln{$nid{$i}})?"$ln{$nid{$i}}":"NULL";
|
||||
|
||||
if ($sn eq "NULL") {
|
||||
$sn=$ln;
|
||||
$sn{$nid{$i}} = $ln;
|
||||
}
|
||||
|
||||
if ($ln eq "NULL") {
|
||||
$ln=$sn;
|
||||
$ln{$nid{$i}} = $sn;
|
||||
}
|
||||
|
||||
$out ="{";
|
||||
$out.="\"$sn\"";
|
||||
$out.=","."\"$ln\"";
|
||||
$out.=",NID_$nid{$i},";
|
||||
if (defined($obj{$nid{$i}}) && $objd{$obj{$nid{$i}}} =~ /,/)
|
||||
{
|
||||
$v=$objd{$obj{$nid{$i}}};
|
||||
$v =~ s/L//g;
|
||||
$v =~ s/,/ /g;
|
||||
$r=&der_it($v);
|
||||
$z="";
|
||||
$length=0;
|
||||
foreach (unpack("C*",$r))
|
||||
{
|
||||
$z.=sprintf("0x%02X,",$_);
|
||||
$length++;
|
||||
}
|
||||
$obj_der{$obj{$nid{$i}}}=$z;
|
||||
$obj_len{$obj{$nid{$i}}}=$length;
|
||||
|
||||
push(@lvalues,sprintf("%-45s/* [%3d] %s */\n",
|
||||
$z,$lvalues,$obj{$nid{$i}}));
|
||||
$out.="$length,&(lvalues[$lvalues]),0";
|
||||
$lvalues+=$length;
|
||||
}
|
||||
else
|
||||
{
|
||||
$out.="0,NULL,0";
|
||||
}
|
||||
$out.="},\n";
|
||||
push(@out,$out);
|
||||
}
|
||||
}
|
||||
|
||||
@a=grep(defined($sn{$nid{$_}}),0 .. $n);
|
||||
foreach (sort { $sn{$nid{$a}} cmp $sn{$nid{$b}} } @a)
|
||||
{
|
||||
push(@sn,sprintf("%2d,\t/* \"$sn{$nid{$_}}\" */\n",$_));
|
||||
}
|
||||
|
||||
@a=grep(defined($ln{$nid{$_}}),0 .. $n);
|
||||
foreach (sort { $ln{$nid{$a}} cmp $ln{$nid{$b}} } @a)
|
||||
{
|
||||
push(@ln,sprintf("%2d,\t/* \"$ln{$nid{$_}}\" */\n",$_));
|
||||
}
|
||||
|
||||
@a=grep(defined($obj{$nid{$_}}) && $objd{$obj{$nid{$_}}} =~ /,/,0 .. $n);
|
||||
foreach (sort obj_cmp @a)
|
||||
{
|
||||
$m=$obj{$nid{$_}};
|
||||
$v=$objd{$m};
|
||||
$v =~ s/L//g;
|
||||
$v =~ s/,/ /g;
|
||||
push(@ob,sprintf("%2d,\t/* %-32s %s */\n",$_,$m,$v));
|
||||
}
|
||||
|
||||
print OUT <<'EOF';
|
||||
/* THIS FILE IS GENERATED FROM objects.h by obj_dat.pl via the
|
||||
* following command:
|
||||
* perl obj_dat.pl ../../include/openssl/nid.h obj_dat.h */
|
||||
|
||||
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.] */
|
||||
|
||||
EOF
|
||||
|
||||
printf OUT "#define NUM_NID %d\n",$n;
|
||||
printf OUT "#define NUM_SN %d\n",$#sn+1;
|
||||
printf OUT "#define NUM_LN %d\n",$#ln+1;
|
||||
printf OUT "#define NUM_OBJ %d\n\n",$#ob+1;
|
||||
|
||||
printf OUT "static const unsigned char lvalues[%d]={\n",$lvalues+1;
|
||||
print OUT @lvalues;
|
||||
print OUT "};\n\n";
|
||||
|
||||
printf OUT "static const ASN1_OBJECT kObjects[NUM_NID]={\n";
|
||||
foreach (@out)
|
||||
{
|
||||
if (length($_) > 75)
|
||||
{
|
||||
$out="";
|
||||
foreach (split(/,/))
|
||||
{
|
||||
$t=$out.$_.",";
|
||||
if (length($t) > 70)
|
||||
{
|
||||
print OUT "$out\n";
|
||||
$t="\t$_,";
|
||||
}
|
||||
$out=$t;
|
||||
}
|
||||
chop $out;
|
||||
print OUT "$out";
|
||||
}
|
||||
else
|
||||
{ print OUT $_; }
|
||||
}
|
||||
print OUT "};\n\n";
|
||||
|
||||
printf OUT "static const unsigned int kNIDsInShortNameOrder[NUM_SN]={\n";
|
||||
print OUT @sn;
|
||||
print OUT "};\n\n";
|
||||
|
||||
printf OUT "static const unsigned int kNIDsInLongNameOrder[NUM_LN]={\n";
|
||||
print OUT @ln;
|
||||
print OUT "};\n\n";
|
||||
|
||||
printf OUT "static const unsigned int kNIDsInOIDOrder[NUM_OBJ]={\n";
|
||||
print OUT @ob;
|
||||
print OUT "};\n\n";
|
||||
|
||||
close OUT;
|
||||
|
||||
sub der_it
|
||||
{
|
||||
local($v)=@_;
|
||||
local(@a,$i,$ret,@r);
|
||||
|
||||
@a=split(/\s+/,$v);
|
||||
$ret.=pack("C*",$a[0]*40+$a[1]);
|
||||
shift @a;
|
||||
shift @a;
|
||||
foreach (@a)
|
||||
{
|
||||
@r=();
|
||||
$t=0;
|
||||
while ($_ >= 128)
|
||||
{
|
||||
$x=$_%128;
|
||||
$_/=128;
|
||||
push(@r,((($t++)?0x80:0)|$x));
|
||||
}
|
||||
push(@r,((($t++)?0x80:0)|$_));
|
||||
$ret.=pack("C*",reverse(@r));
|
||||
}
|
||||
return($ret);
|
||||
}
|
||||
949
external/boringssl/crypto/obj/obj_mac.num
vendored
Normal file
949
external/boringssl/crypto/obj/obj_mac.num
vendored
Normal file
File diff suppressed because it is too large
Load Diff
106
external/boringssl/crypto/obj/obj_test.cc
vendored
Normal file
106
external/boringssl/crypto/obj/obj_test.cc
vendored
Normal file
@@ -0,0 +1,106 @@
|
||||
/* Copyright (c) 2016, Google Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, and/or distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
|
||||
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <openssl/bytestring.h>
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/obj.h>
|
||||
|
||||
|
||||
static bool TestBasic() {
|
||||
static const int kNID = NID_sha256WithRSAEncryption;
|
||||
static const char kShortName[] = "RSA-SHA256";
|
||||
static const char kLongName[] = "sha256WithRSAEncryption";
|
||||
static const char kText[] = "1.2.840.113549.1.1.11";
|
||||
static const uint8_t kDER[] = {
|
||||
0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b,
|
||||
};
|
||||
|
||||
CBS cbs;
|
||||
CBS_init(&cbs, kDER, sizeof(kDER));
|
||||
if (OBJ_cbs2nid(&cbs) != kNID ||
|
||||
OBJ_sn2nid(kShortName) != kNID ||
|
||||
OBJ_ln2nid(kLongName) != kNID ||
|
||||
OBJ_txt2nid(kShortName) != kNID ||
|
||||
OBJ_txt2nid(kLongName) != kNID ||
|
||||
OBJ_txt2nid(kText) != kNID) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (strcmp(kShortName, OBJ_nid2sn(kNID)) != 0 ||
|
||||
strcmp(kLongName, OBJ_nid2ln(kNID)) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (OBJ_sn2nid("this is not an OID") != NID_undef ||
|
||||
OBJ_ln2nid("this is not an OID") != NID_undef ||
|
||||
OBJ_txt2nid("this is not an OID") != NID_undef) {
|
||||
return false;
|
||||
}
|
||||
|
||||
CBS_init(&cbs, NULL, 0);
|
||||
if (OBJ_cbs2nid(&cbs) != NID_undef) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 1.2.840.113554.4.1.72585.2 (https://davidben.net/oid).
|
||||
static const uint8_t kUnknownDER[] = {
|
||||
0x2a, 0x86, 0x48, 0x86, 0xf7, 0x12, 0x04, 0x01, 0x84, 0xb7, 0x09, 0x02,
|
||||
};
|
||||
CBS_init(&cbs, kUnknownDER, sizeof(kUnknownDER));
|
||||
if (OBJ_cbs2nid(&cbs) != NID_undef) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool TestSignatureAlgorithms() {
|
||||
int digest_nid, pkey_nid;
|
||||
if (!OBJ_find_sigid_algs(NID_sha256WithRSAEncryption, &digest_nid,
|
||||
&pkey_nid) ||
|
||||
digest_nid != NID_sha256 || pkey_nid != NID_rsaEncryption) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (OBJ_find_sigid_algs(NID_sha256, &digest_nid, &pkey_nid)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int sign_nid;
|
||||
if (!OBJ_find_sigid_by_algs(&sign_nid, NID_sha256, NID_rsaEncryption) ||
|
||||
sign_nid != NID_sha256WithRSAEncryption) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (OBJ_find_sigid_by_algs(&sign_nid, NID_dsa, NID_rsaEncryption)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int main() {
|
||||
CRYPTO_library_init();
|
||||
|
||||
if (!TestBasic() ||
|
||||
!TestSignatureAlgorithms()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("PASS\n");
|
||||
return 0;
|
||||
}
|
||||
124
external/boringssl/crypto/obj/obj_xref.c
vendored
Normal file
124
external/boringssl/crypto/obj/obj_xref.c
vendored
Normal file
@@ -0,0 +1,124 @@
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.] */
|
||||
|
||||
#include <openssl/obj.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "obj_xref.h"
|
||||
|
||||
|
||||
static int nid_triple_cmp_by_sign_id(const void *in_a, const void *in_b) {
|
||||
const nid_triple *a = in_a;
|
||||
const nid_triple *b = in_b;
|
||||
|
||||
return a->sign_id - b->sign_id;
|
||||
}
|
||||
|
||||
int OBJ_find_sigid_algs(int sign_nid, int *out_digest_nid, int *out_pkey_nid) {
|
||||
nid_triple key;
|
||||
const nid_triple *triple;
|
||||
|
||||
key.sign_id = sign_nid;
|
||||
|
||||
triple = bsearch(&key, sigoid_srt, sizeof(sigoid_srt) / sizeof(nid_triple),
|
||||
sizeof(nid_triple), nid_triple_cmp_by_sign_id);
|
||||
|
||||
if (triple == NULL) {
|
||||
return 0;
|
||||
}
|
||||
if (out_digest_nid) {
|
||||
*out_digest_nid = triple->hash_id;
|
||||
}
|
||||
if (out_pkey_nid) {
|
||||
*out_pkey_nid = triple->pkey_id;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int nid_triple_cmp_by_digest_and_hash(const void *in_a,
|
||||
const void *in_b) {
|
||||
const nid_triple *a = *((nid_triple**) in_a);
|
||||
const nid_triple *b = *((nid_triple**) in_b);
|
||||
|
||||
int ret = a->hash_id - b->hash_id;
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
return a->pkey_id - b->pkey_id;
|
||||
}
|
||||
|
||||
int OBJ_find_sigid_by_algs(int *out_sign_nid, int digest_nid, int pkey_nid) {
|
||||
nid_triple key, *pkey;
|
||||
const nid_triple **triple;
|
||||
|
||||
key.hash_id = digest_nid;
|
||||
key.pkey_id = pkey_nid;
|
||||
pkey = &key;
|
||||
|
||||
triple = bsearch(&pkey, sigoid_srt_xref,
|
||||
sizeof(sigoid_srt_xref) / sizeof(nid_triple *),
|
||||
sizeof(nid_triple *), nid_triple_cmp_by_digest_and_hash);
|
||||
|
||||
if (triple == NULL) {
|
||||
return 0;
|
||||
}
|
||||
if (out_sign_nid) {
|
||||
*out_sign_nid = (*triple)->sign_id;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
96
external/boringssl/crypto/obj/obj_xref.h
vendored
Normal file
96
external/boringssl/crypto/obj/obj_xref.h
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
/* THIS FILE IS GENERATED FROM obj_xref.txt by obj_xref.pl via the
|
||||
* following command:
|
||||
* perl obj_xref.pl obj_mac.num obj_xref.txt > obj_xref.h */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int sign_id;
|
||||
int hash_id;
|
||||
int pkey_id;
|
||||
} nid_triple;
|
||||
|
||||
static const nid_triple sigoid_srt[] =
|
||||
{
|
||||
{NID_md2WithRSAEncryption, NID_md2, NID_rsaEncryption},
|
||||
{NID_md5WithRSAEncryption, NID_md5, NID_rsaEncryption},
|
||||
{NID_shaWithRSAEncryption, NID_sha, NID_rsaEncryption},
|
||||
{NID_sha1WithRSAEncryption, NID_sha1, NID_rsaEncryption},
|
||||
{NID_dsaWithSHA, NID_sha, NID_dsa},
|
||||
{NID_dsaWithSHA1_2, NID_sha1, NID_dsa_2},
|
||||
{NID_mdc2WithRSA, NID_mdc2, NID_rsaEncryption},
|
||||
{NID_md5WithRSA, NID_md5, NID_rsa},
|
||||
{NID_dsaWithSHA1, NID_sha1, NID_dsa},
|
||||
{NID_sha1WithRSA, NID_sha1, NID_rsa},
|
||||
{NID_ripemd160WithRSA, NID_ripemd160, NID_rsaEncryption},
|
||||
{NID_md4WithRSAEncryption, NID_md4, NID_rsaEncryption},
|
||||
{NID_ecdsa_with_SHA1, NID_sha1, NID_X9_62_id_ecPublicKey},
|
||||
{NID_sha256WithRSAEncryption, NID_sha256, NID_rsaEncryption},
|
||||
{NID_sha384WithRSAEncryption, NID_sha384, NID_rsaEncryption},
|
||||
{NID_sha512WithRSAEncryption, NID_sha512, NID_rsaEncryption},
|
||||
{NID_sha224WithRSAEncryption, NID_sha224, NID_rsaEncryption},
|
||||
{NID_ecdsa_with_Recommended, NID_undef, NID_X9_62_id_ecPublicKey},
|
||||
{NID_ecdsa_with_Specified, NID_undef, NID_X9_62_id_ecPublicKey},
|
||||
{NID_ecdsa_with_SHA224, NID_sha224, NID_X9_62_id_ecPublicKey},
|
||||
{NID_ecdsa_with_SHA256, NID_sha256, NID_X9_62_id_ecPublicKey},
|
||||
{NID_ecdsa_with_SHA384, NID_sha384, NID_X9_62_id_ecPublicKey},
|
||||
{NID_ecdsa_with_SHA512, NID_sha512, NID_X9_62_id_ecPublicKey},
|
||||
{NID_dsa_with_SHA224, NID_sha224, NID_dsa},
|
||||
{NID_dsa_with_SHA256, NID_sha256, NID_dsa},
|
||||
{NID_id_GostR3411_94_with_GostR3410_2001, NID_id_GostR3411_94, NID_id_GostR3410_2001},
|
||||
{NID_id_GostR3411_94_with_GostR3410_94, NID_id_GostR3411_94, NID_id_GostR3410_94},
|
||||
{NID_id_GostR3411_94_with_GostR3410_94_cc, NID_id_GostR3411_94, NID_id_GostR3410_94_cc},
|
||||
{NID_id_GostR3411_94_with_GostR3410_2001_cc, NID_id_GostR3411_94, NID_id_GostR3410_2001_cc},
|
||||
{NID_rsassaPss, NID_undef, NID_rsaEncryption},
|
||||
{NID_dhSinglePass_stdDH_sha1kdf_scheme, NID_sha1, NID_dh_std_kdf},
|
||||
{NID_dhSinglePass_stdDH_sha224kdf_scheme, NID_sha224, NID_dh_std_kdf},
|
||||
{NID_dhSinglePass_stdDH_sha256kdf_scheme, NID_sha256, NID_dh_std_kdf},
|
||||
{NID_dhSinglePass_stdDH_sha384kdf_scheme, NID_sha384, NID_dh_std_kdf},
|
||||
{NID_dhSinglePass_stdDH_sha512kdf_scheme, NID_sha512, NID_dh_std_kdf},
|
||||
{NID_dhSinglePass_cofactorDH_sha1kdf_scheme, NID_sha1, NID_dh_cofactor_kdf},
|
||||
{NID_dhSinglePass_cofactorDH_sha224kdf_scheme, NID_sha224, NID_dh_cofactor_kdf},
|
||||
{NID_dhSinglePass_cofactorDH_sha256kdf_scheme, NID_sha256, NID_dh_cofactor_kdf},
|
||||
{NID_dhSinglePass_cofactorDH_sha384kdf_scheme, NID_sha384, NID_dh_cofactor_kdf},
|
||||
{NID_dhSinglePass_cofactorDH_sha512kdf_scheme, NID_sha512, NID_dh_cofactor_kdf},
|
||||
};
|
||||
|
||||
static const nid_triple * const sigoid_srt_xref[] =
|
||||
{
|
||||
&sigoid_srt[0],
|
||||
&sigoid_srt[1],
|
||||
&sigoid_srt[7],
|
||||
&sigoid_srt[2],
|
||||
&sigoid_srt[4],
|
||||
&sigoid_srt[3],
|
||||
&sigoid_srt[9],
|
||||
&sigoid_srt[5],
|
||||
&sigoid_srt[8],
|
||||
&sigoid_srt[12],
|
||||
&sigoid_srt[30],
|
||||
&sigoid_srt[35],
|
||||
&sigoid_srt[6],
|
||||
&sigoid_srt[10],
|
||||
&sigoid_srt[11],
|
||||
&sigoid_srt[13],
|
||||
&sigoid_srt[24],
|
||||
&sigoid_srt[20],
|
||||
&sigoid_srt[32],
|
||||
&sigoid_srt[37],
|
||||
&sigoid_srt[14],
|
||||
&sigoid_srt[21],
|
||||
&sigoid_srt[33],
|
||||
&sigoid_srt[38],
|
||||
&sigoid_srt[15],
|
||||
&sigoid_srt[22],
|
||||
&sigoid_srt[34],
|
||||
&sigoid_srt[39],
|
||||
&sigoid_srt[16],
|
||||
&sigoid_srt[23],
|
||||
&sigoid_srt[19],
|
||||
&sigoid_srt[31],
|
||||
&sigoid_srt[36],
|
||||
&sigoid_srt[25],
|
||||
&sigoid_srt[26],
|
||||
&sigoid_srt[27],
|
||||
&sigoid_srt[28],
|
||||
};
|
||||
|
||||
118
external/boringssl/crypto/obj/obj_xref.pl
vendored
Normal file
118
external/boringssl/crypto/obj/obj_xref.pl
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
use strict;
|
||||
|
||||
if (scalar @ARGV != 2)
|
||||
{
|
||||
print "Usage: perl obj_xref.pl obj_mac.num obj_xref.txt > obj_xref.h\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
my %xref_tbl;
|
||||
my %oid_tbl;
|
||||
|
||||
my ($mac_file, $xref_file) = @ARGV;
|
||||
|
||||
open(IN, $mac_file) || die "Can't open $mac_file";
|
||||
|
||||
# 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, $xref_file) || die "Can't open $xref_file";
|
||||
|
||||
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;
|
||||
|
||||
my $pname = $0;
|
||||
|
||||
$pname =~ s|^.[^/]/||;
|
||||
|
||||
print <<EOF;
|
||||
/* THIS FILE IS GENERATED FROM obj_xref.txt by obj_xref.pl via the
|
||||
* following command:
|
||||
* perl obj_xref.pl obj_mac.num obj_xref.txt > obj_xref.h */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int sign_id;
|
||||
int hash_id;
|
||||
int pkey_id;
|
||||
} nid_triple;
|
||||
|
||||
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 ($p1, $p2, $x) = @{$xref_tbl{$_}};
|
||||
# If digest or signature algorithm is "undef" then the algorithm
|
||||
# needs special handling and is excluded from the cross reference table.
|
||||
next if $p1 eq "undef" || $p2 eq "undef";
|
||||
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";
|
||||
}
|
||||
}
|
||||
|
||||
58
external/boringssl/crypto/obj/obj_xref.txt
vendored
Normal file
58
external/boringssl/crypto/obj/obj_xref.txt
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
# OID cross reference table.
|
||||
# Links signatures OIDs to their corresponding public key algorithms
|
||||
# and digests.
|
||||
|
||||
md2WithRSAEncryption md2 rsaEncryption
|
||||
md5WithRSAEncryption md5 rsaEncryption
|
||||
shaWithRSAEncryption sha rsaEncryption
|
||||
sha1WithRSAEncryption sha1 rsaEncryption
|
||||
md4WithRSAEncryption md4 rsaEncryption
|
||||
sha256WithRSAEncryption sha256 rsaEncryption
|
||||
sha384WithRSAEncryption sha384 rsaEncryption
|
||||
sha512WithRSAEncryption sha512 rsaEncryption
|
||||
sha224WithRSAEncryption sha224 rsaEncryption
|
||||
mdc2WithRSA mdc2 rsaEncryption
|
||||
ripemd160WithRSA ripemd160 rsaEncryption
|
||||
# For PSS the digest algorithm can vary and depends on the included
|
||||
# AlgorithmIdentifier. The digest "undef" indicates the public key
|
||||
# method should handle this explicitly.
|
||||
rsassaPss undef rsaEncryption
|
||||
|
||||
# Alternative deprecated OIDs. By using the older "rsa" OID this
|
||||
# type will be recognized by not normally used.
|
||||
|
||||
md5WithRSA md5 rsa
|
||||
sha1WithRSA sha1 rsa
|
||||
|
||||
dsaWithSHA sha dsa
|
||||
dsaWithSHA1 sha1 dsa
|
||||
|
||||
dsaWithSHA1_2 sha1 dsa_2
|
||||
|
||||
ecdsa_with_SHA1 sha1 X9_62_id_ecPublicKey
|
||||
ecdsa_with_SHA224 sha224 X9_62_id_ecPublicKey
|
||||
ecdsa_with_SHA256 sha256 X9_62_id_ecPublicKey
|
||||
ecdsa_with_SHA384 sha384 X9_62_id_ecPublicKey
|
||||
ecdsa_with_SHA512 sha512 X9_62_id_ecPublicKey
|
||||
ecdsa_with_Recommended undef X9_62_id_ecPublicKey
|
||||
ecdsa_with_Specified undef X9_62_id_ecPublicKey
|
||||
|
||||
dsa_with_SHA224 sha224 dsa
|
||||
dsa_with_SHA256 sha256 dsa
|
||||
|
||||
id_GostR3411_94_with_GostR3410_2001 id_GostR3411_94 id_GostR3410_2001
|
||||
id_GostR3411_94_with_GostR3410_94 id_GostR3411_94 id_GostR3410_94
|
||||
id_GostR3411_94_with_GostR3410_94_cc id_GostR3411_94 id_GostR3410_94_cc
|
||||
id_GostR3411_94_with_GostR3410_2001_cc id_GostR3411_94 id_GostR3410_2001_cc
|
||||
# ECDH KDFs and their corresponding message digests and schemes
|
||||
dhSinglePass_stdDH_sha1kdf_scheme sha1 dh_std_kdf
|
||||
dhSinglePass_stdDH_sha224kdf_scheme sha224 dh_std_kdf
|
||||
dhSinglePass_stdDH_sha256kdf_scheme sha256 dh_std_kdf
|
||||
dhSinglePass_stdDH_sha384kdf_scheme sha384 dh_std_kdf
|
||||
dhSinglePass_stdDH_sha512kdf_scheme sha512 dh_std_kdf
|
||||
|
||||
dhSinglePass_cofactorDH_sha1kdf_scheme sha1 dh_cofactor_kdf
|
||||
dhSinglePass_cofactorDH_sha224kdf_scheme sha224 dh_cofactor_kdf
|
||||
dhSinglePass_cofactorDH_sha256kdf_scheme sha256 dh_cofactor_kdf
|
||||
dhSinglePass_cofactorDH_sha384kdf_scheme sha384 dh_cofactor_kdf
|
||||
dhSinglePass_cofactorDH_sha512kdf_scheme sha512 dh_cofactor_kdf
|
||||
255
external/boringssl/crypto/obj/objects.pl
vendored
Normal file
255
external/boringssl/crypto/obj/objects.pl
vendored
Normal file
@@ -0,0 +1,255 @@
|
||||
#!/usr/bin/env perl
|
||||
|
||||
if (scalar @ARGV != 3)
|
||||
{
|
||||
print "Usage: perl objects.pl objects.txt obj_mac.num ../../include/openssl/nid.h\n";
|
||||
exit 1;
|
||||
}
|
||||
|
||||
open (NUMIN,"$ARGV[1]") || die "Can't open number file $ARGV[1]";
|
||||
$max_nid=0;
|
||||
$o=0;
|
||||
while(<NUMIN>)
|
||||
{
|
||||
chop;
|
||||
$o++;
|
||||
s/#.*$//;
|
||||
next if /^\s*$/;
|
||||
$_ = 'X'.$_;
|
||||
($Cname,$mynum) = split;
|
||||
$Cname =~ s/^X//;
|
||||
if (defined($nidn{$mynum}))
|
||||
{ die "$ARGV[1]:$o:There's already an object with NID ",$mynum," on line ",$order{$mynum},"\n"; }
|
||||
if (defined($nid{$Cname}))
|
||||
{ die "$ARGV[1]:$o:There's already an object with name ",$Cname," on line ",$order{$nid{$Cname}},"\n"; }
|
||||
$nid{$Cname} = $mynum;
|
||||
$nidn{$mynum} = $Cname;
|
||||
$order{$mynum} = $o;
|
||||
$max_nid = $mynum if $mynum > $max_nid;
|
||||
}
|
||||
close NUMIN;
|
||||
|
||||
open (IN,"$ARGV[0]") || die "Can't open input file $ARGV[0]";
|
||||
$Cname="";
|
||||
$o=0;
|
||||
while (<IN>)
|
||||
{
|
||||
chop;
|
||||
$o++;
|
||||
if (/^!module\s+(.*)$/)
|
||||
{
|
||||
$module = $1."-";
|
||||
$module =~ s/\./_/g;
|
||||
$module =~ s/-/_/g;
|
||||
}
|
||||
if (/^!global$/)
|
||||
{ $module = ""; }
|
||||
if (/^!Cname\s+(.*)$/)
|
||||
{ $Cname = $1; }
|
||||
if (/^!Alias\s+(.+?)\s+(.*)$/)
|
||||
{
|
||||
$Cname = $module.$1;
|
||||
$myoid = $2;
|
||||
$myoid = &process_oid($myoid);
|
||||
$Cname =~ s/-/_/g;
|
||||
$ordern{$o} = $Cname;
|
||||
$order{$Cname} = $o;
|
||||
$obj{$Cname} = $myoid;
|
||||
$_ = "";
|
||||
$Cname = "";
|
||||
}
|
||||
s/!.*$//;
|
||||
s/#.*$//;
|
||||
next if /^\s*$/;
|
||||
($myoid,$mysn,$myln) = split ':';
|
||||
$mysn =~ s/^\s*//;
|
||||
$mysn =~ s/\s*$//;
|
||||
$myln =~ s/^\s*//;
|
||||
$myln =~ s/\s*$//;
|
||||
$myoid =~ s/^\s*//;
|
||||
$myoid =~ s/\s*$//;
|
||||
if ($myoid ne "")
|
||||
{
|
||||
$myoid = &process_oid($myoid);
|
||||
}
|
||||
|
||||
if ($Cname eq "" && !($myln =~ / /))
|
||||
{
|
||||
$Cname = $myln;
|
||||
$Cname =~ s/\./_/g;
|
||||
$Cname =~ s/-/_/g;
|
||||
if ($Cname ne "" && defined($ln{$module.$Cname}))
|
||||
{ die "objects.txt:$o:There's already an object with long name ",$ln{$module.$Cname}," on line ",$order{$module.$Cname},"\n"; }
|
||||
}
|
||||
if ($Cname eq "")
|
||||
{
|
||||
$Cname = $mysn;
|
||||
$Cname =~ s/-/_/g;
|
||||
if ($Cname ne "" && defined($sn{$module.$Cname}))
|
||||
{ die "objects.txt:$o:There's already an object with short name ",$sn{$module.$Cname}," on line ",$order{$module.$Cname},"\n"; }
|
||||
}
|
||||
if ($Cname eq "")
|
||||
{
|
||||
$Cname = $myln;
|
||||
$Cname =~ s/-/_/g;
|
||||
$Cname =~ s/\./_/g;
|
||||
$Cname =~ s/ /_/g;
|
||||
if ($Cname ne "" && defined($ln{$module.$Cname}))
|
||||
{ die "objects.txt:$o:There's already an object with long name ",$ln{$module.$Cname}," on line ",$order{$module.$Cname},"\n"; }
|
||||
}
|
||||
$Cname =~ s/\./_/g;
|
||||
$Cname =~ s/-/_/g;
|
||||
$Cname = $module.$Cname;
|
||||
$ordern{$o} = $Cname;
|
||||
$order{$Cname} = $o;
|
||||
$sn{$Cname} = $mysn;
|
||||
$ln{$Cname} = $myln;
|
||||
$obj{$Cname} = $myoid;
|
||||
if (!defined($nid{$Cname}))
|
||||
{
|
||||
$max_nid++;
|
||||
$nid{$Cname} = $max_nid;
|
||||
$nidn{$max_nid} = $Cname;
|
||||
print STDERR "Added OID $Cname\n";
|
||||
}
|
||||
$Cname="";
|
||||
}
|
||||
close IN;
|
||||
|
||||
open (NUMOUT,">$ARGV[1]") || die "Can't open output file $ARGV[1]";
|
||||
foreach (sort { $a <=> $b } keys %nidn)
|
||||
{
|
||||
print NUMOUT $nidn{$_},"\t\t",$_,"\n";
|
||||
}
|
||||
close NUMOUT;
|
||||
|
||||
open (OUT,">$ARGV[2]") || die "Can't open output file $ARGV[2]";
|
||||
print OUT <<'EOF';
|
||||
/* THIS FILE IS GENERATED FROM objects.txt by objects.pl via the
|
||||
* following command:
|
||||
* perl objects.pl objects.txt obj_mac.num ../../include/openssl/nid.h */
|
||||
|
||||
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_HEADER_NID_H
|
||||
#define OPENSSL_HEADER_NID_H
|
||||
|
||||
|
||||
/* The nid library provides numbered values for ASN.1 object identifiers and
|
||||
* other symbols. These values are used by other libraries to identify
|
||||
* cryptographic primitives.
|
||||
*
|
||||
* A separate objects library, obj.h, provides functions for converting between
|
||||
* nids and object identifiers. However it depends on large internal tables with
|
||||
* the encodings of every nid defind. Consumers concerned with binary size
|
||||
* should instead embed the encodings of the few consumed OIDs and compare
|
||||
* against those.
|
||||
*
|
||||
* These values should not be used outside of a single process; they are not
|
||||
* stable identifiers. */
|
||||
|
||||
|
||||
#define SN_undef "UNDEF"
|
||||
#define LN_undef "undefined"
|
||||
#define NID_undef 0
|
||||
#define OBJ_undef 0L
|
||||
|
||||
EOF
|
||||
|
||||
foreach (sort { $a <=> $b } keys %ordern)
|
||||
{
|
||||
$Cname=$ordern{$_};
|
||||
print OUT "#define SN_",$Cname," \"",$sn{$Cname},"\"\n" if $sn{$Cname} ne "";
|
||||
print OUT "#define LN_",$Cname," \"",$ln{$Cname},"\"\n" if $ln{$Cname} ne "";
|
||||
print OUT "#define NID_",$Cname," ",$nid{$Cname},"\n" if $nid{$Cname} ne "";
|
||||
print OUT "#define OBJ_",$Cname," ",$obj{$Cname},"\n" if $obj{$Cname} ne "";
|
||||
print OUT "\n";
|
||||
}
|
||||
|
||||
print OUT "\n#endif /* OPENSSL_HEADER_NID_H */\n";
|
||||
|
||||
close OUT;
|
||||
|
||||
sub process_oid
|
||||
{
|
||||
local($oid)=@_;
|
||||
local(@a,$oid_pref);
|
||||
|
||||
@a = split(/\s+/,$myoid);
|
||||
$pref_oid = "";
|
||||
$pref_sep = "";
|
||||
if (!($a[0] =~ /^[0-9]+$/))
|
||||
{
|
||||
$a[0] =~ s/-/_/g;
|
||||
if (!defined($obj{$a[0]}))
|
||||
{ die "$ARGV[0]:$o:Undefined identifier ",$a[0],"\n"; }
|
||||
$pref_oid = "OBJ_" . $a[0];
|
||||
$pref_sep = ",";
|
||||
shift @a;
|
||||
}
|
||||
$oids = join('L,',@a) . "L";
|
||||
if ($oids ne "L")
|
||||
{
|
||||
$oids = $pref_oid . $pref_sep . $oids;
|
||||
}
|
||||
else
|
||||
{
|
||||
$oids = $pref_oid;
|
||||
}
|
||||
return($oids);
|
||||
}
|
||||
1338
external/boringssl/crypto/obj/objects.txt
vendored
Normal file
1338
external/boringssl/crypto/obj/objects.txt
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user