2020-01-24 12:09:33 +08:00
|
|
|
/*
|
2021-02-18 22:57:13 +08:00
|
|
|
* Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
|
2020-01-24 12:09:33 +08:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License 2.0 (the "License"). You may not use
|
|
|
|
* this file except in compliance with the License. You can obtain a copy
|
|
|
|
* in the file LICENSE in the source distribution or at
|
|
|
|
* https://www.openssl.org/source/license.html
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OSSL_INTERNAL_FFC_H
|
|
|
|
# define OSSL_INTERNAL_FFC_H
|
2021-02-07 05:14:03 +08:00
|
|
|
# pragma once
|
2020-01-24 12:09:33 +08:00
|
|
|
|
2020-03-23 12:40:47 +08:00
|
|
|
# include <openssl/core.h>
|
2020-01-24 12:09:33 +08:00
|
|
|
# include <openssl/bn.h>
|
2020-02-06 20:28:36 +08:00
|
|
|
# include <openssl/evp.h>
|
|
|
|
# include <openssl/dh.h> /* Uses Error codes from DH */
|
2020-04-15 19:02:52 +08:00
|
|
|
# include <openssl/params.h>
|
|
|
|
# include <openssl/param_build.h>
|
2020-06-17 09:33:16 +08:00
|
|
|
# include "internal/sizes.h"
|
2020-02-06 20:28:36 +08:00
|
|
|
|
|
|
|
/* Default value for gindex when canonical generation of g is not used */
|
|
|
|
# define FFC_UNVERIFIABLE_GINDEX -1
|
|
|
|
|
|
|
|
/* The different types of FFC keys */
|
|
|
|
# define FFC_PARAM_TYPE_DSA 0
|
|
|
|
# define FFC_PARAM_TYPE_DH 1
|
|
|
|
|
2020-06-17 09:33:16 +08:00
|
|
|
/*
|
|
|
|
* The mode used by functions that share code for both generation and
|
ffc: add _ossl to exported but internal functions
The functions updated are:
ffc_generate_private_key, ffc_named_group_from_uid,
ffc_named_group_to_uid, ffc_params_FIPS186_2_gen_verify,
ffc_params_FIPS186_2_generate, ffc_params_FIPS186_2_validate,
ffc_params_FIPS186_4_gen_verify, ffc_params_FIPS186_4_generate,
ffc_params_FIPS186_4_validate, ffc_params_cleanup, ffc_params_cmp,
ffc_params_copy, ffc_params_enable_flags, ffc_params_flags_from_name,
ffc_params_flags_to_name, ffc_params_fromdata,
ffc_params_get0_pqg, ffc_params_get_validate_params,
ffc_params_init, ffc_params_print, ffc_params_set0_j,
ffc_params_set0_pqg, ffc_params_set_flags, ffc_params_set_gindex,
ffc_params_set_h, ffc_params_set_pcounter, ffc_params_set_seed,
ffc_params_set_validate_params, ffc_params_simple_validate,
ffc_params_todata, ffc_params_validate_unverifiable_g, ffc_set_digest,
ffc_set_group_pqg, ffc_validate_private_key, ffc_validate_public_key
and ffc_validate_public_key_partial.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13041)
2020-09-30 13:07:24 +08:00
|
|
|
* verification. See ossl_ffc_params_FIPS186_4_gen_verify().
|
2020-06-17 09:33:16 +08:00
|
|
|
*/
|
|
|
|
#define FFC_PARAM_MODE_VERIFY 0
|
|
|
|
#define FFC_PARAM_MODE_GENERATE 1
|
|
|
|
|
2020-02-06 20:28:36 +08:00
|
|
|
/* Return codes for generation and validation of FFC parameters */
|
2020-06-17 09:33:16 +08:00
|
|
|
#define FFC_PARAM_RET_STATUS_FAILED 0
|
|
|
|
#define FFC_PARAM_RET_STATUS_SUCCESS 1
|
2020-02-06 20:28:36 +08:00
|
|
|
/* Returned if validating and g is only partially verifiable */
|
2020-06-17 09:33:16 +08:00
|
|
|
#define FFC_PARAM_RET_STATUS_UNVERIFIABLE_G 2
|
2020-02-06 20:28:36 +08:00
|
|
|
|
|
|
|
/* Validation flags */
|
2020-08-11 08:15:28 +08:00
|
|
|
# define FFC_PARAM_FLAG_VALIDATE_PQ 0x01
|
|
|
|
# define FFC_PARAM_FLAG_VALIDATE_G 0x02
|
2021-05-10 08:27:42 +08:00
|
|
|
# define FFC_PARAM_FLAG_VALIDATE_PQG \
|
2020-06-17 09:33:16 +08:00
|
|
|
(FFC_PARAM_FLAG_VALIDATE_PQ | FFC_PARAM_FLAG_VALIDATE_G)
|
2020-08-11 08:15:28 +08:00
|
|
|
#define FFC_PARAM_FLAG_VALIDATE_LEGACY 0x04
|
2020-02-06 20:28:36 +08:00
|
|
|
|
2020-02-06 23:30:24 +08:00
|
|
|
/*
|
|
|
|
* NB: These values must align with the equivalently named macros in
|
|
|
|
* openssl/dh.h. We cannot use those macros here in case DH has been disabled.
|
|
|
|
*/
|
|
|
|
# define FFC_CHECK_P_NOT_PRIME 0x00001
|
|
|
|
# define FFC_CHECK_P_NOT_SAFE_PRIME 0x00002
|
|
|
|
# define FFC_CHECK_UNKNOWN_GENERATOR 0x00004
|
|
|
|
# define FFC_CHECK_NOT_SUITABLE_GENERATOR 0x00008
|
|
|
|
# define FFC_CHECK_Q_NOT_PRIME 0x00010
|
|
|
|
# define FFC_CHECK_INVALID_Q_VALUE 0x00020
|
|
|
|
# define FFC_CHECK_INVALID_J_VALUE 0x00040
|
|
|
|
|
2020-02-06 20:28:36 +08:00
|
|
|
# define FFC_CHECK_BAD_LN_PAIR 0x00080
|
|
|
|
# define FFC_CHECK_INVALID_SEED_SIZE 0x00100
|
|
|
|
# define FFC_CHECK_MISSING_SEED_OR_COUNTER 0x00200
|
|
|
|
# define FFC_CHECK_INVALID_G 0x00400
|
|
|
|
# define FFC_CHECK_INVALID_PQ 0x00800
|
|
|
|
# define FFC_CHECK_INVALID_COUNTER 0x01000
|
|
|
|
# define FFC_CHECK_P_MISMATCH 0x02000
|
|
|
|
# define FFC_CHECK_Q_MISMATCH 0x04000
|
|
|
|
# define FFC_CHECK_G_MISMATCH 0x08000
|
|
|
|
# define FFC_CHECK_COUNTER_MISMATCH 0x10000
|
2020-01-24 12:09:33 +08:00
|
|
|
|
2020-02-16 11:03:46 +08:00
|
|
|
/* Validation Return codes */
|
|
|
|
# define FFC_ERROR_PUBKEY_TOO_SMALL 0x01
|
|
|
|
# define FFC_ERROR_PUBKEY_TOO_LARGE 0x02
|
|
|
|
# define FFC_ERROR_PUBKEY_INVALID 0x04
|
|
|
|
# define FFC_ERROR_NOT_SUITABLE_GENERATOR 0x08
|
|
|
|
# define FFC_ERROR_PRIVKEY_TOO_SMALL 0x10
|
|
|
|
# define FFC_ERROR_PRIVKEY_TOO_LARGE 0x20
|
|
|
|
|
2020-01-24 12:09:33 +08:00
|
|
|
/*
|
|
|
|
* Finite field cryptography (FFC) domain parameters are used by DH and DSA.
|
|
|
|
* Refer to FIPS186_4 Appendix A & B.
|
|
|
|
*/
|
|
|
|
typedef struct ffc_params_st {
|
|
|
|
/* Primes */
|
|
|
|
BIGNUM *p;
|
|
|
|
BIGNUM *q;
|
|
|
|
/* Generator */
|
|
|
|
BIGNUM *g;
|
|
|
|
/* DH X9.42 Optional Subgroup factor j >= 2 where p = j * q + 1 */
|
|
|
|
BIGNUM *j;
|
|
|
|
|
|
|
|
/* Required for FIPS186_4 validation of p, q and optionally canonical g */
|
|
|
|
unsigned char *seed;
|
|
|
|
/* If this value is zero the hash size is used as the seed length */
|
|
|
|
size_t seedlen;
|
|
|
|
/* Required for FIPS186_4 validation of p and q */
|
|
|
|
int pcounter;
|
2020-01-31 06:18:46 +08:00
|
|
|
int nid; /* The identity of a named group */
|
2020-01-24 12:09:33 +08:00
|
|
|
|
2020-02-06 20:28:36 +08:00
|
|
|
/*
|
|
|
|
* Required for FIPS186_4 generation & validation of canonical g.
|
|
|
|
* It uses unverifiable g if this value is -1.
|
|
|
|
*/
|
|
|
|
int gindex;
|
|
|
|
int h; /* loop counter for unverifiable g */
|
2020-06-17 09:33:16 +08:00
|
|
|
|
2021-05-10 08:27:42 +08:00
|
|
|
unsigned int flags;
|
2020-06-17 09:33:16 +08:00
|
|
|
/*
|
|
|
|
* The digest to use for generation or validation. If this value is NULL,
|
|
|
|
* then the digest is chosen using the value of N.
|
|
|
|
*/
|
|
|
|
const char *mdname;
|
|
|
|
const char *mdprops;
|
2020-01-24 12:09:33 +08:00
|
|
|
} FFC_PARAMS;
|
|
|
|
|
ffc: add _ossl to exported but internal functions
The functions updated are:
ffc_generate_private_key, ffc_named_group_from_uid,
ffc_named_group_to_uid, ffc_params_FIPS186_2_gen_verify,
ffc_params_FIPS186_2_generate, ffc_params_FIPS186_2_validate,
ffc_params_FIPS186_4_gen_verify, ffc_params_FIPS186_4_generate,
ffc_params_FIPS186_4_validate, ffc_params_cleanup, ffc_params_cmp,
ffc_params_copy, ffc_params_enable_flags, ffc_params_flags_from_name,
ffc_params_flags_to_name, ffc_params_fromdata,
ffc_params_get0_pqg, ffc_params_get_validate_params,
ffc_params_init, ffc_params_print, ffc_params_set0_j,
ffc_params_set0_pqg, ffc_params_set_flags, ffc_params_set_gindex,
ffc_params_set_h, ffc_params_set_pcounter, ffc_params_set_seed,
ffc_params_set_validate_params, ffc_params_simple_validate,
ffc_params_todata, ffc_params_validate_unverifiable_g, ffc_set_digest,
ffc_set_group_pqg, ffc_validate_private_key, ffc_validate_public_key
and ffc_validate_public_key_partial.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13041)
2020-09-30 13:07:24 +08:00
|
|
|
void ossl_ffc_params_init(FFC_PARAMS *params);
|
|
|
|
void ossl_ffc_params_cleanup(FFC_PARAMS *params);
|
|
|
|
void ossl_ffc_params_set0_pqg(FFC_PARAMS *params, BIGNUM *p, BIGNUM *q,
|
|
|
|
BIGNUM *g);
|
|
|
|
void ossl_ffc_params_get0_pqg(const FFC_PARAMS *params, const BIGNUM **p,
|
|
|
|
const BIGNUM **q, const BIGNUM **g);
|
|
|
|
void ossl_ffc_params_set0_j(FFC_PARAMS *d, BIGNUM *j);
|
|
|
|
int ossl_ffc_params_set_seed(FFC_PARAMS *params,
|
|
|
|
const unsigned char *seed, size_t seedlen);
|
|
|
|
void ossl_ffc_params_set_gindex(FFC_PARAMS *params, int index);
|
|
|
|
void ossl_ffc_params_set_pcounter(FFC_PARAMS *params, int index);
|
|
|
|
void ossl_ffc_params_set_h(FFC_PARAMS *params, int index);
|
|
|
|
void ossl_ffc_params_set_flags(FFC_PARAMS *params, unsigned int flags);
|
|
|
|
void ossl_ffc_params_enable_flags(FFC_PARAMS *params, unsigned int flags,
|
|
|
|
int enable);
|
|
|
|
int ossl_ffc_set_digest(FFC_PARAMS *params, const char *alg, const char *props);
|
|
|
|
|
|
|
|
int ossl_ffc_params_set_validate_params(FFC_PARAMS *params,
|
|
|
|
const unsigned char *seed,
|
|
|
|
size_t seedlen, int counter);
|
|
|
|
void ossl_ffc_params_get_validate_params(const FFC_PARAMS *params,
|
|
|
|
unsigned char **seed, size_t *seedlen,
|
|
|
|
int *pcounter);
|
|
|
|
|
|
|
|
int ossl_ffc_params_copy(FFC_PARAMS *dst, const FFC_PARAMS *src);
|
|
|
|
int ossl_ffc_params_cmp(const FFC_PARAMS *a, const FFC_PARAMS *b, int ignore_q);
|
2020-01-24 12:09:33 +08:00
|
|
|
|
2020-04-14 04:34:56 +08:00
|
|
|
#ifndef FIPS_MODULE
|
ffc: add _ossl to exported but internal functions
The functions updated are:
ffc_generate_private_key, ffc_named_group_from_uid,
ffc_named_group_to_uid, ffc_params_FIPS186_2_gen_verify,
ffc_params_FIPS186_2_generate, ffc_params_FIPS186_2_validate,
ffc_params_FIPS186_4_gen_verify, ffc_params_FIPS186_4_generate,
ffc_params_FIPS186_4_validate, ffc_params_cleanup, ffc_params_cmp,
ffc_params_copy, ffc_params_enable_flags, ffc_params_flags_from_name,
ffc_params_flags_to_name, ffc_params_fromdata,
ffc_params_get0_pqg, ffc_params_get_validate_params,
ffc_params_init, ffc_params_print, ffc_params_set0_j,
ffc_params_set0_pqg, ffc_params_set_flags, ffc_params_set_gindex,
ffc_params_set_h, ffc_params_set_pcounter, ffc_params_set_seed,
ffc_params_set_validate_params, ffc_params_simple_validate,
ffc_params_todata, ffc_params_validate_unverifiable_g, ffc_set_digest,
ffc_set_group_pqg, ffc_validate_private_key, ffc_validate_public_key
and ffc_validate_public_key_partial.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13041)
2020-09-30 13:07:24 +08:00
|
|
|
int ossl_ffc_params_print(BIO *bp, const FFC_PARAMS *ffc, int indent);
|
2020-04-14 04:34:56 +08:00
|
|
|
#endif /* FIPS_MODULE */
|
2020-01-24 12:09:33 +08:00
|
|
|
|
2020-02-06 20:28:36 +08:00
|
|
|
|
2020-10-15 17:55:50 +08:00
|
|
|
int ossl_ffc_params_FIPS186_4_generate(OSSL_LIB_CTX *libctx, FFC_PARAMS *params,
|
ffc: add _ossl to exported but internal functions
The functions updated are:
ffc_generate_private_key, ffc_named_group_from_uid,
ffc_named_group_to_uid, ffc_params_FIPS186_2_gen_verify,
ffc_params_FIPS186_2_generate, ffc_params_FIPS186_2_validate,
ffc_params_FIPS186_4_gen_verify, ffc_params_FIPS186_4_generate,
ffc_params_FIPS186_4_validate, ffc_params_cleanup, ffc_params_cmp,
ffc_params_copy, ffc_params_enable_flags, ffc_params_flags_from_name,
ffc_params_flags_to_name, ffc_params_fromdata,
ffc_params_get0_pqg, ffc_params_get_validate_params,
ffc_params_init, ffc_params_print, ffc_params_set0_j,
ffc_params_set0_pqg, ffc_params_set_flags, ffc_params_set_gindex,
ffc_params_set_h, ffc_params_set_pcounter, ffc_params_set_seed,
ffc_params_set_validate_params, ffc_params_simple_validate,
ffc_params_todata, ffc_params_validate_unverifiable_g, ffc_set_digest,
ffc_set_group_pqg, ffc_validate_private_key, ffc_validate_public_key
and ffc_validate_public_key_partial.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13041)
2020-09-30 13:07:24 +08:00
|
|
|
int type, size_t L, size_t N,
|
|
|
|
int *res, BN_GENCB *cb);
|
2020-10-15 17:55:50 +08:00
|
|
|
int ossl_ffc_params_FIPS186_2_generate(OSSL_LIB_CTX *libctx, FFC_PARAMS *params,
|
ffc: add _ossl to exported but internal functions
The functions updated are:
ffc_generate_private_key, ffc_named_group_from_uid,
ffc_named_group_to_uid, ffc_params_FIPS186_2_gen_verify,
ffc_params_FIPS186_2_generate, ffc_params_FIPS186_2_validate,
ffc_params_FIPS186_4_gen_verify, ffc_params_FIPS186_4_generate,
ffc_params_FIPS186_4_validate, ffc_params_cleanup, ffc_params_cmp,
ffc_params_copy, ffc_params_enable_flags, ffc_params_flags_from_name,
ffc_params_flags_to_name, ffc_params_fromdata,
ffc_params_get0_pqg, ffc_params_get_validate_params,
ffc_params_init, ffc_params_print, ffc_params_set0_j,
ffc_params_set0_pqg, ffc_params_set_flags, ffc_params_set_gindex,
ffc_params_set_h, ffc_params_set_pcounter, ffc_params_set_seed,
ffc_params_set_validate_params, ffc_params_simple_validate,
ffc_params_todata, ffc_params_validate_unverifiable_g, ffc_set_digest,
ffc_set_group_pqg, ffc_validate_private_key, ffc_validate_public_key
and ffc_validate_public_key_partial.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13041)
2020-09-30 13:07:24 +08:00
|
|
|
int type, size_t L, size_t N,
|
|
|
|
int *res, BN_GENCB *cb);
|
|
|
|
|
2020-10-15 17:55:50 +08:00
|
|
|
int ossl_ffc_params_FIPS186_4_gen_verify(OSSL_LIB_CTX *libctx,
|
ffc: add _ossl to exported but internal functions
The functions updated are:
ffc_generate_private_key, ffc_named_group_from_uid,
ffc_named_group_to_uid, ffc_params_FIPS186_2_gen_verify,
ffc_params_FIPS186_2_generate, ffc_params_FIPS186_2_validate,
ffc_params_FIPS186_4_gen_verify, ffc_params_FIPS186_4_generate,
ffc_params_FIPS186_4_validate, ffc_params_cleanup, ffc_params_cmp,
ffc_params_copy, ffc_params_enable_flags, ffc_params_flags_from_name,
ffc_params_flags_to_name, ffc_params_fromdata,
ffc_params_get0_pqg, ffc_params_get_validate_params,
ffc_params_init, ffc_params_print, ffc_params_set0_j,
ffc_params_set0_pqg, ffc_params_set_flags, ffc_params_set_gindex,
ffc_params_set_h, ffc_params_set_pcounter, ffc_params_set_seed,
ffc_params_set_validate_params, ffc_params_simple_validate,
ffc_params_todata, ffc_params_validate_unverifiable_g, ffc_set_digest,
ffc_set_group_pqg, ffc_validate_private_key, ffc_validate_public_key
and ffc_validate_public_key_partial.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13041)
2020-09-30 13:07:24 +08:00
|
|
|
FFC_PARAMS *params, int mode, int type,
|
|
|
|
size_t L, size_t N, int *res,
|
|
|
|
BN_GENCB *cb);
|
2020-10-15 17:55:50 +08:00
|
|
|
int ossl_ffc_params_FIPS186_2_gen_verify(OSSL_LIB_CTX *libctx,
|
ffc: add _ossl to exported but internal functions
The functions updated are:
ffc_generate_private_key, ffc_named_group_from_uid,
ffc_named_group_to_uid, ffc_params_FIPS186_2_gen_verify,
ffc_params_FIPS186_2_generate, ffc_params_FIPS186_2_validate,
ffc_params_FIPS186_4_gen_verify, ffc_params_FIPS186_4_generate,
ffc_params_FIPS186_4_validate, ffc_params_cleanup, ffc_params_cmp,
ffc_params_copy, ffc_params_enable_flags, ffc_params_flags_from_name,
ffc_params_flags_to_name, ffc_params_fromdata,
ffc_params_get0_pqg, ffc_params_get_validate_params,
ffc_params_init, ffc_params_print, ffc_params_set0_j,
ffc_params_set0_pqg, ffc_params_set_flags, ffc_params_set_gindex,
ffc_params_set_h, ffc_params_set_pcounter, ffc_params_set_seed,
ffc_params_set_validate_params, ffc_params_simple_validate,
ffc_params_todata, ffc_params_validate_unverifiable_g, ffc_set_digest,
ffc_set_group_pqg, ffc_validate_private_key, ffc_validate_public_key
and ffc_validate_public_key_partial.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13041)
2020-09-30 13:07:24 +08:00
|
|
|
FFC_PARAMS *params, int mode, int type,
|
|
|
|
size_t L, size_t N, int *res,
|
|
|
|
BN_GENCB *cb);
|
|
|
|
|
2021-02-11 01:44:00 +08:00
|
|
|
int ossl_ffc_params_simple_validate(OSSL_LIB_CTX *libctx,
|
|
|
|
const FFC_PARAMS *params,
|
|
|
|
int paramstype, int *res);
|
|
|
|
int ossl_ffc_params_full_validate(OSSL_LIB_CTX *libctx,
|
|
|
|
const FFC_PARAMS *params,
|
|
|
|
int paramstype, int *res);
|
2020-10-15 17:55:50 +08:00
|
|
|
int ossl_ffc_params_FIPS186_4_validate(OSSL_LIB_CTX *libctx,
|
ffc: add _ossl to exported but internal functions
The functions updated are:
ffc_generate_private_key, ffc_named_group_from_uid,
ffc_named_group_to_uid, ffc_params_FIPS186_2_gen_verify,
ffc_params_FIPS186_2_generate, ffc_params_FIPS186_2_validate,
ffc_params_FIPS186_4_gen_verify, ffc_params_FIPS186_4_generate,
ffc_params_FIPS186_4_validate, ffc_params_cleanup, ffc_params_cmp,
ffc_params_copy, ffc_params_enable_flags, ffc_params_flags_from_name,
ffc_params_flags_to_name, ffc_params_fromdata,
ffc_params_get0_pqg, ffc_params_get_validate_params,
ffc_params_init, ffc_params_print, ffc_params_set0_j,
ffc_params_set0_pqg, ffc_params_set_flags, ffc_params_set_gindex,
ffc_params_set_h, ffc_params_set_pcounter, ffc_params_set_seed,
ffc_params_set_validate_params, ffc_params_simple_validate,
ffc_params_todata, ffc_params_validate_unverifiable_g, ffc_set_digest,
ffc_set_group_pqg, ffc_validate_private_key, ffc_validate_public_key
and ffc_validate_public_key_partial.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13041)
2020-09-30 13:07:24 +08:00
|
|
|
const FFC_PARAMS *params,
|
|
|
|
int type, int *res, BN_GENCB *cb);
|
2020-10-15 17:55:50 +08:00
|
|
|
int ossl_ffc_params_FIPS186_2_validate(OSSL_LIB_CTX *libctx,
|
ffc: add _ossl to exported but internal functions
The functions updated are:
ffc_generate_private_key, ffc_named_group_from_uid,
ffc_named_group_to_uid, ffc_params_FIPS186_2_gen_verify,
ffc_params_FIPS186_2_generate, ffc_params_FIPS186_2_validate,
ffc_params_FIPS186_4_gen_verify, ffc_params_FIPS186_4_generate,
ffc_params_FIPS186_4_validate, ffc_params_cleanup, ffc_params_cmp,
ffc_params_copy, ffc_params_enable_flags, ffc_params_flags_from_name,
ffc_params_flags_to_name, ffc_params_fromdata,
ffc_params_get0_pqg, ffc_params_get_validate_params,
ffc_params_init, ffc_params_print, ffc_params_set0_j,
ffc_params_set0_pqg, ffc_params_set_flags, ffc_params_set_gindex,
ffc_params_set_h, ffc_params_set_pcounter, ffc_params_set_seed,
ffc_params_set_validate_params, ffc_params_simple_validate,
ffc_params_todata, ffc_params_validate_unverifiable_g, ffc_set_digest,
ffc_set_group_pqg, ffc_validate_private_key, ffc_validate_public_key
and ffc_validate_public_key_partial.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13041)
2020-09-30 13:07:24 +08:00
|
|
|
const FFC_PARAMS *params,
|
|
|
|
int type, int *res, BN_GENCB *cb);
|
|
|
|
|
|
|
|
int ossl_ffc_generate_private_key(BN_CTX *ctx, const FFC_PARAMS *params,
|
|
|
|
int N, int s, BIGNUM *priv);
|
|
|
|
|
|
|
|
int ossl_ffc_params_validate_unverifiable_g(BN_CTX *ctx, BN_MONT_CTX *mont,
|
|
|
|
const BIGNUM *p, const BIGNUM *q,
|
|
|
|
const BIGNUM *g, BIGNUM *tmp,
|
|
|
|
int *ret);
|
|
|
|
|
|
|
|
int ossl_ffc_validate_public_key(const FFC_PARAMS *params,
|
|
|
|
const BIGNUM *pub_key, int *ret);
|
|
|
|
int ossl_ffc_validate_public_key_partial(const FFC_PARAMS *params,
|
|
|
|
const BIGNUM *pub_key, int *ret);
|
|
|
|
int ossl_ffc_validate_private_key(const BIGNUM *upper, const BIGNUM *priv_key,
|
|
|
|
int *ret);
|
|
|
|
|
|
|
|
int ossl_ffc_params_todata(const FFC_PARAMS *ffc, OSSL_PARAM_BLD *tmpl,
|
|
|
|
OSSL_PARAM params[]);
|
|
|
|
int ossl_ffc_params_fromdata(FFC_PARAMS *ffc, const OSSL_PARAM params[]);
|
2020-12-02 02:11:59 +08:00
|
|
|
|
|
|
|
typedef struct dh_named_group_st DH_NAMED_GROUP;
|
|
|
|
const DH_NAMED_GROUP *ossl_ffc_name_to_dh_named_group(const char *name);
|
|
|
|
const DH_NAMED_GROUP *ossl_ffc_uid_to_dh_named_group(int uid);
|
|
|
|
#ifndef OPENSSL_NO_DH
|
|
|
|
const DH_NAMED_GROUP *ossl_ffc_numbers_to_dh_named_group(const BIGNUM *p,
|
|
|
|
const BIGNUM *q,
|
|
|
|
const BIGNUM *g);
|
|
|
|
#endif
|
|
|
|
int ossl_ffc_named_group_get_uid(const DH_NAMED_GROUP *group);
|
|
|
|
const char *ossl_ffc_named_group_get_name(const DH_NAMED_GROUP *);
|
|
|
|
#ifndef OPENSSL_NO_DH
|
|
|
|
const BIGNUM *ossl_ffc_named_group_get_q(const DH_NAMED_GROUP *group);
|
|
|
|
int ossl_ffc_named_group_set_pqg(FFC_PARAMS *ffc, const DH_NAMED_GROUP *group);
|
|
|
|
#endif
|
|
|
|
|
2020-01-24 12:09:33 +08:00
|
|
|
#endif /* OSSL_INTERNAL_FFC_H */
|