xref: /freebsd-src/contrib/wpa/src/common/dragonfly.h (revision ec080394e21815b6852dee5cba6155bbba26a3ff)
1206b73d0SCy Schubert /*
2206b73d0SCy Schubert  * Shared Dragonfly functionality
3206b73d0SCy Schubert  * Copyright (c) 2012-2016, Jouni Malinen <j@w1.fi>
4206b73d0SCy Schubert  * Copyright (c) 2019, The Linux Foundation
5206b73d0SCy Schubert  *
6206b73d0SCy Schubert  * This software may be distributed under the terms of the BSD license.
7206b73d0SCy Schubert  * See README for more details.
8206b73d0SCy Schubert  */
9206b73d0SCy Schubert 
10206b73d0SCy Schubert #ifndef DRAGONFLY_H
11206b73d0SCy Schubert #define DRAGONFLY_H
12206b73d0SCy Schubert 
13206b73d0SCy Schubert #define DRAGONFLY_MAX_ECC_PRIME_LEN 66
14206b73d0SCy Schubert 
15206b73d0SCy Schubert struct crypto_bignum;
16206b73d0SCy Schubert struct crypto_ec;
17206b73d0SCy Schubert 
18206b73d0SCy Schubert int dragonfly_suitable_group(int group, int ecc_only);
19206b73d0SCy Schubert unsigned int dragonfly_min_pwe_loop_iter(int group);
20206b73d0SCy Schubert int dragonfly_get_random_qr_qnr(const struct crypto_bignum *prime,
21206b73d0SCy Schubert 				struct crypto_bignum **qr,
22206b73d0SCy Schubert 				struct crypto_bignum **qnr);
23206b73d0SCy Schubert int dragonfly_is_quadratic_residue_blind(struct crypto_ec *ec,
24206b73d0SCy Schubert 					 const u8 *qr, const u8 *qnr,
25206b73d0SCy Schubert 					 const struct crypto_bignum *val);
26206b73d0SCy Schubert int dragonfly_generate_scalar(const struct crypto_bignum *order,
27206b73d0SCy Schubert 			      struct crypto_bignum *_rand,
28206b73d0SCy Schubert 			      struct crypto_bignum *_mask,
29206b73d0SCy Schubert 			      struct crypto_bignum *scalar);
30*ec080394SCy Schubert int dragonfly_sqrt(struct crypto_ec *ec, const struct crypto_bignum *val,
31*ec080394SCy Schubert 		   struct crypto_bignum *res);
32206b73d0SCy Schubert 
33206b73d0SCy Schubert #endif /* DRAGONFLY_H */
34