@@ -59,7 +59,7 @@ impl ECCPoint {
5959 }
6060 let wc_ecc_point = unsafe { ws:: wc_ecc_new_point ( ) } ;
6161 if wc_ecc_point. is_null ( ) {
62- return Err ( 0 ) ;
62+ return Err ( ws :: wolfCrypt_ErrorCodes_MEMORY_E ) ;
6363 }
6464 let eccpoint = ECCPoint { wc_ecc_point } ;
6565 let din_size = din. len ( ) as u32 ;
@@ -108,7 +108,7 @@ impl ECCPoint {
108108 }
109109 let wc_ecc_point = unsafe { ws:: wc_ecc_new_point ( ) } ;
110110 if wc_ecc_point. is_null ( ) {
111- return Err ( 0 ) ;
111+ return Err ( ws :: wolfCrypt_ErrorCodes_MEMORY_E ) ;
112112 }
113113 let eccpoint = ECCPoint { wc_ecc_point } ;
114114 let din_size = din. len ( ) as u32 ;
@@ -216,10 +216,10 @@ impl ECCPoint {
216216 /// use wolfssl::wolfcrypt::ecc::ECC;
217217 /// let mut rng = RNG::new().expect("Failed to create RNG");
218218 /// let mut ecc = ECC::generate(32, &mut rng).expect("Error with generate()");
219- /// let ecc_point = ecc.make_pub_to_point(Some(&mut rng)).expect("Error with make_pub_to_point()");
219+ /// let mut ecc_point = ecc.make_pub_to_point(Some(&mut rng)).expect("Error with make_pub_to_point()");
220220 /// ecc_point.forcezero();
221221 /// ```
222- pub fn forcezero ( & self ) {
222+ pub fn forcezero ( & mut self ) {
223223 unsafe { ws:: wc_ecc_forcezero_point ( self . wc_ecc_point ) } ;
224224 }
225225}
@@ -806,7 +806,6 @@ impl ECC {
806806 /// let _ecc2 = ECC::import_x963(x963).expect("Error with import_x963()");
807807 /// ```
808808 pub fn import_x963 ( din : & [ u8 ] ) -> Result < ECC , i32 > {
809- let din_ptr = din. as_ptr ( ) as * const u8 ;
810809 let din_size = din. len ( ) as u32 ;
811810 let mut wc_ecc_key: MaybeUninit < ws:: ecc_key > = MaybeUninit :: uninit ( ) ;
812811 let rc = unsafe { ws:: wc_ecc_init ( wc_ecc_key. as_mut_ptr ( ) ) } ;
@@ -815,7 +814,7 @@ impl ECC {
815814 }
816815 let mut wc_ecc_key = unsafe { wc_ecc_key. assume_init ( ) } ;
817816 let rc = unsafe {
818- ws:: wc_ecc_import_x963 ( din_ptr , din_size, & mut wc_ecc_key)
817+ ws:: wc_ecc_import_x963 ( din . as_ptr ( ) , din_size, & mut wc_ecc_key)
819818 } ;
820819 if rc != 0 {
821820 unsafe { ws:: wc_ecc_free ( & mut wc_ecc_key) ; }
@@ -857,7 +856,6 @@ impl ECC {
857856 /// let _ecc2 = ECC::import_x963_ex(x963, curve_id).expect("Error with import_x963_ex()");
858857 /// ```
859858 pub fn import_x963_ex ( din : & [ u8 ] , curve_id : i32 ) -> Result < ECC , i32 > {
860- let din_ptr = din. as_ptr ( ) as * const u8 ;
861859 let din_size = din. len ( ) as u32 ;
862860 let mut wc_ecc_key: MaybeUninit < ws:: ecc_key > = MaybeUninit :: uninit ( ) ;
863861 let rc = unsafe { ws:: wc_ecc_init ( wc_ecc_key. as_mut_ptr ( ) ) } ;
@@ -866,7 +864,7 @@ impl ECC {
866864 }
867865 let mut wc_ecc_key = unsafe { wc_ecc_key. assume_init ( ) } ;
868866 let rc = unsafe {
869- ws:: wc_ecc_import_x963_ex ( din_ptr , din_size, & mut wc_ecc_key, curve_id)
867+ ws:: wc_ecc_import_x963_ex ( din . as_ptr ( ) , din_size, & mut wc_ecc_key, curve_id)
870868 } ;
871869 if rc != 0 {
872870 unsafe { ws:: wc_ecc_free ( & mut wc_ecc_key) ; }
@@ -1385,7 +1383,7 @@ impl ECC {
13851383 } ;
13861384 let wc_ecc_point = unsafe { ws:: wc_ecc_new_point ( ) } ;
13871385 if wc_ecc_point. is_null ( ) {
1388- return Err ( 0 ) ;
1386+ return Err ( ws :: wolfCrypt_ErrorCodes_MEMORY_E ) ;
13891387 }
13901388 let ecc_point = ECCPoint { wc_ecc_point } ;
13911389 let rc = unsafe {
0 commit comments