Fixed BLS sigs

parent d0fd73da
...@@ -137,35 +137,52 @@ int main(int argc, char *argv[]) { ...@@ -137,35 +137,52 @@ int main(int argc, char *argv[]) {
status = encrypt_key(eid, &err_status, errMsg, keyArray, encryptedKey, &enc_len); status = encrypt_key(eid, &err_status, errMsg, keyArray, encryptedKey, &enc_len);
if (status != SGX_SUCCESS) { if (status != SGX_SUCCESS) {
gmp_printf("ECALL encrypt_key: 0x%04x\n", status); printf("ECALL encrypt_key: 0x%04x\n", status);
return 1; return 1;
} }
gmp_printf("Encrypt key completed with status: %d %s \n", err_status, errMsg);
char result[BUF_LEN];
printf("Encrypt key completed with status: %d %s \n", err_status, errMsg);
printf(" Encrypted key len %d\n", enc_len);
char result[2* BUF_LEN];
carray2Hex(encryptedKey, enc_len, result); carray2Hex(encryptedKey, enc_len, result);
uint64_t dec_len; uint64_t dec_len = 0;
uint8_t bin[BUF_LEN]; uint8_t bin[BUF_LEN];
hex2carray(result, &dec_len, bin); if (!hex2carray(result, &dec_len, bin)) {
printf("hex2carray returned false");
if (dec_len != enc_len) {
return 1;
} }
printf("Hex key len %d\n", dec_len);
for (int i=0; i < dec_len; i++) { for (int i=0; i < dec_len; i++) {
if (bin[i] != encryptedKey[i]) if (bin[i] != encryptedKey[i]) {
printf("Hex does not match");
return 1; return 1;
}
}
if (dec_len != enc_len) {
printf("Dec_len != enc_len %d %d \n", (uint32_t) dec_len, (uint32_t) enc_len);
return 1;
} }
gmp_printf("Result: %s", result); gmp_printf("Result: %s", result);
gmp_printf("\n Length: %d \n", enc_len); gmp_printf("\n Length: %d \n", enc_len);
......
...@@ -41,13 +41,15 @@ void carray2Hex(const unsigned char *d, int _len, char* _hexArray) { ...@@ -41,13 +41,15 @@ void carray2Hex(const unsigned char *d, int _len, char* _hexArray) {
_hexArray[j * 2 + 1] = hexval[(d[j]) & 0x0F]; _hexArray[j * 2 + 1] = hexval[(d[j]) & 0x0F];
} }
_hexArray[_len * 2] = 0;
} }
bool hex2carray(const char * _hex, uint64_t *_bin_len, bool hex2carray(const char * _hex, uint64_t *_bin_len,
uint8_t* _bin ) { uint8_t* _bin ) {
int len = strnlen(_hex, BUF_LEN); int len = strnlen(_hex, 2 * BUF_LEN);
if (len == 0 && len % 2 == 1) if (len == 0 && len % 2 == 1)
......
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