diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-05-07 16:35:20 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-05-07 18:24:24 +0200 |
commit | c0308304ad20cd702231572eba3dedb293bdc103 (patch) | |
tree | 0b1344e7adf4004c61008b3fe485b42b765db3c6 /openpgp-ffi/src | |
parent | 83a109af5039cb764aa9b7ffddc14bafd3d42dca (diff) |
openpgp-ffi, ffi: Fix calling convention on Windows.
- Use `extern "C"` instead of `extern "system"`. The latter selects
stdcall, which is only appropriate for talking to the Windows API.
Diffstat (limited to 'openpgp-ffi/src')
-rw-r--r-- | openpgp-ffi/src/armor.rs | 12 | ||||
-rw-r--r-- | openpgp-ffi/src/crypto.rs | 14 | ||||
-rw-r--r-- | openpgp-ffi/src/error.rs | 4 | ||||
-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/packet/key.rs | 12 | ||||
-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 | 36 | ||||
-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 | 10 | ||||
-rw-r--r-- | openpgp-ffi/src/parse/mod.rs | 34 | ||||
-rw-r--r-- | openpgp-ffi/src/parse/stream.rs | 22 | ||||
-rw-r--r-- | openpgp-ffi/src/serialize.rs | 20 | ||||
-rw-r--r-- | openpgp-ffi/src/tpk.rs | 86 |
17 files changed, 152 insertions, 152 deletions
diff --git a/openpgp-ffi/src/armor.rs b/openpgp-ffi/src/armor.rs index 8b0fcfbd..66bafd75 100644 --- a/openpgp-ffi/src/armor.rs +++ b/openpgp-ffi/src/armor.rs @@ -107,7 +107,7 @@ fn kind_to_int(kind: Option<armor::Kind>) -> c_int { /// pgp_reader_free (bytes); /// ``` #[::sequoia_ffi_macros::extern_fn] #[no_mangle] -pub extern "system" fn pgp_armor_reader_new(inner: *mut Reader, +pub extern "C" fn pgp_armor_reader_new(inner: *mut Reader, kind: c_int) -> *mut Reader { let inner = inner.ref_mut_raw(); @@ -118,7 +118,7 @@ pub extern "system" fn pgp_armor_reader_new(inner: *mut Reader, /// Creates a `Reader` from a file. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] -pub extern "system" fn pgp_armor_reader_from_file(errp: Option<&mut *mut ::error::Error>, +pub extern "C" fn pgp_armor_reader_from_file(errp: Option<&mut *mut ::error::Error>, filename: *const c_char, kind: c_int) -> Maybe<Reader> { @@ -185,7 +185,7 @@ pub extern "system" fn pgp_armor_reader_from_file(errp: Option<&mut *mut ::error /// /// pgp_reader_free (armor); /// ``` -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_armor_reader_from_bytes(b: *const uint8_t, len: size_t, kind: c_int) -> *mut Reader { @@ -210,7 +210,7 @@ fn pgp_armor_reader_from_bytes(b: *const uint8_t, len: size_t, /// /// [this]: fn.pgp_armor_reader_new.html #[::sequoia_ffi_macros::extern_fn] #[no_mangle] -pub extern "system" fn pgp_armor_reader_kind(reader: *const Reader) +pub extern "C" fn pgp_armor_reader_kind(reader: *const Reader) -> c_int { if let ReaderKind::Armored(ref armor_reader) = reader.ref_raw() { @@ -240,7 +240,7 @@ pub extern "system" fn pgp_armor_reader_kind(reader: *const Reader) /// /// [this]: fn.pgp_armor_reader_new.html #[::sequoia_ffi_macros::extern_fn] #[no_mangle] -pub extern "system" fn pgp_armor_reader_headers(errp: Option<&mut *mut ::error::Error>, +pub extern "C" fn pgp_armor_reader_headers(errp: Option<&mut *mut ::error::Error>, reader: *mut Reader, len: *mut size_t) -> *mut ArmorHeader { @@ -341,7 +341,7 @@ pub extern "system" fn pgp_armor_reader_headers(errp: Option<&mut *mut ::error:: /// } /// ``` #[::sequoia_ffi_macros::extern_fn] #[no_mangle] -pub extern "system" fn pgp_armor_writer_new +pub extern "C" fn pgp_armor_writer_new (errp: Option<&mut *mut ::error::Error>, inner: *mut super::io::Writer, kind: c_int, diff --git a/openpgp-ffi/src/crypto.rs b/openpgp-ffi/src/crypto.rs index 540bcfd4..ab5eca2b 100644 --- a/openpgp-ffi/src/crypto.rs +++ b/openpgp-ffi/src/crypto.rs @@ -24,14 +24,14 @@ use MoveIntoRaw; pub struct SessionKey(openpgp::crypto::SessionKey); /// Creates a new session key. -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_session_key_new(size: size_t) -> *mut SessionKey { openpgp::crypto::SessionKey::new(&mut Yarrow::default(), size) .move_into_raw() } /// Creates a new session key from a buffer. -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_session_key_from_bytes(buf: *const uint8_t, size: size_t) -> *mut SessionKey { let buf = unsafe { @@ -48,7 +48,7 @@ fn pgp_session_key_from_bytes(buf: *const uint8_t, size: size_t) pub struct Password(openpgp::crypto::Password); /// Creates a new password from a buffer. -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_password_from_bytes(buf: *const uint8_t, size: size_t) -> *mut Password { let buf = unsafe { ::std::slice::from_raw_parts(buf, size) @@ -58,7 +58,7 @@ fn pgp_password_from_bytes(buf: *const uint8_t, size: size_t) -> *mut Password { /// Frees a signer. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] -pub extern "system" fn pgp_signer_free +pub extern "C" fn pgp_signer_free (s: Option<&mut &'static mut crypto::Signer>) { ffi_free!(s) @@ -66,7 +66,7 @@ pub extern "system" fn pgp_signer_free /// Creates a new key pair. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] -pub extern "system" fn pgp_key_pair_new +pub extern "C" fn pgp_key_pair_new (errp: Option<&mut *mut ::error::Error>, public: *mut Key, secret: *mut crypto::mpis::SecretKey) -> *mut crypto::KeyPair { @@ -78,7 +78,7 @@ pub extern "system" fn pgp_key_pair_new /// Frees a key pair. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] -pub extern "system" fn pgp_key_pair_free +pub extern "C" fn pgp_key_pair_free (kp: Option<&mut crypto::KeyPair>) { ffi_free!(kp) @@ -89,7 +89,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. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] -pub extern "system" fn pgp_key_pair_as_signer +pub extern "C" 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 991b22db..66dd7417 100644 --- a/openpgp-ffi/src/error.rs +++ b/openpgp-ffi/src/error.rs @@ -45,7 +45,7 @@ impl ::MoveResultIntoRaw<::error::Status> for ::failure::Fallible<()> /// Returns the error status code. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] -pub extern "system" fn pgp_error_status(error: *const Error) +pub extern "C" fn pgp_error_status(error: *const Error) -> Status { error.ref_raw().into() } @@ -145,7 +145,7 @@ pub enum Status { /// /// The returned value must *not* be freed. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] -pub extern "system" fn pgp_status_to_string(status: Status) -> *const c_char { +pub extern "C" fn pgp_status_to_string(status: Status) -> *const c_char { use error::Status::*; match status { diff --git a/openpgp-ffi/src/fingerprint.rs b/openpgp-ffi/src/fingerprint.rs index bdb9275e..a575d136 100644 --- a/openpgp-ffi/src/fingerprint.rs +++ b/openpgp-ffi/src/fingerprint.rs @@ -35,7 +35,7 @@ use RefRaw; pub struct Fingerprint(openpgp::Fingerprint); /// Reads a binary fingerprint. -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_fingerprint_from_bytes(buf: *const uint8_t, len: size_t) -> *mut Fingerprint { @@ -66,7 +66,7 @@ fn pgp_fingerprint_from_bytes(buf: *const uint8_t, /// free (pretty); /// pgp_fingerprint_free (fp); /// ``` -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_fingerprint_from_hex(hex: *const c_char) -> Maybe<Fingerprint> { let hex = ffi_param_cstr!(hex).to_string_lossy(); @@ -77,7 +77,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. -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_fingerprint_as_bytes(fp: *const Fingerprint, fp_len: Option<&mut size_t>) -> *const uint8_t { @@ -89,14 +89,14 @@ fn pgp_fingerprint_as_bytes(fp: *const Fingerprint, } /// Converts the fingerprint to a hexadecimal number. -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" 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. -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" 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 b1c74031..5698c955 100644 --- a/openpgp-ffi/src/io.rs +++ b/openpgp-ffi/src/io.rs @@ -41,7 +41,7 @@ impl Read for ReaderKind { /// Opens a file returning a reader. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] -pub extern "system" fn pgp_reader_from_file(errp: Option<&mut *mut ::error::Error>, +pub extern "C" fn pgp_reader_from_file(errp: Option<&mut *mut ::error::Error>, filename: *const c_char) -> Maybe<Reader> { let filename = ffi_param_cstr!(filename).to_string_lossy().into_owned(); @@ -54,7 +54,7 @@ pub extern "system" fn pgp_reader_from_file(errp: Option<&mut *mut ::error::Erro /// Opens a file descriptor returning a reader. #[cfg(unix)] #[::sequoia_ffi_macros::extern_fn] #[no_mangle] -pub extern "system" fn pgp_reader_from_fd(fd: c_int) +pub extern "C" fn pgp_reader_from_fd(fd: c_int) -> *mut Reader { ReaderKind::Generic(Box::new(unsafe { File::from_raw_fd(fd) @@ -63,7 +63,7 @@ pub extern "system" fn pgp_reader_from_fd(fd: c_int) /// Creates a reader from a buffer. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] -pub extern "system" fn pgp_reader_from_bytes(buf: *const uint8_t, +pub extern "C" fn pgp_reader_from_bytes(buf: *const uint8_t, len: size_t) -> *mut Reader { assert!(!buf.is_null()); @@ -75,7 +75,7 @@ pub extern "system" fn pgp_reader_from_bytes(buf: *const uint8_t, /// Reads up to `len` bytes into `buf`. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] -pub extern "system" fn pgp_reader_read(errp: Option<&mut *mut ::error::Error>, +pub extern "C" fn pgp_reader_read(errp: Option<&mut *mut ::error::Error>, reader: *mut Reader, buf: *mut uint8_t, len: size_t) -> ssize_t { @@ -97,7 +97,7 @@ pub extern "system" fn pgp_reader_read(errp: Option<&mut *mut ::error::Error>, /// Copies up to `len` bytes from `source` to `dest`. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] -pub extern "system" fn pgp_reader_copy(errp: Option<&mut *mut ::error::Error>, +pub extern "C" fn pgp_reader_copy(errp: Option<&mut *mut ::error::Error>, source: *mut Reader, dest: *mut Writer, len: size_t) @@ -119,7 +119,7 @@ pub extern "system" fn pgp_reader_copy(errp: Option<&mut *mut ::error::Error>, /// Reads all data from reader and discards it. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] -pub extern "system" fn pgp_reader_discard(errp: Option<&mut *mut ::error::Error>, +pub extern "C" fn pgp_reader_discard(errp: Option<&mut *mut ::error::Error>, reader: *mut Reader) -> ssize_t { let mut reader = reader.ref_mut_raw(); @@ -144,7 +144,7 @@ pub struct Writer(Box<io::Write>); /// /// The file will be created if it does not exist, or be truncated /// otherwise. If you need more control, use `pgp_writer_from_fd`. -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_writer_from_file(errp: Option<&mut *mut ::error::Error>, filename: *const c_char) -> Maybe<Writer> { @@ -157,14 +157,14 @@ fn pgp_writer_from_file(errp: Option<&mut *mut ::error::Error>, /// Opens a file descriptor returning a writer. #[cfg(unix)] -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_writer_from_fd(fd: c_int) -> *mut Writer { let w: Box<io::Write> = Box::new(unsafe { File::from_raw_fd(fd) }); w.move_into_raw() } /// Creates a writer from a buffer. -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_writer_from_bytes(buf: *mut uint8_t, len: size_t) -> *mut Writer { assert!(!buf.is_null()); let buf = unsafe { @@ -182,7 +182,7 @@ fn pgp_writer_from_bytes(buf: *mut uint8_t, len: size_t) -> *mut Writer { /// reference a chunk of memory allocated using libc's heap allocator. /// The caller is responsible to `free` it once the writer has been /// destroyed. -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_writer_alloc(buf: *mut *mut c_void, len: *mut size_t) -> *mut Writer { let buf = ffi_param_ref_mut!(buf); @@ -229,7 +229,7 @@ impl Write for WriterAlloc { } /// Writes up to `len` bytes of `buf` into `writer`. -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_writer_write(errp: Option<&mut *mut ::error::Error>, writer: *mut Writer, buf: *const uint8_t, len: size_t) diff --git a/openpgp-ffi/src/keyid.rs b/openpgp-ffi/src/keyid.rs index ec4b978b..1b5eeb99 100644 --- a/openpgp-ffi/src/keyid.rs +++ b/openpgp-ffi/src/keyid.rs @@ -52,7 +52,7 @@ pub struct KeyID(openpgp::KeyID); /// pgp_keyid_free (mr_b); /// free (mr_b_as_string); /// ``` -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_keyid_from_bytes(id: *const uint8_t) -> *mut KeyID { assert!(!id.is_null()); let id = unsafe { slice::from_raw_parts(id, 8) }; @@ -77,14 +77,14 @@ fn pgp_keyid_from_bytes(id: *const uint8_t) -> *mut KeyID { /// free (mr_b_as_string); /// pgp_keyid_free (mr_b); /// ``` -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" 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. -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" 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/packet/key.rs b/openpgp-ffi/src/packet/key.rs index c9eadd19..c6d371b9 100644 --- a/openpgp-ffi/src/packet/key.rs +++ b/openpgp-ffi/src/packet/key.rs @@ -29,20 +29,20 @@ pub struct Key(openpgp::packet::Key); /// Computes and returns the key's fingerprint as per Section 12.2 /// of RFC 4880. -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_key_fingerprint(key: *const Key) -> *mut Fingerprint { key.ref_raw().fingerprint().move_into_raw() } /// Computes and returns the key's key ID as per Section 12.2 of RFC /// 4880. -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_key_keyid(key: *const Key) -> *mut KeyID { key.ref_raw().keyid().move_into_raw() } /// Returns the key's creation time. -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_key_creation_time(key: *const Key) -> time_t { let key = key.ref_raw(); let ct = key.creation_time(); @@ -51,7 +51,7 @@ fn pgp_key_creation_time(key: *const Key) -> time_t { } /// Returns the key's public key algorithm. -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_key_public_key_algo(key: *const Key) -> c_int { let key = key.ref_raw(); let pk_algo : u8 = key.pk_algo().into(); @@ -59,7 +59,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 "system" +#[::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::*; @@ -81,7 +81,7 @@ fn pgp_key_public_key_bits(key: *const Key) -> c_int { /// # Errors /// /// Fails if the secret key is missing, or encrypted. -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_key_into_key_pair(errp: Option<&mut *mut ::error::Error>, key: *mut Key) -> *mut self::openpgp::crypto::KeyPair { diff --git a/openpgp-ffi/src/packet/mod.rs b/openpgp-ffi/src/packet/mod.rs index 3576210d..f57dfa7b 100644 --- a/openpgp-ffi/src/packet/mod.rs +++ b/openpgp-ffi/src/packet/mod.rs @@ -53,7 +53,7 @@ pub struct Packet(openpgp::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 -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_packet_tag(p: *const Packet) -> uint8_t { u8::from(p.ref_raw().tag()) as uint8_t } @@ -65,7 +65,7 @@ fn pgp_packet_tag(p: *const Packet) -> uint8_t { /// Signature Packet uses some unsupported methods, it is parsed /// into an `Packet::Unknown`. `tag()` returns `PGP_TAG_SIGNATURE`, /// whereas `kind()` returns `0`. -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_packet_kind(p: *const Packet) -> uint8_t { if let Some(kind) = p.ref_raw().kind() { kind.into() @@ -84,7 +84,7 @@ fn pgp_packet_kind(p: *const Packet) -> uint8_t { /// assert (strcmp (pgp_tag_to_string (2), "SIGNATURE") == 0); /// ``` #[::sequoia_ffi_macros::extern_fn] #[no_mangle] -pub extern "system" fn pgp_tag_to_string(tag: uint8_t) -> *const c_char { +pub extern "C" fn pgp_tag_to_string(tag: uint8_t) -> *const c_char { match Tag::from(tag) { Tag::PKESK => "PKESK\x00", Tag::Signature => "SIGNATURE\x00", @@ -113,7 +113,7 @@ pub extern "system" fn pgp_tag_to_string(tag: uint8_t) -> *const c_char { /// function returns `NULL`. Objects returned from this function must /// be deallocated using `pgp_signature_free` even though they only /// reference the given packet. -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_packet_ref_signature(p: *const Packet) -> Maybe<signature::Signature> { if let openpgp::Packet::Signature(ref p) = p.ref_raw() { ::std::ptr::NonNull::new(p.move_into_raw()) diff --git a/openpgp-ffi/src/packet/pkesk.rs b/openpgp-ffi/src/packet/pkesk.rs index 34527870..af87be5f 100644 --- a/openpgp-ffi/src/packet/pkesk.rs +++ b/openpgp-ffi/src/packet/pkesk.rs @@ -18,7 +18,7 @@ use RefRaw; /// The return value is a reference ot a `KeyID`. The caller must not /// modify or free it. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] -pub extern "system" fn pgp_pkesk_recipient(pkesk: *const PKESK) +pub extern "C" fn pgp_pkesk_recipient(pkesk: *const PKESK) -> *const KeyID { let pkesk = ffi_param_ref!(pkesk); pkesk.recipient().move_into_raw() @@ -31,7 +31,7 @@ pub extern "system" fn pgp_pkesk_recipient(pkesk: *const PKESK) /// is not written to it. Either way, `key_len` is set to the size of /// the session key. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] -pub extern "system" fn pgp_pkesk_decrypt(errp: Option<&mut *mut ::error::Error>, +pub extern "C" fn pgp_pkesk_decrypt(errp: Option<&mut *mut ::error::Error>, pkesk: *const PKESK, secret_key: *const Key, algo: *mut uint8_t, // XXX diff --git a/openpgp-ffi/src/packet/signature.rs b/openpgp-ffi/src/packet/signature.rs index a019f750..a4aa94d6 100644 --- a/openpgp-ffi/src/packet/signature.rs +++ b/openpgp-ffi/src/packet/signature.rs @@ -36,7 +36,7 @@ use RefRaw; pub struct Signature(openpgp::packet::Signature); /// Converts the signature to a packet. -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_signature_into_packet(s: *mut Signature) -> *mut openpgp::Packet { box_raw!(s.move_from_raw().into()) } @@ -46,7 +46,7 @@ fn pgp_signature_into_packet(s: *mut Signature) -> *mut openpgp::Packet { /// If there is no Issuer subpacket, this returns NULL. Note: if /// there is no Issuer subpacket, but there is an IssuerFingerprint /// subpacket, this still returns NULL. -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_signature_issuer(sig: *const Signature) -> Maybe<KeyID> { sig.ref_raw().issuer().move_into_raw() } @@ -56,7 +56,7 @@ fn pgp_signature_issuer(sig: *const Signature) -> Maybe<KeyID> { /// If there is no IssuerFingerprint subpacket, this returns NULL. /// Note: if there is no IssuerFingerprint subpacket, but there is an /// Issuer subpacket, this still returns NULL. -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_signature_issuer_fingerprint(sig: *const Signature) -> Maybe<Fingerprint> { sig.ref_raw().issuer_fingerprint().move_into_raw() @@ -65,21 +65,21 @@ fn pgp_signature_issuer_fingerprint(sig: *const Signature) /// Returns whether the KeyFlags indicates that the key can be used to /// make certifications. -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_signature_can_certify(sig: *const Signature) -> bool { sig.ref_raw().key_flags().can_certify() } /// Returns whether the KeyFlags indicates that the key can be used to /// make signatures. -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_signature_can_sign(sig: *const Signature) -> bool { sig.ref_raw().key_flags().can_sign() } /// Returns whether the KeyFlags indicates that the key can be used to /// encrypt data for transport. -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_signature_can_encrypt_for_transport(sig: *const Signature) -> bool { sig.ref_raw().key_flags().can_encrypt_for_transport() @@ -87,28 +87,28 @@ fn pgp_signature_can_encrypt_for_transport(sig: *const Signature) /// 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 "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_signature_can_encrypt_at_rest(sig: *const Signature) -> bool { sig.ref_raw().key_flags().can_encrypt_at_rest() } /// Returns whether the KeyFlags indicates that the key can be used /// for authentication. -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_signature_can_authenticate(sig: *const Signature) -> bool { sig.ref_raw().key_flags().can_authenticate() } /// Returns whether the KeyFlags indicates that the key is a split /// key. -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::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().is_split_key() } /// Returns whether the KeyFlags indicates that the key is a group /// key. -#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system" +#[::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().is_group_key() } @@ -118,7 +118,7 @@ fn pgp_signature_is_group_key(sig: *const Signature) -> bool { /// /// A signature is alive if the creation date is in the past, and the /// signature has not expired. -#[::sequoia_ffi_macr |