Added gmp

parent 4b35d3f3
...@@ -22,9 +22,9 @@ enclave { ...@@ -22,9 +22,9 @@ enclave {
); );
public void encrypt_key ( public void encrypt_key (
[user_check] mpf_t *pi,
[user_check] int *err_status, [user_check] int *err_status,
[in, count = 100] char* key); [in, count = 100] char* key,
[out, count = 100] char* encrypted_key);
}; };
......
...@@ -45,7 +45,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ...@@ -45,7 +45,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
void usage (); void usage ();
void usage () { void usage () {
fprintf(stderr, "usage: sgxgmppi digits\n"); fprintf(stderr, "usage: sgxd\n");
exit(1); exit(1);
} }
...@@ -56,8 +56,6 @@ int main (int argc, char *argv[]) ...@@ -56,8 +56,6 @@ int main (int argc, char *argv[])
sgx_status_t status; sgx_status_t status;
int updated= 0; int updated= 0;
unsigned long support; unsigned long support;
mpf_t pi;
uint64_t digits;
int opt; int opt;
while ( (opt= getopt(argc, argv, "h")) != -1 ) { while ( (opt= getopt(argc, argv, "h")) != -1 ) {
...@@ -71,14 +69,18 @@ int main (int argc, char *argv[]) ...@@ -71,14 +69,18 @@ int main (int argc, char *argv[])
argc-= optind; argc-= optind;
argv+= optind; argv+= optind;
if ( argc != 1 ) usage(); if ( argc != 0 ) usage();
/*
digits= strtoull(argv[0], NULL, 10); digits= strtoull(argv[0], NULL, 10);
if ( digits == 0 ) { if ( digits == 0 ) {
fprintf(stderr, "invalid digit count\n"); fprintf(stderr, "invalid digit count\n");
return 1; return 1;
} }
*/
#ifndef SGX_HW_SIM #ifndef SGX_HW_SIM
support= get_sgx_support(); support= get_sgx_support();
if ( ! SGX_OK(support) ) { if ( ! SGX_OK(support) ) {
...@@ -112,18 +114,18 @@ int main (int argc, char *argv[]) ...@@ -112,18 +114,18 @@ int main (int argc, char *argv[])
fprintf(stderr, "libtgmp initialized\n"); fprintf(stderr, "libtgmp initialized\n");
mpf_init(pi);
const char* key = "4160780231445160889237664391382223604184857153814275770598791864649971919844"; const char* key = "4160780231445160889237664391382223604184857153814275770598791864649971919844";
char keyArray[100]; char keyArray[100];
char encryptedKey[100];
strncpy(keyArray, key, 100); strncpy(keyArray, key, 100);
int err_status = -2; int err_status = -2;
status= encrypt_key(eid, &pi, &err_status, keyArray); status= encrypt_key(eid, &err_status, keyArray, encryptedKey);
if ( status != SGX_SUCCESS ) { if ( status != SGX_SUCCESS ) {
......
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