This commit is contained in:
Frank Denis 2015-05-27 16:10:07 +02:00
parent 4ea111bcb5
commit 67305902ee
9 changed files with 24 additions and 20 deletions

View File

@ -63,8 +63,7 @@ auth(void)
int
main(void)
{
sodium_init();
printf("Using LibSodium %s\n", sodium_version_string());
init();
return auth() != 0;
}

View File

@ -114,8 +114,7 @@ box(void)
int
main(void)
{
sodium_init();
printf("Using LibSodium %s\n", sodium_version_string());
init();
return box() != 0;
}

View File

@ -45,9 +45,8 @@ generichash(void)
int
main(void)
{
sodium_init();
printf("Using LibSodium %s\n", sodium_version_string());
init();
generichash();
return 0;
}

View File

@ -55,9 +55,8 @@ generichashstream(void)
int
main(void)
{
sodium_init();
printf("Using LibSodium %s\n", sodium_version_string());
init();
generichashstream();
return 0;
}

View File

@ -65,8 +65,7 @@ onetimeauth(void)
int
main(void)
{
sodium_init();
printf("Using LibSodium %s\n", sodium_version_string());
init();
return onetimeauth() != 0;
}

View File

@ -42,9 +42,8 @@ shorthash(void)
int
main(void)
{
sodium_init();
printf("Using LibSodium %s\n", sodium_version_string());
init();
shorthash();
return 0;
}

View File

@ -83,8 +83,7 @@ sign(void)
int
main(void)
{
sodium_init();
printf("Using LibSodium %s\n", sodium_version_string());
init();
return sign() != 0;
}

View File

@ -74,3 +74,10 @@ print_verification(int r)
else
puts("Failure\n");
}
void
init(void)
{
sodium_init();
printf("Using libsodium %s\n", sodium_version_string());
}

View File

@ -1,15 +1,19 @@
/*
* Utility functions shared by all the demo programs.
*/
#ifndef DEMO_UTILS_H
#define DEMO_UTILS_H
#ifndef UTILS_H
#define UTILS_H
#include <stddef.h>
#define MAX_INPUT_SIZE 4096 /* max size of all input buffers in the demo */
void print_hex(const void *bin, const size_t bin_len);
size_t prompt_input(char *prompt, char *input, const size_t max_input_len);
void print_verification(int r);
#endif /* DEMO_UTILS_H */
void init(void);
#endif /* UTILS_H */