This commit is contained in:
purplerain 2023-05-13 14:25:18 +00:00
parent f609457dcf
commit 62073e0295
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
318 changed files with 8112 additions and 4346 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ec_asn1.c,v 1.42 2023/04/25 19:53:30 tb Exp $ */
/* $OpenBSD: ec_asn1.c,v 1.45 2023/05/04 05:59:38 tb Exp $ */
/*
* Written by Nils Larsch for the OpenSSL project.
*/
@ -225,7 +225,6 @@ static const ASN1_ADB_TABLE X9_62_CHARACTERISTIC_TWO_adbtbl[] = {
.field_name = "p.onBasis",
.item = &ASN1_NULL_it,
},
},
{
.value = NID_X9_62_tpBasis,
@ -236,7 +235,6 @@ static const ASN1_ADB_TABLE X9_62_CHARACTERISTIC_TWO_adbtbl[] = {
.field_name = "p.tpBasis",
.item = &ASN1_INTEGER_it,
},
},
{
.value = NID_X9_62_ppBasis,
@ -327,7 +325,6 @@ static const ASN1_ADB_TABLE X9_62_FIELDID_adbtbl[] = {
.field_name = "p.prime",
.item = &ASN1_INTEGER_it,
},
},
{
.value = NID_X9_62_characteristic_two_field,
@ -338,7 +335,6 @@ static const ASN1_ADB_TABLE X9_62_FIELDID_adbtbl[] = {
.field_name = "p.char_two",
.item = &X9_62_CHARACTERISTIC_TWO_it,
},
},
};
@ -619,7 +615,7 @@ EC_PRIVATEKEY_free(EC_PRIVATEKEY *a)
/* some declarations of internal function */
/* ec_asn1_group2field() sets the values in a X9_62_FIELDID object */
/* ec_asn1_group2fieldid() sets the values in a X9_62_FIELDID object */
static int ec_asn1_group2fieldid(const EC_GROUP *, X9_62_FIELDID *);
/* ec_asn1_group2curve() sets the values in a X9_62_CURVE object */
static int ec_asn1_group2curve(const EC_GROUP *, X9_62_CURVE *);
@ -912,8 +908,8 @@ ec_asn1_group2pkparameters(const EC_GROUP *group, ECPKPARAMETERS *params)
} else {
/* use the ECPARAMETERS structure */
ret->type = 1;
if ((ret->value.parameters = ec_asn1_group2parameters(
group, NULL)) == NULL)
if ((ret->value.parameters = ec_asn1_group2parameters(group,
NULL)) == NULL)
ok = 0;
}
@ -1098,7 +1094,7 @@ ec_asn1_pkparameters2group(const ECPKPARAMETERS *params)
/* EC_GROUP <-> DER encoding of ECPKPARAMETERS */
EC_GROUP *
d2i_ECPKParameters(EC_GROUP ** a, const unsigned char **in, long len)
d2i_ECPKParameters(EC_GROUP **a, const unsigned char **in, long len)
{
EC_GROUP *group = NULL;
ECPKPARAMETERS *params;
@ -1143,7 +1139,7 @@ i2d_ECPKParameters(const EC_GROUP *a, unsigned char **out)
/* some EC_KEY functions */
EC_KEY *
d2i_ECPrivateKey(EC_KEY ** a, const unsigned char **in, long len)
d2i_ECPrivateKey(EC_KEY **a, const unsigned char **in, long len)
{
EC_KEY *ret = NULL;
EC_PRIVATEKEY *priv_key = NULL;
@ -1329,7 +1325,7 @@ i2d_ECParameters(EC_KEY *a, unsigned char **out)
}
EC_KEY *
d2i_ECParameters(EC_KEY ** a, const unsigned char **in, long len)
d2i_ECParameters(EC_KEY **a, const unsigned char **in, long len)
{
EC_KEY *ret;
@ -1358,7 +1354,7 @@ d2i_ECParameters(EC_KEY ** a, const unsigned char **in, long len)
}
EC_KEY *
o2i_ECPublicKey(EC_KEY ** a, const unsigned char **in, long len)
o2i_ECPublicKey(EC_KEY **a, const unsigned char **in, long len)
{
EC_KEY *ret = NULL;

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ec_lib.c,v 1.56 2023/04/25 19:53:30 tb Exp $ */
/* $OpenBSD: ec_lib.c,v 1.57 2023/05/04 13:51:59 tb Exp $ */
/*
* Originally written by Bodo Moeller for the OpenSSL project.
*/
@ -1459,15 +1459,20 @@ ec_group_simple_order_bits(const EC_GROUP *group)
EC_KEY *
ECParameters_dup(EC_KEY *key)
{
unsigned char *p = NULL;
EC_KEY *k = NULL;
const unsigned char *p;
unsigned char *der = NULL;
EC_KEY *dup = NULL;
int len;
if (key == NULL)
return (NULL);
return NULL;
if ((len = i2d_ECParameters(key, &p)) > 0)
k = d2i_ECParameters(NULL, (const unsigned char **)&p, len);
if ((len = i2d_ECParameters(key, &der)) <= 0)
return NULL;
return (k);
p = der;
dup = d2i_ECParameters(NULL, &p, len);
freezero(der, len);
return dup;
}

View file

@ -1,4 +1,4 @@
/* $OpenBSD: ec_oct.c,v 1.13 2023/05/01 21:15:26 tb Exp $ */
/* $OpenBSD: ec_oct.c,v 1.14 2023/05/04 06:45:51 tb Exp $ */
/*
* Originally written by Bodo Moeller for the OpenSSL project.
*/
@ -113,7 +113,7 @@ EC_POINT_point2oct(const EC_GROUP *group, const EC_POINT *point,
BN_CTX *ctx_in)
{
BN_CTX *ctx;
int ret = 0;
size_t ret = 0;
if ((ctx = ctx_in) == NULL)
ctx = BN_CTX_new();