]>
git.ipfire.org Git - thirdparty/openssl.git/blob - include/internal/ffc.h
2 * Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
10 #ifndef OSSL_INTERNAL_FFC_H
11 # define OSSL_INTERNAL_FFC_H
13 # include <openssl/bn.h>
16 * Finite field cryptography (FFC) domain parameters are used by DH and DSA.
17 * Refer to FIPS186_4 Appendix A & B.
19 typedef struct ffc_params_st
{
25 /* DH X9.42 Optional Subgroup factor j >= 2 where p = j * q + 1 */
28 /* Required for FIPS186_4 validation of p, q and optionally canonical g */
30 /* If this value is zero the hash size is used as the seed length */
32 /* Required for FIPS186_4 validation of p and q */
34 int nid
; /* The identity of a named group */
38 void ffc_params_init(FFC_PARAMS
*params
);
39 void ffc_params_cleanup(FFC_PARAMS
*params
);
40 void ffc_params_set0_pqg(FFC_PARAMS
*params
, BIGNUM
*p
, BIGNUM
*q
, BIGNUM
*g
);
41 void ffc_params_get0_pqg(const FFC_PARAMS
*params
, const BIGNUM
**p
,
42 const BIGNUM
**q
, const BIGNUM
**g
);
43 void ffc_params_set0_j(FFC_PARAMS
*d
, BIGNUM
*j
);
44 int ffc_params_set_validate_params(FFC_PARAMS
*params
,
45 const unsigned char *seed
, size_t seedlen
,
47 void ffc_params_get_validate_params(const FFC_PARAMS
*params
,
48 unsigned char **seed
, size_t *seedlen
,
51 int ffc_params_copy(FFC_PARAMS
*dst
, const FFC_PARAMS
*src
);
52 int ffc_params_cmp(const FFC_PARAMS
*a
, const FFC_PARAMS
*b
, int ignore_q
);
55 int ffc_params_print(BIO
*bp
, const FFC_PARAMS
*ffc
, int indent
);
56 #endif /* FIPS_MODE */
58 #endif /* OSSL_INTERNAL_FFC_H */