mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-24 14:51:11 +01:00
Add crypto_pk_check_key_public_exponent function
This commit is contained in:
parent
7571e9f1cb
commit
d2629f78a0
2 changed files with 13 additions and 0 deletions
|
@ -656,6 +656,18 @@ crypto_pk_key_is_private(const crypto_pk_env_t *key)
|
|||
return PRIVATE_KEY_OK(key);
|
||||
}
|
||||
|
||||
/** Return true iff <b>env</b> contains a public key whose public exponent
|
||||
* equals 65537.
|
||||
*/
|
||||
int
|
||||
crypto_pk_check_key_public_exponent(crypto_pk_env_t *env)
|
||||
{
|
||||
tor_assert(env);
|
||||
tor_assert(env->key);
|
||||
|
||||
return BN_is_word(env->key->e, 65537);
|
||||
}
|
||||
|
||||
/** Compare the public-key components of a and b. Return -1 if a\<b, 0
|
||||
* if a==b, and 1 if a\>b.
|
||||
*/
|
||||
|
|
|
@ -92,6 +92,7 @@ size_t crypto_pk_keysize(crypto_pk_env_t *env);
|
|||
crypto_pk_env_t *crypto_pk_dup_key(crypto_pk_env_t *orig);
|
||||
crypto_pk_env_t *crypto_pk_copy_full(crypto_pk_env_t *orig);
|
||||
int crypto_pk_key_is_private(const crypto_pk_env_t *key);
|
||||
int crypto_pk_check_key_public_exponent(crypto_pk_env_t *env);
|
||||
|
||||
int crypto_pk_public_encrypt(crypto_pk_env_t *env, char *to, size_t tolen,
|
||||
const char *from, size_t fromlen, int padding);
|
||||
|
|
Loading…
Add table
Reference in a new issue