Update for breaking changes in underlying rustc.

This should be a major version number since I changed public constants
in the ffi module. I'm not doing so as the invariant "will the constants
be meaningful to the underlying library" has not changed.

In general this library's version numbers do not map well to the
underlying library, which is as-yet not versioned at all, so users
need to always be running "the lastest" rust-secp256k1 anyway, and
semantic versioning can't really be used meaninfully. So this is a
bit of a judgement call.
This commit is contained in:
Andrew Poelstra 2015-10-25 18:26:08 -05:00
parent d49db8167e
commit f1e1da1213
4 changed files with 12 additions and 5 deletions

View File

@ -1,7 +1,7 @@
[package]
name = "secp256k1"
version = "0.3.2"
version = "0.3.3"
authors = [ "Dawid Ciężarkiewicz <dpc@ucore.info>",
"Andrew Poelstra <apoelstra@wpsoftware.net>" ]
license = "CC0-1.0"

View File

@ -19,10 +19,16 @@
use std::mem;
use libc::{c_int, c_uchar, c_uint, c_void, size_t};
/// Flag for context to enable no precomputation
pub const SECP256K1_START_NONE: c_uint = (1 << 0) | 0;
/// Flag for context to enable verification precomputation
pub const SECP256K1_START_VERIFY: c_uint = 0x1;
pub const SECP256K1_START_VERIFY: c_uint = (1 << 0) | (1 << 8);
/// Flag for context to enable signing precomputation
pub const SECP256K1_START_SIGN: c_uint = 0x2;
pub const SECP256K1_START_SIGN: c_uint = (1 << 0) | (1 << 9);
/// Flag for keys to indicate uncompressed serialization format
pub const SECP256K1_SER_UNCOMPRESSED: c_uint = (1 << 1) | 0;
/// Flag for keys to indicate compressed serialization format
pub const SECP256K1_SER_COMPRESSED: c_uint = (1 << 1) | (1 << 8);
/// A nonce generation function. Ordinary users of the library
/// never need to see this type; only if you need to control

View File

@ -160,9 +160,10 @@ impl PublicKey {
unsafe {
let mut ret_len = ret.len() as ::libc::size_t;
let compressed = if compressed { ffi::SECP256K1_SER_COMPRESSED } else { ffi::SECP256K1_SER_UNCOMPRESSED };
debug_assert!(ffi::secp256k1_ec_pubkey_serialize(secp.ctx, ret.as_ptr(),
&mut ret_len, self.as_ptr(),
if compressed {1} else {0}) == 1);
compressed) == 1);
ret.set_len(ret_len as usize);
}
ret

View File

@ -356,7 +356,7 @@ impl Secp256k1 {
/// Creates a new Secp256k1 context with the specified capabilities
pub fn with_caps(caps: ContextFlag) -> Secp256k1 {
let flag = match caps {
ContextFlag::None => 0,
ContextFlag::None => ffi::SECP256K1_START_NONE,
ContextFlag::SignOnly => ffi::SECP256K1_START_SIGN,
ContextFlag::VerifyOnly => ffi::SECP256K1_START_VERIFY,
ContextFlag::Full => ffi::SECP256K1_START_SIGN | ffi::SECP256K1_START_VERIFY