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
c3e05f2a
Unverified
Commit
c3e05f2a
authored
Oct 03, 2019
by
svetaro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-1512-add-DKG-to-SGX merge
parent
bb63afeb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
56 deletions
+9
-56
drive_key_dkg.c
secure_enclave/drive_key_dkg.c
+1
-1
random.c
secure_enclave/random.c
+0
-40
random.h
secure_enclave/random.h
+0
-12
testw.cpp
testw.cpp
+8
-3
No files found.
secure_enclave/drive_key_dkg.c
View file @
c3e05f2a
...
...
@@ -67,4 +67,4 @@ void xor_encrypt(char* key, char* message, char* cypher){
for
(
int
i
=
0
;
i
<
32
;
i
++
){
cypher
[
i
]
=
message
[
i
]
^
key
[
i
];
}
}
\ No newline at end of file
}
secure_enclave/random.c
deleted
100644 → 0
View file @
bb63afeb
#include <stdio.h>
#include <stdlib.h>
#include <../tgmp-build/include/sgx_tgmp.h>
#include "random.h"
/*Seeds the random state with information from /dev/random
*This may take time, but it's needed to ensure true randomness*/
void
random_seeding
(
gmp_randstate_t
r_state
)
{
//Open the random device for reading
FILE
*
ran
=
fopen
(
RANDOM_DEVICE
,
"r"
);
//input variables
char
i1
,
i2
,
i3
,
i4
;
//Read 4 bytes, cause that's the most we can put in an unsigned long int
i1
=
fgetc
(
ran
);
if
(
i1
==
EOF
)
goto
end
;
i2
=
fgetc
(
ran
);
if
(
i2
==
EOF
)
goto
end
;
i3
=
fgetc
(
ran
);
if
(
i3
==
EOF
)
goto
end
;
i4
=
fgetc
(
ran
);
if
(
i4
==
EOF
)
goto
end
;
//abs() returns long (signed long), therefor there must be two, since DO NOT want to loose any randomness
gmp_randseed_ui
(
r_state
,
(
unsigned
long
int
)
abs
(
i1
)
*
(
unsigned
long
int
)
abs
(
i2
*
i3
*
i4
));
//Define end
end:
//Close file resources
fclose
(
ran
);
}
secure_enclave/random.h
deleted
100644 → 0
View file @
bb63afeb
/*Seeds the random state with information from /dev/random
*This may take time, but it's needed to ensure true randomness*/
void
random_seeding
(
gmp_randstate_t
r_state
);
/*Operating system dependent random device, please use true random
*Linux has /dev/random as true RNG and /dev/urandom as pseudo random device
*Note: /dev/random may be slow, whereas /dev/urandom is not as secure*/
#define RANDOM_DEVICE "/dev/urandom"
/*Time spent reading from random device is not included in benchmark and other timings.
*To see difference between real execution time and execution time use Unix "time" command*/
testw.cpp
View file @
c3e05f2a
...
...
@@ -30,6 +30,10 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <libff/algebra/fields/fp.hpp>
#include <dkg/dkg.h>
#include <jsonrpccpp/server/connectors/httpserver.h>
...
...
@@ -37,6 +41,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <libff/algebra/curves/alt_bn128/alt_bn128_pp.hpp>
#include <libff/algebra/exponentiation/exponentiation.hpp>
#include <libff/algebra/fields/fp.hpp>
#include <dkg/dkg.h>
#include "sgxwallet_common.h"
#include "create_enclave.h"
#include "secure_enclave_u.h"
...
...
@@ -56,9 +64,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <sgx_tcrypto.h>
#include <dkg/dkg.h>
#define CATCH_CONFIG_MAIN // This tells Catch to provide a main() - only do this in one cpp file
#include "catch.hpp"
...
...
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