Indent
This commit is contained in:
parent
9d03fbb38c
commit
a8cc1634f4
@ -40,8 +40,8 @@ tv(void)
|
||||
assert(sizeof MESSAGE - 1U == MLEN);
|
||||
memcpy(m, MESSAGE, MLEN);
|
||||
crypto_aead_xchacha20poly1305_ietf_encrypt(c, &found_clen, m, MLEN,
|
||||
ad, ADLEN,
|
||||
NULL, nonce, firstkey);
|
||||
ad, ADLEN,
|
||||
NULL, nonce, firstkey);
|
||||
if (found_clen != MLEN + crypto_aead_xchacha20poly1305_ietf_abytes()) {
|
||||
printf("found_clen is not properly set\n");
|
||||
}
|
||||
@ -53,10 +53,10 @@ tv(void)
|
||||
}
|
||||
printf("\n");
|
||||
crypto_aead_xchacha20poly1305_ietf_encrypt_detached(detached_c,
|
||||
mac, &found_maclen,
|
||||
m, MLEN,
|
||||
ad, ADLEN,
|
||||
NULL, nonce, firstkey);
|
||||
mac, &found_maclen,
|
||||
m, MLEN,
|
||||
ad, ADLEN,
|
||||
NULL, nonce, firstkey);
|
||||
if (found_maclen != crypto_aead_xchacha20poly1305_ietf_abytes()) {
|
||||
printf("found_maclen is not properly set\n");
|
||||
}
|
||||
@ -65,7 +65,7 @@ tv(void)
|
||||
}
|
||||
|
||||
if (crypto_aead_xchacha20poly1305_ietf_decrypt(m2, &m2len, NULL, c, CLEN, ad,
|
||||
ADLEN, nonce, firstkey) != 0) {
|
||||
ADLEN, nonce, firstkey) != 0) {
|
||||
printf("crypto_aead_xchacha20poly1305_ietf_decrypt() failed\n");
|
||||
}
|
||||
if (m2len != MLEN) {
|
||||
@ -76,9 +76,9 @@ tv(void)
|
||||
}
|
||||
memset(m2, 0, m2len);
|
||||
if (crypto_aead_xchacha20poly1305_ietf_decrypt_detached(m2, NULL,
|
||||
c, MLEN, mac,
|
||||
ad, ADLEN,
|
||||
nonce, firstkey) != 0) {
|
||||
c, MLEN, mac,
|
||||
ad, ADLEN,
|
||||
nonce, firstkey) != 0) {
|
||||
printf("crypto_aead_xchacha20poly1305_ietf_decrypt_detached() failed\n");
|
||||
}
|
||||
if (memcmp(m, m2, MLEN) != 0) {
|
||||
@ -88,14 +88,14 @@ tv(void)
|
||||
for (i = 0U; i < CLEN; i++) {
|
||||
c[i] ^= (i + 1U);
|
||||
if (crypto_aead_xchacha20poly1305_ietf_decrypt(m2, NULL, NULL, c, CLEN,
|
||||
ad, ADLEN, nonce, firstkey)
|
||||
ad, ADLEN, nonce, firstkey)
|
||||
== 0 || memcmp(m, m2, MLEN) == 0) {
|
||||
printf("message can be forged\n");
|
||||
}
|
||||
c[i] ^= (i + 1U);
|
||||
}
|
||||
crypto_aead_xchacha20poly1305_ietf_encrypt(c, &found_clen, m, MLEN,
|
||||
NULL, 0U, NULL, nonce, firstkey);
|
||||
NULL, 0U, NULL, nonce, firstkey);
|
||||
if (found_clen != CLEN) {
|
||||
printf("clen is not properly set (adlen=0)\n");
|
||||
}
|
||||
@ -107,7 +107,7 @@ tv(void)
|
||||
}
|
||||
printf("\n");
|
||||
if (crypto_aead_xchacha20poly1305_ietf_decrypt(m2, &m2len, NULL, c, CLEN,
|
||||
NULL, 0U, nonce, firstkey) != 0) {
|
||||
NULL, 0U, nonce, firstkey) != 0) {
|
||||
printf("crypto_aead_xchacha20poly1305_ietf_decrypt() failed (adlen=0)\n");
|
||||
}
|
||||
if (m2len != MLEN) {
|
||||
@ -139,7 +139,7 @@ tv(void)
|
||||
|
||||
memcpy(c, m, MLEN);
|
||||
crypto_aead_xchacha20poly1305_ietf_encrypt(c, &found_clen, c, MLEN,
|
||||
NULL, 0U, NULL, nonce, firstkey);
|
||||
NULL, 0U, NULL, nonce, firstkey);
|
||||
if (found_clen != CLEN) {
|
||||
printf("clen is not properly set (adlen=0)\n");
|
||||
}
|
||||
@ -152,7 +152,7 @@ tv(void)
|
||||
printf("\n");
|
||||
|
||||
if (crypto_aead_xchacha20poly1305_ietf_decrypt(c, &m2len, NULL, c, CLEN,
|
||||
NULL, 0U, nonce, firstkey) != 0) {
|
||||
NULL, 0U, nonce, firstkey) != 0) {
|
||||
printf("crypto_aead_xchacha20poly1305_ietf_decrypt() failed (adlen=0)\n");
|
||||
}
|
||||
if (m2len != MLEN) {
|
||||
@ -164,7 +164,7 @@ tv(void)
|
||||
|
||||
crypto_aead_xchacha20poly1305_ietf_keygen(key2);
|
||||
if (crypto_aead_xchacha20poly1305_ietf_decrypt(c, &m2len, NULL, c, CLEN,
|
||||
NULL, 0U, nonce, key2) == 0) {
|
||||
NULL, 0U, nonce, key2) == 0) {
|
||||
printf("crypto_aead_xchacha20poly1305_ietf_decrypt() with a wrong key should have failed\n");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user