-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make TrustInSoft entrypoints for other interfaces
update parameters in gimli_hash.h and gimli_aead.h update example variable names to more closely match interfaces
- Loading branch information
Showing
22 changed files
with
163 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Import("env") | ||
|
||
tis_env = env.Clone() | ||
tis_env.Append(CPPPATH="stubs") | ||
|
||
tis_env.Program("hash.c") | ||
tis_env.Program("x25519.c") | ||
tis_env.Program("keygen.c") | ||
tis_env.Program("sign.c") | ||
tis_env.Program("verify.c") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,27 @@ | ||
[ | ||
{ | ||
"name": "Hash", | ||
"include": "base.json", | ||
"files": ["hash.c"] | ||
}, | ||
{ | ||
"name": "X25519", | ||
"include": "base.json", | ||
"files": ["x25519.c"] | ||
}, | ||
{ | ||
"name": "Keygen", | ||
"include": "base.json", | ||
"files": ["keygen.c"] | ||
}, | ||
{ | ||
"name": "Sign", | ||
"include": "base.json", | ||
"val-profile": "analyzer", | ||
"no-results": true, | ||
"slevel": 1024, | ||
"files": [ | ||
"sign.c" | ||
] | ||
"files": ["sign.c"] | ||
}, | ||
{ | ||
"name": "Verify", | ||
"include": "base.json", | ||
"val-profile": "analyzer", | ||
"no-results": true, | ||
"slevel": 1024, | ||
"files": [ | ||
"verify.c" | ||
] | ||
"files": ["verify.c"] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#include <lithium/gimli_hash.h> | ||
|
||
#include <tis_builtin.h> | ||
|
||
int main(void) | ||
{ | ||
unsigned char h[1024], m[1024]; | ||
tis_make_unknown(m, sizeof m); | ||
size_t hlen = tis_unsigned_long_interval(0, sizeof h); | ||
size_t mlen = tis_unsigned_long_interval(0, sizeof m); | ||
gimli_hash(h, hlen, m, mlen); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include <lithium/sign.h> | ||
|
||
#include <tis_builtin.h> | ||
|
||
void lith_random_bytes(unsigned char *buf, size_t len) | ||
{ | ||
tis_make_unknown(buf, len); | ||
} | ||
|
||
int main(void) | ||
{ | ||
unsigned char public_key[LITH_SIGN_PUBLIC_KEY_LEN], | ||
secret_key[LITH_SIGN_SECRET_KEY_LEN]; | ||
lith_sign_keygen(public_key, secret_key); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
#include <lithium/random.h> | ||
#include <lithium/sign.h> | ||
|
||
#include <tis_builtin.h> | ||
|
||
int main(void) | ||
{ | ||
unsigned char public_key[LITH_SIGN_PUBLIC_KEY_LEN], | ||
secret_key[LITH_SIGN_SECRET_KEY_LEN], sig[LITH_SIGN_LEN], msg[1024]; | ||
lith_sign_keygen(public_key, secret_key); | ||
lith_random_bytes(msg, sizeof msg); | ||
unsigned char sig[LITH_SIGN_LEN], msg[1024], | ||
secret_key[LITH_SIGN_SECRET_KEY_LEN]; | ||
tis_make_unknown(msg, sizeof msg); | ||
tis_make_unknown(secret_key, sizeof secret_key); | ||
size_t msglen = tis_unsigned_long_interval(0, sizeof msg); | ||
lith_sign_create(sig, msg, msglen, secret_key); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#ifndef STUBS_TIS_BUILTIN_H | ||
#define STUBS_TIS_BUILTIN_H | ||
|
||
#include <lithium/random.h> | ||
|
||
/* | ||
* Trivial versions of tis_builtin.h functions that the examples use, that use | ||
* random data rather than data generalization. | ||
*/ | ||
|
||
static inline int tis_make_unknown(void *p, unsigned long len) | ||
{ | ||
lith_random_bytes(p, len); | ||
return 0; | ||
} | ||
|
||
static inline unsigned long tis_unsigned_long_interval(unsigned long min_, | ||
unsigned long max_) | ||
{ | ||
unsigned long range = max_ - min_; | ||
unsigned long rand; | ||
lith_random_bytes((unsigned char *)&rand, sizeof rand); | ||
rand %= range; | ||
return min_ + range; | ||
} | ||
|
||
#endif // STUBS_TIS_BUILTIN_H |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
#include <lithium/random.h> | ||
#include <lithium/sign.h> | ||
|
||
#include <tis_builtin.h> | ||
|
||
int main(void) | ||
{ | ||
unsigned char public_key[LITH_SIGN_PUBLIC_KEY_LEN], | ||
secret_key[LITH_SIGN_SECRET_KEY_LEN], sig[LITH_SIGN_LEN], msg[1024]; | ||
unsigned char sig[LITH_SIGN_LEN], msg[1024], | ||
public_key[LITH_SIGN_PUBLIC_KEY_LEN]; | ||
tis_make_unknown(sig, sizeof sig); | ||
tis_make_unknown(msg, sizeof msg); | ||
tis_make_unknown(public_key, sizeof public_key); | ||
size_t msglen = tis_unsigned_long_interval(0, sizeof msg); | ||
lith_sign_keygen(public_key, secret_key); | ||
lith_random_bytes(msg, sizeof msg); | ||
lith_random_bytes(sig, sizeof sig); | ||
return !lith_sign_verify(sig, msg, msglen, public_key); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include <lithium/x25519.h> | ||
|
||
#include <tis_builtin.h> | ||
|
||
int main(void) | ||
{ | ||
unsigned char out[X25519_LEN], scalar[X25519_LEN], point[X25519_LEN]; | ||
tis_make_unknown(scalar, sizeof scalar); | ||
tis_make_unknown(point, sizeof point); | ||
x25519(out, scalar, point); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.