summaryrefslogtreecommitdiffstats
path: root/openpgp-ffi
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-08-05 11:53:22 +0200
committerJustus Winter <justus@sequoia-pgp.org>2020-08-05 13:05:09 +0200
commit7d4090c4c862e6f38f5a17a9ad77484bf219909d (patch)
treef70a89f90b06616557b151bea15b63d7e2e81a7d /openpgp-ffi
parent78e9b6626ba96fa918f53e524720d595a6bb9340 (diff)
openpgp: Don't implement Default for the Bitflags types.
- See #525.
Diffstat (limited to 'openpgp-ffi')
-rw-r--r--openpgp-ffi/src/packet/signature.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/openpgp-ffi/src/packet/signature.rs b/openpgp-ffi/src/packet/signature.rs
index fdab2d4f..b6ee4061 100644
--- a/openpgp-ffi/src/packet/signature.rs
+++ b/openpgp-ffi/src/packet/signature.rs
@@ -11,6 +11,7 @@ use libc::time_t;
use libc::c_uint;
extern crate sequoia_openpgp as openpgp;
+use openpgp::types::KeyFlags;
use super::Packet;
use super::super::fingerprint::Fingerprint;
use super::super::keyid::KeyID;
@@ -71,14 +72,14 @@ fn pgp_signature_issuer_fingerprint(sig: *const Signature)
/// make certifications.
#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C"
fn pgp_signature_for_certification(sig: *const Signature) -> bool {
- sig.ref_raw().key_flags().unwrap_or_default().for_certification()
+ sig.ref_raw().key_flags().unwrap_or_else(KeyFlags::empty).for_certification()
}
/// Returns whether the KeyFlags indicates that the key can be used to
/// make signatures.
#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C"
fn pgp_signature_for_signing(sig: *const Signature) -> bool {
- sig.ref_raw().key_flags().unwrap_or_default().for_signing()
+ sig.ref_raw().key_flags().unwrap_or_else(KeyFlags::empty).for_signing()
}
/// Returns whether the KeyFlags indicates that the key can be used to
@@ -86,35 +87,35 @@ fn pgp_signature_for_signing(sig: *const Signature) -> bool {
#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C"
fn pgp_signature_for_transport_encryption(sig: *const Signature)
-> bool {
- sig.ref_raw().key_flags().unwrap_or_default().for_transport_encryption()
+ sig.ref_raw().key_flags().unwrap_or_else(KeyFlags::empty).for_transport_encryption()
}
/// Returns whether the KeyFlags indicates that the key can be used to
/// encrypt data at rest.
#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C"
fn pgp_signature_for_storage_encryption(sig: *const Signature) -> bool {
- sig.ref_raw().key_flags().unwrap_or_default().for_storage_encryption()
+ sig.ref_raw().key_flags().unwrap_or_else(KeyFlags::empty).for_storage_encryption()
}
/// Returns whether the KeyFlags indicates that the key can be used
/// for authentication.
#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C"
fn pgp_signature_for_authentication(sig: *const Signature) -> bool {
- sig.ref_raw().key_flags().unwrap_or_default().for_authentication()
+ sig.ref_raw().key_flags().unwrap_or_else(KeyFlags::empty).for_authentication()
}
/// Returns whether the KeyFlags indicates that the key is a split
/// key.
#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C"
fn pgp_signature_is_split_key(sig: *const Signature) -> bool {
- sig.ref_raw().key_flags().unwrap_or_default().is_split_key()
+ sig.ref_raw().key_flags().unwrap_or_else(KeyFlags::empty).is_split_key()
}
/// Returns whether the KeyFlags indicates that the key is a group
/// key.
#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C"
fn pgp_signature_is_group_key(sig: *const Signature) -> bool {
- sig.ref_raw().key_flags().unwrap_or_default().is_group_key()
+ sig.ref_raw().key_flags().unwrap_or_else(KeyFlags::empty).is_group_key()
}