Import OpenSSL 1.1.0f

This commit is contained in:
Steve Dower
2017-09-07 16:27:43 -07:00
committed by Steve Dower
parent ccd3ab4aff
commit f4b81cb7c9
3340 changed files with 325158 additions and 557542 deletions

View File

@@ -1,132 +0,0 @@
#
# OpenSSL/crypto/objects/Makefile
#
DIR= objects
TOP= ../..
CC= cc
INCLUDES= -I.. -I$(TOP) -I../../include
CFLAG=-g
MAKEFILE= Makefile
AR= ar r
PERL= perl
CFLAGS= $(INCLUDES) $(CFLAG)
GENERAL=Makefile README
TEST=
APPS=
LIB=$(TOP)/libcrypto.a
LIBSRC= o_names.c obj_dat.c obj_lib.c obj_err.c obj_xref.c
LIBOBJ= o_names.o obj_dat.o obj_lib.o obj_err.o obj_xref.o
SRC= $(LIBSRC)
EXHEADER= objects.h obj_mac.h
HEADER= $(EXHEADER) obj_dat.h obj_xref.h
ALL= $(GENERAL) $(SRC) $(HEADER)
top:
(cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
all: obj_dat.h obj_xref.h lib
lib: $(LIBOBJ)
$(AR) $(LIB) $(LIBOBJ)
$(RANLIB) $(LIB) || echo Never mind.
@touch lib
obj_dat.h: obj_dat.pl obj_mac.h
$(PERL) obj_dat.pl obj_mac.h obj_dat.h
# objects.pl both reads and writes obj_mac.num
obj_mac.h: objects.pl objects.txt obj_mac.num
$(PERL) objects.pl objects.txt obj_mac.num obj_mac.h
@sleep 1; touch obj_mac.h; sleep 1
obj_xref.h: objxref.pl obj_xref.txt obj_mac.num
$(PERL) objxref.pl obj_mac.num obj_xref.txt > obj_xref.h
@sleep 1; touch obj_xref.h; sleep 1
files:
$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
links:
@$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
@$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
@$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
install:
@[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
@headerlist="$(EXHEADER)"; for i in $$headerlist ; \
do \
(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
done;
tags:
ctags $(SRC)
tests:
lint:
lint -DLINT $(INCLUDES) $(SRC)>fluff
update: obj_dat.h obj_mac.h obj_xref.h depend
depend:
@[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
$(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
dclean:
$(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
mv -f Makefile.new $(MAKEFILE)
clean:
rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
# DO NOT DELETE THIS LINE -- make depend depends on it.
o_names.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
o_names.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
o_names.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
o_names.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
o_names.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
o_names.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
o_names.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
o_names.o: o_names.c
obj_dat.o: ../../e_os.h ../../include/openssl/asn1.h
obj_dat.o: ../../include/openssl/bio.h ../../include/openssl/bn.h
obj_dat.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
obj_dat.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
obj_dat.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
obj_dat.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
obj_dat.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
obj_dat.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
obj_dat.o: ../../include/openssl/symhacks.h ../cryptlib.h obj_dat.c obj_dat.h
obj_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
obj_err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
obj_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
obj_err.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
obj_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
obj_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
obj_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
obj_err.o: obj_err.c
obj_lib.o: ../../e_os.h ../../include/openssl/asn1.h
obj_lib.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
obj_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
obj_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
obj_lib.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
obj_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
obj_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
obj_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
obj_lib.o: ../cryptlib.h obj_lib.c
obj_xref.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
obj_xref.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
obj_xref.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h
obj_xref.o: ../../include/openssl/opensslconf.h
obj_xref.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
obj_xref.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
obj_xref.o: ../../include/openssl/symhacks.h obj_xref.c obj_xref.h

View File

@@ -0,0 +1,3 @@
LIBS=../../libcrypto
SOURCE[../../libcrypto]=\
o_names.c obj_dat.c obj_lib.c obj_err.c obj_xref.c

View File

@@ -1,3 +1,12 @@
/*
* Copyright 1998-2016 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
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -7,35 +16,40 @@
#include <openssl/objects.h>
#include <openssl/safestack.h>
#include <openssl/e_os2.h>
#include "obj_lcl.h"
/*
* Later versions of DEC C has started to add lnkage information to certain
* functions, which makes it tricky to use them as values to regular function
* pointers. One way is to define a macro that takes care of casting them
* correctly.
* We define this wrapper for two reasons. Firstly, later versions of
* DEC C add linkage information to certain functions, which makes it
* tricky to use them as values to regular function pointers.
* Secondly, in the EDK2 build environment, the strcmp function is
* actually an external function (AsciiStrCmp) with the Microsoft ABI,
* so we can't transparently assign function pointers to it.
* Arguably the latter is a stupidity of the UEFI environment, but
* since the wrapper solves the DEC C issue too, let's just use the
* same solution.
*/
#ifdef OPENSSL_SYS_VMS_DECC
# define OPENSSL_strcmp (int (*)(const char *,const char *))strcmp
#if defined(OPENSSL_SYS_VMS_DECC) || defined(OPENSSL_SYS_UEFI)
static int obj_strcmp(const char *a, const char *b)
{
return strcmp(a, b);
}
#else
# define OPENSSL_strcmp strcmp
#define obj_strcmp strcmp
#endif
/*
* I use the ex_data stuff to manage the identifiers for the obj_name_types
* that applications may define. I only really use the free function field.
*/
DECLARE_LHASH_OF(OBJ_NAME);
static LHASH_OF(OBJ_NAME) *names_lh = NULL;
static int names_type_num = OBJ_NAME_TYPE_NUM;
typedef struct name_funcs_st {
struct name_funcs_st {
unsigned long (*hash_func) (const char *name);
int (*cmp_func) (const char *a, const char *b);
void (*free_func) (const char *, int, const char *);
} NAME_FUNCS;
DECLARE_STACK_OF(NAME_FUNCS)
IMPLEMENT_STACK_OF(NAME_FUNCS)
};
static STACK_OF(NAME_FUNCS) *name_funcs_stack;
@@ -45,21 +59,16 @@ static STACK_OF(NAME_FUNCS) *name_funcs_stack;
* casting without the need for macro-generated wrapper functions.
*/
/* static unsigned long obj_name_hash(OBJ_NAME *a); */
static unsigned long obj_name_hash(const void *a_void);
/* static int obj_name_cmp(OBJ_NAME *a,OBJ_NAME *b); */
static int obj_name_cmp(const void *a_void, const void *b_void);
static IMPLEMENT_LHASH_HASH_FN(obj_name, OBJ_NAME)
static IMPLEMENT_LHASH_COMP_FN(obj_name, OBJ_NAME)
static unsigned long obj_name_hash(const OBJ_NAME *a);
static int obj_name_cmp(const OBJ_NAME *a, const OBJ_NAME *b);
int OBJ_NAME_init(void)
{
if (names_lh != NULL)
return (1);
MemCheck_off();
names_lh = lh_OBJ_NAME_new();
MemCheck_on();
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
names_lh = lh_OBJ_NAME_new(obj_name_hash, obj_name_cmp);
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
return (names_lh != NULL);
}
@@ -67,14 +76,13 @@ int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *),
int (*cmp_func) (const char *, const char *),
void (*free_func) (const char *, int, const char *))
{
int ret;
int i;
int ret, i, push;
NAME_FUNCS *name_funcs;
if (name_funcs_stack == NULL) {
MemCheck_off();
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
name_funcs_stack = sk_NAME_FUNCS_new_null();
MemCheck_on();
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
}
if (name_funcs_stack == NULL) {
/* ERROR */
@@ -83,22 +91,25 @@ int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *),
ret = names_type_num;
names_type_num++;
for (i = sk_NAME_FUNCS_num(name_funcs_stack); i < names_type_num; i++) {
MemCheck_off();
name_funcs = OPENSSL_malloc(sizeof(NAME_FUNCS));
MemCheck_on();
if (!name_funcs) {
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
name_funcs = OPENSSL_zalloc(sizeof(*name_funcs));
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
if (name_funcs == NULL) {
OBJerr(OBJ_F_OBJ_NAME_NEW_INDEX, ERR_R_MALLOC_FAILURE);
return (0);
}
name_funcs->hash_func = lh_strhash;
name_funcs->cmp_func = OPENSSL_strcmp;
name_funcs->free_func = 0; /* NULL is often declared to * ((void
* *)0), which according * to Compaq C is
* not really * compatible with a function
* * pointer. -- Richard Levitte */
MemCheck_off();
sk_NAME_FUNCS_push(name_funcs_stack, name_funcs);
MemCheck_on();
name_funcs->hash_func = OPENSSL_LH_strhash;
name_funcs->cmp_func = obj_strcmp;
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE);
push = sk_NAME_FUNCS_push(name_funcs_stack, name_funcs);
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE);
if (!push) {
OBJerr(OBJ_F_OBJ_NAME_NEW_INDEX, ERR_R_MALLOC_FAILURE);
OPENSSL_free(name_funcs);
return 0;
}
}
name_funcs = sk_NAME_FUNCS_value(name_funcs_stack, ret);
if (hash_func != NULL)
@@ -110,12 +121,9 @@ int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *),
return (ret);
}
/* static int obj_name_cmp(OBJ_NAME *a, OBJ_NAME *b) */
static int obj_name_cmp(const void *a_void, const void *b_void)
static int obj_name_cmp(const OBJ_NAME *a, const OBJ_NAME *b)
{
int ret;
const OBJ_NAME *a = (const OBJ_NAME *)a_void;
const OBJ_NAME *b = (const OBJ_NAME *)b_void;
ret = a->type - b->type;
if (ret == 0) {
@@ -129,11 +137,9 @@ static int obj_name_cmp(const void *a_void, const void *b_void)
return (ret);
}
/* static unsigned long obj_name_hash(OBJ_NAME *a) */
static unsigned long obj_name_hash(const void *a_void)
static unsigned long obj_name_hash(const OBJ_NAME *a)
{
unsigned long ret;
const OBJ_NAME *a = (const OBJ_NAME *)a_void;
if ((name_funcs_stack != NULL)
&& (sk_NAME_FUNCS_num(name_funcs_stack) > a->type)) {
@@ -141,7 +147,7 @@ static unsigned long obj_name_hash(const void *a_void)
sk_NAME_FUNCS_value(name_funcs_stack,
a->type)->hash_func(a->name);
} else {
ret = lh_strhash(a->name);
ret = OPENSSL_LH_strhash(a->name);
}
ret ^= a->type;
return (ret);
@@ -188,7 +194,7 @@ int OBJ_NAME_add(const char *name, int type, const char *data)
alias = type & OBJ_NAME_ALIAS;
type &= ~OBJ_NAME_ALIAS;
onp = (OBJ_NAME *)OPENSSL_malloc(sizeof(OBJ_NAME));
onp = OPENSSL_malloc(sizeof(*onp));
if (onp == NULL) {
/* ERROR */
return 0;
@@ -252,31 +258,30 @@ int OBJ_NAME_remove(const char *name, int type)
return (0);
}
struct doall {
typedef struct {
int type;
void (*fn) (const OBJ_NAME *, void *arg);
void *arg;
};
} OBJ_DOALL;
static void do_all_fn_doall_arg(const OBJ_NAME *name, struct doall *d)
static void do_all_fn(const OBJ_NAME *name, OBJ_DOALL *d)
{
if (name->type == d->type)
d->fn(name, d->arg);
}
static IMPLEMENT_LHASH_DOALL_ARG_FN(do_all_fn, const OBJ_NAME, struct doall)
IMPLEMENT_LHASH_DOALL_ARG_CONST(OBJ_NAME, OBJ_DOALL);
void OBJ_NAME_do_all(int type, void (*fn) (const OBJ_NAME *, void *arg),
void *arg)
{
struct doall d;
OBJ_DOALL d;
d.type = type;
d.fn = fn;
d.arg = arg;
lh_OBJ_NAME_doall_arg(names_lh, LHASH_DOALL_ARG_FN(do_all_fn),
struct doall, &d);
lh_OBJ_NAME_doall_OBJ_DOALL(names_lh, do_all_fn, &d);
}
struct doall_sorted {
@@ -312,13 +317,13 @@ void OBJ_NAME_do_all_sorted(int type,
d.type = type;
d.names =
OPENSSL_malloc(lh_OBJ_NAME_num_items(names_lh) * sizeof *d.names);
OPENSSL_malloc(sizeof(*d.names) * lh_OBJ_NAME_num_items(names_lh));
/* Really should return an error if !d.names...but its a void function! */
if (d.names) {
if (d.names != NULL) {
d.n = 0;
OBJ_NAME_do_all(type, do_all_sorted_fn, &d);
qsort((void *)d.names, d.n, sizeof *d.names, do_all_sorted_cmp);
qsort((void *)d.names, d.n, sizeof(*d.names), do_all_sorted_cmp);
for (n = 0; n < d.n; ++n)
fn(d.names[n], arg);
@@ -338,8 +343,6 @@ static void names_lh_free_doall(OBJ_NAME *onp)
OBJ_NAME_remove(onp->name, onp->type);
}
static IMPLEMENT_LHASH_DOALL_FN(names_lh_free, OBJ_NAME)
static void name_funcs_free(NAME_FUNCS *ptr)
{
OPENSSL_free(ptr);
@@ -353,15 +356,15 @@ void OBJ_NAME_cleanup(int type)
return;
free_type = type;
down_load = lh_OBJ_NAME_down_load(names_lh);
lh_OBJ_NAME_down_load(names_lh) = 0;
down_load = lh_OBJ_NAME_get_down_load(names_lh);
lh_OBJ_NAME_set_down_load(names_lh, 0);
lh_OBJ_NAME_doall(names_lh, LHASH_DOALL_FN(names_lh_free));
lh_OBJ_NAME_doall(names_lh, names_lh_free_doall);
if (type < 0) {
lh_OBJ_NAME_free(names_lh);
sk_NAME_FUNCS_pop_free(name_funcs_stack, name_funcs_free);
names_lh = NULL;
name_funcs_stack = NULL;
} else
lh_OBJ_NAME_down_load(names_lh) = down_load;
lh_OBJ_NAME_set_down_load(names_lh, down_load);
}

View File

@@ -1,85 +1,25 @@
/* crypto/objects/obj_dat.c */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
/*
* Copyright 1995-2016 The OpenSSL Project Authors. 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.]
* 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
*/
#include <stdio.h>
#include <ctype.h>
#include <limits.h>
#include "cryptlib.h"
#include "internal/cryptlib.h"
#include <openssl/lhash.h>
#include <openssl/asn1.h>
#include <openssl/objects.h>
#include "internal/objects.h"
#include <openssl/bn.h>
#include "internal/asn1_int.h"
#include "obj_lcl.h"
/* obj_dat.h is generated from objects.h by obj_dat.pl */
#ifndef OPENSSL_NO_OBJECT
# include "obj_dat.h"
#else
/* You will have to load all the objects needed manually in the application */
# define NUM_NID 0
# define NUM_SN 0
# define NUM_LN 0
# define NUM_OBJ 0
static const unsigned char lvalues[1];
static const ASN1_OBJECT nid_objs[1];
static const unsigned int sn_objs[1];
static const unsigned int ln_objs[1];
static const unsigned int obj_objs[1];
#endif
#include "obj_dat.h"
DECLARE_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, sn);
DECLARE_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, ln);
@@ -90,11 +30,10 @@ DECLARE_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, obj);
#define ADDED_LNAME 2
#define ADDED_NID 3
typedef struct added_obj_st {
struct added_obj_st {
int type;
ASN1_OBJECT *obj;
} ADDED_OBJ;
DECLARE_LHASH_OF(ADDED_OBJ);
};
static int new_nid = NUM_NID;
static LHASH_OF(ADDED_OBJ) *added = NULL;
@@ -129,10 +68,10 @@ static unsigned long added_obj_hash(const ADDED_OBJ *ca)
ret ^= p[i] << ((i * 3) % 24);
break;
case ADDED_SNAME:
ret = lh_strhash(a->sn);
ret = OPENSSL_LH_strhash(a->sn);
break;
case ADDED_LNAME:
ret = lh_strhash(a->ln);
ret = OPENSSL_LH_strhash(a->ln);
break;
case ADDED_NID:
ret = a->nid;
@@ -146,8 +85,6 @@ static unsigned long added_obj_hash(const ADDED_OBJ *ca)
return (ret);
}
static IMPLEMENT_LHASH_HASH_FN(added_obj, ADDED_OBJ)
static int added_obj_cmp(const ADDED_OBJ *ca, const ADDED_OBJ *cb)
{
ASN1_OBJECT *a, *b;
@@ -186,13 +123,11 @@ static int added_obj_cmp(const ADDED_OBJ *ca, const ADDED_OBJ *cb)
}
}
static IMPLEMENT_LHASH_COMP_FN(added_obj, ADDED_OBJ)
static int init_added(void)
{
if (added != NULL)
return (1);
added = lh_ADDED_OBJ_new();
added = lh_ADDED_OBJ_new(added_obj_hash, added_obj_cmp);
return (added != NULL);
}
@@ -215,34 +150,14 @@ static void cleanup3_doall(ADDED_OBJ *a)
OPENSSL_free(a);
}
static IMPLEMENT_LHASH_DOALL_FN(cleanup1, ADDED_OBJ)
static IMPLEMENT_LHASH_DOALL_FN(cleanup2, ADDED_OBJ)
static IMPLEMENT_LHASH_DOALL_FN(cleanup3, ADDED_OBJ)
/*
* The purpose of obj_cleanup_defer is to avoid EVP_cleanup() attempting to
* use freed up OIDs. If neccessary the actual freeing up of OIDs is delayed.
*/
int obj_cleanup_defer = 0;
void check_defer(int nid)
void obj_cleanup_int(void)
{
if (!obj_cleanup_defer && nid >= NUM_NID)
obj_cleanup_defer = 1;
}
void OBJ_cleanup(void)
{
if (obj_cleanup_defer) {
obj_cleanup_defer = 2;
return;
}
if (added == NULL)
return;
lh_ADDED_OBJ_down_load(added) = 0;
lh_ADDED_OBJ_doall(added, LHASH_DOALL_FN(cleanup1)); /* zero counters */
lh_ADDED_OBJ_doall(added, LHASH_DOALL_FN(cleanup2)); /* set counters */
lh_ADDED_OBJ_doall(added, LHASH_DOALL_FN(cleanup3)); /* free objects */
lh_ADDED_OBJ_set_down_load(added, 0);
lh_ADDED_OBJ_doall(added, cleanup1_doall); /* zero counters */
lh_ADDED_OBJ_doall(added, cleanup2_doall); /* set counters */
lh_ADDED_OBJ_doall(added, cleanup3_doall); /* free objects */
lh_ADDED_OBJ_free(added);
added = NULL;
}
@@ -267,21 +182,16 @@ int OBJ_add_object(const ASN1_OBJECT *obj)
return (0);
if ((o = OBJ_dup(obj)) == NULL)
goto err;
if (!(ao[ADDED_NID] = (ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ))))
if ((ao[ADDED_NID] = OPENSSL_malloc(sizeof(*ao[0]))) == NULL)
goto err2;
if ((o->length != 0) && (obj->data != NULL))
if (!
(ao[ADDED_DATA] = (ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ))))
if ((ao[ADDED_DATA] = OPENSSL_malloc(sizeof(*ao[0]))) == NULL)
goto err2;
if (o->sn != NULL)
if (!
(ao[ADDED_SNAME] =
(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ))))
if ((ao[ADDED_SNAME] = OPENSSL_malloc(sizeof(*ao[0]))) == NULL)
goto err2;
if (o->ln != NULL)
if (!
(ao[ADDED_LNAME] =
(ADDED_OBJ *)OPENSSL_malloc(sizeof(ADDED_OBJ))))
if ((ao[ADDED_LNAME] = OPENSSL_malloc(sizeof(*ao[0]))) == NULL)
goto err2;
for (i = ADDED_DATA; i <= ADDED_NID; i++) {
@@ -289,9 +199,8 @@ int OBJ_add_object(const ASN1_OBJECT *obj)
ao[i]->type = i;
ao[i]->obj = o;
aop = lh_ADDED_OBJ_insert(added, ao[i]);
/* memory leak, buit should not normally matter */
if (aop != NULL)
OPENSSL_free(aop);
/* memory leak, but should not normally matter */
OPENSSL_free(aop);
}
}
o->flags &=
@@ -303,10 +212,8 @@ int OBJ_add_object(const ASN1_OBJECT *obj)
OBJerr(OBJ_F_OBJ_ADD_OBJECT, ERR_R_MALLOC_FAILURE);
err:
for (i = ADDED_DATA; i <= ADDED_NID; i++)
if (ao[i] != NULL)
OPENSSL_free(ao[i]);
if (o != NULL)
OPENSSL_free(o);
OPENSSL_free(ao[i]);
OPENSSL_free(o);
return (NID_undef);
}
@@ -466,8 +373,10 @@ ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name)
}
/* Work out total size */
j = ASN1_object_size(0, i, V_ASN1_OBJECT);
if (j < 0)
return NULL;
if ((buf = (unsigned char *)OPENSSL_malloc(j)) == NULL)
if ((buf = OPENSSL_malloc(j)) == NULL)
return NULL;
p = buf;
@@ -504,7 +413,7 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)
s = OBJ_nid2sn(nid);
if (s) {
if (buf)
BUF_strlcpy(buf, s, buf_len);
OPENSSL_strlcpy(buf, s, buf_len);
n = strlen(s);
return n;
}
@@ -532,7 +441,7 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)
if (!(c & 0x80))
break;
if (!use_bn && (l > (ULONG_MAX >> 7L))) {
if (!bl && !(bl = BN_new()))
if (bl == NULL && (bl = BN_new()) == NULL)
goto err;
if (!BN_set_word(bl, l))
goto err;
@@ -578,7 +487,7 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)
*buf = '\0';
buf_len--;
}
BUF_strlcpy(buf, bndec, buf_len);
OPENSSL_strlcpy(buf, bndec, buf_len);
if (i > buf_len) {
buf += buf_len;
buf_len = 0;
@@ -594,7 +503,7 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)
BIO_snprintf(tbuf, sizeof tbuf, ".%lu", l);
i = strlen(tbuf);
if (buf && (buf_len > 0)) {
BUF_strlcpy(buf, tbuf, buf_len);
OPENSSL_strlcpy(buf, tbuf, buf_len);
if (i > buf_len) {
buf += buf_len;
buf_len = 0;
@@ -608,13 +517,11 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)
}
}
if (bl)
BN_free(bl);
BN_free(bl);
return n;
err:
if (bl)
BN_free(bl);
BN_free(bl);
return -1;
}
@@ -727,7 +634,7 @@ const void *OBJ_bsearch_ex_(const void *key, const void *base_, int num,
int OBJ_create_objects(BIO *in)
{
MS_STATIC char buf[512];
char buf[512];
int i, num = 0;
char *o, *s, *l = NULL;
@@ -774,28 +681,50 @@ int OBJ_create_objects(BIO *in)
int OBJ_create(const char *oid, const char *sn, const char *ln)
{
ASN1_OBJECT *tmpoid = NULL;
int ok = 0;
ASN1_OBJECT *op = NULL;
unsigned char *buf;
int i;
i = a2d_ASN1_OBJECT(NULL, 0, oid, -1);
if (i <= 0)
return (0);
if ((buf = (unsigned char *)OPENSSL_malloc(i)) == NULL) {
OBJerr(OBJ_F_OBJ_CREATE, ERR_R_MALLOC_FAILURE);
return (0);
/* Check to see if short or long name already present */
if (OBJ_sn2nid(sn) != NID_undef || OBJ_ln2nid(ln) != NID_undef) {
OBJerr(OBJ_F_OBJ_CREATE, OBJ_R_OID_EXISTS);
return 0;
}
i = a2d_ASN1_OBJECT(buf, i, oid, -1);
if (i == 0)
/* Convert numerical OID string to an ASN1_OBJECT structure */
tmpoid = OBJ_txt2obj(oid, 1);
if (tmpoid == NULL)
return 0;
/* If NID is not NID_undef then object already exists */
if (OBJ_obj2nid(tmpoid) != NID_undef) {
OBJerr(OBJ_F_OBJ_CREATE, OBJ_R_OID_EXISTS);
goto err;
op = (ASN1_OBJECT *)ASN1_OBJECT_create(OBJ_new_nid(1), buf, i, sn, ln);
if (op == NULL)
goto err;
ok = OBJ_add_object(op);
}
tmpoid->nid = OBJ_new_nid(1);
tmpoid->sn = (char *)sn;
tmpoid->ln = (char *)ln;
ok = OBJ_add_object(tmpoid);
tmpoid->sn = NULL;
tmpoid->ln = NULL;
err:
ASN1_OBJECT_free(op);
OPENSSL_free(buf);
return (ok);
ASN1_OBJECT_free(tmpoid);
return ok;
}
size_t OBJ_length(const ASN1_OBJECT *obj)
{
if (obj == NULL)
return 0;
return obj->length;
}
const unsigned char *OBJ_get0_data(const ASN1_OBJECT *obj)
{
if (obj == NULL)
return NULL;
return obj->data;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,307 +1,227 @@
#!/usr/local/bin/perl
#! /usr/bin/env perl
# Copyright 1995-2016 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
# fixes bug in floating point emulation on sparc64 when
# this script produces off-by-one output on sparc64
use integer;
use strict;
use warnings;
sub obj_cmp
{
local(@a,@b,$_,$r);
# Generate the DER encoding for the given OID.
sub der_it
{
# Prologue
my ($v) = @_;
my @a = split(/\s+/, $v);
my $ret = pack("C*", $a[0] * 40 + $a[1]);
shift @a;
shift @a;
$A=$obj_len{$obj{$nid{$a}}};
$B=$obj_len{$obj{$nid{$b}}};
# Loop over rest of bytes; or in 0x80 for multi-byte numbers.
my $t;
foreach (@a) {
my @r = ();
$t = 0;
while ($_ >= 128) {
my $x = $_ % 128;
$_ /= 128;
push(@r, ($t++ ? 0x80 : 0) | $x);
}
push(@r, ($t++ ? 0x80 : 0) | $_);
$ret .= pack("C*", reverse(@r));
}
return $ret;
}
$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;
}
}
# Read input, parse all #define's into OID name and value.
# Populate %ln and %sn with long and short names (%dupln and %dupsn)
# are used to watch for duplicates. Also %nid and %obj get the
# NID and OBJ entries.
my %ln;
my %sn;
my %dupln;
my %dupsn;
my %nid;
my %obj;
my %objd;
open(IN, "$ARGV[0]") || die "Can't open input file $ARGV[0], $!";
while (<IN>) {
next unless /^\#define\s+(\S+)\s+(.*)$/;
my $v = $1;
my $d = $2;
$d =~ s/^\"//;
$d =~ s/\"$//;
if ($v =~ /^SN_(.*)$/) {
if (defined $dupsn{$d}) {
print "WARNING: Duplicate short name \"$d\"\n";
} else {
$dupsn{$d} = 1;
}
$sn{$1} = $d;
}
elsif ($v =~ /^LN_(.*)$/) {
if (defined $dupln{$d}) {
print "WARNING: Duplicate long name \"$d\"\n";
} else {
$dupln{$d} = 1;
}
$ln{$1} = $d;
}
elsif ($v =~ /^NID_(.*)$/) {
$nid{$d} = $1;
}
elsif ($v =~ /^OBJ_(.*)$/) {
$obj{$1} = $v;
$objd{$v} = $d;
}
}
close IN;
%ob=&expand_obj(*objd);
# For every value in %obj, recursively expand OBJ_xxx values. That is:
# #define OBJ_iso 1L
# #define OBJ_identified_organization OBJ_iso,3L
# Modify %objd values in-place. Create an %objn array that has
my $changed;
do {
$changed = 0;
foreach my $k (keys %objd) {
$changed = 1 if $objd{$k} =~ s/(OBJ_[^,]+),/$objd{$1},/;
}
} while ($changed);
@a=sort { $a <=> $b } keys %nid;
$n=$a[$#a]+1;
my @a = sort { $a <=> $b } keys %nid;
my $n = $a[$#a] + 1;
my @lvalues = ();
my $lvalues = 0;
@lvalues=();
$lvalues=0;
# Scan all defined objects, building up the @out array.
# %obj_der holds the DER encoding as an array of bytes, and %obj_len
# holds the length in bytes.
my @out;
my %obj_der;
my %obj_len;
for (my $i = 0; $i < $n; $i++) {
if (!defined $nid{$i}) {
push(@out, " { NULL, NULL, NID_undef },\n");
next;
}
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";
my $sn = defined $sn{$nid{$i}} ? "$sn{$nid{$i}}" : "NULL";
my $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;
}
if ($sn eq "NULL") {
$sn=$ln;
$sn{$nid{$i}} = $ln;
}
my $out = " {\"$sn\", \"$ln\", NID_$nid{$i}";
if (defined $obj{$nid{$i}} && $objd{$obj{$nid{$i}}} =~ /,/) {
my $v = $objd{$obj{$nid{$i}}};
$v =~ s/L//g;
$v =~ s/,/ /g;
my $r = &der_it($v);
my $z = "";
my $length = 0;
# Format using fixed-with because we use strcmp later.
foreach (unpack("C*",$r)) {
$z .= sprintf("0x%02X,", $_);
$length++;
}
$obj_der{$obj{$nid{$i}}} = $z;
$obj_len{$obj{$nid{$i}}} = $length;
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{$_}}),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));
}
push(@lvalues,
sprintf(" %-45s /* [%5d] %s */\n",
$z, $lvalues, $obj{$nid{$i}}));
$out .= ", $length, &so[$lvalues]";
$lvalues += $length;
}
$out .= "},\n";
push(@out, $out);
}
# Finally ready to generate the output.
open(OUT, ">$ARGV[1]") || die "Can't open output file $ARGV[1], $!";
print OUT <<'EOF';
/* crypto/objects/obj_dat.h */
/* THIS FILE IS GENERATED FROM objects.h by obj_dat.pl via the
* following command:
* perl obj_dat.pl obj_mac.h obj_dat.h
*/
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
* All rights reserved.
/*
* WARNING: do not edit!
* Generated by crypto/objects/obj_dat.pl
*
* 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.]
* Copyright 1995-2016 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
*/
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 "/* Serialized OID's */\n";
printf OUT "static const unsigned char so[%d] = {\n", $lvalues + 1;
print OUT @lvalues;
print OUT "};\n\n";
printf OUT "static const ASN1_OBJECT nid_objs[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 $_; }
}
printf OUT "#define NUM_NID %d\n", $n;
printf OUT "static const ASN1_OBJECT nid_objs[NUM_NID] = {\n";
print OUT @out;
print OUT "};\n\n";
printf OUT "static const unsigned int sn_objs[NUM_SN]={\n";
print OUT @sn;
{
no warnings "uninitialized";
@a = grep(defined $sn{$nid{$_}}, 0 .. $n);
}
printf OUT "#define NUM_SN %d\n", $#a + 1;
printf OUT "static const unsigned int sn_objs[NUM_SN] = {\n";
foreach (sort { $sn{$nid{$a}} cmp $sn{$nid{$b}} } @a) {
printf OUT " %4d, /* \"$sn{$nid{$_}}\" */\n", $_;
}
print OUT "};\n\n";
printf OUT "static const unsigned int ln_objs[NUM_LN]={\n";
print OUT @ln;
{
no warnings "uninitialized";
@a = grep(defined $ln{$nid{$_}}, 0 .. $n);
}
printf OUT "#define NUM_LN %d\n", $#a + 1;
printf OUT "static const unsigned int ln_objs[NUM_LN] = {\n";
foreach (sort { $ln{$nid{$a}} cmp $ln{$nid{$b}} } @a) {
printf OUT " %4d, /* \"$ln{$nid{$_}}\" */\n", $_;
}
print OUT "};\n\n";
printf OUT "static const unsigned int obj_objs[NUM_OBJ]={\n";
print OUT @ob;
print OUT "};\n\n";
{
no warnings "uninitialized";
@a = grep(defined $obj{$nid{$_}}, 0 .. $n);
}
printf OUT "#define NUM_OBJ %d\n", $#a + 1;
printf OUT "static const unsigned int obj_objs[NUM_OBJ] = {\n";
# Compare DER; prefer shorter; if some length, use the "smaller" encoding.
sub obj_cmp
{
no warnings "uninitialized";
my $A = $obj_len{$obj{$nid{$a}}};
my $B = $obj_len{$obj{$nid{$b}}};
my $r = $A - $B;
return $r if $r != 0;
$A = $obj_der{$obj{$nid{$a}}};
$B = $obj_der{$obj{$nid{$b}}};
return $A cmp $B;
}
foreach (sort obj_cmp @a) {
my $m = $obj{$nid{$_}};
my $v = $objd{$m};
$v =~ s/L//g;
$v =~ s/,/ /g;
printf OUT " %4d, /* %-32s %s */\n", $_, $m, $v;
}
print OUT "};\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);
}

View File

@@ -1,62 +1,11 @@
/* crypto/objects/obj_err.c */
/* ====================================================================
* Copyright (c) 1999-2006 The OpenSSL Project. All rights reserved.
*
* 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 above 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 acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* openssl-core@OpenSSL.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED 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 OpenSSL PROJECT OR
* ITS 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.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com).
*
*/
/*
* NOTE: this file was auto generated by the mkerr.pl script: any changes
* made to it will be overwritten when the script next updates this file,
* only reason strings will be preserved.
* Generated by util/mkerr.pl DO NOT EDIT
* Copyright 1995-2016 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
*/
#include <stdio.h>
@@ -81,14 +30,14 @@ static ERR_STRING_DATA OBJ_str_functs[] = {
};
static ERR_STRING_DATA OBJ_str_reasons[] = {
{ERR_REASON(OBJ_R_MALLOC_FAILURE), "malloc failure"},
{ERR_REASON(OBJ_R_OID_EXISTS), "oid exists"},
{ERR_REASON(OBJ_R_UNKNOWN_NID), "unknown nid"},
{0, NULL}
};
#endif
void ERR_load_OBJ_strings(void)
int ERR_load_OBJ_strings(void)
{
#ifndef OPENSSL_NO_ERR
@@ -97,4 +46,5 @@ void ERR_load_OBJ_strings(void)
ERR_load_strings(0, OBJ_str_reasons);
}
#endif
return 1;
}

14
crypto/objects/obj_lcl.h Normal file
View File

@@ -0,0 +1,14 @@
/*
* Copyright 2016 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 name_funcs_st NAME_FUNCS;
DEFINE_STACK_OF(NAME_FUNCS)
DEFINE_LHASH_OF(OBJ_NAME);
typedef struct added_obj_st ADDED_OBJ;
DEFINE_LHASH_OF(ADDED_OBJ);

View File

@@ -1,127 +1,58 @@
/* crypto/objects/obj_lib.c */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
/*
* Copyright 1995-2016 The OpenSSL Project Authors. 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.]
* 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
*/
#include <stdio.h>
#include "cryptlib.h"
#include "internal/cryptlib.h"
#include <openssl/lhash.h>
#include <openssl/objects.h>
#include <openssl/buffer.h>
#include "internal/asn1_int.h"
ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o)
{
ASN1_OBJECT *r;
int i;
char *ln = NULL, *sn = NULL;
unsigned char *data = NULL;
if (o == NULL)
return (NULL);
return NULL;
/* If object isn't dynamic it's an internal OID which is never freed */
if (!(o->flags & ASN1_OBJECT_FLAG_DYNAMIC))
return ((ASN1_OBJECT *)o); /* XXX: ugh! Why? What kind of duplication
* is this??? */
return ((ASN1_OBJECT *)o);
r = ASN1_OBJECT_new();
if (r == NULL) {
OBJerr(OBJ_F_OBJ_DUP, ERR_R_ASN1_LIB);
return (NULL);
}
data = OPENSSL_malloc(o->length);
if (data == NULL)
goto err;
if (o->data != NULL)
memcpy(data, o->data, o->length);
/* once data attached to object it remains const */
r->data = data;
r->length = o->length;
r->nid = o->nid;
r->ln = r->sn = NULL;
if (o->ln != NULL) {
i = strlen(o->ln) + 1;
ln = OPENSSL_malloc(i);
if (ln == NULL)
goto err;
memcpy(ln, o->ln, i);
r->ln = ln;
}
if (o->sn != NULL) {
i = strlen(o->sn) + 1;
sn = OPENSSL_malloc(i);
if (sn == NULL)
goto err;
memcpy(sn, o->sn, i);
r->sn = sn;
}
/* Set dynamic flags so everything gets freed up on error */
r->flags = o->flags | (ASN1_OBJECT_FLAG_DYNAMIC |
ASN1_OBJECT_FLAG_DYNAMIC_STRINGS |
ASN1_OBJECT_FLAG_DYNAMIC_DATA);
return (r);
if (o->length > 0 && (r->data = OPENSSL_memdup(o->data, o->length)) == NULL)
goto err;
r->length = o->length;
r->nid = o->nid;
if (o->ln != NULL && (r->ln = OPENSSL_strdup(o->ln)) == NULL)
goto err;
if (o->sn != NULL && (r->sn = OPENSSL_strdup(o->sn)) == NULL)
goto err;
return r;
err:
ASN1_OBJECT_free(r);
OBJerr(OBJ_F_OBJ_DUP, ERR_R_MALLOC_FAILURE);
if (ln != NULL)
OPENSSL_free(ln);
if (sn != NULL)
OPENSSL_free(sn);
if (data != NULL)
OPENSSL_free(data);
if (r != NULL)
OPENSSL_free(r);
return (NULL);
return NULL;
}
int OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b)

File diff suppressed because it is too large Load Diff

View File

@@ -955,3 +955,106 @@ ct_cert_scts 954
jurisdictionLocalityName 955
jurisdictionStateOrProvinceName 956
jurisdictionCountryName 957
aes_128_ocb 958
aes_192_ocb 959
aes_256_ocb 960
camellia_128_gcm 961
camellia_128_ccm 962
camellia_128_ctr 963
camellia_128_cmac 964
camellia_192_gcm 965
camellia_192_ccm 966
camellia_192_ctr 967
camellia_192_cmac 968
camellia_256_gcm 969
camellia_256_ccm 970
camellia_256_ctr 971
camellia_256_cmac 972
id_scrypt 973
id_tc26 974
gost89_cnt_12 975
gost_mac_12 976
id_tc26_algorithms 977
id_tc26_sign 978
id_GostR3410_2012_256 979
id_GostR3410_2012_512 980
id_tc26_digest 981
id_GostR3411_2012_256 982
id_GostR3411_2012_512 983
id_tc26_signwithdigest 984
id_tc26_signwithdigest_gost3410_2012_256 985
id_tc26_signwithdigest_gost3410_2012_512 986
id_tc26_mac 987
id_tc26_hmac_gost_3411_2012_256 988
id_tc26_hmac_gost_3411_2012_512 989
id_tc26_cipher 990
id_tc26_agreement 991
id_tc26_agreement_gost_3410_2012_256 992
id_tc26_agreement_gost_3410_2012_512 993
id_tc26_constants 994
id_tc26_sign_constants 995
id_tc26_gost_3410_2012_512_constants 996
id_tc26_gost_3410_2012_512_paramSetTest 997
id_tc26_gost_3410_2012_512_paramSetA 998
id_tc26_gost_3410_2012_512_paramSetB 999
id_tc26_digest_constants 1000
id_tc26_cipher_constants 1001
id_tc26_gost_28147_constants 1002
id_tc26_gost_28147_param_Z 1003
INN 1004
OGRN 1005
SNILS 1006
subjectSignTool 1007
issuerSignTool 1008
gost89_cbc 1009
gost89_ecb 1010
gost89_ctr 1011
grasshopper_ecb 1012
grasshopper_ctr 1013
grasshopper_ofb 1014
grasshopper_cbc 1015
grasshopper_cfb 1016
grasshopper_mac 1017
chacha20_poly1305 1018
chacha20 1019
tlsfeature 1020
tls1_prf 1021
ipsec_IKE 1022
capwapAC 1023
capwapWTP 1024
sshClient 1025
sshServer 1026
sendRouter 1027
sendProxiedRouter 1028
sendOwner 1029
sendProxiedOwner 1030
id_pkinit 1031
pkInitClientAuth 1032
pkInitKDC 1033
X25519 1034
X448 1035
hkdf 1036
kx_rsa 1037
kx_ecdhe 1038
kx_dhe 1039
kx_ecdhe_psk 1040
kx_dhe_psk 1041
kx_rsa_psk 1042
kx_psk 1043
kx_srp 1044
kx_gost 1045
auth_rsa 1046
auth_ecdsa 1047
auth_psk 1048
auth_dss 1049
auth_gost01 1050
auth_gost12 1051
auth_srp 1052
auth_null 1053
fips_none 1054
fips_140_2 1055
blake2b512 1056
blake2s256 1057
id_smime_ct_contentCollection 1058
id_smime_ct_authEnvelopedData 1059
id_ct_xml 1060

View File

@@ -1,67 +1,17 @@
/* crypto/objects/obj_xref.c */
/*
* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
* 2006.
*/
/* ====================================================================
* Copyright (c) 2006 The OpenSSL Project. All rights reserved.
*
* 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 above 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 acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
*
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* licensing@OpenSSL.org.
*
* 5. Products derived from this software may not be called "OpenSSL"
* nor may "OpenSSL" appear in their names without prior written
* permission of the OpenSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
* EXPRESSED 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 OpenSSL PROJECT OR
* ITS 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.
* ====================================================================
*
* This product includes cryptographic software written by Eric Young
* (eay@cryptsoft.com). This product includes software written by Tim
* Hudson (tjh@cryptsoft.com).
* Copyright 2006-2016 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
*/
#include <openssl/objects.h>
#include "obj_xref.h"
#include "e_os.h"
DECLARE_STACK_OF(nid_triple)
STACK_OF(nid_triple) *sig_app, *sigx_app;
static STACK_OF(nid_triple) *sig_app, *sigx_app;
static int sig_cmp(const nid_triple *a, const nid_triple *b)
{
@@ -102,8 +52,7 @@ int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid)
}
#ifndef OBJ_XREF_TEST2
if (rv == NULL) {
rv = OBJ_bsearch_sig(&tmp, sigoid_srt,
sizeof(sigoid_srt) / sizeof(nid_triple));
rv = OBJ_bsearch_sig(&tmp, sigoid_srt, OSSL_NELEM(sigoid_srt));
}
#endif
if (rv == NULL)
@@ -133,9 +82,7 @@ int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid)
}
#ifndef OBJ_XREF_TEST2
if (rv == NULL) {
rv = OBJ_bsearch_sigx(&t, sigoid_srt_xref,
sizeof(sigoid_srt_xref) / sizeof(nid_triple *)
);
rv = OBJ_bsearch_sigx(&t, sigoid_srt_xref, OSSL_NELEM(sigoid_srt_xref));
}
#endif
if (rv == NULL)
@@ -148,16 +95,16 @@ int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid)
int OBJ_add_sigid(int signid, int dig_id, int pkey_id)
{
nid_triple *ntr;
if (!sig_app)
if (sig_app == NULL)
sig_app = sk_nid_triple_new(sig_sk_cmp);
if (!sig_app)
if (sig_app == NULL)
return 0;
if (!sigx_app)
if (sigx_app == NULL)
sigx_app = sk_nid_triple_new(sigx_cmp);
if (!sigx_app)
if (sigx_app == NULL)
return 0;
ntr = OPENSSL_malloc(sizeof(int) * 3);
if (!ntr)
ntr = OPENSSL_malloc(sizeof(*ntr));
if (ntr == NULL)
return 0;
ntr->sign_id = signid;
ntr->hash_id = dig_id;
@@ -184,14 +131,10 @@ static void sid_free(nid_triple *tt)
void OBJ_sigid_free(void)
{
if (sig_app) {
sk_nid_triple_pop_free(sig_app, sid_free);
sig_app = NULL;
}
if (sigx_app) {
sk_nid_triple_free(sigx_app);
sigx_app = NULL;
}
sk_nid_triple_pop_free(sig_app, sid_free);
sig_app = NULL;
sk_nid_triple_free(sigx_app);
sigx_app = NULL;
}
#ifdef OBJ_XREF_TEST
@@ -202,12 +145,12 @@ main()
int i, rv;
# ifdef OBJ_XREF_TEST2
for (i = 0; i < sizeof(sigoid_srt) / sizeof(nid_triple); i++) {
for (i = 0; i < OSSL_NELEM(sigoid_srt); i++) {
OBJ_add_sigid(sigoid_srt[i][0], sigoid_srt[i][1], sigoid_srt[i][2]);
}
# endif
for (i = 0; i < sizeof(sigoid_srt) / sizeof(nid_triple); i++) {
for (i = 0; i < OSSL_NELEM(sigoid_srt); i++) {
n1 = sigoid_srt[i][0];
rv = OBJ_find_sigid_algs(n1, &n2, &n3);
printf("Forward: %d, %s %s %s\n", rv,

View File

@@ -1,4 +1,15 @@
/* AUTOGENERATED BY objxref.pl, DO NOT EDIT */
/*
* WARNING: do not edit!
* Generated by objxref.pl
*
* Copyright 1998-2016 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;
@@ -6,6 +17,8 @@ typedef struct {
int pkey_id;
} nid_triple;
DEFINE_STACK_OF(nid_triple)
static const nid_triple sigoid_srt[] = {
{NID_md2WithRSAEncryption, NID_md2, NID_rsaEncryption},
{NID_md5WithRSAEncryption, NID_md5, NID_rsaEncryption},
@@ -56,6 +69,10 @@ static const nid_triple sigoid_srt[] = {
NID_dh_cofactor_kdf},
{NID_dhSinglePass_cofactorDH_sha512kdf_scheme, NID_sha512,
NID_dh_cofactor_kdf},
{NID_id_tc26_signwithdigest_gost3410_2012_256, NID_id_GostR3411_2012_256,
NID_id_GostR3410_2012_256},
{NID_id_tc26_signwithdigest_gost3410_2012_512, NID_id_GostR3411_2012_512,
NID_id_GostR3410_2012_512},
};
static const nid_triple *const sigoid_srt_xref[] = {
@@ -96,4 +113,6 @@ static const nid_triple *const sigoid_srt_xref[] = {
&sigoid_srt[26],
&sigoid_srt[27],
&sigoid_srt[28],
&sigoid_srt[40],
&sigoid_srt[41],
};

View File

@@ -44,6 +44,8 @@ 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
id_tc26_signwithdigest_gost3410_2012_256 id_GostR3411_2012_256 id_GostR3410_2012_256
id_tc26_signwithdigest_gost3410_2012_512 id_GostR3411_2012_512 id_GostR3410_2012_512
# 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

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +1,17 @@
#!/usr/local/bin/perl
#! /usr/bin/env perl
# Copyright 2000-2016 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
open (NUMIN,"$ARGV[1]") || die "Can't open number file $ARGV[1]";
$max_nid=0;
$o=0;
while(<NUMIN>)
{
chop;
s|\R$||;
$o++;
s/#.*$//;
next if /^\s*$/;
@@ -28,7 +34,7 @@ $Cname="";
$o=0;
while (<IN>)
{
chop;
s|\R$||;
$o++;
if (/^!module\s+(.*)$/)
{
@@ -119,68 +125,15 @@ close NUMOUT;
open (OUT,">$ARGV[2]") || die "Can't open output file $ARGV[2]";
print OUT <<'EOF';
/* crypto/objects/obj_mac.h */
/*
* THIS FILE IS GENERATED FROM objects.txt by objects.pl via the following
* command: perl objects.pl objects.txt obj_mac.num obj_mac.h
*/
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
* All rights reserved.
* WARNING: do not edit!
* Generated by crypto/objects/objects.pl
*
* 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.]
* Copyright 2000-2016 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
*/
#define SN_undef "UNDEF"

View File

@@ -257,7 +257,10 @@ id-smime-ct 6 : id-smime-ct-contentInfo
id-smime-ct 7 : id-smime-ct-DVCSRequestData
id-smime-ct 8 : id-smime-ct-DVCSResponseData
id-smime-ct 9 : id-smime-ct-compressedData
id-smime-ct 19 : id-smime-ct-contentCollection
id-smime-ct 23 : id-smime-ct-authEnvelopedData
id-smime-ct 27 : id-ct-asciiTextWithCRLF
id-smime-ct 28 : id-ct-xml
# S/MIME Attributes
id-smime-aa 1 : id-smime-aa-receiptRequest
@@ -472,6 +475,7 @@ id-pe 10 : ac-proxying
!Cname sinfo-access
id-pe 11 : subjectInfoAccess : Subject Information Access
id-pe 14 : proxyCertInfo : Proxy Certificate Information
id-pe 24 : tlsfeature : TLS Feature
# PKIX policyQualifiers for Internet policy qualifiers
id-qt 1 : id-qt-cps : Policy Qualifier CPS
@@ -496,6 +500,18 @@ id-kp 8 : timeStamping : Time Stamping
!Cname OCSP-sign
id-kp 9 : OCSPSigning : OCSP Signing
id-kp 10 : DVCS : dvcs
!Cname ipsec-IKE
id-kp 17 : ipsecIKE : ipsec Internet Key Exchange
id-kp 18 : capwapAC : Ctrl/provision WAP Access
id-kp 19 : capwapWTP : Ctrl/Provision WAP Termination
!Cname sshClient
id-kp 21 : secureShellClient : SSH Client
!Cname sshServer
id-kp 22 : secureShellServer : SSH Server
id-kp 23 : sendRouter : Send Router
id-kp 24 : sendProxiedRouter : Send Proxied Router
id-kp 25 : sendOwner : Send Owner
id-kp 26 : sendProxiedOwner : Send Proxied Owner
# CMP information types
id-it 1 : id-it-caProtEncCert
@@ -658,6 +674,9 @@ algorithm 29 : RSA-SHA1-2 : sha1WithRSA
1 3 36 3 2 1 : RIPEMD160 : ripemd160
1 3 36 3 3 1 2 : RSA-RIPEMD160 : ripemd160WithRSA
1 3 6 1 4 1 1722 12 2 1 16 : BLAKE2b512 : blake2b512
1 3 6 1 4 1 1722 12 2 2 8 : BLAKE2s256 : blake2s256
!Cname sxnet
1 3 101 1 4 1 : SXNetID : Strong Extranet ID
@@ -748,7 +767,7 @@ id-ce 24 : invalidityDate : Invalidity Date
!Cname delta-crl
id-ce 27 : deltaCRL : X509v3 Delta CRL Indicator
!Cname issuing-distribution-point
id-ce 28 : issuingDistributionPoint : X509v3 Issuing Distrubution Point
id-ce 28 : issuingDistributionPoint : X509v3 Issuing Distribution Point
!Cname certificate-issuer
id-ce 29 : certificateIssuer : X509v3 Certificate Issuer
!Cname name-constraints
@@ -838,9 +857,7 @@ mime-mhs 2 : mime-mhs-bodies : mime-mhs-bodies
mime-mhs-headings 1 : id-hex-partial-message : id-hex-partial-message
mime-mhs-headings 2 : id-hex-multipart-message : id-hex-multipart-message
# What the hell are these OIDs, really?
!Cname rle-compression
1 1 1 1 666 1 : RLE : run length compression
# RFC 3274
!Cname zlib-compression
id-smime-alg 8 : ZLIB : zlib compression
@@ -894,6 +911,9 @@ aes 48 : id-aes256-wrap-pad
: AES-128-CTR : aes-128-ctr
: AES-192-CTR : aes-192-ctr
: AES-256-CTR : aes-256-ctr
: AES-128-OCB : aes-128-ocb
: AES-192-OCB : aes-192-ocb
: AES-256-OCB : aes-256-ocb
: AES-128-XTS : aes-128-xts
: AES-256-XTS : aes-256-xts
: DES-CFB1 : des-cfb1
@@ -985,8 +1005,7 @@ pilotAttributeType 40 : : personalTitle
pilotAttributeType 41 : : mobileTelephoneNumber
pilotAttributeType 42 : : pagerTelephoneNumber
pilotAttributeType 43 : : friendlyCountryName
# The following clashes with 2.5.4.45, so commented away
#pilotAttributeType 44 : uid : uniqueIdentifier
pilotAttributeType 44 : uid : uniqueIdentifier
pilotAttributeType 45 : : organizationalStatus
pilotAttributeType 46 : : janetMailbox
pilotAttributeType 47 : : mailPreferenceOption
@@ -1156,6 +1175,7 @@ iso 0 10118 3 0 55 : whirlpool
member-body 643 2 2 : cryptopro
member-body 643 2 9 : cryptocom
member-body 643 7 1 : id-tc26
cryptopro 3 : id-GostR3411-94-with-GostR3410-2001 : GOST R 34.11-94 with GOST R 34.10-2001
cryptopro 4 : id-GostR3411-94-with-GostR3410-94 : GOST R 34.11-94 with GOST R 34.10-94
@@ -1169,8 +1189,13 @@ cryptopro 20 : gost94 : GOST R 34.10-94
!Cname id-Gost28147-89
cryptopro 21 : gost89 : GOST 28147-89
: gost89-cnt
: gost89-cnt-12
: gost89-cbc
: gost89-ecb
: gost89-ctr
!Cname id-Gost28147-89-MAC
cryptopro 22 : gost-mac : GOST 28147-89 MAC
: gost-mac-12
!Cname id-GostR3411-94-prf
cryptopro 23 : prf-gostr3411-94 : GOST R 34.11-94 PRF
cryptopro 98 : id-GostR3410-2001DH : GOST R 34.10-2001 DH
@@ -1229,6 +1254,62 @@ cryptocom 1 3 4 : id-GostR3411-94-with-GostR3410-2001-cc : GOST R 34.11-94 with
cryptocom 1 8 1 : id-GostR3410-2001-ParamSet-cc : GOST R 3410-2001 Parameter Set Cryptocom
# TC26 GOST OIDs
id-tc26 1 : id-tc26-algorithms
id-tc26-algorithms 1 : id-tc26-sign
!Cname id-GostR3410-2012-256
id-tc26-sign 1 : gost2012_256: GOST R 34.10-2012 with 256 bit modulus
!Cname id-GostR3410-2012-512
id-tc26-sign 2 : gost2012_512: GOST R 34.10-2012 with 512 bit modulus
id-tc26-algorithms 2 : id-tc26-digest
!Cname id-GostR3411-2012-256
id-tc26-digest 2 : md_gost12_256: GOST R 34.11-2012 with 256 bit hash
!Cname id-GostR3411-2012-512
id-tc26-digest 3 : md_gost12_512: GOST R 34.11-2012 with 512 bit hash
id-tc26-algorithms 3 : id-tc26-signwithdigest
id-tc26-signwithdigest 2: id-tc26-signwithdigest-gost3410-2012-256: GOST R 34.10-2012 with GOST R 34.11-2012 (256 bit)
id-tc26-signwithdigest 3: id-tc26-signwithdigest-gost3410-2012-512: GOST R 34.10-2012 with GOST R 34.11-2012 (512 bit)
id-tc26-algorithms 4 : id-tc26-mac
id-tc26-mac 1 : id-tc26-hmac-gost-3411-2012-256 : HMAC GOST 34.11-2012 256 bit
id-tc26-mac 2 : id-tc26-hmac-gost-3411-2012-512 : HMAC GOST 34.11-2012 512 bit
id-tc26-algorithms 5 : id-tc26-cipher
id-tc26-algorithms 6 : id-tc26-agreement
id-tc26-agreement 1 : id-tc26-agreement-gost-3410-2012-256
id-tc26-agreement 2 : id-tc26-agreement-gost-3410-2012-512
id-tc26 2 : id-tc26-constants
id-tc26-constants 1 : id-tc26-sign-constants
id-tc26-sign-constants 2: id-tc26-gost-3410-2012-512-constants
id-tc26-gost-3410-2012-512-constants 0 : id-tc26-gost-3410-2012-512-paramSetTest: GOST R 34.10-2012 (512 bit) testing parameter set
id-tc26-gost-3410-2012-512-constants 1 : id-tc26-gost-3410-2012-512-paramSetA: GOST R 34.10-2012 (512 bit) ParamSet A
id-tc26-gost-3410-2012-512-constants 2 : id-tc26-gost-3410-2012-512-paramSetB: GOST R 34.10-2012 (512 bit) ParamSet B
id-tc26-constants 2 : id-tc26-digest-constants
id-tc26-constants 5 : id-tc26-cipher-constants
id-tc26-cipher-constants 1 : id-tc26-gost-28147-constants
id-tc26-gost-28147-constants 1 : id-tc26-gost-28147-param-Z : GOST 28147-89 TC26 parameter set
member-body 643 3 131 1 1 : INN : INN
member-body 643 100 1 : OGRN : OGRN
member-body 643 100 3 : SNILS : SNILS
member-body 643 100 111 : subjectSignTool : Signing Tool of Subject
member-body 643 100 112 : issuerSignTool : Signing Tool of Issuer
#GOST R34.13-2015 Grasshopper "Kuznechik"
: grasshopper-ecb
: grasshopper-ctr
: grasshopper-ofb
: grasshopper-cbc
: grasshopper-cfb
: grasshopper-mac
# Definitions for Camellia cipher - CBC MODE
1 2 392 200011 61 1 1 1 2 : CAMELLIA-128-CBC : camellia-128-cbc
@@ -1248,18 +1329,30 @@ camellia 1 : CAMELLIA-128-ECB : camellia-128-ecb
camellia 3 : CAMELLIA-128-OFB : camellia-128-ofb
!Cname camellia-128-cfb128
camellia 4 : CAMELLIA-128-CFB : camellia-128-cfb
camellia 6 : CAMELLIA-128-GCM : camellia-128-gcm
camellia 7 : CAMELLIA-128-CCM : camellia-128-ccm
camellia 9 : CAMELLIA-128-CTR : camellia-128-ctr
camellia 10 : CAMELLIA-128-CMAC : camellia-128-cmac
camellia 21 : CAMELLIA-192-ECB : camellia-192-ecb
!Cname camellia-192-ofb128
camellia 23 : CAMELLIA-192-OFB : camellia-192-ofb
!Cname camellia-192-cfb128
camellia 24 : CAMELLIA-192-CFB : camellia-192-cfb
camellia 26 : CAMELLIA-192-GCM : camellia-192-gcm
camellia 27 : CAMELLIA-192-CCM : camellia-192-ccm
camellia 29 : CAMELLIA-192-CTR : camellia-192-ctr
camellia 30 : CAMELLIA-192-CMAC : camellia-192-cmac
camellia 41 : CAMELLIA-256-ECB : camellia-256-ecb
!Cname camellia-256-ofb128
camellia 43 : CAMELLIA-256-OFB : camellia-256-ofb
!Cname camellia-256-cfb128
camellia 44 : CAMELLIA-256-CFB : camellia-256-cfb
camellia 46 : CAMELLIA-256-GCM : camellia-256-gcm
camellia 47 : CAMELLIA-256-CCM : camellia-256-ccm
camellia 49 : CAMELLIA-256-CTR : camellia-256-ctr
camellia 50 : CAMELLIA-256-CMAC : camellia-256-cmac
# There are no OIDs for these modes...
@@ -1294,6 +1387,8 @@ kisa 1 6 : SEED-OFB : seed-ofb
: AES-128-CBC-HMAC-SHA256 : aes-128-cbc-hmac-sha256
: AES-192-CBC-HMAC-SHA256 : aes-192-cbc-hmac-sha256
: AES-256-CBC-HMAC-SHA256 : aes-256-cbc-hmac-sha256
: ChaCha20-Poly1305 : chacha20-poly1305
: ChaCha20 : chacha20
ISO-US 10046 2 1 : dhpublicnumber : X9.42 DH
@@ -1348,3 +1443,43 @@ secg-scheme 14 3 : dhSinglePass-cofactorDH-sha512kdf-scheme
1 3 6 1 4 1 311 60 2 1 1 : jurisdictionL : jurisdictionLocalityName
1 3 6 1 4 1 311 60 2 1 2 : jurisdictionST : jurisdictionStateOrProvinceName
1 3 6 1 4 1 311 60 2 1 3 : jurisdictionC : jurisdictionCountryName
# SCRYPT algorithm
1 3 6 1 4 1 11591 4 11 : id-scrypt
# NID for TLS1 PRF
: TLS1-PRF : tls1-prf
# NID for HKDF
: HKDF : hkdf
# RFC 4556
1 3 6 1 5 2 3 : id-pkinit
id-pkinit 4 : pkInitClientAuth : PKINIT Client Auth
id-pkinit 5 : pkInitKDC : Signing KDC Response
# New curves from draft-ietf-curdle-pkix-00
1 3 101 110 : X25519
1 3 101 111 : X448
# NIDs for cipher key exchange
: KxRSA : kx-rsa
: KxECDHE : kx-ecdhe
: KxDHE : kx-dhe
: KxECDHE-PSK : kx-ecdhe-psk
: KxDHE-PSK : kx-dhe-psk
: KxRSA_PSK : kx-rsa-psk
: KxPSK : kx-psk
: KxSRP : kx-srp
: KxGOST : kx-gost
# NIDs for cipher authentication
: AuthRSA : auth-rsa
: AuthECDSA : auth-ecdsa
: AuthPSK : auth-psk
: AuthDSS : auth-dss
: AuthGOST01 : auth-gost01
: AuthGOST12 : auth-gost12
: AuthSRP : auth-srp
: AuthNULL : auth-null

View File

@@ -1,4 +1,11 @@
#!/usr/local/bin/perl
#! /usr/bin/env perl
# Copyright 1998-2016 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,25 @@ my %oid_tbl;
my ($mac_file, $xref_file) = @ARGV;
open(IN, $mac_file) || die "Can't open $mac_file";
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 +64,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-2016 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 +86,8 @@ typedef struct {
int pkey_id;
} nid_triple;
DEFINE_STACK_OF(nid_triple)
static const nid_triple sigoid_srt[] = {
EOF
@@ -111,6 +130,6 @@ sub check_oid
my ($chk) = @_;
if (!exists $oid_tbl{$chk})
{
die "Not Found \"$chk\"\n";
die "Can't find \"$chk\"\n";
}
}