diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-02-04 13:28:30 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-02-05 17:17:39 +0100 |
commit | 46b7c84f0d8fbb7d8659d70477b26d41ce4d4337 (patch) | |
tree | 3f5b10c99a99ec11c159aeea318b0289747631de /openpgp-ffi | |
parent | 33233a5743ae333679b3f7300fa552fbbc3d5b48 (diff) |
openpgp-ffi: Use a common macro for every exported function.
- This way we can easily introduce new transformations.
Diffstat (limited to 'openpgp-ffi')
-rw-r--r-- | openpgp-ffi/src/armor.rs | 12 | ||||
-rw-r--r-- | openpgp-ffi/src/common.rs | 18 | ||||
-rw-r--r-- | openpgp-ffi/src/crypto.rs | 8 | ||||
-rw-r--r-- | openpgp-ffi/src/error.rs | 2 | ||||
-rw-r--r-- | openpgp-ffi/src/fingerprint.rs | 10 | ||||
-rw-r--r-- | openpgp-ffi/src/io.rs | 22 | ||||
-rw-r--r-- | openpgp-ffi/src/keyid.rs | 6 | ||||
-rw-r--r-- | openpgp-ffi/src/lib.rs | 1 | ||||
-rw-r--r-- | openpgp-ffi/src/packet/key.rs | 22 | ||||
-rw-r--r-- | openpgp-ffi/src/packet/mod.rs | 8 | ||||
-rw-r--r-- | openpgp-ffi/src/packet/pkesk.rs | 4 | ||||
-rw-r--r-- | openpgp-ffi/src/packet/signature.rs | 30 | ||||
-rw-r--r-- | openpgp-ffi/src/packet/skesk.rs | 2 | ||||
-rw-r--r-- | openpgp-ffi/src/packet/user_attribute.rs | 2 | ||||
-rw-r--r-- | openpgp-ffi/src/packet/userid.rs | 2 | ||||
-rw-r--r-- | openpgp-ffi/src/parse.rs | 34 | ||||
-rw-r--r-- | openpgp-ffi/src/serialize.rs | 20 | ||||
-rw-r--r-- | openpgp-ffi/src/tpk.rs | 68 | ||||
-rw-r--r-- | openpgp-ffi/src/tsk.rs | 6 |
19 files changed, 138 insertions, 139 deletions
diff --git a/openpgp-ffi/src/armor.rs b/openpgp-ffi/src/armor.rs index b45cb09a..aef262ad 100644 --- a/openpgp-ffi/src/armor.rs +++ b/openpgp-ffi/src/armor.rs @@ -101,7 +101,7 @@ fn kind_to_int(kind: Option<armor::Kind>) -> c_int { /// pgp_reader_free (armor); /// pgp_reader_free (bytes); /// ``` -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_armor_reader_new(inner: *mut Box<Read>, kind: c_int) -> *mut Box<Read> { @@ -112,7 +112,7 @@ pub extern "system" fn pgp_armor_reader_new(inner: *mut Box<Read>, } /// Creates a `Reader` from a file. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_armor_reader_from_file(errp: Option<&mut *mut ::error::Error>, filename: *const c_char, kind: c_int) @@ -180,7 +180,7 @@ pub extern "system" fn pgp_armor_reader_from_file(errp: Option<&mut *mut ::error /// /// pgp_reader_free (armor); /// ``` -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_armor_reader_from_bytes(b: *const uint8_t, len: size_t, kind: c_int) -> *mut Box<Read> { @@ -204,7 +204,7 @@ pub extern "system" fn pgp_armor_reader_from_bytes(b: *const uint8_t, len: size_ /// See [this] example. /// /// [this]: fn.pgp_armor_reader_new.html -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_armor_reader_kind(reader: *mut Box<Read>) -> c_int { // We need to downcast `reader`. To do that, we need to do a @@ -234,7 +234,7 @@ pub extern "system" fn pgp_armor_reader_kind(reader: *mut Box<Read>) /// See [this] example. /// /// [this]: fn.pgp_armor_reader_new.html -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_armor_reader_headers(errp: Option<&mut *mut ::error::Error>, reader: *mut Box<Read>, len: *mut size_t) @@ -340,7 +340,7 @@ pub extern "system" fn pgp_armor_reader_headers(errp: Option<&mut *mut ::error:: /// return 0; /// } /// ``` -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_armor_writer_new (errp: Option<&mut *mut ::error::Error>, inner: *mut Box<Write>, diff --git a/openpgp-ffi/src/common.rs b/openpgp-ffi/src/common.rs index 9d430a69..ba2ce7d2 100644 --- a/openpgp-ffi/src/common.rs +++ b/openpgp-ffi/src/common.rs @@ -327,7 +327,7 @@ fn revocation_status_to_int(rs: &RevocationStatus) -> c_int { } /// Returns the TPK's revocation status variant. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_revocation_status_variant( rs: *mut RevocationStatus) -> c_int @@ -339,7 +339,7 @@ pub extern "system" fn pgp_revocation_status_variant( } /// Frees a pgp_revocation_status_t. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_revocation_status_free( rs: Option<&mut RevocationStatus>) { @@ -349,7 +349,7 @@ pub extern "system" fn pgp_revocation_status_free( // Secret. /// Creates an pgp_secret_t from a decrypted session key. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub fn pgp_secret_cached<'a>(algo: u8, session_key: *const u8, session_key_len: size_t) @@ -398,7 +398,7 @@ pub struct VerificationResults<'a> { /// This function returns the verification results for a particular /// level. The result is an array of references to /// `VerificationResult`. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub fn pgp_verification_results_at_level<'a>(results: *const VerificationResults<'a>, level: size_t, r: *mut *const &'a VerificationResult, @@ -417,7 +417,7 @@ pub fn pgp_verification_results_at_level<'a>(results: *const VerificationResults } /// Returns the verification result code. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub fn pgp_verification_result_code(result: *const VerificationResult) -> c_int { @@ -430,7 +430,7 @@ pub fn pgp_verification_result_code(result: *const VerificationResult) } /// Returns the verification result code. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub fn pgp_verification_result_signature(result: *const VerificationResult) -> *const self::openpgp::packet::Signature { @@ -445,7 +445,7 @@ pub fn pgp_verification_result_signature(result: *const VerificationResult) } /// Returns the verification result code. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub fn pgp_verification_result_level(result: *const VerificationResult) -> c_int { @@ -622,7 +622,7 @@ fn verify_real<'a>(input: &'a mut Box<'a + Read>, /// treated as opaque containers. /// /// Note: output may be NULL, if the output is not required. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub fn pgp_verify<'a>(errp: Option<&mut *mut ::error::Error>, input: *mut Box<'a + Read>, dsig: Option<&'a mut Box<'a + Read>>, @@ -745,7 +745,7 @@ fn decrypt_real<'a>(input: &'a mut Box<'a + Read>, /// first parameter to each of them. /// /// Note: all of the parameters are required; none may be NULL. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub fn pgp_decrypt<'a>(errp: Option<&mut *mut ::error::Error>, input: *mut Box<'a + Read>, output: *mut Box<'a + Write>, diff --git a/openpgp-ffi/src/crypto.rs b/openpgp-ffi/src/crypto.rs index eebd7f3a..82bb1707 100644 --- a/openpgp-ffi/src/crypto.rs +++ b/openpgp-ffi/src/crypto.rs @@ -11,7 +11,7 @@ use self::sequoia_openpgp::{ }; /// Frees a signer. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_signer_free (s: Option<&mut &'static mut crypto::Signer>) { @@ -19,7 +19,7 @@ pub extern "system" fn pgp_signer_free } /// Creates a new key pair. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_key_pair_new (errp: Option<&mut *mut ::error::Error>, public: *mut Key, secret: *mut crypto::mpis::SecretKey) -> *mut crypto::KeyPair @@ -31,7 +31,7 @@ pub extern "system" fn pgp_key_pair_new } /// Frees a key pair. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_key_pair_free (kp: Option<&mut crypto::KeyPair>) { @@ -42,7 +42,7 @@ pub extern "system" fn pgp_key_pair_free /// /// Note that the returned object merely references the key pair, and /// must not outlive the key pair. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_key_pair_as_signer (kp: *mut crypto::KeyPair) -> *mut &'static mut crypto::Signer diff --git a/openpgp-ffi/src/error.rs b/openpgp-ffi/src/error.rs index ffed2be7..5a8bf4ab 100644 --- a/openpgp-ffi/src/error.rs +++ b/openpgp-ffi/src/error.rs @@ -31,7 +31,7 @@ impl MoveResultIntoRaw<::error::Status> for ::failure::Fallible<()> } /// Returns the error status code. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_error_status(error: *const Error) -> Status { error.ref_raw().into() diff --git a/openpgp-ffi/src/fingerprint.rs b/openpgp-ffi/src/fingerprint.rs index 07dabf2c..b3917236 100644 --- a/openpgp-ffi/src/fingerprint.rs +++ b/openpgp-ffi/src/fingerprint.rs @@ -33,7 +33,7 @@ use Maybe; pub struct Fingerprint(openpgp::Fingerprint); /// Reads a binary fingerprint. -#[::ffi_catch_abort] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_fingerprint_from_bytes(buf: *const uint8_t, len: size_t) -> *mut Fingerprint { @@ -64,7 +64,7 @@ fn pgp_fingerprint_from_bytes(buf: *const uint8_t, /// free (pretty); /// pgp_fingerprint_free (fp); /// ``` -#[::ffi_catch_abort] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_fingerprint_from_hex(hex: *const c_char) -> Maybe<Fingerprint> { let hex = ffi_param_cstr!(hex).to_string_lossy(); @@ -75,7 +75,7 @@ fn pgp_fingerprint_from_hex(hex: *const c_char) /// /// This returns a reference to the internal buffer that is valid as /// long as the fingerprint is. -#[::ffi_catch_abort] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_fingerprint_as_bytes(fp: *const Fingerprint, fp_len: Option<&mut size_t>) -> *const uint8_t { @@ -87,14 +87,14 @@ fn pgp_fingerprint_as_bytes(fp: *const Fingerprint, } /// Converts the fingerprint to a hexadecimal number. -#[::ffi_catch_abort] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_fingerprint_to_hex(fp: *const Fingerprint) -> *mut c_char { ffi_return_string!(fp.ref_raw().to_hex()) } /// Converts the fingerprint to a key ID. -#[::ffi_catch_abort] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_fingerprint_to_keyid(fp: *const Fingerprint) -> *mut KeyID { fp.ref_raw().to_keyid().move_into_raw() diff --git a/openpgp-ffi/src/io.rs b/openpgp-ffi/src/io.rs index 436b6619..e6ca0eda 100644 --- a/openpgp-ffi/src/io.rs +++ b/openpgp-ffi/src/io.rs @@ -10,7 +10,7 @@ use libc::{uint8_t, c_void, c_char, c_int, size_t, ssize_t, realloc}; use std::os::unix::io::FromRawFd; /// Opens a file returning a reader. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_reader_from_file(errp: Option<&mut *mut ::error::Error>, filename: *const c_char) -> *mut Box<Read> { @@ -23,14 +23,14 @@ pub extern "system" fn pgp_reader_from_file(errp: Option<&mut *mut ::error::Erro /// Opens a file descriptor returning a reader. #[cfg(unix)] -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_reader_from_fd(fd: c_int) -> *mut Box<Read> { box_raw!(Box::new(unsafe { File::from_raw_fd(fd) })) } /// Creates a reader from a buffer. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_reader_from_bytes(buf: *const uint8_t, len: size_t) -> *mut Box<Read> { @@ -42,13 +42,13 @@ pub extern "system" fn pgp_reader_from_bytes(buf: *const uint8_t, } /// Frees a reader. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_reader_free(reader: Option<&mut Box<Read>>) { ffi_free!(reader) } /// Reads up to `len` bytes into `buf`. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_reader_read(errp: Option<&mut *mut ::error::Error>, reader: *mut Box<Read>, buf: *mut uint8_t, len: size_t) @@ -67,7 +67,7 @@ pub extern "system" fn pgp_reader_read(errp: Option<&mut *mut ::error::Error>, /// /// The file will be created if it does not exist, or be truncated /// otherwise. If you need more control, use `pgp_writer_from_fd`. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_writer_from_file(errp: Option<&mut *mut ::error::Error>, filename: *const c_char) -> *mut Box<Write> { @@ -80,14 +80,14 @@ pub extern "system" fn pgp_writer_from_file(errp: Option<&mut *mut ::error::Erro /// Opens a file descriptor returning a writer. #[cfg(unix)] -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_writer_from_fd(fd: c_int) -> *mut Box<Write> { box_raw!(Box::new(unsafe { File::from_raw_fd(fd) })) } /// Creates a writer from a buffer. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_writer_from_bytes(buf: *mut uint8_t, len: size_t) -> *mut Box<Write> { @@ -106,7 +106,7 @@ pub extern "system" fn pgp_writer_from_bytes(buf: *mut uint8_t, /// reference a chunk of memory allocated using libc's heap allocator. /// The caller is responsible to `free` it once the writer has been /// destroyed. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_writer_alloc(buf: *mut *mut c_void, len: *mut size_t) -> *mut Box<Write> { @@ -153,13 +153,13 @@ impl Write for WriterAlloc { } /// Frees a writer. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_writer_free(writer: Option<&mut Box<Write>>) { ffi_free!(writer) } /// Writes up to `len` bytes of `buf` into `writer`. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_writer_write(errp: Option<&mut *mut ::error::Error>, writer: *mut Box<Write>, buf: *const uint8_t, len: size_t) diff --git a/openpgp-ffi/src/keyid.rs b/openpgp-ffi/src/keyid.rs index 7236da89..fca6b3b4 100644 --- a/openpgp-ffi/src/keyid.rs +++ b/openpgp-ffi/src/keyid.rs @@ -50,7 +50,7 @@ pub struct KeyID(openpgp::KeyID); /// pgp_keyid_free (mr_b); /// free (mr_b_as_string); /// ``` -#[::ffi_catch_abort] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_keyid_from_bytes(id: *const uint8_t) -> *mut KeyID { assert!(!id.is_null()); let id = unsafe { slice::from_raw_parts(id, 8) }; @@ -75,14 +75,14 @@ fn pgp_keyid_from_bytes(id: *const uint8_t) -> *mut KeyID { /// free (mr_b_as_string); /// pgp_keyid_free (mr_b); /// ``` -#[::ffi_catch_abort] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_keyid_from_hex(id: *const c_char) -> Maybe<KeyID> { let id = ffi_param_cstr!(id).to_string_lossy(); openpgp::KeyID::from_hex(&id).ok().move_into_raw() } /// Converts the KeyID to a hexadecimal number. -#[::ffi_catch_abort] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_keyid_to_hex(id: *const KeyID) -> *mut c_char { ffi_return_string!(id.ref_raw().to_hex()) } diff --git a/openpgp-ffi/src/lib.rs b/openpgp-ffi/src/lib.rs index 54f37eb5..6572b2be 100644 --- a/openpgp-ffi/src/lib.rs +++ b/openpgp-ffi/src/lib.rs @@ -322,7 +322,6 @@ extern crate memsec; extern crate sequoia_ffi_macros; use sequoia_ffi_macros::{ - ffi_catch_abort, ffi_wrapper_type, }; diff --git a/openpgp-ffi/src/packet/key.rs b/openpgp-ffi/src/packet/key.rs index 9bac8089..83785efc 100644 --- a/openpgp-ffi/src/packet/key.rs +++ b/openpgp-ffi/src/packet/key.rs @@ -14,7 +14,7 @@ use self::openpgp::{ }; /// Clones the key. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_key_clone(key: *const packet::Key) -> *mut packet::Key { let key = ffi_param_ref!(key); @@ -23,7 +23,7 @@ pub extern "system" fn pgp_key_clone(key: *const packet::Key) /// Computes and returns the key's fingerprint as per Section 12.2 /// of RFC 4880. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_key_fingerprint(key: *const packet::Key) -> *mut Fingerprint { let key = ffi_param_ref!(key); @@ -32,7 +32,7 @@ pub extern "system" fn pgp_key_fingerprint(key: *const packet::Key) /// Computes and returns the key's key ID as per Section 12.2 of RFC /// 4880. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_key_keyid(key: *const packet::Key) -> *mut KeyID { let key = ffi_param_ref!(key); @@ -45,7 +45,7 @@ pub extern "system" fn pgp_key_keyid(key: *const packet::Key) /// Note: this is with respect to the provided signature, which is not /// checked for validity. That is, we do not check whether the /// signature is a valid self-signature for the given key. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_key_expired(key: *const packet::Key, sig: *const packet::Signature) -> bool @@ -57,7 +57,7 @@ pub extern "system" fn pgp_key_expired(key: *const packet::Key, } /// Like pgp_key_expired, but at a specific time. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_key_expired_at(key: *const packet::Key, sig: *const packet::Signature, when: time_t) @@ -78,7 +78,7 @@ pub extern "system" fn pgp_key_expired_at(key: *const packet::Key, /// Note: this is with respect to the provided signature, which is not /// checked for validity. That is, we do not check whether the /// signature is a valid self-signature for the given key. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_key_alive(key: *const packet::Key, sig: *const packet::Signature) -> bool @@ -90,7 +90,7 @@ pub extern "system" fn pgp_key_alive(key: *const packet::Key, } /// Like pgp_key_alive, but at a specific time. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_key_alive_at(key: *const packet::Key, sig: *const packet::Signature, when: time_t) @@ -103,7 +103,7 @@ pub extern "system" fn pgp_key_alive_at(key: *const packet::Key, } /// Returns the key's creation time. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_key_creation_time(key: *const packet::Key) -> u32 { @@ -114,7 +114,7 @@ pub extern "system" fn pgp_key_creation_time(key: *const packet::Key) } /// Returns the key's public key algorithm. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_key_public_key_algo(key: *const packet::Key) -> c_int { @@ -124,7 +124,7 @@ pub extern "system" fn pgp_key_public_key_algo(key: *const packet::Key) } /// Returns the public key's size in bits. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_key_public_key_bits(key: *const packet::Key) -> c_int { @@ -148,7 +148,7 @@ pub extern "system" fn pgp_key_public_key_bits(key: *const packet::Key) /// # Errors /// /// Fails if the secret key is missing, or encrypted. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_key_into_key_pair(errp: Option<&mut *mut ::error::Error>, key: *mut packet::Key) -> *mut self::openpgp::crypto::KeyPair diff --git a/openpgp-ffi/src/packet/mod.rs b/openpgp-ffi/src/packet/mod.rs index 692487e4..84ee4b89 100644 --- a/openpgp-ffi/src/packet/mod.rs +++ b/openpgp-ffi/src/packet/mod.rs @@ -23,7 +23,7 @@ pub mod user_attribute; pub mod userid; /// Frees the Packet. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_packet_free(p: Option<&mut Packet>) { ffi_free!(p) } @@ -33,7 +33,7 @@ pub extern "system" fn pgp_packet_free(p: Option<&mut Packet>) { /// Tags are explained in [Section 4.3 of RFC 4880]. /// /// [Section 4.3 of RFC 4880]: https://tools.ietf.org/html/rfc4880#section-4.3 -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_packet_tag(p: *const Packet) -> uint8_t { let p = ffi_param_ref!(p); @@ -48,7 +48,7 @@ pub extern "system" fn pgp_packet_tag(p: *const Packet) /// Signature Packet uses some unsupported methods, it is parsed /// into an `Packet::Unknown`. `tag()` returns `PGP_TAG_SIGNATURE`, /// whereas `kind()` returns `0`. -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" fn pgp_packet_kind(p: *const Packet) -> uint8_t { let p = ffi_param_ref!(p); @@ -68,7 +68,7 @@ pub extern "system" fn pgp_packet_kind(p: *const Packet) /// /// assert (strcmp (pgp_tag_to_string (2), "SIGNATURE") == 0); /// ``` -#[::ffi_catch_abort] #[no_mangle] +#[::sequoia_ffi_macros::extern_fn] #[no_mang |