11extern crate ethereum_bn128;
2- extern crate parity_bytes as bytes;
32extern crate rustc_hex;
43
54use std:: ffi:: CStr ;
@@ -8,16 +7,14 @@ use std::os::raw::c_char;
87use rustc_hex:: FromHex ;
98use rustc_hex:: ToHex ;
109
11- use bytes:: BytesRef ;
12-
1310#[ no_mangle]
1411pub fn ec_mul ( input_hex_ptr : * const c_char ) -> * const c_char {
1512 let input_hex = unsafe { CStr :: from_ptr ( input_hex_ptr) } ;
1613 let input_str: & str = input_hex. to_str ( ) . unwrap ( ) ;
1714 let input_parsed = FromHex :: from_hex ( input_str) . unwrap ( ) ;
1815
19- let mut output = vec ! [ 0u8 ; 64 ] ;
20- match ethereum_bn128:: bn128_mul ( & input_parsed[ ..] , & mut BytesRef :: Fixed ( & mut output[ .. ] ) ) {
16+ let mut output = [ 0u8 ; 64 ] ;
17+ match ethereum_bn128:: bn128_mul ( & input_parsed[ ..] , & mut output) {
2118 Ok ( _) => {
2219 let mut output_hex = output. to_hex ( ) ;
2320 output_hex. push_str ( "\0 " ) ;
@@ -33,8 +30,8 @@ pub fn ec_add(input_hex_ptr: *const c_char) -> *const c_char {
3330 let input_str: & str = input_hex. to_str ( ) . unwrap ( ) ;
3431 let input_parsed = FromHex :: from_hex ( input_str) . unwrap ( ) ;
3532
36- let mut output = vec ! [ 0u8 ; 64 ] ;
37- match ethereum_bn128:: bn128_add ( & input_parsed[ ..] , & mut BytesRef :: Fixed ( & mut output[ .. ] ) ) {
33+ let mut output = [ 0u8 ; 64 ] ;
34+ match ethereum_bn128:: bn128_add ( & input_parsed[ ..] , & mut output) {
3835 Ok ( _) => {
3936 let mut output_hex = output. to_hex ( ) ;
4037 output_hex. push_str ( "\0 " ) ;
@@ -50,8 +47,8 @@ pub fn ec_pairing(input_hex_ptr: *const c_char) -> *const c_char {
5047 let input_str: & str = input_hex. to_str ( ) . unwrap ( ) ;
5148 let input_parsed = FromHex :: from_hex ( input_str) . unwrap ( ) ;
5249
53- let mut output = vec ! [ 0u8 ; 32 ] ;
54- match ethereum_bn128:: bn128_pairing ( & input_parsed[ ..] , & mut BytesRef :: Fixed ( & mut output[ .. ] ) ) {
50+ let mut output = [ 0u8 ; 32 ] ;
51+ match ethereum_bn128:: bn128_pairing ( & input_parsed[ ..] , & mut output) {
5552 Ok ( _) => {
5653 let mut output_hex = output. to_hex ( ) ;
5754 output_hex. push_str ( "\0 " ) ;
0 commit comments