[GitHub] [incubator-milagro-crypto-c] GuillaumeCisco edited a comment on issue #38: Python wrappers

2019-08-14 Thread GitBox
GuillaumeCisco edited a comment on issue #38: Python wrappers
URL: 
https://github.com/apache/incubator-milagro-crypto-c/issues/38#issuecomment-521329526
 
 
   What I tried:
   Using the file `test_pair_FP256BN.c` which use `CURVE_Order_FP256BN`.
   Creating the .so (from python wrapper generated directory) using:
   `gcc -g -I../../include -I../../../../include -fPIC -Wall -Wextra 
../../test/test_pair_FP256BN.c -shared -o ./test_pair_FP256BN.so`
   With a file named test_pair_FP256BN.py:
   ```
   import cffi
   
   ffi = cffi.FFI()
   ffi.cdef("""
  int main();
   """)
   
   
   lib = ffi.dlopen("./rom.so")
   lib.main()
   ```
   
   Then:
   ```
   $> python
   Python 2.7.15+ (default, Nov 27 2018, 23:36:35) 
   [GCC 7.3.0] on linux2
   Type "help", "copyright", "credits" or "license" for more information.
   >>> import test_pair_FP256BN
   Traceback (most recent call last):
 File "", line 1, in 
   ImportError: ./test_pair_FP256BN.so: undefined symbol: CURVE_Order_FP256BN
   ```
   There is something I'm not doing correctly...


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: issues-unsubscr...@milagro.apache.org
For additional commands, e-mail: issues-h...@milagro.apache.org



[GitHub] [incubator-milagro-crypto-c] GuillaumeCisco edited a comment on issue #38: Python wrappers

2019-08-14 Thread GitBox
GuillaumeCisco edited a comment on issue #38: Python wrappers
URL: 
https://github.com/apache/incubator-milagro-crypto-c/issues/38#issuecomment-521321028
 
 
   Thanks.
   I need a little help on this one.
   If I create rom.c like:
   ```c
   #include 
   #include 
   #include 
   #include 
   #include 
   
   int main()
   {
   BIG_256_56 q2;
   BIG_256_28 r2;
   
   printf("BLS381\n");
   BIG_256_56_rcopy(q2, Modulus_FP256BN);
   printf("q (381) = 0x");
   BIG_256_56_output(q2);
   printf("\n");
   BIG_256_28_rcopy(r2 ,CURVE_Order_FP256BN);
   printf("r (257) = 0x");
   }
   ```
   
   Then how do I wrap it with cffi?
   If I write something like:
   ```python
   import cffi
   import platform
   
   ffi = cffi.FFI()
   ffi.cdef("""
  int main();
   """)
   
   
   if (platform.system() == 'Windows'):
   libamcl_wcc_FP256BN = ffi.dlopen("libamcl_wcc_FP256BN.dll")
   libamcl_core = ffi.dlopen("libamcl_core.dll")
   elif (platform.system() == 'Darwin'):
   libamcl_wcc_FP256BN = ffi.dlopen("libamcl_wcc_FP256BN.dylib")
   libamcl_core = ffi.dlopen("libamcl_core.dylib")
   else:
   libamcl_wcc_FP256BN = ffi.dlopen("libamcl_wcc_FP256BN.so")
   libamcl_core = ffi.dlopen("libamcl_core.so")
   
   libamcl_core.main()
   
   ```
   It won't work, as there is no link between rom.c and `libamcl_core`.
   I should create a .so file from the rom.c, right?
   I have no knowledge in cffi and will learn how to use it.
   But a little help would be great ;)
   Also is it possible to simply export constant from a C code for importing it 
after from python?
   
   Thanks


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: issues-unsubscr...@milagro.apache.org
For additional commands, e-mail: issues-h...@milagro.apache.org



[GitHub] [incubator-milagro-crypto-c] GuillaumeCisco edited a comment on issue #38: Python wrappers

2019-08-14 Thread GitBox
GuillaumeCisco edited a comment on issue #38: Python wrappers
URL: 
https://github.com/apache/incubator-milagro-crypto-c/issues/38#issuecomment-521240128
 
 
   Quick question, is `bls_ZZZ.py.in` a generated file?
   What `.py.in` stands for?
   could we generate a `rom_ZZZ.py.in` file?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: issues-unsubscr...@milagro.apache.org
For additional commands, e-mail: issues-h...@milagro.apache.org



[GitHub] [incubator-milagro-crypto-c] GuillaumeCisco edited a comment on issue #38: Python wrappers

2019-08-14 Thread GitBox
GuillaumeCisco edited a comment on issue #38: Python wrappers
URL: 
https://github.com/apache/incubator-milagro-crypto-c/issues/38#issuecomment-521240128
 
 
   Quick question, is `bls_ZZZ.py.in` generated files?
   What `.py.in` stands for?
   could we generate a `rom_ZZZ.py.in` file?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

-
To unsubscribe, e-mail: issues-unsubscr...@milagro.apache.org
For additional commands, e-mail: issues-h...@milagro.apache.org