summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-06-28 13:58:26 +0200
committerJustus Winter <justus@sequoia-pgp.org>2019-06-28 13:58:26 +0200
commitf214d55b7061e9d6006f915ee8fbedf29ddf6078 (patch)
tree391a258bd72d51a77391b232a0cc8243d31681c5
parent0e026f8ac794a70012d36e662a0b54ad0888d890 (diff)
openpgp-ffi: Use PublicKey::bits().
- See #154.
-rw-r--r--openpgp-ffi/src/packet/key.rs13
1 files changed, 1 insertions, 12 deletions
diff --git a/openpgp-ffi/src/packet/key.rs b/openpgp-ffi/src/packet/key.rs
index c6d371b9..6e14971a 100644
--- a/openpgp-ffi/src/packet/key.rs
+++ b/openpgp-ffi/src/packet/key.rs
@@ -61,18 +61,7 @@ fn pgp_key_public_key_algo(key: *const Key) -> c_int {
/// Returns the public key's size in bits.
#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C"
fn pgp_key_public_key_bits(key: *const Key) -> c_int {
- use self::openpgp::crypto::mpis::PublicKey::*;
-
- let key = key.ref_raw();
- match key.mpis() {
- RSA { e: _, n } => n.bits as c_int,
- DSA { p: _, q: _, g: _, y } => y.bits as c_int,
- Elgamal { p: _, g: _, y } => y.bits as c_int,
- EdDSA { curve: _, q } => q.bits as c_int,
- ECDSA { curve: _, q } => q.bits as c_int,
- ECDH { curve: _, q, hash: _, sym: _ } => q.bits as c_int,
- Unknown { mpis: _, rest: _ } => 0,
- }
+ key.ref_raw().mpis().bits().unwrap_or(0) as c_int
}
/// Creates a new key pair from a Key packet with an unencrypted