sync with OpenBSD -current
This commit is contained in:
parent
bc7421a947
commit
4cca26dc5a
120 changed files with 4168 additions and 640 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: conf_api.c,v 1.18 2024/03/02 11:11:11 tb Exp $ */
|
||||
/* $OpenBSD: conf_api.c,v 1.19 2024/07/14 14:32:45 jsing Exp $ */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -69,8 +69,6 @@
|
|||
#include <openssl/conf.h>
|
||||
#include <openssl/conf_api.h>
|
||||
|
||||
#include "lhash_local.h"
|
||||
|
||||
static void value_free_hash_doall_arg(CONF_VALUE *a,
|
||||
LHASH_OF(CONF_VALUE) *conf);
|
||||
static void value_free_stack_doall(CONF_VALUE *a);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: evp_pkey.c,v 1.28 2024/04/09 13:55:02 beck Exp $ */
|
||||
/* $OpenBSD: evp_pkey.c,v 1.30 2024/07/14 16:06:31 tb Exp $ */
|
||||
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
|
||||
* project 1999.
|
||||
*/
|
||||
|
@ -141,19 +141,63 @@ error:
|
|||
}
|
||||
LCRYPTO_ALIAS(EVP_PKEY2PKCS8);
|
||||
|
||||
/* EVP_PKEY attribute functions */
|
||||
/*
|
||||
* XXX - This is only used by openssl(1) pkcs12 for the Microsoft-specific
|
||||
* NID_ms_csp_name and NID_LocalKeySet. This turns out to be the only reason
|
||||
* why attributes hangs off the EVP_PKEY struct.
|
||||
*/
|
||||
int
|
||||
EVP_PKEY_add1_attr_by_NID(EVP_PKEY *pkey, int nid, int type,
|
||||
const unsigned char *bytes, int len)
|
||||
{
|
||||
STACK_OF(X509_ATTRIBUTE) *attrs = NULL;
|
||||
X509_ATTRIBUTE *attr = NULL;
|
||||
int ret = 0;
|
||||
|
||||
if ((attr = X509_ATTRIBUTE_create_by_NID(NULL, nid, type,
|
||||
bytes, len)) == NULL)
|
||||
goto err;
|
||||
|
||||
if ((attrs = pkey->attributes) == NULL)
|
||||
attrs = sk_X509_ATTRIBUTE_new_null();
|
||||
if (attrs == NULL)
|
||||
goto err;
|
||||
|
||||
if (sk_X509_ATTRIBUTE_push(attrs, attr) <= 0)
|
||||
goto err;
|
||||
attr = NULL;
|
||||
|
||||
pkey->attributes = attrs;
|
||||
attrs = NULL;
|
||||
|
||||
ret = 1;
|
||||
|
||||
err:
|
||||
X509_ATTRIBUTE_free(attr);
|
||||
if (attrs != pkey->attributes)
|
||||
sk_X509_ATTRIBUTE_pop_free(attrs, X509_ATTRIBUTE_free);
|
||||
|
||||
return ret;
|
||||
}
|
||||
LCRYPTO_ALIAS(EVP_PKEY_add1_attr_by_NID);
|
||||
|
||||
/*
|
||||
* XXX - delete all the garbage below in the next bump.
|
||||
*/
|
||||
|
||||
int
|
||||
EVP_PKEY_get_attr_count(const EVP_PKEY *key)
|
||||
{
|
||||
return X509at_get_attr_count(key->attributes);
|
||||
EVPerror(ERR_R_DISABLED);
|
||||
return 0;
|
||||
}
|
||||
LCRYPTO_ALIAS(EVP_PKEY_get_attr_count);
|
||||
|
||||
int
|
||||
EVP_PKEY_get_attr_by_NID(const EVP_PKEY *key, int nid, int lastpos)
|
||||
{
|
||||
return X509at_get_attr_by_NID(key->attributes, nid, lastpos);
|
||||
EVPerror(ERR_R_DISABLED);
|
||||
return -1;
|
||||
}
|
||||
LCRYPTO_ALIAS(EVP_PKEY_get_attr_by_NID);
|
||||
|
||||
|
@ -161,29 +205,31 @@ int
|
|||
EVP_PKEY_get_attr_by_OBJ(const EVP_PKEY *key, const ASN1_OBJECT *obj,
|
||||
int lastpos)
|
||||
{
|
||||
return X509at_get_attr_by_OBJ(key->attributes, obj, lastpos);
|
||||
EVPerror(ERR_R_DISABLED);
|
||||
return -1;
|
||||
}
|
||||
LCRYPTO_ALIAS(EVP_PKEY_get_attr_by_OBJ);
|
||||
|
||||
X509_ATTRIBUTE *
|
||||
EVP_PKEY_get_attr(const EVP_PKEY *key, int loc)
|
||||
{
|
||||
return X509at_get_attr(key->attributes, loc);
|
||||
EVPerror(ERR_R_DISABLED);
|
||||
return NULL;
|
||||
}
|
||||
LCRYPTO_ALIAS(EVP_PKEY_get_attr);
|
||||
|
||||
X509_ATTRIBUTE *
|
||||
EVP_PKEY_delete_attr(EVP_PKEY *key, int loc)
|
||||
{
|
||||
return X509at_delete_attr(key->attributes, loc);
|
||||
EVPerror(ERR_R_DISABLED);
|
||||
return NULL;
|
||||
}
|
||||
LCRYPTO_ALIAS(EVP_PKEY_delete_attr);
|
||||
|
||||
int
|
||||
EVP_PKEY_add1_attr(EVP_PKEY *key, X509_ATTRIBUTE *attr)
|
||||
{
|
||||
if (X509at_add1_attr(&key->attributes, attr))
|
||||
return 1;
|
||||
EVPerror(ERR_R_DISABLED);
|
||||
return 0;
|
||||
}
|
||||
LCRYPTO_ALIAS(EVP_PKEY_add1_attr);
|
||||
|
@ -192,29 +238,16 @@ int
|
|||
EVP_PKEY_add1_attr_by_OBJ(EVP_PKEY *key, const ASN1_OBJECT *obj, int type,
|
||||
const unsigned char *bytes, int len)
|
||||
{
|
||||
if (X509at_add1_attr_by_OBJ(&key->attributes, obj, type, bytes, len))
|
||||
return 1;
|
||||
EVPerror(ERR_R_DISABLED);
|
||||
return 0;
|
||||
}
|
||||
LCRYPTO_ALIAS(EVP_PKEY_add1_attr_by_OBJ);
|
||||
|
||||
int
|
||||
EVP_PKEY_add1_attr_by_NID(EVP_PKEY *key, int nid, int type,
|
||||
const unsigned char *bytes, int len)
|
||||
{
|
||||
if (X509at_add1_attr_by_NID(&key->attributes, nid, type, bytes, len))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
LCRYPTO_ALIAS(EVP_PKEY_add1_attr_by_NID);
|
||||
|
||||
int
|
||||
EVP_PKEY_add1_attr_by_txt(EVP_PKEY *key, const char *attrname, int type,
|
||||
const unsigned char *bytes, int len)
|
||||
{
|
||||
if (X509at_add1_attr_by_txt(&key->attributes, attrname, type,
|
||||
bytes, len))
|
||||
return 1;
|
||||
EVPerror(ERR_R_DISABLED);
|
||||
return 0;
|
||||
}
|
||||
LCRYPTO_ALIAS(EVP_PKEY_add1_attr_by_txt);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: x509.h,v 1.7 2024/07/08 17:01:54 beck Exp $ */
|
||||
/* $OpenBSD: x509.h,v 1.8 2024/07/15 18:50:42 tb Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2022 Bob Beck <beck@openbsd.org>
|
||||
*
|
||||
|
@ -442,15 +442,15 @@ LCRYPTO_USED(X509_ocspid_print);
|
|||
LCRYPTO_USED(X509_CRL_print);
|
||||
LCRYPTO_USED(X509_REQ_print_ex);
|
||||
LCRYPTO_USED(X509_REQ_print);
|
||||
LCRYPTO_USED(EVP_PKEY_get_attr_count);
|
||||
LCRYPTO_USED(EVP_PKEY_get_attr_by_NID);
|
||||
LCRYPTO_USED(EVP_PKEY_get_attr_by_OBJ);
|
||||
LCRYPTO_USED(EVP_PKEY_get_attr);
|
||||
LCRYPTO_USED(EVP_PKEY_delete_attr);
|
||||
LCRYPTO_USED(EVP_PKEY_add1_attr);
|
||||
LCRYPTO_USED(EVP_PKEY_add1_attr_by_OBJ);
|
||||
LCRYPTO_USED(EVP_PKEY_add1_attr_by_NID);
|
||||
LCRYPTO_USED(EVP_PKEY_add1_attr_by_txt);
|
||||
LCRYPTO_UNUSED(EVP_PKEY_get_attr_count);
|
||||
LCRYPTO_UNUSED(EVP_PKEY_get_attr_by_NID);
|
||||
LCRYPTO_UNUSED(EVP_PKEY_get_attr_by_OBJ);
|
||||
LCRYPTO_UNUSED(EVP_PKEY_get_attr);
|
||||
LCRYPTO_UNUSED(EVP_PKEY_delete_attr);
|
||||
LCRYPTO_UNUSED(EVP_PKEY_add1_attr);
|
||||
LCRYPTO_UNUSED(EVP_PKEY_add1_attr_by_OBJ);
|
||||
LCRYPTO_UNUSED(EVP_PKEY_add1_attr_by_NID);
|
||||
LCRYPTO_UNUSED(EVP_PKEY_add1_attr_by_txt);
|
||||
LCRYPTO_USED(PKCS8_PRIV_KEY_INFO_new);
|
||||
LCRYPTO_USED(PKCS8_PRIV_KEY_INFO_free);
|
||||
LCRYPTO_USED(d2i_PKCS8_PRIV_KEY_INFO);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: lhash.c,v 1.27 2024/06/30 14:13:08 jsing Exp $ */
|
||||
/* $OpenBSD: lhash.c,v 1.28 2024/07/14 14:32:45 jsing Exp $ */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -65,13 +65,34 @@
|
|||
#include <openssl/crypto.h>
|
||||
#include <openssl/lhash.h>
|
||||
|
||||
#include "lhash_local.h"
|
||||
|
||||
#undef MIN_NODES
|
||||
#define MIN_NODES 16
|
||||
#define UP_LOAD (2*LH_LOAD_MULT) /* load times 256 (default 2) */
|
||||
#define DOWN_LOAD (LH_LOAD_MULT) /* load times 256 (default 1) */
|
||||
|
||||
typedef struct lhash_node_st {
|
||||
void *data;
|
||||
struct lhash_node_st *next;
|
||||
#ifndef OPENSSL_NO_HASH_COMP
|
||||
unsigned long hash;
|
||||
#endif
|
||||
} LHASH_NODE;
|
||||
|
||||
struct lhash_st {
|
||||
LHASH_NODE **b;
|
||||
LHASH_COMP_FN_TYPE comp;
|
||||
LHASH_HASH_FN_TYPE hash;
|
||||
unsigned int num_nodes;
|
||||
unsigned int num_alloc_nodes;
|
||||
unsigned int p;
|
||||
unsigned int pmax;
|
||||
unsigned long up_load; /* load times 256 */
|
||||
unsigned long down_load; /* load times 256 */
|
||||
unsigned long num_items;
|
||||
|
||||
int error;
|
||||
} /* _LHASH */;
|
||||
|
||||
static void
|
||||
expand(_LHASH *lh)
|
||||
{
|
||||
|
|
|
@ -1,91 +0,0 @@
|
|||
/* $OpenBSD: lhash_local.h,v 1.2 2024/06/30 14:13:08 jsing Exp $ */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
/* Header for dynamic hash table routines
|
||||
* Author - Eric Young
|
||||
*/
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
|
||||
#ifndef HEADER_LHASH_LOCAL_H
|
||||
#define HEADER_LHASH_LOCAL_H
|
||||
|
||||
typedef struct lhash_node_st {
|
||||
void *data;
|
||||
struct lhash_node_st *next;
|
||||
#ifndef OPENSSL_NO_HASH_COMP
|
||||
unsigned long hash;
|
||||
#endif
|
||||
} LHASH_NODE;
|
||||
|
||||
struct lhash_st {
|
||||
LHASH_NODE **b;
|
||||
LHASH_COMP_FN_TYPE comp;
|
||||
LHASH_HASH_FN_TYPE hash;
|
||||
unsigned int num_nodes;
|
||||
unsigned int num_alloc_nodes;
|
||||
unsigned int p;
|
||||
unsigned int pmax;
|
||||
unsigned long up_load; /* load times 256 */
|
||||
unsigned long down_load; /* load times 256 */
|
||||
unsigned long num_items;
|
||||
|
||||
int error;
|
||||
} /* _LHASH */;
|
||||
|
||||
#endif
|
|
@ -1,4 +1,4 @@
|
|||
.\" $OpenBSD: EC_KEY_new.3,v 1.19 2024/02/16 06:09:36 tb Exp $
|
||||
.\" $OpenBSD: EC_KEY_new.3,v 1.20 2024/07/14 05:53:09 jsg Exp $
|
||||
.\" full merge up to: OpenSSL 3aef36ff Jan 5 13:06:03 2016 -0500
|
||||
.\" partial merge up to: OpenSSL e9b77246 Jan 20 19:58:49 2017 +0100
|
||||
.\"
|
||||
|
@ -49,7 +49,7 @@
|
|||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd $Mdocdate: February 16 2024 $
|
||||
.Dd $Mdocdate: July 14 2024 $
|
||||
.Dt EC_KEY_NEW 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -377,7 +377,7 @@ and
|
|||
.Fn EC_KEY_set_conv_form
|
||||
get and set the point_conversion_form for the
|
||||
.Fa key .
|
||||
For a description of point_conversion_form please refer to
|
||||
For a description of point_conversion_form refer to
|
||||
.Xr EC_GROUP_copy 3 .
|
||||
.Pp
|
||||
.Fn EC_KEY_set_flags
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: obj_dat.c,v 1.90 2024/05/08 16:35:05 tb Exp $ */
|
||||
/* $OpenBSD: obj_dat.c,v 1.91 2024/07/14 14:32:45 jsing Exp $ */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -71,7 +71,6 @@
|
|||
#include <openssl/objects.h>
|
||||
|
||||
#include "asn1_local.h"
|
||||
#include "lhash_local.h"
|
||||
|
||||
/* obj_dat.h is generated from objects.h by obj_dat.pl */
|
||||
#include "obj_dat.h"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: p12_crt.c,v 1.24 2024/03/24 06:48:03 tb Exp $ */
|
||||
/* $OpenBSD: p12_crt.c,v 1.25 2024/07/15 15:43:25 tb Exp $ */
|
||||
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
|
||||
* project.
|
||||
*/
|
||||
|
@ -60,8 +60,11 @@
|
|||
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/pkcs12.h>
|
||||
#include <openssl/x509.h>
|
||||
|
||||
#include "evp_local.h"
|
||||
#include "pkcs12_local.h"
|
||||
#include "x509_local.h"
|
||||
|
||||
static int pkcs12_add_bag(STACK_OF(PKCS12_SAFEBAG) **pbags,
|
||||
PKCS12_SAFEBAG *bag);
|
||||
|
@ -69,13 +72,25 @@ static int pkcs12_add_bag(STACK_OF(PKCS12_SAFEBAG) **pbags,
|
|||
static int
|
||||
copy_bag_attr(PKCS12_SAFEBAG *bag, EVP_PKEY *pkey, int nid)
|
||||
{
|
||||
int idx;
|
||||
X509_ATTRIBUTE *attr;
|
||||
X509_ATTRIBUTE *attr = NULL;
|
||||
const ASN1_OBJECT *obj;
|
||||
int i;
|
||||
|
||||
idx = EVP_PKEY_get_attr_by_NID(pkey, nid, -1);
|
||||
if (idx < 0)
|
||||
if ((obj = OBJ_nid2obj(nid)) == NULL) {
|
||||
/* XXX - this seems wrong but preserves behavior. */
|
||||
return 1;
|
||||
attr = EVP_PKEY_get_attr(pkey, idx);
|
||||
}
|
||||
|
||||
for (i = 0; i < sk_X509_ATTRIBUTE_num(pkey->attributes); i++) {
|
||||
attr = sk_X509_ATTRIBUTE_value(pkey->attributes, i);
|
||||
if (OBJ_cmp(attr->object, obj) == 0)
|
||||
break;
|
||||
attr = NULL;
|
||||
}
|
||||
|
||||
if (attr == NULL)
|
||||
return 1;
|
||||
|
||||
if (!X509at_add1_attr(&bag->attrib, attr))
|
||||
return 0;
|
||||
return 1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue