This commit is contained in:
purplerain 2023-07-10 00:10:46 +00:00
parent 2a351e0cdc
commit f57be82572
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
704 changed files with 20524 additions and 10572 deletions

View file

@ -1,4 +1,4 @@
/* $OpenBSD: rsa_lib.c,v 1.46 2023/03/11 21:14:26 tb Exp $ */
/* $OpenBSD: rsa_lib.c,v 1.47 2023/07/08 12:26:45 beck Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@ -83,12 +83,14 @@ RSA_new(void)
return r;
}
LCRYPTO_ALIAS(RSA_new);
void
RSA_set_default_method(const RSA_METHOD *meth)
{
default_RSA_meth = meth;
}
LCRYPTO_ALIAS(RSA_set_default_method);
const RSA_METHOD *
RSA_get_default_method(void)
@ -98,12 +100,14 @@ RSA_get_default_method(void)
return default_RSA_meth;
}
LCRYPTO_ALIAS(RSA_get_default_method);
const RSA_METHOD *
RSA_get_method(const RSA *rsa)
{
return rsa->meth;
}
LCRYPTO_ALIAS(RSA_get_method);
int
RSA_set_method(RSA *rsa, const RSA_METHOD *meth)
@ -126,6 +130,7 @@ RSA_set_method(RSA *rsa, const RSA_METHOD *meth)
meth->init(rsa);
return 1;
}
LCRYPTO_ALIAS(RSA_set_method);
RSA *
RSA_new_method(ENGINE *engine)
@ -179,6 +184,7 @@ RSA_new_method(ENGINE *engine)
return NULL;
}
LCRYPTO_ALIAS(RSA_new_method);
void
RSA_free(RSA *r)
@ -213,6 +219,7 @@ RSA_free(RSA *r)
RSA_PSS_PARAMS_free(r->pss);
free(r);
}
LCRYPTO_ALIAS(RSA_free);
int
RSA_up_ref(RSA *r)
@ -220,6 +227,7 @@ RSA_up_ref(RSA *r)
int i = CRYPTO_add(&r->references, 1, CRYPTO_LOCK_RSA);
return i > 1 ? 1 : 0;
}
LCRYPTO_ALIAS(RSA_up_ref);
int
RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
@ -228,24 +236,28 @@ RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
return CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_RSA, argl, argp,
new_func, dup_func, free_func);
}
LCRYPTO_ALIAS(RSA_get_ex_new_index);
int
RSA_set_ex_data(RSA *r, int idx, void *arg)
{
return CRYPTO_set_ex_data(&r->ex_data, idx, arg);
}
LCRYPTO_ALIAS(RSA_set_ex_data);
void *
RSA_get_ex_data(const RSA *r, int idx)
{
return CRYPTO_get_ex_data(&r->ex_data, idx);
}
LCRYPTO_ALIAS(RSA_get_ex_data);
int
RSA_security_bits(const RSA *rsa)
{
return BN_security_bits(RSA_bits(rsa), -1);
}
LCRYPTO_ALIAS(RSA_security_bits);
void
RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
@ -257,6 +269,7 @@ RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e, const BIGNUM **d)
if (d != NULL)
*d = r->d;
}
LCRYPTO_ALIAS(RSA_get0_key);
int
RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d)
@ -279,6 +292,7 @@ RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d)
return 1;
}
LCRYPTO_ALIAS(RSA_set0_key);
void
RSA_get0_crt_params(const RSA *r, const BIGNUM **dmp1, const BIGNUM **dmq1,
@ -291,6 +305,7 @@ RSA_get0_crt_params(const RSA *r, const BIGNUM **dmp1, const BIGNUM **dmq1,
if (iqmp != NULL)
*iqmp = r->iqmp;
}
LCRYPTO_ALIAS(RSA_get0_crt_params);
int
RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp)
@ -315,6 +330,7 @@ RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp)
return 1;
}
LCRYPTO_ALIAS(RSA_set0_crt_params);
void
RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q)
@ -324,6 +340,7 @@ RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q)
if (q != NULL)
*q = r->q;
}
LCRYPTO_ALIAS(RSA_get0_factors);
int
RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q)
@ -342,78 +359,91 @@ RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q)
return 1;
}
LCRYPTO_ALIAS(RSA_set0_factors);
const BIGNUM *
RSA_get0_n(const RSA *r)
{
return r->n;
}
LCRYPTO_ALIAS(RSA_get0_n);
const BIGNUM *
RSA_get0_e(const RSA *r)
{
return r->e;
}
LCRYPTO_ALIAS(RSA_get0_e);
const BIGNUM *
RSA_get0_d(const RSA *r)
{
return r->d;
}
LCRYPTO_ALIAS(RSA_get0_d);
const BIGNUM *
RSA_get0_p(const RSA *r)
{
return r->p;
}
LCRYPTO_ALIAS(RSA_get0_p);
const BIGNUM *
RSA_get0_q(const RSA *r)
{
return r->q;
}
LCRYPTO_ALIAS(RSA_get0_q);
const BIGNUM *
RSA_get0_dmp1(const RSA *r)
{
return r->dmp1;
}
LCRYPTO_ALIAS(RSA_get0_dmp1);
const BIGNUM *
RSA_get0_dmq1(const RSA *r)
{
return r->dmq1;
}
LCRYPTO_ALIAS(RSA_get0_dmq1);
const BIGNUM *
RSA_get0_iqmp(const RSA *r)
{
return r->iqmp;
}
LCRYPTO_ALIAS(RSA_get0_iqmp);
const RSA_PSS_PARAMS *
RSA_get0_pss_params(const RSA *r)
{
return r->pss;
}
LCRYPTO_ALIAS(RSA_get0_pss_params);
void
RSA_clear_flags(RSA *r, int flags)
{
r->flags &= ~flags;
}
LCRYPTO_ALIAS(RSA_clear_flags);
int
RSA_test_flags(const RSA *r, int flags)
{
return r->flags & flags;
}
LCRYPTO_ALIAS(RSA_test_flags);
void
RSA_set_flags(RSA *r, int flags)
{
r->flags |= flags;
}
LCRYPTO_ALIAS(RSA_set_flags);
int
RSA_pkey_ctx_ctrl(EVP_PKEY_CTX *ctx, int optype, int cmd, int p1, void *p2)
@ -426,3 +456,4 @@ RSA_pkey_ctx_ctrl(EVP_PKEY_CTX *ctx, int optype, int cmd, int p1, void *p2)
return EVP_PKEY_CTX_ctrl(ctx, -1, optype, cmd, p1, p2);
}
LCRYPTO_ALIAS(RSA_pkey_ctx_ctrl);