sync code with last fixes and improvements from OpenBSD
This commit is contained in:
parent
58df21ce75
commit
f960599e67
399 changed files with 7016 additions and 6902 deletions
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: arm64cap.c,v 1.2 2022/03/25 17:42:07 robert Exp $ */
|
||||
/* $OpenBSD: arm64cap.c,v 1.3 2023/07/26 09:57:34 jsing Exp $ */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -30,10 +30,6 @@
|
|||
|
||||
unsigned int OPENSSL_armcap_P;
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ >= 2
|
||||
void OPENSSL_cpuid_setup(void) __attribute__((constructor));
|
||||
#endif
|
||||
|
||||
#if defined(CPU_ID_AA64ISAR0)
|
||||
void
|
||||
OPENSSL_cpuid_setup(void)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: armcap.c,v 1.1 2022/03/23 15:13:31 tb Exp $ */
|
||||
/* $OpenBSD: armcap.c,v 1.2 2023/07/26 09:57:34 jsing Exp $ */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -28,10 +28,6 @@ void _armv8_sha256_probe(void);
|
|||
void _armv8_pmull_probe(void);
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__>=2
|
||||
void OPENSSL_cpuid_setup(void) __attribute__((constructor));
|
||||
#endif
|
||||
|
||||
void
|
||||
OPENSSL_cpuid_setup(void)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: x_name.c,v 1.40 2023/07/07 19:37:52 beck Exp $ */
|
||||
/* $OpenBSD: x_name.c,v 1.41 2023/07/24 06:56:54 tb Exp $ */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -189,13 +189,13 @@ const ASN1_ITEM X509_NAME_INTERNAL_it = {
|
|||
*/
|
||||
|
||||
const ASN1_EXTERN_FUNCS x509_name_ff = {
|
||||
NULL,
|
||||
x509_name_ex_new,
|
||||
x509_name_ex_free,
|
||||
0, /* Default clear behaviour is OK */
|
||||
x509_name_ex_d2i,
|
||||
x509_name_ex_i2d,
|
||||
x509_name_ex_print
|
||||
.app_data = NULL,
|
||||
.asn1_ex_new = x509_name_ex_new,
|
||||
.asn1_ex_free = x509_name_ex_free,
|
||||
.asn1_ex_clear = NULL,
|
||||
.asn1_ex_d2i = x509_name_ex_d2i,
|
||||
.asn1_ex_i2d = x509_name_ex_i2d,
|
||||
.asn1_ex_print = x509_name_ex_print,
|
||||
};
|
||||
|
||||
const ASN1_ITEM X509_NAME_it = {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: bn_arch.h,v 1.12 2023/06/21 07:56:43 jsing Exp $ */
|
||||
/* $OpenBSD: bn_arch.h,v 1.13 2023/07/24 10:21:29 jsing Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2023 Joel Sing <jsing@openbsd.org>
|
||||
*
|
||||
|
@ -241,7 +241,7 @@ bn_qwmulw_addw(BN_ULONG a3, BN_ULONG a2, BN_ULONG a1, BN_ULONG a0, BN_ULONG b,
|
|||
"mul %[c], %[a3], %[b] \n"
|
||||
"adcs %[r3], %[r3], %[c] \n"
|
||||
"adc %[r4], %[r4], xzr \n"
|
||||
: [c]"+r"(c), [r4]"=&r"(r4), [r3]"=&r"(r3), [r2]"=&r"(r2),
|
||||
: [c]"+&r"(c), [r4]"=&r"(r4), [r3]"=&r"(r3), [r2]"=&r"(r2),
|
||||
[r1]"=&r"(r1), [r0]"=&r"(r0)
|
||||
: [a3]"r"(a3), [a2]"r"(a2), [a1]"r"(a1), [a0]"r"(a0), [b]"r"(b)
|
||||
: "cc");
|
||||
|
@ -282,7 +282,7 @@ bn_qwmulw_addqw_addw(BN_ULONG a3, BN_ULONG a2, BN_ULONG a1, BN_ULONG a0,
|
|||
"adcs %[r2], %[r2], %[c2] \n"
|
||||
"adcs %[r3], %[r3], %[c3] \n"
|
||||
"adc %[r4], %[r4], xzr \n"
|
||||
: [d]"+r"(d), [r4]"=&r"(r4), [r3]"=&r"(r3), [r2]"=&r"(r2),
|
||||
: [d]"+&r"(d), [r4]"=&r"(r4), [r3]"=&r"(r3), [r2]"=&r"(r2),
|
||||
[r1]"=&r"(r1), [r0]"=&r"(r0)
|
||||
: [a3]"r"(a3), [a2]"r"(a2), [a1]"r"(a1), [a0]"r"(a0), [b]"r"(b),
|
||||
[c3]"r"(c3), [c2]"r"(c2), [c1]"r"(c1), [c0]"r"(c0)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: bn_print.c,v 1.45 2023/07/10 02:29:28 tb Exp $ */
|
||||
/* $OpenBSD: bn_print.c,v 1.46 2023/07/22 17:14:08 tb Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2023 Theo Buehler <tb@openbsd.org>
|
||||
|
@ -17,7 +17,6 @@
|
|||
*/
|
||||
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
|
@ -73,11 +72,9 @@ bn_print_bignum(BIO *bio, const BIGNUM *bn, int indent)
|
|||
goto err;
|
||||
|
||||
/* Secondary indent is 4 spaces, capped at 128. */
|
||||
if (indent > INT_MAX - 4)
|
||||
goto err;
|
||||
if (indent > 124)
|
||||
indent = 124;
|
||||
indent += 4;
|
||||
if (indent > 128)
|
||||
indent = 128;
|
||||
if (indent < 0)
|
||||
indent = 0;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ct_sct.c,v 1.9 2023/07/08 07:22:58 beck Exp $ */
|
||||
/* $OpenBSD: ct_sct.c,v 1.10 2023/07/22 17:02:49 tb Exp $ */
|
||||
/*
|
||||
* Written by Rob Stradling (rob@comodo.com), Stephen Henson (steve@openssl.org)
|
||||
* and Adam Eijdenberg (adam.eijdenberg@gmail.com) for the OpenSSL project 2016.
|
||||
|
@ -61,14 +61,16 @@
|
|||
# error "CT disabled"
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <openssl/asn1.h>
|
||||
#include <openssl/ct.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/tls1.h>
|
||||
#include <openssl/objects.h>
|
||||
#include <openssl/x509.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "ct_local.h"
|
||||
|
||||
SCT *
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: dh_check.c,v 1.27 2023/07/08 15:29:03 beck Exp $ */
|
||||
/* $OpenBSD: dh_check.c,v 1.28 2023/07/24 16:25:02 tb Exp $ */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -289,7 +289,7 @@ DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *flags)
|
|||
if (!BN_mod_exp_ct(residue, pub_key, dh->q, dh->p, ctx))
|
||||
goto err;
|
||||
if (!BN_is_one(residue))
|
||||
*flags = DH_CHECK_PUBKEY_INVALID;
|
||||
*flags |= DH_CHECK_PUBKEY_INVALID;
|
||||
}
|
||||
|
||||
ok = 1;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ec_lib.c,v 1.64 2023/07/07 19:37:53 beck Exp $ */
|
||||
/* $OpenBSD: ec_lib.c,v 1.65 2023/07/25 06:57:26 tb Exp $ */
|
||||
/*
|
||||
* Originally written by Bodo Moeller for the OpenSSL project.
|
||||
*/
|
||||
|
@ -1062,7 +1062,7 @@ EC_POINT_is_on_curve(const EC_GROUP *group, const EC_POINT *point,
|
|||
BN_CTX *ctx_in)
|
||||
{
|
||||
BN_CTX *ctx;
|
||||
int ret = 0;
|
||||
int ret = -1;
|
||||
|
||||
if ((ctx = ctx_in) == NULL)
|
||||
ctx = BN_CTX_new();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ecp_smpl.c,v 1.46 2023/07/07 13:54:45 beck Exp $ */
|
||||
/* $OpenBSD: ecp_smpl.c,v 1.55 2023/07/26 17:15:25 tb Exp $ */
|
||||
/* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de>
|
||||
* for the OpenSSL project.
|
||||
* Includes code written by Bodo Moeller for the OpenSSL project.
|
||||
|
@ -114,11 +114,52 @@ ec_GFp_simple_group_copy(EC_GROUP *dest, const EC_GROUP *src)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
ec_decode_scalar(const EC_GROUP *group, BIGNUM *bn, const BIGNUM *x, BN_CTX *ctx)
|
||||
{
|
||||
if (bn == NULL)
|
||||
return 1;
|
||||
|
||||
if (group->meth->field_decode != NULL)
|
||||
return group->meth->field_decode(group, bn, x, ctx);
|
||||
|
||||
return bn_copy(bn, x);
|
||||
}
|
||||
|
||||
static int
|
||||
ec_encode_scalar(const EC_GROUP *group, BIGNUM *bn, const BIGNUM *x, BN_CTX *ctx)
|
||||
{
|
||||
if (!BN_nnmod(bn, x, &group->field, ctx))
|
||||
return 0;
|
||||
|
||||
if (group->meth->field_encode != NULL)
|
||||
return group->meth->field_encode(group, bn, bn, ctx);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
ec_encode_z_coordinate(const EC_GROUP *group, BIGNUM *bn, int *is_one,
|
||||
const BIGNUM *z, BN_CTX *ctx)
|
||||
{
|
||||
if (!BN_nnmod(bn, z, &group->field, ctx))
|
||||
return 0;
|
||||
|
||||
*is_one = BN_is_one(bn);
|
||||
if (*is_one && group->meth->field_set_to_one != NULL)
|
||||
return group->meth->field_set_to_one(group, bn, ctx);
|
||||
|
||||
if (group->meth->field_encode != NULL)
|
||||
return group->meth->field_encode(group, bn, bn, ctx);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
ec_GFp_simple_group_set_curve(EC_GROUP *group,
|
||||
const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
|
||||
{
|
||||
BIGNUM *tmp_a;
|
||||
BIGNUM *a_plus_3;
|
||||
int ret = 0;
|
||||
|
||||
/* p must be a prime > 3 */
|
||||
|
@ -129,34 +170,24 @@ ec_GFp_simple_group_set_curve(EC_GROUP *group,
|
|||
|
||||
BN_CTX_start(ctx);
|
||||
|
||||
if ((tmp_a = BN_CTX_get(ctx)) == NULL)
|
||||
if ((a_plus_3 = BN_CTX_get(ctx)) == NULL)
|
||||
goto err;
|
||||
|
||||
/* group->field */
|
||||
if (!bn_copy(&group->field, p))
|
||||
goto err;
|
||||
BN_set_negative(&group->field, 0);
|
||||
|
||||
/* group->a */
|
||||
if (!BN_nnmod(tmp_a, a, p, ctx))
|
||||
if (!ec_encode_scalar(group, &group->a, a, ctx))
|
||||
goto err;
|
||||
if (group->meth->field_encode) {
|
||||
if (!group->meth->field_encode(group, &group->a, tmp_a, ctx))
|
||||
goto err;
|
||||
} else if (!bn_copy(&group->a, tmp_a))
|
||||
if (!ec_encode_scalar(group, &group->b, b, ctx))
|
||||
goto err;
|
||||
|
||||
/* group->b */
|
||||
if (!BN_nnmod(&group->b, b, p, ctx))
|
||||
if (!BN_set_word(a_plus_3, 3))
|
||||
goto err;
|
||||
if (!BN_mod_add(a_plus_3, a_plus_3, a, &group->field, ctx))
|
||||
goto err;
|
||||
if (group->meth->field_encode)
|
||||
if (!group->meth->field_encode(group, &group->b, &group->b, ctx))
|
||||
goto err;
|
||||
|
||||
/* group->a_is_minus3 */
|
||||
if (!BN_add_word(tmp_a, 3))
|
||||
goto err;
|
||||
group->a_is_minus3 = (0 == BN_cmp(tmp_a, &group->field));
|
||||
group->a_is_minus3 = BN_is_zero(a_plus_3);
|
||||
|
||||
ret = 1;
|
||||
|
||||
|
@ -167,31 +198,17 @@ ec_GFp_simple_group_set_curve(EC_GROUP *group,
|
|||
}
|
||||
|
||||
int
|
||||
ec_GFp_simple_group_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNUM *b, BN_CTX *ctx)
|
||||
ec_GFp_simple_group_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a,
|
||||
BIGNUM *b, BN_CTX *ctx)
|
||||
{
|
||||
if (p != NULL) {
|
||||
if (!bn_copy(p, &group->field))
|
||||
return 0;
|
||||
}
|
||||
if (group->meth->field_decode != NULL) {
|
||||
if (a != NULL) {
|
||||
if (!group->meth->field_decode(group, a, &group->a, ctx))
|
||||
return 0;
|
||||
}
|
||||
if (b != NULL) {
|
||||
if (!group->meth->field_decode(group, b, &group->b, ctx))
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
if (a != NULL) {
|
||||
if (!bn_copy(a, &group->a))
|
||||
return 0;
|
||||
}
|
||||
if (b != NULL) {
|
||||
if (!bn_copy(b, &group->b))
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (!ec_decode_scalar(group, a, &group->a, ctx))
|
||||
return 0;
|
||||
if (!ec_decode_scalar(group, b, &group->b, ctx))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -205,62 +222,52 @@ ec_GFp_simple_group_get_degree(const EC_GROUP *group)
|
|||
int
|
||||
ec_GFp_simple_group_check_discriminant(const EC_GROUP *group, BN_CTX *ctx)
|
||||
{
|
||||
BIGNUM *a, *b, *order, *tmp_1, *tmp_2;
|
||||
const BIGNUM *p = &group->field;
|
||||
BIGNUM *p, *a, *b, *discriminant;
|
||||
int ret = 0;
|
||||
|
||||
BN_CTX_start(ctx);
|
||||
|
||||
if ((p = BN_CTX_get(ctx)) == NULL)
|
||||
goto err;
|
||||
if ((a = BN_CTX_get(ctx)) == NULL)
|
||||
goto err;
|
||||
if ((b = BN_CTX_get(ctx)) == NULL)
|
||||
goto err;
|
||||
if ((tmp_1 = BN_CTX_get(ctx)) == NULL)
|
||||
goto err;
|
||||
if ((tmp_2 = BN_CTX_get(ctx)) == NULL)
|
||||
goto err;
|
||||
if ((order = BN_CTX_get(ctx)) == NULL)
|
||||
if ((discriminant = BN_CTX_get(ctx)) == NULL)
|
||||
goto err;
|
||||
|
||||
if (group->meth->field_decode) {
|
||||
if (!group->meth->field_decode(group, a, &group->a, ctx))
|
||||
goto err;
|
||||
if (!group->meth->field_decode(group, b, &group->b, ctx))
|
||||
goto err;
|
||||
} else {
|
||||
if (!bn_copy(a, &group->a))
|
||||
goto err;
|
||||
if (!bn_copy(b, &group->b))
|
||||
goto err;
|
||||
}
|
||||
if (!EC_GROUP_get_curve(group, p, a, b, ctx))
|
||||
goto err;
|
||||
|
||||
/*
|
||||
* check the discriminant: y^2 = x^3 + a*x + b is an elliptic curve
|
||||
* <=> 4*a^3 + 27*b^2 != 0 (mod p) 0 =< a, b < p
|
||||
* Check that the discriminant 4a^3 + 27b^2 is non-zero modulo p.
|
||||
*/
|
||||
if (BN_is_zero(a)) {
|
||||
if (BN_is_zero(b))
|
||||
goto err;
|
||||
} else if (!BN_is_zero(b)) {
|
||||
if (!BN_mod_sqr(tmp_1, a, p, ctx))
|
||||
goto err;
|
||||
if (!BN_mod_mul(tmp_2, tmp_1, a, p, ctx))
|
||||
goto err;
|
||||
if (!BN_lshift(tmp_1, tmp_2, 2))
|
||||
goto err;
|
||||
/* tmp_1 = 4*a^3 */
|
||||
|
||||
if (!BN_mod_sqr(tmp_2, b, p, ctx))
|
||||
goto err;
|
||||
if (!BN_mul_word(tmp_2, 27))
|
||||
goto err;
|
||||
/* tmp_2 = 27*b^2 */
|
||||
if (BN_is_zero(a) && BN_is_zero(b))
|
||||
goto err;
|
||||
if (BN_is_zero(a) || BN_is_zero(b))
|
||||
goto done;
|
||||
|
||||
if (!BN_mod_add(a, tmp_1, tmp_2, p, ctx))
|
||||
goto err;
|
||||
if (BN_is_zero(a))
|
||||
goto err;
|
||||
}
|
||||
/* Compute the discriminant: first 4a^3, then 27b^2, then their sum. */
|
||||
if (!BN_mod_sqr(discriminant, a, p, ctx))
|
||||
goto err;
|
||||
if (!BN_mod_mul(discriminant, discriminant, a, p, ctx))
|
||||
goto err;
|
||||
if (!BN_lshift(discriminant, discriminant, 2))
|
||||
goto err;
|
||||
|
||||
if (!BN_mod_sqr(b, b, p, ctx))
|
||||
goto err;
|
||||
if (!BN_mul_word(b, 27))
|
||||
goto err;
|
||||
|
||||
if (!BN_mod_add(discriminant, discriminant, b, p, ctx))
|
||||
goto err;
|
||||
|
||||
if (BN_is_zero(discriminant))
|
||||
goto err;
|
||||
|
||||
done:
|
||||
ret = 1;
|
||||
|
||||
err:
|
||||
|
@ -318,39 +325,25 @@ ec_GFp_simple_set_Jprojective_coordinates(const EC_GROUP *group,
|
|||
{
|
||||
int ret = 0;
|
||||
|
||||
/*
|
||||
* Setting individual coordinates allows the creation of bad points.
|
||||
* EC_POINT_set_Jprojective_coordinates() checks at the API boundary.
|
||||
*/
|
||||
|
||||
if (x != NULL) {
|
||||
if (!BN_nnmod(&point->X, x, &group->field, ctx))
|
||||
if (!ec_encode_scalar(group, &point->X, x, ctx))
|
||||
goto err;
|
||||
if (group->meth->field_encode != NULL) {
|
||||
if (!group->meth->field_encode(group, &point->X, &point->X, ctx))
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
if (y != NULL) {
|
||||
if (!BN_nnmod(&point->Y, y, &group->field, ctx))
|
||||
if (!ec_encode_scalar(group, &point->Y, y, ctx))
|
||||
goto err;
|
||||
if (group->meth->field_encode != NULL) {
|
||||
if (!group->meth->field_encode(group, &point->Y, &point->Y, ctx))
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
if (z != NULL) {
|
||||
int Z_is_one;
|
||||
|
||||
if (!BN_nnmod(&point->Z, z, &group->field, ctx))
|
||||
if (!ec_encode_z_coordinate(group, &point->Z, &point->Z_is_one,
|
||||
z, ctx))
|
||||
goto err;
|
||||
Z_is_one = BN_is_one(&point->Z);
|
||||
if (group->meth->field_encode != NULL) {
|
||||
if (Z_is_one && (group->meth->field_set_to_one != 0)) {
|
||||
if (!group->meth->field_set_to_one(group, &point->Z, ctx))
|
||||
goto err;
|
||||
} else {
|
||||
if (!group->meth->field_encode(group, &point->Z, &point->Z, ctx))
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
point->Z_is_one = Z_is_one;
|
||||
}
|
||||
|
||||
ret = 1;
|
||||
|
||||
err:
|
||||
|
@ -363,33 +356,12 @@ ec_GFp_simple_get_Jprojective_coordinates(const EC_GROUP *group,
|
|||
{
|
||||
int ret = 0;
|
||||
|
||||
if (group->meth->field_decode != NULL) {
|
||||
if (x != NULL) {
|
||||
if (!group->meth->field_decode(group, x, &point->X, ctx))
|
||||
goto err;
|
||||
}
|
||||
if (y != NULL) {
|
||||
if (!group->meth->field_decode(group, y, &point->Y, ctx))
|
||||
goto err;
|
||||
}
|
||||
if (z != NULL) {
|
||||
if (!group->meth->field_decode(group, z, &point->Z, ctx))
|
||||
goto err;
|
||||
}
|
||||
} else {
|
||||
if (x != NULL) {
|
||||
if (!bn_copy(x, &point->X))
|
||||
goto err;
|
||||
}
|
||||
if (y != NULL) {
|
||||
if (!bn_copy(y, &point->Y))
|
||||
goto err;
|
||||
}
|
||||
if (z != NULL) {
|
||||
if (!bn_copy(z, &point->Z))
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
if (!ec_decode_scalar(group, x, &point->X, ctx))
|
||||
goto err;
|
||||
if (!ec_decode_scalar(group, y, &point->Y, ctx))
|
||||
goto err;
|
||||
if (!ec_decode_scalar(group, z, &point->Z, ctx))
|
||||
goto err;
|
||||
|
||||
ret = 1;
|
||||
|
||||
|
@ -411,11 +383,10 @@ ec_GFp_simple_point_set_affine_coordinates(const EC_GROUP *group, EC_POINT *poin
|
|||
}
|
||||
|
||||
int
|
||||
ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *point,
|
||||
BIGNUM *x, BIGNUM *y, BN_CTX *ctx)
|
||||
ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP *group,
|
||||
const EC_POINT *point, BIGNUM *x, BIGNUM *y, BN_CTX *ctx)
|
||||
{
|
||||
BIGNUM *Z, *Z_1, *Z_2, *Z_3;
|
||||
const BIGNUM *Z_;
|
||||
BIGNUM *z, *Z, *Z_1, *Z_2, *Z_3;
|
||||
int ret = 0;
|
||||
|
||||
if (EC_POINT_is_at_infinity(group, point) > 0) {
|
||||
|
@ -425,6 +396,8 @@ ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP *group, const EC_POINT
|
|||
|
||||
BN_CTX_start(ctx);
|
||||
|
||||
if ((z = BN_CTX_get(ctx)) == NULL)
|
||||
goto err;
|
||||
if ((Z = BN_CTX_get(ctx)) == NULL)
|
||||
goto err;
|
||||
if ((Z_1 = BN_CTX_get(ctx)) == NULL)
|
||||
|
@ -434,77 +407,59 @@ ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP *group, const EC_POINT
|
|||
if ((Z_3 = BN_CTX_get(ctx)) == NULL)
|
||||
goto err;
|
||||
|
||||
/* transform (X, Y, Z) into (x, y) := (X/Z^2, Y/Z^3) */
|
||||
/* Convert from projective coordinates (X, Y, Z) into (X/Z^2, Y/Z^3). */
|
||||
|
||||
if (group->meth->field_decode) {
|
||||
if (!group->meth->field_decode(group, Z, &point->Z, ctx))
|
||||
if (!ec_decode_scalar(group, z, &point->Z, ctx))
|
||||
goto err;
|
||||
|
||||
if (BN_is_one(z)) {
|
||||
if (!ec_decode_scalar(group, x, &point->X, ctx))
|
||||
goto err;
|
||||
Z_ = Z;
|
||||
} else {
|
||||
Z_ = &point->Z;
|
||||
if (!ec_decode_scalar(group, y, &point->Y, ctx))
|
||||
goto err;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (BN_is_one(Z_)) {
|
||||
if (group->meth->field_decode) {
|
||||
if (x != NULL) {
|
||||
if (!group->meth->field_decode(group, x, &point->X, ctx))
|
||||
goto err;
|
||||
}
|
||||
if (y != NULL) {
|
||||
if (!group->meth->field_decode(group, y, &point->Y, ctx))
|
||||
goto err;
|
||||
}
|
||||
} else {
|
||||
if (x != NULL) {
|
||||
if (!bn_copy(x, &point->X))
|
||||
goto err;
|
||||
}
|
||||
if (y != NULL) {
|
||||
if (!bn_copy(y, &point->Y))
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (BN_mod_inverse_ct(Z_1, Z_, &group->field, ctx) == NULL) {
|
||||
ECerror(ERR_R_BN_LIB);
|
||||
if (BN_mod_inverse_ct(Z_1, z, &group->field, ctx) == NULL) {
|
||||
ECerror(ERR_R_BN_LIB);
|
||||
goto err;
|
||||
}
|
||||
if (group->meth->field_encode == NULL) {
|
||||
/* field_sqr works on standard representation */
|
||||
if (!group->meth->field_sqr(group, Z_2, Z_1, ctx))
|
||||
goto err;
|
||||
} else {
|
||||
if (!BN_mod_sqr(Z_2, Z_1, &group->field, ctx))
|
||||
goto err;
|
||||
}
|
||||
if (group->meth->field_encode == 0) {
|
||||
/* field_sqr works on standard representation */
|
||||
if (!group->meth->field_sqr(group, Z_2, Z_1, ctx))
|
||||
goto err;
|
||||
} else {
|
||||
if (!BN_mod_sqr(Z_2, Z_1, &group->field, ctx))
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (x != NULL) {
|
||||
/*
|
||||
* in the Montgomery case, field_mul will cancel out
|
||||
* Montgomery factor in X:
|
||||
*/
|
||||
if (!group->meth->field_mul(group, x, &point->X, Z_2, ctx))
|
||||
goto err;
|
||||
}
|
||||
if (y != NULL) {
|
||||
if (group->meth->field_encode == 0) {
|
||||
/* field_mul works on standard representation */
|
||||
if (!group->meth->field_mul(group, Z_3, Z_2, Z_1, ctx))
|
||||
goto err;
|
||||
} else {
|
||||
if (!BN_mod_mul(Z_3, Z_2, Z_1, &group->field, ctx))
|
||||
goto err;
|
||||
}
|
||||
|
||||
/*
|
||||
* in the Montgomery case, field_mul will cancel out
|
||||
* Montgomery factor in Y:
|
||||
*/
|
||||
if (!group->meth->field_mul(group, y, &point->Y, Z_3, ctx))
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
if (x != NULL) {
|
||||
/*
|
||||
* in the Montgomery case, field_mul will cancel out
|
||||
* Montgomery factor in X:
|
||||
*/
|
||||
if (!group->meth->field_mul(group, x, &point->X, Z_2, ctx))
|
||||
goto err;
|
||||
}
|
||||
if (y != NULL) {
|
||||
if (group->meth->field_encode == NULL) {
|
||||
/* field_mul works on standard representation */
|
||||
if (!group->meth->field_mul(group, Z_3, Z_2, Z_1, ctx))
|
||||
goto err;
|
||||
} else {
|
||||
if (!BN_mod_mul(Z_3, Z_2, Z_1, &group->field, ctx))
|
||||
goto err;
|
||||
}
|
||||
|
||||
/*
|
||||
* in the Montgomery case, field_mul will cancel out
|
||||
* Montgomery factor in Y:
|
||||
*/
|
||||
if (!group->meth->field_mul(group, y, &point->Y, Z_3, ctx))
|
||||
goto err;
|
||||
}
|
||||
|
||||
done:
|
||||
ret = 1;
|
||||
|
||||
err:
|
||||
|
@ -704,11 +659,9 @@ ec_GFp_simple_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN_CTX
|
|||
BIGNUM *n0, *n1, *n2, *n3;
|
||||
int ret = 0;
|
||||
|
||||
if (EC_POINT_is_at_infinity(group, a) > 0) {
|
||||
BN_zero(&r->Z);
|
||||
r->Z_is_one = 0;
|
||||
return 1;
|
||||
}
|
||||
if (EC_POINT_is_at_infinity(group, a) > 0)
|
||||
return EC_POINT_set_to_infinity(group, r);
|
||||
|
||||
field_mul = group->meth->field_mul;
|
||||
field_sqr = group->meth->field_sqr;
|
||||
p = &group->field;
|
||||
|
@ -1162,7 +1115,7 @@ ec_GFp_simple_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT *po
|
|||
goto err;
|
||||
}
|
||||
}
|
||||
if (group->meth->field_encode != 0) {
|
||||
if (group->meth->field_encode != NULL) {
|
||||
/*
|
||||
* in the Montgomery case, we just turned R*H (representing
|
||||
* H) into 1/(R*H), but we need R*(1/H) (representing
|
||||
|
@ -1212,7 +1165,7 @@ ec_GFp_simple_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT *po
|
|||
if (!group->meth->field_mul(group, &p->Y, &p->Y, tmp1, ctx))
|
||||
goto err;
|
||||
|
||||
if (group->meth->field_set_to_one != 0) {
|
||||
if (group->meth->field_set_to_one != NULL) {
|
||||
if (!group->meth->field_set_to_one(group, &p->Z, ctx))
|
||||
goto err;
|
||||
} else {
|
||||
|
@ -1273,7 +1226,7 @@ ec_GFp_simple_blind_coordinates(const EC_GROUP *group, EC_POINT *p, BN_CTX *ctx)
|
|||
if ((tmp = BN_CTX_get(ctx)) == NULL)
|
||||
goto err;
|
||||
|
||||
/* Generate lambda in [1, group->field - 1] */
|
||||
/* Generate lambda in [1, group->field). */
|
||||
if (!bn_rand_interval(lambda, BN_value_one(), &group->field))
|
||||
goto err;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ecx_methods.c,v 1.7 2023/07/05 20:56:29 bcook Exp $ */
|
||||
/* $OpenBSD: ecx_methods.c,v 1.9 2023/07/22 19:33:25 tb Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2022 Joel Sing <jsing@openbsd.org>
|
||||
*
|
||||
|
@ -292,6 +292,42 @@ ecx_pub_cmp(const EVP_PKEY *pkey1, const EVP_PKEY *pkey2)
|
|||
pkey1->pkey.ecx->pub_key_len) == 0;
|
||||
}
|
||||
|
||||
/* Reimplementation of ASN1_buf_print() that adds a secondary indent of 4. */
|
||||
static int
|
||||
ecx_buf_print(BIO *bio, const uint8_t *buf, size_t buf_len, int indent)
|
||||
{
|
||||
uint8_t u8;
|
||||
size_t octets = 0;
|
||||
const char *sep = ":", *nl = "";
|
||||
CBS cbs;
|
||||
|
||||
if (indent > 60)
|
||||
indent = 60;
|
||||
indent += 4;
|
||||
if (indent < 0)
|
||||
indent = 0;
|
||||
|
||||
CBS_init(&cbs, buf, buf_len);
|
||||
while (CBS_len(&cbs) > 0) {
|
||||
if (!CBS_get_u8(&cbs, &u8))
|
||||
return 0;
|
||||
if (octets++ % 15 == 0) {
|
||||
if (BIO_printf(bio, "%s%*s", nl, indent, "") < 0)
|
||||
return 0;
|
||||
nl = "\n";
|
||||
}
|
||||
if (CBS_len(&cbs) == 0)
|
||||
sep = "";
|
||||
if (BIO_printf(bio, "%02x%s", u8, sep) <= 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (BIO_printf(bio, "\n") <= 0)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
ecx_pub_print(BIO *bio, const EVP_PKEY *pkey, int indent, ASN1_PCTX *ctx)
|
||||
{
|
||||
|
@ -309,8 +345,7 @@ ecx_pub_print(BIO *bio, const EVP_PKEY *pkey, int indent, ASN1_PCTX *ctx)
|
|||
return 0;
|
||||
if (BIO_printf(bio, "%*spub:\n", indent, "") <= 0)
|
||||
return 0;
|
||||
if (ASN1_buf_print(bio, ecx_key->pub_key, ecx_key->pub_key_len,
|
||||
indent + 4) == 0)
|
||||
if (!ecx_buf_print(bio, ecx_key->pub_key, ecx_key->pub_key_len, indent))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
|
@ -422,13 +457,11 @@ ecx_priv_print(BIO *bio, const EVP_PKEY *pkey, int indent, ASN1_PCTX *ctx)
|
|||
return 0;
|
||||
if (BIO_printf(bio, "%*spriv:\n", indent, "") <= 0)
|
||||
return 0;
|
||||
if (ASN1_buf_print(bio, ecx_key->priv_key, ecx_key->priv_key_len,
|
||||
indent + 4) == 0)
|
||||
if (!ecx_buf_print(bio, ecx_key->priv_key, ecx_key->priv_key_len, indent))
|
||||
return 0;
|
||||
if (BIO_printf(bio, "%*spub:\n", indent, "") <= 0)
|
||||
return 0;
|
||||
if (ASN1_buf_print(bio, ecx_key->pub_key, ecx_key->pub_key_len,
|
||||
indent + 4) == 0)
|
||||
if (!ecx_buf_print(bio, ecx_key->pub_key, ecx_key->pub_key_len, indent))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: ecdh.c,v 1.5 2023/07/12 08:54:18 tb Exp $ */
|
||||
/* $OpenBSD: ecdh.c,v 1.6 2023/07/24 17:08:53 tb Exp $ */
|
||||
/* ====================================================================
|
||||
* Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
|
||||
*
|
||||
|
@ -176,7 +176,7 @@ ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, EC_KEY *ecdh
|
|||
if ((group = EC_KEY_get0_group(ecdh)) == NULL)
|
||||
goto err;
|
||||
|
||||
if (!EC_POINT_is_on_curve(group, pub_key, ctx))
|
||||
if (EC_POINT_is_on_curve(group, pub_key, ctx) <= 0)
|
||||
goto err;
|
||||
|
||||
if ((point = EC_POINT_new(group)) == NULL) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: c_all.c,v 1.31 2023/07/07 19:37:53 beck Exp $ */
|
||||
/* $OpenBSD: c_all.c,v 1.32 2023/07/24 10:24:58 jsing Exp $ */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -317,7 +317,6 @@ OpenSSL_add_all_digests(void)
|
|||
void
|
||||
OPENSSL_add_all_algorithms_noconf(void)
|
||||
{
|
||||
OPENSSL_cpuid_setup();
|
||||
OpenSSL_add_all_ciphers();
|
||||
OpenSSL_add_all_digests();
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: names.c,v 1.19 2023/07/07 19:37:54 beck Exp $ */
|
||||
/* $OpenBSD: names.c,v 1.20 2023/07/22 18:12:55 tb Exp $ */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
|
@ -152,7 +152,6 @@ EVP_cleanup(void)
|
|||
obj_cleanup_defer = 0;
|
||||
OBJ_cleanup();
|
||||
}
|
||||
OBJ_sigid_free();
|
||||
}
|
||||
|
||||
struct doall_cipher {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: gostr341001_key.c,v 1.13 2023/07/08 14:30:44 beck Exp $ */
|
||||
/* $OpenBSD: gostr341001_key.c,v 1.14 2023/07/24 17:08:53 tb Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2014 Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
|
||||
* Copyright (c) 2005-2006 Cryptocom LTD
|
||||
|
@ -132,7 +132,7 @@ GOST_KEY_check_key(const GOST_KEY *key)
|
|||
goto err;
|
||||
|
||||
/* testing whether the pub_key is on the elliptic curve */
|
||||
if (EC_POINT_is_on_curve(key->group, key->pub_key, ctx) == 0) {
|
||||
if (EC_POINT_is_on_curve(key->group, key->pub_key, ctx) <= 0) {
|
||||
GOSTerror(EC_R_POINT_IS_NOT_ON_CURVE);
|
||||
goto err;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $OpenBSD: BIO_ctrl.3,v 1.23 2023/05/01 07:28:11 tb Exp $
|
||||
.\" $OpenBSD: BIO_ctrl.3,v 1.24 2023/07/26 20:01:04 tb Exp $
|
||||
.\" full merge up to: OpenSSL 24a535eaf Tue Sep 22 13:14:20 2020 +0100
|
||||
.\" selective merge up to: OpenSSL 0c5bc96f Tue Mar 15 13:57:22 2022 +0000
|
||||
.\"
|
||||
|
@ -66,7 +66,7 @@
|
|||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd $Mdocdate: May 1 2023 $
|
||||
.Dd $Mdocdate: July 26 2023 $
|
||||
.Dt BIO_CTRL 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -430,12 +430,10 @@ They are documented in the following manual pages:
|
|||
.Bl -column BIO_CTRL_DGRAM_SET_RECV_TIMEOUT BIO_dgram_recv_timedout(3)\
|
||||
-offset 3n
|
||||
.It Fa cmd No constant Ta manual page
|
||||
.It Dv BIO_C_GET_EX_ARG Ta Xr BIO_f_asn1 3
|
||||
.It Dv BIO_C_GET_PREFIX Ta Xr BIO_asn1_get_prefix 3
|
||||
.It Dv BIO_C_GET_SUFFIX Ta Xr BIO_asn1_get_suffix 3
|
||||
.It Dv BIO_C_SET_EX_ARG Ta Xr BIO_f_asn1 3
|
||||
.It Dv BIO_C_SET_PREFIX Ta Xr BIO_asn1_set_prefix 3
|
||||
.It Dv BIO_C_SET_SUFFIX Ta Xr BIO_asn1_set_suffix 3
|
||||
.\" The following constants are intentionally undocumented because
|
||||
.\" BIO_f_asn1 has been removed from the public API.
|
||||
.\" .It Dv BIO_C_GET_EX_ARG Ta Xr BIO_f_asn1 3
|
||||
.\" .It Dv BIO_C_SET_EX_ARG Ta Xr BIO_f_asn1 3
|
||||
.It Dv BIO_CTRL_DGRAM_GET_FALLBACK_MTU Ta Xr BIO_dgram_set_peer 3
|
||||
.It Dv BIO_CTRL_DGRAM_GET_MTU Ta Xr BIO_dgram_set_peer 3
|
||||
.It Dv BIO_CTRL_DGRAM_GET_RECV_TIMEOUT Ta Xr BIO_dgram_recv_timedout 3
|
||||
|
|
|
@ -1,228 +0,0 @@
|
|||
.\" $OpenBSD: BIO_f_asn1.3,v 1.3 2023/05/01 07:28:11 tb Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
|
||||
.\"
|
||||
.\" Permission to use, copy, modify, and distribute this software for any
|
||||
.\" purpose with or without fee is hereby granted, provided that the above
|
||||
.\" copyright notice and this permission notice appear in all copies.
|
||||
.\"
|
||||
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.Dd $Mdocdate: May 1 2023 $
|
||||
.Dt BIO_F_ASN1 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm BIO_f_asn1 ,
|
||||
.Nm asn1_ps_func ,
|
||||
.Nm BIO_asn1_set_prefix ,
|
||||
.Nm BIO_asn1_get_prefix ,
|
||||
.Nm BIO_asn1_set_suffix ,
|
||||
.Nm BIO_asn1_get_suffix
|
||||
.Nd BER-encoding filter BIO
|
||||
.Sh SYNOPSIS
|
||||
.In openssl/asn1.h
|
||||
.Ft const BIO_METHOD *
|
||||
.Fn BIO_f_asn1 void
|
||||
.In openssl/bio.h
|
||||
.Ft typedef int
|
||||
.Fo asn1_ps_func
|
||||
.Fa "BIO *bio"
|
||||
.Fa "unsigned char **pbuf"
|
||||
.Fa "int *plen"
|
||||
.Fa "void *parg"
|
||||
.Fc
|
||||
.Ft int
|
||||
.Fo BIO_asn1_set_prefix
|
||||
.Fa "BIO *chain"
|
||||
.Fa "asn1_ps_func *prefix"
|
||||
.Fa "asn1_ps_func *prefix_free"
|
||||
.Fc
|
||||
.Ft int
|
||||
.Fo BIO_asn1_get_prefix
|
||||
.Fa "BIO *chain"
|
||||
.Fa "asn1_ps_func **pprefix"
|
||||
.Fa "asn1_ps_func **pprefix_free"
|
||||
.Fc
|
||||
.Ft int
|
||||
.Fo BIO_asn1_set_suffix
|
||||
.Fa "BIO *chain"
|
||||
.Fa "asn1_ps_func *suffix"
|
||||
.Fa "asn1_ps_func *suffix_free"
|
||||
.Fc
|
||||
.Ft int
|
||||
.Fo BIO_asn1_get_suffix
|
||||
.Fa "BIO *chain"
|
||||
.Fa "asn1_ps_func **psuffix"
|
||||
.Fa "asn1_ps_func **psuffix_free"
|
||||
.Fc
|
||||
.Sh DESCRIPTION
|
||||
.Fn BIO_f_asn1
|
||||
returns the
|
||||
.Qq asn1
|
||||
BIO method.
|
||||
BIOs created from it with
|
||||
.Xr BIO_new 3
|
||||
are filter BIOs intended to BER-encode data written to them
|
||||
and pass the encoded data on to the next BIO in the chain.
|
||||
Such BIOs operate as follows:
|
||||
.Bl -hang -width 1n
|
||||
.It Xr BIO_method_type 3
|
||||
returns
|
||||
.Dv BIO_TYPE_ASN1 .
|
||||
.It Xr BIO_method_name 3
|
||||
returns a pointer to the static string
|
||||
.Qq asn1 .
|
||||
.It Xr BIO_write 3
|
||||
writes the DER encoding of an ASN.1 OCTET STRING with the
|
||||
.Fa len
|
||||
content octets in
|
||||
.Fa buf
|
||||
to the next BIO in the chain.
|
||||
.Pp
|
||||
If a
|
||||
.Fa prefix
|
||||
function was installed with
|
||||
.Fn BIO_asn1_set_prefix ,
|
||||
that function is called before writing the object.
|
||||
It may for example produce additional output.
|
||||
If it fails, writing fails.
|
||||
.Pp
|
||||
If a
|
||||
.Fa prefix_free
|
||||
function was installed as well, that function is called
|
||||
after writing any output produced by
|
||||
.Fa prefix
|
||||
but before writing the object.
|
||||
Failure of
|
||||
.Fa prefix_free
|
||||
is silently ignored.
|
||||
.It Xr BIO_puts 3
|
||||
operates like
|
||||
.Xr BIO_write 3
|
||||
but uses the
|
||||
.Xr strlen 3
|
||||
of
|
||||
.Fa buf
|
||||
instead of a
|
||||
.Fa len
|
||||
argument.
|
||||
.It Xr BIO_flush 3
|
||||
calls the
|
||||
.Fa suffix
|
||||
callback function, if any.
|
||||
If that produces any output, it calls the
|
||||
.Fa suffix_free
|
||||
callback function, if any, silently ignoring failure.
|
||||
Finally, it calls
|
||||
.Xr BIO_flush 3
|
||||
on the next BIO in the chain.
|
||||
It fails if no data was previously written or if the
|
||||
.Fa suffix
|
||||
callback, writing, or
|
||||
.Xr BIO_flush 3
|
||||
on the next BIO fail.
|
||||
.It Xr BIO_ctrl 3
|
||||
with a
|
||||
.Fa cmd
|
||||
of
|
||||
.Dv BIO_C_SET_EX_ARG
|
||||
stores the pointer
|
||||
.Fa parg
|
||||
internally such that it will be passed to the
|
||||
.Fn asn1_ps_func
|
||||
callback functions.
|
||||
With a
|
||||
.Fa cmd
|
||||
of
|
||||
.Dv BIO_C_GET_EX_ARG ,
|
||||
it retrieves that pointer, storing it in
|
||||
.Pf * Fa parg .
|
||||
The commands
|
||||
.Dv BIO_C_SET_PREFIX ,
|
||||
.Dv BIO_C_GET_PREFIX ,
|
||||
.Dv BIO_C_SET_SUFFIX ,
|
||||
.Dv BIO_C_GET_SUFFIX ,
|
||||
and
|
||||
.Dv BIO_CTRL_FLUSH
|
||||
are used internally to implement
|
||||
.Fn BIO_asn1_set_prefix ,
|
||||
.Fn BIO_asn1_get_prefix ,
|
||||
.Fn BIO_asn1_set_suffix ,
|
||||
.Fn BIO_asn1_get_suffix
|
||||
and
|
||||
.Xr BIO_flush 3
|
||||
and are not intended for use by application programs.
|
||||
Other commands are merely forwarded to the next BIO in the chain.
|
||||
.It Xo
|
||||
.Xr BIO_read 3 ,
|
||||
.Xr BIO_gets 3 ,
|
||||
and
|
||||
.Xr BIO_callback_ctrl 3
|
||||
.Xc
|
||||
merely call the same function on the next BIO in the chain.
|
||||
.El
|
||||
.Pp
|
||||
If the above description of a function mentions the next BIO in the
|
||||
chain, that function fails if the asn1 BIO is the last BIO in the chain.
|
||||
.Pp
|
||||
.Fn BIO_asn1_set_prefix
|
||||
and
|
||||
.Fn BIO_asn1_get_prefix
|
||||
install and retrieve the
|
||||
.Fa prefix
|
||||
and
|
||||
.Fa prefix_free
|
||||
callback functions in and from the first asn1 BIO in the given
|
||||
.Fa chain .
|
||||
Similarly,
|
||||
.Fn BIO_asn1_set_suffix
|
||||
and
|
||||
.Fn BIO_asn1_get_suffix
|
||||
install and retrieve the
|
||||
.Fa suffix
|
||||
and
|
||||
.Fa suffix_free
|
||||
callback functions.
|
||||
Passing a
|
||||
.Dv NULL
|
||||
pointer for any of the
|
||||
.Fn asn1_ps_func
|
||||
arguments disables that particular callback.
|
||||
.Sh RETURN VALUES
|
||||
.Fn BIO_f_asn1
|
||||
always returns a pointer to a static built-in object.
|
||||
.Pp
|
||||
Functions of the type
|
||||
.Fn asn1_ps_func
|
||||
are supposed to return 1 on success or 0 on failure.
|
||||
.Pp
|
||||
.Fn BIO_asn1_set_prefix ,
|
||||
.Fn BIO_asn1_get_prefix ,
|
||||
.Fn BIO_asn1_set_suffix ,
|
||||
and
|
||||
.Fn BIO_asn1_get_suffix
|
||||
return 1 on success or 0 if
|
||||
.Fa chain
|
||||
is a
|
||||
.Dv NULL
|
||||
pointer or does not contain any asn1 BIO.
|
||||
They may return \-2 if a BIO is encountered in the
|
||||
.Fa chain
|
||||
that is not properly initialized.
|
||||
.Sh SEE ALSO
|
||||
.Xr ASN1_put_object 3 ,
|
||||
.Xr BIO_ctrl 3 ,
|
||||
.Xr BIO_new 3 ,
|
||||
.Xr BIO_next 3 ,
|
||||
.Xr BIO_write 3 ,
|
||||
.Xr i2d_ASN1_OCTET_STRING 3
|
||||
.Sh HISTORY
|
||||
These functions first appeared in OpenSSL 1.0.0
|
||||
and have been available since
|
||||
.Ox 4.9 .
|
|
@ -1,4 +1,4 @@
|
|||
.\" $OpenBSD: BIO_find_type.3,v 1.11 2023/04/11 15:35:31 schwarze Exp $
|
||||
.\" $OpenBSD: BIO_find_type.3,v 1.12 2023/07/26 20:01:04 tb Exp $
|
||||
.\" full merge up to: OpenSSL 1cb7eff4 Sep 10 13:56:40 2019 +0100
|
||||
.\"
|
||||
.\" This file is a derived work.
|
||||
|
@ -65,7 +65,7 @@
|
|||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd $Mdocdate: April 11 2023 $
|
||||
.Dd $Mdocdate: July 26 2023 $
|
||||
.Dt BIO_FIND_TYPE 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -180,7 +180,9 @@ and
|
|||
set in their type constant.
|
||||
.Bl -column BIO_TYPE_NULL_FILTER "datagram socket" BIO_s_datagram(3)
|
||||
.It Fa type No constant Ta Em name No string Ta Vt BIO_METHOD
|
||||
.It Dv BIO_TYPE_ASN1 Ta asn1 Ta Xr BIO_f_asn1 3
|
||||
.\" BIO_TYPE_ASN1 is intentionally undocumented because BIO_f_asn1 was
|
||||
.\" removed from the public API.
|
||||
.\" .It Dv BIO_TYPE_ASN1 Ta asn1 Ta Xr BIO_f_asn1 3
|
||||
.It Dv BIO_TYPE_BASE64 Ta base64 encoding Ta Xr BIO_f_base64 3
|
||||
.It Dv BIO_TYPE_BUFFER Ta buffer Ta Xr BIO_f_buffer 3
|
||||
.It Dv BIO_TYPE_CIPHER Ta cipher Ta Xr BIO_f_cipher 3
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $OpenBSD: BIO_new.3,v 1.27 2023/07/21 04:50:47 tb Exp $
|
||||
.\" $OpenBSD: BIO_new.3,v 1.28 2023/07/26 20:01:04 tb Exp $
|
||||
.\" full merge up to:
|
||||
.\" OpenSSL man3/BIO_new.pod fb46be03 Feb 26 11:51:31 2016 +0000
|
||||
.\" OpenSSL man7/bio.pod 631c37be Dec 12 16:56:50 2017 +0100
|
||||
|
@ -52,7 +52,7 @@
|
|||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd $Mdocdate: July 21 2023 $
|
||||
.Dd $Mdocdate: July 26 2023 $
|
||||
.Dt BIO_NEW 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -232,7 +232,6 @@ Create a memory BIO:
|
|||
.Xr BIO_ctrl 3 ,
|
||||
.Xr BIO_dump 3 ,
|
||||
.Xr BIO_dup_chain 3 ,
|
||||
.Xr BIO_f_asn1 3 ,
|
||||
.Xr BIO_f_base64 3 ,
|
||||
.Xr BIO_f_buffer 3 ,
|
||||
.Xr BIO_f_cipher 3 ,
|
||||
|
|
|
@ -1,317 +0,0 @@
|
|||
.\" $OpenBSD: BN_BLINDING_new.3,v 1.12 2023/04/25 20:07:55 tb Exp $
|
||||
.\" OpenSSL a528d4f0 Oct 27 13:40:11 2015 -0400
|
||||
.\"
|
||||
.\" This file was written by Nils Larsch <nils@openssl.org>.
|
||||
.\" Copyright (c) 2005, 2008, 2013, 2015 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.
|
||||
.\"
|
||||
.Dd $Mdocdate: April 25 2023 $
|
||||
.Dt BN_BLINDING_NEW 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm BN_BLINDING_new ,
|
||||
.Nm BN_BLINDING_free ,
|
||||
.Nm BN_BLINDING_update ,
|
||||
.Nm BN_BLINDING_convert ,
|
||||
.Nm BN_BLINDING_invert ,
|
||||
.Nm BN_BLINDING_convert_ex ,
|
||||
.Nm BN_BLINDING_invert_ex ,
|
||||
.Nm BN_BLINDING_thread_id ,
|
||||
.Nm BN_BLINDING_get_flags ,
|
||||
.Nm BN_BLINDING_set_flags ,
|
||||
.Nm BN_BLINDING_create_param
|
||||
.Nd blinding related BIGNUM functions
|
||||
.Sh SYNOPSIS
|
||||
.In openssl/bn.h
|
||||
.Ft BN_BLINDING *
|
||||
.Fo BN_BLINDING_new
|
||||
.Fa "const BIGNUM *A"
|
||||
.Fa "const BIGNUM *Ai"
|
||||
.Fa "BIGNUM *mod"
|
||||
.Fc
|
||||
.Ft void
|
||||
.Fo BN_BLINDING_free
|
||||
.Fa "BN_BLINDING *b"
|
||||
.Fc
|
||||
.Ft int
|
||||
.Fo BN_BLINDING_update
|
||||
.Fa "BN_BLINDING *b"
|
||||
.Fa "BN_CTX *ctx"
|
||||
.Fc
|
||||
.Ft int
|
||||
.Fo BN_BLINDING_convert
|
||||
.Fa "BIGNUM *n"
|
||||
.Fa "BN_BLINDING *b"
|
||||
.Fa "BN_CTX *ctx"
|
||||
.Fc
|
||||
.Ft int
|
||||
.Fo BN_BLINDING_invert
|
||||
.Fa "BIGNUM *n"
|
||||
.Fa "BN_BLINDING *b"
|
||||
.Fa "BN_CTX *ctx"
|
||||
.Fc
|
||||
.Ft int
|
||||
.Fo BN_BLINDING_convert_ex
|
||||
.Fa "BIGNUM *n"
|
||||
.Fa "BIGNUM *r"
|
||||
.Fa "BN_BLINDING *b"
|
||||
.Fa "BN_CTX *ctx"
|
||||
.Fc
|
||||
.Ft int
|
||||
.Fo BN_BLINDING_invert_ex
|
||||
.Fa "BIGNUM *n"
|
||||
.Fa "const BIGNUM *r"
|
||||
.Fa "BN_BLINDING *b"
|
||||
.Fa "BN_CTX *ctx"
|
||||
.Fc
|
||||
.Ft CRYPTO_THREADID *
|
||||
.Fo BN_BLINDING_thread_id
|
||||
.Fa "BN_BLINDING *"
|
||||
.Fc
|
||||
.Ft unsigned long
|
||||
.Fo BN_BLINDING_get_flags
|
||||
.Fa "const BN_BLINDING *"
|
||||
.Fc
|
||||
.Ft void
|
||||
.Fo BN_BLINDING_set_flags
|
||||
.Fa "BN_BLINDING *"
|
||||
.Fa "unsigned long"
|
||||
.Fc
|
||||
.Ft BN_BLINDING *
|
||||
.Fo BN_BLINDING_create_param
|
||||
.Fa "BN_BLINDING *b"
|
||||
.Fa "const BIGNUM *e"
|
||||
.Fa "BIGNUM *m"
|
||||
.Fa "BN_CTX *ctx"
|
||||
.Fa "int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\
|
||||
const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)"
|
||||
.Fa "BN_MONT_CTX *m_ctx"
|
||||
.Fc
|
||||
.Sh DESCRIPTION
|
||||
.Fn BN_BLINDING_new
|
||||
allocates a new
|
||||
.Vt BN_BLINDING
|
||||
structure and copies the
|
||||
.Fa A
|
||||
and
|
||||
.Fa \&Ai
|
||||
values into the newly created
|
||||
.Vt BN_BLINDING
|
||||
object.
|
||||
.Pp
|
||||
.Fn BN_BLINDING_free
|
||||
frees the
|
||||
.Vt BN_BLINDING
|
||||
structure.
|
||||
If
|
||||
.Fa b
|
||||
is a
|
||||
.Dv NULL
|
||||
pointer, no action occurs.
|
||||
.Pp
|
||||
.Fn BN_BLINDING_update
|
||||
updates the
|
||||
.Vt BN_BLINDING
|
||||
parameters by squaring the
|
||||
.Fa A
|
||||
and
|
||||
.Fa \&Ai
|
||||
or, after a specific number of uses and if the necessary parameters are
|
||||
set, by re-creating the blinding parameters.
|
||||
.Pp
|
||||
.Fn BN_BLINDING_convert_ex
|
||||
multiplies
|
||||
.Fa n
|
||||
with the blinding factor
|
||||
.Fa A .
|
||||
If
|
||||
.Fa r
|
||||
is not
|
||||
.Dv NULL ,
|
||||
a copy of the inverse blinding factor
|
||||
.Fa \&Ai
|
||||
will be returned in
|
||||
.Fa r
|
||||
(this is useful if an
|
||||
.Vt RSA
|
||||
object is shared among several threads).
|
||||
.Fn BN_BLINDING_invert_ex
|
||||
multiplies
|
||||
.Fa n
|
||||
with the inverse blinding factor
|
||||
.Fa \&Ai .
|
||||
If
|
||||
.Fa r
|
||||
is not
|
||||
.Dv NULL ,
|
||||
it will be used as the inverse blinding.
|
||||
.Pp
|
||||
.Fn BN_BLINDING_convert
|
||||
and
|
||||
.Fn BN_BLINDING_invert
|
||||
are wrapper functions for
|
||||
.Fn BN_BLINDING_convert_ex
|
||||
and
|
||||
.Fn BN_BLINDING_invert_ex
|
||||
with
|
||||
.Fa r
|
||||
set to
|
||||
.Dv NULL .
|
||||
.Pp
|
||||
.Fn BN_BLINDING_thread_id
|
||||
provides access to the
|
||||
.Vt CRYPTO_THREADID
|
||||
object within the
|
||||
.Vt BN_BLINDING
|
||||
structure.
|
||||
This is to help users provide proper locking if needed for
|
||||
multi-threaded use.
|
||||
The thread ID object of a newly allocated
|
||||
.Vt BN_BLINDING
|
||||
structure is initialised to the thread ID in which
|
||||
.Fn BN_BLINDING_new
|
||||
was called.
|
||||
.Pp
|
||||
.Fn BN_BLINDING_get_flags
|
||||
returns the
|
||||
.Dv BN_BLINDING_*
|
||||
flags.
|
||||
Currently there are two supported flags:
|
||||
.Dv BN_BLINDING_NO_UPDATE
|
||||
and
|
||||
.Dv BN_BLINDING_NO_RECREATE .
|
||||
.Dv BN_BLINDING_NO_UPDATE
|
||||
inhibits the automatic update of the
|
||||
.Vt BN_BLINDING
|
||||
parameters after each use and
|
||||
.Dv BN_BLINDING_NO_RECREATE
|
||||
inhibits the automatic re-creation of the
|
||||
.Vt BN_BLINDING
|
||||
parameters after a fixed number of uses (currently 32).
|
||||
In newly allocated
|
||||
.Vt BN_BLINDING
|
||||
objects no flags are set.
|
||||
.Fn BN_BLINDING_set_flags
|
||||
sets the
|
||||
.Dv BN_BLINDING_*
|
||||
parameters flags.
|
||||
.Pp
|
||||
.Fn BN_BLINDING_create_param
|
||||
creates new
|
||||
.Vt BN_BLINDING
|
||||
parameters using the exponent
|
||||
.Fa e
|
||||
and the modulus
|
||||
.Fa m .
|
||||
.Fa bn_mod_exp
|
||||
and
|
||||
.Fa m_ctx
|
||||
can be used to pass special functions for exponentiation (normally
|
||||
.Xr BN_mod_exp 3
|
||||
and
|
||||
.Vt BN_MONT_CTX ) .
|
||||
.Sh RETURN VALUES
|
||||
.Fn BN_BLINDING_new
|
||||
returns the newly allocated
|
||||
.Vt BN_BLINDING
|
||||
structure or
|
||||
.Dv NULL
|
||||
in case of an error.
|
||||
.Pp
|
||||
.Fn BN_BLINDING_update ,
|
||||
.Fn BN_BLINDING_convert ,
|
||||
.Fn BN_BLINDING_invert ,
|
||||
.Fn BN_BLINDING_convert_ex
|
||||
and
|
||||
.Fn BN_BLINDING_invert_ex
|
||||
return 1 on success and 0 if an error occurred.
|
||||
.Pp
|
||||
.Fn BN_BLINDING_thread_id
|
||||
returns a pointer to the thread ID object within a
|
||||
.Vt BN_BLINDING
|
||||
object.
|
||||
.Pp
|
||||
.Fn BN_BLINDING_get_flags
|
||||
returns the currently set
|
||||
.Dv BN_BLINDING_*
|
||||
flags (an
|
||||
.Vt unsigned long
|
||||
value).
|
||||
.Pp
|
||||
.Fn BN_BLINDING_create_param
|
||||
returns the newly created
|
||||
.Vt BN_BLINDING
|
||||
parameters or
|
||||
.Dv NULL
|
||||
on error.
|
||||
.Sh SEE ALSO
|
||||
.Xr BN_new 3 ,
|
||||
.Xr RSA_blinding_on 3
|
||||
.Sh HISTORY
|
||||
.Fn BN_BLINDING_new ,
|
||||
.Fn BN_BLINDING_free ,
|
||||
.Fn BN_BLINDING_update ,
|
||||
.Fn BN_BLINDING_convert ,
|
||||
and
|
||||
.Fn BN_BLINDING_invert
|
||||
first appeared in SSLeay 0.9.0 and have been available since
|
||||
.Ox 2.4 .
|
||||
.Pp
|
||||
.Fn BN_BLINDING_convert_ex ,
|
||||
.Fn BN_BLINDIND_invert_ex ,
|
||||
.Fn BN_BLINDING_get_flags ,
|
||||
.Fn BN_BLINDING_set_flags ,
|
||||
and
|
||||
.Fn BN_BLINDING_create_param
|
||||
first appeared in OpenSSL 0.9.8 and have been available since
|
||||
.Ox 4.5 .
|
||||
.Pp
|
||||
.Fn BN_BLINDING_thread_id
|
||||
first appeared in OpenSSL 1.0.0 and has been available since
|
||||
.Ox 4.9 .
|
||||
.Sh AUTHORS
|
||||
.An Nils Larsch Aq Mt nils@openssl.org
|
|
@ -1,4 +1,4 @@
|
|||
.\" $OpenBSD: BN_new.3,v 1.30 2023/07/21 05:04:48 tb Exp $
|
||||
.\" $OpenBSD: BN_new.3,v 1.31 2023/07/26 20:08:59 tb Exp $
|
||||
.\" full merge up to: OpenSSL man3/BN_new 2457c19d Mar 6 08:43:36 2004 +0000
|
||||
.\" selective merge up to: man3/BN_new 681acb31 Sep 29 13:10:34 2017 +0200
|
||||
.\" full merge up to: OpenSSL man7/bn 05ea606a May 20 20:52:46 2016 -0400
|
||||
|
@ -50,7 +50,7 @@
|
|||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd $Mdocdate: July 21 2023 $
|
||||
.Dd $Mdocdate: July 26 2023 $
|
||||
.Dt BN_NEW 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -135,7 +135,6 @@ and sets an error code that can be obtained by
|
|||
.Sh SEE ALSO
|
||||
.Xr BN_add 3 ,
|
||||
.Xr BN_add_word 3 ,
|
||||
.Xr BN_BLINDING_new 3 ,
|
||||
.Xr BN_bn2bin 3 ,
|
||||
.Xr BN_cmp 3 ,
|
||||
.Xr BN_copy 3 ,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $OpenBSD: BUF_MEM_new.3,v 1.16 2019/06/06 01:06:58 schwarze Exp $
|
||||
.\" $OpenBSD: BUF_MEM_new.3,v 1.18 2023/07/27 06:20:45 tb Exp $
|
||||
.\" OpenSSL doc/crypto/buffer.pod 18edda0f Sep 20 03:28:54 2000 +0000
|
||||
.\" not merged: 74924dcb, 58e3457a, 21b0fa91, 7644a9ae
|
||||
.\" OpenSSL doc/crypto/BUF_MEM_new.pod 53934822 Jun 9 16:39:19 2016 -0400
|
||||
|
@ -52,16 +52,14 @@
|
|||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd $Mdocdate: June 6 2019 $
|
||||
.Dd $Mdocdate: July 27 2023 $
|
||||
.Dt BUF_MEM_NEW 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm BUF_MEM_new ,
|
||||
.Nm BUF_MEM_free ,
|
||||
.Nm BUF_MEM_grow ,
|
||||
.Nm BUF_MEM_grow_clean ,
|
||||
.Nm BUF_reverse ,
|
||||
.Nm BUF_strdup
|
||||
.Nm BUF_MEM_grow_clean
|
||||
.Nd simple character arrays structure
|
||||
.Sh SYNOPSIS
|
||||
.In openssl/buffer.h
|
||||
|
@ -83,16 +81,6 @@
|
|||
.Fa "BUF_MEM *str"
|
||||
.Fa "size_t len"
|
||||
.Fc
|
||||
.Ft void
|
||||
.Fo BUF_reverse
|
||||
.Fa "unsigned char *out"
|
||||
.Fa "const unsigned char *in"
|
||||
.Fa "size_t len"
|
||||
.Fc
|
||||
.Ft char *
|
||||
.Fo BUF_strdup
|
||||
.Fa "const char *str"
|
||||
.Fc
|
||||
.Sh DESCRIPTION
|
||||
The buffer library handles simple character arrays.
|
||||
Buffers are used for various purposes in the library, most notably
|
||||
|
@ -138,40 +126,6 @@ Any data already in the buffer is preserved if it increases in size.
|
|||
is similar to
|
||||
.Fn BUF_MEM_grow ,
|
||||
but it sets any freed or additionally allocated memory to zero.
|
||||
.Pp
|
||||
.Fn BUF_reverse
|
||||
reverses
|
||||
.Fa len
|
||||
bytes at
|
||||
.Fa in
|
||||
into
|
||||
.Fa out .
|
||||
If
|
||||
.Fa in
|
||||
is
|
||||
.Dv NULL ,
|
||||
.Fa out
|
||||
is reversed in place.
|
||||
.Pp
|
||||
.Fn BUF_strdup
|
||||
copies a NUL terminated string into a block of allocated memory and
|
||||
returns a pointer to the allocated block.
|
||||
Unlike the system
|
||||
.Xr strdup 3
|
||||
function,
|
||||
.Fn BUF_strdup
|
||||
will accept a
|
||||
.Dv NULL
|
||||
argument and will return
|
||||
.Dv NULL
|
||||
in that case.
|
||||
Its use in new programs is discouraged.
|
||||
.Pp
|
||||
The memory allocated from
|
||||
.Fn BUF_strdup
|
||||
should be freed up using the
|
||||
.Xr free 3
|
||||
function.
|
||||
.Sh RETURN VALUES
|
||||
.Fn BUF_MEM_new
|
||||
returns the buffer or
|
||||
|
@ -192,15 +146,9 @@ return zero on error or the new size (i.e.\&
|
|||
and
|
||||
.Fn BUF_MEM_grow
|
||||
first appeared in SSLeay 0.6.0.
|
||||
.Fn BUF_strdup
|
||||
first appeared in SSLeay 0.8.0.
|
||||
All these functions have been available since
|
||||
.Ox 2.4 .
|
||||
.Pp
|
||||
.Fn BUF_MEM_grow_clean
|
||||
first appeared in OpenSSL 0.9.7 and has been available since
|
||||
.Ox 3.2 .
|
||||
.Pp
|
||||
.Fn BUF_reverse
|
||||
first appeared in OpenSSL 1.0.0 and has been available since
|
||||
.Ox 4.9 .
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $OpenBSD: CMS_get0_SignerInfos.3,v 1.7 2019/11/02 15:39:46 schwarze Exp $
|
||||
.\" $OpenBSD: CMS_get0_SignerInfos.3,v 1.8 2023/07/26 19:30:43 tb Exp $
|
||||
.\" full merge up to: OpenSSL 83cf7abf May 29 13:07:08 2018 +0100
|
||||
.\"
|
||||
.\" This file was written by Dr. Stephen Henson <steve@openssl.org>.
|
||||
|
@ -48,11 +48,12 @@
|
|||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd $Mdocdate: November 2 2019 $
|
||||
.Dd $Mdocdate: July 26 2023 $
|
||||
.Dt CMS_GET0_SIGNERINFOS 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm CMS_get0_SignerInfos ,
|
||||
.Nm CMS_SignerInfo_get_version ,
|
||||
.Nm CMS_SignerInfo_get0_signer_id ,
|
||||
.Nm CMS_SignerInfo_get0_signature ,
|
||||
.Nm CMS_SignerInfo_cert_cmp ,
|
||||
|
@ -65,6 +66,11 @@
|
|||
.Fa "CMS_ContentInfo *cms"
|
||||
.Fc
|
||||
.Ft int
|
||||
.Fo CMS_SignerInfo_get_version
|
||||
.Fa "CMS_SignerInfo *si"
|
||||
.Fa "long *version"
|
||||
.Fc
|
||||
.Ft int
|
||||
.Fo CMS_SignerInfo_get0_signer_id
|
||||
.Fa "CMS_SignerInfo *si"
|
||||
.Fa "ASN1_OCTET_STRING **keyid"
|
||||
|
@ -94,6 +100,14 @@ structures associated with the
|
|||
structure
|
||||
.Fa cms .
|
||||
.Pp
|
||||
.Fn CMS_SignerInfo_get_version
|
||||
sets
|
||||
.Pf * Fa version
|
||||
to the syntax version number of the
|
||||
.Vt SignerInfo
|
||||
structure
|
||||
.Fa si .
|
||||
.Pp
|
||||
.Fn CMS_SignerInfo_get0_signer_id
|
||||
retrieves the certificate
|
||||
.Vt SignerIdentifier
|
||||
|
@ -157,6 +171,9 @@ if there are no signers or if
|
|||
is not of the type
|
||||
.Vt SignedData .
|
||||
.Pp
|
||||
.Fn CMS_SignerInfo_get_version
|
||||
always succeeds and returns 1.
|
||||
.Pp
|
||||
.Fn CMS_SignerInfo_get0_signer_id
|
||||
returns 1 for success or 0 for failure.
|
||||
.Pp
|
||||
|
@ -190,3 +207,7 @@ first appeared in OpenSSL 0.9.8h and
|
|||
in OpenSSL 1.0.2.
|
||||
These functions have been available since
|
||||
.Ox 6.7 .
|
||||
.Pp
|
||||
.Fn CMS_SignerInfo_get_version
|
||||
first appeared in
|
||||
.Ox 7.4 .
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $OpenBSD: CMS_get0_type.3,v 1.7 2019/11/02 15:39:46 schwarze Exp $
|
||||
.\" $OpenBSD: CMS_get0_type.3,v 1.9 2023/07/27 05:31:28 tb Exp $
|
||||
.\" full merge up to: OpenSSL 72a7a702 Feb 26 14:05:09 2019 +0000
|
||||
.\"
|
||||
.\" This file is a derived work.
|
||||
|
@ -65,11 +65,12 @@
|
|||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd $Mdocdate: November 2 2019 $
|
||||
.Dd $Mdocdate: July 27 2023 $
|
||||
.Dt CMS_GET0_TYPE 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm CMS_get0_type ,
|
||||
.Nm CMS_get_version ,
|
||||
.Nm CMS_set1_eContentType ,
|
||||
.Nm CMS_get0_eContentType ,
|
||||
.Nm CMS_get0_content
|
||||
|
@ -81,6 +82,11 @@
|
|||
.Fa "const CMS_ContentInfo *cms"
|
||||
.Fc
|
||||
.Ft int
|
||||
.Fo CMS_get_version
|
||||
.Fa "const CMS_ContentInfo *cms"
|
||||
.Fa "long *version"
|
||||
.Fc
|
||||
.Ft int
|
||||
.Fo CMS_set1_eContentType
|
||||
.Fa "CMS_ContentInfo *cms"
|
||||
.Fa "const ASN1_OBJECT *oid"
|
||||
|
@ -149,6 +155,21 @@ copies the supplied
|
|||
.Fa oid ,
|
||||
so it should be freed up after use.
|
||||
.Pp
|
||||
.Fn CMS_get_version
|
||||
sets
|
||||
.Pf * Fa version
|
||||
to the syntax version number of the
|
||||
.Vt ContentInfo
|
||||
structure
|
||||
.Fa cms .
|
||||
The version is a number between 0 and 5 and is defined for all the
|
||||
above content types except for arbitrary data.
|
||||
For arbitrary data and unsupported content types
|
||||
.Fn CMS_get_version
|
||||
fails and the content of
|
||||
.Pf * Fa version
|
||||
is unspecified.
|
||||
.Pp
|
||||
.Fn CMS_get0_eContentType
|
||||
returns the type of the embedded content.
|
||||
.Pp
|
||||
|
@ -176,6 +197,9 @@ return internal pointers to
|
|||
.Vt OBJECT IDENTIFIER
|
||||
structures.
|
||||
.Pp
|
||||
.Fn CMS_get_version
|
||||
returns 1 on success and 0 on failure.
|
||||
.Pp
|
||||
.Fn CMS_get0_content
|
||||
returns an internal pointer to the storage location where the pointer
|
||||
to the embedded content is stored.
|
||||
|
@ -196,3 +220,7 @@ RFC 3274: Compressed Data Content Type for Cryptographic Message Syntax (CMS)
|
|||
These functions first appeared in OpenSSL 0.9.8h
|
||||
and have been available since
|
||||
.Ox 6.7 .
|
||||
.Pp
|
||||
.Fn CMS_get_version
|
||||
first appeared in
|
||||
.Ox 7.4 .
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $OpenBSD: ERR.3,v 1.10 2022/09/06 10:22:31 kn Exp $
|
||||
.\" $OpenBSD: ERR.3,v 1.11 2023/07/26 20:15:51 tb Exp $
|
||||
.\" OpenSSL 186bb907 Apr 13 11:05:13 2015 -0700
|
||||
.\"
|
||||
.\" This file was written by Ulf Moeller <ulf@openssl.org> and
|
||||
|
@ -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: September 6 2022 $
|
||||
.Dd $Mdocdate: July 26 2023 $
|
||||
.Dt ERR 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -136,10 +136,6 @@ When more error codes are added, the old ones are overwritten, on the
|
|||
assumption that the most recent errors are most important.
|
||||
.Pp
|
||||
Error strings are also stored in a hash table.
|
||||
The hash tables can be obtained by calling
|
||||
.Fn ERR_get_err_state_table
|
||||
and
|
||||
.Fn ERR_get_string_table .
|
||||
.Sh SEE ALSO
|
||||
.Xr crypto 3 ,
|
||||
.Xr ERR_asprintf_error_data 3 ,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $OpenBSD: Makefile,v 1.255 2023/07/21 04:50:47 tb Exp $
|
||||
# $OpenBSD: Makefile,v 1.258 2023/07/26 20:08:59 tb Exp $
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
|
@ -37,7 +37,6 @@ MAN= \
|
|||
BIO_ctrl.3 \
|
||||
BIO_dump.3 \
|
||||
BIO_dup_chain.3 \
|
||||
BIO_f_asn1.3 \
|
||||
BIO_f_base64.3 \
|
||||
BIO_f_buffer.3 \
|
||||
BIO_f_cipher.3 \
|
||||
|
@ -63,7 +62,6 @@ MAN= \
|
|||
BIO_s_socket.3 \
|
||||
BIO_set_callback.3 \
|
||||
BIO_should_retry.3 \
|
||||
BN_BLINDING_new.3 \
|
||||
BN_CTX_new.3 \
|
||||
BN_CTX_start.3 \
|
||||
BN_add.3 \
|
||||
|
@ -214,8 +212,8 @@ MAN= \
|
|||
MD5.3 \
|
||||
NAME_CONSTRAINTS_new.3 \
|
||||
OBJ_NAME_add.3 \
|
||||
OBJ_add_sigid.3 \
|
||||
OBJ_create.3 \
|
||||
OBJ_find_sigid_algs.3 \
|
||||
OBJ_nid2obj.3 \
|
||||
OCSP_CRLID_new.3 \
|
||||
OCSP_REQUEST_new.3 \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
.\" $OpenBSD: OBJ_add_sigid.3,v 1.2 2023/07/21 05:02:53 tb Exp $
|
||||
.\" $OpenBSD: OBJ_find_sigid_algs.3,v 1.1 2023/07/22 06:35:26 tb Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
|
||||
.\"
|
||||
|
@ -14,8 +14,8 @@
|
|||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
.\"
|
||||
.Dd $Mdocdate: July 21 2023 $
|
||||
.Dt OBJ_ADD_SIGID 3
|
||||
.Dd $Mdocdate: July 22 2023 $
|
||||
.Dt OBJ_FIND_SIGID_ALGS 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm OBJ_find_sigid_algs ,
|
|
@ -1,4 +1,4 @@
|
|||
.\" $OpenBSD: RSA_blinding_on.3,v 1.6 2019/06/06 01:06:59 schwarze Exp $
|
||||
.\" $OpenBSD: RSA_blinding_on.3,v 1.7 2023/07/26 20:08:59 tb Exp $
|
||||
.\" OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400
|
||||
.\"
|
||||
.\" This file was written by Ulf Moeller <ulf@openssl.org>.
|
||||
|
@ -48,7 +48,7 @@
|
|||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
.\" OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
.\"
|
||||
.Dd $Mdocdate: June 6 2019 $
|
||||
.Dd $Mdocdate: July 26 2023 $
|
||||
.Dt RSA_BLINDING_ON 3
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
@ -88,7 +88,6 @@ turns blinding off and frees the memory used for the blinding factor.
|
|||
.Fn RSA_blinding_on
|
||||
returns 1 on success, and 0 if an error occurred.
|
||||
.Sh SEE ALSO
|
||||
.Xr BN_BLINDING_new 3 ,
|
||||
.Xr RSA_new 3
|
||||
.Sh HISTORY
|
||||
.Fn RSA_blinding_on
|
||||
|
|
|
@ -1,241 +1,325 @@
|
|||
/* $OpenBSD: obj_xref.c,v 1.9 2023/07/08 12:27:51 beck Exp $ */
|
||||
/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
|
||||
* project 2006.
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 2006 The OpenSSL Project. All rights reserved.
|
||||
/* $OpenBSD: obj_xref.c,v 1.12 2023/07/22 19:08:03 tb Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2023 Theo Buehler <tb@openbsd.org>
|
||||
*
|
||||
* 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).
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <openssl/objects.h>
|
||||
#include "obj_xref.h"
|
||||
|
||||
DECLARE_STACK_OF(nid_triple)
|
||||
STACK_OF(nid_triple) *sig_app, *sigx_app;
|
||||
/*
|
||||
* Map between signature nids and pairs of (hash, pkey) nids. If the hash nid
|
||||
* is NID_undef, this indicates to ASN1_item_{sign,verify}() that the pkey's
|
||||
* ASN.1 method needs to handle algorithm identifiers and part of the message
|
||||
* digest.
|
||||
*/
|
||||
|
||||
static int
|
||||
sig_cmp(const nid_triple *a, const nid_triple *b)
|
||||
{
|
||||
return a->sign_id - b->sign_id;
|
||||
}
|
||||
static const struct {
|
||||
int sign_nid;
|
||||
int hash_nid;
|
||||
int pkey_nid;
|
||||
} nid_triple[] = {
|
||||
{
|
||||
.sign_nid = NID_md2WithRSAEncryption,
|
||||
.hash_nid = NID_md2,
|
||||
.pkey_nid = NID_rsaEncryption,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_md5WithRSAEncryption,
|
||||
.hash_nid = NID_md5,
|
||||
.pkey_nid = NID_rsaEncryption,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_shaWithRSAEncryption,
|
||||
.hash_nid = NID_sha,
|
||||
.pkey_nid = NID_rsaEncryption,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_sha1WithRSAEncryption,
|
||||
.hash_nid = NID_sha1,
|
||||
.pkey_nid = NID_rsaEncryption,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_dsaWithSHA,
|
||||
.hash_nid = NID_sha,
|
||||
.pkey_nid = NID_dsa,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_dsaWithSHA1_2,
|
||||
.hash_nid = NID_sha1,
|
||||
.pkey_nid = NID_dsa_2,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_mdc2WithRSA,
|
||||
.hash_nid = NID_mdc2,
|
||||
.pkey_nid = NID_rsaEncryption,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_md5WithRSA,
|
||||
.hash_nid = NID_md5,
|
||||
.pkey_nid = NID_rsa,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_dsaWithSHA1,
|
||||
.hash_nid = NID_sha1,
|
||||
.pkey_nid = NID_dsa,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_sha1WithRSA,
|
||||
.hash_nid = NID_sha1,
|
||||
.pkey_nid = NID_rsa,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_ripemd160WithRSA,
|
||||
.hash_nid = NID_ripemd160,
|
||||
.pkey_nid = NID_rsaEncryption,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_md4WithRSAEncryption,
|
||||
.hash_nid = NID_md4,
|
||||
.pkey_nid = NID_rsaEncryption,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_ecdsa_with_SHA1,
|
||||
.hash_nid = NID_sha1,
|
||||
.pkey_nid = NID_X9_62_id_ecPublicKey,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_sha256WithRSAEncryption,
|
||||
.hash_nid = NID_sha256,
|
||||
.pkey_nid = NID_rsaEncryption,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_sha384WithRSAEncryption,
|
||||
.hash_nid = NID_sha384,
|
||||
.pkey_nid = NID_rsaEncryption,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_sha512WithRSAEncryption,
|
||||
.hash_nid = NID_sha512,
|
||||
.pkey_nid = NID_rsaEncryption,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_sha224WithRSAEncryption,
|
||||
.hash_nid = NID_sha224,
|
||||
.pkey_nid = NID_rsaEncryption,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_ecdsa_with_Recommended,
|
||||
.hash_nid = NID_undef,
|
||||
.pkey_nid = NID_X9_62_id_ecPublicKey,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_ecdsa_with_Specified,
|
||||
.hash_nid = NID_undef,
|
||||
.pkey_nid = NID_X9_62_id_ecPublicKey,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_ecdsa_with_SHA224,
|
||||
.hash_nid = NID_sha224,
|
||||
.pkey_nid = NID_X9_62_id_ecPublicKey,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_ecdsa_with_SHA256,
|
||||
.hash_nid = NID_sha256,
|
||||
.pkey_nid = NID_X9_62_id_ecPublicKey,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_ecdsa_with_SHA384,
|
||||
.hash_nid = NID_sha384,
|
||||
.pkey_nid = NID_X9_62_id_ecPublicKey,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_ecdsa_with_SHA512,
|
||||
.hash_nid = NID_sha512,
|
||||
.pkey_nid = NID_X9_62_id_ecPublicKey,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_dsa_with_SHA224,
|
||||
.hash_nid = NID_sha224,
|
||||
.pkey_nid = NID_dsa,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_dsa_with_SHA256,
|
||||
.hash_nid = NID_sha256,
|
||||
.pkey_nid = NID_dsa,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_id_GostR3411_94_with_GostR3410_2001,
|
||||
.hash_nid = NID_id_GostR3411_94,
|
||||
.pkey_nid = NID_id_GostR3410_2001,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_id_GostR3411_94_with_GostR3410_94,
|
||||
.hash_nid = NID_id_GostR3411_94,
|
||||
.pkey_nid = NID_id_GostR3410_94,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_id_GostR3411_94_with_GostR3410_94_cc,
|
||||
.hash_nid = NID_id_GostR3411_94,
|
||||
.pkey_nid = NID_id_GostR3410_94_cc,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_id_GostR3411_94_with_GostR3410_2001_cc,
|
||||
.hash_nid = NID_id_GostR3411_94,
|
||||
.pkey_nid = NID_id_GostR3410_2001_cc,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_rsassaPss,
|
||||
.hash_nid = NID_undef,
|
||||
.pkey_nid = NID_rsaEncryption,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_id_tc26_signwithdigest_gost3410_2012_256,
|
||||
.hash_nid = NID_id_tc26_gost3411_2012_256,
|
||||
.pkey_nid = NID_id_GostR3410_2001,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_id_tc26_signwithdigest_gost3410_2012_512,
|
||||
.hash_nid = NID_id_tc26_gost3411_2012_512,
|
||||
.pkey_nid = NID_id_GostR3410_2001,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_Ed25519,
|
||||
.hash_nid = NID_undef,
|
||||
.pkey_nid = NID_Ed25519,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_dhSinglePass_stdDH_sha1kdf_scheme,
|
||||
.hash_nid = NID_sha1,
|
||||
.pkey_nid = NID_dh_std_kdf,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_dhSinglePass_stdDH_sha224kdf_scheme,
|
||||
.hash_nid = NID_sha224,
|
||||
.pkey_nid = NID_dh_std_kdf,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_dhSinglePass_stdDH_sha256kdf_scheme,
|
||||
.hash_nid = NID_sha256,
|
||||
.pkey_nid = NID_dh_std_kdf,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_dhSinglePass_stdDH_sha384kdf_scheme,
|
||||
.hash_nid = NID_sha384,
|
||||
.pkey_nid = NID_dh_std_kdf,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_dhSinglePass_stdDH_sha512kdf_scheme,
|
||||
.hash_nid = NID_sha512,
|
||||
.pkey_nid = NID_dh_std_kdf,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_dhSinglePass_cofactorDH_sha1kdf_scheme,
|
||||
.hash_nid = NID_sha1,
|
||||
.pkey_nid = NID_dh_cofactor_kdf,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_dhSinglePass_cofactorDH_sha224kdf_scheme,
|
||||
.hash_nid = NID_sha224,
|
||||
.pkey_nid = NID_dh_cofactor_kdf,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_dhSinglePass_cofactorDH_sha256kdf_scheme,
|
||||
.hash_nid = NID_sha256,
|
||||
.pkey_nid = NID_dh_cofactor_kdf,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_dhSinglePass_cofactorDH_sha384kdf_scheme,
|
||||
.hash_nid = NID_sha384,
|
||||
.pkey_nid = NID_dh_cofactor_kdf,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_dhSinglePass_cofactorDH_sha512kdf_scheme,
|
||||
.hash_nid = NID_sha512,
|
||||
.pkey_nid = NID_dh_cofactor_kdf,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_RSA_SHA3_224,
|
||||
.hash_nid = NID_sha3_224,
|
||||
.pkey_nid = NID_rsaEncryption,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_RSA_SHA3_256,
|
||||
.hash_nid = NID_sha3_256,
|
||||
.pkey_nid = NID_rsaEncryption,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_RSA_SHA3_384,
|
||||
.hash_nid = NID_sha3_384,
|
||||
.pkey_nid = NID_rsaEncryption,
|
||||
},
|
||||
{
|
||||
.sign_nid = NID_RSA_SHA3_512,
|
||||
.hash_nid = NID_sha3_512,
|
||||
.pkey_nid = NID_rsaEncryption,
|
||||
},
|
||||
};
|
||||
|
||||
static int sig_cmp_BSEARCH_CMP_FN(const void *, const void *);
|
||||
static int sig_cmp(nid_triple const *, nid_triple const *);
|
||||
static nid_triple *OBJ_bsearch_sig(nid_triple *key, nid_triple const *base, int num);
|
||||
|
||||
static int
|
||||
sig_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_)
|
||||
{
|
||||
nid_triple const *a = a_;
|
||||
nid_triple const *b = b_;
|
||||
return sig_cmp(a, b);
|
||||
}
|
||||
|
||||
static nid_triple *
|
||||
OBJ_bsearch_sig(nid_triple *key, nid_triple const *base, int num)
|
||||
{
|
||||
return (nid_triple *)OBJ_bsearch_(key, base, num, sizeof(nid_triple),
|
||||
sig_cmp_BSEARCH_CMP_FN);
|
||||
}
|
||||
|
||||
static int
|
||||
sig_sk_cmp(const nid_triple * const *a, const nid_triple * const *b)
|
||||
{
|
||||
return (*a)->sign_id - (*b)->sign_id;
|
||||
}
|
||||
|
||||
static int sigx_cmp_BSEARCH_CMP_FN(const void *, const void *);
|
||||
static int sigx_cmp(const nid_triple * const *, const nid_triple * const *);
|
||||
static const nid_triple * *OBJ_bsearch_sigx(const nid_triple * *key, const nid_triple * const *base, int num);
|
||||
|
||||
static int
|
||||
sigx_cmp(const nid_triple * const *a, const nid_triple * const *b)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = (*a)->hash_id - (*b)->hash_id;
|
||||
if (ret)
|
||||
return ret;
|
||||
return (*a)->pkey_id - (*b)->pkey_id;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
sigx_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_)
|
||||
{
|
||||
const nid_triple * const *a = a_;
|
||||
const nid_triple * const *b = b_;
|
||||
return sigx_cmp(a, b);
|
||||
}
|
||||
|
||||
static const nid_triple * *
|
||||
OBJ_bsearch_sigx(const nid_triple * *key, const nid_triple * const *base, int num)
|
||||
{
|
||||
return (const nid_triple * *)OBJ_bsearch_(key, base, num, sizeof(const nid_triple *),
|
||||
sigx_cmp_BSEARCH_CMP_FN);
|
||||
}
|
||||
#define N_NID_TRIPLES (sizeof(nid_triple) / sizeof(nid_triple[0]))
|
||||
|
||||
int
|
||||
OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid)
|
||||
OBJ_find_sigid_algs(int sign_nid, int *hash_nid, int *pkey_nid)
|
||||
{
|
||||
nid_triple tmp;
|
||||
const nid_triple *rv = NULL;
|
||||
tmp.sign_id = signid;
|
||||
size_t i;
|
||||
|
||||
if (sig_app) {
|
||||
int idx = sk_nid_triple_find(sig_app, &tmp);
|
||||
if (idx >= 0)
|
||||
rv = sk_nid_triple_value(sig_app, idx);
|
||||
for (i = 0; i < N_NID_TRIPLES; i++) {
|
||||
if (sign_nid != nid_triple[i].sign_nid)
|
||||
continue;
|
||||
|
||||
if (hash_nid != NULL)
|
||||
*hash_nid = nid_triple[i].hash_nid;
|
||||
if (pkey_nid != NULL)
|
||||
*pkey_nid = nid_triple[i].pkey_nid;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifndef OBJ_XREF_TEST2
|
||||
if (rv == NULL) {
|
||||
rv = OBJ_bsearch_sig(&tmp, sigoid_srt,
|
||||
sizeof(sigoid_srt) / sizeof(nid_triple));
|
||||
}
|
||||
#endif
|
||||
if (rv == NULL)
|
||||
return 0;
|
||||
if (pdig_nid)
|
||||
*pdig_nid = rv->hash_id;
|
||||
if (ppkey_nid)
|
||||
*ppkey_nid = rv->pkey_id;
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
LCRYPTO_ALIAS(OBJ_find_sigid_algs);
|
||||
|
||||
int
|
||||
OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid)
|
||||
OBJ_find_sigid_by_algs(int *sign_nid, int hash_nid, int pkey_nid)
|
||||
{
|
||||
nid_triple tmp;
|
||||
const nid_triple *t = &tmp;
|
||||
const nid_triple **rv = NULL;
|
||||
size_t i;
|
||||
|
||||
tmp.hash_id = dig_nid;
|
||||
tmp.pkey_id = pkey_nid;
|
||||
for (i = 0; i < N_NID_TRIPLES; i++) {
|
||||
if (hash_nid != nid_triple[i].hash_nid)
|
||||
continue;
|
||||
if (pkey_nid != nid_triple[i].pkey_nid)
|
||||
continue;
|
||||
|
||||
if (sigx_app) {
|
||||
int idx = sk_nid_triple_find(sigx_app, &tmp);
|
||||
if (idx >= 0) {
|
||||
t = sk_nid_triple_value(sigx_app, idx);
|
||||
rv = &t;
|
||||
}
|
||||
if (sign_nid != NULL)
|
||||
*sign_nid = nid_triple[i].sign_nid;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifndef OBJ_XREF_TEST2
|
||||
if (rv == NULL) {
|
||||
rv = OBJ_bsearch_sigx(&t, sigoid_srt_xref,
|
||||
sizeof(sigoid_srt_xref) / sizeof(nid_triple *));
|
||||
}
|
||||
#endif
|
||||
if (rv == NULL)
|
||||
return 0;
|
||||
if (psignid)
|
||||
*psignid = (*rv)->sign_id;
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
LCRYPTO_ALIAS(OBJ_find_sigid_by_algs);
|
||||
|
||||
int
|
||||
OBJ_add_sigid(int signid, int dig_id, int pkey_id)
|
||||
OBJ_add_sigid(int sign_nid, int hash_nid, int pkey_nid)
|
||||
{
|
||||
nid_triple *ntr;
|
||||
|
||||
if (!sig_app)
|
||||
sig_app = sk_nid_triple_new(sig_sk_cmp);
|
||||
if (!sig_app)
|
||||
return 0;
|
||||
if (!sigx_app)
|
||||
sigx_app = sk_nid_triple_new(sigx_cmp);
|
||||
if (!sigx_app)
|
||||
return 0;
|
||||
ntr = reallocarray(NULL, 3, sizeof(int));
|
||||
if (!ntr)
|
||||
return 0;
|
||||
ntr->sign_id = signid;
|
||||
ntr->hash_id = dig_id;
|
||||
ntr->pkey_id = pkey_id;
|
||||
|
||||
if (!sk_nid_triple_push(sig_app, ntr)) {
|
||||
free(ntr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!sk_nid_triple_push(sigx_app, ntr))
|
||||
return 0;
|
||||
|
||||
sk_nid_triple_sort(sig_app);
|
||||
sk_nid_triple_sort(sigx_app);
|
||||
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
LCRYPTO_ALIAS(OBJ_add_sigid);
|
||||
|
||||
static void
|
||||
sid_free(nid_triple *tt)
|
||||
{
|
||||
free(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;
|
||||
}
|
||||
}
|
||||
LCRYPTO_ALIAS(OBJ_sigid_free);
|
||||
|
|
|
@ -1,115 +0,0 @@
|
|||
/* $OpenBSD: obj_xref.h,v 1.7 2023/06/15 17:58:27 tb Exp $ */
|
||||
/* AUTOGENERATED BY objxref.pl, DO NOT EDIT */
|
||||
|
||||
__BEGIN_HIDDEN_DECLS
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int sign_id;
|
||||
int hash_id;
|
||||
int pkey_id;
|
||||
} nid_triple;
|
||||
|
||||
static const nid_triple sigoid_srt[] =
|
||||
{
|
||||
{NID_md2WithRSAEncryption, NID_md2, NID_rsaEncryption},
|
||||
{NID_md5WithRSAEncryption, NID_md5, NID_rsaEncryption},
|
||||
{NID_shaWithRSAEncryption, NID_sha, NID_rsaEncryption},
|
||||
{NID_sha1WithRSAEncryption, NID_sha1, NID_rsaEncryption},
|
||||
{NID_dsaWithSHA, NID_sha, NID_dsa},
|
||||
{NID_dsaWithSHA1_2, NID_sha1, NID_dsa_2},
|
||||
{NID_mdc2WithRSA, NID_mdc2, NID_rsaEncryption},
|
||||
{NID_md5WithRSA, NID_md5, NID_rsa},
|
||||
{NID_dsaWithSHA1, NID_sha1, NID_dsa},
|
||||
{NID_sha1WithRSA, NID_sha1, NID_rsa},
|
||||
{NID_ripemd160WithRSA, NID_ripemd160, NID_rsaEncryption},
|
||||
{NID_md4WithRSAEncryption, NID_md4, NID_rsaEncryption},
|
||||
{NID_ecdsa_with_SHA1, NID_sha1, NID_X9_62_id_ecPublicKey},
|
||||
{NID_sha256WithRSAEncryption, NID_sha256, NID_rsaEncryption},
|
||||
{NID_sha384WithRSAEncryption, NID_sha384, NID_rsaEncryption},
|
||||
{NID_sha512WithRSAEncryption, NID_sha512, NID_rsaEncryption},
|
||||
{NID_sha224WithRSAEncryption, NID_sha224, NID_rsaEncryption},
|
||||
{NID_ecdsa_with_Recommended, NID_undef, NID_X9_62_id_ecPublicKey},
|
||||
{NID_ecdsa_with_Specified, NID_undef, NID_X9_62_id_ecPublicKey},
|
||||
{NID_ecdsa_with_SHA224, NID_sha224, NID_X9_62_id_ecPublicKey},
|
||||
{NID_ecdsa_with_SHA256, NID_sha256, NID_X9_62_id_ecPublicKey},
|
||||
{NID_ecdsa_with_SHA384, NID_sha384, NID_X9_62_id_ecPublicKey},
|
||||
{NID_ecdsa_with_SHA512, NID_sha512, NID_X9_62_id_ecPublicKey},
|
||||
{NID_dsa_with_SHA224, NID_sha224, NID_dsa},
|
||||
{NID_dsa_with_SHA256, NID_sha256, NID_dsa},
|
||||
{NID_id_GostR3411_94_with_GostR3410_2001, NID_id_GostR3411_94, NID_id_GostR3410_2001},
|
||||
{NID_id_GostR3411_94_with_GostR3410_94, NID_id_GostR3411_94, NID_id_GostR3410_94},
|
||||
{NID_id_GostR3411_94_with_GostR3410_94_cc, NID_id_GostR3411_94, NID_id_GostR3410_94_cc},
|
||||
{NID_id_GostR3411_94_with_GostR3410_2001_cc, NID_id_GostR3411_94, NID_id_GostR3410_2001_cc},
|
||||
{NID_rsassaPss, NID_undef, NID_rsaEncryption},
|
||||
{NID_id_tc26_signwithdigest_gost3410_2012_256, NID_id_tc26_gost3411_2012_256, NID_id_GostR3410_2001},
|
||||
{NID_id_tc26_signwithdigest_gost3410_2012_512, NID_id_tc26_gost3411_2012_512, NID_id_GostR3410_2001},
|
||||
{NID_Ed25519, NID_undef, NID_Ed25519},
|
||||
{NID_dhSinglePass_stdDH_sha1kdf_scheme, NID_sha1, NID_dh_std_kdf},
|
||||
{NID_dhSinglePass_stdDH_sha224kdf_scheme, NID_sha224, NID_dh_std_kdf},
|
||||
{NID_dhSinglePass_stdDH_sha256kdf_scheme, NID_sha256, NID_dh_std_kdf},
|
||||
{NID_dhSinglePass_stdDH_sha384kdf_scheme, NID_sha384, NID_dh_std_kdf},
|
||||
{NID_dhSinglePass_stdDH_sha512kdf_scheme, NID_sha512, NID_dh_std_kdf},
|
||||
{NID_dhSinglePass_cofactorDH_sha1kdf_scheme, NID_sha1, NID_dh_cofactor_kdf},
|
||||
{NID_dhSinglePass_cofactorDH_sha224kdf_scheme, NID_sha224, NID_dh_cofactor_kdf},
|
||||
{NID_dhSinglePass_cofactorDH_sha256kdf_scheme, NID_sha256, NID_dh_cofactor_kdf},
|
||||
{NID_dhSinglePass_cofactorDH_sha384kdf_scheme, NID_sha384, NID_dh_cofactor_kdf},
|
||||
{NID_dhSinglePass_cofactorDH_sha512kdf_scheme, NID_sha512, NID_dh_cofactor_kdf},
|
||||
{NID_RSA_SHA3_224, NID_sha3_224, NID_rsaEncryption},
|
||||
{NID_RSA_SHA3_256, NID_sha3_256, NID_rsaEncryption},
|
||||
{NID_RSA_SHA3_384, NID_sha3_384, NID_rsaEncryption},
|
||||
{NID_RSA_SHA3_512, NID_sha3_512, NID_rsaEncryption},
|
||||
};
|
||||
|
||||
static const nid_triple * const sigoid_srt_xref[] =
|
||||
{
|
||||
&sigoid_srt[29],
|
||||
&sigoid_srt[18],
|
||||
&sigoid_srt[17],
|
||||
&sigoid_srt[32],
|
||||
&sigoid_srt[0],
|
||||
&sigoid_srt[1],
|
||||
&sigoid_srt[7],
|
||||
&sigoid_srt[2],
|
||||
&sigoid_srt[4],
|
||||
&sigoid_srt[3],
|
||||
&sigoid_srt[9],
|
||||
&sigoid_srt[5],
|
||||
&sigoid_srt[8],
|
||||
&sigoid_srt[12],
|
||||
&sigoid_srt[33],
|
||||
&sigoid_srt[38],
|
||||
&sigoid_srt[6],
|
||||
&sigoid_srt[10],
|
||||
&sigoid_srt[11],
|
||||
&sigoid_srt[13],
|
||||
&sigoid_srt[24],
|
||||
&sigoid_srt[20],
|
||||
&sigoid_srt[35],
|
||||
&sigoid_srt[40],
|
||||
&sigoid_srt[14],
|
||||
&sigoid_srt[21],
|
||||
&sigoid_srt[36],
|
||||
&sigoid_srt[41],
|
||||
&sigoid_srt[15],
|
||||
&sigoid_srt[22],
|
||||
&sigoid_srt[37],
|
||||
&sigoid_srt[42],
|
||||
&sigoid_srt[16],
|
||||
&sigoid_srt[23],
|
||||
&sigoid_srt[19],
|
||||
&sigoid_srt[34],
|
||||
&sigoid_srt[39],
|
||||
&sigoid_srt[25],
|
||||
&sigoid_srt[26],
|
||||
&sigoid_srt[27],
|
||||
&sigoid_srt[28],
|
||||
&sigoid_srt[30],
|
||||
&sigoid_srt[31],
|
||||
&sigoid_srt[43],
|
||||
&sigoid_srt[44],
|
||||
&sigoid_srt[45],
|
||||
&sigoid_srt[46],
|
||||
};
|
||||
|
||||
__END_HIDDEN_DECLS
|
|
@ -1,68 +0,0 @@
|
|||
# OID cross reference table.
|
||||
# Links signatures OIDs to their corresponding public key algorithms
|
||||
# and digests. The digest "undef" indicates the public key's ASN.1
|
||||
# method should handle AlgorithmIdentifiers and (at least part of) the
|
||||
# message digest explicitly.
|
||||
|
||||
md2WithRSAEncryption md2 rsaEncryption
|
||||
md5WithRSAEncryption md5 rsaEncryption
|
||||
shaWithRSAEncryption sha rsaEncryption
|
||||
sha1WithRSAEncryption sha1 rsaEncryption
|
||||
md4WithRSAEncryption md4 rsaEncryption
|
||||
sha256WithRSAEncryption sha256 rsaEncryption
|
||||
sha384WithRSAEncryption sha384 rsaEncryption
|
||||
sha512WithRSAEncryption sha512 rsaEncryption
|
||||
sha224WithRSAEncryption sha224 rsaEncryption
|
||||
mdc2WithRSA mdc2 rsaEncryption
|
||||
ripemd160WithRSA ripemd160 rsaEncryption
|
||||
RSA_SHA3_224 sha3_224 rsaEncryption
|
||||
RSA_SHA3_256 sha3_256 rsaEncryption
|
||||
RSA_SHA3_384 sha3_384 rsaEncryption
|
||||
RSA_SHA3_512 sha3_512 rsaEncryption
|
||||
# For PSS the digest algorithm can vary and depends on the included
|
||||
# AlgorithmIdentifier.
|
||||
rsassaPss undef rsaEncryption
|
||||
|
||||
Ed25519 undef Ed25519
|
||||
|
||||
# Alternative deprecated OIDs. By using the older "rsa" OID this
|
||||
# type will be recognized by not normally used.
|
||||
|
||||
md5WithRSA md5 rsa
|
||||
sha1WithRSA sha1 rsa
|
||||
|
||||
dsaWithSHA sha dsa
|
||||
dsaWithSHA1 sha1 dsa
|
||||
|
||||
dsaWithSHA1_2 sha1 dsa_2
|
||||
|
||||
ecdsa_with_SHA1 sha1 X9_62_id_ecPublicKey
|
||||
ecdsa_with_SHA224 sha224 X9_62_id_ecPublicKey
|
||||
ecdsa_with_SHA256 sha256 X9_62_id_ecPublicKey
|
||||
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
|
||||
|
||||
dsa_with_SHA224 sha224 dsa
|
||||
dsa_with_SHA256 sha256 dsa
|
||||
|
||||
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_tc26_gost3411_2012_256 id_GostR3410_2001
|
||||
id_tc26_signwithdigest_gost3410_2012_512 id_tc26_gost3411_2012_512 id_GostR3410_2001
|
||||
|
||||
# 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
|
||||
dhSinglePass_stdDH_sha256kdf_scheme sha256 dh_std_kdf
|
||||
dhSinglePass_stdDH_sha384kdf_scheme sha384 dh_std_kdf
|
||||
dhSinglePass_stdDH_sha512kdf_scheme sha512 dh_std_kdf
|
||||
|
||||
dhSinglePass_cofactorDH_sha1kdf_scheme sha1 dh_cofactor_kdf
|
||||
dhSinglePass_cofactorDH_sha224kdf_scheme sha224 dh_cofactor_kdf
|
||||
dhSinglePass_cofactorDH_sha256kdf_scheme sha256 dh_cofactor_kdf
|
||||
dhSinglePass_cofactorDH_sha384kdf_scheme sha384 dh_cofactor_kdf
|
||||
dhSinglePass_cofactorDH_sha512kdf_scheme sha512 dh_cofactor_kdf
|
|
@ -1,111 +0,0 @@
|
|||
#!/usr/local/bin/perl
|
||||
|
||||
use strict;
|
||||
|
||||
my %xref_tbl;
|
||||
my %oid_tbl;
|
||||
|
||||
my ($mac_file, $xref_file) = @ARGV;
|
||||
|
||||
open(IN, $mac_file) || die "Can't open $mac_file";
|
||||
|
||||
# Read in OID nid values for a lookup table.
|
||||
|
||||
while (<IN>)
|
||||
{
|
||||
chomp;
|
||||
my ($name, $num) = /^(\S+)\s+(\S+)$/;
|
||||
$oid_tbl{$name} = $num;
|
||||
}
|
||||
close IN;
|
||||
|
||||
open(IN, $xref_file) || die "Can't open $xref_file";
|
||||
|
||||
my $ln = 1;
|
||||
|
||||
while (<IN>)
|
||||
{
|
||||
chomp;
|
||||
s/#.*$//;
|
||||
next if (/^\S*$/);
|
||||
my ($xr, $p1, $p2) = /^(\S+)\s+(\S+)\s+(\S+)/;
|
||||
check_oid($xr);
|
||||
check_oid($p1);
|
||||
check_oid($p2);
|
||||
$xref_tbl{$xr} = [$p1, $p2, $ln];
|
||||
}
|
||||
|
||||
my @xrkeys = keys %xref_tbl;
|
||||
|
||||
my @srt1 = sort { $oid_tbl{$a} <=> $oid_tbl{$b}} @xrkeys;
|
||||
|
||||
for(my $i = 0; $i <= $#srt1; $i++)
|
||||
{
|
||||
$xref_tbl{$srt1[$i]}[2] = $i;
|
||||
}
|
||||
|
||||
my @srt2 = sort
|
||||
{
|
||||
my$ap1 = $oid_tbl{$xref_tbl{$a}[0]};
|
||||
my$bp1 = $oid_tbl{$xref_tbl{$b}[0]};
|
||||
return $ap1 - $bp1 if ($ap1 != $bp1);
|
||||
my$ap2 = $oid_tbl{$xref_tbl{$a}[1]};
|
||||
my$bp2 = $oid_tbl{$xref_tbl{$b}[1]};
|
||||
|
||||
return $ap2 - $bp2;
|
||||
} @xrkeys;
|
||||
|
||||
my $pname = $0;
|
||||
|
||||
$pname =~ s|^.[^/]/||;
|
||||
|
||||
print <<EOF;
|
||||
/* \$OpenBSD\$ */
|
||||
/* AUTOGENERATED BY $pname, DO NOT EDIT */
|
||||
|
||||
__BEGIN_HIDDEN_DECLS
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int sign_id;
|
||||
int hash_id;
|
||||
int pkey_id;
|
||||
} nid_triple;
|
||||
|
||||
static const nid_triple sigoid_srt[] =
|
||||
{
|
||||
EOF
|
||||
|
||||
foreach (@srt1)
|
||||
{
|
||||
my $xr = $_;
|
||||
my ($p1, $p2) = @{$xref_tbl{$_}};
|
||||
print "\t{NID_$xr, NID_$p1, NID_$p2},\n";
|
||||
}
|
||||
|
||||
print "\t};";
|
||||
print <<EOF;
|
||||
|
||||
|
||||
static const nid_triple * const sigoid_srt_xref[] =
|
||||
{
|
||||
EOF
|
||||
|
||||
foreach (@srt2)
|
||||
{
|
||||
my $x = $xref_tbl{$_}[2];
|
||||
print "\t\&sigoid_srt\[$x\],\n";
|
||||
}
|
||||
|
||||
print "\t};\n\n";
|
||||
print "__END_HIDDEN_DECLS\n";
|
||||
|
||||
sub check_oid
|
||||
{
|
||||
my ($chk) = @_;
|
||||
if (!exists $oid_tbl{$chk})
|
||||
{
|
||||
die "Not Found \"$chk\"\n";
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue