Added gmp

parent 429bb0cb
......@@ -45,7 +45,7 @@ std::string *stringFromG1(libff::alt_bn128_G1 *_g1) {
auto sZ = stringFromFq(&_g1->Z);
auto sG1 = new std::string(*sX + *sY + *sZ);
auto sG1 = new std::string(*sX + ":" + *sY + ":" + *sZ);
delete(sX);
delete(sY);
......
......@@ -15,5 +15,8 @@
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
......@@ -38,6 +38,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <sgx_trts.h>
#include <math.h>
#include <string.h>
#define MAX_KEY_LENGTH 128
......@@ -109,7 +110,7 @@ void encrypt_key(int *err_status, unsigned char *key,
*err_status = -1;
if (strnlen(key) >= MAX_KEY_LENGTH)
if (strnlen(key, MAX_KEY_LENGTH) == MAX_KEY_LENGTH)
return;
*err_status = -3;
......@@ -170,6 +171,9 @@ void decrypt_key(int *err_status, unsigned char *encrypted_key,
void sign_message(int *err_status, unsigned char *encrypted_key,
uint32_t enc_len, unsigned char *message,
unsigned char *signature) {
*err_status = -1;
uint8_t key[MAX_KEY_LENGTH];
......@@ -179,7 +183,14 @@ void sign_message(int *err_status, unsigned char *encrypted_key,
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