1e5b75505Sopenharmony_ci/*
2e5b75505Sopenharmony_ci * Shared Dragonfly functionality
3e5b75505Sopenharmony_ci * Copyright (c) 2012-2016, Jouni Malinen <j@w1.fi>
4e5b75505Sopenharmony_ci * Copyright (c) 2019, The Linux Foundation
5e5b75505Sopenharmony_ci *
6e5b75505Sopenharmony_ci * This software may be distributed under the terms of the BSD license.
7e5b75505Sopenharmony_ci * See README for more details.
8e5b75505Sopenharmony_ci */
9e5b75505Sopenharmony_ci
10e5b75505Sopenharmony_ci#ifndef DRAGONFLY_H
11e5b75505Sopenharmony_ci#define DRAGONFLY_H
12e5b75505Sopenharmony_ci
13e5b75505Sopenharmony_ci#define DRAGONFLY_MAX_ECC_PRIME_LEN 66
14e5b75505Sopenharmony_ci
15e5b75505Sopenharmony_cistruct crypto_bignum;
16e5b75505Sopenharmony_cistruct crypto_ec;
17e5b75505Sopenharmony_ci
18e5b75505Sopenharmony_ciint dragonfly_suitable_group(int group, int ecc_only);
19e5b75505Sopenharmony_ciunsigned int dragonfly_min_pwe_loop_iter(int group);
20e5b75505Sopenharmony_ciint dragonfly_get_random_qr_qnr(const struct crypto_bignum *prime,
21e5b75505Sopenharmony_ci				struct crypto_bignum **qr,
22e5b75505Sopenharmony_ci				struct crypto_bignum **qnr);
23e5b75505Sopenharmony_ciint dragonfly_is_quadratic_residue_blind(struct crypto_ec *ec,
24e5b75505Sopenharmony_ci					 const u8 *qr, const u8 *qnr,
25e5b75505Sopenharmony_ci					 const struct crypto_bignum *val);
26e5b75505Sopenharmony_ciint dragonfly_generate_scalar(const struct crypto_bignum *order,
27e5b75505Sopenharmony_ci			      struct crypto_bignum *_rand,
28e5b75505Sopenharmony_ci			      struct crypto_bignum *_mask,
29e5b75505Sopenharmony_ci			      struct crypto_bignum *scalar);
30e5b75505Sopenharmony_ciint dragonfly_sqrt(struct crypto_ec *ec, const struct crypto_bignum *val,
31e5b75505Sopenharmony_ci		   struct crypto_bignum *res);
32e5b75505Sopenharmony_ci
33e5b75505Sopenharmony_ci#endif /* DRAGONFLY_H */
34