diff options
-rw-r--r-- | ffi-macros/src/lib.rs | 4 | ||||
-rw-r--r-- | ffi-macros/src/rust2c.rs | 10 | ||||
-rw-r--r-- | ffi/src/core.rs | 4 | ||||
-rw-r--r-- | ffi/src/net.rs | 4 | ||||
-rw-r--r-- | ffi/src/store.rs | 28 | ||||
-rw-r--r-- | openpgp-ffi/src/armor.rs | 4 | ||||
-rw-r--r-- | openpgp-ffi/src/crypto.rs | 6 | ||||
-rw-r--r-- | openpgp-ffi/src/fingerprint.rs | 6 | ||||
-rw-r--r-- | openpgp-ffi/src/io.rs | 10 | ||||
-rw-r--r-- | openpgp-ffi/src/keyid.rs | 4 | ||||
-rw-r--r-- | openpgp-ffi/src/packet/mod.rs | 10 | ||||
-rw-r--r-- | openpgp-ffi/src/packet/pkesk.rs | 6 | ||||
-rw-r--r-- | openpgp-ffi/src/packet/skesk.rs | 8 | ||||
-rw-r--r-- | openpgp-ffi/src/packet/user_attribute.rs | 4 | ||||
-rw-r--r-- | openpgp-ffi/src/packet/userid.rs | 6 | ||||
-rw-r--r-- | openpgp-ffi/src/parse/mod.rs | 12 | ||||
-rw-r--r-- | openpgp-ffi/src/parse/stream.rs | 12 | ||||
-rw-r--r-- | openpgp-ffi/src/serialize.rs | 16 | ||||
-rw-r--r-- | openpgp-ffi/src/tpk.rs | 4 |
19 files changed, 84 insertions, 74 deletions
diff --git a/ffi-macros/src/lib.rs b/ffi-macros/src/lib.rs index 26c1beb9..2e957890 100644 --- a/ffi-macros/src/lib.rs +++ b/ffi-macros/src/lib.rs @@ -870,7 +870,7 @@ fn derive_hash(span: proc_macro2::Span, prefix: &str, name: &str, /// Hashes this object. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn #ident #generics (this: *const #wrapper #generics) - -> ::libc::uint64_t { + -> u64 { use ::std::hash::{Hash, Hasher}; use ::RefRaw; @@ -929,7 +929,7 @@ fn derive_parse(span: proc_macro2::Span, prefix: &str, name: &str, /// Parses an object from the given buffer. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn #from_bytes #generics(errp: Option<&mut *mut ::error::Error>, - b: *const ::libc::uint8_t, len: ::libc::size_t) + b: *const u8, len: ::libc::size_t) -> ::Maybe<#wrapper #generics> { use ::sequoia_openpgp::parse::Parse; use ::MoveResultIntoRaw; diff --git a/ffi-macros/src/rust2c.rs b/ffi-macros/src/rust2c.rs index 84117ce5..56ef9761 100644 --- a/ffi-macros/src/rust2c.rs +++ b/ffi-macros/src/rust2c.rs @@ -29,6 +29,16 @@ fn ident2c(ident: &syn::Ident) -> (String, bool) { "int8_t" | "int16_t" | "int32_t" | "int64_t" | "uint8_t" | "uint16_t" | "uint32_t" | "uint64_t" => return (ident_string.clone(), false), + + // Primitive types. + "u8" => return ("uint8_t".into(), false), + "u16" => return ("uint16_t".into(), false), + "u32" => return ("uint32_t".into(), false), + "u64" => return ("uint64_t".into(), false), + "i8" => return ("int8_t".into(), false), + "i16" => return ("int16_t".into(), false), + "i32" => return ("int32_t".into(), false), + "i64" => return ("int64_t".into(), false), _ => (), } diff --git a/ffi/src/core.rs b/ffi/src/core.rs index 830391d6..70d333be 100644 --- a/ffi/src/core.rs +++ b/ffi/src/core.rs @@ -39,7 +39,7 @@ //! ``` use std::ptr; -use libc::{uint8_t, c_char, c_int}; +use libc::{c_char, c_int}; use sequoia_core as core; use sequoia_core::Config; @@ -127,7 +127,7 @@ fn sq_context_ipc_policy(ctx: *const Context) -> c_int { /// Returns whether or not this is an ephemeral context. #[::ffi_catch_abort] #[no_mangle] pub extern "C" -fn sq_context_ephemeral(ctx: *const Context) -> uint8_t { +fn sq_context_ephemeral(ctx: *const Context) -> u8 { let ctx = ffi_param_ref!(ctx); if ctx.c.ephemeral() { 1 } else { 0 } } diff --git a/ffi/src/net.rs b/ffi/src/net.rs index 93ea61cc..3f25b643 100644 --- a/ffi/src/net.rs +++ b/ffi/src/net.rs @@ -27,7 +27,7 @@ //! tpk = sq_keyserver_get (ctx, ks, id); //! ``` -use libc::{uint8_t, c_char, size_t}; +use libc::{c_char, size_t}; use native_tls::Certificate; use std::ptr; use std::slice; @@ -69,7 +69,7 @@ fn sq_keyserver_new(ctx: *mut Context, uri: *const c_char) -> *mut KeyServer { #[::ffi_catch_abort] #[no_mangle] pub extern "C" fn sq_keyserver_with_cert(ctx: *mut Context, uri: *const c_char, - cert: *const uint8_t, + cert: *const u8, len: size_t) -> *mut KeyServer { let ctx = ffi_param_ref_mut!(ctx); ffi_make_fry_from_ctx!(ctx); diff --git a/ffi/src/store.rs b/ffi/src/store.rs index 3aef93a7..a5e49c8b 100644 --- a/ffi/src/store.rs +++ b/ffi/src/store.rs @@ -23,7 +23,7 @@ //! ``` -use libc::{uint8_t, uint64_t, c_char}; +use libc::c_char; use std::ptr; extern crate sequoia_openpgp as openpgp; @@ -65,7 +65,7 @@ fn sq_store_list_stores(ctx: *mut Context, fn sq_store_iter_next(iter: *mut StoreIter, realmp: Option<&mut *mut c_char>, namep: Option<&mut *mut c_char>, - policyp: Option<&mut uint8_t>) + policyp: Option<&mut u8>) -> *mut Store { let iter = ffi_param_ref_mut!(iter); match iter.next() { @@ -159,7 +159,7 @@ fn sq_log_iter_next(iter: *mut LogIter) -> *mut Log { }; box_raw!(Log{ - timestamp: e.timestamp.sec as uint64_t, + timestamp: e.timestamp.sec as u64, store: maybe_box_raw!(e.store), binding: maybe_box_raw!(e.binding), key: maybe_box_raw!(e.key), @@ -569,23 +569,23 @@ fn sq_stats_free(stats: Option<&mut Stats>) { #[repr(C)] pub struct Stamps { /// Counts how many times this has been used. - pub count: uint64_t, + pub count: u64, /// Records the time when this has been used first. - pub first: uint64_t, + pub first: u64, /// Records the time when this has been used last. - pub last: uint64_t, + pub last: u64, } impl Stamps { fn new(s: &sequoia_store::Stamps) -> Stamps { Stamps{ - count: s.count as uint64_t, + count: s.count as u64, first: s.first.map(|t| t.sec).unwrap_or(0) - as uint64_t, + as u64, last: s.last.map(|t| t.sec).unwrap_or(0) - as uint64_t, + as u64, } } } @@ -598,10 +598,10 @@ impl Stamps { #[repr(C)] pub struct Stats { /// Records the time this item was created. - pub created: uint64_t, + pub created: u64, /// Records the time this item was last updated. - pub updated: uint64_t, + pub updated: u64, /// Records counters and timestamps of encryptions. pub encryption: Stamps, @@ -613,8 +613,8 @@ pub struct Stats { impl Stats { fn new(s: sequoia_store::Stats) -> Stats { Stats { - created: s.created.map(|t| t.sec).unwrap_or(0) as uint64_t, - updated: s.updated.map(|t| t.sec).unwrap_or(0) as uint64_t, + created: s.created.map(|t| t.sec).unwrap_or(0) as u64, + updated: s.updated.map(|t| t.sec).unwrap_or(0) as u64, encryption: Stamps::new(&s.encryption), verification: Stamps::new(&s.verification), } @@ -625,7 +625,7 @@ impl Stats { #[repr(C)] pub struct Log { /// Records the time of the entry. - pub timestamp: uint64_t, + pub timestamp: u64, /// Relates the entry to a store. /// diff --git a/openpgp-ffi/src/armor.rs b/openpgp-ffi/src/armor.rs index a0e6a203..cb352ca1 100644 --- a/openpgp-ffi/src/armor.rs +++ b/openpgp-ffi/src/armor.rs @@ -8,7 +8,7 @@ use std::mem::size_of; use std::ptr; use std::slice; use std::io; -use libc::{self, uint8_t, c_char, c_int, size_t}; +use libc::{self, c_char, c_int, size_t}; extern crate sequoia_openpgp; use self::sequoia_openpgp::armor; @@ -202,7 +202,7 @@ pub extern "C" fn pgp_armor_reader_from_file(errp: Option<&mut *mut ::error::Err /// pgp_reader_free (armor); /// ``` #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" -fn pgp_armor_reader_from_bytes(b: *const uint8_t, len: size_t, +fn pgp_armor_reader_from_bytes(b: *const u8, len: size_t, mode: c_int) -> *mut Reader { assert!(!b.is_null()); diff --git a/openpgp-ffi/src/crypto.rs b/openpgp-ffi/src/crypto.rs index ab5eca2b..2e3ef661 100644 --- a/openpgp-ffi/src/crypto.rs +++ b/openpgp-ffi/src/crypto.rs @@ -4,7 +4,7 @@ //! //! [`sequoia-openpgp::crypto`]: ../../sequoia_openpgp/crypto/index.html -use libc::{size_t, uint8_t}; +use libc::size_t; use nettle::Yarrow; extern crate sequoia_openpgp as openpgp; @@ -32,7 +32,7 @@ fn pgp_session_key_new(size: size_t) -> *mut SessionKey { /// Creates a new session key from a buffer. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" -fn pgp_session_key_from_bytes(buf: *const uint8_t, size: size_t) +fn pgp_session_key_from_bytes(buf: *const u8, size: size_t) -> *mut SessionKey { let buf = unsafe { ::std::slice::from_raw_parts(buf, size) @@ -49,7 +49,7 @@ pub struct Password(openpgp::crypto::Password); /// Creates a new password from a buffer. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" -fn pgp_password_from_bytes(buf: *const uint8_t, size: size_t) -> *mut Password { +fn pgp_password_from_bytes(buf: *const u8, size: size_t) -> *mut Password { let buf = unsafe { ::std::slice::from_raw_parts(buf, size) }; diff --git a/openpgp-ffi/src/fingerprint.rs b/openpgp-ffi/src/fingerprint.rs index a575d136..e040b6ce 100644 --- a/openpgp-ffi/src/fingerprint.rs +++ b/openpgp-ffi/src/fingerprint.rs @@ -11,7 +11,7 @@ //! [`sequoia-openpgp::Fingerprint`]: ../../sequoia_openpgp/enum.Fingerprint.html use std::slice; -use libc::{uint8_t, c_char, size_t}; +use libc::{c_char, size_t}; extern crate sequoia_openpgp as openpgp; use super::keyid::KeyID; @@ -36,7 +36,7 @@ pub struct Fingerprint(openpgp::Fingerprint); /// Reads a binary fingerprint. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" -fn pgp_fingerprint_from_bytes(buf: *const uint8_t, +fn pgp_fingerprint_from_bytes(buf: *const u8, len: size_t) -> *mut Fingerprint { assert!(!buf.is_null()); @@ -80,7 +80,7 @@ fn pgp_fingerprint_from_hex(hex: *const c_char) #[::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 { + -> *const u8 { let fp = fp.ref_raw(); if let Some(p) = fp_len { *p = fp.as_slice().len(); diff --git a/openpgp-ffi/src/io.rs b/openpgp-ffi/src/io.rs index 5698c955..605fa04e 100644 --- a/openpgp-ffi/src/io.rs +++ b/openpgp-ffi/src/io.rs @@ -4,7 +4,7 @@ use std::fs::File; use std::io::{self, Read, Write, Cursor}; use std::path::Path; use std::slice; -use libc::{uint8_t, c_void, c_char, c_int, size_t, ssize_t, realloc}; +use libc::{c_void, c_char, c_int, size_t, ssize_t, realloc}; #[cfg(unix)] use std::os::unix::io::FromRawFd; @@ -63,7 +63,7 @@ pub extern "C" fn pgp_reader_from_fd(fd: c_int) /// Creates a reader from a buffer. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] -pub extern "C" fn pgp_reader_from_bytes(buf: *const uint8_t, +pub extern "C" fn pgp_reader_from_bytes(buf: *const u8, len: size_t) -> *mut Reader { assert!(!buf.is_null()); @@ -77,7 +77,7 @@ pub extern "C" fn pgp_reader_from_bytes(buf: *const uint8_t, #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_reader_read(errp: Option<&mut *mut ::error::Error>, reader: *mut Reader, - buf: *mut uint8_t, len: size_t) + buf: *mut u8, len: size_t) -> ssize_t { assert!(!buf.is_null()); let buf = unsafe { @@ -165,7 +165,7 @@ fn pgp_writer_from_fd(fd: c_int) -> *mut Writer { /// Creates a writer from a buffer. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" -fn pgp_writer_from_bytes(buf: *mut uint8_t, len: size_t) -> *mut Writer { +fn pgp_writer_from_bytes(buf: *mut u8, len: size_t) -> *mut Writer { assert!(!buf.is_null()); let buf = unsafe { slice::from_raw_parts_mut(buf, len as usize) @@ -232,7 +232,7 @@ impl Write for WriterAlloc { #[::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) + buf: *const u8, len: size_t) -> ssize_t { assert!(!buf.is_null()); let buf = unsafe { diff --git a/openpgp-ffi/src/keyid.rs b/openpgp-ffi/src/keyid.rs index 1b5eeb99..5336bbc8 100644 --- a/openpgp-ffi/src/keyid.rs +++ b/openpgp-ffi/src/keyid.rs @@ -11,7 +11,7 @@ //! [`sequoia-openpgp::KeyID`]: ../../sequoia_openpgp/enum.KeyID.html use std::slice; -use libc::{uint8_t, c_char}; +use libc::{c_char}; extern crate sequoia_openpgp as openpgp; @@ -53,7 +53,7 @@ pub struct KeyID(openpgp::KeyID); /// free (mr_b_as_string); /// ``` #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" -fn pgp_keyid_from_bytes(id: *const uint8_t) -> *mut KeyID { +fn pgp_keyid_from_bytes(id: *const u8) -> *mut KeyID { assert!(!id.is_null()); let id = unsafe { slice::from_raw_parts(id, 8) }; openpgp::KeyID::from_bytes(id).move_into_raw() diff --git a/openpgp-ffi/src/packet/mod.rs b/openpgp-ffi/src/packet/mod.rs index 49218547..b1bf69dd 100644 --- a/openpgp-ffi/src/packet/mod.rs +++ b/openpgp-ffi/src/packet/mod.rs @@ -4,7 +4,7 @@ //! //! [Section 4 of RFC 4880]: https://tools.ietf.org/html/rfc4880#section-4 -use libc::{uint8_t, c_char}; +use libc::c_char; extern crate sequoia_openpgp as openpgp; extern crate time; @@ -55,8 +55,8 @@ pub struct Packet(openpgp::Packet); /// /// [Section 4.3 of RFC 4880]: https://tools.ietf.org/html/rfc4880#section-4.3 #[::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 +fn pgp_packet_tag(p: *const Packet) -> u8 { + u8::from(p.ref_raw().tag()) as u8 } /// Returns the parsed `Packet's` corresponding OpenPGP tag. @@ -67,7 +67,7 @@ fn pgp_packet_tag(p: *const Packet) -> uint8_t { /// into an `Packet::Unknown`. `tag()` returns `PGP_TAG_SIGNATURE`, /// whereas `kind()` returns `0`. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" -fn pgp_packet_kind(p: *const Packet) -> uint8_t { +fn pgp_packet_kind(p: *const Packet) -> u8 { if let Some(kind) = p.ref_raw().kind() { kind.into() } else { @@ -85,7 +85,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 "C" fn pgp_tag_to_string(tag: uint8_t) -> *const c_char { +pub extern "C" fn pgp_tag_to_string(tag: u8) -> *const c_char { match Tag::from(tag) { Tag::PKESK => "PKESK\x00", Tag::Signature => "SIGNATURE\x00", diff --git a/openpgp-ffi/src/packet/pkesk.rs b/openpgp-ffi/src/packet/pkesk.rs index e50f0cc9..407336f8 100644 --- a/openpgp-ffi/src/packet/pkesk.rs +++ b/openpgp-ffi/src/packet/pkesk.rs @@ -1,7 +1,7 @@ //! Asymmetrically encrypted session keys. use failure; -use libc::{uint8_t, size_t}; +use libc::size_t; extern crate sequoia_openpgp as openpgp; use self::openpgp::packet::PKESK; @@ -34,8 +34,8 @@ pub extern "C" fn pgp_pkesk_recipient(pkesk: *const PKESK) 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 - key: *mut uint8_t, + algo: *mut u8, // XXX + key: *mut u8, key_len: *mut size_t) -> Status { ffi_make_fry_from_errp!(errp); diff --git a/openpgp-ffi/src/packet/skesk.rs b/openpgp-ffi/src/packet/skesk.rs index 06653604..7f5305f3 100644 --- a/openpgp-ffi/src/packet/skesk.rs +++ b/openpgp-ffi/src/packet/skesk.rs @@ -1,7 +1,7 @@ //! Symmetrically encrypted session keys. use std::slice; -use libc::{uint8_t, size_t}; +use libc::size_t; use failure; extern crate sequoia_openpgp as openpgp; @@ -19,10 +19,10 @@ use RefRaw; #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_skesk_decrypt(errp: Option<&mut *mut ::error::Error>, skesk: *const Packet, - password: *const uint8_t, + password: *const u8, password_len: size_t, - algo: *mut uint8_t, // XXX - key: *mut uint8_t, + algo: *mut u8, // XXX + key: *mut u8, key_len: *mut size_t) -> Status { ffi_make_fry_from_errp!(errp); diff --git a/openpgp-ffi/src/packet/user_attribute.rs b/openpgp-ffi/src/packet/user_attribute.rs index c26e9cce..1045b6d0 100644 --- a/openpgp-ffi/src/packet/user_attribute.rs +++ b/openpgp-ffi/src/packet/user_attribute.rs @@ -4,7 +4,7 @@ //! //! [Section 5.12 of RFC 4880]: https://tools.ietf.org/html/rfc4880#section-5.12 -use libc::{uint8_t, size_t}; +use libc::size_t; extern crate sequoia_openpgp as openpgp; use super::Packet; @@ -17,7 +17,7 @@ use RefRaw; #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_user_attribute_value(ua: *const Packet, value_len: Option<&mut size_t>) - -> *const uint8_t { + -> *const u8 { if let &openpgp::Packet::UserAttribute(ref ua) = ua.ref_raw() { if let Some(p) = value_len { *p = ua.value().len(); diff --git a/openpgp-ffi/src/packet/userid.rs b/openpgp-ffi/src/packet/userid.rs index 34c4da33..ce59161f 100644 --- a/openpgp-ffi/src/packet/userid.rs +++ b/openpgp-ffi/src/packet/userid.rs @@ -5,7 +5,7 @@ //! [Section 5.11 of RFC 4880]: https://tools.ietf.org/html/rfc4880#section-5.11 extern crate sequoia_openpgp as openpgp; -use libc::{uint8_t, c_char, size_t}; +use libc::{c_char, size_t}; use error::Status; use super::Packet; @@ -105,7 +105,7 @@ fn pgp_user_id_from_unchecked_address( /// `value` need not be valid UTF-8. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" -fn pgp_user_id_from_raw(value: *const uint8_t, len: size_t) +fn pgp_user_id_from_raw(value: *const u8, len: size_t) -> *mut Packet { let value : &[u8] = unsafe { std::slice::from_raw_parts(value, len) }; @@ -120,7 +120,7 @@ fn pgp_user_id_from_raw(value: *const uint8_t, len: size_t) #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_user_id_value(uid: *const Packet, value_len: Option<&mut size_t>) - -> *const uint8_t + -> *const u8 { if let &openpgp::Packet::UserID(ref uid) = uid.ref_raw() { if let Some(p) = value_len { diff --git a/openpgp-ffi/src/parse/mod.rs b/openpgp-ffi/src/parse/mod.rs index df13bcbd..d1b953d1 100644 --- a/openpgp-ffi/src/parse/mod.rs +++ b/openpgp-ffi/src/parse/mod.rs @@ -9,7 +9,7 @@ use std::mem::forget; use std::ptr; use std::slice; -use libc::{uint8_t, c_char, c_int, size_t}; +use libc::{c_char, c_int, size_t}; extern crate sequoia_openpgp as openpgp; extern crate time; @@ -64,7 +64,7 @@ pub extern "C" fn pgp_packet_parser_from_file /// the stream. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_packet_parser_from_bytes - (errp: Option<&mut *mut ::error::Error>, b: *const uint8_t, len: size_t) + (errp: Option<&mut *mut ::error::Error>, b: *const u8, len: size_t) -> *mut PacketParserResult<'static> { ffi_make_fry_from_errp!(errp); assert!(!b.is_null()); @@ -125,7 +125,7 @@ pub extern "C" fn pgp_packet_parser_packet #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_packet_parser_recursion_depth (pp: *const PacketParser) - -> uint8_t { + -> u8 { let pp = ffi_param_ref!(pp); pp.recursion_depth() as u8 } @@ -276,7 +276,7 @@ pub extern "C" fn pgp_packet_parser_buffer_unread_content<'a> (errp: Option<&mut *mut ::error::Error>, pp: *mut PacketParser<'a>, len: *mut usize) - -> *const uint8_t { + -> *const u8 { ffi_make_fry_from_errp!(errp); let pp = ffi_param_ref_mut!(pp); let len = ffi_param_ref_mut!(len); @@ -327,8 +327,8 @@ pub extern "C" fn pgp_packet_parser_finish<'a> pub extern "C" fn pgp_packet_parser_decrypt<'a> (errp: Option<&mut *mut ::error::Error>, pp: *mut PacketParser<'a>, - algo: uint8_t, // XXX - key: *const uint8_t, key_len: size_t) + algo: u8, // XXX + key: *const u8, key_len: size_t) -> Status { ffi_make_fry_from_errp!(errp); let pp = ffi_param_ref_mut!(pp); diff --git a/openpgp-ffi/src/parse/stream.rs b/openpgp-ffi/src/parse/stream.rs index b887f5e6..f31124aa 100644 --- a/openpgp-ffi/src/parse/stream.rs +++ b/openpgp-ffi/src/parse/stream.rs @@ -11,7 +11,7 @@ //! [`sequoia-openpgp::parse::stream`]: ../../../sequoia_openpgp/parse/stream/index.html use std::ptr; -use libc::{c_int, c_void, uint8_t, time_t}; +use libc::{c_int, c_void, time_t}; extern crate sequoia_openpgp as openpgp; extern crate time; @@ -91,7 +91,7 @@ fn pgp_message_layer_variant(result: *const MessageLayer) /// members if the corresponding parameter is not `NULL`. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_message_layer_compression(v: *const MessageLayer, - algo_r: Maybe<uint8_t>) + algo_r: Maybe<u8>) -> bool { use self::stream::MessageLayer::*; @@ -112,8 +112,8 @@ fn pgp_message_layer_compression(v: *const MessageLayer, /// members if the corresponding parameter is not `NULL`. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_message_layer_encryption(v: *const MessageLayer, - sym_algo_r: Maybe<uint8_t>, - aead_algo_r: Maybe<uint8_t>) + sym_algo_r: Maybe<u8>, + aead_algo_r: Maybe<u8>) -> bool { use self::stream::MessageLayer::*; @@ -298,7 +298,7 @@ type InspectCallback = fn(*mut HelperCookie, *const PacketParser) -> Status; type DecryptCallback = fn(*mut HelperCookie, *const *const PKESK, usize, *const *const SKESK, usize, - extern "C" fn (*mut c_void, uint8_t, + extern "C" fn (*mut c_void, u8, *const crypto::SessionKey) -> Status, *mut c_void, @@ -717,7 +717,7 @@ impl DecryptionHelper for DHelper { // skesks.into_iter().for_each(|o| { // super::super::packet::skesk::pgp_skesk_free(o) }); - extern "C" fn trampoline<D>(data: *mut c_void, algo: uint8_t, + extern "C" fn trampoline<D>(data: *mut c_void, algo: u8, sk: *const crypto::SessionKey) -> Status where D: FnMut(SymmetricAlgorithm, &SessionKey) diff --git a/openpgp-ffi/src/serialize.rs b/openpgp-ffi/src/serialize.rs index 653c06a0..a2613c24 100644 --- a/openpgp-ffi/src/serialize.rs +++ b/openpgp-ffi/src/serialize.rs @@ -8,7 +8,7 @@ use std::ptr; use std::slice; use std::io::Write; -use libc::{uint8_t, c_char, size_t, ssize_t}; +use libc::{c_char, size_t, ssize_t}; extern crate sequoia_openpgp as openpgp; extern crate time; @@ -55,7 +55,7 @@ pub extern "C" fn pgp_writer_stack_message pub extern "C" fn pgp_writer_stack_write (errp: Option<&mut *mut ::error::Error>, writer: *mut writer::Stack<'static, Cooki |