Browse Source

Rename obj_mac.h to nid.h and make it a multiply-includable header.

obj_mac.h is missing #include guards, so one cannot use NIDs without
pulling in the OBJ_* functions which depend on the giant OID table. Give
it #include guards, tidy up the style slightly, and also rename it to
nid.h which is a much more reasonable name.

obj_mac.h is kept as a forwarding header as, despite it being a little
screwy, some code #includes it anyway.

BUG=chromium:499653

Change-Id: Iec0b3f186c02e208ff1f7437bf27ee3a5ad004b7
Reviewed-on: https://boringssl-review.googlesource.com/7562
Reviewed-by: Steven Valdez <svaldez@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
kris/onging/CECPQ3_patch15
David Benjamin 8 years ago
parent
commit
5d38f78e29
7 changed files with 4220 additions and 4162 deletions
  1. +6
    -6
      crypto/obj/README
  2. +1
    -1
      crypto/obj/obj_dat.h
  3. +2
    -2
      crypto/obj/obj_dat.pl
  4. +30
    -10
      crypto/obj/objects.pl
  5. +4163
    -0
      include/openssl/nid.h
  6. +1
    -1
      include/openssl/obj.h
  7. +17
    -4142
      include/openssl/obj_mac.h

+ 6
- 6
crypto/obj/README View File

@@ -1,17 +1,17 @@
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/obj_mac.h
perl obj_dat.pl ../../include/openssl/obj_mac.h obj_dat.h
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 obj_mac.h. obj_mac.num is the list of NID
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. obj_mac.h is the header which defines macros for all the
across regenerations. nid.h is the header which defines macros for all the
built-in OIDs in C.

obj_mac.h is read by obj_dat.pl to generate obj_dat.h. obj_dat.h contains the
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.

@@ -28,7 +28,7 @@ Dependency graph:
[objects.pl] <--+
/ \ |
V V |
obj_mac.h obj_mac.num obj_xref.txt
nid.h obj_mac.num obj_xref.txt
| \ /
V V V
[obj_dat.pl] [obj_xref.pl]


+ 1
- 1
crypto/obj/obj_dat.h View File

@@ -1,6 +1,6 @@
/* THIS FILE IS GENERATED FROM objects.h by obj_dat.pl via the
* following command:
* perl obj_dat.pl ../../include/openssl/obj_mac.h obj_dat.h */
* perl obj_dat.pl ../../include/openssl/nid.h obj_dat.h */

/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
* All rights reserved.


+ 2
- 2
crypto/obj/obj_dat.pl View File

@@ -6,7 +6,7 @@ use integer;

if (scalar @ARGV != 2)
{
print "Usage: perl obj_dat.pl ../../include/openssl/obj_mac.h obj_dat.h\n";
print "Usage: perl obj_dat.pl ../../include/openssl/nid.h obj_dat.h\n";
exit 1;
}

@@ -176,7 +176,7 @@ foreach (sort obj_cmp @a)
print OUT <<'EOF';
/* THIS FILE IS GENERATED FROM objects.h by obj_dat.pl via the
* following command:
* perl obj_dat.pl ../../include/openssl/obj_mac.h obj_dat.h */
* perl obj_dat.pl ../../include/openssl/nid.h obj_dat.h */

/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
* All rights reserved.


+ 30
- 10
crypto/obj/objects.pl View File

@@ -2,7 +2,7 @@

if (scalar @ARGV != 3)
{
print "Usage: perl objects.pl objects.txt obj_mac.num ../../include/openssl/obj_mac.h\n";
print "Usage: perl objects.pl objects.txt obj_mac.num ../../include/openssl/nid.h\n";
exit 1;
}

@@ -127,7 +127,7 @@ 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/obj_mac.h */
* perl objects.pl objects.txt obj_mac.num ../../include/openssl/nid.h */

/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
* All rights reserved.
@@ -186,23 +186,43 @@ print OUT <<'EOF';
* [including the GNU Public Licence.]
*/

#define SN_undef "UNDEF"
#define LN_undef "undefined"
#define NID_undef 0
#define OBJ_undef 0L
#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,"\t\t\"",$sn{$Cname},"\"\n" if $sn{$Cname} ne "";
print OUT "#define LN_",$Cname,"\t\t\"",$ln{$Cname},"\"\n" if $ln{$Cname} ne "";
print OUT "#define NID_",$Cname,"\t\t",$nid{$Cname},"\n" if $nid{$Cname} ne "";
print OUT "#define OBJ_",$Cname,"\t\t",$obj{$Cname},"\n" if $obj{$Cname} ne "";
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


+ 4163
- 0
include/openssl/nid.h
File diff suppressed because it is too large
View File


+ 1
- 1
include/openssl/obj.h View File

@@ -60,7 +60,7 @@
#include <openssl/base.h>

#include <openssl/bytestring.h>
#include <openssl/obj_mac.h>
#include <openssl/nid.h>

#if defined(__cplusplus)
extern "C" {


+ 17
- 4142
include/openssl/obj_mac.h
File diff suppressed because it is too large
View File


Loading…
Cancel
Save