SAE: Use more generic random bignum generation
Move the bignum comparison part into the bignum library to allow a single implementation of rand generation for both ECC and FCC based groups. Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
629c56d70a
commit
b1677c393b
3 changed files with 45 additions and 27 deletions
|
@ -589,6 +589,22 @@ int crypto_bignum_mulmod(const struct crypto_bignum *a,
|
|||
const struct crypto_bignum *c,
|
||||
struct crypto_bignum *d);
|
||||
|
||||
/**
|
||||
* crypto_bignum_cmp - Compare two bignums
|
||||
* @a: Bignum
|
||||
* @b: Bignum
|
||||
* Returns: -1 if a < b, 0 if a == b, or 1 if a > b
|
||||
*/
|
||||
int crypto_bignum_cmp(const struct crypto_bignum *a,
|
||||
const struct crypto_bignum *b);
|
||||
|
||||
/**
|
||||
* crypto_bignum_bits - Get size of a bignum in bits
|
||||
* @a: Bignum
|
||||
* Returns: Number of bits in the bignum
|
||||
*/
|
||||
int crypto_bignum_bits(const struct crypto_bignum *a);
|
||||
|
||||
/**
|
||||
* struct crypto_ec - Elliptic curve context
|
||||
*
|
||||
|
|
|
@ -987,6 +987,19 @@ int crypto_bignum_mulmod(const struct crypto_bignum *a,
|
|||
}
|
||||
|
||||
|
||||
int crypto_bignum_cmp(const struct crypto_bignum *a,
|
||||
const struct crypto_bignum *b)
|
||||
{
|
||||
return BN_cmp((const BIGNUM *) a, (const BIGNUM *) b);
|
||||
}
|
||||
|
||||
|
||||
int crypto_bignum_bits(const struct crypto_bignum *a)
|
||||
{
|
||||
return BN_num_bits((const BIGNUM *) a);
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_ECC
|
||||
|
||||
struct crypto_ec {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue