milagro-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-milagro-crypto-c] GuillaumeCisco commented on issue #38: Python wrappers
Date Wed, 14 Aug 2019 16:33:23 GMT
GuillaumeCisco commented 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 <stdio.h>
   #include <stdlib.h>
   #include <string.h>
   #include <time.h>
   #include <amcl/pair_FP256BN.h>
   
   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
   #include <stdio.h>
   #include <stdlib.h>
   #include <string.h>
   #include <time.h>
   #include <amcl/pair_FP256BN.h>
   
   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");
   }
   ```
   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:
users@infra.apache.org


With regards,
Apache Git Services

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


Mime
View raw message