Go to the documentation of this file.
76 #include "../fipsmodule/bn/internal.h"
77 #include "../internal.h"
82 #define DSS_prime_checks 50
144 const BIGNUM **out_priv_key) {
145 if (out_pub_key != NULL) {
148 if (out_priv_key != NULL) {
167 if (dsa->
pub_key == NULL && pub_key == NULL) {
171 if (pub_key != NULL) {
175 if (priv_key != NULL) {
184 if ((dsa->
p == NULL &&
p == NULL) ||
185 (dsa->
q == NULL && q == NULL) ||
186 (dsa->
g == NULL &&
g == NULL)) {
207 size_t seed_len,
int *out_counter,
214 BIGNUM *
g = NULL, *q = NULL, *
p = NULL;
234 if (seed_in != NULL) {
235 if (seed_len < (
size_t)qsize) {
238 if (seed_len > (
size_t)qsize) {
272 int use_random_seed = (seed_in == NULL);
273 if (use_random_seed) {
284 for (
i = qsize - 1;
i < qsize;
i--) {
296 for (
i = 0;
i < qsize;
i++) {
302 md[qsize - 1] |= 0x01;
328 n = (
bits - 1) / 160;
338 for (
k = 0;
k <=
n;
k++) {
340 for (
i = qsize - 1;
i < qsize;
i--) {
442 if (dsa->
p == NULL || dsa->
q == NULL || dsa->
g == NULL) {
446 if (out_counter != NULL) {
472 if (
ret->p == NULL ||
ret->q == NULL ||
ret->g == NULL) {
482 BIGNUM *pub_key = NULL, *priv_key = NULL;
490 if (priv_key == NULL) {
492 if (priv_key == NULL) {
502 if (pub_key == NULL) {
504 if (pub_key == NULL) {
564 if (
r == NULL || s == NULL) {
583 int ok =
tmp != NULL &&
595 BIGNUM *kinv = NULL, *
r = NULL, *s = NULL;
624 if (
BN_bin2bn(digest, digest_len, &
m) == NULL) {
684 size_t digest_len,
DSA_SIG *sig,
const DSA *dsa) {
719 if (digest_len > (q_bits >> 3)) {
723 digest_len = (q_bits >> 3);
726 if (
BN_bin2bn(digest, digest_len, &u1) == NULL) {
759 *out_valid =
BN_ucmp(&u1, sig->
r) == 0;
775 uint8_t *out_sig,
unsigned int *out_siglen,
const DSA *dsa) {
790 const uint8_t *sig,
size_t sig_len,
const DSA *dsa) {
799 size_t digest_len,
const uint8_t *sig,
size_t sig_len,
811 if (
d2i_DSA_SIG(&s, &sigp, sig_len) == NULL || sigp != sig + sig_len) {
817 if (der_len < 0 || (
size_t)der_len != sig_len ||
848 size_t integer_len = 1 +
der_len_len(order_len + 1) + 1 + order_len;
849 if (integer_len < order_len) {
853 size_t value_len = 2 * integer_len;
854 if (value_len < integer_len) {
859 if (
ret < value_len) {
867 if (!dsa->
p || !dsa->
q || !dsa->
g) {
877 if (
r == NULL || kinv == NULL ||
948 if (dsa->
q != NULL) {
954 if ((dsa->
p != NULL && (
ret->p =
BN_dup(dsa->
p)) == NULL) ||
955 (dsa->
g != NULL && (
ret->g =
BN_dup(dsa->
g)) == NULL) ||
int DSA_verify(int type, const uint8_t *digest, size_t digest_len, const uint8_t *sig, size_t sig_len, const DSA *dsa)
#define CRYPTO_EX_DATA_CLASS_INIT
static int OPENSSL_memcmp(const void *s1, const void *s2, size_t n)
int DSA_set_ex_data(DSA *dsa, int idx, void *arg)
DH * DSA_dup_DH(const DSA *dsa)
CRYPTO_refcount_t references
int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, const CRYPTO_EX_DATA *from, void **from_d, int index, long argl, void *argp)
const BIGNUM * DSA_get0_p(const DSA *dsa)
#define OPENSSL_PUT_ERROR(library, reason)
#define bn_mod_inverse_prime
static const uint8_t seed[20]
int DSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_unused *unused, CRYPTO_EX_dup *dup_unused, CRYPTO_EX_free *free_func)
const BIGNUM * DSA_get0_g(const DSA *dsa)
#define BN_mod(rem, numerator, divisor, ctx)
int DSA_check_signature(int *out_valid, const uint8_t *digest, size_t digest_len, const uint8_t *sig, size_t sig_len, const DSA *dsa)
#define BN_GENCB_GENERATED
int DSA_do_verify(const uint8_t *digest, size_t digest_len, DSA_SIG *sig, const DSA *dsa)
void DSA_get0_pqg(const DSA *dsa, const BIGNUM **out_p, const BIGNUM **out_q, const BIGNUM **out_g)
CRYPTO_MUTEX method_mont_lock
#define CRYPTO_MUTEX_init
const OPENSSL_EXPORT EVP_MD * EVP_sha256(void)
DSA * DSAparams_dup(const DSA *dsa)
static void * OPENSSL_memset(void *dst, int c, size_t n)
const OPENSSL_EXPORT BIGNUM * BN_value_one(void)
#define dsa_check_parameters
#define CRYPTO_free_ex_data
int DSA_set0_key(DSA *dsa, BIGNUM *pub_key, BIGNUM *priv_key)
int DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s)
int DSA_do_check_signature(int *out_valid, const uint8_t *digest, size_t digest_len, DSA_SIG *sig, const DSA *dsa)
static void * OPENSSL_memcpy(void *dst, const void *src, size_t n)
OPENSSL_EXPORT ASN1_BIT_STRING * bits
#define CRYPTO_new_ex_data
DSA_SIG * DSA_SIG_new(void)
static size_t der_len_len(size_t len)
const BIGNUM * DSA_get0_priv_key(const DSA *dsa)
const BIGNUM * DSA_get0_q(const DSA *dsa)
BN_MONT_CTX * method_mont_q
void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad, int index, long argl, void *argp)
int DSA_generate_key(DSA *dsa)
#define BN_MONT_CTX_set_locked
#define BN_MONT_CTX_new_for_modulus
static CRYPTO_EX_DATA_CLASS g_ex_data_class
#define CRYPTO_get_ex_data
static int dsa_sign_setup(const DSA *dsa, BN_CTX *ctx_in, BIGNUM **out_kinv, BIGNUM **out_r)
#define CRYPTO_MUTEX_cleanup
#define CRYPTO_get_ex_new_index
DSA_SIG * DSA_do_sign(const uint8_t *digest, size_t digest_len, const DSA *dsa)
UniquePtr< SSL_SESSION > ret
void DSA_get0_key(const DSA *dsa, const BIGNUM **out_pub_key, const BIGNUM **out_priv_key)
BN_MONT_CTX * method_mont_p
#define SHA256_DIGEST_LENGTH
const BIGNUM * DSA_get0_pub_key(const DSA *dsa)
#define BN_mod_exp_mont_consttime
#define BN_is_prime_fasttest_ex
const OPENSSL_EXPORT EVP_MD * EVP_sha1(void)
int DSA_sign(int type, const uint8_t *digest, size_t digest_len, uint8_t *out_sig, unsigned int *out_siglen, const DSA *dsa)
#define CRYPTO_refcount_inc
int DSA_set0_pqg(DSA *dsa, BIGNUM *p, BIGNUM *q, BIGNUM *g)
#define bn_mod_add_consttime
void DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **out_r, const BIGNUM **out_s)
#define CRYPTO_set_ex_data
#define BN_mod_mul_montgomery
int DSA_generate_parameters_ex(DSA *dsa, unsigned bits, const uint8_t *seed_in, size_t seed_len, int *out_counter, unsigned long *out_h, BN_GENCB *cb)
#define DSA_R_MISSING_PARAMETERS
static int mod_mul_consttime(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BN_MONT_CTX *mont, BN_CTX *ctx)
OPENSSL_EXPORT pem_password_cb * cb
void * DSA_get_ex_data(const DSA *dsa, int idx)
#define ERR_R_MALLOC_FAILURE
#define bn_reduce_once_in_place
void DSA_SIG_free(DSA_SIG *sig)
int DSA_size(const DSA *dsa)
#define CRYPTO_refcount_dec_and_test_zero
grpc
Author(s):
autogenerated on Thu Mar 13 2025 02:59:13