summaryrefslogtreecommitdiffstats
path: root/openpgp-ffi
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-03-18 12:44:36 +0100
committerJustus Winter <justus@sequoia-pgp.org>2019-03-18 14:03:58 +0100
commit01db33b99244294702f0f58f06c6736becee28db (patch)
tree0cedce9f950866e1f355787be82a712bcf581ac4 /openpgp-ffi
parentfc387f5c290774a39feff97cde31ea78300d2b23 (diff)
openpgp: Make hash algorithm configurable in streaming Signer.
- See #208.
Diffstat (limited to 'openpgp-ffi')
-rw-r--r--openpgp-ffi/include/sequoia/openpgp.h6
-rw-r--r--openpgp-ffi/src/serialize.rs10
2 files changed, 10 insertions, 6 deletions
diff --git a/openpgp-ffi/include/sequoia/openpgp.h b/openpgp-ffi/include/sequoia/openpgp.h
index 169b3d7a..b00cce91 100644
--- a/openpgp-ffi/include/sequoia/openpgp.h
+++ b/openpgp-ffi/include/sequoia/openpgp.h
@@ -1351,7 +1351,8 @@ pgp_writer_stack_t pgp_arbitrary_writer_new (pgp_error_t *errp,
/*/
pgp_writer_stack_t pgp_signer_new (pgp_error_t *errp,
pgp_writer_stack_t inner,
- pgp_signer_t *signers, size_t signers_len);
+ pgp_signer_t *signers, size_t signers_len,
+ uint8_t hash_algo);
/*/
/// Creates a signer for a detached signature.
@@ -1359,7 +1360,8 @@ pgp_writer_stack_t pgp_signer_new (pgp_error_t *errp,
pgp_writer_stack_t pgp_signer_new_detached (pgp_error_t *errp,
pgp_writer_stack_t inner,
pgp_signer_t *signers,
- size_t signers_len);
+ size_t signers_len,
+ uint8_t hash_algo);
/*/
/// Writes a literal data packet.
diff --git a/openpgp-ffi/src/serialize.rs b/openpgp-ffi/src/serialize.rs
index 362d2aa6..61e69a98 100644
--- a/openpgp-ffi/src/serialize.rs
+++ b/openpgp-ffi/src/serialize.rs
@@ -145,7 +145,8 @@ pub extern "system" fn pgp_signer_new
(errp: Option<&mut *mut ::error::Error>,
inner: *mut writer::Stack<'static, Cookie>,
signers: *const *mut Box<self::openpgp::crypto::Signer>,
- signers_len: size_t)
+ signers_len: size_t,
+ hash_algo: uint8_t)
-> *mut writer::Stack<'static, Cookie>
{
ffi_make_fry_from_errp!(errp);
@@ -160,7 +161,7 @@ pub extern "system" fn pgp_signer_new
ffi_param_ref_mut!(signer).as_mut()
}
).collect();
- ffi_try_box!(Signer::new(*inner, signers))
+ ffi_try_box!(Signer::new(*inner, signers, Some(hash_algo.into())))
}
/// Creates a signer for a detached signature.
@@ -169,7 +170,8 @@ pub extern "system" fn pgp_signer_new_detached
(errp: Option<&mut *mut ::error::Error>,
inner: *mut writer::Stack<'static, Cookie>,
signers: *const *mut Box<self::openpgp::crypto::Signer>,
- signers_len: size_t)
+ signers_len: size_t,
+ hash_algo: uint8_t)
-> *mut writer::Stack<'static, Cookie>
{
ffi_make_fry_from_errp!(errp);
@@ -184,7 +186,7 @@ pub extern "system" fn pgp_signer_new_detached
ffi_param_ref_mut!(signer).as_mut()
}
).collect();
- ffi_try_box!(Signer::detached(*inner, signers))
+ ffi_try_box!(Signer::detached(*inner, signers, Some(hash_algo.into())))
}
/// Writes a literal data packet.