@@ -243,32 +243,51 @@ extern "C" {
243
243
//TODO secp256k1_ec_privkey_export
244
244
//TODO secp256k1_ec_privkey_import
245
245
246
+ #[ deprecated( since = "0.2.0" , note = "Please use the secp256k1_ec_seckey_tweak_add function instead" ) ]
246
247
#[ cfg_attr( not( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_2_0_ec_privkey_negate" ) ]
247
248
pub fn secp256k1_ec_privkey_negate ( cx : * const Context ,
248
249
sk : * mut c_uchar ) -> c_int ;
249
250
251
+ #[ cfg_attr( not( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_2_0_ec_privkey_negate" ) ]
252
+ pub fn secp256k1_ec_seckey_negate ( cx : * const Context ,
253
+ sk : * mut c_uchar ) -> c_int ;
254
+
250
255
#[ cfg_attr( not( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_2_0_ec_pubkey_negate" ) ]
251
256
pub fn secp256k1_ec_pubkey_negate ( cx : * const Context ,
252
257
pk : * mut PublicKey ) -> c_int ;
253
258
259
+ #[ deprecated( since = "0.2.0" , note = "Please use the secp256k1_ec_seckey_tweak_add function instead" ) ]
254
260
#[ cfg_attr( not( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_2_0_ec_privkey_tweak_add" ) ]
255
261
pub fn secp256k1_ec_privkey_tweak_add ( cx : * const Context ,
256
262
sk : * mut c_uchar ,
257
263
tweak : * const c_uchar )
258
264
-> c_int ;
259
265
266
+ #[ cfg_attr( not( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_2_0_ec_seckey_tweak_add" ) ]
267
+ pub fn secp256k1_ec_seckey_tweak_add ( cx : * const Context ,
268
+ sk : * mut c_uchar ,
269
+ tweak : * const c_uchar )
270
+ -> c_int ;
271
+
260
272
#[ cfg_attr( not( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_2_0_ec_pubkey_tweak_add" ) ]
261
273
pub fn secp256k1_ec_pubkey_tweak_add ( cx : * const Context ,
262
274
pk : * mut PublicKey ,
263
275
tweak : * const c_uchar )
264
276
-> c_int ;
265
277
278
+ #[ deprecated( since = "0.2.0" , note = "Please use the secp256k1_ec_seckey_tweak_mul function instead" ) ]
266
279
#[ cfg_attr( not( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_2_0_ec_privkey_tweak_mul" ) ]
267
280
pub fn secp256k1_ec_privkey_tweak_mul ( cx : * const Context ,
268
281
sk : * mut c_uchar ,
269
282
tweak : * const c_uchar )
270
283
-> c_int ;
271
284
285
+ #[ cfg_attr( not( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_2_0_ec_seckey_tweak_mul" ) ]
286
+ pub fn secp256k1_ec_seckey_tweak_mul ( cx : * const Context ,
287
+ sk : * mut c_uchar ,
288
+ tweak : * const c_uchar )
289
+ -> c_int ;
290
+
272
291
#[ cfg_attr( not( feature = "external-symbols" ) , link_name = "rustsecp256k1_v0_2_0_ec_pubkey_tweak_mul" ) ]
273
292
pub fn secp256k1_ec_pubkey_tweak_mul ( cx : * const Context ,
274
293
pk : * mut PublicKey ,
@@ -287,7 +306,7 @@ extern "C" {
287
306
cx : * const Context ,
288
307
output : * mut c_uchar ,
289
308
pubkey : * const PublicKey ,
290
- privkey : * const c_uchar ,
309
+ seckey : * const c_uchar ,
291
310
hashfp : EcdhHashFn ,
292
311
data : * mut c_void ,
293
312
) -> c_int ;
@@ -413,7 +432,7 @@ unsafe fn strlen(mut str_ptr: *const c_char) -> usize {
413
432
/// A trait for producing pointers that will always be valid in C. (assuming NULL pointer is a valid no-op)
414
433
/// Rust doesn't promise what pointers does it give to ZST (https://doc.rust-lang.org/nomicon/exotic-sizes.html#zero-sized-types-zsts)
415
434
/// In case the type is empty this trait will give a NULL pointer, which should be handled in C.
416
- ///
435
+ ///
417
436
pub trait CPtr {
418
437
type Target ;
419
438
fn as_c_ptr ( & self ) -> * const Self :: Target ;
@@ -702,8 +721,14 @@ mod fuzz_dummy {
702
721
//TODO secp256k1_ec_privkey_export
703
722
//TODO secp256k1_ec_privkey_import
704
723
724
+ #[ deprecated( since = "0.2.0" , note = "Please use the secp256k1_ec_seckey_negate function instead" ) ]
705
725
pub unsafe fn secp256k1_ec_privkey_negate ( cx : * const Context ,
706
726
sk : * mut c_uchar ) -> c_int {
727
+ secp256k1_ec_seckey_negate ( cx, sk)
728
+ }
729
+
730
+ pub unsafe fn secp256k1_ec_seckey_negate ( cx : * const Context ,
731
+ sk : * mut c_uchar ) -> c_int {
707
732
assert ! ( !cx. is_null( ) && ( * cx) . 0 as u32 & !( SECP256K1_START_NONE | SECP256K1_START_VERIFY | SECP256K1_START_SIGN ) == 0 ) ;
708
733
if secp256k1_ec_seckey_verify ( cx, sk) != 1 { return 0 ; }
709
734
1
@@ -721,6 +746,13 @@ mod fuzz_dummy {
721
746
sk : * mut c_uchar ,
722
747
tweak : * const c_uchar )
723
748
-> c_int {
749
+ secp256k1_ec_seckey_tweak_add ( cx, sk, tweak)
750
+ }
751
+
752
+ pub unsafe fn secp256k1_ec_seckey_tweak_add ( cx : * const Context ,
753
+ sk : * mut c_uchar ,
754
+ tweak : * const c_uchar )
755
+ -> c_int {
724
756
assert ! ( !cx. is_null( ) && ( * cx) . 0 as u32 & !( SECP256K1_START_NONE | SECP256K1_START_VERIFY | SECP256K1_START_SIGN ) == 0 ) ;
725
757
if secp256k1_ec_seckey_verify ( cx, sk) != 1 { return 0 ; }
726
758
ptr:: copy ( tweak. offset ( 16 ) , sk. offset ( 16 ) , 16 ) ;
@@ -747,6 +779,14 @@ mod fuzz_dummy {
747
779
sk : * mut c_uchar ,
748
780
tweak : * const c_uchar )
749
781
-> c_int {
782
+ secp256k1_ec_seckey_tweak_mul ( cx, sk, tweak)
783
+ }
784
+
785
+ /// Copies the last 16 bytes of tweak into the last 16 bytes of sk
786
+ pub unsafe fn secp256k1_ec_seckey_tweak_mul ( cx : * const Context ,
787
+ sk : * mut c_uchar ,
788
+ tweak : * const c_uchar )
789
+ -> c_int {
750
790
assert ! ( !cx. is_null( ) && ( * cx) . 0 as u32 & !( SECP256K1_START_NONE | SECP256K1_START_VERIFY | SECP256K1_START_SIGN ) == 0 ) ;
751
791
if secp256k1_ec_seckey_verify ( cx, sk) != 1 { return 0 ; }
752
792
ptr:: copy ( tweak. offset ( 16 ) , sk. offset ( 16 ) , 16 ) ;
0 commit comments