Revert "quantum init"

This reverts commit 53af3b51ae.
This commit is contained in:
Simon
2018-01-04 14:03:27 +08:00
parent 53af3b51ae
commit 38395c5c80
2361 changed files with 144430 additions and 387427 deletions

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,48 @@ 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 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;
}

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,245 @@ 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
X9_62_id_ecSigType 1061
secg_scheme 1062
ecies_recommendedParameters 1063
ecies_specifiedParameters 1064
x9_63_kdf 1065
nist_concatenation_kdf 1066
tls_kdf 1067
ikev2_kdf 1068
xor_in_ecies 1069
tdes_cbc_in_ecies 1070
aes128_cbc_in_ecies 1071
aes192_cbc_in_ecies 1072
aes256_cbc_in_ecies 1073
aes128_ctr_in_ecies 1074
aes192_ctr_in_ecies 1075
aes256_ctr_in_ecies 1076
hmac_full_ecies 1077
hmac_half_ecies 1078
cmac_aes128_ecies 1079
cmac_aes192_ecies 1080
cmac_aes256_ecies 1081
cbc_mac 1082
ISO_CN 1083
oscca 1084
sm_scheme 1085
sm6_ecb 1086
sm6_cbc 1087
sm6_ofb128 1088
sm6_cfb128 1089
sm1_ecb 1090
sm1_cbc 1091
sm1_ofb128 1092
sm1_cfb128 1093
sm1_cfb1 1094
sm1_cfb8 1095
ssf33_ecb 1096
ssf33_cbc 1097
ssf33_ofb128 1098
ssf33_cfb128 1099
ssf33_cfb1 1100
ssf33_cfb8 1101
sms4_ecb 1102
sms4_cbc 1103
sms4_ofb128 1104
sms4_cfb128 1105
sms4_cfb1 1106
sms4_cfb8 1107
sms4_ctr 1108
sms4_gcm 1109
sms4_ccm 1110
sms4_xts 1111
sms4_wrap 1112
sms4_wrap_pad 1113
sms4_ocb 1114
sm5 1115
sm2p256v1 1116
sm2sign 1117
sm2keyagreement 1118
sm2encrypt 1119
sm2encrypt_recommendedParameters 1120
sm2encrypt_specifiedParameters 1121
id_sm9PublicKey 1122
sm9sign 1123
sm9keyagreement 1124
sm9encrypt 1125
sm3 1126
hmac_sm3 1127
sm2sign_with_sm3 1128
sm2sign_with_sha1 1129
sm2sign_with_sha256 1130
sm2sign_with_sha512 1131
sm2sign_with_sha224 1132
sm2sign_with_sha384 1133
sm2sign_with_rmd160 1134
wapip192v1 1135
zuc 1136
bfibe 1137
bb1 1138
type1curve 1139
type2curve 1140
type3curve 1141
type4curve 1142
tate_pairing 1143
weil_pairing 1144
ate_pairing 1145
r_ate_pairing 1146
cpk 1147
paillier 1148
sm2exchange 1149
GmSSL 1150
cpk_map 1151
cpk_sha1_map 1152
cpk_sha256_map 1153
cpk_sm3_map 1154
sm2encrypt_with_sm3 1155
sm2encrypt_with_sha1 1156
sm2encrypt_with_sha224 1157
sm2encrypt_with_sha256 1158
sm2encrypt_with_sha384 1159
sm2encrypt_with_sha512 1160
sm2encrypt_with_rmd160 1161
sm2encrypt_with_whirlpool 1162
sm2encrypt_with_blake2b512 1163
sm2encrypt_with_blake2s256 1164
sm2encrypt_with_md5 1165
sm2sign_with_whirlpool 1166
sm2sign_with_blake2b512 1167
sm2sign_with_blake2s256 1168
ecies_with_x9_63_sha1_xor_hmac 1169
ecies_with_x9_63_sha256_xor_hmac 1170
ecies_with_x9_63_sha512_xor_hmac 1171
ecies_with_x9_63_sha1_aes128_cbc_hmac 1172
ecies_with_x9_63_sha256_aes128_cbc_hmac 1173
ecies_with_x9_63_sha512_aes256_cbc_hmac 1174
ecies_with_x9_63_sha256_aes128_ctr_hmac 1175
ecies_with_x9_63_sha512_aes256_ctr_hmac 1176
ecies_with_x9_63_sha256_aes128_cbc_hmac_half 1177
ecies_with_x9_63_sha512_aes256_cbc_hmac_half 1178
ecies_with_x9_63_sha256_aes128_ctr_hmac_half 1179
ecies_with_x9_63_sha512_aes256_ctr_hmac_half 1180
ecies_with_x9_63_sha1_aes128_cbc_cmac 1181
ecies_with_x9_63_sha256_aes128_cbc_cmac 1182
ecies_with_x9_63_sha512_aes256_cbc_cmac 1183
ecies_with_x9_63_sha256_aes128_ctr_cmac 1184
ecies_with_x9_63_sha512_aes256_ctr_cmac 1185
kx_sm2 1186
auth_sm2 1187
kx_sm9 1188
auth_sm9 1189
kx_sm2dhe 1190
kx_sm2_psk 1191
kx_sm9dhe 1192
zuc_128eea3 1193
zuc_128eia3 1194
pbe_WithSM3AndSMS4_CBC 1195
bwips 1196
wapi_crypto 1197
wapi_ec 1198
wapi_ecdsa192_sha256 1199

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,11 @@ 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},
{NID_sm2sign_with_sm3, NID_sm3, NID_X9_62_id_ecPublicKey},
};
static const nid_triple *const sigoid_srt_xref[] = {
@@ -96,4 +114,7 @@ static const nid_triple *const sigoid_srt_xref[] = {
&sigoid_srt[26],
&sigoid_srt[27],
&sigoid_srt[28],
&sigoid_srt[40],
&sigoid_srt[41],
&sigoid_srt[42],
};

View File

@@ -36,6 +36,7 @@ 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
sm2sign_with_sm3 sm3 X9_62_id_ecPublicKey
dsa_with_SHA224 sha224 dsa
dsa_with_SHA256 sha256 dsa
@@ -44,6 +45,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

View File

@@ -1,44 +0,0 @@
objects.txt syntax
------------------
To cover all the naming hacks that were previously in objects.h needed some
kind of hacks in objects.txt.
The basic syntax for adding an object is as follows:
1 2 3 4 : shortName : Long Name
If Long Name contains only word characters and hyphen-minus
(0x2D) or full stop (0x2E) then Long Name is used as basis
for the base name in C. Otherwise, the shortName is used.
The base name (let's call it 'base') will then be used to
create the C macros SN_base, LN_base, NID_base and OBJ_base.
Note that if the base name contains spaces, dashes or periods,
those will be converte to underscore.
Then there are some extra commands:
!Alias foo 1 2 3 4
This just makes a name foo for an OID. The C macro
OBJ_foo will be created as a result.
!Cname foo
This makes sure that the name foo will be used as base name
in C.
!module foo
1 2 3 4 : shortName : Long Name
!global
The !module command was meant to define a kind of modularity.
What it does is to make sure the module name is prepended
to the base name. !global turns this off. This construction
is not recursive.
Lines starting with # are treated as comments, as well as any line starting
with ! and not matching the commands above.

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

@@ -76,7 +76,9 @@ X9-62_primeCurve 4 : prime239v1
X9-62_primeCurve 5 : prime239v2
X9-62_primeCurve 6 : prime239v3
X9-62_primeCurve 7 : prime256v1
!Alias id-ecSigType ansi-X9-62 4
# GMSSL export ecdsa type
#!Alias id-ecSigType ansi-X9-62 4
ansi-X9-62 4 : id-ecSigType
!global
X9-62_id-ecSigType 1 : ecdsa-with-SHA1
X9-62_id-ecSigType 2 : ecdsa-with-Recommended
@@ -257,7 +259,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
@@ -348,6 +353,10 @@ pkcs12-pbeids 5 : PBE-SHA1-RC2-128 : pbeWithSHA1And128BitRC2-CBC
!Cname pbe-WithSHA1And40BitRC2-CBC
pkcs12-pbeids 6 : PBE-SHA1-RC2-40 : pbeWithSHA1And40BitRC2-CBC
# GmSSL Append
!Cname pbe-WithSM3AndSMS4-CBC
pkcs12-pbeids 100 : PBE-SM3-SMS4 : pbeWithSM3AndSMS4-CBC
!Alias pkcs12-Version1 pkcs12 10
!Alias pkcs12-BagIds pkcs12-Version1 1
pkcs12-BagIds 1 : : keyBag
@@ -472,6 +481,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 +506,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 +680,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 +773,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 +863,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 +917,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 +1011,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 +1181,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 +1195,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 +1260,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 +1335,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 +1393,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
@@ -1319,7 +1420,9 @@ ISO-US 10046 2 1 : dhpublicnumber : X9.42 DH
# ECDH schemes from RFC5753
!Alias x9-63-scheme 1 3 133 16 840 63 0
!Alias secg-scheme certicom-arc 1
# GMSSL export secg-scheme
# !Alias secg-scheme certicom-arc 1
certicom-arc 1 : secg-scheme
x9-63-scheme 2 : dhSinglePass-stdDH-sha1kdf-scheme
secg-scheme 11 0 : dhSinglePass-stdDH-sha224kdf-scheme
@@ -1348,3 +1451,222 @@ 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
: KxSM2 : kx-sm2
: KxSM2DHE : kx-sm2dhe
: KxSM2-PSK : kx-sm2-psk
: KxSM9 : kx-sm9
: KxSM9DHE : kx-sm9dhe
# 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
: AuthSM2 : auth-sm2
: AuthSM9 : auth-sm9
# GmSSL SECG ECIES OID
secg-scheme 7 : ecies-recommendedParameters
secg-scheme 8 : ecies-specifiedParameters
secg-scheme 17 0 : x9-63-kdf
secg-scheme 17 1 : nist-concatenation-kdf
secg-scheme 17 2 : tls-kdf
secg-scheme 17 3 : ikev2-kdf
secg-scheme 18 : xor-in-ecies
secg-scheme 19 : tdes-cbc-in-ecies
secg-scheme 20 0 : aes128-cbc-in-ecies
secg-scheme 20 1 : aes192-cbc-in-ecies
secg-scheme 20 2 : aes256-cbc-in-ecies
secg-scheme 21 0 : aes128-ctr-in-ecies
secg-scheme 21 1 : aes192-ctr-in-ecies
secg-scheme 21 2 : aes256-ctr-in-ecies
secg-scheme 22 : hmac-full-ecies
secg-scheme 23 : hmac-half-ecies
secg-scheme 24 0 : cmac-aes128-ecies
secg-scheme 24 1 : cmac-aes192-ecies
secg-scheme 24 2 : cmac-aes256-ecies
ecies-specifiedParameters 1 : ecies-with-x9-63-sha1-xor-hmac
ecies-specifiedParameters 2 : ecies-with-x9-63-sha256-xor-hmac
ecies-specifiedParameters 3 : ecies-with-x9-63-sha512-xor-hmac
ecies-specifiedParameters 4 : ecies-with-x9-63-sha1-aes128-cbc-hmac
ecies-specifiedParameters 5 : ecies-with-x9-63-sha256-aes128-cbc-hmac
ecies-specifiedParameters 6 : ecies-with-x9-63-sha512-aes256-cbc-hmac
ecies-specifiedParameters 7 : ecies-with-x9-63-sha256-aes128-ctr-hmac
ecies-specifiedParameters 8 : ecies-with-x9-63-sha512-aes256-ctr-hmac
ecies-specifiedParameters 9 : ecies-with-x9-63-sha256-aes128-cbc-hmac-half
ecies-specifiedParameters 10 : ecies-with-x9-63-sha512-aes256-cbc-hmac-half
ecies-specifiedParameters 11 : ecies-with-x9-63-sha256-aes128-ctr-hmac-half
ecies-specifiedParameters 12 : ecies-with-x9-63-sha512-aes256-ctr-hmac-half
ecies-specifiedParameters 13 : ecies-with-x9-63-sha1-aes128-cbc-cmac
ecies-specifiedParameters 14 : ecies-with-x9-63-sha256-aes128-cbc-cmac
ecies-specifiedParameters 15 : ecies-with-x9-63-sha512-aes256-cbc-cmac
ecies-specifiedParameters 16 : ecies-with-x9-63-sha256-aes128-ctr-cmac
ecies-specifiedParameters 17 : ecies-with-x9-63-sha512-aes256-ctr-cmac
# GmSSL SM OID
member-body 156 : ISO-CN : ISO CN Member Body
ISO-CN 10197 : oscca
oscca 1 : sm-scheme
sm-scheme 101 1 : SM6-ECB : sm6-ecb
sm-scheme 101 2 : SM6-CBC : sm6-cbc
!Cname sm6-ofb128
sm-scheme 101 3 : SM6-OFB : sm6-ofb
!Cname sm6-cfb128
sm-scheme 101 4 : SM6-CFB : sm6-cfb
sm-scheme 102 1 : SM1-ECB : sm1-ecb
sm-scheme 102 2 : SM1-CBC : sm1-cbc
!Cname sm1-ofb128
sm-scheme 102 3 : SM1-OFB : sm1-ofb
!Cname sm1-cfb128
sm-scheme 102 4 : SM1-CFB : sm1-cfb
sm-scheme 102 5 : SM1-CFB1 : sm1-cfb1
sm-scheme 102 6 : SM1-CFB8 : sm1-cfb8
sm-scheme 103 1 : SSF33-ECB : ssf33-ecb
sm-scheme 103 2 : SSF33-CBC : ssf33-cbc
!Cname ssf33-ofb128
sm-scheme 103 3 : SSF33-OFB : ssf33-ofb
!Cname ssf33-cfb128
sm-scheme 103 4 : SSF33-CFB : ssf33-cfb
sm-scheme 103 5 : SSF33-CFB1 : ssf33-cfb1
sm-scheme 103 6 : SSF33-CFB8 : ssf33-cfb8
sm-scheme 104 1 : SMS4-ECB : sms4-ecb
sm-scheme 104 2 : SMS4-CBC : sms4-cbc
!Cname sms4-ofb128
sm-scheme 104 3 : SMS4-OFB : sms4-ofb
!Cname sms4-cfb128
sm-scheme 104 4 : SMS4-CFB : sms4-cfb
sm-scheme 104 5 : SMS4-CFB1 : sms4-cfb1
sm-scheme 104 6 : SMS4-CFB8 : sms4-cfb8
sm-scheme 104 7 : SMS4-CTR : sms4-ctr
sm-scheme 104 8 : SMS4-GCM : sms4-gcm
sm-scheme 104 9 : SMS4-CCM : sms4-ccm
sm-scheme 104 10 : SMS4-XTS : sms4-xts
sm-scheme 104 11 : SMS4-WRAP : sms4-wrap
sm-scheme 104 12 : SMS4-WRAP-PAD : sms4-wrap-pad
sm-scheme 104 100 : SMS4-OCB : sms4-ocb
!Alias sm7 sm-scheme 105
!Alias sm8 sm-scheme 106
sm-scheme 201 : SM5 : sm5
sm-scheme 301 : sm2p256v1
sm-scheme 301 1 : sm2sign
sm-scheme 301 2 : sm2exchange
sm-scheme 301 3 : sm2encrypt
#sm-scheme 301 101 : wapip192v1
sm2encrypt 1 : sm2encrypt-recommendedParameters
sm2encrypt 2 : sm2encrypt-specifiedParameters
sm2encrypt 2 1 : sm2encrypt-with-sm3
sm2encrypt 2 2 : sm2encrypt-with-sha1
sm2encrypt 2 3 : sm2encrypt-with-sha224
sm2encrypt 2 4 : sm2encrypt-with-sha256
sm2encrypt 2 5 : sm2encrypt-with-sha384
sm2encrypt 2 6 : sm2encrypt-with-sha512
sm2encrypt 2 7 : sm2encrypt-with-rmd160
sm2encrypt 2 8 : sm2encrypt-with-whirlpool
sm2encrypt 2 9 : sm2encrypt-with-blake2b512
sm2encrypt 2 10 : sm2encrypt-with-blake2s256
sm2encrypt 2 11 : sm2encrypt-with-md5
sm-scheme 302 : id-sm9PublicKey
sm-scheme 302 1 : sm9sign
sm-scheme 302 2 : sm9keyagreement
sm-scheme 302 3 : sm9encrypt
sm-scheme 401 : SM3 : sm3
sm-scheme 401 2 : HMAC-SM3 : hmac-sm3
sm-scheme 501 : SM2Sign-with-SM3 : sm2sign-with-sm3
sm-scheme 502 : SM2Sign-with-SHA1 : sm2sign-with-sha1
sm-scheme 503 : SM2Sign-with-SHA256 : sm2sign-with-sha256
sm-scheme 504 : SM2Sign-with-SHA511 : sm2sign-with-sha512
sm-scheme 505 : SM2Sign-with-SHA224 : sm2sign-with-sha224
sm-scheme 506 : SM2Sign-with-SHA384 : sm2sign-with-sha384
sm-scheme 507 : SM2Sign-with-RMD160 : sm2sign-with-rmd160
sm-scheme 520 : SM2Sign-with-Whirlpool : sm2sign-with-whirlpool
sm-scheme 521 : SM2Sign-with-Blake2b512 : sm2sign-with-blake2b512
sm-scheme 522 : SM2Sign-with-Blake2s256 : sm2sign-with-blake2s256
# GmSSL ZUC OID
sm-scheme 800 : ZUC : zuc
zuc 1 : zuc-128eea3
zuc 2 : zuc-128eia3
# IBCS1
!Alias ibcs1 ISO-US 1 114334 1
ibcs1 2 1 : bfibe
ibcs1 2 2 : bb1
# 1 tate, 2 weil, 3 ate, 4 r-ate
ibcs1 1 1 : type1curve
ibcs1 1 2 : type2curve
ibcs1 1 3 : type3curve
ibcs1 1 4 : type4curve
ibcs1 3 1 : tate-pairing
ibcs1 3 2 : weil-pairing
ibcs1 3 3 : ate-pairing
ibcs1 3 4 : r-ate-pairing
# GmSSL
Enterprises 49549 : gmssl : GmSSL
GmSSL 1 : CPK : cpk
cpk 1 : cpk-map
cpk-map 1 : cpk-sha1-map
cpk-map 2 : cpk-sha256-map
cpk-map 3 : cpk-sm3-map
GmSSL 21 : paillier
# WAPI (GB 15629.11-2003-XG1-2006)
ISO-CN 11235 : bwips
bwips 1 : wapi-crypto
wapi-crypto 1 : wapi-ec
wapi-ec 1 : wapi-ecdsa192-sha256
wapi-ec 2 1 : wapip192v1

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";
}
}