1*b077aed3SPierre Pronchery /* 2*b077aed3SPierre Pronchery * Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved. 3*b077aed3SPierre Pronchery * 4*b077aed3SPierre Pronchery * Licensed under the Apache License 2.0 (the "License"). You may not use 5*b077aed3SPierre Pronchery * this file except in compliance with the License. You can obtain a copy 6*b077aed3SPierre Pronchery * in the file LICENSE in the source distribution or at 7*b077aed3SPierre Pronchery * https://www.openssl.org/source/license.html 8*b077aed3SPierre Pronchery */ 9*b077aed3SPierre Pronchery 10*b077aed3SPierre Pronchery #ifndef OSSL_CRYPTO_DSA_H 11*b077aed3SPierre Pronchery # define OSSL_CRYPTO_DSA_H 12*b077aed3SPierre Pronchery # pragma once 13*b077aed3SPierre Pronchery 14*b077aed3SPierre Pronchery # include <openssl/core.h> 15*b077aed3SPierre Pronchery # include <openssl/dsa.h> 16*b077aed3SPierre Pronchery # include "internal/ffc.h" 17*b077aed3SPierre Pronchery 18*b077aed3SPierre Pronchery #define DSA_PARAMGEN_TYPE_FIPS_186_4 0 /* Use FIPS186-4 standard */ 19*b077aed3SPierre Pronchery #define DSA_PARAMGEN_TYPE_FIPS_186_2 1 /* Use legacy FIPS186-2 standard */ 20*b077aed3SPierre Pronchery #define DSA_PARAMGEN_TYPE_FIPS_DEFAULT 2 21*b077aed3SPierre Pronchery 22*b077aed3SPierre Pronchery DSA *ossl_dsa_new(OSSL_LIB_CTX *libctx); 23*b077aed3SPierre Pronchery void ossl_dsa_set0_libctx(DSA *d, OSSL_LIB_CTX *libctx); 24*b077aed3SPierre Pronchery 25*b077aed3SPierre Pronchery int ossl_dsa_generate_ffc_parameters(DSA *dsa, int type, int pbits, int qbits, 26*b077aed3SPierre Pronchery BN_GENCB *cb); 27*b077aed3SPierre Pronchery 28*b077aed3SPierre Pronchery int ossl_dsa_sign_int(int type, const unsigned char *dgst, int dlen, 29*b077aed3SPierre Pronchery unsigned char *sig, unsigned int *siglen, DSA *dsa); 30*b077aed3SPierre Pronchery 31*b077aed3SPierre Pronchery FFC_PARAMS *ossl_dsa_get0_params(DSA *dsa); 32*b077aed3SPierre Pronchery int ossl_dsa_ffc_params_fromdata(DSA *dsa, const OSSL_PARAM params[]); 33*b077aed3SPierre Pronchery int ossl_dsa_key_fromdata(DSA *dsa, const OSSL_PARAM params[], 34*b077aed3SPierre Pronchery int include_private); 35*b077aed3SPierre Pronchery DSA *ossl_dsa_key_from_pkcs8(const PKCS8_PRIV_KEY_INFO *p8inf, 36*b077aed3SPierre Pronchery OSSL_LIB_CTX *libctx, const char *propq); 37*b077aed3SPierre Pronchery 38*b077aed3SPierre Pronchery int ossl_dsa_generate_public_key(BN_CTX *ctx, const DSA *dsa, 39*b077aed3SPierre Pronchery const BIGNUM *priv_key, BIGNUM *pub_key); 40*b077aed3SPierre Pronchery int ossl_dsa_check_params(const DSA *dsa, int checktype, int *ret); 41*b077aed3SPierre Pronchery int ossl_dsa_check_pub_key(const DSA *dsa, const BIGNUM *pub_key, int *ret); 42*b077aed3SPierre Pronchery int ossl_dsa_check_pub_key_partial(const DSA *dsa, const BIGNUM *pub_key, 43*b077aed3SPierre Pronchery int *ret); 44*b077aed3SPierre Pronchery int ossl_dsa_check_priv_key(const DSA *dsa, const BIGNUM *priv_key, int *ret); 45*b077aed3SPierre Pronchery int ossl_dsa_check_pairwise(const DSA *dsa); 46*b077aed3SPierre Pronchery int ossl_dsa_is_foreign(const DSA *dsa); 47*b077aed3SPierre Pronchery DSA *ossl_dsa_dup(const DSA *dsa, int selection); 48*b077aed3SPierre Pronchery 49*b077aed3SPierre Pronchery #endif 50