Added gmp

parent 429bb0cb
...@@ -45,7 +45,7 @@ std::string *stringFromG1(libff::alt_bn128_G1 *_g1) { ...@@ -45,7 +45,7 @@ std::string *stringFromG1(libff::alt_bn128_G1 *_g1) {
auto sZ = stringFromFq(&_g1->Z); auto sZ = stringFromFq(&_g1->Z);
auto sG1 = new std::string(*sX + *sY + *sZ); auto sG1 = new std::string(*sX + ":" + *sY + ":" + *sZ);
delete(sX); delete(sX);
delete(sY); delete(sY);
......
...@@ -15,5 +15,8 @@ ...@@ -15,5 +15,8 @@
EXTERNC bool check_key(const char* _keyString); EXTERNC bool check_key(const char* _keyString);
EXTERNC char * sign(const char *_keyString, const char* _hashXString, const char* _hashYString,
const char* _hashZString);
#endif //SGXD_BLSUTILS_H #endif //SGXD_BLSUTILS_H
...@@ -38,6 +38,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -38,6 +38,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <sgx_trts.h> #include <sgx_trts.h>
#include <math.h> #include <math.h>
#include <string.h>
#define MAX_KEY_LENGTH 128 #define MAX_KEY_LENGTH 128
...@@ -109,7 +110,7 @@ void encrypt_key(int *err_status, unsigned char *key, ...@@ -109,7 +110,7 @@ void encrypt_key(int *err_status, unsigned char *key,
*err_status = -1; *err_status = -1;
if (strnlen(key) >= MAX_KEY_LENGTH) if (strnlen(key, MAX_KEY_LENGTH) == MAX_KEY_LENGTH)
return; return;
*err_status = -3; *err_status = -3;
...@@ -170,6 +171,9 @@ void decrypt_key(int *err_status, unsigned char *encrypted_key, ...@@ -170,6 +171,9 @@ void decrypt_key(int *err_status, unsigned char *encrypted_key,
void sign_message(int *err_status, unsigned char *encrypted_key, void sign_message(int *err_status, unsigned char *encrypted_key,
uint32_t enc_len, unsigned char *message, uint32_t enc_len, unsigned char *message,
unsigned char *signature) { unsigned char *signature) {
*err_status = -1;
uint8_t key[MAX_KEY_LENGTH]; uint8_t key[MAX_KEY_LENGTH];
...@@ -179,7 +183,14 @@ void sign_message(int *err_status, unsigned char *encrypted_key, ...@@ -179,7 +183,14 @@ void sign_message(int *err_status, unsigned char *encrypted_key,
return; return;
} }
char* sig = sign(key, "", "", "");
if (sig == NULL) {
return;
}
strcpy(signature, sig);
*err_status = 0;
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment