summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-01-17 17:54:30 +0100
committerJustus Winter <justus@sequoia-pgp.org>2019-01-17 17:54:30 +0100
commit72f7f83fa697ac44d962dc65ef9329dcfe6fd3e8 (patch)
tree3b2af100212cee4ae26e548d0535db705e5f616d
parent3f58832474a4b270e136544016a401ef773ac065 (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
-rw-r--r--ffi/examples/configure.c12
-rw-r--r--ffi/examples/keyserver.c24
-rw-r--r--ffi/include/sequoia/core.h6
-rw-r--r--ffi/include/sequoia/net.h8
-rw-r--r--ffi/include/sequoia/store.h38
-rw-r--r--ffi/lang/python/sequoia/core.py22
-rw-r--r--ffi/lang/python/sequoia/error.py26
-rw-r--r--ffi/lang/python/sequoia/glue.py2
-rw-r--r--ffi/lang/python/sequoia/openpgp.py172
-rw-r--r--ffi/lang/python/sequoia/store.py4
-rw-r--r--ffi/src/lib.rs10
-rw-r--r--ffi/src/net.rs6
-rw-r--r--ffi/src/store.rs4
-rw-r--r--openpgp-ffi/examples/armor.c30
-rw-r--r--openpgp-ffi/examples/encrypt-for.c38
-rw-r--r--openpgp-ffi/examples/example.c12
-rw-r--r--openpgp-ffi/examples/parser.c28
-rw-r--r--openpgp-ffi/examples/reader.c18
-rw-r--r--openpgp-ffi/include/sequoia/io.h28
-rw-r--r--openpgp-ffi/include/sequoia/openpgp.h810
-rw-r--r--openpgp-ffi/include/sequoia/openpgp/crypto.h16
-rw-r--r--openpgp-ffi/include/sequoia/openpgp/error.h58
-rw-r--r--openpgp-ffi/src/armor.rs72
-rw-r--r--openpgp-ffi/src/common.rs166
-rw-r--r--openpgp-ffi/src/crypto.rs8
-rw-r--r--openpgp-ffi/src/error.rs6
-rw-r--r--openpgp-ffi/src/fingerprint.rs22
-rw-r--r--openpgp-ffi/src/io.rs24
-rw-r--r--openpgp-ffi/src/keyid.rs22
-rw-r--r--openpgp-ffi/src/lib.rs10
-rw-r--r--openpgp-ffi/src/packet_pile.rs16
-rw-r--r--openpgp-ffi/src/tpk.rs202
-rw-r--r--openpgp-ffi/src/tsk.rs10
33 files changed, 965 insertions, 965 deletions
diff --git a/ffi/examples/configure.c b/ffi/examples/configure.c
index f0192f87..9e986613 100644
--- a/ffi/examples/configure.c
+++ b/ffi/examples/configure.c
@@ -10,7 +10,7 @@
int
main (int argc, char **argv)
{
- sq_error_t err;
+ pgp_error_t err;
sq_config_t cfg;
sq_context_t ctx;
sq_keyserver_t ks;
@@ -20,18 +20,18 @@ main (int argc, char **argv)
ctx = sq_config_build (cfg, &err);
if (ctx == NULL)
error (1, 0, "Initializing sequoia failed: %s",
- sq_error_string (err));
+ pgp_error_string (err));
ks = sq_keyserver_sks_pool (ctx);
if (ks == NULL)
{
- sq_error_t err = sq_context_last_error (ctx);
- assert (sq_error_status (err) == SQ_STATUS_NETWORK_POLICY_VIOLATION);
- char *msg = sq_error_string (err);
+ pgp_error_t err = sq_context_last_error (ctx);
+ assert (pgp_error_status (err) == PGP_STATUS_NETWORK_POLICY_VIOLATION);
+ char *msg = pgp_error_string (err);
error (0, 0, "Initializing KeyServer failed as expected: %s",
msg);
free (msg);
- sq_error_free (err);
+ pgp_error_free (err);
}
else
error (1, 0, "This should not be allowed");
diff --git a/ffi/examples/keyserver.c b/ffi/examples/keyserver.c
index fbc6fe9a..25c72696 100644
--- a/ffi/examples/keyserver.c
+++ b/ffi/examples/keyserver.c
@@ -8,35 +8,35 @@
int
main (int argc, char **argv)
{
- sq_error_t err;
+ pgp_error_t err;
sq_context_t ctx;
- sq_keyid_t id;
+ pgp_keyid_t id;
sq_keyserver_t ks;
- sq_tpk_t tpk;
+ pgp_tpk_t tpk;
ctx = sq_context_new ("org.sequoia-pgp.example", &err);
if (ctx == NULL)
error (1, 0, "Initializing sequoia failed: %s",
- sq_error_string (err));
+ pgp_error_string (err));
ks = sq_keyserver_sks_pool (ctx);
if (ks == NULL)
{
- sq_error_t err = sq_context_last_error (ctx);
- error (1, 0, "Initializing Keyserver failed: %s", sq_error_string (err));
+ pgp_error_t err = sq_context_last_error (ctx);
+ error (1, 0, "Initializing Keyserver failed: %s", pgp_error_string (err));
}
- id = sq_keyid_from_bytes ((uint8_t *) "\x24\x7F\x6D\xAB\xC8\x49\x14\xFE");
+ id = pgp_keyid_from_bytes ((uint8_t *) "\x24\x7F\x6D\xAB\xC8\x49\x14\xFE");
tpk = sq_keyserver_get (ctx, ks, id);
if (tpk == NULL)
{
- sq_error_t err = sq_context_last_error (ctx);
- error (1, 0, "Failed to retrieve key: %s", sq_error_string (err));
+ pgp_error_t err = sq_context_last_error (ctx);
+ error (1, 0, "Failed to retrieve key: %s", pgp_error_string (err));
}
- sq_tpk_dump (tpk);
- sq_tpk_free (tpk);
- sq_keyid_free (id);
+ pgp_tpk_dump (tpk);
+ pgp_tpk_free (tpk);
+ pgp_keyid_free (id);
sq_keyserver_free (ks);
sq_context_free (ctx);
return 0;
diff --git a/ffi/include/sequoia/core.h b/ffi/include/sequoia/core.h
index 0d2ea3cd..d34f8985 100644
--- a/ffi/include/sequoia/core.h
+++ b/ffi/include/sequoia/core.h
@@ -25,7 +25,7 @@ typedef struct sq_context *sq_context_t;
///
/// Returns and removes the last error from the context.
/*/
-sq_error_t sq_context_last_error (sq_context_t ctx);
+pgp_error_t sq_context_last_error (sq_context_t ctx);
/*/
/// Represents a `Context` configuration.
@@ -132,7 +132,7 @@ typedef enum sq_ipc_policy {
/// Returns `NULL` on errors. If `errp` is not `NULL`, the error is
/// stored there.
/*/
-sq_context_t sq_context_new(const char *domain, sq_error_t *errp);
+sq_context_t sq_context_new(const char *domain, pgp_error_t *errp);
/*/
/// Frees a context.
@@ -191,7 +191,7 @@ uint8_t sq_context_ephemeral(const sq_context_t ctx);
/// Consumes `cfg`. Returns `NULL` on errors. Returns `NULL` on
/// errors. If `errp` is not `NULL`, the error is stored there.
/*/
-sq_context_t sq_config_build(sq_config_t cfg, sq_error_t *errp);
+sq_context_t sq_config_build(sq_config_t cfg, pgp_error_t *errp);
/*/
/// Sets the directory containing shared state.
diff --git a/ffi/include/sequoia/net.h b/ffi/include/sequoia/net.h
index 414d50d5..4e2f030b 100644
--- a/ffi/include/sequoia/net.h
+++ b/ffi/include/sequoia/net.h
@@ -54,17 +54,17 @@ void sq_keyserver_free (sq_keyserver_t ks);
///
/// Returns `NULL` on errors.
/*/
-sq_tpk_t sq_keyserver_get (sq_context_t ctx,
+pgp_tpk_t sq_keyserver_get (sq_context_t ctx,
sq_keyserver_t ks,
- const sq_keyid_t id);
+ const pgp_keyid_t id);
/*/
/// Sends the given key to the server.
///
/// Returns != 0 on errors.
/*/
-sq_status_t sq_keyserver_send (sq_context_t ctx,
+pgp_status_t sq_keyserver_send (sq_context_t ctx,
sq_keyserver_t ks,
- const sq_tpk_t tpk);
+ const pgp_tpk_t tpk);
#endif
diff --git a/ffi/include/sequoia/store.h b/ffi/include/sequoia/store.h
index 926b80fd..343e52ab 100644
--- a/ffi/include/sequoia/store.h
+++ b/ffi/include/sequoia/store.h
@@ -186,7 +186,7 @@ typedef struct sq_binding_iter *sq_binding_iter_t;
/*/
sq_binding_t sq_binding_iter_next (sq_binding_iter_t iter,
char **labelp,
- sq_fingerprint_t *fpp);
+ pgp_fingerprint_t *fpp);
/*/
/// Frees a sq_binding_iter_t.
@@ -205,7 +205,7 @@ typedef struct sq_key_iter *sq_key_iter_t;
/// fingerprint is stored there.
/*/
sq_key_t sq_key_iter_next (sq_key_iter_t iter,
- sq_fingerprint_t *fpp);
+ pgp_fingerprint_t *fpp);
/*/
/// Frees a sq_key_iter_t.
@@ -258,13 +258,13 @@ sq_store_t sq_store_open (sq_context_t ctx, const char *name);
/// Adds a key identified by fingerprint to the store.
/*/
sq_binding_t sq_store_add (sq_context_t ctx, sq_store_t store,
- const char *label, sq_fingerprint_t fp);
+ const char *label, pgp_fingerprint_t fp);
/*/
/// Imports a key into the store.
/*/
-sq_tpk_t sq_store_import (sq_context_t ctx, sq_store_t store,
- const char *label, sq_tpk_t tpk);
+pgp_tpk_t sq_store_import (sq_context_t ctx, sq_store_t store,
+ const char *label, pgp_tpk_t tpk);
/*/
/// Returns the binding for the given label.
@@ -275,19 +275,19 @@ sq_binding_t sq_store_lookup (sq_context_t ctx, sq_store_t store,
/*/
/// Looks up a key in the common key pool by KeyID.
/*/
-sq_key_t sq_store_lookup_by_keyid (sq_context_t ctx, sq_keyid_t keyid);
+sq_key_t sq_store_lookup_by_keyid (sq_context_t ctx, pgp_keyid_t keyid);
/*/
/// Looks up a key in the common key pool by (Sub)KeyID.
/*/
-sq_key_t sq_store_lookup_by_subkeyid (sq_context_t ctx, sq_keyid_t keyid);
+sq_key_t sq_store_lookup_by_subkeyid (sq_context_t ctx, pgp_keyid_t keyid);
/*/
/// Deletes this store.
///
/// Consumes `store`. Returns != 0 on error.
/*/
-sq_status_t sq_store_delete (sq_store_t store);
+pgp_status_t sq_store_delete (sq_store_t store);
/*/
/// Lists all bindings.
@@ -310,9 +310,9 @@ sq_stats_t sq_binding_stats (sq_context_t ctx, sq_binding_t binding);
sq_key_t sq_binding_key (sq_context_t ctx, sq_binding_t binding);
/*/
-/// Returns the `sq_tpk_t` of this binding.
+/// Returns the `pgp_tpk_t` of this binding.
/*/
-sq_tpk_t sq_binding_tpk (sq_context_t ctx, sq_binding_t binding);
+pgp_tpk_t sq_binding_tpk (sq_context_t ctx, sq_binding_t binding);
/*/
/// Updates this binding with the given TPK.
@@ -332,8 +332,8 @@ sq_tpk_t sq_binding_tpk (sq_context_t ctx, sq_binding_t binding);
/// conflict, either by ignoring the new key, or by using
/// `sq_binding_rotate` to force a rotation.
/*/
-sq_tpk_t sq_binding_import (sq_context_t ctx, sq_binding_t binding,
- sq_tpk_t tpk);
+pgp_tpk_t sq_binding_import (sq_context_t ctx, sq_binding_t binding,
+ pgp_tpk_t tpk);
/*/
/// Forces a keyrotation to the given TPK.
@@ -350,15 +350,15 @@ sq_tpk_t sq_binding_import (sq_context_t ctx, sq_binding_t binding,
/// You could simply ask Alice to call her communication partner
/// Bob and confirm that he rotated his keys.
/*/
-sq_tpk_t sq_binding_rotate (sq_context_t ctx, sq_binding_t binding,
- sq_tpk_t tpk);
+pgp_tpk_t sq_binding_rotate (sq_context_t ctx, sq_binding_t binding,
+ pgp_tpk_t tpk);
/*/
/// Deletes this binding.
///
/// Consumes `binding`. Returns != 0 on error.
/*/
-sq_status_t sq_binding_delete (sq_context_t ctx, sq_binding_t binding);
+pgp_status_t sq_binding_delete (sq_context_t ctx, sq_binding_t binding);
/*/
/// Lists all log entries related to this binding.
@@ -371,9 +371,9 @@ sq_log_iter_t sq_binding_log (sq_context_t ctx, sq_binding_t binding);
sq_stats_t sq_key_stats (sq_context_t ctx, sq_key_t key);
/*/
-/// Returns the `sq_tpk_t` of this key.
+/// Returns the `pgp_tpk_t` of this key.
/*/
-sq_tpk_t sq_key_tpk (sq_context_t ctx, sq_key_t key);
+pgp_tpk_t sq_key_tpk (sq_context_t ctx, sq_key_t key);
/*/
/// Updates this stored key with the given TPK.
@@ -386,8 +386,8 @@ sq_tpk_t sq_key_tpk (sq_context_t ctx, sq_key_t key);
/// If the new key does not match the current key,
/// `Error::Conflict` is returned.
/*/
-sq_tpk_t sq_key_import (sq_context_t ctx, sq_key_t key,
- sq_tpk_t tpk);
+pgp_tpk_t sq_key_import (sq_context_t ctx, sq_key_t key,
+ pgp_tpk_t tpk);
/*/
/// Lists all log entries related to this key.
diff --git a/ffi/lang/python/sequoia/core.py b/ffi/lang/python/sequoia/core.py
index 117e1207..a7e12808 100644
--- a/ffi/lang/python/sequoia/core.py
+++ b/ffi/lang/python/sequoia/core.py
@@ -30,14 +30,14 @@ class Context(SQObject):
lib.sq_config_ipc_policy(cfg, ipc_policy.value)
if ephemeral:
lib.sq_config_ephemeral(cfg)
- err = ffi.new("sq_error_t[1]")
+ err = ffi.new("pgp_error_t[1]")
o = lib.sq_config_build(cfg, err)
if o == ffi.NULL:
raise Error._from(err[0])
super(Context, self).__init__(o)
class AbstractReader(SQObject, io.RawIOBase):
- _del = lib.sq_reader_free
+ _del = lib.pgp_reader_free
def readable(self):
return True
@@ -46,7 +46,7 @@ class AbstractReader(SQObject, io.RawIOBase):
def readinto(self, buf):
return invoke(
- lib.sq_reader_read,
+ lib.pgp_reader_read,
self.ref(),
ffi.cast("uint8_t *", ffi.from_buffer(buf)),
len(buf))
@@ -65,24 +65,24 @@ class Reader(AbstractReader):
@classmethod
def open(cls, ctx, filename):
return Reader(
- invoke(lib.sq_reader_from_file,
+ invoke(lib.pgp_reader_from_file,
filename.encode()),
context=ctx)
@classmethod
def from_fd(cls, ctx, fd):
- return Reader(lib.sq_reader_from_fd(fd),
+ return Reader(lib.pgp_reader_from_fd(fd),
context=ctx)
@classmethod
def from_bytes(cls, ctx, buf):
return Reader(
- lib.sq_reader_from_bytes(
+ lib.pgp_reader_from_bytes(
ffi.cast("uint8_t *", ffi.from_buffer(buf)), len(buf)),
context=ctx)
class AbstractWriter(SQObject, io.RawIOBase):
- _del = lib.sq_writer_free
+ _del = lib.pgp_writer_free
def readable(self):
return False
@@ -91,7 +91,7 @@ class AbstractWriter(SQObject, io.RawIOBase):
def write(self, buf):
return invoke(
- lib.sq_writer_write,
+ lib.pgp_writer_write,
self.ref(),
ffi.cast("const uint8_t *", ffi.from_buffer(buf)),
len(buf))
@@ -110,18 +110,18 @@ class Writer(AbstractWriter):
@classmethod
def open(cls, ctx, filename):
return Writer(
- invoke(lib.sq_writer_from_file,
+ invoke(lib.pgp_writer_from_file,
filename.encode()),
context=ctx)
@classmethod
def from_fd(cls, ctx, fd):
- return Writer(lib.sq_writer_from_fd(fd),
+ return Writer(lib.pgp_writer_from_fd(fd),
context=ctx)
@classmethod
def from_bytes(cls, ctx, buf):
return Writer(
- lib.sq_writer_from_bytes(
+ lib.pgp_writer_from_bytes(
ffi.cast("uint8_t *", ffi.from_buffer(buf)), len(buf)),
context=ctx)
diff --git a/ffi/lang/python/sequoia/error.py b/ffi/lang/python/sequoia/error.py
index 29eb2545..192b7d18 100644
--- a/ffi/lang/python/sequoia/error.py
+++ b/ffi/lang/python/sequoia/error.py
@@ -7,7 +7,7 @@ class Error(Exception):
if o == ffi.NULL:
return MalformedValue()
- status = lib.sq_error_status(o)
+ status = lib.pgp_error_status(o)
return _status_map[status](o)
@classmethod
@@ -22,8 +22,8 @@ class MalformedValue(Error, ValueError):
class SQError(Error):
def __init__(self, o):
- self.__o = ffi.gc(o, lib.sq_error_free)
- super(SQError, self).__init__(sq_str(lib.sq_error_string(self.__o)))
+ self.__o = ffi.gc(o, lib.pgp_error_free)
+ super(SQError, self).__init__(sq_str(lib.pgp_error_string(self.__o)))
class Success(SQError):
pass
@@ -56,14 +56,14 @@ class InvalidSessionKey(SQError):
pass
_status_map = {
- lib.SQ_STATUS_SUCCESS: Success,
- lib.SQ_STATUS_UNKNOWN_ERROR: UnknownError,
- lib.SQ_STATUS_NETWORK_POLICY_VIOLATION: NetworkPolicyViolation,
- lib.SQ_STATUS_IO_ERROR: IoError,
- lib.SQ_STATUS_INVALID_OPERATION: InvalidOperataion,
- lib.SQ_STATUS_MALFORMED_PACKET: MalformedPacket,
- lib.SQ_STATUS_UNSUPPORTED_HASH_ALGORITHM: UnsupportedHashAlgorithm,
- lib.SQ_STATUS_UNSUPPORTED_SYMMETRIC_ALGORITHM: UnsupportedSymmetricAlgorithm,
- lib.SQ_STATUS_INVALID_PASSWORD: InvalidPassword,
- lib.SQ_STATUS_INVALID_SESSION_KEY: InvalidSessionKey,
+ lib.PGP_STATUS_SUCCESS: Success,
+ lib.PGP_STATUS_UNKNOWN_ERROR: UnknownError,
+ lib.PGP_STATUS_NETWORK_POLICY_VIOLATION: NetworkPolicyViolation,
+ lib.PGP_STATUS_IO_ERROR: IoError,
+ lib.PGP_STATUS_INVALID_OPERATION: InvalidOperataion,
+ lib.PGP_STATUS_MALFORMED_PACKET: MalformedPacket,
+ lib.PGP_STATUS_UNSUPPORTED_HASH_ALGORITHM: UnsupportedHashAlgorithm,
+ lib.PGP_STATUS_UNSUPPORTED_SYMMETRIC_ALGORITHM: UnsupportedSymmetricAlgorithm,
+ lib.PGP_STATUS_INVALID_PASSWORD: InvalidPassword,
+ lib.PGP_STATUS_INVALID_SESSION_KEY: InvalidSessionKey,
}
diff --git a/ffi/lang/python/sequoia/glue.py b/ffi/lang/python/sequoia/glue.py
index 5bfd4aae..11468dfd 100644
--- a/ffi/lang/python/sequoia/glue.py
+++ b/