diff options
Diffstat (limited to 'other/fun')
-rw-r--r-- | other/fun/sign.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/other/fun/sign.c b/other/fun/sign.c index 423d974a..eaea9d6a 100644 --- a/other/fun/sign.c +++ b/other/fun/sign.c | |||
@@ -17,19 +17,7 @@ | |||
17 | */ | 17 | */ |
18 | #include <sodium.h> | 18 | #include <sodium.h> |
19 | #include <string.h> | 19 | #include <string.h> |
20 | 20 | #include "../../testing/misc_tools.c" // hex_string_to_bin | |
21 | unsigned char *hex_string_to_bin(char hex_string[]) | ||
22 | { | ||
23 | size_t len = strlen(hex_string); | ||
24 | unsigned char *val = malloc(len); | ||
25 | char *pos = hex_string; | ||
26 | int i; | ||
27 | |||
28 | for (i = 0; i < len; ++i, pos += 2) | ||
29 | sscanf(pos, "%2hhx", &val[i]); | ||
30 | |||
31 | return val; | ||
32 | } | ||
33 | 21 | ||
34 | int load_file(char *filename, char **result) | 22 | int load_file(char *filename, char **result) |
35 | { | 23 | { |
@@ -90,6 +78,7 @@ int main(int argc, char *argv[]) | |||
90 | unsigned long long smlen; | 78 | unsigned long long smlen; |
91 | char *sm = malloc(size + crypto_sign_ed25519_BYTES * 2); | 79 | char *sm = malloc(size + crypto_sign_ed25519_BYTES * 2); |
92 | crypto_sign_ed25519(sm, &smlen, data, size, secret_key); | 80 | crypto_sign_ed25519(sm, &smlen, data, size, secret_key); |
81 | free(secret_key); | ||
93 | 82 | ||
94 | if (smlen - size != crypto_sign_ed25519_BYTES) | 83 | if (smlen - size != crypto_sign_ed25519_BYTES) |
95 | goto fail; | 84 | goto fail; |