/* @key: RSA key @num_bits: Storage for the number of public exponent bits  */
static int num_public_exponent_bits(const struct rsa_public_key *key, int *num_bits)
/* @key: RSA key @num_bits: Storage for the number of public exponent bits  */
static int num_public_exponent_bits(const struct rsa_public_key *key, int *num_bits)
{
	uint64_t exponent;
	int exponent_bits;
	const uint max_bits = (sizeof(exponent) * 8);
	exponent = key->exponent;
	exponent_bits = 0;
	if (!exponent) {
		*num_bits = exponent_bits;
		return 0;
	}
	for (exponent_bits = 1; exponent_bits < max_bits + 1; ++exponent_bits)
		if (!(exponent >>= 1)) {
			*num_bits = exponent_bits;
			return 0;
		}
	return -EINVAL;
}