summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openpgp-ffi/include/sequoia/openpgp/types.h4
-rw-r--r--openpgp-ffi/src/packet/mod.rs8
2 files changed, 8 insertions, 4 deletions
diff --git a/openpgp-ffi/include/sequoia/openpgp/types.h b/openpgp-ffi/include/sequoia/openpgp/types.h
index d1612a73..d7a8271e 100644
--- a/openpgp-ffi/include/sequoia/openpgp/types.h
+++ b/openpgp-ffi/include/sequoia/openpgp/types.h
@@ -286,6 +286,10 @@ typedef enum pgp_tag {
PGP_TAG_PRIVATE1 = 61,
PGP_TAG_PRIVATE2 = 62,
PGP_TAG_PRIVATE3 = 63,
+
+ /* Dummy value to make sure the enumeration has a defined size.
+ Do not use this value. */
+ PGP_TAG_FORCE_WIDTH = INT_MAX,
} pgp_tag_t;
/*/
diff --git a/openpgp-ffi/src/packet/mod.rs b/openpgp-ffi/src/packet/mod.rs
index d332da87..7bab6195 100644
--- a/openpgp-ffi/src/packet/mod.rs
+++ b/openpgp-ffi/src/packet/mod.rs
@@ -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) -> u8 {
- u8::from(p.ref_raw().tag()) as u8
+fn pgp_packet_tag(p: *const Packet) -> u32 {
+ u8::from(p.ref_raw().tag()) as u32
}
/// Returns the parsed `Packet's` corresponding OpenPGP tag.
@@ -67,9 +67,9 @@ fn pgp_packet_tag(p: *const Packet) -> u8 {
/// 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) -> u8 {
+fn pgp_packet_kind(p: *const Packet) -> u32 {
if let Some(kind) = p.ref_raw().kind() {
- kind.into()
+ u8::from(kind) as u32
} else {
0
}