2 * Copyright 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 #include <openssl/core_names.h>
11 #include "internal/ffc.h"
14 * The intention with the "backend" source file is to offer backend support
15 * for legacy backends (EVP_PKEY_ASN1_METHOD and EVP_PKEY_METHOD) and provider
16 * implementations alike.
19 int ffc_fromdata(FFC_PARAMS *ffc, const OSSL_PARAM params[])
21 const OSSL_PARAM *param_p, *param_q, *param_g;
22 BIGNUM *p = NULL, *q = NULL, *g = NULL;
27 param_p = OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_FFC_P);
28 param_q = OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_FFC_Q);
29 param_g = OSSL_PARAM_locate_const(params, OSSL_PKEY_PARAM_FFC_G);
31 if ((param_p != NULL && !OSSL_PARAM_get_BN(param_p, &p))
32 || (param_q != NULL && !OSSL_PARAM_get_BN(param_q, &q))
33 || (param_g != NULL && !OSSL_PARAM_get_BN(param_g, &g)))
36 ffc_params_set0_pqg(ffc, p, q, g);