diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-01-17 17:54:30 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-01-17 17:54:30 +0100 |
commit | 72f7f83fa697ac44d962dc65ef9329dcfe6fd3e8 (patch) | |
tree | 3b2af100212cee4ae26e548d0535db705e5f616d /openpgp-ffi | |
parent | 3f58832474a4b270e136544016a401ef773ac065 (diff) |
openpgp-ffi: Change prefix from 'sq' to 'pgp'.
- This change is the result of the following command, which can also
be used to automatically convert existing users of Sequoia's C
API:
git grep -il sq_ | while read F ; do sed -E -i -e 's/sq_(arbitrary_writer_new|armor_reader_from_bytes|armor_reader_from_file|armor_reader_headers|armor_reader_kind|armor_reader_new|armor_writer_new|decrypt|encryptor_new|error_free|error_status|error_string|fingerprint_as_bytes|fingerprint_clone|fingerprint_equal|fingerprint_free|fingerprint_from_bytes|fingerprint_from_hex|fingerprint_hash|fingerprint_to_hex|fingerprint_to_keyid|fingerprint_to_string|keyid_clone|keyid_equal|keyid_free|keyid_from_bytes|keyid_from_hex|keyid_hash|keyid_to_hex|keyid_to_string|key_pair_as_signer|key_pair_free|key_pair_new|literal_writer_new|packet_free|packet_kind|packet_parser_buffer_unread_content|packet_parser_decrypt|packet_parser_eof_free|packet_parser_eof_is_message|packet_parser_finish|packet_parser_free|packet_parser_from_bytes|packet_parser_from_file|packet_parser_from_reader|packet_parser_next|packet_parser_packet|packet_parser_recurse|packet_parser_recursion_depth|packet_parser_result_eof|packet_parser_result_free|packet_parser_result_packet_parser|packet_parser_result_tag|packet_pile_clone|packet_pile_free|packet_pile_from_bytes|packet_pile_from_file|packet_pile_from_reader|packet_pile_serialize|packet_tag|pkesk_decrypt|pkesk_recipient|p_key_alive|p_key_alive_at|p_key_clone|p_key_creation_time|p_key_expired|p_key_expired_at|p_key_fingerprint|p_key_into_key_pair|p_key_keyid|p_key_public_key_algo|p_key_public_key_bits|reader_free|reader_from_bytes|reader_from_fd|reader_from_file|reader_read|revocation_status_free|revocation_status_variant|secret_cached|signature_alive|signature_alive_at|signature_can_authenticate|signature_can_certify|signature_can_encrypt_at_rest|signature_can_encrypt_for_transport|signature_can_sign|signature_expired|signature_expired_at|signature_free|signature_is_group_key|signature_is_split_key|signature_issuer|signature_issuer_fingerprint|signature_to_packet|signer_free|signer_new|signer_new_detached|skesk_decrypt|tag_to_string|tpk_alive|tpk_alive_at|tpk_builder_add_certification_subkey|tpk_builder_add_encryption_subkey|tpk_builder_add_signing_subkey|tpk_builder_add_userid|tpk_builder_autocrypt|tpk_builder_default|tpk_builder_free|tpk_builder_generate|tpk_builder_set_cipher_suite|tpk_clone|tpk_dump|tpk_equal|tpk_expired|tpk_expired_at|tpk_fingerprint|tpk_free|tpk_from_bytes|tpk_from_file|tpk_from_packet_parser|tpk_from_packet_pile|tpk_from_reader|tpk_into_tsk|tpk_is_tsk|tpk_key_iter|tpk_key_iter_free|tpk_key_iter_next|tpk_merge|tpk_merge_packets|tpk_primary|tpk_primary_user_id|tpk_revocation_status|tpk_revoke|tpk_revoke_in_place|tpk_serialize|tpk_set_expiry|tpk_user_id_binding_iter|tsk_free|tsk_into_tpk|tsk_new|tsk_serialize|tsk_tpk|user_attribute_value|user_id_binding_iter_free|user_id_binding_iter_next|user_id_binding_selfsig|user_id_binding_user_id|user_id_value|verification_result_code|verification_result_level|verification_results_at_level|verification_result_signature|verify|writer_alloc|writer_free|writer_from_bytes|writer_from_fd|writer_from_file|writer_stack_finalize|writer_stack_finalize_one|writer_stack_message|writer_stack_write|writer_stack_write_all|writer_write|reader|writer|packet_parser|packet_parser_result|packet_parser_eof|keyid|fingerprint|revocation_status|revocation_status_variant|armor_kind|armor_header|tag|unknown|signature|one_pass_sig|p_key|user_id|user_attribute|literal|compressed_data|pkesk|skesk|seip|mdc|packet|packet_pile|reason_for_revocation|user_id_binding|user_id_binding_iter|tpk_key_iter|tpk|tsk|tpk_builder|tpk_cipher_suite|public_key_algorithm|writer_stack|encryption_mode|secret|verification_results|verification_result|verification_result_code|sequoia_decrypt_get_public_keys_cb_t|sequoia_decrypt_get_secret_keys_cb_t|sequoia_decrypt_check_signatures_cb_t|mpi|signer|key_pair|p_key|status|error)/pgp_\1/g' -e 's/SQ_(ARMOR_KIND_ANY|ARMOR_KIND_FILE|ARMOR_KIND_FORCE_WIDTH|ARMOR_KIND_MESSAGE|ARMOR_KIND_PUBLICKEY|ARMOR_KIND_SECRETKEY|ARMOR_KIND_SIGNATURE|ENCRYPTION_MODE_AT_REST|ENCRYPTION_MODE_FOR_TRANSPORT|PUBLIC_KEY_ALGO_DSA|PUBLIC_KEY_ALGO_ECDH|PUBLIC_KEY_ALGO_ECDSA|PUBLIC_KEY_ALGO_EDDSA|PUBLIC_KEY_ALGO_ELGAMAL_ENCRYPT|PUBLIC_KEY_ALGO_ELGAMAL_ENCRYPT_SIGN|PUBLIC_KEY_ALGO_FORCE_WIDTH|PUBLIC_KEY_ALGO_RSA_ENCRYPT|PUBLIC_KEY_ALGO_RSA_ENCRYPT_SIGN|PUBLIC_KEY_ALGO_RSA_SIGN|REASON_FOR_REVOCATION_FORCE_WIDTH|REASON_FOR_REVOCATION_KEY_COMPROMISED|REASON_FOR_REVOCATION_KEY_RETIRED|REASON_FOR_REVOCATION_KEY_SUPERSEDED|REASON_FOR_REVOCATION_UID_RETIRED|REASON_FOR_REVOCATION_UNSPECIFIED|REVOCATION_STATUS_COULD_BE|REVOCATION_STATUS_FORCE_WIDTH|REVOCATION_STATUS_NOT_AS_FAR_AS_WE_KNOW|REVOCATION_STATUS_REVOKED|STATUS_BAD_SIGNATURE|STATUS_FORCE_WIDTH|STATUS_INDEX_OUT_OF_RANGE|STATUS_INVALID_ARGUMENT|STATUS_INVALID_OPERATION|STATUS_INVALID_PASSWORD|STATUS_INVALID_SESSION_KEY|STATUS_IO_ERROR|STATUS_MALFORMED_MESSAGE|STATUS_MALFORMED_PACKET|STATUS_MALFORMED_TPK|STATUS_MANIPULATED_MESSAGE|STATUS_MISSING_SESSION_KEY|STATUS_NETWORK_POLICY_VIOLATION|STATUS_SUCCESS|STATUS_UNKNOWN_ERROR|STATUS_UNSUPPORTED_AEAD_ALGORITHM|STATUS_UNSUPPORTED_ELLIPTIC_CURVE|STATUS_UNSUPPORTED_HASH_ALGORITHM|STATUS_UNSUPPORTED_PUBLICKEY_ALGORITHM|STATUS_UNSUPPORTED_SIGNATURE_TYPE|STATUS_UNSUPPORTED_SYMMETRIC_ALGORITHM|STATUS_UNSUPPORTED_TPK|TAG_COMPRESSED_DATA|TAG_LITERAL|TAG_MARKER|TAG_MDC|TAG_ONE_PASS_SIG|TAG_PKESK|TAG_PRIVATE|TAG_PUBLIC_KEY|TAG_PUBLIC_SUBKEY|TAG_RESERVED|TAG_SECRET_KEY|TAG_SECRET_SUBKEY|TAG_SED|TAG_SEIP|TAG_SIGNATURE|TAG_SKESK|TAG_TRUST|TAG_UNASSIGNED|TAG_USER_ATTRIBUTE|TAG_USER_ID|TPK_CIPHER_SUITE_CV|TPK_CIPHER_SUITE_FORCE_WIDTH|TPK_CIPHER_SUITE_RSA|VERIFICATION_RESULT_CODE_BAD_CHECKSUM|VERIFICATION_RESULT_CODE_FORCE_WIDTH|VERIFICATION_RESULT_CODE_GOOD_CHECKSUM|VERIFICATION_RESULT_CODE_MISSING_KEY)/PGP_\1/g' $F ; done
Diffstat (limited to 'openpgp-ffi')
-rw-r--r-- | openpgp-ffi/examples/armor.c | 30 | ||||
-rw-r--r-- | openpgp-ffi/examples/encrypt-for.c | 38 | ||||
-rw-r--r-- | openpgp-ffi/examples/example.c | 12 | ||||
-rw-r--r-- | openpgp-ffi/examples/parser.c | 28 | ||||
-rw-r--r-- | openpgp-ffi/examples/reader.c | 18 | ||||
-rw-r--r-- | openpgp-ffi/include/sequoia/io.h | 28 | ||||
-rw-r--r-- | openpgp-ffi/include/sequoia/openpgp.h | 810 | ||||
-rw-r--r-- | openpgp-ffi/include/sequoia/openpgp/crypto.h | 16 | ||||
-rw-r--r-- | openpgp-ffi/include/sequoia/openpgp/error.h | 58 | ||||
-rw-r--r-- | openpgp-ffi/src/armor.rs | 72 | ||||
-rw-r--r-- | openpgp-ffi/src/common.rs | 166 | ||||
-rw-r--r-- | openpgp-ffi/src/crypto.rs | 8 | ||||
-rw-r--r-- | openpgp-ffi/src/error.rs | 6 | ||||
-rw-r--r-- | openpgp-ffi/src/fingerprint.rs | 22 | ||||
-rw-r--r-- | openpgp-ffi/src/io.rs | 24 | ||||
-rw-r--r-- | openpgp-ffi/src/keyid.rs | 22 | ||||
-rw-r--r-- | openpgp-ffi/src/lib.rs | 10 | ||||
-rw-r--r-- | openpgp-ffi/src/packet_pile.rs | 16 | ||||
-rw-r--r-- | openpgp-ffi/src/tpk.rs | 202 | ||||
-rw-r--r-- | openpgp-ffi/src/tsk.rs | 10 |
20 files changed, 798 insertions, 798 deletions
diff --git a/openpgp-ffi/examples/armor.c b/openpgp-ffi/examples/armor.c index 9b965c5b..4c47be6c 100644 --- a/openpgp-ffi/examples/armor.c +++ b/openpgp-ffi/examples/armor.c @@ -19,20 +19,20 @@ const char *armored = int main (int argc, char **argv) { - sq_error_t err; - sq_reader_t bytes; - sq_reader_t armor; - sq_armor_kind_t kind; + pgp_error_t err; + pgp_reader_t bytes; + pgp_reader_t armor; + pgp_armor_kind_t kind; char message[12]; - sq_armor_header_t *header; + pgp_armor_header_t *header; size_t header_len; - bytes = sq_reader_from_bytes ((uint8_t *) armored, strlen (armored)); - armor = sq_armor_reader_new (bytes, SQ_ARMOR_KIND_ANY); + bytes = pgp_reader_from_bytes ((uint8_t *) armored, strlen (armored)); + armor = pgp_armor_reader_new (bytes, PGP_ARMOR_KIND_ANY); - header = sq_armor_reader_headers (&err, armor, &header_len); + header = pgp_armor_reader_headers (&err, armor, &header_len); if (header == NULL) - error (1, 0, "Getting headers failed: %s", sq_error_string (err)); + error (1, 0, "Getting headers failed: %s", pgp_error_string (err)); assert (header_len == 2); assert (strcmp (header[0].key, "Key0") == 0 @@ -46,15 +46,15 @@ main (int argc, char **argv) } free (header); - kind = sq_armor_reader_kind (armor); - assert (kind == SQ_ARMOR_KIND_FILE); + kind = pgp_armor_reader_kind (armor); + assert (kind == PGP_ARMOR_KIND_FILE); - if (sq_reader_read (&err, armor, (uint8_t *) message, 12) < 0) - error (1, 0, "Reading failed: %s", sq_error_string (err)); + if (pgp_reader_read (&err, armor, (uint8_t *) message, 12) < 0) + error (1, 0, "Reading failed: %s", pgp_error_string (err)); assert (memcmp (message, "Hello world!", 12) == 0); - sq_reader_free (armor); - sq_reader_free (bytes); + pgp_reader_free (armor); + pgp_reader_free (bytes); return 0; } diff --git a/openpgp-ffi/examples/encrypt-for.c b/openpgp-ffi/examples/encrypt-for.c index ab0943ba..b34d3a9f 100644 --- a/openpgp-ffi/examples/encrypt-for.c +++ b/openpgp-ffi/examples/encrypt-for.c @@ -20,12 +20,12 @@ main (int argc, char **argv) struct stat st; int fd; uint8_t *b; - sq_status_t rc; - sq_error_t err; + pgp_status_t rc; + pgp_error_t err; int use_armor = 1; - sq_tpk_t tpk; - sq_writer_t sink; - sq_writer_stack_t writer = NULL; + pgp_tpk_t tpk; + pgp_writer_t sink; + pgp_writer_stack_t writer = NULL; void *cipher = NULL; size_t cipher_bytes = 0; @@ -44,28 +44,28 @@ main (int argc, char **argv) if (b == MAP_FAILED) error (1, errno, "mmap"); - tpk = sq_tpk_from_bytes (&err, b, st.st_size); + tpk = pgp_tpk_from_bytes (&err, b, st.st_size); if (tpk == NULL) - error (1, 0, "sq_packet_parser_from_bytes: %s", sq_error_string (err)); + error (1, 0, "pgp_packet_parser_from_bytes: %s", pgp_error_string (err)); - sink = sq_writer_alloc (&cipher, &cipher_bytes); + sink = pgp_writer_alloc (&cipher, &cipher_bytes); if (use_armor) - sink = sq_armor_writer_new (&err, sink, SQ_ARMOR_KIND_MESSAGE, + sink = pgp_armor_writer_new (&err, sink, PGP_ARMOR_KIND_MESSAGE, NULL, 0); - writer = sq_writer_stack_message (sink); - writer = sq_encryptor_new (&err, + writer = pgp_writer_stack_message (sink); + writer = pgp_encryptor_new (&err, writer, NULL, 0, /* no passwords */ &tpk, 1, - SQ_ENCRYPTION_MODE_FOR_TRANSPORT); + PGP_ENCRYPTION_MODE_FOR_TRANSPORT); if (writer == NULL) - error (1, 0, "sq_encryptor_new: %s", sq_error_string (err)); + error (1, 0, "pgp_encryptor_new: %s", pgp_error_string (err)); - writer = sq_literal_writer_new (&err, writer); + writer = pgp_literal_writer_new (&err, writer); if (writer == NULL) - error (1, 0, "sq_literal_writer_new: %s", sq_error_string (err)); + error (1, 0, "pgp_literal_writer_new: %s", pgp_error_string (err)); size_t nread; uint8_t buf[4096]; @@ -75,19 +75,19 @@ main (int argc, char **argv) while (nread) { ssize_t written; - written = sq_writer_stack_write (&err, writer, b, nread); + written = pgp_writer_stack_write (&err, writer, b, nread); if (written < 0) - error (1, 0, "sq_writer_stack_write: %s", sq_error_string (err)); + error (1, 0, "pgp_writer_stack_write: %s", pgp_error_string (err)); b += written; nread -= written; } } - rc = sq_writer_stack_finalize (&err, writer); + rc = pgp_writer_stack_finalize (&err, writer); writer = NULL; if (rc) - error (1, 0, "sq_writer_stack_write: %s", sq_error_string (err)); + error (1, 0, "pgp_writer_stack_write: %s", pgp_error_string (err)); fwrite (cipher, 1, cipher_bytes, stdout); diff --git a/openpgp-ffi/examples/example.c b/openpgp-ffi/examples/example.c index ac23ff57..4d00876d 100644 --- a/openpgp-ffi/examples/example.c +++ b/openpgp-ffi/examples/example.c @@ -16,8 +16,8 @@ main (int argc, char **argv) struct stat st; int fd; uint8_t *b; - sq_error_t err; - sq_tpk_t tpk; + pgp_error_t err; + pgp_tpk_t tpk; if (argc != 2) error (1, 0, "Usage: %s <file>", argv[0]); @@ -33,12 +33,12 @@ main (int argc, char **argv) if (b == MAP_FAILED) error (1, errno, "mmap"); - tpk = sq_tpk_from_bytes (&err, b, st.st_size); + tpk = pgp_tpk_from_bytes (&err, b, st.st_size); if (tpk == NULL) - error (1, 0, "sq_tpk_from_bytes: %s", sq_error_string (err)); + error (1, 0, "pgp_tpk_from_bytes: %s", pgp_error_string (err)); - sq_tpk_dump (tpk); - sq_tpk_free (tpk); + pgp_tpk_dump (tpk); + pgp_tpk_free (tpk); munmap (b, st.st_size); close (fd); return 0; diff --git a/openpgp-ffi/examples/parser.c b/openpgp-ffi/examples/parser.c index 81b097af..3f9d90ab 100644 --- a/openpgp-ffi/examples/parser.c +++ b/openpgp-ffi/examples/parser.c @@ -20,10 +20,10 @@ main (int argc, char **argv) struct stat st; int fd; uint8_t *b; - sq_status_t rc; - sq_error_t err; - sq_packet_parser_result_t ppr; - sq_packet_parser_t pp; + pgp_status_t rc; + pgp_error_t err; + pgp_packet_parser_result_t ppr; + pgp_packet_parser_t pp; if (argc != 2) error (1, 0, "Usage: %s <file>", argv[0]); @@ -45,23 +45,23 @@ main (int argc, char **argv) time_t elapsed; size_t tens_of_s = 0; - ppr = sq_packet_parser_from_bytes (&err, b, st.st_size); - while (ppr && (pp = sq_packet_parser_result_packet_parser (ppr))) + ppr = pgp_packet_parser_from_bytes (&err, b, st.st_size); + while (ppr && (pp = pgp_packet_parser_result_packet_parser (ppr))) { // Get a reference to the packet that is currently being parsed. - sq_packet_t p = sq_packet_parser_packet (pp); + pgp_packet_t p = pgp_packet_parser_packet (pp); - if (sq_packet_tag(p) == SQ_TAG_LITERAL) + if (pgp_packet_tag(p) == PGP_TAG_LITERAL) { // Stream the packet here. } // Finish parsing the current packet (returned in p), and read // the header of the next packet (returned in ppr). - rc = sq_packet_parser_next (&err, pp, &p, &ppr); + rc = pgp_packet_parser_next (&err, pp, &p, &ppr); if (rc) - error (1, 0, "sq_packet_parser_from_bytes: %s", - sq_error_string (err)); + error (1, 0, "pgp_packet_parser_from_bytes: %s", + pgp_error_string (err)); // We now own p. If we want, we can save it in some structure. // This would be useful when collecting PKESK packets. Either @@ -69,7 +69,7 @@ main (int argc, char **argv) n += 1; - sq_packet_free (p); + pgp_packet_free (p); elapsed = time (NULL) - start; if (elapsed % 10 == 0 && tens_of_s != elapsed / 10) @@ -82,12 +82,12 @@ main (int argc, char **argv) } } if (ppr == NULL) - error (1, 0, "sq_packet_parser_from_bytes: %s", sq_error_string (err)); + error (1, 0, "pgp_packet_parser_from_bytes: %s", pgp_error_string (err)); fprintf (stderr, "Parsed %ld packets in %ld seconds, %.2f packets/s.\n", n, elapsed, (double) n / (double) elapsed); - sq_packet_parser_result_free (ppr); + pgp_packet_parser_result_free (ppr); munmap (b, st.st_size); return 0; } diff --git a/openpgp-ffi/examples/reader.c b/openpgp-ffi/examples/reader.c index 019d87d9..f8a69adf 100644 --- a/openpgp-ffi/examples/reader.c +++ b/openpgp-ffi/examples/reader.c @@ -16,9 +16,9 @@ main (int argc, char **argv) struct stat st; int fd; uint8_t *b; - sq_error_t err; - sq_reader_t reader; - sq_tpk_t tpk; + pgp_error_t err; + pgp_reader_t reader; + pgp_tpk_t tpk; if (argc != 2) error (1, 0, "Usage: %s <file>", argv[0]); @@ -34,14 +34,14 @@ main (int argc, char **argv) if (b == MAP_FAILED) error (1, errno, "mmap"); - reader = sq_reader_from_bytes (b, st.st_size); - tpk = sq_tpk_from_reader (&err, reader); + reader = pgp_reader_from_bytes (b, st.st_size); + tpk = pgp_tpk_from_reader (&err, reader); if (tpk == NULL) - error (1, 0, "sq_tpk_from_reader: %s", sq_error_string (err)); + error (1, 0, "pgp_tpk_from_reader: %s", pgp_error_string (err)); - sq_tpk_dump (tpk); - sq_tpk_free (tpk); - sq_reader_free (reader); + pgp_tpk_dump (tpk); + pgp_tpk_free (tpk); + pgp_reader_free (reader); munmap (b, st.st_size); close (fd); return 0; diff --git a/openpgp-ffi/include/sequoia/io.h b/openpgp-ffi/include/sequoia/io.h index c84de166..75036da1 100644 --- a/openpgp-ffi/include/sequoia/io.h +++ b/openpgp-ffi/include/sequoia/io.h @@ -6,56 +6,56 @@ /*/ /// A generic reader. /*/ -typedef struct sq_reader *sq_reader_t; +typedef struct pgp_reader *pgp_reader_t; /*/ /// Opens a file returning a reader. /*/ -sq_reader_t sq_reader_from_file (sq_error_t *errp, const char *filename); +pgp_reader_t pgp_reader_from_file (pgp_error_t *errp, const char *filename); /*/ /// Opens a file descriptor returning a reader. /*/ -sq_reader_t sq_reader_from_fd (int fd); +pgp_reader_t pgp_reader_from_fd (int fd); /*/ /// Creates a reader from a buffer. /*/ -sq_reader_t sq_reader_from_bytes (const uint8_t *buf, size_t len); +pgp_reader_t pgp_reader_from_bytes (const uint8_t *buf, size_t len); /*/ /// Frees a reader. /*/ -void sq_reader_free (sq_reader_t reader); +void pgp_reader_free (pgp_reader_t reader); /*/ /// Reads up to `len` bytes into `buf`. /*/ -ssize_t sq_reader_read (sq_error_t *errp, sq_reader_t reader, +ssize_t pgp_reader_read (pgp_error_t *errp, pgp_reader_t reader, uint8_t *buf, size_t len); /*/ /// A generic writer. /*/ -typedef struct sq_writer *sq_writer_t; +typedef struct pgp_writer *pgp_writer_t; /*/ /// Opens a file returning a writer. /// /// The file will be created if it does not exist, or be truncated -/// otherwise. If you need more control, use `sq_writer_from_fd`. +/// otherwise. If you need more control, use `pgp_writer_from_fd`. /*/ -sq_writer_t sq_writer_from_file (sq_error_t *errp, const char *filename); +pgp_writer_t pgp_writer_from_file (pgp_error_t *errp, const char *filename); /*/ /// Opens a file descriptor returning a writer. /*/ -sq_writer_t sq_writer_from_fd (int fd); +pgp_writer_t pgp_writer_from_fd (int fd); /*/ /// Creates a writer from a buffer. /*/ -sq_writer_t sq_writer_from_bytes (uint8_t *buf, size_t len); +pgp_writer_t pgp_writer_from_bytes (uint8_t *buf, size_t len); /*/ /// Creates an allocating writer. @@ -67,17 +67,17 @@ sq_writer_t sq_writer_from_bytes (uint8_t *buf, size_t len); /// The caller is responsible to `free` it once the writer has been /// destroyed. /*/ -sq_writer_t sq_writer_alloc (void **buf, size_t *len); +pgp_writer_t pgp_writer_alloc (void **buf, size_t *len); /*/ /// Frees a writer. /*/ -void sq_writer_free (sq_writer_t writer); +void pgp_writer_free (pgp_writer_t writer); /*/ /// Writes up to `len` bytes of `buf` into `writer`. /*/ -ssize_t sq_writer_write (sq_error_t *errp, sq_writer_t writer, +ssize_t pgp_writer_write (pgp_error_t *errp, pgp_writer_t writer, const uint8_t *buf, size_t len); #endif diff --git a/openpgp-ffi/include/sequoia/openpgp.h b/openpgp-ffi/include/sequoia/openpgp.h index ddc6ed5a..368eab2e 100644 --- a/openpgp-ffi/include/sequoia/openpgp.h +++ b/openpgp-ffi/include/sequoia/openpgp.h @@ -29,65 +29,65 @@ /// recurse into the packet, if it is a container, instead of getting /// the following packet. /*/ -typedef struct sq_packet_parser *sq_packet_parser_t; +typedef struct pgp_packet_parser *pgp_packet_parser_t; /*/ /// Like an `Option<PacketParser>`, but the `None` variant /// (`PacketParserEOF`) contains some summary information. /*/ -typedef struct sq_packet_parser_result *sq_packet_parser_result_t; +typedef struct pgp_packet_parser_result *pgp_packet_parser_result_t; /*/ /// The `None` variant of a `PacketParserResult`. /*/ -typedef struct sq_packet_parser_eof *sq_packet_parser_eof_t; +typedef struct pgp_packet_parser_eof *pgp_packet_parser_eof_t; /* sequoia::openpgp::KeyID. */ /*/ /// Holds a KeyID. /*/ -typedef struct sq_keyid *sq_keyid_t; +typedef struct pgp_keyid *pgp_keyid_t; /*/ /// Reads a binary key ID. /*/ -sq_keyid_t sq_keyid_from_bytes (const uint8_t *id); +pgp_keyid_t pgp_keyid_from_bytes (const uint8_t *id); /*/ /// Reads a hex-encoded Key ID. /*/ -sq_keyid_t sq_keyid_from_hex (const char *id); +pgp_keyid_t pgp_keyid_from_hex (const char *id); /*/ -/// Frees a sq_keyid_t. +/// Frees a pgp_keyid_t. /*/ -void sq_keyid_free (sq_keyid_t keyid); +void pgp_keyid_free (pgp_keyid_t keyid); /*/ /// Clones the KeyID. /*/ -sq_keyid_t sq_keyid_clone (sq_keyid_t keyid); +pgp_keyid_t pgp_keyid_clone (pgp_keyid_t keyid); /*/ /// Hashes the KeyID. /*/ -uint64_t sq_keyid_hash (sq_keyid_t keyid); +uint64_t pgp_keyid_hash (pgp_keyid_t keyid); /*/ /// Converts the KeyID to its standard representation. /*/ -char *sq_keyid_to_string (const sq_keyid_t fp); +char *pgp_keyid_to_string (const pgp_keyid_t fp); /*/ /// Converts the KeyID to a hexadecimal number. /*/ -char *sq_keyid_to_hex (const sq_keyid_t keyid); +char *pgp_keyid_to_hex (const pgp_keyid_t keyid); /*/ /// Compares KeyIDs. /*/ -int sq_keyid_equal (const sq_keyid_t a, const sq_keyid_t b); +int pgp_keyid_equal (const pgp_keyid_t a, const pgp_keyid_t b); /* sequoia::openpgp::Fingerprint. */ @@ -95,32 +95,32 @@ int sq_keyid_equal (const sq_keyid_t a, const sq_keyid_t b); /*/ /// Holds a fingerprint. /*/ -typedef struct sq_fingerprint *sq_fingerprint_t; +typedef struct pgp_fingerprint *pgp_fingerprint_t; /*/ /// Reads a binary fingerprint. /*/ -sq_fingerprint_t sq_fingerprint_from_bytes (const uint8_t *buf, size_t len); +pgp_fingerprint_t pgp_fingerprint_from_bytes (const uint8_t *buf, size_t len); /*/ /// Reads a hexadecimal fingerprint. /*/ -sq_fingerprint_t sq_fingerprint_from_hex (const char *hex); +pgp_fingerprint_t pgp_fingerprint_from_hex (const char *hex); /*/ -/// Frees a sq_fingerprint_t. +/// Frees a pgp_fingerprint_t. /*/ -void sq_fingerprint_free (sq_fingerprint_t fp); +void pgp_fingerprint_free (pgp_fingerprint_t fp); /*/ /// Clones the Fingerprint. /*/ -sq_fingerprint_t sq_fingerprint_clone (sq_fingerprint_t fingerprint); +pgp_fingerprint_t pgp_fingerprint_clone (pgp_fingerprint_t fingerprint); /*/ /// Hashes the Fingerprint. /*/ -uint64_t sq_fingerprint_hash (sq_fingerprint_t fingerprint); +uint64_t pgp_fingerprint_hash (pgp_fingerprint_t fingerprint); /*/ /// Returns a reference to the raw Fingerprint. @@ -128,43 +128,43 @@ uint64_t sq_fingerprint_hash (sq_fingerprint_t fingerprint); /// This returns a reference to the internal buffer that is valid as /// long as the fingerprint is. /*/ -uint8_t *sq_fingerprint_as_bytes (const sq_fingerprint_t fp, size_t *fp_len); +uint8_t *pgp_fingerprint_as_bytes (const pgp_fingerprint_t fp, size_t *fp_len); /*/ /// Converts the fingerprint to its standard representation. /*/ -char *sq_fingerprint_to_string (const sq_fingerprint_t fp); +char *pgp_fingerprint_to_string (const pgp_fingerprint_t fp); /*/ /// Converts the fingerprint to a hexadecimal number. /*/ -char *sq_fingerprint_to_hex (const sq_fingerprint_t fp); +char *pgp_fingerprint_to_hex (const pgp_fingerprint_t fp); /*/ /// Converts the fingerprint to a key ID. /*/ -sq_keyid_t sq_fingerprint_to_keyid (const sq_fingerprint_t fp); +pgp_keyid_t pgp_fingerprint_to_keyid (const pgp_fingerprint_t fp); /*/ /// Compares Fingerprints. /*/ -int sq_fingerprint_equal (const sq_fingerprint_t a, const sq_fingerprint_t b); +int pgp_fingerprint_equal (const pgp_fingerprint_t a, const pgp_fingerprint_t b); /* sequoia::openpgp::RevocationStatus. */ /*/ /// Holds a revocation status. /*/ -typedef struct sq_revocation_status *sq_revocation_status_t; +typedef struct pgp_revocation_status *pgp_revocation_status_t; -typedef enum sq_revocation_status_variant { +typedef enum pgp_revocation_status_variant { /*/ /// The key is definitely revoked. /// /// All self-revocations are returned, the most recent revocation /// first. /*/ - SQ_REVOCATION_STATUS_REVOKED, + PGP_REVOCATION_STATUS_REVOKED, /*/ /// We have a third-party revocation certificate that is allegedly @@ -174,30 +174,30 @@ typedef enum sq_revocation_status_variant { /// All such certificates are returned. The caller must check /// them manually. /*/ - SQ_REVOCATION_STATUS_COULD_BE, + PGP_REVOCATION_STATUS_COULD_BE, /*/ /// The key does not appear to be revoked, but perhaps an attacker /// has performed a DoS, which prevents us from seeing the /// revocation certificate. /*/ - SQ_REVOCATION_STATUS_NOT_AS_FAR_AS_WE_KNOW, + PGP_REVOCATION_STATUS_NOT_AS_FAR_AS_WE_KNOW, /* Dummy value to make sure the enumeration has a defined size. Do not use this value. */ - SQ_REVOCATION_STATUS_FORCE_WIDTH = INT_MAX, -} sq_revocation_status_variant_t; + PGP_REVOCATION_STATUS_FORCE_WIDTH = INT_MAX, +} pgp_revocation_status_variant_t; /*/ /// Returns the revocation status's variant. /*/ -sq_revocation_status_varia |