sync with OpenBSD -current

This commit is contained in:
purplerain 2024-01-05 00:18:10 +00:00
parent eff43bb1fd
commit a2b5593ce1
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
76 changed files with 1704 additions and 1876 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: e_aes.c,v 1.55 2023/11/18 09:37:15 tb Exp $ */
/* $OpenBSD: e_aes.c,v 1.56 2024/01/04 17:38:36 tb Exp $ */
/* ====================================================================
* Copyright (c) 2001-2011 The OpenSSL Project. All rights reserved.
*
@ -2550,7 +2550,6 @@ static const EVP_CIPHER aes_128_wrap = {
.set_asn1_parameters = NULL,
.get_asn1_parameters = NULL,
.ctrl = aes_wrap_ctrl,
.app_data = NULL,
};
const EVP_CIPHER *
@ -2572,7 +2571,6 @@ static const EVP_CIPHER aes_192_wrap = {
.set_asn1_parameters = NULL,
.get_asn1_parameters = NULL,
.ctrl = aes_wrap_ctrl,
.app_data = NULL,
};
const EVP_CIPHER *
@ -2594,7 +2592,6 @@ static const EVP_CIPHER aes_256_wrap = {
.set_asn1_parameters = NULL,
.get_asn1_parameters = NULL,
.ctrl = aes_wrap_ctrl,
.app_data = NULL,
};
const EVP_CIPHER *

View file

@ -1,4 +1,4 @@
/* $OpenBSD: e_bf.c,v 1.17 2023/07/07 19:37:53 beck Exp $ */
/* $OpenBSD: e_bf.c,v 1.18 2024/01/04 17:38:36 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -170,7 +170,6 @@ static const EVP_CIPHER bf_cbc = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *
@ -192,7 +191,6 @@ static const EVP_CIPHER bf_cfb64 = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *
@ -214,7 +212,6 @@ static const EVP_CIPHER bf_ofb = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *
@ -236,7 +233,6 @@ static const EVP_CIPHER bf_ecb = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *

View file

@ -1,4 +1,4 @@
/* $OpenBSD: e_camellia.c,v 1.18 2023/07/07 19:37:53 beck Exp $ */
/* $OpenBSD: e_camellia.c,v 1.19 2024/01/04 17:38:36 tb Exp $ */
/* ====================================================================
* Copyright (c) 2006 The OpenSSL Project. All rights reserved.
*
@ -171,7 +171,6 @@ static const EVP_CIPHER camellia_128_cbc = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *
@ -193,7 +192,6 @@ static const EVP_CIPHER camellia_128_cfb128 = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *
@ -215,7 +213,6 @@ static const EVP_CIPHER camellia_128_ofb = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *
@ -237,7 +234,6 @@ static const EVP_CIPHER camellia_128_ecb = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *
@ -329,7 +325,6 @@ static const EVP_CIPHER camellia_192_cbc = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *
@ -351,7 +346,6 @@ static const EVP_CIPHER camellia_192_cfb128 = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *
@ -373,7 +367,6 @@ static const EVP_CIPHER camellia_192_ofb = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *
@ -395,7 +388,6 @@ static const EVP_CIPHER camellia_192_ecb = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *
@ -487,7 +479,6 @@ static const EVP_CIPHER camellia_256_cbc = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *
@ -509,7 +500,6 @@ static const EVP_CIPHER camellia_256_cfb128 = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *
@ -531,7 +521,6 @@ static const EVP_CIPHER camellia_256_ofb = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *
@ -553,7 +542,6 @@ static const EVP_CIPHER camellia_256_ecb = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *
@ -597,7 +585,6 @@ static const EVP_CIPHER camellia_128_cfb1 = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *
@ -641,7 +628,6 @@ static const EVP_CIPHER camellia_192_cfb1 = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *
@ -685,7 +671,6 @@ static const EVP_CIPHER camellia_256_cfb1 = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *
@ -728,7 +713,6 @@ static const EVP_CIPHER camellia_128_cfb8 = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *
@ -770,7 +754,6 @@ static const EVP_CIPHER camellia_192_cfb8 = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *
@ -812,7 +795,6 @@ static const EVP_CIPHER camellia_256_cfb8 = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *

View file

@ -1,4 +1,4 @@
/* $OpenBSD: e_cast.c,v 1.16 2023/07/07 19:37:53 beck Exp $ */
/* $OpenBSD: e_cast.c,v 1.17 2024/01/04 17:38:36 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -170,7 +170,6 @@ static const EVP_CIPHER cast5_cbc = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *
@ -192,7 +191,6 @@ static const EVP_CIPHER cast5_cfb64 = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *
@ -214,7 +212,6 @@ static const EVP_CIPHER cast5_ofb = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *
@ -236,7 +233,6 @@ static const EVP_CIPHER cast5_ecb = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *

View file

@ -1,4 +1,4 @@
/* $OpenBSD: e_des.c,v 1.22 2023/07/07 19:37:53 beck Exp $ */
/* $OpenBSD: e_des.c,v 1.23 2024/01/04 17:38:36 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -234,7 +234,6 @@ static const EVP_CIPHER des_cbc = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = des_ctrl,
.app_data = NULL,
};
const EVP_CIPHER *
@ -256,7 +255,6 @@ static const EVP_CIPHER des_cfb64 = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = des_ctrl,
.app_data = NULL,
};
const EVP_CIPHER *
@ -278,7 +276,6 @@ static const EVP_CIPHER des_ofb = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = des_ctrl,
.app_data = NULL,
};
const EVP_CIPHER *
@ -300,7 +297,6 @@ static const EVP_CIPHER des_ecb = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = des_ctrl,
.app_data = NULL,
};
const EVP_CIPHER *
@ -322,7 +318,6 @@ static const EVP_CIPHER des_cfb1 = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = des_ctrl,
.app_data = NULL,
};
const EVP_CIPHER *
@ -344,7 +339,6 @@ static const EVP_CIPHER des_cfb8 = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = des_ctrl,
.app_data = NULL,
};
const EVP_CIPHER *

View file

@ -1,4 +1,4 @@
/* $OpenBSD: e_des3.c,v 1.28 2023/07/07 19:37:53 beck Exp $ */
/* $OpenBSD: e_des3.c,v 1.29 2024/01/04 17:38:36 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -266,7 +266,6 @@ static const EVP_CIPHER des_ede_cbc = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = des3_ctrl,
.app_data = NULL,
};
const EVP_CIPHER *
@ -288,7 +287,6 @@ static const EVP_CIPHER des_ede_cfb64 = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = des3_ctrl,
.app_data = NULL,
};
const EVP_CIPHER *
@ -310,7 +308,6 @@ static const EVP_CIPHER des_ede_ofb = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = des3_ctrl,
.app_data = NULL,
};
const EVP_CIPHER *
@ -332,7 +329,6 @@ static const EVP_CIPHER des_ede_ecb = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = des3_ctrl,
.app_data = NULL,
};
const EVP_CIPHER *
@ -360,7 +356,6 @@ static const EVP_CIPHER des_ede3_cbc = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = des3_ctrl,
.app_data = NULL,
};
const EVP_CIPHER *
@ -382,7 +377,6 @@ static const EVP_CIPHER des_ede3_cfb64 = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = des3_ctrl,
.app_data = NULL,
};
const EVP_CIPHER *
@ -404,7 +398,6 @@ static const EVP_CIPHER des_ede3_ofb = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = des3_ctrl,
.app_data = NULL,
};
const EVP_CIPHER *
@ -426,7 +419,6 @@ static const EVP_CIPHER des_ede3_ecb = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = des3_ctrl,
.app_data = NULL,
};
const EVP_CIPHER *
@ -449,7 +441,6 @@ static const EVP_CIPHER des_ede3_cfb1 = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = des3_ctrl,
.app_data = NULL,
};
const EVP_CIPHER *
@ -472,7 +463,6 @@ static const EVP_CIPHER des_ede3_cfb8 = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = des3_ctrl,
.app_data = NULL,
};
const EVP_CIPHER *

View file

@ -1,4 +1,4 @@
/* $OpenBSD: e_gost2814789.c,v 1.13 2023/07/07 19:37:53 beck Exp $ */
/* $OpenBSD: e_gost2814789.c,v 1.14 2024/01/04 17:38:36 tb Exp $ */
/*
* Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
* Copyright (c) 2005-2006 Cryptocom LTD
@ -260,7 +260,6 @@ static const EVP_CIPHER gost2814789_ecb = {
.set_asn1_parameters = gost2814789_set_asn1_params,
.get_asn1_parameters = gost2814789_get_asn1_params,
.ctrl = gost2814789_ctl,
.app_data = NULL,
};
const EVP_CIPHER *
@ -282,7 +281,6 @@ static const EVP_CIPHER gost2814789_cfb64 = {
.set_asn1_parameters = gost2814789_set_asn1_params,
.get_asn1_parameters = gost2814789_get_asn1_params,
.ctrl = gost2814789_ctl,
.app_data = NULL,
};
const EVP_CIPHER *
@ -304,7 +302,6 @@ static const EVP_CIPHER gost2814789_cnt = {
.set_asn1_parameters = gost2814789_set_asn1_params,
.get_asn1_parameters = gost2814789_get_asn1_params,
.ctrl = gost2814789_ctl,
.app_data = NULL,
};
const EVP_CIPHER *

View file

@ -1,4 +1,4 @@
/* $OpenBSD: e_idea.c,v 1.20 2023/07/07 19:37:53 beck Exp $ */
/* $OpenBSD: e_idea.c,v 1.21 2024/01/04 17:38:36 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -189,7 +189,6 @@ static const EVP_CIPHER idea_cbc = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *
@ -211,7 +210,6 @@ static const EVP_CIPHER idea_cfb64 = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *
@ -233,7 +231,6 @@ static const EVP_CIPHER idea_ofb = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *
@ -255,7 +252,6 @@ static const EVP_CIPHER idea_ecb = {
.set_asn1_parameters = EVP_CIPHER_set_asn1_iv,
.get_asn1_parameters = EVP_CIPHER_get_asn1_iv,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *

View file

@ -1,4 +1,4 @@
/* $OpenBSD: e_null.c,v 1.18 2023/07/07 19:37:53 beck Exp $ */
/* $OpenBSD: e_null.c,v 1.19 2024/01/04 17:38:36 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -80,7 +80,6 @@ static const EVP_CIPHER n_cipher = {
NULL,
NULL,
NULL,
NULL
};
const EVP_CIPHER *

View file

@ -1,4 +1,4 @@
/* $OpenBSD: e_rc2.c,v 1.25 2023/12/02 19:06:22 tb Exp $ */
/* $OpenBSD: e_rc2.c,v 1.26 2024/01/04 17:38:36 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -172,7 +172,6 @@ static const EVP_CIPHER rc2_cbc = {
.set_asn1_parameters = rc2_set_asn1_type_and_iv,
.get_asn1_parameters = rc2_get_asn1_type_and_iv,
.ctrl = rc2_ctrl,
.app_data = NULL,
};
const EVP_CIPHER *
@ -194,7 +193,6 @@ static const EVP_CIPHER rc2_cfb64 = {
.set_asn1_parameters = rc2_set_asn1_type_and_iv,
.get_asn1_parameters = rc2_get_asn1_type_and_iv,
.ctrl = rc2_ctrl,
.app_data = NULL,
};
const EVP_CIPHER *
@ -216,7 +214,6 @@ static const EVP_CIPHER rc2_ofb = {
.set_asn1_parameters = rc2_set_asn1_type_and_iv,
.get_asn1_parameters = rc2_get_asn1_type_and_iv,
.ctrl = rc2_ctrl,
.app_data = NULL,
};
const EVP_CIPHER *
@ -238,7 +235,6 @@ static const EVP_CIPHER rc2_ecb = {
.set_asn1_parameters = rc2_set_asn1_type_and_iv,
.get_asn1_parameters = rc2_get_asn1_type_and_iv,
.ctrl = rc2_ctrl,
.app_data = NULL,
};
const EVP_CIPHER *
@ -262,7 +258,6 @@ static const EVP_CIPHER r2_64_cbc_cipher = {
rc2_set_asn1_type_and_iv,
rc2_get_asn1_type_and_iv,
rc2_ctrl,
NULL
};
static const EVP_CIPHER r2_40_cbc_cipher = {
@ -276,7 +271,6 @@ static const EVP_CIPHER r2_40_cbc_cipher = {
rc2_set_asn1_type_and_iv,
rc2_get_asn1_type_and_iv,
rc2_ctrl,
NULL
};
const EVP_CIPHER *

View file

@ -1,4 +1,4 @@
/* $OpenBSD: e_rc4.c,v 1.17 2023/07/07 19:37:53 beck Exp $ */
/* $OpenBSD: e_rc4.c,v 1.18 2024/01/04 17:38:36 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -93,7 +93,6 @@ static const EVP_CIPHER r4_cipher = {
NULL,
NULL,
NULL,
NULL
};
static const EVP_CIPHER r4_40_cipher = {
@ -107,7 +106,6 @@ static const EVP_CIPHER r4_40_cipher = {
NULL,
NULL,
NULL,
NULL
};
const EVP_CIPHER *

View file

@ -1,4 +1,4 @@
/* $OpenBSD: e_rc4_hmac_md5.c,v 1.12 2023/07/07 19:37:53 beck Exp $ */
/* $OpenBSD: e_rc4_hmac_md5.c,v 1.13 2024/01/04 17:38:36 tb Exp $ */
/* ====================================================================
* Copyright (c) 2011 The OpenSSL Project. All rights reserved.
*
@ -296,7 +296,6 @@ static EVP_CIPHER r4_hmac_md5_cipher = {
NULL,
NULL,
rc4_hmac_md5_ctrl,
NULL
};
const EVP_CIPHER *

View file

@ -1,4 +1,4 @@
/* $OpenBSD: e_sm4.c,v 1.11 2024/01/02 19:54:43 tb Exp $ */
/* $OpenBSD: e_sm4.c,v 1.12 2024/01/04 17:38:36 tb Exp $ */
/*
* Copyright (c) 2017, 2019 Ribose Inc
*
@ -157,7 +157,6 @@ static const EVP_CIPHER sm4_cbc = {
.set_asn1_parameters = NULL,
.get_asn1_parameters = NULL,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *
@ -179,7 +178,6 @@ static const EVP_CIPHER sm4_cfb128 = {
.set_asn1_parameters = NULL,
.get_asn1_parameters = NULL,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *
@ -201,7 +199,6 @@ static const EVP_CIPHER sm4_ofb = {
.set_asn1_parameters = NULL,
.get_asn1_parameters = NULL,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *
@ -223,7 +220,6 @@ static const EVP_CIPHER sm4_ecb = {
.set_asn1_parameters = NULL,
.get_asn1_parameters = NULL,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *
@ -256,7 +252,6 @@ static const EVP_CIPHER sm4_ctr_mode = {
.set_asn1_parameters = NULL,
.get_asn1_parameters = NULL,
.ctrl = NULL,
.app_data = NULL,
};
const EVP_CIPHER *

View file

@ -1,4 +1,4 @@
/* $OpenBSD: e_xcbc_d.c,v 1.15 2023/07/07 19:37:53 beck Exp $ */
/* $OpenBSD: e_xcbc_d.c,v 1.16 2024/01/04 17:38:36 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -94,7 +94,6 @@ static const EVP_CIPHER d_xcbc_cipher = {
EVP_CIPHER_set_asn1_iv,
EVP_CIPHER_get_asn1_iv,
NULL,
NULL
};
const EVP_CIPHER *

View file

@ -1,4 +1,4 @@
/* $OpenBSD: evp_cipher.c,v 1.13 2024/01/02 21:27:39 tb Exp $ */
/* $OpenBSD: evp_cipher.c,v 1.15 2024/01/04 09:47:54 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -204,7 +204,8 @@ EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, ENGINE *engine,
case EVP_CIPH_CBC_MODE:
iv_len = EVP_CIPHER_CTX_iv_length(ctx);
if (iv_len < 0 || iv_len > sizeof(ctx->oiv)) {
if (iv_len < 0 || iv_len > sizeof(ctx->oiv) ||
iv_len > sizeof(ctx->iv)) {
EVPerror(EVP_R_IV_TOO_LARGE);
return 0;
}
@ -899,15 +900,24 @@ EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx)
*/
int
EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type)
EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type)
{
if (ctx->cipher->set_asn1_parameters != NULL)
return ctx->cipher->set_asn1_parameters(ctx, type);
int i = 0;
int l;
if ((ctx->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) != 0)
return EVP_CIPHER_set_asn1_iv(ctx, type);
return -1;
if (type != NULL) {
l = EVP_CIPHER_CTX_iv_length(ctx);
if (l < 0 || l > sizeof(ctx->oiv) || l > sizeof(ctx->iv)) {
EVPerror(EVP_R_IV_TOO_LARGE);
return 0;
}
i = ASN1_TYPE_get_octetstring(type, ctx->oiv, l);
if (i != l)
return (-1);
else if (i > 0)
memcpy(ctx->iv, ctx->oiv, l);
}
return (i);
}
int
@ -922,27 +932,6 @@ EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type)
return -1;
}
int
EVP_CIPHER_get_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type)
{
int i = 0;
int l;
if (type != NULL) {
l = EVP_CIPHER_CTX_iv_length(ctx);
if (l < 0 || l > sizeof(ctx->iv)) {
EVPerror(EVP_R_IV_TOO_LARGE);
return 0;
}
i = ASN1_TYPE_get_octetstring(type, ctx->oiv, l);
if (i != l)
return (-1);
else if (i > 0)
memcpy(ctx->iv, ctx->oiv, l);
}
return (i);
}
int
EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type)
{
@ -951,7 +940,7 @@ EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type)
if (type != NULL) {
j = EVP_CIPHER_CTX_iv_length(ctx);
if (j < 0 || j > sizeof(ctx->iv)) {
if (j < 0 || j > sizeof(ctx->oiv)) {
EVPerror(EVP_R_IV_TOO_LARGE);
return 0;
}
@ -960,6 +949,18 @@ EVP_CIPHER_set_asn1_iv(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type)
return (i);
}
int
EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *ctx, ASN1_TYPE *type)
{
if (ctx->cipher->set_asn1_parameters != NULL)
return ctx->cipher->set_asn1_parameters(ctx, type);
if ((ctx->cipher->flags & EVP_CIPH_FLAG_DEFAULT_ASN1) != 0)
return EVP_CIPHER_set_asn1_iv(ctx, type);
return -1;
}
/* Convert the various cipher NIDs and dummies to a proper OID NID */
int
EVP_CIPHER_type(const EVP_CIPHER *cipher)

View file

@ -1,4 +1,4 @@
/* $OpenBSD: evp_local.h,v 1.11 2024/01/01 15:23:00 tb Exp $ */
/* $OpenBSD: evp_local.h,v 1.13 2024/01/04 17:38:36 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2000.
*/
@ -90,8 +90,8 @@ struct ecx_key_st {
};
struct evp_pkey_asn1_method_st {
const EVP_PKEY_ASN1_METHOD *base_method;
int pkey_id;
int pkey_base_id;
unsigned long pkey_flags;
char *pem_str;
@ -223,7 +223,6 @@ struct evp_cipher_st {
int (*set_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Populate a ASN1_TYPE with parameters */
int (*get_asn1_parameters)(EVP_CIPHER_CTX *, ASN1_TYPE *); /* Get parameters from a ASN1_TYPE */
int (*ctrl)(EVP_CIPHER_CTX *, int type, int arg, void *ptr); /* Miscellaneous operations */
void *app_data; /* Application data */
} /* EVP_CIPHER */;
struct evp_cipher_ctx_st {

View file

@ -1,4 +1,4 @@
/* $OpenBSD: p_lib.c,v 1.52 2024/01/01 15:23:00 tb Exp $ */
/* $OpenBSD: p_lib.c,v 1.57 2024/01/04 17:22:29 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -133,33 +133,40 @@
extern const EVP_PKEY_ASN1_METHOD cmac_asn1_meth;
extern const EVP_PKEY_ASN1_METHOD dh_asn1_meth;
extern const EVP_PKEY_ASN1_METHOD dsa_asn1_meths[];
extern const EVP_PKEY_ASN1_METHOD dsa_asn1_meth;
extern const EVP_PKEY_ASN1_METHOD dsa1_asn1_meth;
extern const EVP_PKEY_ASN1_METHOD dsa2_asn1_meth;
extern const EVP_PKEY_ASN1_METHOD dsa3_asn1_meth;
extern const EVP_PKEY_ASN1_METHOD dsa4_asn1_meth;
extern const EVP_PKEY_ASN1_METHOD eckey_asn1_meth;
extern const EVP_PKEY_ASN1_METHOD ed25519_asn1_meth;
extern const EVP_PKEY_ASN1_METHOD gostimit_asn1_meth;
extern const EVP_PKEY_ASN1_METHOD gostr01_asn1_meths[];
extern const EVP_PKEY_ASN1_METHOD gostr01_asn1_meth;
extern const EVP_PKEY_ASN1_METHOD gostr12_256_asn1_meth;
extern const EVP_PKEY_ASN1_METHOD gostr12_512_asn1_meth;
extern const EVP_PKEY_ASN1_METHOD hmac_asn1_meth;
extern const EVP_PKEY_ASN1_METHOD rsa_asn1_meths[];
extern const EVP_PKEY_ASN1_METHOD rsa_asn1_meth;
extern const EVP_PKEY_ASN1_METHOD rsa2_asn1_meth;
extern const EVP_PKEY_ASN1_METHOD rsa_pss_asn1_meth;
extern const EVP_PKEY_ASN1_METHOD x25519_asn1_meth;
static const EVP_PKEY_ASN1_METHOD *asn1_methods[] = {
&cmac_asn1_meth,
&dh_asn1_meth,
&dsa_asn1_meths[0],
&dsa_asn1_meths[1],
&dsa_asn1_meths[2],
&dsa_asn1_meths[3],
&dsa_asn1_meths[4],
&dsa_asn1_meth,
&dsa1_asn1_meth,
&dsa2_asn1_meth,
&dsa3_asn1_meth,
&dsa4_asn1_meth,
&eckey_asn1_meth,
&ed25519_asn1_meth,
&gostimit_asn1_meth,
&gostr01_asn1_meths[0],
&gostr01_asn1_meths[1],
&gostr01_asn1_meths[2],
&gostr01_asn1_meth,
&gostr12_256_asn1_meth,
&gostr12_512_asn1_meth,
&hmac_asn1_meth,
&rsa_asn1_meths[0],
&rsa_asn1_meths[1],
&rsa_asn1_meth,
&rsa2_asn1_meth,
&rsa_pss_asn1_meth,
&x25519_asn1_meth,
};
@ -181,84 +188,71 @@ EVP_PKEY_asn1_get0(int idx)
return asn1_methods[idx];
}
static const EVP_PKEY_ASN1_METHOD *
pkey_asn1_find(int pkey_id)
const EVP_PKEY_ASN1_METHOD *
EVP_PKEY_asn1_find(ENGINE **engine, int pkey_id)
{
const EVP_PKEY_ASN1_METHOD *ameth;
int i;
size_t i;
for (i = EVP_PKEY_asn1_get_count() - 1; i >= 0; i--) {
ameth = EVP_PKEY_asn1_get0(i);
if (ameth->pkey_id == pkey_id)
return ameth;
if (engine != NULL)
*engine = NULL;
for (i = 0; i < N_ASN1_METHODS; i++) {
if (asn1_methods[i]->pkey_id == pkey_id)
return asn1_methods[i]->base_method;
}
return NULL;
}
/*
* XXX - fix this. In what looks like an infinite loop, this API only makes two
* calls to pkey_asn1_find(): If the type resolves to an aliased ASN.1 method,
* the second call will find the method it aliases. Codify this in regress and
* make this explicit in code.
*/
const EVP_PKEY_ASN1_METHOD *
EVP_PKEY_asn1_find(ENGINE **pe, int type)
{
const EVP_PKEY_ASN1_METHOD *mp;
if (pe != NULL)
*pe = NULL;
for (;;) {
if ((mp = pkey_asn1_find(type)) == NULL)
break;
if ((mp->pkey_flags & ASN1_PKEY_ALIAS) == 0)
break;
type = mp->pkey_base_id;
}
return mp;
}
const EVP_PKEY_ASN1_METHOD *
EVP_PKEY_asn1_find_str(ENGINE **pe, const char *str, int len)
EVP_PKEY_asn1_find_str(ENGINE **engine, const char *str, int len)
{
const EVP_PKEY_ASN1_METHOD *ameth;
size_t str_len;
int i;
if (engine != NULL)
*engine = NULL;
if (len < -1)
return NULL;
if (len == -1)
len = strlen(str);
if (pe != NULL)
*pe = NULL;
for (i = EVP_PKEY_asn1_get_count() - 1; i >= 0; i--) {
ameth = EVP_PKEY_asn1_get0(i);
str_len = strlen(str);
else
str_len = len;
for (i = 0; i < N_ASN1_METHODS; i++) {
ameth = asn1_methods[i];
if (ameth->pkey_flags & ASN1_PKEY_ALIAS)
continue;
if (((int)strlen(ameth->pem_str) == len) &&
!strncasecmp(ameth->pem_str, str, len))
if (strlen(ameth->pem_str) != str_len)
continue;
if (strncasecmp(ameth->pem_str, str, str_len) == 0)
return ameth;
}
return NULL;
}
int
EVP_PKEY_asn1_get0_info(int *ppkey_id, int *ppkey_base_id, int *ppkey_flags,
const char **pinfo, const char **ppem_str,
EVP_PKEY_asn1_get0_info(int *pkey_id, int *pkey_base_id, int *pkey_flags,
const char **info, const char **pem_str,
const EVP_PKEY_ASN1_METHOD *ameth)
{
if (!ameth)
if (ameth == NULL)
return 0;
if (ppkey_id)
*ppkey_id = ameth->pkey_id;
if (ppkey_base_id)
*ppkey_base_id = ameth->pkey_base_id;
if (ppkey_flags)
*ppkey_flags = ameth->pkey_flags;
if (pinfo)
*pinfo = ameth->info;
if (ppem_str)
*ppem_str = ameth->pem_str;
if (pkey_id != NULL)
*pkey_id = ameth->pkey_id;
if (pkey_base_id != NULL)
*pkey_base_id = ameth->base_method->pkey_id;
if (pkey_flags != NULL)
*pkey_flags = ameth->pkey_flags;
if (info != NULL)
*info = ameth->info;
if (pem_str != NULL)
*pem_str = ameth->pem_str;
return 1;
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: pmeth_lib.c,v 1.35 2023/11/29 21:35:57 tb Exp $ */
/* $OpenBSD: pmeth_lib.c,v 1.36 2024/01/04 20:15:01 tb Exp $ */
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
* project 2006.
*/
@ -71,9 +71,6 @@
#include "asn1_local.h"
#include "evp_local.h"
DECLARE_STACK_OF(EVP_PKEY_METHOD)
STACK_OF(EVP_PKEY_METHOD) *pkey_app_methods = NULL;
extern const EVP_PKEY_METHOD cmac_pkey_meth;
extern const EVP_PKEY_METHOD dh_pkey_meth;
extern const EVP_PKEY_METHOD dsa_pkey_meth;
@ -102,43 +99,15 @@ static const EVP_PKEY_METHOD *pkey_methods[] = {
&x25519_pkey_meth,
};
static const size_t pkey_methods_count =
sizeof(pkey_methods) / sizeof(pkey_methods[0]);
int
evp_pkey_meth_get_count(void)
{
int num = pkey_methods_count;
if (pkey_app_methods != NULL)
num += sk_EVP_PKEY_METHOD_num(pkey_app_methods);
return num;
}
const EVP_PKEY_METHOD *
evp_pkey_meth_get0(int idx)
{
int num = pkey_methods_count;
if (idx < 0)
return NULL;
if (idx < num)
return pkey_methods[idx];
idx -= num;
return sk_EVP_PKEY_METHOD_value(pkey_app_methods, idx);
}
#define N_PKEY_METHODS (sizeof(pkey_methods) / sizeof(pkey_methods[0]))
const EVP_PKEY_METHOD *
EVP_PKEY_meth_find(int type)
{
const EVP_PKEY_METHOD *pmeth;
int i;
size_t i;
for (i = evp_pkey_meth_get_count() - 1; i >= 0; i--) {
pmeth = evp_pkey_meth_get0(i);
for (i = 0; i < N_PKEY_METHODS; i++) {
const EVP_PKEY_METHOD *pmeth = pkey_methods[i];
if (pmeth->pkey_id == type)
return pmeth;
}
@ -275,16 +244,8 @@ EVP_PKEY_CTX_dup(EVP_PKEY_CTX *pctx)
int
EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth)
{
if (pkey_app_methods == NULL) {
pkey_app_methods = sk_EVP_PKEY_METHOD_new(NULL);
if (pkey_app_methods == NULL)
return 0;
}
if (!sk_EVP_PKEY_METHOD_push(pkey_app_methods, pmeth))
return 0;
return 1;
EVPerror(ERR_R_DISABLED);
return 0;
}
void