1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-19 18:15:18 -07:00

Update the examples for libsodium 1.0.7

This commit is contained in:
Frank Denis 2015-12-06 23:08:44 +01:00
parent c7eec99d2f
commit 7354964b91
3 changed files with 10 additions and 4 deletions

View File

@ -91,7 +91,9 @@ box(void)
/* encrypt and authenticate the message */
printf("Encrypting and authenticating with %s\n\n", crypto_box_primitive());
crypto_box_easy(ciphertext, message, message_len, nonce, alice_pk, bob_sk);
if (crypto_box_easy(ciphertext, message, message_len, nonce, alice_pk, bob_sk) != 0) {
abort();
}
ciphertext_len = crypto_box_MACBYTES + message_len;
/* send the nonce and the ciphertext */

View File

@ -91,8 +91,10 @@ box_detached(void)
/* encrypt and authenticate the message */
printf("Encrypting and authenticating with %s\n\n", crypto_box_primitive());
crypto_box_detached(ciphertext, mac, message, message_len, nonce,
alice_pk, bob_sk);
if (crypto_box_detached(ciphertext, mac, message, message_len, nonce,
alice_pk, bob_sk) != 0) {
abort();
}
/* send the nonce, the MAC and the ciphertext */
puts("Bob sends the nonce, the MAC and the ciphertext...\n");

View File

@ -99,7 +99,9 @@ print_verification(int ret)
static void
init(void)
{
sodium_init();
if (sodium_init() != 0) {
abort();
}
printf("Using libsodium %s\n", sodium_version_string());
}