Skip to content

Commit

Permalink
use a variable message length in TrustInSoft entrypoints
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisnc committed Oct 17, 2021
1 parent 9994125 commit ac58eef
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions .trustinsoft/sign.c
Original file line number Diff line number Diff line change
@@ -1,11 +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[50];
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);
lith_sign_create(sig, msg, sizeof msg, secret_key);
size_t msglen = tis_unsigned_long_interval(0, sizeof msg);
lith_sign_create(sig, msg, msglen, secret_key);
}
7 changes: 5 additions & 2 deletions .trustinsoft/verify.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
#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[50];
secret_key[LITH_SIGN_SECRET_KEY_LEN], sig[LITH_SIGN_LEN], msg[1024];
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, sizeof msg, public_key);
return !lith_sign_verify(sig, msg, msglen, public_key);
}

0 comments on commit ac58eef

Please sign in to comment.