Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sgxwallet
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董子豪
sgxwallet
Commits
744691da
Unverified
Commit
744691da
authored
Aug 16, 2019
by
a72d9e2bad9edfd58d6c0248c12c953b71d409d2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes
parent
69188512
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
256 deletions
+41
-256
Makefile
Makefile
+18
-18
Makefile.am
Makefile.am
+5
-5
Makefile.in
Makefile.in
+18
-18
config.log
config.log
+0
-90
sgxgmppi.c
sgxgmppi.c
+0
-125
No files found.
Makefile
View file @
744691da
...
...
@@ -88,7 +88,7 @@ POST_INSTALL = :
NORMAL_UNINSTALL
=
:
PRE_UNINSTALL
=
:
POST_UNINSTALL
=
:
bin_PROGRAMS
=
sgxgmpmath
$(EXEEXT)
sgx
gmppi
$(EXEEXT)
bin_PROGRAMS
=
sgxgmpmath
$(EXEEXT)
sgx
d
$(EXEEXT)
subdir
=
.
ACLOCAL_M4
=
$(top_srcdir)
/aclocal.m4
am__aclocal_m4_deps
=
$(top_srcdir)
/m4/sgx_init.m4
\
...
...
@@ -106,16 +106,16 @@ am__installdirs = "$(DESTDIR)$(bindir)"
PROGRAMS
=
$(bin_PROGRAMS)
am__objects_1
=
sgx_stub.
$(OBJEXT)
sgx_detect_linux.
$(OBJEXT)
\
create_enclave.
$(OBJEXT)
oc_alloc.
$(OBJEXT)
am_sgx
gmpmath_OBJECTS
=
sgxgmpmath
.
$(OBJEXT)
$(am__objects_1)
am_sgx
d_OBJECTS
=
sgxd
.
$(OBJEXT)
$(am__objects_1)
am__objects_2
=
EnclaveGmpTest_u.
$(OBJEXT)
nodist_sgxd_OBJECTS
=
$(am__objects_2)
sgxd_OBJECTS
=
$(am_sgxd_OBJECTS)
$(nodist_sgxd_OBJECTS)
sgxd_DEPENDENCIES
=
am_sgxgmpmath_OBJECTS
=
sgxgmpmath.
$(OBJEXT)
$(am__objects_1)
nodist_sgxgmpmath_OBJECTS
=
$(am__objects_2)
sgxgmpmath_OBJECTS
=
$(am_sgxgmpmath_OBJECTS)
\
$(nodist_sgxgmpmath_OBJECTS)
sgxgmpmath_DEPENDENCIES
=
am_sgxgmppi_OBJECTS
=
sgxgmppi.
$(OBJEXT)
$(am__objects_1)
nodist_sgxgmppi_OBJECTS
=
$(am__objects_2)
sgxgmppi_OBJECTS
=
$(am_sgxgmppi_OBJECTS)
$(nodist_sgxgmppi_OBJECTS)
sgxgmppi_DEPENDENCIES
=
AM_V_P
=
$
(
am__v_P_
$(V)
)
am__v_P_
=
$
(
am__v_P_
$(AM_DEFAULT_VERBOSITY)
)
am__v_P_0
=
false
...
...
@@ -144,9 +144,9 @@ AM_V_CCLD = $(am__v_CCLD_$(V))
am__v_CCLD_
=
$
(
am__v_CCLD_
$(AM_DEFAULT_VERBOSITY)
)
am__v_CCLD_0
=
@echo
" CCLD "
$@
;
am__v_CCLD_1
=
SOURCES
=
$(sgx
gmpmath_SOURCES)
$(nodist_
sgxgmpmath_SOURCES)
\
$(
sgxgmppi_SOURCES)
$(nodist_sgxgmppi
_SOURCES)
DIST_SOURCES
=
$(sgx
gmpmath_SOURCES)
$(sgxgmppi
_SOURCES)
SOURCES
=
$(sgx
d_SOURCES)
$(nodist_sgxd_SOURCES)
$(
sgxgmpmath_SOURCES)
\
$(
nodist_sgxgmpmath
_SOURCES)
DIST_SOURCES
=
$(sgx
d_SOURCES)
$(sgxgmpmath
_SOURCES)
RECURSIVE_TARGETS
=
all-recursive check-recursive cscopelist-recursive
\
ctags-recursive dvi-recursive html-recursive info-recursive
\
install-data-recursive install-dvi-recursive
\
...
...
@@ -369,12 +369,12 @@ COMMON_ENCLAVE_SRC = EnclaveGmpTest_u.c EnclaveGmpTest_u.h
sgxgmpmath_SOURCES
=
sgxgmpmath.c
$(COMMON_SRC)
nodist_sgxgmpmath_SOURCES
=
$(COMMON_ENCLAVE_SRC)
EXTRA_sgxgmpmath_DEPENDENCIES
=
EnclaveGmpTest.signed.so
sgx
gmppi_SOURCES
=
sgxgmppi
.c
$(COMMON_SRC)
nodist_sgx
gmppi
_SOURCES
=
$(COMMON_ENCLAVE_SRC)
EXTRA_sgx
gmppi
_DEPENDENCIES
=
EnclaveGmpTest.signed.so
sgx
d_SOURCES
=
sgxd
.c
$(COMMON_SRC)
nodist_sgx
d
_SOURCES
=
$(COMMON_ENCLAVE_SRC)
EXTRA_sgx
d
_DEPENDENCIES
=
EnclaveGmpTest.signed.so
BUILT_SOURCES
=
$(COMMON_ENCLAVE_SRC)
sgxgmpmath_LDADD
=
-l
$(SGX_URTS_LIB)
-lgmp
-ldl
-l
:libsgx_capable.a
-l
:libsgx_tprotected_fs.a
-lpthread
sgx
gmppi
_LDADD
=
-l
$(SGX_URTS_LIB)
-lgmp
-ldl
-l
:libsgx_capable.a
-l
:libsgx_tprotected_fs.a
-lpthread
sgx
d
_LDADD
=
-l
$(SGX_URTS_LIB)
-lgmp
-ldl
-l
:libsgx_capable.a
-l
:libsgx_tprotected_fs.a
-lpthread
all
:
$(BUILT_SOURCES)
$(MAKE)
$(AM_MAKEFLAGS)
all-recursive
...
...
@@ -457,14 +457,14 @@ uninstall-binPROGRAMS:
clean-binPROGRAMS
:
-
test
-z
"
$(bin_PROGRAMS)
"
||
rm
-f
$(bin_PROGRAMS)
sgxd$(EXEEXT)
:
$(sgxd_OBJECTS) $(sgxd_DEPENDENCIES) $(EXTRA_sgxd_DEPENDENCIES)
@
rm
-f
sgxd
$(EXEEXT)
$(AM_V_CCLD)$(LINK)
$(sgxd_OBJECTS)
$(sgxd_LDADD)
$(LIBS)
sgxgmpmath$(EXEEXT)
:
$(sgxgmpmath_OBJECTS) $(sgxgmpmath_DEPENDENCIES) $(EXTRA_sgxgmpmath_DEPENDENCIES)
@
rm
-f
sgxgmpmath
$(EXEEXT)
$(AM_V_CCLD)$(LINK)
$(sgxgmpmath_OBJECTS)
$(sgxgmpmath_LDADD)
$(LIBS)
sgxgmppi$(EXEEXT)
:
$(sgxgmppi_OBJECTS) $(sgxgmppi_DEPENDENCIES) $(EXTRA_sgxgmppi_DEPENDENCIES)
@
rm
-f
sgxgmppi
$(EXEEXT)
$(AM_V_CCLD)$(LINK)
$(sgxgmppi_OBJECTS)
$(sgxgmppi_LDADD)
$(LIBS)
mostlyclean-compile
:
-
rm
-f
*
.
$(OBJEXT)
...
...
@@ -476,8 +476,8 @@ include ./$(DEPDIR)/create_enclave.Po
include
./$(DEPDIR)/oc_alloc.Po
include
./$(DEPDIR)/sgx_detect_linux.Po
include
./$(DEPDIR)/sgx_stub.Po
include
./$(DEPDIR)/sgxd.Po
include
./$(DEPDIR)/sgxgmpmath.Po
include
./$(DEPDIR)/sgxgmppi.Po
.c.o
:
$(AM_V_CC)$(COMPILE)
-MT
$@
-MD
-MP
-MF
$(DEPDIR)
/
$*
.Tpo
-c
-o
$@
$<
...
...
Makefile.am
View file @
744691da
...
...
@@ -56,7 +56,7 @@ CLEANFILES = $(COMMON_ENCLAVE_SRC) EnclaveGmpTest.edl \
## The build target
bin_PROGRAMS
=
sgxgmpmath sgx
gmppi
bin_PROGRAMS
=
sgxgmpmath sgx
d
## You can't use $(wildcard ...) with automake so all source files
...
...
@@ -69,9 +69,9 @@ sgxgmpmath_SOURCES = sgxgmpmath.c $(COMMON_SRC)
nodist_sgxgmpmath_SOURCES
=
$(COMMON_ENCLAVE_SRC)
EXTRA_sgxgmpmath_DEPENDENCIES
=
EnclaveGmpTest.signed.so
sgx
gmppi_SOURCES
=
sgxgmppi
.c
$(COMMON_SRC)
nodist_sgx
gmppi
_SOURCES
=
$(COMMON_ENCLAVE_SRC)
EXTRA_sgx
gmppi
_DEPENDENCIES
=
EnclaveGmpTest.signed.so
sgx
d_SOURCES
=
sgxd
.c
$(COMMON_SRC)
nodist_sgx
d
_SOURCES
=
$(COMMON_ENCLAVE_SRC)
EXTRA_sgx
d
_DEPENDENCIES
=
EnclaveGmpTest.signed.so
BUILT_SOURCES
=
$(COMMON_ENCLAVE_SRC)
AM_LDFLAGS
+=
$(GMP_LDFLAGS)
...
...
@@ -92,5 +92,5 @@ EnclaveGmpTest.signed.so: EnclaveGmpTest/EnclaveGmpTest.signed.so
## targets work on simulation builds.
sgxgmpmath_LDADD
=
-l
$(SGX_URTS_LIB)
-lgmp
-ldl
-l
:libsgx_capable.a
-l
:libsgx_tprotected_fs.a
-lpthread
sgx
gmppi
_LDADD
=
-l
$(SGX_URTS_LIB)
-lgmp
-ldl
-l
:libsgx_capable.a
-l
:libsgx_tprotected_fs.a
-lpthread
sgx
d
_LDADD
=
-l
$(SGX_URTS_LIB)
-lgmp
-ldl
-l
:libsgx_capable.a
-l
:libsgx_tprotected_fs.a
-lpthread
Makefile.in
View file @
744691da
...
...
@@ -88,7 +88,7 @@ POST_INSTALL = :
NORMAL_UNINSTALL
=
:
PRE_UNINSTALL
=
:
POST_UNINSTALL
=
:
bin_PROGRAMS
=
sgxgmpmath
$(EXEEXT)
sgx
gmppi
$(EXEEXT)
bin_PROGRAMS
=
sgxgmpmath
$(EXEEXT)
sgx
d
$(EXEEXT)
subdir
=
.
ACLOCAL_M4
=
$(top_srcdir)
/aclocal.m4
am__aclocal_m4_deps
=
$(top_srcdir)
/m4/sgx_init.m4
\
...
...
@@ -106,16 +106,16 @@ am__installdirs = "$(DESTDIR)$(bindir)"
PROGRAMS
=
$(bin_PROGRAMS)
am__objects_1
=
sgx_stub.
$(OBJEXT)
sgx_detect_linux.
$(OBJEXT)
\
create_enclave.
$(OBJEXT)
oc_alloc.
$(OBJEXT)
am_sgx
gmpmath_OBJECTS
=
sgxgmpmath
.
$(OBJEXT)
$(am__objects_1)
am_sgx
d_OBJECTS
=
sgxd
.
$(OBJEXT)
$(am__objects_1)
am__objects_2
=
EnclaveGmpTest_u.
$(OBJEXT)
nodist_sgxd_OBJECTS
=
$(am__objects_2)
sgxd_OBJECTS
=
$(am_sgxd_OBJECTS)
$(nodist_sgxd_OBJECTS)
sgxd_DEPENDENCIES
=
am_sgxgmpmath_OBJECTS
=
sgxgmpmath.
$(OBJEXT)
$(am__objects_1)
nodist_sgxgmpmath_OBJECTS
=
$(am__objects_2)
sgxgmpmath_OBJECTS
=
$(am_sgxgmpmath_OBJECTS)
\
$(nodist_sgxgmpmath_OBJECTS)
sgxgmpmath_DEPENDENCIES
=
am_sgxgmppi_OBJECTS
=
sgxgmppi.
$(OBJEXT)
$(am__objects_1)
nodist_sgxgmppi_OBJECTS
=
$(am__objects_2)
sgxgmppi_OBJECTS
=
$(am_sgxgmppi_OBJECTS)
$(nodist_sgxgmppi_OBJECTS)
sgxgmppi_DEPENDENCIES
=
AM_V_P
=
$
(
am__v_P_@AM_V@
)
am__v_P_
=
$
(
am__v_P_@AM_DEFAULT_V@
)
am__v_P_0
=
false
...
...
@@ -144,9 +144,9 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_
=
$
(
am__v_CCLD_@AM_DEFAULT_V@
)
am__v_CCLD_0
=
@echo
" CCLD "
$@
;
am__v_CCLD_1
=
SOURCES
=
$(sgx
gmpmath_SOURCES)
$(nodist_
sgxgmpmath_SOURCES)
\
$(
sgxgmppi_SOURCES)
$(nodist_sgxgmppi
_SOURCES)
DIST_SOURCES
=
$(sgx
gmpmath_SOURCES)
$(sgxgmppi
_SOURCES)
SOURCES
=
$(sgx
d_SOURCES)
$(nodist_sgxd_SOURCES)
$(
sgxgmpmath_SOURCES)
\
$(
nodist_sgxgmpmath
_SOURCES)
DIST_SOURCES
=
$(sgx
d_SOURCES)
$(sgxgmpmath
_SOURCES)
RECURSIVE_TARGETS
=
all-recursive check-recursive cscopelist-recursive
\
ctags-recursive dvi-recursive html-recursive info-recursive
\
install-data-recursive install-dvi-recursive
\
...
...
@@ -369,12 +369,12 @@ COMMON_ENCLAVE_SRC = EnclaveGmpTest_u.c EnclaveGmpTest_u.h
sgxgmpmath_SOURCES
=
sgxgmpmath.c
$(COMMON_SRC)
nodist_sgxgmpmath_SOURCES
=
$(COMMON_ENCLAVE_SRC)
EXTRA_sgxgmpmath_DEPENDENCIES
=
EnclaveGmpTest.signed.so
sgx
gmppi_SOURCES
=
sgxgmppi
.c
$(COMMON_SRC)
nodist_sgx
gmppi
_SOURCES
=
$(COMMON_ENCLAVE_SRC)
EXTRA_sgx
gmppi
_DEPENDENCIES
=
EnclaveGmpTest.signed.so
sgx
d_SOURCES
=
sgxd
.c
$(COMMON_SRC)
nodist_sgx
d
_SOURCES
=
$(COMMON_ENCLAVE_SRC)
EXTRA_sgx
d
_DEPENDENCIES
=
EnclaveGmpTest.signed.so
BUILT_SOURCES
=
$(COMMON_ENCLAVE_SRC)
sgxgmpmath_LDADD
=
-l
$(SGX_URTS_LIB)
-lgmp
-ldl
-l
:libsgx_capable.a
-l
:libsgx_tprotected_fs.a
-lpthread
sgx
gmppi
_LDADD
=
-l
$(SGX_URTS_LIB)
-lgmp
-ldl
-l
:libsgx_capable.a
-l
:libsgx_tprotected_fs.a
-lpthread
sgx
d
_LDADD
=
-l
$(SGX_URTS_LIB)
-lgmp
-ldl
-l
:libsgx_capable.a
-l
:libsgx_tprotected_fs.a
-lpthread
all
:
$(BUILT_SOURCES)
$(MAKE)
$(AM_MAKEFLAGS)
all-recursive
...
...
@@ -457,14 +457,14 @@ uninstall-binPROGRAMS:
clean-binPROGRAMS
:
-
test
-z
"
$(bin_PROGRAMS)
"
||
rm
-f
$(bin_PROGRAMS)
sgxd$(EXEEXT)
:
$(sgxd_OBJECTS) $(sgxd_DEPENDENCIES) $(EXTRA_sgxd_DEPENDENCIES)
@
rm
-f
sgxd
$(EXEEXT)
$(AM_V_CCLD)$(LINK)
$(sgxd_OBJECTS)
$(sgxd_LDADD)
$(LIBS)
sgxgmpmath$(EXEEXT)
:
$(sgxgmpmath_OBJECTS) $(sgxgmpmath_DEPENDENCIES) $(EXTRA_sgxgmpmath_DEPENDENCIES)
@
rm
-f
sgxgmpmath
$(EXEEXT)
$(AM_V_CCLD)$(LINK)
$(sgxgmpmath_OBJECTS)
$(sgxgmpmath_LDADD)
$(LIBS)
sgxgmppi$(EXEEXT)
:
$(sgxgmppi_OBJECTS) $(sgxgmppi_DEPENDENCIES) $(EXTRA_sgxgmppi_DEPENDENCIES)
@
rm
-f
sgxgmppi
$(EXEEXT)
$(AM_V_CCLD)$(LINK)
$(sgxgmppi_OBJECTS)
$(sgxgmppi_LDADD)
$(LIBS)
mostlyclean-compile
:
-
rm
-f
*
.
$(OBJEXT)
...
...
@@ -476,8 +476,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/oc_alloc.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/sgx_detect_linux.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/sgx_stub.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/sgxd.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/sgxgmpmath.Po@am__quote@
@AMDEP_TRUE@@am__include@
@am__quote@./$(DEPDIR)/sgxgmppi.Po@am__quote@
.c.o
:
@am__fastdepCC_TRUE@
$(AM_V_CC)$(COMPILE)
-MT
$@
-MD
-MP
-MF
$(DEPDIR)/$*.Tpo
-c
-o
$@
$<
...
...
config.log
View file @
744691da
...
...
@@ -462,93 +462,3 @@ on kladko
config.status:815: creating Makefile
config.status:987: executing depfiles commands
## ---------------------- ##
## Running config.status. ##
## ---------------------- ##
This file was extended by SGX GMP Test config.status 1.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES =
CONFIG_HEADERS =
CONFIG_LINKS =
CONFIG_COMMANDS =
$ ./config.status EnclaveGmpTest/Makefile depfiles
on kladko
config.status:815: creating EnclaveGmpTest/Makefile
config.status:987: executing depfiles commands
## ---------------------- ##
## Running config.status. ##
## ---------------------- ##
This file was extended by SGX GMP Test config.status 1.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES =
CONFIG_HEADERS =
CONFIG_LINKS =
CONFIG_COMMANDS =
$ ./config.status EnclaveGmpTest/Makefile depfiles
on kladko
config.status:815: creating EnclaveGmpTest/Makefile
config.status:987: executing depfiles commands
## ---------------------- ##
## Running config.status. ##
## ---------------------- ##
This file was extended by SGX GMP Test config.status 1.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES =
CONFIG_HEADERS =
CONFIG_LINKS =
CONFIG_COMMANDS =
$ ./config.status EnclaveGmpTest/Makefile depfiles
on kladko
config.status:815: creating EnclaveGmpTest/Makefile
config.status:987: executing depfiles commands
## ---------------------- ##
## Running config.status. ##
## ---------------------- ##
This file was extended by SGX GMP Test config.status 1.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES =
CONFIG_HEADERS =
CONFIG_LINKS =
CONFIG_COMMANDS =
$ ./config.status EnclaveGmpTest/Makefile depfiles
on kladko
config.status:815: creating EnclaveGmpTest/Makefile
config.status:987: executing depfiles commands
## ---------------------- ##
## Running config.status. ##
## ---------------------- ##
This file was extended by SGX GMP Test config.status 1.0, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES =
CONFIG_HEADERS =
CONFIG_LINKS =
CONFIG_COMMANDS =
$ ./config.status EnclaveGmpTest/Makefile depfiles
on kladko
config.status:815: creating EnclaveGmpTest/Makefile
config.status:987: executing depfiles commands
sgxgmppi.c
deleted
100644 → 0
View file @
69188512
/*
Copyright 2018 Intel Corporation
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sgx_urts.h>
#include <gmp.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "sgx_detect.h"
#include "EnclaveGmpTest_u.h"
#include "create_enclave.h"
#define ENCLAVE_NAME "EnclaveGmpTest.signed.so"
void
usage
();
void
usage
()
{
fprintf
(
stderr
,
"usage: sgxgmppi digits
\n
"
);
exit
(
1
);
}
int
main
(
int
argc
,
char
*
argv
[])
{
sgx_launch_token_t
token
=
{
0
};
sgx_enclave_id_t
eid
=
0
;
sgx_status_t
status
;
int
updated
=
0
;
unsigned
long
support
;
mpf_t
pi
;
uint64_t
digits
;
int
opt
;
while
(
(
opt
=
getopt
(
argc
,
argv
,
"h"
))
!=
-
1
)
{
switch
(
opt
)
{
case
'h'
:
default:
usage
();
}
}
argc
-=
optind
;
argv
+=
optind
;
if
(
argc
!=
1
)
usage
();
digits
=
strtoull
(
argv
[
0
],
NULL
,
10
);
if
(
digits
==
0
)
{
fprintf
(
stderr
,
"invalid digit count
\n
"
);
return
1
;
}
#ifndef SGX_HW_SIM
support
=
get_sgx_support
();
if
(
!
SGX_OK
(
support
)
)
{
sgx_support_perror
(
support
);
return
1
;
}
#endif
status
=
sgx_create_enclave_search
(
ENCLAVE_NAME
,
SGX_DEBUG_FLAG
,
&
token
,
&
updated
,
&
eid
,
0
);
if
(
status
!=
SGX_SUCCESS
)
{
if
(
status
==
SGX_ERROR_ENCLAVE_FILE_ACCESS
)
{
fprintf
(
stderr
,
"sgx_create_enclave: %s: file not found
\n
"
,
ENCLAVE_NAME
);
fprintf
(
stderr
,
"Did you forget to set LD_LIBRARY_PATH?
\n
"
);
}
else
{
fprintf
(
stderr
,
"%s: 0x%04x
\n
"
,
ENCLAVE_NAME
,
status
);
}
return
1
;
}
fprintf
(
stderr
,
"Enclave launched
\n
"
);
status
=
tgmp_init
(
eid
);
if
(
status
!=
SGX_SUCCESS
)
{
fprintf
(
stderr
,
"ECALL test_mpz_add: 0x%04x
\n
"
,
status
);
return
1
;
}
fprintf
(
stderr
,
"libtgmp initialized
\n
"
);
mpf_init
(
pi
);
status
=
encrypt_key
(
eid
,
&
pi
,
digits
);
if
(
status
!=
SGX_SUCCESS
)
{
fprintf
(
stderr
,
"ECALL encrypt_key: 0x%04x
\n
"
,
status
);
return
1
;
}
gmp_printf
(
"pi : %.*Ff
\n
"
,
digits
,
pi
);
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment