mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
squash! Add crypto_pk_check_key_public_exponent function
Rename crypto_pk_check_key_public_exponent to crypto_pk_public_exponent_ok: it's nice to name predicates s.t. you can tell how to interpret true and false.
This commit is contained in:
parent
987190c2bc
commit
4a22046c86
@ -660,7 +660,7 @@ crypto_pk_key_is_private(const crypto_pk_env_t *key)
|
|||||||
* equals 65537.
|
* equals 65537.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
crypto_pk_check_key_public_exponent(crypto_pk_env_t *env)
|
crypto_pk_public_exponent_ok(crypto_pk_env_t *env)
|
||||||
{
|
{
|
||||||
tor_assert(env);
|
tor_assert(env);
|
||||||
tor_assert(env->key);
|
tor_assert(env->key);
|
||||||
|
@ -92,7 +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_dup_key(crypto_pk_env_t *orig);
|
||||||
crypto_pk_env_t *crypto_pk_copy_full(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_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_exponent_ok(crypto_pk_env_t *env);
|
||||||
|
|
||||||
int crypto_pk_public_encrypt(crypto_pk_env_t *env, char *to, size_t tolen,
|
int crypto_pk_public_encrypt(crypto_pk_env_t *env, char *to, size_t tolen,
|
||||||
const char *from, size_t fromlen, int padding);
|
const char *from, size_t fromlen, int padding);
|
||||||
|
@ -1326,7 +1326,7 @@ router_parse_entry_from_string(const char *s, const char *end,
|
|||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
tok = find_by_keyword(tokens, K_ONION_KEY);
|
tok = find_by_keyword(tokens, K_ONION_KEY);
|
||||||
if (!crypto_pk_check_key_public_exponent(tok->key)) {
|
if (!crypto_pk_public_exponent_ok(tok->key)) {
|
||||||
log_warn(LD_DIR,
|
log_warn(LD_DIR,
|
||||||
"Relay's onion key had invalid exponent.");
|
"Relay's onion key had invalid exponent.");
|
||||||
goto err;
|
goto err;
|
||||||
@ -3976,7 +3976,7 @@ rend_parse_introduction_points(rend_service_descriptor_t *parsed,
|
|||||||
}
|
}
|
||||||
/* Parse onion key. */
|
/* Parse onion key. */
|
||||||
tok = find_by_keyword(tokens, R_IPO_ONION_KEY);
|
tok = find_by_keyword(tokens, R_IPO_ONION_KEY);
|
||||||
if (!crypto_pk_check_key_public_exponent(tok->key)) {
|
if (!crypto_pk_public_exponent_ok(tok->key)) {
|
||||||
log_warn(LD_REND,
|
log_warn(LD_REND,
|
||||||
"Introduction point's onion key had invalid exponent.");
|
"Introduction point's onion key had invalid exponent.");
|
||||||
rend_intro_point_free(intro);
|
rend_intro_point_free(intro);
|
||||||
@ -3986,7 +3986,7 @@ rend_parse_introduction_points(rend_service_descriptor_t *parsed,
|
|||||||
tok->key = NULL; /* Prevent free */
|
tok->key = NULL; /* Prevent free */
|
||||||
/* Parse service key. */
|
/* Parse service key. */
|
||||||
tok = find_by_keyword(tokens, R_IPO_SERVICE_KEY);
|
tok = find_by_keyword(tokens, R_IPO_SERVICE_KEY);
|
||||||
if (!crypto_pk_check_key_public_exponent(tok->key)) {
|
if (!crypto_pk_public_exponent_ok(tok->key)) {
|
||||||
log_warn(LD_REND,
|
log_warn(LD_REND,
|
||||||
"Introduction point key had invalid exponent.");
|
"Introduction point key had invalid exponent.");
|
||||||
rend_intro_point_free(intro);
|
rend_intro_point_free(intro);
|
||||||
|
Loading…
Reference in New Issue
Block a user