Add and remove libs and components for Arduino Core 3 (#400)
* Add and remove libs and components for Arduino Core 3 * Add back NimBLE-Arduino in resources
This commit is contained in:
@@ -0,0 +1,525 @@
|
||||
|
||||
EXTRA_DIST = \
|
||||
run.sh \
|
||||
cmptest.h \
|
||||
wasi-test-wrapper.sh \
|
||||
wintest.bat \
|
||||
pre.js.inc \
|
||||
aead_aegis128l.exp \
|
||||
aead_aegis256.exp \
|
||||
aead_aes256gcm.exp \
|
||||
aead_aes256gcm2.exp \
|
||||
aead_chacha20poly1305.exp \
|
||||
aead_chacha20poly13052.exp \
|
||||
aead_xchacha20poly1305.exp \
|
||||
auth.exp \
|
||||
auth2.exp \
|
||||
auth3.exp \
|
||||
auth5.exp \
|
||||
auth6.exp \
|
||||
auth7.exp \
|
||||
box.exp \
|
||||
box2.exp \
|
||||
box7.exp \
|
||||
box8.exp \
|
||||
box_easy.exp \
|
||||
box_easy2.exp \
|
||||
box_seal.exp \
|
||||
box_seed.exp \
|
||||
chacha20.exp \
|
||||
codecs.exp \
|
||||
core_ed25519.exp \
|
||||
core_ristretto255.exp \
|
||||
core1.exp \
|
||||
core2.exp \
|
||||
core3.exp \
|
||||
core4.exp \
|
||||
core5.exp \
|
||||
core6.exp \
|
||||
ed25519_convert.exp \
|
||||
generichash.exp \
|
||||
generichash2.exp \
|
||||
generichash3.exp \
|
||||
hash.exp \
|
||||
hash3.exp \
|
||||
kdf.exp \
|
||||
kdf_hkdf.exp \
|
||||
keygen.exp \
|
||||
kx.exp \
|
||||
metamorphic.exp \
|
||||
misuse.exp \
|
||||
onetimeauth.exp \
|
||||
onetimeauth2.exp \
|
||||
onetimeauth7.exp \
|
||||
pwhash_argon2i.exp \
|
||||
pwhash_argon2id.exp \
|
||||
pwhash_scrypt.exp \
|
||||
pwhash_scrypt_ll.exp \
|
||||
randombytes.exp \
|
||||
scalarmult.exp \
|
||||
scalarmult_ed25519.exp \
|
||||
scalarmult_ristretto255.exp \
|
||||
scalarmult2.exp \
|
||||
scalarmult5.exp \
|
||||
scalarmult6.exp \
|
||||
scalarmult7.exp \
|
||||
scalarmult8.exp \
|
||||
secretbox.exp \
|
||||
secretbox2.exp \
|
||||
secretbox7.exp \
|
||||
secretbox8.exp \
|
||||
secretbox_easy.exp \
|
||||
secretbox_easy2.exp \
|
||||
secretstream_xchacha20poly1305.exp \
|
||||
shorthash.exp \
|
||||
sign.exp \
|
||||
siphashx24.exp \
|
||||
sodium_core.exp \
|
||||
sodium_utils.exp \
|
||||
sodium_utils2.exp \
|
||||
sodium_utils3.exp \
|
||||
sodium_version.exp \
|
||||
stream.exp \
|
||||
stream2.exp \
|
||||
stream3.exp \
|
||||
stream4.exp \
|
||||
verify1.exp \
|
||||
xchacha20.exp
|
||||
|
||||
DISTCLEANFILES = \
|
||||
aead_aegis128l.res \
|
||||
aead_aegis256.res \
|
||||
aead_aes256gcm.res \
|
||||
aead_aes256gcm2.res \
|
||||
aead_chacha20poly1305.res \
|
||||
aead_chacha20poly13052.res \
|
||||
aead_xchacha20poly1305.res \
|
||||
auth.res \
|
||||
auth2.res \
|
||||
auth3.res \
|
||||
auth5.res \
|
||||
auth6.res \
|
||||
auth7.res \
|
||||
box.res \
|
||||
box2.res \
|
||||
box7.res \
|
||||
box8.res \
|
||||
box_easy.res \
|
||||
box_easy2.res \
|
||||
box_seal.res \
|
||||
box_seed.res \
|
||||
chacha20.res \
|
||||
codecs.res \
|
||||
core_ed25519.res \
|
||||
core_ristretto255.res \
|
||||
core1.res \
|
||||
core2.res \
|
||||
core3.res \
|
||||
core4.res \
|
||||
core5.res \
|
||||
core6.res \
|
||||
ed25519_convert.res \
|
||||
generichash.res \
|
||||
generichash2.res \
|
||||
generichash3.res \
|
||||
hash.res \
|
||||
hash2.res \
|
||||
hash3.res \
|
||||
kdf.res \
|
||||
kdf_hkdf.res \
|
||||
keygen.res \
|
||||
kx.res \
|
||||
metamorphic.res \
|
||||
misuse.res \
|
||||
onetimeauth.res \
|
||||
onetimeauth2.res \
|
||||
onetimeauth7.res \
|
||||
pwhash_argon2i.res \
|
||||
pwhash_argon2id.res \
|
||||
pwhash_scrypt.res \
|
||||
pwhash_scrypt_ll.res \
|
||||
randombytes.res \
|
||||
scalarmult.res \
|
||||
scalarmult_ed25519.res \
|
||||
scalarmult_ristretto255.res \
|
||||
scalarmult2.res \
|
||||
scalarmult5.res \
|
||||
scalarmult6.res \
|
||||
scalarmult7.res \
|
||||
scalarmult8.res \
|
||||
secretbox.res \
|
||||
secretbox2.res \
|
||||
secretbox7.res \
|
||||
secretbox8.res \
|
||||
secretbox_easy.res \
|
||||
secretbox_easy2.res \
|
||||
secretstream_xchacha20poly1305.res \
|
||||
shorthash.res \
|
||||
sign.res \
|
||||
siphashx24.res \
|
||||
sodium_core.res \
|
||||
sodium_utils.res \
|
||||
sodium_utils2.res \
|
||||
sodium_utils3.res \
|
||||
sodium_version.res \
|
||||
stream.res \
|
||||
stream2.res \
|
||||
stream3.res \
|
||||
stream4.res \
|
||||
verify1.res \
|
||||
xchacha20.res
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-DTEST_SRCDIR=\"@srcdir@\" \
|
||||
-I$(top_srcdir)/src/libsodium/include \
|
||||
-I$(top_srcdir)/src/libsodium/include/sodium \
|
||||
-I$(top_builddir)/src/libsodium/include \
|
||||
-I$(top_builddir)/src/libsodium/include/sodium \
|
||||
-I$(top_srcdir)/test/quirks
|
||||
|
||||
AM_LDFLAGS = @TEST_LDFLAGS@
|
||||
|
||||
TESTS_TARGETS = \
|
||||
aead_aegis128l \
|
||||
aead_aegis256 \
|
||||
aead_aes256gcm \
|
||||
aead_aes256gcm2 \
|
||||
aead_chacha20poly1305 \
|
||||
aead_chacha20poly13052 \
|
||||
aead_xchacha20poly1305 \
|
||||
auth \
|
||||
auth2 \
|
||||
auth3 \
|
||||
auth5 \
|
||||
auth6 \
|
||||
auth7 \
|
||||
box \
|
||||
box2 \
|
||||
box7 \
|
||||
box8 \
|
||||
box_easy \
|
||||
box_easy2 \
|
||||
box_seal \
|
||||
box_seed \
|
||||
chacha20 \
|
||||
codecs \
|
||||
core1 \
|
||||
core2 \
|
||||
core3 \
|
||||
core4 \
|
||||
core5 \
|
||||
core6 \
|
||||
ed25519_convert \
|
||||
generichash \
|
||||
generichash2 \
|
||||
generichash3 \
|
||||
hash \
|
||||
hash3 \
|
||||
kdf \
|
||||
keygen \
|
||||
kx \
|
||||
metamorphic \
|
||||
misuse \
|
||||
onetimeauth \
|
||||
onetimeauth2 \
|
||||
onetimeauth7 \
|
||||
pwhash_argon2i \
|
||||
pwhash_argon2id \
|
||||
randombytes \
|
||||
scalarmult \
|
||||
scalarmult2 \
|
||||
scalarmult5 \
|
||||
scalarmult6 \
|
||||
scalarmult7 \
|
||||
scalarmult8 \
|
||||
secretbox \
|
||||
secretbox2 \
|
||||
secretbox7 \
|
||||
secretbox8 \
|
||||
secretbox_easy \
|
||||
secretbox_easy2 \
|
||||
secretstream_xchacha20poly1305 \
|
||||
shorthash \
|
||||
sign \
|
||||
sodium_core \
|
||||
sodium_utils \
|
||||
sodium_version \
|
||||
stream \
|
||||
stream2 \
|
||||
stream3 \
|
||||
stream4 \
|
||||
verify1
|
||||
|
||||
if !EMSCRIPTEN
|
||||
TESTS_TARGETS += \
|
||||
sodium_utils2 \
|
||||
sodium_utils3
|
||||
endif
|
||||
|
||||
check_PROGRAMS = $(TESTS_TARGETS)
|
||||
|
||||
TESTS = $(TESTS_TARGETS)
|
||||
|
||||
TESTS_LDADD = \
|
||||
${top_builddir}/src/libsodium/libsodium.la
|
||||
|
||||
aead_aegis128l_SOURCE = cmptest.h aead_aegis128l.c
|
||||
aead_aegis128l_LDADD = $(TESTS_LDADD)
|
||||
|
||||
aead_aegis256_SOURCE = cmptest.h aead_aegis256.c
|
||||
aead_aegis256_LDADD = $(TESTS_LDADD)
|
||||
|
||||
aead_aes256gcm_SOURCE = cmptest.h aead_aes256gcm.c
|
||||
aead_aes256gcm_LDADD = $(TESTS_LDADD)
|
||||
|
||||
aead_aes256gcm2_SOURCE = cmptest.h aead_aes256gcm2.c
|
||||
aead_aes256gcm2_LDADD = $(TESTS_LDADD)
|
||||
|
||||
aead_chacha20poly1305_SOURCE = cmptest.h aead_chacha20poly1305.c
|
||||
aead_chacha20poly1305_LDADD = $(TESTS_LDADD)
|
||||
|
||||
aead_chacha20poly13052_SOURCE = cmptest.h aead_chacha20poly13052.c
|
||||
aead_chacha20poly13052_LDADD = $(TESTS_LDADD)
|
||||
|
||||
aead_xchacha20poly1305_SOURCE = cmptest.h aead_xchacha20poly1305.c
|
||||
aead_xchacha20poly1305_LDADD = $(TESTS_LDADD)
|
||||
|
||||
auth_SOURCE = cmptest.h auth.c
|
||||
auth_LDADD = $(TESTS_LDADD)
|
||||
|
||||
auth2_SOURCE = cmptest.h auth2.c
|
||||
auth2_LDADD = $(TESTS_LDADD)
|
||||
|
||||
auth3_SOURCE = cmptest.h auth3.c
|
||||
auth3_LDADD = $(TESTS_LDADD)
|
||||
|
||||
auth5_SOURCE = cmptest.h auth5.c quirks.h
|
||||
auth5_LDADD = $(TESTS_LDADD)
|
||||
|
||||
auth6_SOURCE = cmptest.h auth6.c quirks.h
|
||||
auth6_LDADD = $(TESTS_LDADD)
|
||||
|
||||
auth7_SOURCE = cmptest.h auth7.c quirks.h
|
||||
auth7_LDADD = $(TESTS_LDADD)
|
||||
|
||||
box_SOURCE = cmptest.h box.c
|
||||
box_LDADD = $(TESTS_LDADD)
|
||||
|
||||
box2_SOURCE = cmptest.h box2.c
|
||||
box2_LDADD = $(TESTS_LDADD)
|
||||
|
||||
box7_SOURCE = cmptest.h box7.c
|
||||
box7_LDADD = $(TESTS_LDADD)
|
||||
|
||||
box8_SOURCE = cmptest.h box8.c
|
||||
box8_LDADD = $(TESTS_LDADD)
|
||||
|
||||
box_easy_SOURCE = cmptest.h box_easy.c
|
||||
box_easy_LDADD = $(TESTS_LDADD)
|
||||
|
||||
box_easy2_SOURCE = cmptest.h box_easy2.c
|
||||
box_easy2_LDADD = $(TESTS_LDADD)
|
||||
|
||||
box_seal_SOURCE = cmptest.h box_seal.c
|
||||
box_seal_LDADD = $(TESTS_LDADD)
|
||||
|
||||
box_seed_SOURCE = cmptest.h box_seed.c
|
||||
box_seed_LDADD = $(TESTS_LDADD)
|
||||
|
||||
chacha20_SOURCE = cmptest.h chacha20.c
|
||||
chacha20_LDADD = $(TESTS_LDADD)
|
||||
|
||||
codecs_SOURCE = cmptest.h codecs.c
|
||||
codecs_LDADD = $(TESTS_LDADD)
|
||||
|
||||
core_ed25519_SOURCE = cmptest.h core_ed25519.c
|
||||
core_ed25519_LDADD = $(TESTS_LDADD)
|
||||
|
||||
core_ristretto255_SOURCE = cmptest.h core_ristretto255.c
|
||||
core_ristretto255_LDADD = $(TESTS_LDADD)
|
||||
|
||||
core1_SOURCE = cmptest.h core1.c
|
||||
core1_LDADD = $(TESTS_LDADD)
|
||||
|
||||
core2_SOURCE = cmptest.h core2.c
|
||||
core2_LDADD = $(TESTS_LDADD)
|
||||
|
||||
core3_SOURCE = cmptest.h core3.c
|
||||
core3_LDADD = $(TESTS_LDADD)
|
||||
|
||||
core4_SOURCE = cmptest.h core4.c
|
||||
core4_LDADD = $(TESTS_LDADD)
|
||||
|
||||
core5_SOURCE = cmptest.h core5.c
|
||||
core5_LDADD = $(TESTS_LDADD)
|
||||
|
||||
core6_SOURCE = cmptest.h core6.c
|
||||
core6_LDADD = $(TESTS_LDADD)
|
||||
|
||||
ed25519_convert_SOURCE = cmptest.h ed25519_convert.c
|
||||
ed25519_convert_LDADD = $(TESTS_LDADD)
|
||||
|
||||
generichash_SOURCE = cmptest.h generichash.c
|
||||
generichash_LDADD = $(TESTS_LDADD)
|
||||
|
||||
generichash2_SOURCE = cmptest.h generichash2.c
|
||||
generichash2_LDADD = $(TESTS_LDADD)
|
||||
|
||||
generichash3_SOURCE = cmptest.h generichash3.c
|
||||
generichash3_LDADD = $(TESTS_LDADD)
|
||||
|
||||
hash_SOURCE = cmptest.h hash.c
|
||||
hash_LDADD = $(TESTS_LDADD)
|
||||
|
||||
hash3_SOURCE = cmptest.h hash3.c
|
||||
hash3_LDADD = $(TESTS_LDADD)
|
||||
|
||||
kdf_SOURCE = cmptest.h kdf.c
|
||||
kdf_LDADD = $(TESTS_LDADD)
|
||||
|
||||
kdf_hkdf_SOURCE = cmptest.h kdf_hkdf.c
|
||||
kdf_hkdf_LDADD = $(TESTS_LDADD)
|
||||
|
||||
keygen_SOURCE = cmptest.h keygen.c
|
||||
keygen_LDADD = $(TESTS_LDADD)
|
||||
|
||||
kx_SOURCE = cmptest.h kx.c
|
||||
kx_LDADD = $(TESTS_LDADD)
|
||||
|
||||
metamorphic_SOURCE = cmptest.h metamorphic.c
|
||||
metamorphic_LDADD = $(TESTS_LDADD)
|
||||
|
||||
misuse_SOURCE = cmptest.h misuse.c
|
||||
misuse_LDADD = $(TESTS_LDADD)
|
||||
|
||||
onetimeauth_SOURCE = cmptest.h onetimeauth.c
|
||||
onetimeauth_LDADD = $(TESTS_LDADD)
|
||||
|
||||
onetimeauth2_SOURCE = cmptest.h onetimeauth2.c
|
||||
onetimeauth2_LDADD = $(TESTS_LDADD)
|
||||
|
||||
onetimeauth7_SOURCE = cmptest.h onetimeauth7.c
|
||||
onetimeauth7_LDADD = $(TESTS_LDADD)
|
||||
|
||||
pwhash_argon2i_SOURCE = cmptest.h pwhash_argon2i.c
|
||||
pwhash_argon2i_LDADD = $(TESTS_LDADD)
|
||||
|
||||
pwhash_argon2id_SOURCE = cmptest.h pwhash_argon2id.c
|
||||
pwhash_argon2id_LDADD = $(TESTS_LDADD)
|
||||
|
||||
pwhash_scrypt_SOURCE = cmptest.h pwhash_scrypt.c
|
||||
pwhash_scrypt_LDADD = $(TESTS_LDADD)
|
||||
|
||||
pwhash_scrypt_ll_SOURCE = cmptest.h pwhash_scrypt_ll.c
|
||||
pwhash_scrypt_ll_LDADD = $(TESTS_LDADD)
|
||||
|
||||
randombytes_SOURCE = cmptest.h randombytes.c
|
||||
randombytes_LDADD = $(TESTS_LDADD)
|
||||
|
||||
scalarmult_SOURCE = cmptest.h scalarmult.c
|
||||
scalarmult_LDADD = $(TESTS_LDADD)
|
||||
|
||||
scalarmult_ed25519_SOURCE = cmptest.h scalarmult_ed25519.c
|
||||
scalarmult_ed25519_LDADD = $(TESTS_LDADD)
|
||||
|
||||
scalarmult_ristretto255_SOURCE = cmptest.h scalarmult_ristretto255.c
|
||||
scalarmult_ristretto255_LDADD = $(TESTS_LDADD)
|
||||
|
||||
scalarmult2_SOURCE = cmptest.h scalarmult2.c
|
||||
scalarmult2_LDADD = $(TESTS_LDADD)
|
||||
|
||||
scalarmult5_SOURCE = cmptest.h scalarmult5.c
|
||||
scalarmult5_LDADD = $(TESTS_LDADD)
|
||||
|
||||
scalarmult6_SOURCE = cmptest.h scalarmult6.c
|
||||
scalarmult6_LDADD = $(TESTS_LDADD)
|
||||
|
||||
scalarmult7_SOURCE = cmptest.h scalarmult7.c
|
||||
scalarmult7_LDADD = $(TESTS_LDADD)
|
||||
|
||||
scalarmult8_SOURCE = cmptest.h scalarmult8.c
|
||||
scalarmult8_LDADD = $(TESTS_LDADD)
|
||||
|
||||
secretbox_SOURCE = cmptest.h secretbox.c
|
||||
secretbox_LDADD = $(TESTS_LDADD)
|
||||
|
||||
secretbox2_SOURCE = cmptest.h secretbox2.c
|
||||
secretbox2_LDADD = $(TESTS_LDADD)
|
||||
|
||||
secretbox7_SOURCE = cmptest.h secretbox7.c
|
||||
secretbox7_LDADD = $(TESTS_LDADD)
|
||||
|
||||
secretbox8_SOURCE = cmptest.h secretbox8.c
|
||||
secretbox8_LDADD = $(TESTS_LDADD)
|
||||
|
||||
secretbox_easy_SOURCE = cmptest.h secretbox_easy.c
|
||||
secretbox_easy_LDADD = $(TESTS_LDADD)
|
||||
|
||||
secretbox_easy2_SOURCE = cmptest.h secretbox_easy2.c
|
||||
secretbox_easy2_LDADD = $(TESTS_LDADD)
|
||||
|
||||
secretstream_xchacha20poly1305_SOURCE = cmptest.h secretstream_xchacha20poly1305.c
|
||||
secretstream_xchacha20poly1305_LDADD = $(TESTS_LDADD)
|
||||
|
||||
shorthash_SOURCE = cmptest.h shorthash.c
|
||||
shorthash_LDADD = $(TESTS_LDADD)
|
||||
|
||||
sign_SOURCE = cmptest.h sign.c
|
||||
sign_LDADD = $(TESTS_LDADD)
|
||||
|
||||
siphashx24_SOURCE = cmptest.h siphashx24.c
|
||||
siphashx24_LDADD = $(TESTS_LDADD)
|
||||
|
||||
sodium_core_SOURCE = cmptest.h sodium_core.c
|
||||
sodium_core_LDADD = $(TESTS_LDADD)
|
||||
|
||||
sodium_utils_SOURCE = cmptest.h sodium_utils.c
|
||||
sodium_utils_LDADD = $(TESTS_LDADD)
|
||||
|
||||
sodium_utils2_SOURCE = cmptest.h sodium_utils2.c
|
||||
sodium_utils2_LDADD = $(TESTS_LDADD)
|
||||
|
||||
sodium_utils3_SOURCE = cmptest.h sodium_utils3.c
|
||||
sodium_utils3_LDADD = $(TESTS_LDADD)
|
||||
|
||||
sodium_version_SOURCE = cmptest.h sodium_version.c
|
||||
sodium_version_LDADD = $(TESTS_LDADD)
|
||||
|
||||
stream_SOURCE = cmptest.h stream.c
|
||||
stream_LDADD = $(TESTS_LDADD)
|
||||
|
||||
stream2_SOURCE = cmptest.h stream2.c
|
||||
stream2_LDADD = $(TESTS_LDADD)
|
||||
|
||||
stream3_SOURCE = cmptest.h stream3.c
|
||||
stream3_LDADD = $(TESTS_LDADD)
|
||||
|
||||
stream4_SOURCE = cmptest.h stream4.c
|
||||
stream4_LDADD = $(TESTS_LDADD)
|
||||
|
||||
verify1_SOURCE = cmptest.h verify1.c
|
||||
verify1_LDADD = $(TESTS_LDADD)
|
||||
|
||||
xchacha20_SOURCE = cmptest.h xchacha20.c
|
||||
xchacha20_LDADD = $(TESTS_LDADD)
|
||||
|
||||
if !MINIMAL
|
||||
TESTS_TARGETS += \
|
||||
core_ed25519 \
|
||||
core_ristretto255 \
|
||||
kdf_hkdf \
|
||||
pwhash_scrypt \
|
||||
pwhash_scrypt_ll \
|
||||
scalarmult_ed25519 \
|
||||
scalarmult_ristretto255 \
|
||||
siphashx24 \
|
||||
xchacha20
|
||||
endif
|
||||
|
||||
if WASI
|
||||
LOG_COMPILER = ./wasi-test-wrapper.sh
|
||||
endif
|
||||
|
||||
verify: check
|
||||
|
||||
@VALGRIND_CHECK_RULES@
|
||||
@@ -0,0 +1,642 @@
|
||||
#define TEST_NAME "aead_aegis128l"
|
||||
#include "cmptest.h"
|
||||
|
||||
static struct {
|
||||
const char *key_hex;
|
||||
const char *nonce_hex;
|
||||
const char *message_hex;
|
||||
const char *ad_hex;
|
||||
const char *ciphertext_hex;
|
||||
const char *mac_hex;
|
||||
} tests[] = {
|
||||
{ "54662e55bb4771f9711fe5301d7412fe", "e51d417ab10a2931d8d22a9fffb98e3a",
|
||||
"04f672f8cdb3e71d032d52c064bc33ecf8aad3d40c41d5806cc306766c057c50b500af5c550d076d34cc3a74a2b4"
|
||||
"bed195ffa3e8eddf953aefe9aed2bc14349c700ab7e4cb974fb31615a9ff70fb44307055523ab378b133fefc8830"
|
||||
"13ce23bb01b23aeda15f85e65cdf02a291a0454900cb261872d5205737fd7410",
|
||||
"3b762e3ab5d06cb2896b852ea70303f289f2775401b7808e30272f",
|
||||
"d6736371f35eb067244dd7963ad2e0cd3949452cbd4c220be55082498ed3b230f579d78844311652a9958e82f172"
|
||||
"bb8072c4b1114ec531a6ccb340ddd86caf32a0d4c9c45738e9ec9c0d9154612f7d90465f3a277bebd667c0af0edb"
|
||||
"6935d8dffbdee96c1a96e4c4318f5d3bc90c1c8d5729e1a402f765bdc9b26b08",
|
||||
"ee9595bb3f1b32000578ffb751b508655b3cae8fecaf44f40d740fa0347e283a" },
|
||||
{ "46a5c72e03d900b48f829df00ecb88b9", "b25187e4b77b6770c35c7a962584597d",
|
||||
"fc8083311b38a80c04e57d069661b273264310906781eb7e4e44c6416f7336267674a44a7c54ed6361b43ef95005"
|
||||
"14e5d9e71f8b5c33aece756b64f3ed011922facbec7c3ffd27d01a853435bde551372806bd0c",
|
||||
"b73c81239e01cd81b0de13247ca4e3528b87f3078e2b674a667430b1dbdc3e93657131e654a4182b4c4ab01a33b3"
|
||||
"6e946f1fcc55aab06fc6f56d",
|
||||
"51189448af53ae3630c06a167ceefe6b9b5eba746fb9b53f4b3104d2b15b6020fa8998e182eb9c9d6b6463939e50"
|
||||
"723780f983733206ae6f11b986d95abe83555e64f8d3242d7e8055fcb8e2df8e41d318f06728",
|
||||
"caf8957f9ebc9a88469c04089962487a3c77040b82661616c5d5c83e974eae1e" },
|
||||
{ "e343d75de99e6d73543968437d3dcf6a", "317a5808ed5debf6f527a780e0896b2d",
|
||||
"247045cb40dea9c514a885444c526ac867b1b80e4728a23b63f596", "323094c01e",
|
||||
"18cb5d2fc5e27bdda5ba16f1320da42049759368548e5bd96f2dbc",
|
||||
"5d3e88816daf20f11018456b58b2614050b93b222f03be079b39a9bb2de49f47" },
|
||||
{ "7db9c2721a03931c880f9e714bbf2211", "27f642398299ada7fdda1895ee4589f0",
|
||||
"dc5180954df0c3391a60b44cbf70aee72b7dbb2addc90a0bf2ceac6113287eb501fe1ea9f4c51822664b82fe0279"
|
||||
"b039f4",
|
||||
"6dd5e43033fa6f021059a353edaf1f870387693054d0a2360fd1f6941a68f48ba972a1bc0816a446a6186e4a9a2f"
|
||||
"9df556bf709470137b8e60d9daa2",
|
||||
"c8a7d9131cebfa5388003cc30deac523aa9b09d148affff06ba40400e09ca900db770e07cedf5cd0647f6723c810"
|
||||
"ffcb59",
|
||||
"2c17a7022f6500450e86c8afdd60d3da535c2322fdf84f3dc67429e6ad92673f" },
|
||||
{ "bef8a47bbf0ffc4ab56ad5d9899f42b6", "3a2195a5196a0d785e04b38dd62f056d",
|
||||
"5aa0dc37e4db1de35789398b25dc656d05cdc6737de4e30ce944b304ec752bbd10ebfa51feff99dfcfe26b8526cc"
|
||||
"9b0cf1ba3d1685fb26cfc0c8888fd3cdf55577a516328b289eebda2e14f15eeb1d0f4207efebe3803618d43d9968"
|
||||
"8e6c",
|
||||
"a4a290a0d719b1aaf58f24152402b2f36957f44ea8a2d76b045390f5e0a3559a8ec5b2f871fc6095152183b7be75"
|
||||
"65d4953b593f854b8477e29ce0cdddce5cf8739ab56288c26c81921f1fbae38b90b287b4622ca8b5b6c0b4b02196"
|
||||
"e73ee56af6ae427ca7ae3ca0",
|
||||
"0ead975179d64f2b927440bf9ef666ab921e7a3b0832949f31315c2931451c5ddf810c17ad0330073922c07a18eb"
|
||||
"665aca01c05de58f7d159a74884f9d90cc10dc8c017ab61b820fc3dd32be52f3f7265e3a7a912a230b2a7ed19992"
|
||||
"e693",
|
||||
"f61ace25382fc3f88ec63eab23a6f9f6d1be65d149428bbb778a77428f909863" },
|
||||
{ "01f1cea5b7e20db64a67502bb4715033", "7336701bbc2d766167b57c452d010f02",
|
||||
"b3669d31ef8040dd6f462624977d69cfd1869fb19946595759b7265eb98b51f579fddce4bd38452fe3",
|
||||
"d007e9ce654ec9a8b44e3655dcac889176fbf8012b133c4effe70b716eff43264d67d84a3d8504858c01002957ca"
|
||||
"c6eb75d94635fb708343a18e20615e4ecb963bd98a8e7bee66520fba5c2991541c1e7863c1c97ae7ba6c3c34f116"
|
||||
"1518097b6e75dcfb3aa3e93995eb39",
|
||||
"4e643f7a1b8c0d595c8ff2b00c0145deb5bfa13d8a1b75d7a731f2258b690e1a3b2ce2cbacc6d05c42",
|
||||
"8f33c6494f971462bcf82a508f341905b8febf9a9d25363ce853d59230d5e60b" },
|
||||
{ "76d53860e1c45cf60d76d8336948e337", "579c0f0993f13470fa301cd4c6fbe99a",
|
||||
"d0f5d2b3b824fe01ca36d00d47434519b2112195093a06d9d07d7f4f9c5b8f2a4c68668265c40d6edd6e12b5a350"
|
||||
"e4af11f1ee6226bf307a1a6c25318c0d3aa0421edf565ad42d524f69d0fef06c236c1f0d0e50261e205f381c3e11"
|
||||
"96dd8827b9990d674288f8250596",
|
||||
"a7a77cc847afdfb9dc8ceccc621462302f31233a830b3827ca68618e604c95ba8615f6ebb5ff1c2c66727e70c038"
|
||||
"554619f96f79d08902fc70111f853766a2db04e51d",
|
||||
"def4fcb75110820298f08a8a4941434deccb952dec01215f5e7f5a2509fcb9e2a994a77d5eaa617da9cf2f03483f"
|
||||
"aff5831506e5617707b88e08195b6a993219898c3ead769ebaa002934d3c80023833d7ce4a7a989596de6fe78eb0"
|
||||
"237e8caab0a9fcd2625af80caad6",
|
||||
"a4a60bf81cb2ce55df3c5864eac4c93d7748010a1adb6e5110d389e0501d7004" },
|
||||
{ "cd05e08e14686623fd334780439c4ae3", "d05ba5a655bf7b1be7500f205c9c80b9",
|
||||
"021c20518825c167a746a728578a0f470b2035c7b39c75f3e492bcc2e6e96035c4fff65dfbfa93cbc7a37828a0cd"
|
||||
"62bf1b20b3bb89425ae647e021cde586f652eb98c98b1ac1018c6fe3e046f41545bbfdbf94dca48e465aaed8efb7"
|
||||
"eab5ea143e5b95b72a078f8fb58d8ecfdd9a3a968e2468b6",
|
||||
"be9255f750498ce672c877285e649318bd5bf07cdc5902b7de61a8415b6fbf20b1e432ebc9f8f9c8e3094ff6dffd"
|
||||
"1b1e0c3cc5",
|
||||
"faa851ddfe54b01cf1a3caf34815c6db0145ddebd1f34ca9edd479bd4a3bb4bac21c2b5d365ff4d389a764bcc143"
|
||||
"6e51267ed3e4f225b7cda1fbf25d221d91b59aed0b4d20f71859f41e85e15a02e2bcd59913d8ae019d1f01ede317"
|
||||
"b4ff94ed2b05650259a705c3b2be2c2a9c82a4809dab7b03",
|
||||
"83b60061bc457578effce5462091e0a2b1f8ee35dbdb6a6b17e4e6179df6eb18" },
|
||||
{ "6870a5652199e2f17407185bd7cf18eb", "942988922482351c317244b26587c560",
|
||||
"49b2f6765f7f552f8704671271d703b3b02157f71ed84e64481be8bbd4f3493bfd3f313ac62ba4e9a7d86288533a"
|
||||
"7bc7a4257cad5db04bb80d6574e473519eccd15cd2",
|
||||
"6cc34a81ee984b436947b31574473e0a849a341db0ebc67f64efb39c9e118f65cfb25d1d898b4ee8052f700cb43c"
|
||||
"be744d70b71d2086a89ad12dd67feceacb092a861ba80e41808c625fbdce017d51916e1fb5b38b0beebb27478d83"
|
||||
"90ec79b3f3902a4ac22d79",
|
||||
"82d3ae3aea3870e40fa48da698adcb596eb43fb063866f6231bb744b687e32e72117a03da08a635e4ed0f255f28f"
|
||||
"3db6f0b8a7238d0244994a507fe75ddd17138b0605",
|
||||
"a3feae07a737428751dc2c92301bc012b0d5c9c41a7543d248d6213a90343565" },
|
||||
{ "15a87aee858f5723beb477b2cc039d14", "6ce71c763784e59fba852ae39b25de3a",
|
||||
"25d1d38a8e9e8c34564abbfcba69035ce2f78df8626543e7639f2f23d742853e34880e7bc6d684ed3075abdfb91e"
|
||||
"36076242dc53d60513333f59d139e680aa246b0e7e6092e8d4e6ab471459068c2a83b07e8b7969c911e3bff7558c"
|
||||
"af02b3f3e6de7ae9122d533558868d993b8242b2328834a88cd656a941",
|
||||
"26fde5885fd22bdcba8b5c1b5f66d09c7da7bfef2790e6dd2a98a351056044495fe4",
|
||||
"2e241f3f96e8bde7d2b5cfad94461d6c7282405c77918a2a8731711175211814e20e72ce01139643f58a2336c05c"
|
||||
"c27458f042ff063bc73fbee2ca8c099ff1f3fbe8517fce6cd3d54567220218cc67b4ef52767f75fe514e8ec49013"
|
||||
"d9fa787685a5a81efe550248f342eaade9cd61fb5037634f2bf621c944",
|
||||
"694a5b5ae2081becf4d38b2958d3557438b9f04dbefbe649baa91924e17e4d88" },
|
||||
{ "23e2250df6b870b6eebbce928cd1a80f", "279f73beda18846d7170c29414590029",
|
||||
"9cdd4e34495b4a03ca2c5bef9074c1",
|
||||
"f306eb122b1907b4b6bccc77984ea7be4a28f9ca3615135d4c84ad74d7469efefbbff997bb495806a3d9ab274b42"
|
||||
"28cb894fceeb24c4905e121efbd3ce8be668dfee4f9e38584ba6c3374337d3c884cdaddcd96f63df225ddc879e0b"
|
||||
"a4bce0125dd0",
|
||||
"8821c6d2c36ae97bef1b9d78c1afba",
|
||||
"155b5b0c92176ed1a2248bc86b04570620e97a2a601a3d730d53236f43696c28" },
|
||||
{ "82f02cd289d07f40acf9a1d2b1cf7f06", "09162f09c3893bd2c5e4f2c8f6ec9930",
|
||||
"29f1d0e8aef96c9936eb5bcb32b0f751b25a7a46d4cc5a33d5f96dcaea757b2b",
|
||||
"4ccb0ba7f1b2eecbe3dc3ba47f797201ca656ab04e5b38df9b95ef24ba02a5ef04a9a8122f954048581d275e",
|
||||
"6b8f329fa3e905b7c0df490f18a13ab3b6be6701cba59a1ee7c12d054c500e58",
|
||||
"8c97a1010a25a9e9047d4dded0235450f488d3c18b460316e5ef5517edc82e3b" },
|
||||
{ "a28c7a79d3d7d7b372c5cb4eb66201ba", "3c27d1ca6e8fd19cbf2dbd81c87d2ac0",
|
||||
"0ff33640432edcf34a2df2527ca13a0340d5adcae1d10589edbc89701f5093efeaf6d7d3f97a778052a76a6efe7b"
|
||||
"37021a4fbc8205f26f17dbd0c68b60c6403c4160985255aeac23c3bc88b1d8c11fd4197ba366962c",
|
||||
"96bec6c8014708e9142a8ea0fd496f89f5a2414f4296ae0a185b13f362f2",
|
||||
"f20be34587afaa4300683655ea16a292bfc7f2779cb771e520c6b0952e41a2b89e45f6c4b571779d573f1383b5e3"
|
||||
"11f71ca89379b8a3eb9d9cde72b16e0f782058e9bb4df4731cbd7c67af1c459061ccff149da3bcdc",
|
||||
"d9dd91cdfc19da4a95fca7229f296a74aafc0d78b2b398e7dc089cfc6309d281" },
|
||||
{ "24d66092958836e491cf974f34ee7ca9", "1c04e8166ef37a2a5d34b4462a7ca8bd",
|
||||
"01a77fb558d8d94c16eccc82b49f53823597272de8e6df070fefd202042665ef5788bab86c70dc3e571e3b372654"
|
||||
"494e552ef00462bf0f7fdeca8efbaa51f3da63e6f18fd13a4668b7fb1a89464a09a17d9ce709b0b8f079d6bf93ed"
|
||||
"4871c0",
|
||||
"3c082dae68ee1cd6b8d1ef79593132e68e373eec746d13583f28d42730bfa18ed77ee83ad6c3db24bcda6d5e2925"
|
||||
"970dc01d1968b744cf3753e597ef831dcab728ce66ef3da0ab872cb0dedf77922a57abfb",
|
||||
"47ec41abfe34c4ece7ff8f3ba179238f38f3e527d97d7f3f6ada79a9609e715cd0acec31f0a0df25c7ac0bb894fe"
|
||||
"791cc467a098710e92af75a14e68d9241c160d4587f7da279deaa9cc9d9c5a6e97b231021ab2ba9c63473cf269ef"
|
||||
"294d1b",
|
||||
"807d350484ead90c1470efc0c6e334999b204444034151c3b80961faa4b821d3" },
|
||||
{ "78f67aada609c94a7c79f2fe9bf9c82e", "9ad46b00946c799b17b683ed3d920896",
|
||||
"3fc884334f762cede042a56b4a89ad9eaf474459371f2daf7c157a352cd5ae6d45662593bd3eaba7bf59ed569429"
|
||||
"c52153599f02e3263b2784be00e52e30d0347553fe8aa70a071c3f2e34593d1e78692f9a194800571eaaeedcf297"
|
||||
"0784426959e0",
|
||||
"80bb105971fd223f89efae15ae1b5e252c7e1c761b6abd5509d8354adbbb5007928763e715aad67b2109ac60afc7"
|
||||
"3e386a75084c77a5af1021ddb4bc636c32a70ee95c6ef5eea9cba0d1c944754f328208ff78f7b0718899bacdf5d6"
|
||||
"e603e1b098acbffc83a86a0e122078338e0bd5",
|
||||
"325ce1b0bb065488f9f74f779bdc433da58412b3834005b4661491e7d9d6c2a371560ca7d649093a7ab2475548ed"
|
||||
"b37b425c23f75eb1bf79b972714469174fc85665dbe2af774719d803c2426f067ae68da1ae0783ae376970055cc2"
|
||||
"8d484ecae2e3",
|
||||
"5f755de0d9a033967a9d23e3357332ad9640983fc121cc9104c8e79b37a9ea6d" },
|
||||
{ "ba4c7e6a36e4684631fa5ede07b678cf", "ed722d3769b33d82626ce89bb4d212d9",
|
||||
"ae106ad8029d73ff984de16db70772ca9adec5f2bffb1d92e12412b6f76f855463f47f1739d6e9a1fab5a9b7ff3e"
|
||||
"ad419efd7fd7b31a0c5b9b992aa8d0ad754cb5ba371adfc60a5cdbcae37c4653b9cf5f46b015d31a03e10e288256"
|
||||
"7d2c44255c30f1",
|
||||
"1955a221ff4b3f271876a4bc04cfb41449881f6ff3a7e9aacaa1e992a5218af3294027709c1ec594bf863000ddb7"
|
||||
"d561ca4c3f42340ee932e71eb8efd1b7dbd19f6ef0de28d437355b2b4cd1527cee849a315fc9a35ecb6e458e4af4"
|
||||
"df07a9e108a0",
|
||||
"aa24653b20af5925a19e486d0b28e3bafdb240aa984c8b365792443a5411c8385c8197d0a13f1a8a7686c02cc0f7"
|
||||
"adbe1230736362afeb3c0ada988dec6d35fd298768866f64aac8dd560250e27bb1007a3fd4c312a8ce3af4af9ed2"
|
||||
"7d5859ae56a3ac",
|
||||
"b06f562123bfc9c4e36e2299da0d6987c2c191c2486ac2ff9e2baa156ce6cb81" },
|
||||
{ "639668e0b0fbb192b83f870048d29c1c", "48ed7de6da13ba38a1e748eb9ea57529", "1ceca7",
|
||||
"604b7b904ba56e1f2d17556236150e5bd19ba125f92e9adef0f75b38356fc9a1851ba34105805cae7e99dc7bdcf8"
|
||||
"744c44f06e709c345cadcffde348d2d55c5c36cf5ee1f288509e7a878dc00daa3d9593afafd7a0d94fa78960b3ca"
|
||||
"9fdb2b7d5746d1f4702080fadaf0cd6785373a16ceed056641aa4afe725e",
|
||||
"0f5286", "b6b24c01ae14d452da68d75693fe772340ee1310d329281370c6c54231372be2" },
|
||||
{ "94b94725497880ff10d89572b62d1029", "bbdb56d8112d298fd5686b93787e0011",
|
||||
"f062bbe085b5f49ae4064f9ffd", "de189cbb1821775cb97888f25d4781ddb82d4664634f41",
|
||||
"d317f2a31eaa3f23e84fc3eaa9",
|
||||
"5098967201169e8ab8242b8e09322165127ef2155795f62fc1e55e6a72363fac" },
|
||||
{ "8e6f1217eaf84aee8e5897f5860f184c", "a4e099068ad0b67f28b6902a40921dca",
|
||||
"53c939f8d167e49980f8fd3ccc4a2ae3",
|
||||
"4bb7fccecf15f0b32be37860507fc53812713194e2844855894ef916abbf9b5d",
|
||||
"92e47292a4f02cc22d3392d1b6a089ce",
|
||||
"a3eb3e03808499409b00f0bb635c6fbf12062469edb45f5bb252c08748e131ed" },
|
||||
{ "6968acc00e83184e6024167672c5df8a", "2d5b193c93e8aa5302fb5bb20cd59504", "bd6b6830",
|
||||
"7f4e725f4b0f84454e823b8193f1d8b39d78a8b12f1a2250beb0def895dd0aef8960652c071a82d9ad89910d9728"
|
||||
"7e72848fba1623f441d4955a019f5c1a955b054db858722b1f15210c3a752fdbd2bd631620cc56c2c30d78ccb162"
|
||||
"72eeeea1",
|
||||
"c01c9b02", "9910104c7d6d91e99c167d027c4190701a21c2fcadc9874b1744cfda7b75b8c6" },
|
||||
{ "1e7e0ef737799bb1e00ccd4e31da5ff9", "9d1111da7d3d329ab5d824404e4bdd60",
|
||||
"76cbec797c2364c6ed70901db527c6a3471a84f8d297c64c9dbffd7c3204503ca6e51c8c88757500ed503ba86d73"
|
||||
"67baf6b9f3f5f2b69308bef97232e67698ae10896ed70a66a7c40115770f3192b9168f66a359270c753bfffc5496"
|
||||
"58fc7aba3d3943221e125a6f88e025cc024b753693",
|
||||
"7e6c97d0fee9f249c7510c2a0abf9530ac49cecfffe2ae37c9d38ba60cd012d3e00b696ee54591",
|
||||
"b04070df9cc5d032d1914eb69f9afeda61559ed98c7e5fbeb81930b242cd30cf097e4130b0cc45b3e3178ba5ff25"
|
||||
"98493e1d1fe22fd14f3cc2de08fd8cbb3539d4c71c606adb7826c2a9e05ac36a6795293cdfab6d07fcfdedac099f"
|
||||
"1ab9bfec63a32f7633e424e684ca8744b4ad2288ed",
|
||||
"a0b933e1a706046c38967971e50c0ce9ececaabd188092313c654e9f297cf18a" },
|
||||
{ "6dbf15415dae57093e6774f4a1b7e4d8", "bba38b490d740d7b3df0c9283d4a530c",
|
||||
"fafe1562e69a0f5149e0ee65d14b42098a8a53a58d2cf07fd86f6c64cc4e67d9b5cf3655b5ed7f722d2073a3e9cc"
|
||||
"8372efd9620a32d6443a328436dd5ae394700ddc171bef8cb0674b1fab87b3e93aa426aee92c7ff733c33f9e4e49"
|
||||
"f614043a7fb42cf657e4e3c2",
|
||||
"c742a929d2a766dde0fb0ce2d0faf790bd6c5feb63cb3126402aac7ef7c9ddfd408cd22bc6928a9b67426e20c3d9"
|
||||
"b340cd7231f87ffbc29a8e6c23602b9dc434f5ab06bb8c049803b45cf088b919e8584091ecfca7259e0d130ddf4c"
|
||||
"a45d44291024446f58f1271f",
|
||||
"d8dda53eeb8b375930698379836e64014c22bd885b5b5cafb4dc65ed00aa947acb2792c46dfed8ecd155b21cfc98"
|
||||
"ff163b403e3a9961805436678fd34942354094bc47663165341ed0b949c0ecb4da5499c1c8c87eab99ddfd0fc2d8"
|
||||
"0a9a520461e3dc402c3d4b4f",
|
||||
"f8e4c1f827d4c5dbe00e7794effc567089b8128a5b11e3c6c2e5e36414b4618a" },
|
||||
{ "a6d38f5cebee041a0afe035caad48443", "cb7e7813c7018b25782f77e0ae7c84c7",
|
||||
"6ef6c5d92f3acf78b3e2c8334038f364a51193e4e559b1458dd74c44269e69a7a6af22f531680c63270b22ee7154"
|
||||
"7d72abc9b87bc5639a1b3a13f8613ad4d1742e8209ab",
|
||||
"d536bed277bbb5a9",
|
||||
"457fff7d0e1b61def59fbe99e81c08bc370bcac0240c9cec6d6a0de2c37f9950f5b2d12b8b21126af18d757c743a"
|
||||
"2a9bf451ebcba235f9f48c31a63674f0e8a1c5af5094",
|
||||
"269ee12821b981d794399bb759d233db2d60c1dcbc3a9a87dbb068551b032f1d" },
|
||||
{ "753eb1d49c102d1e3a9bcfbcb1cfa369", "0e0cc4395844d363ceccc8a07a92a2d8",
|
||||
"5166ac0bdba2b660af164fc847e4ad300675cda9f0acda47567f7952eea7084832f6dbfa0aae9f403a5bbbe307ad"
|
||||
"40845cb08347588063ad3f1df766790c023f160ce21bdf372fb48e0f7e2ced50cb3f86c2fb257ad7863fadc5fe69"
|
||||
"92bf1c4508308b259480007a628aacee94c258c91cd847f3d05251dadb96",
|
||||
"5f590a65034eba433e57a9d089b2924f5f8482db6a467ea435478afc",
|
||||
"f2fa7ed4fccf0388b7bb291977d2214d03dd30c4f81bab2df8f2c1cfaa46ff2fd14733cd7b8fefb6dd020ecab3eb"
|
||||
"478d1fe0b849e057512fe7b897b171771a2b68d7fe6d9b70dcfbb6307dacba5409b7fdafc49752e4392111474388"
|
||||
"afb6d79ed21a60c59234bafad676f88f7653765b4dc758c9fd930b2632a0",
|
||||
"352c935b482696f9a4f40de117ac4efe5c38952c8a45e23242a86c66e79f7f4d" },
|
||||
{ "711a437629429db2e14058e2a826dcbf", "eb036d6e483a212ff6ee25d970fe1ac3",
|
||||
"29937c0efb36ed27fe7709d7179b4f38a2fc191b5e8d9616b58f6dc9ba2ab74e13bbdcd233e8726d90f7ded06c38"
|
||||
"61582f27158732f997df9091446befe75855ab05b348d68f96e45445f44c31e9ba3e4d7be96d9c8e806535e79079"
|
||||
"139c71fcc599fea8701e0c2edf606986eff1535afdfa51d1be2dfdee",
|
||||
"",
|
||||
"4a61f5d6b8e746bf6fb49ca2b16c22f4e9ffcdc89a3137b39bf5445fb6b989d5200f0c8d5538891a5e8979b5cd8c"
|
||||
"734128b4e4ad98b0cd598c40ec9be74725dbca84c65a52f17ac983330b0b74e4193540f6357c3bcde4e8d8fc6942"
|
||||
"314ba68115bf2a682756e3c42008803a81532708a0e7b5e3b8436145",
|
||||
"4af113e2b6165247c2760ab445c6985306c81fb9ccebb8df0e57b0b044c52736" },
|
||||
{ "a26d6028473bf7de23851d00d514455b", "05b87c16ebee8bb62365d265ac6818a2",
|
||||
"baeef99e6d4d15be9ff68a5d94aee7afa3d898cf42f94ad572b089659708658534d198dd3fba47a48611e8d78da"
|
||||
"d",
|
||||
"5d77dd8066d3cea3b0762602ba6ae3d1ae1c27d1ebe70bfcdc068912def545362a5bd2",
|
||||
"e4365eac2e7b5d02e7fc6c110895bcf193a0ebe28e81d0f6128a95e3e9183582ebb964d666972bd7fff8cd3870c"
|
||||
"a",
|
||||
"515045f7ad90ab569a6c8b90808d64346334e71d03db18d07d19f40b2b94fc7d" },
|
||||
{ "9bb0e363275374f1771ababb7b96851c", "08cf3a6355ffbe621ea874e917729d4e",
|
||||
"b380355f794d31e6e85fc81a49fdc2af2104471609692f94c994a710be5cabdc9c9a61b94fc3f76927c1cd5c9a53"
|
||||
"55a0e8ec55a69ef114b3963ec95137b9ff84240c2a71d3b3459056d1a183eae21cc5a7c109e937faf8f61b6232fa"
|
||||
"30951f030047d7555b60f85a318833afcea80ee4d88a98",
|
||||
"a7fc199cb07b6e5e498dbe590af4a4d95d35b043a97d52e11cc1092c70250112e070e49fcb8a3e7bbfca3d0c4467"
|
||||
"ba332c0dad277a997f2a603fd2d016979c24b3870a",
|
||||
"f8ec2722a9aa97d0cab77f7833e6bddc9570bb79a159feec2dac9d2366e7eabeb9d74ab53a846fd8ad052a740dba"
|
||||
"39801b681e4da903939387ac3578eec4547dc97c43a8824db11cdae4e7ca8330c9a2d4249853a7285c54498e59d6"
|
||||
"45546a5bb5858b8ddfe37a14242d9750b02ccb41b92bbf",
|
||||
"1f6822430a2fea84595ad870c833951814a0792cce0cd414bf9f744bfa7c9f72" },
|
||||
{ "7458fcb1fa1a886924a044eccab9c5b2", "30565643aa9bae844b87bd459628d093",
|
||||
"4227dc17d3e0ec8363c84b989f72d235d3991e57ebe8a6fcbcab1053edf3b323cbf5f5f45aa142494ab0afe78c",
|
||||
"d07afef73f3cabbed475b69fa30aac8af674b74448cfd4d6ecb0c5c1b5b58d0c7173eaee440be65715d780d61d34"
|
||||
"6dede7c52724bd76207ada9a3707c1326dffefd04fb29321db617d12b4a607452a5b197460bc524a40672628e5b9"
|
||||
"d45f821a5b",
|
||||
"50c568868de4b49df40d33e6b25abd6b2dfd2f22bdc12a18ee2407dfe82cd3bfa2fc344c91ba6544e079446073",
|
||||
"5d9f885ee5dafd1ef4a2d0a951941f1d03acf8adc3652ec34e5b6ca4bf7ed18b" },
|
||||
{ "68df4e697e83c55c822bb3637bb52d54", "1b0df23e69aa907856ccb9ca4d6c51b5",
|
||||
"59242d6e2d7e612d2aee7e8c08f53f172e0f93d57b0c08e7cffda90da5b2703eed8192511f6f1bd59e9ae781b4f1"
|
||||
"156ae06ec38b5bc1f5dddefee49f561d692f832030f7a1b506c0ebe26447b3eab68172e7e7810b13d425f6c78e1d"
|
||||
"6591cb4a24a61c5f9554a083283485175c18cf5df4ecf2f87c98615de9ccb3",
|
||||
"fe9643236be4e7aa3998f44b4336a4c1f8fec28e17",
|
||||
"46e15eda413037249e584ea1e3007166d70bf9c998ca2a8386bdb8efde70f3bd35a9b0877e333451f7789f4d8b4e"
|
||||
"797170445eef5f818bd321574e66b7881cdb546eb5528dce75cdd1683e715b2ac7ad259954bca62d8f0f0066fa6a"
|
||||
"df50f9e13dbe3ca1e503957cb5f8a2dfce0ca7377ca51989e3d8e5275893ab",
|
||||
"6afa564c9f5a650cdd7284589134c6c1379fb798af9330bec354ab1221539e86" },
|
||||
{ "a4b06bbf87393d2b921dcba697274f07", "5c14d51c52d95ac040e1060a0ffa21eb",
|
||||
"8c85ddd8d3f446608e656052062f0cd58e6d58",
|
||||
"847d3b95895426225d08865cc9a329f6f14e63bc5a66fb6f2a05bf8eb9bc8166e6fef29e1d573acdb4c3bc699dae"
|
||||
"adff7df5d6e8dbe2ef713008afcf9b6e97ce6cab4d90594fa4430ecba5bb62a7938f03d57869",
|
||||
"cf6c47fec422ee29226b6cbc5092bf670b5434",
|
||||
"0d57758c68a9524557fd6f6742d24a00467846456a5bbb1271e2a5e8c3ccbea3" },
|
||||
{ "50034800a878a3e570364540fc862b77", "bc92f50c2630f7fe354399fa9a6fc48f",
|
||||
"23a93e636d1924a60f3461de1020b73ba18fc3854c9dc9f166d7d4d1912503bdf1",
|
||||
"23d5009057b76a00d92db6b280a3a30ba08ba3afec6312197f06ee01dc4a22d73ea010e02b65af7968d8977f9762"
|
||||
"ff5a6dde278d8b351d3b8efb32cf7cc8a70a7a8b3d79",
|
||||
"2cf9f00b66c63518354ea59510c178d75499866218eb5a031a0dc4d743ac8c05c9",
|
||||
"7681550d340ca003acb18bde30e7a26b23022f9e71dc0d7801ea6e9e569784f3" },
|
||||
{ "d68448b73ae9bd161c9f1f36dbf6163d", "3345d820331958c63dd7a129d3ea0de1",
|
||||
"ffa236070dc5b464eb034a9332041a014cd7852b498be2dc498dcdab4151d71f47c7a6b17a176c5999a7574fab5f"
|
||||
"f469cd02226492a38693eb2296a4a7cc2857b28b5b61",
|
||||
"c790bb04036883e6e4a6912a9b0afc36607e12b0d457d4b5f6c120cf0c009caa087fc2710439",
|
||||
"1474d60067d082706bb0cd823b22582ddc0fd68412ea0e399b03988e616ac5ca0a7a8da6e6fe29292b57046c289a"
|
||||
"d8a52360ecd19655bb801c6eaa2ccd66ccb14c4c3748",
|
||||
"a1d80340487279787a1dcfd1082fe04d557c072f9b558cc78c956c1b06a0683b" },
|
||||
{ "519fee7049473c7c41f3bcf7b2f63a69", "be227d2bb97f2eef62d5fd9203cb63a9",
|
||||
"0c121fbcfb4f4f8f150281140e49d71dc5ed82ac4a30263a6b2d92c55ac6fe4f43f64c0f526d3df642c04a5c51e5"
|
||||
"8703c381701b1f4618cf66e27c60dd5e6558b48028d5fb11339c4f2547a3aefd8100",
|
||||
"9ebb3c33eda54164b54bf95d4fbe113333edb0fdd62c24532fbd4cb91b11e08b1e74487dbb0f3daaa08c566e759d"
|
||||
"53ea3974cc3685ec460e608f7d01fd2dc23d9bc283c73ab492bc9fa2ff458d268667504cd47e585826",
|
||||
"c0e22cc3aa610bda350a2ebe8f530c05cafa19e7060b064c276a06f0bb430b79839c51e6b22aabf429616480382c"
|
||||
"86f8c04ea397c976bb08caf8f35c38208e476787ce229a7a300c5411471548b15d9a",
|
||||
"7891d41aa7d6f935761dc0454a7919d511f629fdc3f38f4932eb0148d870a24f" },
|
||||
{ "58bd2c73aedb31baca592e42d614c68a", "bbf76585731b6334fd314e771d9e404f",
|
||||
"d238c5f0677c86c001e66691ea9eb8aee429fc490d38abccfed3a546b5f05398288e7232880fa3d485fe3862c546"
|
||||
"9f980d9ff4caced1cbbe7f97adc15b6919876b8cbdd35320a20eda8a1ad6e853164b0e0ffb2f702e1d6a0eae8b27"
|
||||
"577bdd4e5a17e6d8",
|
||||
"86147d2debc30111b82c1ccc41a13dab1aff144bf2810695a40d02bdeaf519669a1b81864edf",
|
||||
"94fccab0dce48d5aaf42ef59764cba95b42410e2d6b2c87c95d8dbc15421c45d7a556e25296df9167cd46def7d10"
|
||||
"602aeebd0e7e909c52ab7a22f833e976fb76b9b39b1c2889587582d44ad8f484f0382804d7481f1a8d6c903b1319"
|
||||
"0c213102ae273378",
|
||||
"67a012ae5452dc293645179c0fbe23d2f79ecf435e4fa09208ddf8bbd8bf8b37" },
|
||||
{ "a27d07b0976574c43edba5619b3c1f27", "879f4114bf61f1d7b487bcdff6c90778",
|
||||
"302994dba80c2268f5b1c77bfad0b780a9be6437a07dcf1fee61e8e72f7fd3ceac24a01be486a2eddc901a19a0f1"
|
||||
"0eaa94cf46b604f98a90c0f62fa6476d27a338bd046fffc26570",
|
||||
"b97a43027c5dcb8a95",
|
||||
"633c76783dcb88ff677a6f567685ada02d787eb9aa3a527a45fd415180f1fc19cfddcb90583621c2609558703c7c"
|
||||
"5ed548650c98e591fac7a692b1f921284ebd8b86d3a1f26f1ad2",
|
||||
"1f54a298784b2ad47bdbe5c982b51b2eb5f8c96bc4b46a57dd703dbd7e1b199a" },
|
||||
{ "d55658dd1f27af02885d0f431fb2ebb2", "0aba0b9dfc9831aef0203bc61a601176",
|
||||
"05805491b667d9ff38147d96493db29441e188243f72668c7ba61b",
|
||||
"df403489e3bb67eeae8440569f6fbc1ae072305f5047c5105a7e4e5349d3732d75572298253f60e3821c721941c0"
|
||||
"2dd761edfb081d09b3c7528a0e786a6fcbab709727e7d614ecc604def19c78fe061040bd636d842b16e96158db07"
|
||||
"d6c2521ad54778acc78f12b450db0474ef700dfd547f9c5b",
|
||||
"2e8adbea0e9ef5068fc3abb39ccef59616420d4fa038e2f35b560c",
|
||||
"d1f27edf1046f8ad30e9900c43a317744dadc934e6ceeb63184e0663ba80df77" },
|
||||
{ "adff46e4d7d78b3db5c74c712534db37", "c54185637dd281ebf672393cf9bad28f",
|
||||
"b3850ad942e221753e4bf30140eb5569cfd9972246b9a6a35f7a8512db333aec59d380973d6a6505d99cb004dd47"
|
||||
"b33e32f4f238b1342e6756d3619414c31bde45",
|
||||
"59bc7a834189b930c8cbff769ef63b5e1a08c352ed779853b36bcd3d0ca7b4e35bd6cdaf2538ebf0e3a0d7cbcf3b"
|
||||
"cd2b66b910967c226a1da42f84c4a8f81e19161c6593e2c0a0fdddd3c6ab3a864037fbf976e8aebd33d4450be989"
|
||||
"3da2e37e728916b663944e3fa6ba543d1010",
|
||||
"5cc93a30fd8f71befd87fc50112c156b53abfc97466f36e3315915a7d4147f0b3641177b9d08ec13e7315957d078"
|
||||
"ec73eb0a93a3b7a51e3db63a396e6ea2adfba7",
|
||||
"9c14e5bcf26a00fa0bb04256cc32736d0f2300ea93a51f8e4ba69d15ff11121a" },
|
||||
{ "4a5d7c201ddae018edc9783413dd0329", "eb7e038948d3bf61d2cd29d2fe722603",
|
||||
"3e6a17d47db58690b895619128645a2782d17e9a3735c1450a7c8e13a9f212208fcf256f",
|
||||
"65b8cebd83d3197118fe81dddce22b3947653e04a48d05b4a2dbc42a89e62b0d6b61d5f31487af",
|
||||
"a1a858d13540281e1d0a9a82e3caef64ff742e51b1f7476d318729508a68840b371fd300",
|
||||
"62b25795c2cfc4d7f8c1058256ed2d0e73374f8e33a106319a67778387150217" },
|
||||
{ "83190fd90c68cf63648dbc5daa442e3e", "3c3683fb5d3f1446f8c0d0127fc59d5f",
|
||||
"a5136deb0a795dccc18889c23e9bb21640864981a4ecd903e8fb62",
|
||||
"13066ef4f97501fe1854da6e2d57ed43e4c074ad45b7218536e7dd8368a4ee8c6f2b63199fc0a9a679e2b198bd3a"
|
||||
"43e6e8bbd6",
|
||||
"0c8cc3bde1f4933729293718686301b1ce50f5e7521655016f8432",
|
||||
"cbfa761976091ca1ffaadb4278f141f83bd6b5270f78cbcdf61018a744ae2fe4" },
|
||||
{ "05bed4c00afcb8ecacda8daba02585a1", "ed014d4e9eb504c70d5d3153473dc146",
|
||||
"6fab5ff04c5a74a0a96948501de9167597a42fde4c50ab27719dd1e2b0e0fc0fe6e48e97c79d2a71fcb5e7ef60c6"
|
||||
"7a32bf865decb39bf5ac17969177b2fac849a38e08bbaa3be0d6dcee9ff685ba97e9b54514624d51c270065508c0"
|
||||
"3e96f28667e3c79f6a68859a85048301779da7e2254b1bd1662ae3ea15e0332c",
|
||||
"ebb614315ba4b7d69632656d5a4d2810112862ea3e443148100bf2e89d059bc9e2d9563bf34b823c57108ca9a88e"
|
||||
"4b07441f0ceca4713e2af56f40f35d6f2223d37e9eeb61739a65933712763104a67488d2022a5e033e240969a4d3"
|
||||
"3966b4527035eef0970c69660ab3ee5c00ac815a9ee52d767b0a937b",
|
||||
"6edcebf7ac2cd10be8a9a595a00e68e2d3127f5de640323791229141caded658e99fa59539077027ed7b7a433a79"
|
||||
"4bd523ec59f504978964d3e17eb388956e43395ec89b252a93b317c64580426d1ab0b633a972524084be5d488645"
|
||||
"8718ed42f47967eddabdf7b2f440818e0aab9d932c10a4c7283d05b84ef74a6b",
|
||||
"7be2b003c341d5a7d1a7fbbefd6170d8be25e785230bb6adb70785416eabb281" },
|
||||
{ "53e1b8de6176c05e04f5a4787e733b3e", "574de8c0f914115c9267f7852280fbe8",
|
||||
"0ef099d6995b41d4e9227c3aa59da313160afaa32e1753422c1eb45bf102e806aa996a54606c78320e85da74deb3"
|
||||
"9e8b0059bffe32780ec784abf6bd540d3c01e9f13c4209bec2",
|
||||
"3d9ca3718f31b4f37f988ec676fc3b5492a44792d1a4f8fd7cc4726fae899f102841e7f5c04b2ae2c5f9eb204c5b"
|
||||
"74222d89c2bd36b1500b2dd81e9643142becec1b88aa7a0d7ea4c81fb7e8fb37ec1a58e0383e",
|
||||
"5cf9292077dbcc9557a1cef51de815facf02a89c9e29ac62098c8e4d0cb49c4f55ed55dd9dc9c36a634ceb8f4dd4"
|
||||
"75837582b9be1c17030c0546b335be95fded1c416e4599851e",
|
||||
"782baaaec2b50b6bcb07d00c6eacb7fa8ac084113bad5a1d6dbe8c80340443e8" },
|
||||
{ "81118e9376e515a93dbdda15e58ff387", "75a0f02a8e78a0d2d0097cee863aa576",
|
||||
"f30c353db4dcb2320ba5fba118e50526800fda7ebabef05bdf15aee5d9b70f2ab697937d77a01bb4bb460fcc4233"
|
||||
"acc3b970f4f434e9ea85f30aed7d247115fc5db1c333ac6a008dfe65ee02b930ea097d046f2923bf84785d47f382"
|
||||
"b19651948d69a6e4b861a7112c4e1804f6435f70",
|
||||
"6f75857a795e6aff71994dacae41c2b2d9d6d7e67fbaed6d2e20bf89da461f509ef3d284341a8a2059ef1b97e9e6"
|
||||
"820f1a72ad703e71999be36fd7156d3e3f35663eb4db44a858e08bceb154af51360feadf3bca8f20",
|
||||
"0376339c7324168426dbc1f36ee91603f844352817b575ffb25ca6a75e2d0f0d77d853230b7e5a4823195c406298"
|
||||
"bc3781b40df001d9cfdff16de970df4ffd0aa652fc7732c6311e2665daad93bb2576d43e1a58837513c62a8b74cd"
|
||||
"e75901f9520a29a10e4dad9e4aa981c5e72d6cc0",
|
||||
"d5db09ad858cbf4f860e527aac44bafedcfb01653818baeabfc8efeec0e3a9e5" },
|
||||
{ "2d60824c89bbeb4e2b72434aa0356587", "20ad2c51679a7246ca6d0a47ba7292e8",
|
||||
"17aa9ed83ff674f959085ecde2a6c5026325265a143d2c772337056a3c66abb5d742f33be39697194fb1",
|
||||
"283fa29dc399d07116e43c85eec0adc8a76221669a9bba6554f8e828b680",
|
||||
"40fddfe3b15925fe189b25aeb6616538958d43f0c64806f6286a5efc8a4faee98d02314eace7619bd2a3",
|
||||
"4d9f99a5248b8c7ed7ecac6397969bb92799a3e206239bcfbca54ca2b2325f9a" },
|
||||
{ "e2e2a29db958c6a3f68a52825b844c2a", "3210fe0cede911318435fefee1d921d9", "45f5fc3a",
|
||||
"91209d1202574e", "2067b789",
|
||||
"8869621138c4b08670fd8b6ede57933e4036e9c2a635e367f12a4dd7b19e1d73" },
|
||||
{ "24affb4e364dfcb9be823bda04cdf045", "d7db8f0fd20b87ea4ad5e85e026b4b42",
|
||||
"296e2b8040a3907fbd8789f660f85f3b49c6050092029a2b",
|
||||
"42f31798f0016547fc9126a6919c14fdee91bc68f839dabb24d2249ff5e001b6a2308b57bfa6baa84e635123e8c2"
|
||||
"110c",
|
||||
"3af391d72e60751b10d3f009814673d64cb86a0dc998cbf5",
|
||||
"388f9d6b3b3765f7361cf130f3418f1d81f3c4220b37046d82ba47ba252424d6" },
|
||||
{ "e8d14e976fed8be59625b034419fde86", "1d3a06b7b80217caa5a4e237c2b94549",
|
||||
"fa2d4f764e7399bd346f60f1cee797a9624809373daa3803cdb12717fb48503263b21ab1d99dfde20d588458993d"
|
||||
"8c33384e897973a9dd74bb7e308c8fdd6a46a9",
|
||||
"8c0c2e14cf2ed5c7147d8c50b4c28b232a80247344f21a61dfe4065fdc559200b7a0046e58606e3a3615ff54bb60"
|
||||
"5e7a5f001d215de255ba75366f6be3dd1fd4858aa9e8904ca99647387b1a17c7ff",
|
||||
"9427f3a18a22e801a3d7d863cccf4fc8dfc23a51bffab61235e2bdbae311ecc321db38128730818cec04f51ba5f0"
|
||||
"c3e6b7327402a2a63c95c184f7946756f2c94e",
|
||||
"70a800b87eeed41887887449465656d777659f183f9cb335d2a253fe09816cfe" },
|
||||
{ "73e9b0ca8fb59181dac10130454e3a7c", "81c9a08c95fb942c42003aff680b11ea",
|
||||
"971adb65be3d885bc115724cc33a0f53aa47606e7bd5",
|
||||
"03cc2f305af325f4fa14de7ae8e89a03d040e812f0f4a7f82d72441d83b85a424f3ebc34ad",
|
||||
"18ff36eaf9e6f49530db6f886fd85a77d55289d85fcd",
|
||||
"0bde31d7323ac029d9900c897aca4b0d42f33d46bab1974affe35a4095139184" },
|
||||
{ "59f15a1479f5dbd9c1b879475de9d2e7", "060ac95c956235bcc003dfdc92da5d89",
|
||||
"a17b5ffce4cc08b23a8b8cd7735e11822f9672691b4dac380835729694f39da377e4d3fd23ef7b8b40a355e271bb"
|
||||
"fbb8cd632481c7cdb67d99d314609174b10cf370fd9b9ab872346c631127f873573ef61776bb8e154b55bab6d845"
|
||||
"44cd8fe5f7611840a057",
|
||||
"9faf2f97e14d2be029",
|
||||
"3a4986b25ac4ebbdf8c62e74790e79f860c5c131f68b540a7a9f0504cbbc36b7484fe76713a53f354f4970613a97"
|
||||
"6a4cc55ed7480d5c5acf876977b74e622926c8309b65a5edd3ea2ad7c2805f2859ce1e2805577d409760b2cf8e84"
|
||||
"cda7097478491bab3fd9",
|
||||
"81ab6e4c949f5f8552f8a5f067073a0563a4ea6a9ae83810d76937e1a370cda1" },
|
||||
{ "5dc5206e6145ce81ffbce717cb425955", "a7a6fda319439a67cb679b3cc6076dd7",
|
||||
"4244fc95829a69089920",
|
||||
"92f48b403ce97f87118605d24314981ec34b958ca0036f0b6acef5e20bfddee370e13bb2cc676dd8d4547668aacc"
|
||||
"7dfde6af12727789f6ef811e63b391cfa9c4a68ca89e6bd978f38f9228dd9c24e968c4e59e3d34963d6ee942f788"
|
||||
"e0b5625ad95bd3eb6ae67ffcaf2e4ee9a9cbbd15c40385ae",
|
||||
"adc2915b7813f367bd80", "30cff01d2431cc61bacb6445d7e3e604de19ea532a2db3adcc1a978d9cdf3dcf" },
|
||||
{ "8d88268afada2ee19bdc754147d6b04f", "119588763bcbdec984a226e9dff179ce",
|
||||
"04deb10354489349a273c5cd5d02ee1d71cbda2a20743bdc2cbc48788b9da779ad2f3f1dec4cceb3132b2e4a1c43"
|
||||
"02c8f9ecd1d37fef",
|
||||
"0f32a44fb0edff2f0d2334029e59715f5fe2b8e896068b8488f43b567c0d6fa3de5bfa99c6c8f055e3889309e088"
|
||||
"22eea3a683d6907675b6f0072438be",
|
||||
"bda6c7381492f48849c00a86ba72c8162c09981f593547682b88b7bc6e051a9ab9fa1602e879b8f1e5145bb61925"
|
||||
"30e7faa76be34dc2",
|
||||
"dac7ad31ca2f77427665d8255bb24e7604403434770869ee202598e649950dae" },
|
||||
{ "0049493db4ab12f83fe50f0fb2a88961", "fd0dd2556a03ebe50b41446250d56e52",
|
||||
"1d3139deaf1046e234189942c2249a7aee9d644f934e6a203a8a69e7683557551dfade301cef8abb29d7308c5a28"
|
||||
"93a52ce6b1493bf2232606e79c0ae51b0a55cfc0434f2e669cbc56fe7176fd04a1278918c14791e00f88de41d563"
|
||||
"d3",
|
||||
"4c92be6ed0634323014b9ae5c9401f751c5b710c12df357a694c1c25d906ab3beb5bbaa002208e787f448dd0cef8"
|
||||
"4d3d",
|
||||
"dc3bb7e4baadeb7c32f70cef3144d04ad199ec429ca6b695f87f997c6e5db58e9d60b34d89ccfe49d5e62c267a87"
|
||||
"1ab7818137f523cde68036ad1d8f7db0b80286ceda9734b32ad73f7f0eaf8d19c80fe74866c1cf785f44513b918a"
|
||||
"24",
|
||||
"51a9d0fb861eca8a334632ade9f37e319a283d7b33cf0894b2e4e545d01afe75" },
|
||||
{ "b6279f439261d1dfa4b85151caa60e75", "d0b003ce641633d48413bf3bbcde6b5c",
|
||||
"39ee6f13a66b4ee74cda034a3bfed3fcf36f101f1e5b646d1c93e019174e4bd850417fcd5755264476124a5ee8e6"
|
||||
"8cf2fcb9fba50f872fb1d33a025f8c572b4b5ff034d9ad77ecd33981bdfe3e9554253522",
|
||||
"c635cbbf8eace8f911d093544536f38fcfa14b78b1e1eb069c42a351cbc70b7d1f5e93bceacadaf0c9198d3b2ffe"
|
||||
"54db45cfac70c05d4aecb0c801194642cc070ed223a9e3b65b735af796373db7fb6e3285ee3fd3579dd74be0cd29"
|
||||
"37f6f825dc3bd77ff7674b06a9ac",
|
||||
"9787ff29777e12f86c7281c57c5a345278fa96d8fc6ed949be284bb79f97b34da9f256a6be673ab93829492159e7"
|
||||
"ba1a19dc727e16ec57e388447c6616626c6af3412cc70432c3dbeafa35b044e7e53456c1",
|
||||
"9fb598560f6e1085c32baaeb48e643f0ae1b5a2c3a8ffbc0a9d88821c893330f" },
|
||||
{ "81d8c7bf41cb0e54fa51899660637877", "044d29eb40264aa36b976a766108ac88",
|
||||
"4712680db09039894cd72e86db111d63c4bcb62058f84f83ef419cc21e36f2169ca340375ff69f9280fa60c99d86"
|
||||
"a03dec4673901a7029784be2cdae3f63590da312a448d24eef063304545e553fd01ce6ee088e43c8b02c51b155ba"
|
||||
"da983ea1aca4bad804406aad3c92ac75ce4c",
|
||||
"897f0ea8d69b962913a9a59ca36b65aa7aefe39d3a",
|
||||
"1d5cff8679946302451dc9aed1c601ce46a6f31ef17a53af6ab130605cc2a41da08c932a13b72983ba8cc5837604"
|
||||
"0cc17e3182993dd593f4fc8f2965825173656325942e97db98c584ff0bc913633888a0812ea7675d130d690f9fe8"
|
||||
"d6eb7f1655de1938fa0163b02c50c8a122df",
|
||||
"96887b58e80e7c7716cfc5ef37c2b5a6bffb401733b82a0bd31510613f033a05" },
|
||||
{ "8d35dc035a1039af8f3dc653857cef8c", "a0df1b717a186cfe86a0ac8343e80217",
|
||||
"572bf5295915e7b2f817bd137a6608e09fcb7bad29887b9209eb29e944f2d3231717f9a112e68756948c1fc71dcf"
|
||||
"6245a0130bbffeef74ccf3ff3860ca5a23753f7539b7a268fb08434b73ba9adc385e6f9ccbfd213f812d7b64d8d6"
|
||||
"d7bfce1e236c5fd857",
|
||||
"94714396e2dc4bc13a6d628563b0db14e189695810a4925a90826de63327942db0508e7453",
|
||||
"6f2364c357e257e9b412018a1c702f0d0c1170751393b1f73999f77927d4ec1454e78eda131af56b1b46e348f877"
|
||||
"5e6a022a746b31ee135651bb2a14e21cbc3f333c13df02a3de6d5128ff1145514605d98e984c28dfa89cbfd2f0d8"
|
||||
"bc41af3e4c73e7ddc0",
|
||||
"8df601cc113253733da78d2f06eaba71d45d2026e77c30918ff8c176b54f75a5" },
|
||||
{ "4666ffed66ee2dc3ed18e6345384e828", "8c5c38610ee79b818c18e95ed2baf026",
|
||||
"dd2baf24c168f99d1868712a43dfda4717650c26c36378127800d8cf",
|
||||
"196a5357a0d6c588acc29f85cf38b78b61e0810feefb965d",
|
||||
"a58828aa09a6f25e7d4775ba7a2b303085bd5fb43cd61bcd19c8bb8a",
|
||||
"3f54d97c03f05417d44d62925d9a0e2c457fcc8befd1c388499c3e38bf89e163" },
|
||||
{ "2d5464646342ceb3039a9d2fa406b90a", "8f045fec196343f938902e1bf706e34b",
|
||||
"260ab30c42d3356dc39837b28f6f387accc2527aa853dd58f54426d52cdb9ffc0a5ca5a5c00761a7299e72d48874"
|
||||
"b46ffe18dfaf38f19cfad76d7c9cb4a4cd7784cfb125a58673972b4bb8c894da2a8969f68cb27fab746f8d62fef6"
|
||||
"0664900833dfca7e0be03eb5908f12e74bacda9d35b06e",
|
||||
"d4aa5263a31fcc8ccc9e1127f7ba6ea2d3ccc72cd7e98e442890ad3f8763856d90e362",
|
||||
"51ede001d1e4ca8a3de43186651a011cd14f4bf93e9375e910a8974ea411343b68e8f6ce80cfc945ae7d9c5adf76"
|
||||
"e1c0f93de8f5dc48f36b82b65886776f1298b36a2f012140da048da77e09e4d57426abe2b894c425aeb2050b0eea"
|
||||
"2d8f8255b733bb814abf3ef3d530d87dd7e1504bd683f4",
|
||||
"890d5d33a9dfa3807e5e20e4824d13fdce5f7ccaeee1f3448a4b21a085277370" },
|
||||
{ "723efa25ce1bf1748d86d9da611be9b1", "aff260690905ed2e8618c20963e4b7c9",
|
||||
"f7e3eb593d3966c015d63ea0e9211beceb8fa6d9a202bb4fd4128c3177c5",
|
||||
"3950b62147fc16429392d41cc4188d5c82537204e93edc7abfe7ce3404f9aa1474ebc4acd8e18aa652a87ee99c24"
|
||||
"15f9214963becd44720684f67aa814903cde",
|
||||
"9d7ee643a2cec28c467d2cc88aa539341dfbc82f72b5d940feecd11d4a7d",
|
||||
"eadd8931af484ec1f3c3e18f7acc0dacec73dd80836e03957b595b2022c8ac21" },
|
||||
{ "784197d89800aad00105ff7487b6e5df", "fdded94dfbb72c77ad81b2ccaaa2de2e",
|
||||
"b14ad4fc08d08cb0601289a7ff9127f26c4036606a50bdd2921baadffbc75749b8ca33ddf7b6ac",
|
||||
"b82cbea4eaf532d52046bf0bfaf22ec2",
|
||||
"a625b4da553686296d5c6f5ce526c4f84c4af779c67cd328c16a7985c9a28737130da855b1f3aa",
|
||||
"1807d55856630efb2794c74810522703b71bed188d5d918b8d265fb12a8bdc9b" },
|
||||
{ "4dda1ff559520020513e0a8e554da28e", "8b183c7e23130aade134ff8e539d8053",
|
||||
"e56d6364a87fb7f40af02b672fd337705ab8a02a5fbf2c2a639a872da16895774d90658269437160cd22d7370ab0"
|
||||
"fd3e81d746",
|
||||
"675b6d9e6c4c479798038b06561f1ac0dba2ce54988efa3393cb6265d901df1f815937a6e42db8c64c76dae0c8ab"
|
||||
"a0ee20",
|
||||
"0b2f31b8b15ec535c7e8c732e91f4e119bca192b1fe2eaabdac037dd1568e4a8d786c7048c16ebd4c513324b18ac"
|
||||
"9ee0281fac",
|
||||
"4809fc5e0e21e6344364f0dd59d380740c36c1b1d22e22de5c1190c0044a98fa" },
|
||||
{ "66dbe969ec0adfbe1b99874de53417d8", "13ee71e9dc02d592700c04ca0bcc6344",
|
||||
"fb420a6751909185796656a952759b4b794bd4eb98c82456af4f596093f5615962e62a9ce3fd9c4e0cb31a649cb5"
|
||||
"c17d30f66ad3d52e16589b174102cb5ad9973ce03f44cd3776e0d9c538d255ffe81ddff81e06cff8e4d8adef4f08"
|
||||
"cca416d52ee3aade52341e5cfb5de80c71",
|
||||
"db499d6cf13840accc40e3d14733662885768f7541b2615138c498b087e51b20f1c0c373a589b510de546d372a40"
|
||||
"cad0f92ac3f6f7bc1b85290c4553c83b",
|
||||
"7a7786b03d18c1f2edb2d9015da13a327f364895751c32b8ab840079b08e47870b4ecb49474d2da2bc0a53977aeb"
|
||||
"4d63f3b4e56f6a3d22ccd64fbe098fb9b27eb5e5b1f179ac69eb3d57175bf9ee37345e6f48161adcaa27bfb53638"
|
||||
"89e38cf7297b3fb9b41a0d61e751ca5184",
|
||||
"18d7dd7f471d491883ad31f046ff3451d02dbc85fe59f43c5b67c53c21cd9f19" },
|
||||
{ "3a00ee1e8877248065cd26e3b9a857de", "950529b19697df5b0ce43a3f429e9509",
|
||||
"d6fdd1746e8e7c7b84adef010951f60fd19b5aa74b1a8ab1ef2dbd5487318fdf7844b436dd1063f10e609bc58604"
|
||||
"ada5c41ae2ea1b5303f84c",
|
||||
"30a5f3a4e4543dca2b4d53a59a6a11b97a7d",
|
||||
"06ffcb4a0da10ae1a5a1c5b6205ccf4882a9c796370e7793d9b3ff3a857c156b3285e3dcc2181d8c0df26167ab4f"
|
||||
"8709db6870c9e10e75b90f",
|
||||
"6127c870f1aad279a83c79ce8226147782f709fe81f8c8740eb47bea34c2a558" },
|
||||
{ "b611b23912f0c44c8f0a452e181016a3", "aa0321dae967b75f958a3949fa08fda2",
|
||||
"16320a4eabdcbbb1e600058d308cd8aa650ec35985906489d1ed3210ad402589b33de4a68088cec878461e54ce60"
|
||||
"ebac399457d4f4ffaea77fef304f9363817fd797afac854d0ca313321fbaca4b0f",
|
||||
"d0b0ea43a3fcbcf70e5d4b21ad115e503ada6f43a74a0585481b249db3c00645f06005b1b3da91600a14a40ae5c0"
|
||||
"45127cf8cb6bcb",
|
||||
"39f3258b852471d9b9a289027f26c3a7e49fa8cb61983c429b3b306edb1f0d34d9718774005d71ef2e89212c6c53"
|
||||
"8f647335d85a2d0b4c72b97a7eee96d5b6976a602d82a294bc2a4887b16aa327f6",
|
||||
"411aac7435b623d80d284a1a6533dba99d7a44e4de22bbb22b09a4812c6f27e5" },
|
||||
{ "2ed2ab0c5548c1e97879a6c3ec7ebadc", "3e15d94c7dd22593caa8be653b6d59d2",
|
||||
"76b1d92662d472c87ba9b27e2756cf62513ec190f709996e",
|
||||
"f1e64c14a92e952036305ceef2535f65295b2803f7396a5e88f2ac993e201782e2f1edba92011a1530278b6d3d1c"
|
||||
"9a",
|
||||
"8c9fe2da6b58f0a9d40609bfd9ac6855badaef814588ebc8",
|
||||
"b212a9d7ef27a5228e1c02ba78cc92068c2251c162348e1d87da2afc53616571" },
|
||||
{ "37263267c4f24129d9db09a2a96d7c14", "39e5c4f2b36c9ed5077765b89cea1bed", "3581b4424c",
|
||||
"6ea6a9f99350a38601162f2e24928ee2", "9ace0569f7",
|
||||
"746536436bc496acc8bab10e6ae17d5d1d6113b3fad96df462107c3b4b6bf96e" }
|
||||
};
|
||||
|
||||
static int
|
||||
tv(void)
|
||||
{
|
||||
unsigned char *ad;
|
||||
unsigned char *ciphertext;
|
||||
unsigned char *decrypted;
|
||||
unsigned char *detached_ciphertext;
|
||||
unsigned char *expected_ciphertext;
|
||||
unsigned char *key;
|
||||
unsigned char *message;
|
||||
unsigned char *mac;
|
||||
unsigned char *nonce;
|
||||
char *hex;
|
||||
unsigned long long found_ciphertext_len;
|
||||
unsigned long long found_mac_len;
|
||||
unsigned long long found_message_len;
|
||||
size_t ad_len;
|
||||
size_t ciphertext_len;
|
||||
size_t detached_ciphertext_len;
|
||||
size_t i = 0U;
|
||||
size_t message_len;
|
||||
|
||||
key = (unsigned char *) sodium_malloc(crypto_aead_aegis128l_KEYBYTES);
|
||||
nonce = (unsigned char *) sodium_malloc(crypto_aead_aegis128l_NPUBBYTES);
|
||||
mac = (unsigned char *) sodium_malloc(crypto_aead_aegis128l_ABYTES);
|
||||
|
||||
do {
|
||||
assert(strlen(tests[i].key_hex) == 2 * crypto_aead_aegis128l_KEYBYTES);
|
||||
sodium_hex2bin(key, crypto_aead_aegis128l_KEYBYTES, tests[i].key_hex,
|
||||
strlen(tests[i].key_hex), NULL, NULL, NULL);
|
||||
assert(strlen(tests[i].nonce_hex) == 2 * crypto_aead_aegis128l_NPUBBYTES);
|
||||
sodium_hex2bin(nonce, crypto_aead_aegis128l_NPUBBYTES, tests[i].nonce_hex,
|
||||
strlen(tests[i].nonce_hex), NULL, NULL, NULL);
|
||||
message_len = strlen(tests[i].message_hex) / 2;
|
||||
message = (unsigned char *) sodium_malloc(message_len);
|
||||
sodium_hex2bin(message, message_len, tests[i].message_hex, strlen(tests[i].message_hex),
|
||||
NULL, NULL, NULL);
|
||||
ad_len = strlen(tests[i].ad_hex) / 2;
|
||||
ad = (unsigned char *) sodium_malloc(ad_len);
|
||||
sodium_hex2bin(ad, ad_len, tests[i].ad_hex, strlen(tests[i].ad_hex), NULL, NULL, NULL);
|
||||
ciphertext_len = message_len + crypto_aead_aegis128l_ABYTES;
|
||||
detached_ciphertext_len = message_len;
|
||||
expected_ciphertext = (unsigned char *) sodium_malloc(ciphertext_len);
|
||||
assert(strlen(tests[i].ciphertext_hex) == 2 * message_len);
|
||||
sodium_hex2bin(expected_ciphertext, message_len, tests[i].ciphertext_hex,
|
||||
strlen(tests[i].ciphertext_hex), NULL, NULL, NULL);
|
||||
assert(strlen(tests[i].mac_hex) == 2 * crypto_aead_aegis128l_ABYTES);
|
||||
sodium_hex2bin(expected_ciphertext + message_len, crypto_aead_aegis128l_ABYTES,
|
||||
tests[i].mac_hex, strlen(tests[i].mac_hex), NULL, NULL, NULL);
|
||||
ciphertext = (unsigned char *) sodium_malloc(ciphertext_len);
|
||||
detached_ciphertext = (unsigned char *) sodium_malloc(detached_ciphertext_len);
|
||||
|
||||
crypto_aead_aegis128l_encrypt_detached(detached_ciphertext, mac, &found_mac_len, message,
|
||||
message_len, ad, ad_len, NULL, nonce, key);
|
||||
assert(found_mac_len == crypto_aead_aegis128l_ABYTES);
|
||||
if (memcmp(detached_ciphertext, expected_ciphertext, detached_ciphertext_len) != 0 ||
|
||||
memcmp(mac, expected_ciphertext + message_len, crypto_aead_aegis128l_ABYTES) != 0) {
|
||||
printf("Detached encryption of test vector #%u failed\n", (unsigned int) i);
|
||||
hex = (char *) sodium_malloc((size_t) ciphertext_len * 2 + 1);
|
||||
sodium_bin2hex(hex, (size_t) ciphertext_len * 2 + 1, ciphertext, ciphertext_len);
|
||||
printf("Computed: [%s]\n", hex);
|
||||
sodium_free(hex);
|
||||
}
|
||||
|
||||
crypto_aead_aegis128l_encrypt(ciphertext, &found_ciphertext_len, message, message_len, ad,
|
||||
ad_len, NULL, nonce, key);
|
||||
|
||||
assert((size_t) found_ciphertext_len == ciphertext_len);
|
||||
if (memcmp(ciphertext, expected_ciphertext, ciphertext_len) != 0) {
|
||||
printf("Encryption of test vector #%u failed\n", (unsigned int) i);
|
||||
hex = (char *) sodium_malloc((size_t) found_ciphertext_len * 2 + 1);
|
||||
sodium_bin2hex(hex, (size_t) found_ciphertext_len * 2 + 1, ciphertext, ciphertext_len);
|
||||
printf("Computed: [%s]\n", hex);
|
||||
sodium_free(hex);
|
||||
}
|
||||
|
||||
decrypted = (unsigned char *) sodium_malloc(message_len);
|
||||
found_message_len = 1;
|
||||
if (crypto_aead_aegis128l_decrypt(decrypted, &found_message_len, NULL, ciphertext,
|
||||
randombytes_uniform((uint32_t) ciphertext_len), ad,
|
||||
ad_len, nonce, key) != -1) {
|
||||
printf("Verification of test vector #%u after truncation succeeded\n",
|
||||
(unsigned int) i);
|
||||
}
|
||||
if (found_message_len != 0) {
|
||||
printf("Message length should have been set to zero after a failure\n");
|
||||
}
|
||||
if (crypto_aead_aegis128l_decrypt(decrypted, &found_message_len, NULL, guard_page,
|
||||
randombytes_uniform(crypto_aead_aegis128l_ABYTES), ad,
|
||||
ad_len, nonce, key) != -1) {
|
||||
printf("Verification of test vector #%u with a truncated tag failed\n",
|
||||
(unsigned int) i);
|
||||
}
|
||||
if (i == 0 && crypto_aead_aegis128l_decrypt(NULL, NULL, NULL, ciphertext, ciphertext_len,
|
||||
ad, ad_len, nonce, key) != 0) {
|
||||
printf("Verification of test vector #%u's tag failed\n", (unsigned int) i);
|
||||
}
|
||||
if (crypto_aead_aegis128l_decrypt(decrypted, &found_message_len, NULL, ciphertext,
|
||||
ciphertext_len, ad, ad_len, nonce, key) != 0) {
|
||||
printf("Verification of test vector #%u failed\n", (unsigned int) i);
|
||||
}
|
||||
assert((size_t) found_message_len == message_len);
|
||||
if (memcmp(decrypted, message, message_len) != 0) {
|
||||
printf("Incorrect decryption of test vector #%u\n", (unsigned int) i);
|
||||
}
|
||||
memset(decrypted, 0xd0, message_len);
|
||||
if (crypto_aead_aegis128l_decrypt_detached(decrypted, NULL, detached_ciphertext,
|
||||
detached_ciphertext_len, mac, ad, ad_len, nonce,
|
||||
key) != 0) {
|
||||
printf("Detached verification of test vector #%u failed\n", (unsigned int) i);
|
||||
}
|
||||
if (memcmp(decrypted, message, message_len) != 0) {
|
||||
printf("Incorrect decryption of test vector #%u\n", (unsigned int) i);
|
||||
}
|
||||
|
||||
sodium_free(message);
|
||||
sodium_free(ad);
|
||||
sodium_free(expected_ciphertext);
|
||||
sodium_free(ciphertext);
|
||||
sodium_free(decrypted);
|
||||
sodium_free(detached_ciphertext);
|
||||
} while (++i < (sizeof tests) / (sizeof tests[0]));
|
||||
|
||||
sodium_free(key);
|
||||
sodium_free(mac);
|
||||
sodium_free(nonce);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
tv();
|
||||
assert(crypto_aead_aegis128l_keybytes() == crypto_aead_aegis128l_KEYBYTES);
|
||||
assert(crypto_aead_aegis128l_nsecbytes() == crypto_aead_aegis128l_NSECBYTES);
|
||||
assert(crypto_aead_aegis128l_npubbytes() == crypto_aead_aegis128l_NPUBBYTES);
|
||||
assert(crypto_aead_aegis128l_abytes() == crypto_aead_aegis128l_ABYTES);
|
||||
assert(crypto_aead_aegis128l_messagebytes_max() == crypto_aead_aegis128l_MESSAGEBYTES_MAX);
|
||||
printf("OK\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
OK
|
||||
@@ -0,0 +1,723 @@
|
||||
#define TEST_NAME "aead_aegis256"
|
||||
#include "cmptest.h"
|
||||
|
||||
static struct {
|
||||
const char *key_hex;
|
||||
const char *nonce_hex;
|
||||
const char *message_hex;
|
||||
const char *ad_hex;
|
||||
const char *ciphertext_hex;
|
||||
const char *mac_hex;
|
||||
} tests[] = {
|
||||
{ "7083505997f52fdf86548d86ee87c1429ed91f108cd56384dc840269ef7fdd73",
|
||||
"18cd778e6f5b1d35d4ca975fd719a17aaf22c3eba01928b6a78bac5810c92c75",
|
||||
"5d6691271eb1b2261d1b34fa7560e274b83373343c2e49b2b6a82bc0f20cee85cd608d195c1a16679d720441c95f"
|
||||
"ae86631f3f2cd27f38f71cedc79aaca7fdddbd4da4eeb97632366db65ca21acd85b41fd1a9de688bddff433a4757"
|
||||
"eb084e6816dbc8ff93f5995804",
|
||||
"af5b16a480e6a1400be15c8e6b194c2aca175e3b5c3f3fbbeca865f9390a",
|
||||
"0943a3e659b86e267ffea969ddd6d6d63aa35d1a1f31fb6f47205104b132da65799cc64cc9f66ffa5ec479550c2c"
|
||||
"5dfa006f827ef02e3ab4dae3446bf93ccb5c17e1ec0393f161fca94f2944d041f162e9c964558b6b57d3bb393b97"
|
||||
"43b1f8338ff878a154800fd16c",
|
||||
"480091eb823480e8b29c7aa96ffd55a026ac3d7fa16787c36c25865131a639a4" },
|
||||
{ "c88bb05b2aec1218e1a5026511e6d44de7bd502588e9e2a01591b39c5ead76ff",
|
||||
"4a485f226a73f0c4e16242e8234841cdf6af1771eb278e7f35428d03eb5b4cf0",
|
||||
"2a4c06941ec356390542d7d7833fd68fc85a00c0452281f87dee6f10180d02182791232c7007fde35dfd5a901afa"
|
||||
"896296f9f344db717994d078fbd3a4cec8d782d2bdc205f3709827b776fd5c863a952fea97a14a6c2ee3f20432b8"
|
||||
"baa084470179078bd6a83597478b2fd9ae00ecb424822cb0d61e9a55a4",
|
||||
"38a9809dbdd2579010d38bf5314f255b",
|
||||
"b8565db06c2fa493e09b6764f4d09296422095eb6e9890f606654713bfee6f362a123688b61f254f315f18b20bcc"
|
||||
"5ed8b0b4f2224de9f498e3ef03532a8bcddb361f5ace8ff491bab8b3d06550496501264f9f48ebad277e74921467"
|
||||
"89d0fc1a3b1e3e81598370a4183683d1fee25a9a1fe359c836932746b9",
|
||||
"5d5d35e0299dea47956a2e2143cdace4de8d228784d6717ae5a6bf5ea6b3ed04" },
|
||||
{ "77b473865175ebd5ddf9c382bac227029c25bdb836e683a138e4618cc964488b",
|
||||
"f183d8de1e6dd4ccefa79fe22fabfda58e68dd29116d13408042f0713a4ee5f8",
|
||||
"9888b8ee03c3217a777b7558a31e331909570ea196f02c8cffad2c8dc6499b8125363c06a71c057842666bfb5c6a"
|
||||
"cc937d2eecd960330c2361abdd88a4b191557ddf5102de75ddc7e09aee9862f32e24f1db3847a5f5b379fb32e2ef"
|
||||
"7ffb0d3a60",
|
||||
"0679fd74a846965e33e558676115d843e440fa37092fbd5c57c82fd914210fcf948f911b04632d66be46248d772b"
|
||||
"3eb9f55b537e54b1ec751b63f035c8",
|
||||
"3464d835302583ade6ed99e23333e865d3308f31a6cb65bcefdc9a1b9b4d0e0f75513188480dac4a64922af44413"
|
||||
"24ce7de74eb9f7f4e414f6177a4814edc96313694b99ff8dd36b2f7f79c7ecd70ec475abe1c1909238767f172fd6"
|
||||
"b95e92c025",
|
||||
"33527e829a3db1929cd643d5251ee19482aab7f2d74635cbf8370f1e1621ecdf" },
|
||||
{ "b8c6e8cea59ca9fd2922530ee61911c1ed1c5af98be8fb03cbb449adcea0ed83",
|
||||
"af5bc1abe7bafadee790390277874cdfcc1ac1955f249d1131555d345832f555",
|
||||
"b6c15f560be043d06aa27e15d8c901af6b19db7a15e1",
|
||||
"d899366a0b4e4d86cce5ba61aca2a84349c8de5757e008e94e7d7a3703",
|
||||
"4c8496dfa6c419ef3c4867769a9014bd17118c22eef5",
|
||||
"f81ceacaaae6263c33f836fa26d92b0f08eb0796135c7fe312c93add6a208e8a" },
|
||||
{ "d4ed0fe94cda2be7e50d57833158c84180b4cb7dec95d5ba774b6b5e1b0597bd",
|
||||
"cae41ba20bfd124270b76c13d61c1dffd7a42017731546d41aa071c22b9967cc",
|
||||
"1cd4b85fa6c14d5adea84ed3167479c1cd18e77792cca73a540aa16a00e50ba62ddd12a62911b21d3ee108651693"
|
||||
"7f33ed7756c7ec93b3",
|
||||
"35564745c05bc961994ea03764eb02044f9e7b2f6130d6d1f041580d6b3ea7ade2b6e231dacc5e97db01",
|
||||
"a1f64f45985a89303d1fdacf6f31ad745a8015350f1afe63d6ecc26677f661addd3c229ed76f4c627b1e902f8ce8"
|
||||
"c42fd08baef481e86e",
|
||||
"c706b2f13d4e76b4e024a2d72540637a8d9ff5e626d6bffeb7801c58ccab0c2e" },
|
||||
{ "d755d9d980e8cb221955b63c19f3989eecce945f61307a0593bd7cbea6577e1d",
|
||||
"9f83666d787e5ceb0e17fc1b084b3734dc3ea88dda73b1b7ed53be7491f4637f",
|
||||
"d1093941fdb3d9710cfcbe504be2434c17296d0b7e0f4e4058e79062f2b2cf3cbe2007ae2e5d391ebf3fc1e07e4e"
|
||||
"e7d1705044c9bc2bf08e97a4d8",
|
||||
"f2a1432fba86dc01b3bfbf3206943bfa3dc66e9f54b576c57f61ad515555b0c371dcfcec45eaa58ca06654b6cd47"
|
||||
"6aaaaf1b2602c03f9e41a2cefc265d10f19d42bda0b07aac8e86",
|
||||
"58e044943cf3b73e48ce75c048464fedb0445b02bffc00c1998b212f48f48c93e89dbfbf36cfade1112629e8deb2"
|
||||
"67c55118c10ab67b7ef2740fc2",
|
||||
"0179f0edd217214881e90c1be3b513170d1292603c484a55499e1bc70970d5ed" },
|
||||
{ "152f15933e4ae26192bd3aaecea29daf77e9b2bcd97e7eae7637025de8a3d3ac",
|
||||
"e177be02348efb533fc2e9d5a259cef80aabeec97da50c937e8d5f7c6eeb32ce",
|
||||
"ef86da6d5b0dab27a444a95ef5c237baa5819b863dcf0232d0162dceda8f180e1b9c6b9d94ccc0692eb52923783e"
|
||||
"f9de17497f1da62d6524bbf432aa6c3bbc1e851310218a03ef97ac6676eb6ec30ba6ab131802b992a11417cd00e6"
|
||||
"270ac73dec8dad88ecc3cba25734ef7de3b8e3cceb5d19778d6808",
|
||||
"221b1875425844e48c2111fa59b6df729a924a43b3869ab64f8291dca8f12be34d62d11ac94f9f308e0744d5d5f4"
|
||||
"564fe9fc1e014cefee3cf7706ace4643871d41f1ad5c616adbcc1e9701a3b4",
|
||||
"dc48260eb047397f41c4d0a0ffe394557aaff8b149cf4b16e7c22754095f51b626ded66e3db9d4cbd98421ee9d8e"
|
||||
"7c6eb72b607cd462f1fb3ab0c41b2cc84ad320c781ccda9aefa1a68ff5d280500a17c7959e869f45f97bf09cd0bf"
|
||||
"2c4c068d2b9603710ca8f71f82acd47faefdebdd0abc9b45c83388",
|
||||
"97191234839a54c00143463e8e8c863f5710e520ee9d9b9ce051076696bc8b52" },
|
||||
{ "873edbe818233d0f51bcfc1d5340cc4712c909de36f963e6157f128b8a71e3a8",
|
||||
"16e7637700a6fc10539c056663d12ec85bd529f1e6adb131a3853578f5d27c12",
|
||||
"db38cdcecbd99003978832d29cf6a34acb4d0e6293e37d2795fcded538ba37d6a11ed41430dc9f4c0cfd27587d60"
|
||||
"7846f42aa30682bcc295097053821b80b5869b4a0b852ba7ac1d7b784ea0e76b2d033678011889a5adbf7e091cdb"
|
||||
"b9754f828b7519f1179e2426ca6bf80a509e34729c854a5052e61adf8d",
|
||||
"0b0bd264fb5030f84da620f07099f42dfbad57c314102a1f7fc0b452ebb7966ad4b88ea773aa07",
|
||||
"de67a4eb8821625d4451734993d93e0fafd2c55c761afb097bfccba898e6d634be975d5f2ce8d456785a089c9b40"
|
||||
"724d8ea41095c1cc80f070c3ababc9258e5eea504831b034baccff61d8f73c220d5bdb1244c8a675f2d6081abea8"
|
||||
"f59088b99583cae22f8bd37fa030f94d5bfe1c9e799aa71bb41874b17f",
|
||||
"8665ecac1758be7eea0b5f482ce8024ce3c78b3f51af3ee4e0b440f24db2f451" },
|
||||
{ "b04b735c74d2286302e5994e126a8a8f52af38d6cb094279ac883b560a52a6a6",
|
||||
"6af57ad705792ac2f71a61bcea9ab38a9a5acc510de7995b66f3ae4cd2079aa4",
|
||||
"1c052ab52a21894287fa7f763b12f49b2edd6a0cd266e93207573d08d75ec31b294d171f0098f804020cc12056c6"
|
||||
"0f8d396ec94d97eae1c07a874849e39a3302e8c3b538de6c9e268fb922f6875ee5bbc264137035a76d9ceb269dc0"
|
||||
"988517a302c2bace2fb6efc4ffaa2c1455a16b6cd0",
|
||||
"52618046f112a5a35780e370c713987e24609c38157e5fd5d51ed36324359b0615af70f801b05a98ceb1",
|
||||
"7183180c37ab14f38ed084bdd2aaa4e8d8e8442b526214f594054e0379a2aba6992804afa8c63bb1e580d7d905d0"
|
||||
"c46536970e98bf7cb921e95db8faf388e7c98cc08496a7036b90a2e4efdfbcf79610edbc9f905067358b13934825"
|
||||
"c0ed2e3c3d1f03f7ceb812945f77fcb7731f805b1c",
|
||||
"483a6b3a7d5de797f0911d2a514350d5ae5af89aefe1245cb08cf8c7487eb99a" },
|
||||
{ "5bd7cbff6b469c03643cabb99dc50f905091fc9cfcd6d8f28e74ac1a33fd0198",
|
||||
"3b458a51fdb6b9d5a7071a22825a79f2844c5ac7ae91014ed7862499dcf10461",
|
||||
"4eda7997fa3b9e12e39eb00b209b43af9949c017660e523e78d0e483f23e9113b662f42a164db3511d",
|
||||
"808d8a8523a983a2afb2f9daed913efdc19a3c1ca3315382ffe757426e7ef65bc1d83d8e6af95191f3c30de29806"
|
||||
"5be1e5d14d0dba8f82281aa2fde67684cf7eb6f32ca4de7a116caa796f2b27222f93b9275f4b95f08c4a4e8d6b13"
|
||||
"cd326c16daf232c8",
|
||||
"98959acc116ede75df052f4028783105408022ed6db9516e8a27f18c2b4d59f1bcaa7163e0811203a2",
|
||||
"edff06bd132fd3031cfa5a47803d5169289a29d304f7091b20dec2b284a0e271" },
|
||||
{ "1bc0dea26d8583e51cece0df7021522adb9336450929715fecb497c43cfba717",
|
||||
"7cced62d655e703f54824f4e2ceb6e5af1507e2000f1bfec9e50eb87328c2218",
|
||||
"edeb537b66dc39d20ef6ca5647e6f34df0f5dce2964d227b0c444613f951edbbc532b5576735e9dbf39177ccf807"
|
||||
"1e5fe9fa011bf8ab7fe9f716acd50847f7a9ce35262b22f04486f1e956e09005249b5ed70e68ca9896802c4ff9b8"
|
||||
"019fab057bbd5ecddaebb6a079e57cb6e39c95f6748b22cf3703e30a5e",
|
||||
"36febc6e0763391b6b1031478fd485b54d427b88d06d3582c10263",
|
||||
"5f75548b3bdc53e80c61fe8659f2b90350a59dff4477fad24764621dbc35ebbb6d71f80c556a825a2bba962561a9"
|
||||
"db3360311438d4b3eb7452926dc5ec88d451be66eeaa491cc21837ec202b3e71b3ec2d0ed2f53ec59da253fc9920"
|
||||
"482545f570e3b2e4ecb3629757f3c721fc462a380504aa8fa9fc8880fa",
|
||||
"9e46a21c41a40101ca413017cadc2fed4fc3ff390a57fc0643784871af07492f" },
|
||||
{ "230bf249a043d34effa31974328fce207daf3ce10b42e5b44073b70e9566b1bf",
|
||||
"de67af72aa00fe1798e8b41be2528f36a45aeb3d957bbcc5c01490e4a786437d",
|
||||
"12403a1905c9da8bd546946612e7d4ddab1c716a533cbd5898240b4c68c675c2f18b72dd40c218bc6f7599edb573"
|
||||
"f89af867ab3c05fcef8c78b9bd0a267e8db3d9ab1dd04dd14a11f9c9e0",
|
||||
"77fe28a72f7029da86bfbcddcb819f7068afc07a249e207ae80f0acb90",
|
||||
"e9f1c7e28b1581f25448b1e21de4fe67c3ff432338b2f7364460b6b1f666a2ddb5b9cc896c3f410445d00c146952"
|
||||
"180ad1a36944aad13956e6ff95449bcf8bb6cdb1b3e87112507663441c",
|
||||
"7174e0d47bd83c1a8cf9cb14127d26bad67bf413e146bdfceab4e79b7ef13c70" },
|
||||
{ "c9675c6e2c0d8cf9f45f17faff568943e4a9038df4472908dd631c5ba8a29c2f",
|
||||
"bc07c8de4778d50f5dbf324e3f9e377b82e6defdb84163bc9447f156bb70beb7",
|
||||
"d2c4c2773ac5fcbfe43869bafa8278709a32dc395be3df8360562184d47675133ff716c620fe4d18902dfb41d09b"
|
||||
"205c87a9a2acd268f9d5662c9e4b12c50181d93ec7b676cb7afd0639f2b3c1154f7489cdf926a85f51c62eb16c47"
|
||||
"b1bde2b46df56ffc9438b395",
|
||||
"88a976fd2e7ab25e492f90a1901d7d3982b678217d4b248066c6d8e7a97af0aa93d04300eb0fc0be23a5db41b1c5"
|
||||
"62efc21c6057c57cd723894d9735d3a651240c6c30e7afc2be2192081c4622ff1d7390e81182642a4d532dda34e2"
|
||||
"ed45994ce50e1524ce",
|
||||
"15f5a70290975933cbb70f830200fdd876732952577ef9c0bce0293e78c0525a1209eba2531d9c58cb742ecb4555"
|
||||
"d4c9cb6bbe69c62a0910e633d14351d3b8f0c3c6734ed9adc384c294bc4935d0026fcd50d513750826da12ecb5f4"
|
||||
"6b7c6595550547b963de030e",
|
||||
"da44d1dc3de8523cb2dc0b3d5012f0920ef4665fb676bd4ff66fd6662db058ea" },
|
||||
{ "c4de2cc53d61339da13f360f88ae40b1895067680a7a9d28b3d281bb2a7d2f34",
|
||||
"29428c6b06edddd68e8f4973fc2a698fc49c71230bb97da4fbcdafb7f945c9de",
|
||||
"e9d1f0438a405d57816cf8eb37d3bbada217837db578d7c8e26355ecffc3b497732a54ae509fe8402f30239dca95"
|
||||
"9b0aa7bd436f23c31e2b9cec889f3bc82d4ad2d4af9c6f978a14b1a8dd325d8976368af2d3f04b83ee343a0bea47"
|
||||
"0bf8d56913986121402a49ed4a68c6526cb53d41ac",
|
||||
"74",
|
||||
"f1bc93dc853b7989e79d34615742488c52221d9d277560406fae0dca1a086ec09ae034a37424556922cd6661bb01"
|
||||
"a389aa00823fe3e2fb84e9811a078bdcbb4da5e949fefd45988131846259c64b45b279b7cce15ad2b1ba0b52db1d"
|
||||
"e7d39b07458bba7b26a4a4081fa3b0b6aa53b73d6d",
|
||||
"ff4527b7c136c8c92b151e0658ff456262fe74a07747f9437445d9336919939a" },
|
||||
{ "0d0b70db983f4afeac46cb5e042ca51a6a85cdc500f2dfb2f97282d2f96d3235",
|
||||
"a1280a20ba18cf8977c63450318ff1f6c4303b20c111fc733212e37e11cbd38e",
|
||||
"d9db68a084a6aaacdbfa1cfd7ab1f9b4fde06f18ff093d9f5a04afb9f1a23a573125906fbe126e8fc0f51e65465a"
|
||||
"09c1167bb6fbb623f311fe07f564ad4216a01b597d4d756acfc736b905a26dcbad3c6aae8bb7043039d06561ff59"
|
||||
"7924d623767105024c170113b6",
|
||||
"0a9d9525935e346ede23c3eee268c24f1070959d392d1aa1c4234cc19cce7807c477ac8e9062ff302015952aa910"
|
||||
"6de9db40c8d20e022f3617",
|
||||
"2f517ff86b32f3841fd9cfd34fbbf2bfb77b190dd2bdb74f438914d95809d52d20f07af6fa7a03913a517a6cf3dc"
|
||||
"591045eb4fd7fa0b55d80ca54d48ee85d56841fd44db7585e5d0ad8f27264751157be2190b85f224623a40c4c821"
|
||||
"cc8c7c680c548204e7f742d749",
|
||||
"054df03cbd4f45572ecee0a8fe80b37eeca1f17881bd12c42ad6575a5ef304c5" },
|
||||
{ "8011b1043674d753172302aa123478a121640daf4317957545749d0be6a91698",
|
||||
"57bd1ac0f3db407989f88a762f60b3eabd03d3bc3bae577f3818b15c0974ae9c",
|
||||
"be1833fd169fd745acaa7d8584c457657433e6a3237225a086d47806804120613d78344e097ecc6a5f869d07",
|
||||
"",
|
||||
"e34dff511e16bf12570a6828843c414b8fdced120db36ea0223e8700f57bea4c9dfbec5d3195caa633d52ee8",
|
||||
"0ac3f0459608a7f38b5b77c3f38c73f9ebc48253b316830b9583bcd51ba5c995" },
|
||||
{ "d4af433d4d7598a8bf02f3e34ba9014a85f92e7ff946d51ea7fa9a4f5cab09dc",
|
||||
"4fa45413eca04bccc3c732e18fc6442646e5d809afc00e1e749a8b8f84d6926c",
|
||||
"b867dea7593a03b7b7762052e58b18483163c0828f5ebecb8cbbe4d55c7f1a4ceadf55f4c3a979e619763377cfba"
|
||||
"4f88e9e692c2794ee862b2aed63902879e11c5ee167ea4fc266a4556fbb54357ad243f92418a1d13c987f5b260e"
|
||||
"d",
|
||||
"ee4ff169ca",
|
||||
"e2e12b2510c72d2d59ad8bf30235d14f3e85824e19b09f4e84eed629325b5a5368178dc94dac13b9aa262f12592f"
|
||||
"8748bbed8581dad74895fe73dac4cc3a5f17ba480903ab86d349d68cfa0e4dcedea3321ffe1023b092cc77853a0"
|
||||
"7",
|
||||
"07a59bb7b8f5805195197a01bf6f628c689024dd64218f0a2a9b77aa5cd6b357" },
|
||||
{ "2eb12f163119cd1262e0dbb26338486bc75c183026cbc71bed601f6cde324bb7",
|
||||
"c59654bef68ff95760ce8fdd39f480a3655c650647d00e49620b9938f917535d",
|
||||
"9cf103fd377ee14f1fd775530b5153eb31789755382697aef6008f59b0404bcf3fe34509835308cfac8cfed2678f"
|
||||
"523815615423831317ad7770ef74145db7a72ca9462ecd50d7b19a0d50e894bdadbb0f63d6624c80c85836bfabf4"
|
||||
"4359f700fe04b5e6bf1db1b4ded24fe9054e7318",
|
||||
"a3fb893a7baf646371e92f3c34c6700e6a9306bd7e905a25be4bd7d6239416ca94a1a31b59068729",
|
||||
"22139c2d9bedf4a0535c22de56fe441df6752a692a99c10c186b439fde9954e815d6e81d0bfa0a7c3caf60808343"
|
||||
"3e9b8d32321392f41ae03e5b67cd7801362c371223a98989b00c79fb42d4b25cc222ef6a4fe415654030e67ec506"
|
||||
"44bbc93fe83c20e1a30259a14ae1ec82ac4759d8",
|
||||
"83b054697569ad69e55ee1b1491b9353255c4cef4c0f31a0db8090b7dd06ce0b" },
|
||||
{ "553928dbf68b2dfdacd75bacda2cbb4fb33d81f55731f8ac6615631ed4169784",
|
||||
"92e86bd57fafd57c88a090397a72f7af5967fb623eec8892b358abd1665f88ac",
|
||||
"b305ac06529bc8483fdc6d765a535ccbc8125a27b8d72fa2450053ad4be45beede300f87e035a05538b3",
|
||||
"1f80c2c7694a35f5653ab2fc2cc93614d959f2136bd4cf2918d2a20d6440e8ae73a652e08b7987d1df8c",
|
||||
"4885419082270c83c03f5d4869adc63cd2f940bf527e8474c7c61a748fc883b74e5ffbd8b0cd3e780a92",
|
||||
"ef4b2bbe41b9c4e58e207fe9fdbb0e9aed224989d9b9a77e78003b1c2fd7bc31" },
|
||||
{ "4d6ffdfc693ab2d94d760163bb9b31728a2762c26236f04859b7b31b98c0e159",
|
||||
"e412d9b3b1b40c740ce56cdc0bec430c0ba4f95f5d83124244cebae8295b31c5",
|
||||
"ff03d03191d459d57a628a8d69d398214699bf88c2ce8694e2dcbe6d9c987056a50319ef387363b6266fb8d3e15a"
|
||||
"fe3b2eeb964800799c0686c3d6f0b27d9523592690ba7d765e9a21d62e113788076267cb50193d64b43156b3683e"
|
||||
"7ab0758e",
|
||||
"78c96946f355a8153659dd06b41b75b8109b0c31c0d6ff2feb90c875a3b211f01061f73a88a9d42550c807676dd3"
|
||||
"a405516da1d2639395cb4df526e046d621ec997c1c4fc858b60ff9051f2ee093fc8f032f367bf25b3f32361d8aec"
|
||||
"5c0e239dbb129316411e96da198d6fb512",
|
||||
"4c3083ed17c2de0981fcfd38bc244c6e6d0756fa3c23b22fe770c0c952159b6e112c6f4b6686aef4bbd0be98bcb2"
|
||||
"c32c44af09425f70cbe031d08798ef258a820dcd3029d2b0a857615a939e2a008ef14b949f5bd4ccb4607c8a8a4f"
|
||||
"c5f1236e",
|
||||
"bfa101aea1676baa3b5205d45b572425ef7da415984796d2b76f01fe5e37e919" },
|
||||
{ "c9bde00bad3334e5792b5c1e5a8fda8ea7f7eed152c0a3feceb565208017af73",
|
||||
"2ee41bb5c473206ec00ec597548161573e8c2adf7387f88e4fcf64c84a2f5905",
|
||||
"b7dac21337a4029b80ae0ce7578eb0eb45c76eb84d68c4dde73690162b377118237fd1f466ce1d7d7638945779e0"
|
||||
"b148047c61b63c7e05c877f75f4a52865efe94fb65ee99e4b0d79242c69c3aad1c425d017a71eb26adc2594a6a52"
|
||||
"16eb72b736f40a91001b13c91d13d5b057ff05ea883ccff3eb6033679b7b41a62f",
|
||||
"26b1dbda8f99f9492955fab6891c3de81e4535ed525fdc6d98beebef67067fefb1674359525cacb2119d016876fe"
|
||||
"b5dd",
|
||||
"6249b44800c9d47ca20cfc1726563befbedf20639735d441917f52cbcc7ef72d5b095c6a15a7bf1239f8b93a62d9"
|
||||
"bd5e7f47b05ab9f12b4da72392ab4ba093de150fb8b7b61ea92e6a3204b178e2e1c066102ea9aea6241749ebdfba"
|
||||
"4b307ab0a5471d1d43fc930dc29a1ed5e687d41883c69d0de38ffdd25ce4d8ea33",
|
||||
"53bf7cee58474076330dc64d1eeff748df909700dd942d8d59da2447b9f84fec" },
|
||||
{ "6466a65e9fe920b026739645b446cafb70919a5d03a7e890537bf88c620c5bdf",
|
||||
"db812442fcc36f2deb4b04a9c32354579abd8a57c185654dc8ce5af21f5e5463",
|
||||
"39917090786a9532f0700bbdd94d960491d89b68b2b9b1425ef8db67b735ff08d73cb171d911eb94eda3354e252b"
|
||||
"ee238408ced860a8c1657fdf8c9afea4f4bd041173ae22f236c238d38e469c89b2b2bc73d3ec88cda37530362939"
|
||||
"34732295e29dda",
|
||||
"34c8b124c1e26a893aeee4b228214ce840cd9e49f1ab7bbfbb4d90c808215be99c9da5d0d426d5933f6aaf9d1af5"
|
||||
"78c1a6f2b56e6b4c2ef41f6fa67e7f2693f36b3e21223a5428a8a24d2db24d",
|
||||
"e1d4206c53b1072c317a494b43323a65d4f17afd6f02f865d94c425f80153add9d611175e9f0bb45c51d7f469272"
|
||||
"10bfeafdcbf29cf3e1de3c01f4fc3fa94848af52293e3f48be11d1efa5d6e2aefb62385c97ab1dc7aaa96bd0210b"
|
||||
"af8a7c732386b8",
|
||||
"bb406b111937304d1ede67719247747cb082efa5e8743364b763ef0e9af1059b" },
|
||||
{ "be69e13f684ade9206fc567da10871fa4bface67e86e23b9bab7da87f5c2f39c",
|
||||
"d8b143fd6fe42e1ddf4460592c2c3239e2dd97bad39066b86d121b658395bdce",
|
||||
"4f7c016b4ad5d4822e125851ea3cff387ed83933c6e20965225c34e5da784ba36585e38293c6508eca322e9a9bfb"
|
||||
"21b3d5b5b0866c2d32b850072abfebf5417f9cf7c1b3e995338b99cab418b9812863c051fd03131c82b999bfa107"
|
||||
"bb987a83528931e75a5f4ca0de75f0",
|
||||
"0d32bb65ce4936e3c9eed5cea33bec6cdc7c4e105c132a2dd663bb2cb0fa2ca62fa1fd55ee46ba39853c04655a84"
|
||||
"fcb4eec40e5a810e8ecc01063420cae63259ed33cb3fac23b343cbfaa7d9bb30ea45f824d0eaff4d836845baf675"
|
||||
"6564c66e3aef9457baa1c70e3a9b6cf4",
|
||||
"4cb6bb6308675a9a03f72d1fbf1d2b7b092bb4743e6f8e6d4f8bc176e1778eb226efd8b33a14c3bf0a554d7cd648"
|
||||
"80dff4adf7fe622d8b2a51d5a3becc06f77046eb98f6f8b7e4c9a9cbf24eb7a384f87912146662a065f22b984e9f"
|
||||
"11bbba929183d4152c2dd607f87714",
|
||||
"c06e27543c2dad50440824ab41013fa2fb34bc1c47222e5a157fe2a8d8324c18" },
|
||||
{ "e365b446bd38e82eec6f10ef0ab21ee388ad485f08935ab5b27d812c77c8c2eb",
|
||||
"b5d1efebc38b831ef46617bfc282e47e20a844c326c35981b0af5e97cf151cef",
|
||||
"a04e8c9a01dcc73001fc6a53", "c6064f3f164594ab4bfe65c76c753d81e110a255d3cd9e512c3ef38d54",
|
||||
"bca8a253d89f09d92b364671",
|
||||
"4ef59bdf41cb393aada19b052ed31e568855c6edb37d286078ea3c8b8969061b" },
|
||||
{ "f6c8e88d9e0da3770d3499977a5b9f9d071731244c6b0ccac921261ca799c4ca",
|
||||
"de6b3d103cf9efc4cb7d60dd3458e7c5a348692ab63a87c8ff611a336f0bf63b",
|
||||
"5eda6f7400227d5f0c4f8910c621dcd6ef0c4f9d2d9fb3feab68b3b162fc3db362acfb61c55b06febf04546a3bb0"
|
||||
"02dd6f3b9e2f531cafb7a6b1d31c29483526b2958eddbc9f2eab5717e1",
|
||||
"0dff4615b2084f8e01dce6ecf3edfc785f1cc51361f32f29b7e5c49c82f9666454f2143b9fffaac5ad9ef9fc0aab"
|
||||
"e91245cc050d5e21dd3d31bb508072d8a23d3e289aede9e95bef1bc8c8dd6d1401409234237f7e4df6db44cf9290"
|
||||
"ebca5ee8a69768eb6dc29dcc5aabde",
|
||||
"50c1b3be72fed8b6feeeeac72b999bf7f24bec747d30dee62f91753e7a26fdb4666cbea2f437232e57edb331ef32"
|
||||
"7119b8b41572e8a6198fd4377e6657520d6e833fac4b2b2b1ea4c01923",
|
||||
"342804e54894f812c0879615dd7d4b8959d36f00b03c3e183148ebba41d34d88" },
|
||||
{ "c9268f6053542789747187da6140b7566024b623dc9691a534bd730764b20a63",
|
||||
"b0cd1ad38a01130f0b312be85a9dd570937c0fa1050ec7c3aa31befc400b8283", "60bf644abf31501722",
|
||||
"3091f60cfb9fa8946e8a06b1a663e60b54a24f2e5f8eb5282d980a21878c794efaa2f6f699300e3facc64197c5",
|
||||
"a3bdd452eecc7c431d", "32d6f160b3c802fc4a92344f6edd6bd47cc83630ac76b3f7d2d8ea38bf1d8886" },
|
||||
{ "491c6c8be1926521f6abfdaff5f95c5fc6ee07a800fffb4715e36c5de167e8f3",
|
||||
"747cf6c78d7462846364b00f21a26b18c49d7bc3878f478af38a7dedf86c9ab1",
|
||||
"9ca6b63dce33c54e7122ef72a5bec5552b1cd8099596ed8917ff694390e970248f1ef672e985121c",
|
||||
"3d545120992929ab79fbe41da239705bbd20ab461daeb3f13b74069b0797b02699abe360382669e6752564f6525c"
|
||||
"349b0bf6a8833445d14ad99d2cfa1212e20874603760682769ec1abdf33186de04d33621d8",
|
||||
"f5a2cf25a6e22b71786ebf2adeb78d0675d08711b0cc9f1bbc6b065f056f1948570ebf4dc8df1574",
|
||||
"8c7250ec14c5e10239d1d8d275059a09dce220b496a4869f82718258f52d004f" },
|
||||
{ "512cb5bfea47aa81a414e0e9c866daa1f2f7d7562a9ff7616ca182642695e9c2",
|
||||
"39f87cc65699610a3a5b84abaf4d8333e1f83f640b7673ba630d53eb608f3c57",
|
||||
"371b10a048dc329eadda98b1ab87a8fbcf817eac1fc0a40f5a8c3e34e1b735dd4bf2f185964a",
|
||||
"96fdeb760af9a39b819676fbd7cf6e025de97d9a735012b0fc2aaf2f845b4d76e97220920b7beb1b7f920e0795cd"
|
||||
"e96ff923865a5eec1a08fd88c837b2ac0b38e860b1ac5d5054e46c6538fd916f46e8bb17751cf152a3dd531762a8"
|
||||
"abbafe38198dfbd35ce232ec1927b8f47d1833db9bdebf6f7d92eb029056835ae0",
|
||||
"dfa26829a13b2383e59180b896920d0a8dc02d11ab91fcea5e004416517cbb465f951447237b",
|
||||
"7325d446ad6af8023893386201dc1a8c7b3d603d13241a5bbc33f6248d42cd48" },
|
||||
{ "f2ffec87944d3061075de87038cfed1797276d8c6857433c9458677f67e090b8",
|
||||
"7aef11906a27ec49ace7193bf61183e4c67835c9c26b50381c7ec18b81e4bac4",
|
||||
"1460c5acbb61d26d0af31b565d3696e50d6dc022c528f11569dde0ad691b32fb20538236028d51b98d441ba5ef52"
|
||||
"7ace9a59ee9784c9ff14e8a1d03b2450bb75aba2a91ddf1827c14ef131",
|
||||
"d95e3d49c922e70c4c34edbde880239eec5bad1c13158a07d6a13462a8978158cadb13ee5f2cc95a21673b6ce25d"
|
||||
"7c30f0c8acdfa55c259c6d03a4b25d22fa65",
|
||||
"bfb8d129ab8a3898eb71aa46e2d976c44d790803420ce1b6c77c399ac19842b1486339571b82d84a0461a946664a"
|
||||
"68e6387b4bec56ee0acc08bec0100175d670ebdb6a9c36fcd13126762a",
|
||||
"2956d57d9089e44a5c34400b411210dd35c261a9354f6ef1d07235224f2f3b85" },
|
||||
{ "5c2b46c8c5e5a4661c26ad19be10a781cb845c824a403a6bb708c738e90d9c46",
|
||||
"b80e79dc4b26bb75d284f0346697816efd98b0412549d4ab09e5453b14a1362f",
|
||||
"ead1a7d4f2a4d5d5a979e16cdbd32005a5b5506968e18d68a598ba5c0fe2863839ecb029450b0b2d0966558a890c"
|
||||
"af2b2c5ee750be7784f583b6d3e0bed0cb5d4fa6f7fd098dbe05ba8416c400faf2034c3074dc1ef7d7ee63ea1cfe"
|
||||
"d18526d394c445848a959fee",
|
||||
"9aa44ce6a70328ac8455e5648a34176e",
|
||||
"09633b3761e956bca7602b876d9b5429e64e56c2b39ee00484ce92ffa7395751cfd43f6c46ac3b0552fbc2280404"
|
||||
"df446cdd8632a41fc7989c4d603b3f6b7efbd075aaceeb3e01bbe60ef88b696ac22f41fec3d7b65b35c0c45d8bfb"
|
||||
"0cc99d80316b913968089e28",
|
||||
"2e1954215e5487ac78177f851a580067ff75de270b664e962240f38a42f67150" },
|
||||
{ "05fead6fb5a0f2be62533e0a29377010bac0a25c753155d56de340a094e7c426",
|
||||
"aa6663a20646cdcc620fcf23c31deac51ef80b68bc8c5df1f91197066763eb39",
|
||||
"5e9162142770449251a541fcb7798ee6a59ef56c518a96742b4186f3d27e3a8ef9855dd5c0c586cf957725726a5d"
|
||||
"9518919c54b07b87630c8f5079b49aa656d03b0a10ae7aa498c1eaf4bf0660ff999c8080524843ff8a8137d95921"
|
||||
"b8425ff6a3cbac4f52c198f9932af067ef734ca00b682f6ad0ef0e",
|
||||
"08fffcc594bc5d08a1f6473b604289aa885d9b199c2acbc56493cbd740a5127ed1e218a719076a310301954e54f3"
|
||||
"8b682eb9f50cb05d2335e7d82bb88487f333",
|
||||
"211957354e5bd50bc25009e2cdb0adbad870d25aa02c3759bebb29ea2de74afd194aa82edf530086b07569588e5f"
|
||||
"bc3618f762712d63844c8177d7d24b2d9d5f6be5ff98cf7ea678ac7022a15c17430c20213ef276284ceb7f35e00f"
|
||||
"2b33a124a88d9aa6ca5eb37afa4076b051f94e2c2018cd90bfb499",
|
||||
"79edf8d61edd0c8d23e2337c3cc7db00a622215540796800dd4c01be03958587" },
|
||||
{ "96cfab5f246dfcf8b33a9e80fb15f90a089a9078dabacbe767082da806cb4fc9",
|
||||
"6a0ad0d16594d33730b03a7b40b86581fda3661264ea17f3a4327160a30f181d",
|
||||
"61b0d79387c11ac4a87c37a9b3", "a62d02eac118d047cae4ebd58ce97a7c99ed90f4a4bee9a442",
|
||||
"d0762aa4c8d20934e91a999ca5",
|
||||
"c0dc96d5ad1cdff9445e163c0df739880bb4dd741f4ca70eef655b213b53773e" },
|
||||
{ "4206ea8a06c8fdfa6aa47e76e317c3108169d142f6de50927345a2825767a7db",
|
||||
"b9c7d7ce4503a4ca01b8762ff383f0c13c240d0c9ad691cabb61a73fb1ea7dd0",
|
||||
"0915f9ff74e3b4cc4d9faedd463176e8b4d259aca80b64fedb9427394fc5950d1db2ee8a57",
|
||||
"4b283f58f0938a62ba97144ac872b231bd93c8bc14c7bbe22f993598544d90991d713e289cc3",
|
||||
"963202b6d18e7742621ccdefd04ba47457aa639ec78ea6ebc277d062117fcb7f7efbe926e7",
|
||||
"33d965ed6fff8369f9e2173f784c19795ba93776e9de83fe0292830c0ad52dc5" },
|
||||
{ "7729253efc6935859e8e7cbb15850aeb37e0e3fbc017754c9583d7b4353d37f6",
|
||||
"8b66e8adf9bdc7907e2127485410c30bd8488901d0c75857b35c087eb9e21d18",
|
||||
"ea7d864e9e1b537c409601fa7b35ed10e66b71ad6a81aae70ab07cc69123a459b9020034dd165a46035ce9ab29e7"
|
||||
"01d3622a76947e7adbf6c6fecfb4316f35e24fb01a5f46cf57",
|
||||
"a3788e4450cd6edc283dc66866a7d03b1250b8868364bdfa6017cd9a518046304c4e46f5203e547fbf9c5f416429"
|
||||
"41b198ea1f640ae2f6431caf544fff17a09fb288904fc3f1686c496f7c3dd47f9fe013a9",
|
||||
"01a5877237bc6b94f0597df25ff9482976a5ff545dd26759efa03b10280d5f9a058c7bb1c230be66977d463df1ae"
|
||||
"3ddc3d7ab02c10313320b5dab74a22dc0a6d9158cd3900a184",
|
||||
"7539465a447f836c3d2e6abfc53a8d9af7914d2fcb738735d64051f8f14d59c0" },
|
||||
{ "d0c627cef866ebdab7a8030be47a9aae4e97311a3a1896de7971c78feba16dfa",
|
||||
"505b133a1f82a9eb4c57c485d139197fd3e59dbb07b9c8a02a32438f6502fd90",
|
||||
"206f537aac47c77eff924a9b3e74ea85623945e1c24490",
|
||||
"636238aea904adc5f4582d48a00357c4aa57ff1f822fdbf49cadf780f5e346f0153d8ecd353073517fe4f080",
|
||||
"c44ce4e69f32651596fc5fec1f9f59cfa62c7a44f7281f",
|
||||
"36d1db8dfadc687ed88ccedc2796b8aa76337ed49e999091186659586295b6a8" },
|
||||
{ "e13e72cd7f25a23b4f605050771ce73980ac37ea3c2104a17a6dccfae70b795f",
|
||||
"3720f810b9d2fc0c01abe11477689b78ba6515488483b747fdf66f243f2bb387",
|
||||
"f2468d65f0c10f82d7989e84b500178f011bc98c199f0bc299c882644373f554ef4a6eb8ff008bf005aa8b40da2"
|
||||
"1",
|
||||
"1041f65b724df64dd279659ade61cddf90672f490453aed4f019dd86fe5eee3c15c359b01d0f91a34a67bb67b4ac"
|
||||
"f51e229ada29499a0503fcb6eff20be9f59b4ff57b73e173dcb1faddbb111e645149321883c02b7f2ec265009e1e"
|
||||
"8331905cef72a24111fd80de344b420b51e4daa88e6b3b054dd96f4536f5",
|
||||
"79e9eb1f7879d2c2b27e52f3f00fa7c0e813da9bd741f1a3955ea9de04703a8624f6b7b91b0d720c95432bb57fd"
|
||||
"a",
|
||||
"4071822c3d3d92142be2437266fba4701e5c28cab4c11e3ac32d245351b66135" },
|
||||
{ "1caf2693aa463ae93d13f6b687d7a19fdf047c30d054c2fdb5e07e88b5ab5a08",
|
||||
"86603e8c83f17abf6af5d8571e4f78955440c1aa97bb6a6e146d787fcc1d4e50",
|
||||
"ea9eddcc4ac951c60afae654d012b307f21c823da4ca44b3276c7f7006ce82c07d8caefa665636d6f5031e31bc7"
|
||||
"7",
|
||||
"cfbaf3cac9237f19986571ec0e39ed09b1a5107cfde57bea24b3f5dba56bb7db7459c4fa82ade76f63ec59e9400f"
|
||||
"4f51188734811bb563131f49c2e2d71841334b596a63470b2dfe3a421cc657129b449628e5c1ce39a57ff07f2130"
|
||||
"643a725637014eeba27ff95146a99a06e2584cb9bb3f12",
|
||||
"de9912a8bec65989ba4c82daaeebb14aa21246bdcd52d01ae5d4e1aa3d70a12277651c75d62569349e0e4cebd80"
|
||||
"b",
|
||||
"7af7d1875ed73bf8db71707992f07ffb5fcaa82f5a821c0d3a9000443db1bc45" },
|
||||
{ "cb1a72f1752672a7fc0ccaf10c76257c047fb767f42c3f23cabc78d35a8cae4d",
|
||||
"a48db1fa02317b85f1787ed869f1b13250d7f582304594fdf4a2899d50e22c3f",
|
||||
"25f09554ecaab85e2d00c6e76e31222a9ac91b79fe9eccadb6fd38bdb948502849ea5ed30470d0d94335a64fbfe0"
|
||||
"d01f5a5b6afb95a40c5406c43e022520c2c727d53f66846e35fa3fedb4c7efa44a16",
|
||||
"72c88fc1764d922dcc6f3a61e444213e6f7877ef585c65a57ab9814813c9ae73b5a4619b316a6cec5e34241ed2f3"
|
||||
"cc530d105de4e5ca356ad66cb95f2aef4cedff42a0522f5f7d9d7a9f2fa54901e914a5b733791ef5236b78d06533"
|
||||
"5477a5eac9d626da94b36a76c3f702",
|
||||
"ca4afd213fa1a13a18e6ec57488012451cb648902e367edf72902944422f3dddbfd4946f5b34292c39ddd84e5c76"
|
||||
"91afa22f359cec4dd14afd210a5df66a5799aea2bb57c17f29fcf9c3aeb9c528c260",
|
||||
"21ac240f5e13978f67a5a233e6ecadc5e555fa3c5637d29661ed9196556b231e" },
|
||||
{ "34eeeed632897724c59cc20d82ec745af1a6b43665ac88290c11b9baeda6b80a",
|
||||
"562c76d4ff6201116aa3ba82056b43d8106565553efa4f65be2776ec7346156c",
|
||||
"485560e1c34a3f1068a77cfd144054f1add7ac802d013adf462fa1e112fef5ca2ee8b48c1a37f1d62c06",
|
||||
"26f75dda69bd27835c891b9d556fb7312ed524c8f4fed9029ad963eae7a43f85a6dec0146b919e195bcbcf7eeac0"
|
||||
"09ac5aac9ec784175e0d18a25693",
|
||||
"4a7861fc50e5c17910876b4cc45b1249ca8b8ed3940e82f5f6bf6e0a161263c66005ce91edd32f876c4c",
|
||||
"72b792ed7d8e1d5c044c452daab093029c63881044bfa97a819204f8fd87c499" },
|
||||
{ "ffae6a920ea2fc5baea3c3278f8cbba1f1ab3f07f2499cc87eeb3df3858d67d4",
|
||||
"81a53e4c40e507e2071b7f9464914a273065ec7f24c5e6e5d0bb77f6fce20b76",
|
||||
"484672fe6dbd8223fa1cc097886e9b73e971a6120b9f909dec308cf1df8d02181216b35ca756025dc50f6bfe3d19"
|
||||
"2cc5531ad9bb4dccbc1687afc507539b5fd6259c80f55fb55cee1708485f78d013a03851e4e6ce28c0",
|
||||
"8bb27c47b62c7048b6117e0c631313d2e165c277742a2a1cdddd",
|
||||
"8027f08446e70cb72e52679809488940fe1965ec18bf1c56882cc412e41f7727efc55acd6c2b996b5fac79bf13bf"
|
||||
"ddc7e03b3900f57589215a37ff34241329ca7b5da9ee238ed7fdaf5b1bbbb172e040d1dccc6acbd8ae",
|
||||
"d25734872533b137110dec26861bcb77fe062c0c41775a2a05ccb86365bcac09" },
|
||||
{ "57f2386e011a547a48e5c8c170bdc2758e246d4fdb4b5f90f06945efb6bf6c9e",
|
||||
"8647b48a6ac27f0b6b68f09d9a264963b0b62c8cc8b454ccef9c503e6d568b33",
|
||||
"523120a8a391e743e7e2d60fa509345da8145db83631881bcf21c0c56b47990966ee08a36b361d2660268bfebaa2"
|
||||
"2d4f5a8584c1c04a27693adfef76e910eeac0454c4c1aa3b",
|
||||
"e7b43a9582ba177e97df8725092ae30620a9066c1cdfa627dda1042f5a325a46496c4b200baff0e0709c52ed0ed8"
|
||||
"2ab11af1efec1e05d044f50d25a38eaf6da2fc2709e609df95f2dc6500d30caca60e421a169ac0f1f69b1d774f37"
|
||||
"5b942edfc4151e0c78",
|
||||
"a032008e9601e05f87694a001918c0389b66d13ea514f4c2d5c891591856a3e45472f74b14c409376060ecd90de7"
|
||||
"b700b0048cd84bac232f5211768e4185086d7992103be87e",
|
||||
"ce7174bc583746a5183676f5af292df91213a864bae6e6783cc51543cd18e80c" },
|
||||
{ "29f1e4ad600bc24f64d2a99669f7317add8e61d5d3a3dcda1968b398e7ab3a8d",
|
||||
"15190e8300313a59c0c6c4dcb0358cc88f7e856240091f1b1bc599a2ff3aca00",
|
||||
"b01d68b18df703fa9d166efd6aa3ac15fd48dc99f4ac806194f0f500be971560b3135ae422095a",
|
||||
"cf90cd99d137d5bb0203c0a97f5d4842f4c0ad975df8a5dd863269b37e94fbcd941f220736ea4987e9cfb73b17c9"
|
||||
"39be601c40daa99133b9a0f98bdc4e4b77bc47d307354119a2fab2771285048a273aa859f99a4ceb6bcf5bae19d7"
|
||||
"b9d766529d53e29a384304af8de07e",
|
||||
"321523038cedbe3da195d701835cf62941e6260c3c4ce5466e1fe14b36bccfc0bfcf4955f1f061",
|
||||
"75b72ea023300ea4fd27926d097e49d4955c6dd6747ea38d2c33bb21ca61e168" },
|
||||
{ "4600adc836738547a6e1fb257d6a7c290d4895dcbff2e071dc38bac04f338a30",
|
||||
"ab2f8f6a728f1bab52541407027c51a1619c1db32985120f5ab40cef22e08edd", "f8cbb1362eab78f7",
|
||||
"7adb0527d13748950fc60a8f6879ec1116c73817e343958965359c8f7f7465b26fe5da1f43112465be72751de684"
|
||||
"600456e97856aee757161f6157dafac3",
|
||||
"26baa1fd39aa3c33", "147f674a8345d803d23714b057bf8c030ffb002b6f9dac1a1a7d7582dd89b746" },
|
||||
{ "01f560d41c4dcdb3906e687c5fe23c070b9a8a9653987706f3357037d7d512d2",
|
||||
"a47633929b3fbfafd2c29d25ab1e8e3b6402aeecff25d60761355ef44ace4cb0",
|
||||
"6e085d40606a8042e71fc16b720cec34e47d9bd5e0676f74b6be17f7c78b53ab910980ed7b0622c248006c0ff9e9"
|
||||
"4b66b8944acfe6857f3241d0abdd8d70a4a81eb0c0a86dde53849e34643b9f37e173ed218d88bea948a240",
|
||||
"d7631a8eea17f31555b3d4abf16439f763501827180a1f5e58389f796f1c0b468f41ea3ff2e1c76cd02d180c9df1"
|
||||
"e19f6524b2a8d006f2f954f340a2f0a5a97946d39c34b935f5da5b081f18ecf457b6f0b33a37185ea8af64aa0ade"
|
||||
"40026580dafe1a5dfd2c4a7acfa8a8254897c7fd3b",
|
||||
"c309272b71ffd6ee1ed80b91ad22fe88d0488fa7c2dc4539f3452d6d6d1508c162bb8df3ec1fa5ebbd8ab738387d"
|
||||
"5b0e649cfd83e17b3e943ccedf4548171c82cb8f0b2ae39c48d78df07e282cc40c3068dc70f1fc080114c1",
|
||||
"786061e81d76bc07550cab11bc1ba1765b41e2967bc8736e11029968cbd85ba4" },
|
||||
{ "c440e9504cfb4544932adc72ff5fc1b657ba0aae703b1bff33805b7f9b81412d",
|
||||
"df08a05337a532382953728ef1e921b772d435803e671a02e9cdba82522714a1",
|
||||
"9dfa0945de0d4c2cb76aa55f8b55761911163b87993db7964760dc5e807f003b6875f74eb34cc160942f580bfba4"
|
||||
"d96d967d50b1b20b0643ae1a2c73691b6bfb64403350272686fc8bb3a8e3a5674761c2204ca240e37005",
|
||||
"0c9f5ad3e58b9bf021e09b83564c8d74b1b2bf7c8cba0dc8177084a4e1a07bb84c30c3566103f538",
|
||||
"279ac5eb9bf6e01cd50a0eda161658f331226f4c8d43fdb793ae07f353e6fc2f2821a01a02be62f515af80633215"
|
||||
"a908aad8e5199c4ff23a38277ff8f16f15058d69fca995718c0d837b6db3bbb5842dd21c07ca35b21bd4",
|
||||
"16f09ea8657c053e907bdf8f822936f2cac056af25e0240633c80ae0baf7ade2" },
|
||||
{ "ca81440758e13fe0b847ea81be8037b1be4cf995f805d4f40c1f421c9864ab9d",
|
||||
"aed156910fd8af6af094c74c0ca0fba932b436bc282e0c5c910ffd3651777117", "fd83897f98974ac8",
|
||||
"64ff6ab0506574c5020e14c45a009192a7a17ffbf6761393e17a86aaf339264a5c72e9e2b7fd22832a999076dbd4"
|
||||
"9c75145228ba6d36b0372042e22435f34577a2c3e1c89e2e1846dbc393d57064f016d0487d591fc6b7f8499701f8"
|
||||
"2568182041929386c821b74a53232dd596b300a13fa09949939967e58b2c0cf2de5b8b",
|
||||
"cc1913d2e48750a0", "59db1143754b19f380fb1d1b9296fa992b7c2f5adc56f451349d1ff95cd2a1d9" },
|
||||
{ "a657ee84d894bb98db137d57121d149eee96447353225f701b4c0c8bfc5d9497",
|
||||
"1edcd529feb85cd69e484c0989a9b60776437dd4dcf988e3bfcce5bead13f331",
|
||||
"4fd8a593ef021f81603e430e0c9eef2fa2e7cab56d86b13a9ecfee70fb96a7bb0cdc7b23df061ff73b96a289faf0"
|
||||
"c0756f0c2e4692489e58391eae3574539f40189fb8735735deda0c8d71ff361155a0d3a574b193a31746f0272001"
|
||||
"fbe8f840dbb4f16f522c90096ae5d76209af6eb2e423109d2bf0",
|
||||
"fd167c49f8e588d06df1ac5d94d61538e399d0c531aa0ac0f9a1c030dbd3e8b649796917f4f8f8078b104352b156"
|
||||
"4a042ccffd30c19340e067d4f17b0bacc47e121a8808d06b1ea6bcc06ffbc1bdaed0999dca79212c8df6ec",
|
||||
"99f8a75bbaef042167ebfb927e6ff5bdc23e3a2084e539780ffbdc20d9be6d21e761381f23937f3179aeff80469b"
|
||||
"a65b8d2169c5695ad2dc64e39d165eb7e57ded4ab07182ca59e516b41dc463c2093425d9dcf6a377312e4437d441"
|
||||
"6d063324d24945f86c57a060cdb4c182fb3c9094e6c43af38a8d",
|
||||
"977af18c47b4e1bf3f6ee45ae865d3e3dd6ebc953c4ee636c3e560beb433c5d6" },
|
||||
{ "0cb4ac9b372daf29e69a698a434c67bf822f88eabe81c2fbd1869b151bec66ad",
|
||||
"b34c3f1d39ac43e9a10ed22019b858a679fc4c629b7554e4b205ec3f31d601d7",
|
||||
"40da148ae0cd9eb7d108fe5b04664e6369ac4f24465737a33f2a16164e67a84a403a66ea3f4166b4304f",
|
||||
"1559e36d745dd40b60d8006bfa6ad62f9f1a8a7992de66bbc71d8ddf18fd68ce01e7910a972a028334f686c3b214"
|
||||
"d725d3606eb3b762d69fb1460b95e949a724d09977c41b13fb094e16e186ddd429515e939e641cc38e5f6c492f3c"
|
||||
"f7495cbe2b474c48f1890e214edfb8580d1de07855084d69ae241b421ae6",
|
||||
"e2c7a3fcd1d66a1f71301dfcfc459ad8c3485f2586a4594a02e46d35dbc4e637e9562cee2e317adc7120",
|
||||
"feae706283fea438eaa7c20641bb8446e9695cd9a0292f99b3b3ed4609a28dee" },
|
||||
{ "b38e1805f202898c64975134d2369d065b808ca28ac8562bef3dd97b96650b3c",
|
||||
"1bd55d1c60a6f84094c52906fb2f711aacb93831fee6dc27fb6a746f4c412012",
|
||||
"d4817734cb56d6bd3321c7a3dc4e23d5481703d72075ae6127f1f366a0624bc1e2ac175db9ee2fe4a9c0a016d1d9"
|
||||
"955c652970a05dbb4b16f7d2e7275b9a915bc39df5effea00190b77eeb6fd056cb2951cada1d8ef9c8e9ca0de03d"
|
||||
"7b2d659c947c9a82ab512641ae734f82",
|
||||
"1be672d193cec78c85db5636ebdfe4f087ab5a2fccff0885fb39b60f901e8d6921e4d285b5daa19dac9032d6b03a"
|
||||
"2a81740ba4ffd833e90a942253e607a800c1ff92",
|
||||
"5be3df33c976077a603612ee85cfdf388953e958e5ee0c53271058258dbcc1fa8e493e044467fd00229b64337644"
|
||||
"8e9958dae478e59808839daa20c983159be864a905f97e7e00bf82ac97bfd9d005f3282886b7c1df0b505f75741c"
|
||||
"518bedea91f800fcb135688940a38022",
|
||||
"5fe7fac48f68d44c9c8d8be7ac95025fb4bf890650af092d1228c4858a8c1a9f" },
|
||||
{ "bdeb596ed2056c8a78eb1f33340d2b8b0789cc456d6e8db9bb45516233900e29",
|
||||
"7096012b1bf4f66f48c1f26ab48d8594d244be86426438993ed1cfad84376c90",
|
||||
"5f3638865cb87188951620dfbcf77c6da914372635542fca218b74f5808090f8ff72919975744dff1a6693a759da"
|
||||
"7579ee01c449246e12783546333d9201ddd0e9941acbedc6c1995b09",
|
||||
"186d83c27e4831ef0c472840230860513d15b0f3df6a27ce2decb7a53c15e38c3b043c8a",
|
||||
"399b4dbc243c979b481b18a29415fff5065c9da5367679a2bbe60b5864352fa096c65cc51c9d5054844b8f0cdacb"
|
||||
"c638f8defdc81b7d80a9f5b1fa58201f0c513dbb192ea93a05dda87f",
|
||||
"7f5644fb9adcbc68a86621c4d6d7b1b32a62cda6ccdbe2d5fa8e708a4de8a3f5" },
|
||||
{ "42985b7c9c97ec16bba3c36bcf82e93205c35a57428262d9e45a7fd494a9020d",
|
||||
"be4b2dd3dde2e7a773f7b85f0acb48d65bdbf4d8bfc103eee72697c8834a5058",
|
||||
"6bfc05bc2457a43f50a7391a2c38627fb0429a446ac684e7552cd54c07b9608f716ceeb50d6bc0563247163213e6"
|
||||
"2ca2bbb5067dd00b3d884795a11dab0c96e23419ce7779554bf39c50edd6ae225998cf96d1effe70c81d348a938b"
|
||||
"116fcae5d402f35aa2900673376576",
|
||||
"a7f9f0d4a1cdeb5abf1d927f6968beab9c6ead6995f484c016",
|
||||
"985b208c4938d0fd9ac7b653e0d04445fd9666044e79a766c746354cf7c949e8724170dd76245f2af71ac34d379b"
|
||||
"0be203bcb863f40081564ba161087605a9863f5b39c2c7d0f7876c84b02d9131f5284ce5d837662575efedcbb3b0"
|
||||
"12053e2c4b15ef4ee0010840552759",
|
||||
"ac55330373905d10205b0884596166370c6c9c52af6a358bbf09195b3e2f2626" },
|
||||
{ "50034fdf7205a542055cf377ef546d1fe01ae8c7581806688c04279aeccf76de",
|
||||
"215de8afdde0916097f91dda6fecbd18c5e65bc685e10488e99a225a5887d92b",
|
||||
"dcd4b2ef9dd40e50adc8ce3fb674801d650e",
|
||||
"6f1ce70899b24793fd8ad89784d62ebc43b750faa9bc63fa44e707cb6877dc400dbcb85500a386add1052bbf090c"
|
||||
"637c8c618428040226209023a0db954ac26824ce40ba5021bb19d1a65ee3e3c4261c9801bd85b9c282753072",
|
||||
"df3e9901518fa830aaacab9a5635c861aab5",
|
||||
"b2a32c41c181a42175cd9108135f815663981c51f43af547e7942f77ebdc46aa" },
|
||||
{ "782358a4bf3258130b1ab345e76184bd37eeff55c6efe7b8489626e5ba01741b",
|
||||
"3ae5c450b1f426cedd3f5445ee785b6c2718d587f4239053cbad839e7e19f044", "454e",
|
||||
"bc5971d3c8a7284f6218685581fc0e67572e5f124405136021536da07ec4d443015de3a708e72eaa943f5b5fb8f4"
|
||||
"85472a3999e95dc3ab7cf72ecba533006681a49f39b5d5768e9ed22e3cfc7d20d3744308a6518d46a0",
|
||||
"8a75", "d5cf51a52be53fc9b297efd9c0f3421e598143718f7f46fc3dd542f166a65e8f" },
|
||||
{ "5958a371e26fff28efef8a6e71a0b81b4a14e3cf57ac75d215376e050468806b",
|
||||
"1293abdd7b6c43483f8caa43836922fb3a92feb4eb1476f4fa5ec4f06a0431f7",
|
||||
"06544eb4f4baafd8880df8a4e1da38d3111149aef41669b56ae2", "5f6cd8814bf4915f08cbf1",
|
||||
"e4b718de939d6fbb41e32b57098b08fa16bd39ccc085625d0546",
|
||||
"d1a48afe22b3c7d28e239f103b93b0a200428f4bb8e80fcb2e5110fd1ed780eb" },
|
||||
{ "7bdcad0b011743f3dec12c999ac89b28f60e03564cd076fbf0183457846e606b",
|
||||
"e008a14a3fb5e56e89e02d5fec31b37b3fb6357682bc3db3368f25987f6205c2",
|
||||
"c2bc1a650114c6d522d2f928c6a65fb6abcca554336dfb70b51f61558a349387b35462bba19c3f8f13488fd4812f"
|
||||
"9d6d58d04a6ca93e8dad62a5f695a0834dd99f876294",
|
||||
"18066e9f8cdd274090f075f3047a455ca6be1ec4d1672acb013f328a1d981bece9b9c9f0f38dd25db8523b885b47"
|
||||
"cfaba4844d5bb3972591bdc2b68062e7fb0e08773506e7851a18fbc6cd29c29358a347ea195a10f5a7d874010909"
|
||||
"278395f2f9820ee8eb6655602b7b44c6c1642b9c157cc5c1a454e1b18b46",
|
||||
"bcf887985dc0e45a156b522f02c4b2adbf90a2b30f4a30ee68505df9c61d3857a6216a827c98d1d7df6dc664a526"
|
||||
"32b61361f4d86ca646c83f690015535b149c545efed3",
|
||||
"bd2cbde77f6ef4955e956d440226534942f7a41a659eb826647b3a99a57efa87" },
|
||||
{ "21505992872622190e47da3d4a985ceaf356b35e096429bdff8e4a21fcbeccac",
|
||||
"8b4ab2427a4177cd205fda2b2b31f8f5ecc5ff591262791f88f54535f3054977",
|
||||
"1ceea40aba4d9328718e9939eaba25f5b558ed0df855e743cc958506b4d0c5e44d0690b9637bf94a30e861ed9260"
|
||||
"e254d602be895f173453a7977236846c4687d2b38470f074b07e16e67721646989421cf5081555fa7bef42a83066"
|
||||
"6e6c2c9b61ba14932210",
|
||||
"106f5b1fed2f5d3a102733ef6fbb7e190e508e7e8cb73766bf18fa4d50b87d6f83144f9b616dceef6c0b085f09e4"
|
||||
"27f7f0985a535fd9edf3bc05aa8dbc0db601cb4f90761420164fba50a68c5a87322fecbe28c902b03035e88d499a"
|
||||
"f758eb2049659f2561ee6c5210579f8c0c",
|
||||
"1562c0d501518e478b0c5561b32a79bbf5249d0eb8db411190454b4f3a458bfc200f65af91a22eb0fce63c726cb2"
|
||||
"b51023d294c9a35e0ff842da517d6f91b6126c0ecfccd72cfc35d7ef98f11ebbb4cd071c2eafeda598a5ccf4e09d"
|
||||
"8cff52ed583d968525a7",
|
||||
"1dfe935ef87488e515897c850bc899d4a9844d512969802e98be90c0343bc146" },
|
||||
{ "337bd1641222ad96608b0928eb3e05fee02a6fb1e2f66cb4c9b698d1d96ee39b",
|
||||
"b532f2e6485513a5b21a6326beded2b3a74bc49c74db3f7a23e440e5bc864e7d",
|
||||
"9cdf9d6c42cff95ca0bf8d199962f55ce013348fb06d878b10a344ad5a7b2b2981b0e44ddb7dda1f74bcd24f3ff1"
|
||||
"bb63da249bb02234edf123305759780e45ace82aac7a95adbd1c7e72741e374c82a4524146d13589ef28ee593678"
|
||||
"9e65724b10406aff6d19d0fee8289033c094bed67df3fd45b0bdd52fccc25492cd335a",
|
||||
"efa6fdd7e4c161a5cc2eb6d67b14d6d8f16ecd3c52e8c9720709c321de05973b51750a7286120a50b3039e54c4c5"
|
||||
"e09785f815ddb5eb528b43e972bf4c60e41252",
|
||||
"4616337212a9b1fb827ad8729cf40a8309330dcc958ac0d5f73c9e57279de69280065e13fd1309153243c1303cf1"
|
||||
"16227392c9ce4b8ab505a580c06926587378c83f49c30021a1f4038180fedbe90259a9d468c87bdff827da1d01a1"
|
||||
"23fbd5b091d62d3b17e3ce7f4e83cba4510dc1e41b420c2ffc7544464befe9eb5a898d",
|
||||
"709914dea13632a2127159bf004a73349efc090a46bfecec911c63679a1540e6" },
|
||||
{ "88f3c9cd7b2f27295c5defc7ba7071996ae5d558192c1a4788efe8a3bc3559d0",
|
||||
"d1ec8bbec1bd039825009a00b35522ad81c8de7bbfb698551f880b05319330c6",
|
||||
"5fc7d4fba7f9018c91533584a5e61be925559d1c8b1270621aaa2f0f51ec69ee7b14628841e2a234f3ed4279e589"
|
||||
"bc40339928d600f79a051db41699a98a263864ae34909a7c37e9c833c106bc5e996c730879d7b94d18c87741a3e7"
|
||||
"2bbbd30a5c7a",
|
||||
"9c",
|
||||
"efec904dfe14b42ca52b083ca46fc0ab80877b425e8cfbafdbcdf8600bcaa64afa05119ebbdd0f8db82ae71236c2"
|
||||
"4cac6cc53b9e0ec701f94ae4a9217f9f63ad426394793cebb1f0af7ba4bf0dc8ac621c48e2a435955afc79f095ba"
|
||||
"518e20bbe360",
|
||||
"1ed588fb6966a006fccc5f5a6e57949f9389f89c3e346bd8851610a0b159e958" },
|
||||
{ "db7c3c7c7e5aa8a1c5cd5173bfb0d25958db4038a3d8deb705c102935fea8f21",
|
||||
"315686635d388d5b2ecf3b12a8450280d92555a6920f6ad3b48ba3b4f8ec5053",
|
||||
"939b319d85880267f8be72b69d2a22ba2460bbd7ce68cfc9398afce09c4f0005cf510db2aa894dcbf08120f07640"
|
||||
"255a9464056ec16765521f23d602b5af51cab7133cf01123b3038cd7dc47fdd7801c46fd628de0aa",
|
||||
"b2da",
|
||||
"783dbc7d88eb43f69d7330326e58555f58df2e75a019586beb5e4a303a3b3e4439677fd7e00a6826372cb2bc15c2"
|
||||
"5ab445bb0dfa8aae1f4d9b5d6ded219e69037c161c7fd5911bf08e3179419dbef05d37df75fb19c2",
|
||||
"b96409a14cdac61218fcc2ece389e570ac6c665856f36d98fa01be4d767b960c" },
|
||||
{ "cf1f1538739072f57ebf0fa4090a63c72cf8f5bb904effb6051073596ed1dd19",
|
||||
"41e11d23771626febef2435eaefddf0c93a484ea6c4c7fa0bfd48f93e50b646d",
|
||||
"a22ba67dac88efd1988863f8991bfc9dbb9dc1a34e3866b0a51e088671971225fed3bc0369b0bccb436249d6fa30"
|
||||
"e7",
|
||||
"80d7f1fc70203411f8827cd7eec9888f26e39e055d8fd1c2876e1e252b3b14363f493100f157d8246c29b973a490"
|
||||
"338dfa0bcb52221d260875a65e22a56f655a55330933b35e2937c53a625a55bf40564fc58f742ecf54aed0536ca3"
|
||||
"f7c59f6d",
|
||||
"b3c76b03eb90c78ca281f178f30a92a98ed9966698ceb24f15f6c5ebf2e65ec4880543847005a58006a0829d2d00"
|
||||
"b3",
|
||||
"22f4354c7487a2db0c8c2249fe96909ea1cc9a053447b4a83ad396e3b3ec87ca" },
|
||||
{ "38a7aa902690a3e1b285953e0121eae7304815e12a015fa98cbd227e6f7d73c1",
|
||||
"f23f9ac01c0b118b684f10031836f7c92e8a70eea0e916dba2952b685ae2c148",
|
||||
"995580acc337ee1216802b1a45daf0df12280eb94953ac61916d35eee038e5ea1d1f53da1c6a3e17d54dd1555e79"
|
||||
"c4ac988494f805715f59f2404eee2fdb592fa538928d",
|
||||
"6b726ca02fa44684e7d92ddb0b6e2f30d6a6e75b537f209d21bf2375718b4092286ea592f3c1750af21b12f64961"
|
||||
"1370ee4bfac05e0281c9731242c507a56d9d6522c26e172fb406f3e61efbf3c346917988a1dc85c829d51d3954a0"
|
||||
"825d2ca4d0e2a784c78ea07bfc5973e80fe6b34ccfe72457",
|
||||
"c73f3832441f59ce54910fd16dca9e2bd59a168ccd658ba3eb87fbb1ba561f63ad73ecf9618481bc6e8c8020c60e"
|
||||
"8194cc65bdea155f0f6cc79adaf2334c099793efba4a",
|
||||
"5c52422a24f79990f26224082d375bf81eaf5df242389c894cf89c4d0131d01e" },
|
||||
{ "aa54db3f1c5e6405d443afcf4a463974448435f4002d64044a21a04c269759b9",
|
||||
"0711d3a79176e4c75ac8cc1ecdbadd4203a6a4b9eda4c2ef17150f493d645b8b",
|
||||
"5a80d351e6a2682a6ceeb374acf59de7e7",
|
||||
"171077e40c0a689d44003bd1ce56c08b81f6fa3c118cf448f5e8b6386328d5e3465132e5bdf4f73e60b1b1e6e021"
|
||||
"d05f6881fe7ec8be523ae7e6c57dd1b0af6939b79dc785d584400dfb71aabc336817e295a922aa1d46b873ad3863"
|
||||
"3099ffbecbf43527a1e64f98d82cf85a18",
|
||||
"5026a9cbdd2239c6a9abd45e36d5b46b14",
|
||||
"afe7bea6340c227c0f062e73a05e1be4aa63b93d35f2322322d3e855e0ef5887" },
|
||||
{ "c3dddd6891c6081f6b478a6cf89574636c8905efbc8079ef1924b97036a050ef",
|
||||
"abc30e2892910e8c3fb83d4cb6f93eea614a7ff03b750e31ad5fc74ab77e0715",
|
||||
"079db15c3fc075189ca979ae738e72f0e5a35410b0b746d2d92874f58214cedd7e69a5337485ff038a44f18cbb6c"
|
||||
"9bb02bc396aa128b87e7888011e803fd9f43dd43494dfb2b58981d1f95820be9d37cec3bc4f779861cf59137f764"
|
||||
"dd88ea41cf044d9a",
|
||||
"56c59f42c3429832f9f2333099d2c422ea40cf36162b162e6cda56a9",
|
||||
"6910f3c047011cf301c6d8458ca4d1c40aafc129476a9c89da7b35ced9479edd3c7cbd5c1ae7a8fabff159cce121"
|
||||
"c170c1e1a884255b08758d640371d26eb031ae92d1deb7091f202bff0698ca059eae8ae572ada217b6d3df5d446a"
|
||||
"a5aef503eda02f5e",
|
||||
"f5d285ebf784c68df40ff4324bf79d0808d43f0739d297f4238b833a7cf9c013" },
|
||||
{ "77716c56b9f0e158530b24ae8bc160f827eb4a11ee3b1bb3fbef3922e41d58c1",
|
||||
"f340f377c03ffca01829e013ba7a175b158ac51e5ec84e13dcc1a1974e157557",
|
||||
"2b9b2bf80c7c65d0a2d243cfac9d01ec9a0250b5e985d430f5eed4ca6aa62b31e3f5d4256a9c998fc588c69486ad"
|
||||
"41618d8b9094468f9e74b6",
|
||||
"d314a97f25ebbb16aa2d8a444c70474b5733fa18507c544515ac905450507c708868a7c3847705fcc3b7651a72a2"
|
||||
"15675a24d44aec160c562c1d68f859dcd4b9aa3569595e040ef6",
|
||||
"a58d41ed071ccfd12e01de4038783e6b23f84f55354dc0368a025cb9ceff0aa01d9e77badba040fdbc5cd984f95f"
|
||||
"4c6c6ad1151f02b5687ffd",
|
||||
"f66ee48f6ab2bbdf3ebd292a11c997bfd6f81ef5a9b61f0c9c5f9e77d7fa2624" }
|
||||
};
|
||||
|
||||
static int
|
||||
tv(void)
|
||||
{
|
||||
unsigned char *ad;
|
||||
unsigned char *ciphertext;
|
||||
unsigned char *decrypted;
|
||||
unsigned char *detached_ciphertext;
|
||||
unsigned char *expected_ciphertext;
|
||||
unsigned char *key;
|
||||
unsigned char *message;
|
||||
unsigned char *mac;
|
||||
unsigned char *nonce;
|
||||
char *hex;
|
||||
unsigned long long found_ciphertext_len;
|
||||
unsigned long long found_mac_len;
|
||||
unsigned long long found_message_len;
|
||||
size_t ad_len;
|
||||
size_t ciphertext_len;
|
||||
size_t detached_ciphertext_len;
|
||||
size_t i = 0U;
|
||||
size_t message_len;
|
||||
|
||||
key = (unsigned char *) sodium_malloc(crypto_aead_aegis256_KEYBYTES);
|
||||
nonce = (unsigned char *) sodium_malloc(crypto_aead_aegis256_NPUBBYTES);
|
||||
mac = (unsigned char *) sodium_malloc(crypto_aead_aegis256_ABYTES);
|
||||
|
||||
do {
|
||||
assert(strlen(tests[i].key_hex) == 2 * crypto_aead_aegis256_KEYBYTES);
|
||||
sodium_hex2bin(key, crypto_aead_aegis256_KEYBYTES, tests[i].key_hex,
|
||||
strlen(tests[i].key_hex), NULL, NULL, NULL);
|
||||
assert(strlen(tests[i].nonce_hex) == 2 * crypto_aead_aegis256_NPUBBYTES);
|
||||
sodium_hex2bin(nonce, crypto_aead_aegis256_NPUBBYTES, tests[i].nonce_hex,
|
||||
strlen(tests[i].nonce_hex), NULL, NULL, NULL);
|
||||
message_len = strlen(tests[i].message_hex) / 2;
|
||||
message = (unsigned char *) sodium_malloc(message_len);
|
||||
sodium_hex2bin(message, message_len, tests[i].message_hex, strlen(tests[i].message_hex),
|
||||
NULL, NULL, NULL);
|
||||
ad_len = strlen(tests[i].ad_hex) / 2;
|
||||
ad = (unsigned char *) sodium_malloc(ad_len);
|
||||
sodium_hex2bin(ad, ad_len, tests[i].ad_hex, strlen(tests[i].ad_hex), NULL, NULL, NULL);
|
||||
ciphertext_len = message_len + crypto_aead_aegis256_ABYTES;
|
||||
detached_ciphertext_len = message_len;
|
||||
expected_ciphertext = (unsigned char *) sodium_malloc(ciphertext_len);
|
||||
assert(strlen(tests[i].ciphertext_hex) == 2 * message_len);
|
||||
sodium_hex2bin(expected_ciphertext, message_len, tests[i].ciphertext_hex,
|
||||
strlen(tests[i].ciphertext_hex), NULL, NULL, NULL);
|
||||
assert(strlen(tests[i].mac_hex) == 2 * crypto_aead_aegis256_ABYTES);
|
||||
sodium_hex2bin(expected_ciphertext + message_len, crypto_aead_aegis256_ABYTES,
|
||||
tests[i].mac_hex, strlen(tests[i].mac_hex), NULL, NULL, NULL);
|
||||
ciphertext = (unsigned char *) sodium_malloc(ciphertext_len);
|
||||
detached_ciphertext = (unsigned char *) sodium_malloc(detached_ciphertext_len);
|
||||
|
||||
crypto_aead_aegis256_encrypt_detached(detached_ciphertext, mac, &found_mac_len, message,
|
||||
message_len, ad, ad_len, NULL, nonce, key);
|
||||
assert(found_mac_len == crypto_aead_aegis256_ABYTES);
|
||||
if (memcmp(detached_ciphertext, expected_ciphertext, detached_ciphertext_len) != 0 ||
|
||||
memcmp(mac, expected_ciphertext + message_len, crypto_aead_aegis256_ABYTES) != 0) {
|
||||
printf("Detached encryption of test vector #%u failed\n", (unsigned int) i);
|
||||
hex = (char *) sodium_malloc((size_t) ciphertext_len * 2 + 1);
|
||||
sodium_bin2hex(hex, (size_t) ciphertext_len * 2 + 1, ciphertext, ciphertext_len);
|
||||
printf("Computed: [%s]\n", hex);
|
||||
sodium_free(hex);
|
||||
}
|
||||
|
||||
crypto_aead_aegis256_encrypt(ciphertext, &found_ciphertext_len, message, message_len, ad,
|
||||
ad_len, NULL, nonce, key);
|
||||
|
||||
assert((size_t) found_ciphertext_len == ciphertext_len);
|
||||
if (memcmp(ciphertext, expected_ciphertext, ciphertext_len) != 0) {
|
||||
printf("Encryption of test vector #%u failed\n", (unsigned int) i);
|
||||
hex = (char *) sodium_malloc((size_t) found_ciphertext_len * 2 + 1);
|
||||
sodium_bin2hex(hex, (size_t) found_ciphertext_len * 2 + 1, ciphertext, ciphertext_len);
|
||||
printf("Computed: [%s]\n", hex);
|
||||
sodium_free(hex);
|
||||
}
|
||||
|
||||
decrypted = (unsigned char *) sodium_malloc(message_len);
|
||||
found_message_len = 1;
|
||||
if (crypto_aead_aegis256_decrypt(decrypted, &found_message_len, NULL, ciphertext,
|
||||
randombytes_uniform((uint32_t) ciphertext_len), ad, ad_len,
|
||||
nonce, key) != -1) {
|
||||
printf("Verification of test vector #%u after truncation succeeded\n",
|
||||
(unsigned int) i);
|
||||
}
|
||||
if (found_message_len != 0) {
|
||||
printf("Message length should have been set to zero after a failure\n");
|
||||
}
|
||||
if (crypto_aead_aegis256_decrypt(decrypted, &found_message_len, NULL, guard_page,
|
||||
randombytes_uniform(crypto_aead_aegis256_ABYTES), ad,
|
||||
ad_len, nonce, key) != -1) {
|
||||
printf("Verification of test vector #%u with a truncated tag failed\n",
|
||||
(unsigned int) i);
|
||||
}
|
||||
if (i == 0 && crypto_aead_aegis256_decrypt(NULL, NULL, NULL, ciphertext, ciphertext_len, ad,
|
||||
ad_len, nonce, key) != 0) {
|
||||
printf("Verification of test vector #%u's tag failed\n", (unsigned int) i);
|
||||
}
|
||||
if (crypto_aead_aegis256_decrypt(decrypted, &found_message_len, NULL, ciphertext,
|
||||
ciphertext_len, ad, ad_len, nonce, key) != 0) {
|
||||
printf("Verification of test vector #%u failed\n", (unsigned int) i);
|
||||
}
|
||||
assert((size_t) found_message_len == message_len);
|
||||
if (memcmp(decrypted, message, message_len) != 0) {
|
||||
printf("Incorrect decryption of test vector #%u\n", (unsigned int) i);
|
||||
}
|
||||
memset(decrypted, 0xd0, message_len);
|
||||
if (crypto_aead_aegis256_decrypt_detached(decrypted, NULL, detached_ciphertext,
|
||||
detached_ciphertext_len, mac, ad, ad_len, nonce,
|
||||
key) != 0) {
|
||||
printf("Detached verification of test vector #%u failed\n", (unsigned int) i);
|
||||
}
|
||||
if (memcmp(decrypted, message, message_len) != 0) {
|
||||
printf("Incorrect decryption of test vector #%u\n", (unsigned int) i);
|
||||
}
|
||||
|
||||
sodium_free(message);
|
||||
sodium_free(ad);
|
||||
sodium_free(expected_ciphertext);
|
||||
sodium_free(ciphertext);
|
||||
sodium_free(decrypted);
|
||||
sodium_free(detached_ciphertext);
|
||||
} while (++i < (sizeof tests) / (sizeof tests[0]));
|
||||
|
||||
sodium_free(key);
|
||||
sodium_free(mac);
|
||||
sodium_free(nonce);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
tv();
|
||||
assert(crypto_aead_aegis256_keybytes() == crypto_aead_aegis256_KEYBYTES);
|
||||
assert(crypto_aead_aegis256_nsecbytes() == crypto_aead_aegis256_NSECBYTES);
|
||||
assert(crypto_aead_aegis256_npubbytes() == crypto_aead_aegis256_NPUBBYTES);
|
||||
assert(crypto_aead_aegis256_abytes() == crypto_aead_aegis256_ABYTES);
|
||||
assert(crypto_aead_aegis256_messagebytes_max() == crypto_aead_aegis256_MESSAGEBYTES_MAX);
|
||||
printf("OK\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
OK
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
OK
|
||||
@@ -0,0 +1,276 @@
|
||||
|
||||
#define TEST_NAME "aead_aes256gcm2"
|
||||
#include "cmptest.h"
|
||||
|
||||
static struct {
|
||||
const char *key_hex;
|
||||
const char nonce_hex[crypto_aead_aes256gcm_NPUBBYTES * 2 + 1];
|
||||
const char *ad_hex;
|
||||
const char *message_hex;
|
||||
const char *detached_ciphertext_hex;
|
||||
const char mac_hex[crypto_aead_aes256gcm_ABYTES * 2 + 1];
|
||||
const char *outcome;
|
||||
} tests[] = {
|
||||
{ "92ace3e348cd821092cd921aa3546374299ab46209691bc28b8752d17f123c20",
|
||||
"00112233445566778899aabb", "00000000ffffffff", "00010203040506070809",
|
||||
"e27abdd2d2a53d2f136b", "9a4a2579529301bcfb71c78d4060f52c", "valid" },
|
||||
{ "29d3a44f8723dc640239100c365423a312934ac80239212ac3df3421a2098123",
|
||||
"00112233445566778899aabb", "aabbccddeeff", "", "",
|
||||
"2a7d77fa526b8250cb296078926b5020", "valid" },
|
||||
{ "cc56b680552eb75008f5484b4cb803fa5063ebd6eab91f6ab6aef4916a766273",
|
||||
"99e23ec48985bccdeeab60f1", "", "2a", "06",
|
||||
"633c1e9703ef744ffffb40edf9d14355", "valid" },
|
||||
{ "51e4bf2bad92b7aff1a4bc05550ba81df4b96fabf41c12c7b00e60e48db7e152",
|
||||
"4f07afedfdc3b6c2361823d3", "", "be3308f72a2c6aed", "cf332a12fdee800b",
|
||||
"602e8d7c4799d62c140c9bb834876b09", "valid" },
|
||||
{ "67119627bd988eda906219e08c0d0d779a07d208ce8a4fe0709af755eeec6dcb",
|
||||
"68ab7fdbf61901dad461d23c", "", "51f8c1f731ea14acdb210a6d973e07",
|
||||
"43fc101bff4b32bfadd3daf57a590e", "ec04aacb7148a8b8be44cb7eaf4efa69",
|
||||
"valid" },
|
||||
{ "59d4eafb4de0cfc7d3db99a8f54b15d7b39f0acc8da69763b019c1699f87674a",
|
||||
"2fcb1b38a99e71b84740ad9b", "", "549b365af913f3b081131ccb6b825588",
|
||||
"f58c16690122d75356907fd96b570fca", "28752c20153092818faba2a334640d6e",
|
||||
"valid" },
|
||||
{ "3b2458d8176e1621c0cc24c0c0e24c1e80d72f7ee9149a4b166176629616d011",
|
||||
"45aaa3e5d16d2d42dc03445d", "", "3ff1514b1c503915918f0c0c31094a6e1f",
|
||||
"73a6b6f45f6ccc5131e07f2caa1f2e2f56", "2d7379ec1db5952d4e95d30c340b1b1d",
|
||||
"valid" },
|
||||
{ "0212a8de5007ed87b33f1a7090b6114f9e08cefd9607f2c276bdcfdbc5ce9cd7",
|
||||
"e6b1adf2fd58a8762c65f31b", "",
|
||||
"10f1ecf9c60584665d9ae5efe279e7f7377eea6916d2b111",
|
||||
"0843fff52d934fc7a071ea62c0bd351ce85678cde3ea2c9e",
|
||||
"7355fde599006715053813ce696237a8", "valid" },
|
||||
{ "b279f57e19c8f53f2f963f5f2519fdb7c1779be2ca2b3ae8e1128b7d6c627fc4",
|
||||
"98bc2c7438d5cd7665d76f6e", "c0",
|
||||
"fcc515b294408c8645c9183e3f4ecee5127846d1",
|
||||
"eb5500e3825952866d911253f8de860c00831c81",
|
||||
"ecb660e1fb0541ec41e8d68a64141b3a", "valid" },
|
||||
{ "cdccfe3f46d782ef47df4e72f0c02d9c7f774def970d23486f11a57f54247f17",
|
||||
"376187894605a8d45e30de51", "956846a209e087ed",
|
||||
"e28e0e9f9d22463ac0e42639b530f42102fded75",
|
||||
"feca44952447015b5df1f456df8ca4bb4eee2ce2",
|
||||
"082e91924deeb77880e1b1c84f9b8d30", "valid" },
|
||||
{ "f32364b1d339d82e4f132d8f4a0ec1ff7e746517fa07ef1a7f422f4e25a48194",
|
||||
"5a86a50a0e8a179c734b996d", "ab2ac7c44c60bdf8228c7884adb20184",
|
||||
"43891bccb522b1e72a6b53cf31c074e9d6c2df8e",
|
||||
"43dda832e942e286da314daa99bef5071d9d2c78",
|
||||
"c3922583476ced575404ddb85dd8cd44", "valid" },
|
||||
{ "ff0089ee870a4a39f645b0a5da774f7a5911e9696fc9cad646452c2aa8595a12",
|
||||
"bc2a7757d0ce2d8b1f14ccd9",
|
||||
"972ab4e06390caae8f99dd6e2187be6c7ff2c08a24be16ef",
|
||||
"748b28031621d95ee61812b4b4f47d04c6fc2ff3",
|
||||
"a929ee7e67c7a2f91bbcec6389a3caf43ab49305",
|
||||
"ebec6774b955e789591c822dab739e12", "valid" },
|
||||
{ "00112233445566778899aabbccddeeff102132435465768798a9bacbdcedfe0f",
|
||||
"000000000000000000000000", "", "561008fa07a68f5c61285cd013464eaf",
|
||||
"23293e9b07ca7d1b0cae7cc489a973b3", "ffffffffffffffffffffffffffffffff",
|
||||
"valid" },
|
||||
{ "00112233445566778899aabbccddeeff102132435465768798a9bacbdcedfe0f",
|
||||
"ffffffffffffffffffffffff", "", "c6152244cea1978d3e0bc274cf8c0b3b",
|
||||
"7cb6fc7c6abc009efe9551a99f36a421", "00000000000000000000000000000000",
|
||||
"valid" },
|
||||
{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
"505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
|
||||
"b2061457c0759fc1749f174ee1ccadfa", "9de8fef6d8ab1bf1bf887232eab590dd",
|
||||
"invalid" },
|
||||
{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
"505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
|
||||
"b2061457c0759fc1749f174ee1ccadfa", "9ee8fef6d8ab1bf1bf887232eab590dd",
|
||||
"invalid" },
|
||||
{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
"505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
|
||||
"b2061457c0759fc1749f174ee1ccadfa", "1ce8fef6d8ab1bf1bf887232eab590dd",
|
||||
"invalid" },
|
||||
{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
"505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
|
||||
"b2061457c0759fc1749f174ee1ccadfa", "9ce9fef6d8ab1bf1bf887232eab590dd",
|
||||
"invalid" },
|
||||
{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
"505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
|
||||
"b2061457c0759fc1749f174ee1ccadfa", "9ce8fe76d8ab1bf1bf887232eab590dd",
|
||||
"invalid" },
|
||||
{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
"505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
|
||||
"b2061457c0759fc1749f174ee1ccadfa", "9ce8fef6d9ab1bf1bf887232eab590dd",
|
||||
"invalid" },
|
||||
{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
"505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
|
||||
"b2061457c0759fc1749f174ee1ccadfa", "9ce8fef6daab1bf1bf887232eab590dd",
|
||||
"invalid" },
|
||||
{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
"505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
|
||||
"b2061457c0759fc1749f174ee1ccadfa", "9ce8fef6d8ab1b71bf887232eab590dd",
|
||||
"invalid" },
|
||||
{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
"505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
|
||||
"b2061457c0759fc1749f174ee1ccadfa", "9ce8fef6d8ab1bf1be887232eab590dd",
|
||||
"invalid" },
|
||||
{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
"505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
|
||||
"b2061457c0759fc1749f174ee1ccadfa", "9ce8fef6d8ab1bf13f887232eab590dd",
|
||||
"invalid" },
|
||||
{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
"505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
|
||||
"b2061457c0759fc1749f174ee1ccadfa", "9ce8fef6d8ab1bf1bfa87232eab590dd",
|
||||
"invalid" },
|
||||
{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
"505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
|
||||
"b2061457c0759fc1749f174ee1ccadfa", "9ce8fef6d8ab1bf1bf887332eab590dd",
|
||||
"invalid" },
|
||||
{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
"505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
|
||||
"b2061457c0759fc1749f174ee1ccadfa", "9ce8fef6d8ab1bf1bf887232ebb590dd",
|
||||
"invalid" },
|
||||
{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
"505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
|
||||
"b2061457c0759fc1749f174ee1ccadfa", "9ce8fef6d8ab1bf1bf887232e8b590dd",
|
||||
"invalid" },
|
||||
{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
"505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
|
||||
"b2061457c0759fc1749f174ee1ccadfa", "9ce8fef6d8ab1bf1bf8872326ab590dd",
|
||||
"invalid" },
|
||||
{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
"505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
|
||||
"b2061457c0759fc1749f174ee1ccadfa", "9ce8fef6d8ab1bf1bf887232eab590dc",
|
||||
"invalid" },
|
||||
{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
"505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
|
||||
"b2061457c0759fc1749f174ee1ccadfa", "9ce8fef6d8ab1bf1bf887232eab590df",
|
||||
"invalid" },
|
||||
{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
"505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
|
||||
"b2061457c0759fc1749f174ee1ccadfa", "9ce8fef6d8ab1bf1bf887232eab5909d",
|
||||
"invalid" },
|
||||
{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
"505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
|
||||
"b2061457c0759fc1749f174ee1ccadfa", "9ce8fef6d8ab1bf1bf887232eab5905d",
|
||||
"invalid" },
|
||||
{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
"505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
|
||||
"b2061457c0759fc1749f174ee1ccadfa", "9de8fef6d8ab1bf1be887232eab590dd",
|
||||
"invalid" },
|
||||
{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
"505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
|
||||
"b2061457c0759fc1749f174ee1ccadfa", "9ce8fe76d8ab1b71bf887232eab590dd",
|
||||
"invalid" },
|
||||
{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
"505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
|
||||
"b2061457c0759fc1749f174ee1ccadfa", "9ce8fef6d8ab1b71bf887232eab5905d",
|
||||
"invalid" },
|
||||
{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
"505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
|
||||
"b2061457c0759fc1749f174ee1ccadfa", "631701092754e40e40778dcd154a6f22",
|
||||
"invalid" },
|
||||
{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
"505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
|
||||
"b2061457c0759fc1749f174ee1ccadfa", "00000000000000000000000000000000",
|
||||
"invalid" },
|
||||
{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
"505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
|
||||
"b2061457c0759fc1749f174ee1ccadfa", "ffffffffffffffffffffffffffffffff",
|
||||
"invalid" },
|
||||
{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
"505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
|
||||
"b2061457c0759fc1749f174ee1ccadfa", "1c687e76582b9b713f08f2b26a35105d",
|
||||
"invalid" },
|
||||
{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
"505152535455565758595a5b", "", "202122232425262728292a2b2c2d2e2f",
|
||||
"b2061457c0759fc1749f174ee1ccadfa", "9de9fff7d9aa1af0be897333ebb491dc",
|
||||
"invalid" }
|
||||
};
|
||||
|
||||
static int
|
||||
tv(void)
|
||||
{
|
||||
unsigned char *ad;
|
||||
unsigned char *decrypted;
|
||||
unsigned char *detached_ciphertext;
|
||||
unsigned char *key;
|
||||
unsigned char *message;
|
||||
unsigned char *mac;
|
||||
unsigned char *nonce;
|
||||
size_t ad_len;
|
||||
size_t detached_ciphertext_len;
|
||||
size_t message_len;
|
||||
unsigned int i;
|
||||
|
||||
key = (unsigned char *) sodium_malloc(crypto_aead_aes256gcm_KEYBYTES);
|
||||
nonce = (unsigned char *) sodium_malloc(crypto_aead_aes256gcm_NPUBBYTES);
|
||||
mac = (unsigned char *) sodium_malloc(crypto_aead_aes256gcm_ABYTES);
|
||||
|
||||
for (i = 0U; i < (sizeof tests) / (sizeof tests[0]); i++) {
|
||||
assert(strlen(tests[i].key_hex) == 2 * crypto_aead_aes256gcm_KEYBYTES);
|
||||
sodium_hex2bin(key, crypto_aead_aes256gcm_KEYBYTES, tests[i].key_hex,
|
||||
strlen(tests[i].key_hex), NULL, NULL, NULL);
|
||||
|
||||
assert(strlen(tests[i].nonce_hex) ==
|
||||
2 * crypto_aead_aes256gcm_NPUBBYTES);
|
||||
sodium_hex2bin(nonce, crypto_aead_aes256gcm_NPUBBYTES,
|
||||
tests[i].nonce_hex, strlen(tests[i].nonce_hex), NULL,
|
||||
NULL, NULL);
|
||||
|
||||
message_len = strlen(tests[i].message_hex) / 2;
|
||||
message = (unsigned char *) sodium_malloc(message_len);
|
||||
sodium_hex2bin(message, message_len, tests[i].message_hex,
|
||||
strlen(tests[i].message_hex), NULL, NULL, NULL);
|
||||
|
||||
ad_len = strlen(tests[i].ad_hex) / 2;
|
||||
ad = (unsigned char *) sodium_malloc(ad_len);
|
||||
sodium_hex2bin(ad, ad_len, tests[i].ad_hex, strlen(tests[i].ad_hex),
|
||||
NULL, NULL, NULL);
|
||||
|
||||
detached_ciphertext_len = message_len;
|
||||
assert(strlen(tests[i].detached_ciphertext_hex) == 2 * message_len);
|
||||
assert(strlen(tests[i].mac_hex) == 2 * crypto_aead_aes256gcm_ABYTES);
|
||||
sodium_hex2bin(mac, crypto_aead_aes256gcm_ABYTES, tests[i].mac_hex,
|
||||
strlen(tests[i].mac_hex), NULL, NULL, NULL);
|
||||
|
||||
detached_ciphertext =
|
||||
(unsigned char *) sodium_malloc(detached_ciphertext_len);
|
||||
sodium_hex2bin(detached_ciphertext, detached_ciphertext_len,
|
||||
tests[i].detached_ciphertext_hex,
|
||||
strlen(tests[i].detached_ciphertext_hex), NULL, NULL,
|
||||
NULL);
|
||||
|
||||
decrypted = (unsigned char *) sodium_malloc(message_len);
|
||||
if (crypto_aead_aes256gcm_decrypt_detached(
|
||||
decrypted, NULL, detached_ciphertext, detached_ciphertext_len,
|
||||
mac, ad, ad_len, nonce, key) == 0) {
|
||||
if (strcmp(tests[i].outcome, "valid") != 0) {
|
||||
printf("*** test case %u succeeded, was supposed to be %s\n", i,
|
||||
tests[i].outcome);
|
||||
}
|
||||
if (memcmp(decrypted, message, message_len) != 0) {
|
||||
printf("Incorrect decryption of test vector #%u\n",
|
||||
(unsigned int) i);
|
||||
}
|
||||
} else {
|
||||
if (strcmp(tests[i].outcome, "invalid") != 0) {
|
||||
printf("*** test case %u failed, was supposed to be %s\n", i,
|
||||
tests[i].outcome);
|
||||
}
|
||||
}
|
||||
|
||||
sodium_free(message);
|
||||
sodium_free(ad);
|
||||
sodium_free(decrypted);
|
||||
sodium_free(detached_ciphertext);
|
||||
}
|
||||
|
||||
sodium_free(key);
|
||||
sodium_free(mac);
|
||||
sodium_free(nonce);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
if (crypto_aead_aes256gcm_is_available()) {
|
||||
tv();
|
||||
}
|
||||
printf("OK\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
OK
|
||||
@@ -0,0 +1,372 @@
|
||||
|
||||
#define TEST_NAME "aead_chacha20poly1305"
|
||||
#include "cmptest.h"
|
||||
|
||||
static int
|
||||
tv(void)
|
||||
{
|
||||
#undef MLEN
|
||||
#define MLEN 10U
|
||||
#undef ADLEN
|
||||
#define ADLEN 10U
|
||||
#undef CLEN
|
||||
#define CLEN (MLEN + crypto_aead_chacha20poly1305_ABYTES)
|
||||
static const unsigned char firstkey[crypto_aead_chacha20poly1305_KEYBYTES]
|
||||
= { 0x42, 0x90, 0xbc, 0xb1, 0x54, 0x17, 0x35, 0x31, 0xf3, 0x14, 0xaf,
|
||||
0x57, 0xf3, 0xbe, 0x3b, 0x50, 0x06, 0xda, 0x37, 0x1e, 0xce, 0x27,
|
||||
0x2a, 0xfa, 0x1b, 0x5d, 0xbd, 0xd1, 0x10, 0x0a, 0x10, 0x07 };
|
||||
static const unsigned char m[MLEN]
|
||||
= { 0x86, 0xd0, 0x99, 0x74, 0x84, 0x0b, 0xde, 0xd2, 0xa5, 0xca };
|
||||
static const unsigned char nonce[crypto_aead_chacha20poly1305_NPUBBYTES]
|
||||
= { 0xcd, 0x7c, 0xf6, 0x7b, 0xe3, 0x9c, 0x79, 0x4a };
|
||||
static const unsigned char ad[ADLEN]
|
||||
= { 0x87, 0xe2, 0x29, 0xd4, 0x50, 0x08, 0x45, 0xa0, 0x79, 0xc0 };
|
||||
unsigned char *c = (unsigned char *) sodium_malloc(CLEN);
|
||||
unsigned char *detached_c = (unsigned char *) sodium_malloc(MLEN);
|
||||
unsigned char *mac = (unsigned char *) sodium_malloc(crypto_aead_chacha20poly1305_ABYTES);
|
||||
unsigned char *m2 = (unsigned char *) sodium_malloc(MLEN);
|
||||
unsigned long long found_clen;
|
||||
unsigned long long found_maclen;
|
||||
unsigned long long m2len;
|
||||
size_t i;
|
||||
|
||||
crypto_aead_chacha20poly1305_encrypt(c, &found_clen, m, MLEN,
|
||||
ad, ADLEN,
|
||||
NULL, nonce, firstkey);
|
||||
if (found_clen != CLEN) {
|
||||
printf("found_clen is not properly set\n");
|
||||
}
|
||||
for (i = 0U; i < CLEN; ++i) {
|
||||
printf(",0x%02x", (unsigned int) c[i]);
|
||||
if (i % 8 == 7) {
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
crypto_aead_chacha20poly1305_encrypt_detached(detached_c,
|
||||
mac, &found_maclen,
|
||||
m, MLEN, ad, ADLEN,
|
||||
NULL, nonce, firstkey);
|
||||
if (found_maclen != crypto_aead_chacha20poly1305_abytes()) {
|
||||
printf("found_maclen is not properly set\n");
|
||||
}
|
||||
if (memcmp(detached_c, c, MLEN) != 0) {
|
||||
printf("detached ciphertext is bogus\n");
|
||||
}
|
||||
|
||||
if (crypto_aead_chacha20poly1305_decrypt(m2, &m2len, NULL, c, CLEN,
|
||||
ad, ADLEN,
|
||||
nonce, firstkey) != 0) {
|
||||
printf("crypto_aead_chacha20poly1305_decrypt() failed\n");
|
||||
}
|
||||
if (m2len != MLEN) {
|
||||
printf("m2len is not properly set\n");
|
||||
}
|
||||
if (memcmp(m, m2, MLEN) != 0) {
|
||||
printf("m != m2\n");
|
||||
}
|
||||
memset(m2, 0, m2len);
|
||||
assert(crypto_aead_chacha20poly1305_decrypt_detached(NULL, NULL,
|
||||
c, MLEN, mac,
|
||||
ad, ADLEN,
|
||||
nonce, firstkey) == 0);
|
||||
if (crypto_aead_chacha20poly1305_decrypt_detached(m2, NULL,
|
||||
c, MLEN, mac,
|
||||
ad, ADLEN,
|
||||
nonce, firstkey) != 0) {
|
||||
printf("crypto_aead_chacha20poly1305_decrypt_detached() failed\n");
|
||||
}
|
||||
if (memcmp(m, m2, MLEN) != 0) {
|
||||
printf("detached m != m2\n");
|
||||
}
|
||||
|
||||
for (i = 0U; i < CLEN; i++) {
|
||||
c[i] ^= (i + 1U);
|
||||
if (crypto_aead_chacha20poly1305_decrypt(m2, NULL, NULL, c, CLEN,
|
||||
ad, ADLEN, nonce, firstkey)
|
||||
== 0 || memcmp(m, m2, MLEN) == 0) {
|
||||
printf("message can be forged\n");
|
||||
}
|
||||
c[i] ^= (i + 1U);
|
||||
}
|
||||
|
||||
crypto_aead_chacha20poly1305_encrypt(c, &found_clen, m, MLEN,
|
||||
NULL, 0U, NULL, nonce, firstkey);
|
||||
if (found_clen != CLEN) {
|
||||
printf("found_clen is not properly set (adlen=0)\n");
|
||||
}
|
||||
for (i = 0U; i < CLEN; ++i) {
|
||||
printf(",0x%02x", (unsigned int) c[i]);
|
||||
if (i % 8 == 7) {
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
if (crypto_aead_chacha20poly1305_decrypt(m2, &m2len, NULL, c, CLEN,
|
||||
NULL, 0U, nonce, firstkey) != 0) {
|
||||
printf("crypto_aead_chacha20poly1305_decrypt() failed (adlen=0)\n");
|
||||
}
|
||||
if (m2len != MLEN) {
|
||||
printf("m2len is not properly set (adlen=0)\n");
|
||||
}
|
||||
if (memcmp(m, m2, MLEN) != 0) {
|
||||
printf("m != m2 (adlen=0)\n");
|
||||
}
|
||||
m2len = 1;
|
||||
if (crypto_aead_chacha20poly1305_decrypt(
|
||||
m2, &m2len, NULL, guard_page,
|
||||
randombytes_uniform(crypto_aead_chacha20poly1305_ABYTES),
|
||||
NULL, 0U, nonce, firstkey) != -1) {
|
||||
printf("crypto_aead_chacha20poly1305_decrypt() worked with a short "
|
||||
"ciphertext\n");
|
||||
}
|
||||
if (m2len != 0) {
|
||||
printf("Message length should have been set to zero after a failure\n");
|
||||
}
|
||||
m2len = 1;
|
||||
if (crypto_aead_chacha20poly1305_decrypt(m2, &m2len, NULL, c, 0U, NULL, 0U,
|
||||
nonce, firstkey) != -1) {
|
||||
printf("crypto_aead_chacha20poly1305_decrypt() worked with an empty "
|
||||
"ciphertext\n");
|
||||
}
|
||||
if (m2len != 0) {
|
||||
printf("Message length should have been set to zero after a failure\n");
|
||||
}
|
||||
|
||||
memcpy(c, m, MLEN);
|
||||
crypto_aead_chacha20poly1305_encrypt(c, &found_clen, c, MLEN,
|
||||
NULL, 0U, NULL, nonce, firstkey);
|
||||
if (found_clen != CLEN) {
|
||||
printf("found_clen is not properly set (adlen=0)\n");
|
||||
}
|
||||
for (i = 0U; i < CLEN; ++i) {
|
||||
printf(",0x%02x", (unsigned int) c[i]);
|
||||
if (i % 8 == 7) {
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
if (crypto_aead_chacha20poly1305_decrypt(c, &m2len, NULL, c, CLEN,
|
||||
NULL, 0U, nonce, firstkey) != 0) {
|
||||
printf("crypto_aead_chacha20poly1305_decrypt() failed (adlen=0)\n");
|
||||
}
|
||||
if (m2len != MLEN) {
|
||||
printf("m2len is not properly set (adlen=0)\n");
|
||||
}
|
||||
if (memcmp(m, c, MLEN) != 0) {
|
||||
printf("m != c (adlen=0)\n");
|
||||
}
|
||||
|
||||
sodium_free(c);
|
||||
sodium_free(detached_c);
|
||||
sodium_free(mac);
|
||||
sodium_free(m2);
|
||||
|
||||
assert(crypto_aead_chacha20poly1305_keybytes() > 0U);
|
||||
assert(crypto_aead_chacha20poly1305_npubbytes() > 0U);
|
||||
assert(crypto_aead_chacha20poly1305_nsecbytes() == 0U);
|
||||
assert(crypto_aead_chacha20poly1305_messagebytes_max() > 0U);
|
||||
assert(crypto_aead_chacha20poly1305_messagebytes_max() == crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX);
|
||||
assert(crypto_aead_chacha20poly1305_keybytes() == crypto_aead_chacha20poly1305_KEYBYTES);
|
||||
assert(crypto_aead_chacha20poly1305_nsecbytes() == crypto_aead_chacha20poly1305_NSECBYTES);
|
||||
assert(crypto_aead_chacha20poly1305_npubbytes() == crypto_aead_chacha20poly1305_NPUBBYTES);
|
||||
assert(crypto_aead_chacha20poly1305_abytes() == crypto_aead_chacha20poly1305_ABYTES);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
tv_ietf(void)
|
||||
{
|
||||
#undef MLEN
|
||||
#define MLEN 114U
|
||||
#undef ADLEN
|
||||
#define ADLEN 12U
|
||||
#undef CLEN
|
||||
#define CLEN (MLEN + crypto_aead_chacha20poly1305_ietf_ABYTES)
|
||||
static const unsigned char firstkey[crypto_aead_chacha20poly1305_ietf_KEYBYTES]
|
||||
= {
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
||||
0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
||||
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
|
||||
0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f
|
||||
};
|
||||
#undef MESSAGE
|
||||
#define MESSAGE "Ladies and Gentlemen of the class of '99: If I could offer you " \
|
||||
"only one tip for the future, sunscreen would be it."
|
||||
unsigned char *m = (unsigned char *) sodium_malloc(MLEN);
|
||||
static const unsigned char nonce[crypto_aead_chacha20poly1305_ietf_NPUBBYTES]
|
||||
= { 0x07, 0x00, 0x00, 0x00,
|
||||
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47 };
|
||||
static const unsigned char ad[ADLEN]
|
||||
= { 0x50, 0x51, 0x52, 0x53, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7 };
|
||||
unsigned char *c = (unsigned char *) sodium_malloc(CLEN);
|
||||
unsigned char *detached_c = (unsigned char *) sodium_malloc(MLEN);
|
||||
unsigned char *mac = (unsigned char *) sodium_malloc(crypto_aead_chacha20poly1305_ietf_ABYTES);
|
||||
unsigned char *m2 = (unsigned char *) sodium_malloc(MLEN);
|
||||
unsigned long long found_clen;
|
||||
unsigned long long found_maclen;
|
||||
unsigned long long m2len;
|
||||
size_t i;
|
||||
|
||||
assert(sizeof MESSAGE - 1U == MLEN);
|
||||
memcpy(m, MESSAGE, MLEN);
|
||||
crypto_aead_chacha20poly1305_ietf_encrypt(c, &found_clen, m, MLEN,
|
||||
ad, ADLEN,
|
||||
NULL, nonce, firstkey);
|
||||
if (found_clen != MLEN + crypto_aead_chacha20poly1305_ietf_abytes()) {
|
||||
printf("found_clen is not properly set\n");
|
||||
}
|
||||
for (i = 0U; i < CLEN; ++i) {
|
||||
printf(",0x%02x", (unsigned int) c[i]);
|
||||
if (i % 8 == 7) {
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
crypto_aead_chacha20poly1305_ietf_encrypt_detached(detached_c,
|
||||
mac, &found_maclen,
|
||||
m, MLEN,
|
||||
ad, ADLEN,
|
||||
NULL, nonce, firstkey);
|
||||
if (found_maclen != crypto_aead_chacha20poly1305_ietf_abytes()) {
|
||||
printf("found_maclen is not properly set\n");
|
||||
}
|
||||
if (memcmp(detached_c, c, MLEN) != 0) {
|
||||
printf("detached ciphertext is bogus\n");
|
||||
}
|
||||
|
||||
if (crypto_aead_chacha20poly1305_ietf_decrypt(m2, &m2len, NULL, c, CLEN, ad,
|
||||
ADLEN, nonce, firstkey) != 0) {
|
||||
printf("crypto_aead_chacha20poly1305_ietf_decrypt() failed\n");
|
||||
}
|
||||
if (m2len != MLEN) {
|
||||
printf("m2len is not properly set\n");
|
||||
}
|
||||
if (memcmp(m, m2, MLEN) != 0) {
|
||||
printf("m != m2\n");
|
||||
}
|
||||
memset(m2, 0, m2len);
|
||||
assert(crypto_aead_chacha20poly1305_ietf_decrypt_detached(NULL, NULL,
|
||||
c, MLEN, mac,
|
||||
ad, ADLEN,
|
||||
nonce, firstkey) == 0);
|
||||
if (crypto_aead_chacha20poly1305_ietf_decrypt_detached(m2, NULL,
|
||||
c, MLEN, mac,
|
||||
ad, ADLEN,
|
||||
nonce, firstkey) != 0) {
|
||||
printf("crypto_aead_chacha20poly1305_ietf_decrypt_detached() failed\n");
|
||||
}
|
||||
if (memcmp(m, m2, MLEN) != 0) {
|
||||
printf("detached m != m2\n");
|
||||
}
|
||||
|
||||
for (i = 0U; i < CLEN; i++) {
|
||||
c[i] ^= (i + 1U);
|
||||
if (crypto_aead_chacha20poly1305_ietf_decrypt(m2, NULL, NULL, c, CLEN,
|
||||
ad, ADLEN, nonce, firstkey)
|
||||
== 0 || memcmp(m, m2, MLEN) == 0) {
|
||||
printf("message can be forged\n");
|
||||
}
|
||||
c[i] ^= (i + 1U);
|
||||
}
|
||||
crypto_aead_chacha20poly1305_ietf_encrypt(c, &found_clen, m, MLEN,
|
||||
NULL, 0U, NULL, nonce, firstkey);
|
||||
if (found_clen != CLEN) {
|
||||
printf("clen is not properly set (adlen=0)\n");
|
||||
}
|
||||
for (i = 0U; i < CLEN; ++i) {
|
||||
printf(",0x%02x", (unsigned int) c[i]);
|
||||
if (i % 8 == 7) {
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
if (crypto_aead_chacha20poly1305_ietf_decrypt(m2, &m2len, NULL, c, CLEN,
|
||||
NULL, 0U, nonce, firstkey) != 0) {
|
||||
printf("crypto_aead_chacha20poly1305_ietf_decrypt() failed (adlen=0)\n");
|
||||
}
|
||||
if (m2len != MLEN) {
|
||||
printf("m2len is not properly set (adlen=0)\n");
|
||||
}
|
||||
if (memcmp(m, m2, MLEN) != 0) {
|
||||
printf("m != m2 (adlen=0)\n");
|
||||
}
|
||||
m2len = 1;
|
||||
if (crypto_aead_chacha20poly1305_ietf_decrypt(
|
||||
m2, &m2len, NULL, guard_page,
|
||||
randombytes_uniform(crypto_aead_chacha20poly1305_ietf_ABYTES),
|
||||
NULL, 0U, nonce, firstkey) != -1) {
|
||||
printf("crypto_aead_chacha20poly1305_ietf_decrypt() worked with a short "
|
||||
"ciphertext\n");
|
||||
}
|
||||
if (m2len != 0) {
|
||||
printf("Message length should have been set to zero after a failure\n");
|
||||
}
|
||||
m2len = 1;
|
||||
if (crypto_aead_chacha20poly1305_ietf_decrypt(m2, &m2len, NULL, c, 0U, NULL, 0U,
|
||||
nonce, firstkey) != -1) {
|
||||
printf("crypto_aead_chacha20poly1305_ietf_decrypt() worked with an empty "
|
||||
"ciphertext\n");
|
||||
}
|
||||
if (m2len != 0) {
|
||||
printf("Message length should have been set to zero after a failure\n");
|
||||
}
|
||||
|
||||
memcpy(c, m, MLEN);
|
||||
crypto_aead_chacha20poly1305_ietf_encrypt(c, &found_clen, c, MLEN,
|
||||
NULL, 0U, NULL, nonce, firstkey);
|
||||
if (found_clen != CLEN) {
|
||||
printf("clen is not properly set (adlen=0)\n");
|
||||
}
|
||||
for (i = 0U; i < CLEN; ++i) {
|
||||
printf(",0x%02x", (unsigned int) c[i]);
|
||||
if (i % 8 == 7) {
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
if (crypto_aead_chacha20poly1305_ietf_decrypt(c, &m2len, NULL, c, CLEN,
|
||||
NULL, 0U, nonce, firstkey) != 0) {
|
||||
printf("crypto_aead_chacha20poly1305_ietf_decrypt() failed (adlen=0)\n");
|
||||
}
|
||||
if (m2len != MLEN) {
|
||||
printf("m2len is not properly set (adlen=0)\n");
|
||||
}
|
||||
if (memcmp(m, c, MLEN) != 0) {
|
||||
printf("m != c (adlen=0)\n");
|
||||
}
|
||||
|
||||
sodium_free(c);
|
||||
sodium_free(detached_c);
|
||||
sodium_free(mac);
|
||||
sodium_free(m2);
|
||||
sodium_free(m);
|
||||
|
||||
assert(crypto_aead_chacha20poly1305_ietf_keybytes() > 0U);
|
||||
assert(crypto_aead_chacha20poly1305_ietf_keybytes() == crypto_aead_chacha20poly1305_keybytes());
|
||||
assert(crypto_aead_chacha20poly1305_ietf_npubbytes() > 0U);
|
||||
assert(crypto_aead_chacha20poly1305_ietf_npubbytes() > crypto_aead_chacha20poly1305_npubbytes());
|
||||
assert(crypto_aead_chacha20poly1305_ietf_nsecbytes() == 0U);
|
||||
assert(crypto_aead_chacha20poly1305_ietf_nsecbytes() == crypto_aead_chacha20poly1305_nsecbytes());
|
||||
assert(crypto_aead_chacha20poly1305_ietf_messagebytes_max() == crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX);
|
||||
assert(crypto_aead_chacha20poly1305_IETF_KEYBYTES == crypto_aead_chacha20poly1305_ietf_KEYBYTES);
|
||||
assert(crypto_aead_chacha20poly1305_IETF_NSECBYTES == crypto_aead_chacha20poly1305_ietf_NSECBYTES);
|
||||
assert(crypto_aead_chacha20poly1305_IETF_NPUBBYTES == crypto_aead_chacha20poly1305_ietf_NPUBBYTES);
|
||||
assert(crypto_aead_chacha20poly1305_IETF_ABYTES == crypto_aead_chacha20poly1305_ietf_ABYTES);
|
||||
assert(crypto_aead_chacha20poly1305_IETF_MESSAGEBYTES_MAX == crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
tv();
|
||||
tv_ietf();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
,0xe3,0xe4,0x46,0xf7,0xed,0xe9,0xa1,0x9b
|
||||
,0x62,0xa4,0x67,0x7d,0xab,0xf4,0xe3,0xd2
|
||||
,0x4b,0x87,0x6b,0xb2,0x84,0x75,0x38,0x96
|
||||
,0xe1,0xd6
|
||||
,0xe3,0xe4,0x46,0xf7,0xed,0xe9,0xa1,0x9b
|
||||
,0x62,0xa4,0x69,0xe7,0x78,0x9b,0xcd,0x95
|
||||
,0x4e,0x65,0x8e,0xd3,0x84,0x23,0xe2,0x31
|
||||
,0x61,0xdc
|
||||
,0xe3,0xe4,0x46,0xf7,0xed,0xe9,0xa1,0x9b
|
||||
,0x62,0xa4,0x69,0xe7,0x78,0x9b,0xcd,0x95
|
||||
,0x4e,0x65,0x8e,0xd3,0x84,0x23,0xe2,0x31
|
||||
,0x61,0xdc
|
||||
,0xd3,0x1a,0x8d,0x34,0x64,0x8e,0x60,0xdb
|
||||
,0x7b,0x86,0xaf,0xbc,0x53,0xef,0x7e,0xc2
|
||||
,0xa4,0xad,0xed,0x51,0x29,0x6e,0x08,0xfe
|
||||
,0xa9,0xe2,0xb5,0xa7,0x36,0xee,0x62,0xd6
|
||||
,0x3d,0xbe,0xa4,0x5e,0x8c,0xa9,0x67,0x12
|
||||
,0x82,0xfa,0xfb,0x69,0xda,0x92,0x72,0x8b
|
||||
,0x1a,0x71,0xde,0x0a,0x9e,0x06,0x0b,0x29
|
||||
,0x05,0xd6,0xa5,0xb6,0x7e,0xcd,0x3b,0x36
|
||||
,0x92,0xdd,0xbd,0x7f,0x2d,0x77,0x8b,0x8c
|
||||
,0x98,0x03,0xae,0xe3,0x28,0x09,0x1b,0x58
|
||||
,0xfa,0xb3,0x24,0xe4,0xfa,0xd6,0x75,0x94
|
||||
,0x55,0x85,0x80,0x8b,0x48,0x31,0xd7,0xbc
|
||||
,0x3f,0xf4,0xde,0xf0,0x8e,0x4b,0x7a,0x9d
|
||||
,0xe5,0x76,0xd2,0x65,0x86,0xce,0xc6,0x4b
|
||||
,0x61,0x16,0x1a,0xe1,0x0b,0x59,0x4f,0x09
|
||||
,0xe2,0x6a,0x7e,0x90,0x2e,0xcb,0xd0,0x60
|
||||
,0x06,0x91
|
||||
,0xd3,0x1a,0x8d,0x34,0x64,0x8e,0x60,0xdb
|
||||
,0x7b,0x86,0xaf,0xbc,0x53,0xef,0x7e,0xc2
|
||||
,0xa4,0xad,0xed,0x51,0x29,0x6e,0x08,0xfe
|
||||
,0xa9,0xe2,0xb5,0xa7,0x36,0xee,0x62,0xd6
|
||||
,0x3d,0xbe,0xa4,0x5e,0x8c,0xa9,0x67,0x12
|
||||
,0x82,0xfa,0xfb,0x69,0xda,0x92,0x72,0x8b
|
||||
,0x1a,0x71,0xde,0x0a,0x9e,0x06,0x0b,0x29
|
||||
,0x05,0xd6,0xa5,0xb6,0x7e,0xcd,0x3b,0x36
|
||||
,0x92,0xdd,0xbd,0x7f,0x2d,0x77,0x8b,0x8c
|
||||
,0x98,0x03,0xae,0xe3,0x28,0x09,0x1b,0x58
|
||||
,0xfa,0xb3,0x24,0xe4,0xfa,0xd6,0x75,0x94
|
||||
,0x55,0x85,0x80,0x8b,0x48,0x31,0xd7,0xbc
|
||||
,0x3f,0xf4,0xde,0xf0,0x8e,0x4b,0x7a,0x9d
|
||||
,0xe5,0x76,0xd2,0x65,0x86,0xce,0xc6,0x4b
|
||||
,0x61,0x16,0x6a,0x23,0xa4,0x68,0x1f,0xd5
|
||||
,0x94,0x56,0xae,0xa1,0xd2,0x9f,0x82,0x47
|
||||
,0x72,0x16
|
||||
,0xd3,0x1a,0x8d,0x34,0x64,0x8e,0x60,0xdb
|
||||
,0x7b,0x86,0xaf,0xbc,0x53,0xef,0x7e,0xc2
|
||||
,0xa4,0xad,0xed,0x51,0x29,0x6e,0x08,0xfe
|
||||
,0xa9,0xe2,0xb5,0xa7,0x36,0xee,0x62,0xd6
|
||||
,0x3d,0xbe,0xa4,0x5e,0x8c,0xa9,0x67,0x12
|
||||
,0x82,0xfa,0xfb,0x69,0xda,0x92,0x72,0x8b
|
||||
,0x1a,0x71,0xde,0x0a,0x9e,0x06,0x0b,0x29
|
||||
,0x05,0xd6,0xa5,0xb6,0x7e,0xcd,0x3b,0x36
|
||||
,0x92,0xdd,0xbd,0x7f,0x2d,0x77,0x8b,0x8c
|
||||
,0x98,0x03,0xae,0xe3,0x28,0x09,0x1b,0x58
|
||||
,0xfa,0xb3,0x24,0xe4,0xfa,0xd6,0x75,0x94
|
||||
,0x55,0x85,0x80,0x8b,0x48,0x31,0xd7,0xbc
|
||||
,0x3f,0xf4,0xde,0xf0,0x8e,0x4b,0x7a,0x9d
|
||||
,0xe5,0x76,0xd2,0x65,0x86,0xce,0xc6,0x4b
|
||||
,0x61,0x16,0x6a,0x23,0xa4,0x68,0x1f,0xd5
|
||||
,0x94,0x56,0xae,0xa1,0xd2,0x9f,0x82,0x47
|
||||
,0x72,0x16
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
OK
|
||||
@@ -0,0 +1,203 @@
|
||||
|
||||
#define TEST_NAME "aead_xchacha20poly1305"
|
||||
#include "cmptest.h"
|
||||
|
||||
static int
|
||||
tv(void)
|
||||
{
|
||||
#undef MLEN
|
||||
#define MLEN 114U
|
||||
#undef ADLEN
|
||||
#define ADLEN 12U
|
||||
#undef CLEN
|
||||
#define CLEN (MLEN + crypto_aead_xchacha20poly1305_ietf_ABYTES)
|
||||
static const unsigned char firstkey[crypto_aead_xchacha20poly1305_ietf_KEYBYTES]
|
||||
= {
|
||||
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
|
||||
0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f,
|
||||
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
|
||||
0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f
|
||||
};
|
||||
#undef MESSAGE
|
||||
#define MESSAGE "Ladies and Gentlemen of the class of '99: If I could offer you " \
|
||||
"only one tip for the future, sunscreen would be it."
|
||||
unsigned char *m = (unsigned char *) sodium_malloc(MLEN);
|
||||
static const unsigned char nonce[crypto_aead_xchacha20poly1305_ietf_NPUBBYTES]
|
||||
= { 0x07, 0x00, 0x00, 0x00, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
|
||||
0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53 };
|
||||
static const unsigned char ad[ADLEN]
|
||||
= { 0x50, 0x51, 0x52, 0x53, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7 };
|
||||
unsigned char *c = (unsigned char *) sodium_malloc(CLEN);
|
||||
unsigned char *detached_c = (unsigned char *) sodium_malloc(MLEN);
|
||||
unsigned char *key2 = (unsigned char *) sodium_malloc(crypto_aead_xchacha20poly1305_ietf_KEYBYTES);
|
||||
unsigned char *mac = (unsigned char *) sodium_malloc(crypto_aead_xchacha20poly1305_ietf_ABYTES);
|
||||
unsigned char *m2 = (unsigned char *) sodium_malloc(MLEN);
|
||||
unsigned long long found_clen;
|
||||
unsigned long long found_maclen;
|
||||
unsigned long long m2len;
|
||||
size_t i;
|
||||
|
||||
assert(sizeof MESSAGE - 1U == MLEN);
|
||||
memcpy(m, MESSAGE, MLEN);
|
||||
crypto_aead_xchacha20poly1305_ietf_encrypt(c, &found_clen, m, MLEN,
|
||||
ad, ADLEN,
|
||||
NULL, nonce, firstkey);
|
||||
if (found_clen != MLEN + crypto_aead_xchacha20poly1305_ietf_abytes()) {
|
||||
printf("found_clen is not properly set\n");
|
||||
}
|
||||
for (i = 0U; i < CLEN; ++i) {
|
||||
printf(",0x%02x", (unsigned int) c[i]);
|
||||
if (i % 8 == 7) {
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
crypto_aead_xchacha20poly1305_ietf_encrypt_detached(detached_c,
|
||||
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");
|
||||
}
|
||||
if (memcmp(detached_c, c, MLEN) != 0) {
|
||||
printf("detached ciphertext is bogus\n");
|
||||
}
|
||||
|
||||
if (crypto_aead_xchacha20poly1305_ietf_decrypt(NULL, 0, NULL, c, CLEN, ad,
|
||||
ADLEN, nonce, firstkey) != 0) {
|
||||
printf("crypto_aead_xchacha20poly1305_ietf_decrypt() tag-only verification failed\n");
|
||||
}
|
||||
if (crypto_aead_xchacha20poly1305_ietf_decrypt(m2, &m2len, NULL, c, CLEN, ad,
|
||||
ADLEN, nonce, firstkey) != 0) {
|
||||
printf("crypto_aead_xchacha20poly1305_ietf_decrypt() failed\n");
|
||||
}
|
||||
if (m2len != MLEN) {
|
||||
printf("m2len is not properly set\n");
|
||||
}
|
||||
if (memcmp(m, m2, MLEN) != 0) {
|
||||
printf("m != m2\n");
|
||||
}
|
||||
memset(m2, 0, m2len);
|
||||
if (crypto_aead_xchacha20poly1305_ietf_decrypt_detached(m2, NULL,
|
||||
c, MLEN, mac,
|
||||
ad, ADLEN,
|
||||
nonce, firstkey) != 0) {
|
||||
printf("crypto_aead_xchacha20poly1305_ietf_decrypt_detached() failed\n");
|
||||
}
|
||||
if (memcmp(m, m2, MLEN) != 0) {
|
||||
printf("detached m != m2\n");
|
||||
}
|
||||
|
||||
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)
|
||||
== 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);
|
||||
if (found_clen != CLEN) {
|
||||
printf("clen is not properly set (adlen=0)\n");
|
||||
}
|
||||
for (i = 0U; i < CLEN; ++i) {
|
||||
printf(",0x%02x", (unsigned int) c[i]);
|
||||
if (i % 8 == 7) {
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
if (crypto_aead_xchacha20poly1305_ietf_decrypt(m2, &m2len, NULL, c, CLEN,
|
||||
NULL, 0U, nonce, firstkey) != 0) {
|
||||
printf("crypto_aead_xchacha20poly1305_ietf_decrypt() failed (adlen=0)\n");
|
||||
}
|
||||
if (m2len != MLEN) {
|
||||
printf("m2len is not properly set (adlen=0)\n");
|
||||
}
|
||||
if (memcmp(m, m2, MLEN) != 0) {
|
||||
printf("m != m2 (adlen=0)\n");
|
||||
}
|
||||
m2len = 1;
|
||||
if (crypto_aead_xchacha20poly1305_ietf_decrypt(
|
||||
m2, &m2len, NULL, guard_page,
|
||||
randombytes_uniform(crypto_aead_xchacha20poly1305_ietf_ABYTES),
|
||||
NULL, 0U, nonce, firstkey) != -1) {
|
||||
printf("crypto_aead_xchacha20poly1305_ietf_decrypt() worked with a short "
|
||||
"ciphertext\n");
|
||||
}
|
||||
if (m2len != 0) {
|
||||
printf("Message length should have been set to zero after a failure\n");
|
||||
}
|
||||
m2len = 1;
|
||||
if (crypto_aead_xchacha20poly1305_ietf_decrypt(m2, &m2len, NULL, c, 0U, NULL, 0U,
|
||||
nonce, firstkey) != -1) {
|
||||
printf("crypto_aead_xchacha20poly1305_ietf_decrypt() worked with an empty "
|
||||
"ciphertext\n");
|
||||
}
|
||||
if (m2len != 0) {
|
||||
printf("Message length should have been set to zero after a failure\n");
|
||||
}
|
||||
|
||||
memcpy(c, m, MLEN);
|
||||
crypto_aead_xchacha20poly1305_ietf_encrypt(c, &found_clen, c, MLEN,
|
||||
NULL, 0U, NULL, nonce, firstkey);
|
||||
if (found_clen != CLEN) {
|
||||
printf("clen is not properly set (adlen=0)\n");
|
||||
}
|
||||
for (i = 0U; i < CLEN; ++i) {
|
||||
printf(",0x%02x", (unsigned int) c[i]);
|
||||
if (i % 8 == 7) {
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
if (crypto_aead_xchacha20poly1305_ietf_decrypt(c, &m2len, NULL, c, CLEN,
|
||||
NULL, 0U, nonce, firstkey) != 0) {
|
||||
printf("crypto_aead_xchacha20poly1305_ietf_decrypt() failed (adlen=0)\n");
|
||||
}
|
||||
if (m2len != MLEN) {
|
||||
printf("m2len is not properly set (adlen=0)\n");
|
||||
}
|
||||
if (memcmp(m, c, MLEN) != 0) {
|
||||
printf("m != c (adlen=0)\n");
|
||||
}
|
||||
|
||||
crypto_aead_xchacha20poly1305_ietf_keygen(key2);
|
||||
if (crypto_aead_xchacha20poly1305_ietf_decrypt(c, &m2len, NULL, c, CLEN,
|
||||
NULL, 0U, nonce, key2) == 0) {
|
||||
printf("crypto_aead_xchacha20poly1305_ietf_decrypt() with a wrong key should have failed\n");
|
||||
}
|
||||
|
||||
sodium_free(c);
|
||||
sodium_free(detached_c);
|
||||
sodium_free(key2);
|
||||
sodium_free(mac);
|
||||
sodium_free(m2);
|
||||
sodium_free(m);
|
||||
|
||||
assert(crypto_aead_xchacha20poly1305_ietf_abytes() == crypto_aead_xchacha20poly1305_ietf_ABYTES);
|
||||
assert(crypto_aead_xchacha20poly1305_ietf_keybytes() == crypto_aead_xchacha20poly1305_ietf_KEYBYTES);
|
||||
assert(crypto_aead_xchacha20poly1305_ietf_npubbytes() == crypto_aead_xchacha20poly1305_ietf_NPUBBYTES);
|
||||
assert(crypto_aead_xchacha20poly1305_ietf_nsecbytes() == 0U);
|
||||
assert(crypto_aead_xchacha20poly1305_ietf_nsecbytes() == crypto_aead_xchacha20poly1305_ietf_NSECBYTES);
|
||||
assert(crypto_aead_xchacha20poly1305_ietf_messagebytes_max() == crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX);
|
||||
assert(crypto_aead_xchacha20poly1305_IETF_KEYBYTES == crypto_aead_xchacha20poly1305_ietf_KEYBYTES);
|
||||
assert(crypto_aead_xchacha20poly1305_IETF_NSECBYTES == crypto_aead_xchacha20poly1305_ietf_NSECBYTES);
|
||||
assert(crypto_aead_xchacha20poly1305_IETF_NPUBBYTES == crypto_aead_xchacha20poly1305_ietf_NPUBBYTES);
|
||||
assert(crypto_aead_xchacha20poly1305_IETF_ABYTES == crypto_aead_xchacha20poly1305_ietf_ABYTES);
|
||||
assert(crypto_aead_xchacha20poly1305_IETF_MESSAGEBYTES_MAX == crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
tv();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
,0xf8,0xeb,0xea,0x48,0x75,0x04,0x40,0x66
|
||||
,0xfc,0x16,0x2a,0x06,0x04,0xe1,0x71,0xfe
|
||||
,0xec,0xfb,0x3d,0x20,0x42,0x52,0x48,0x56
|
||||
,0x3b,0xcf,0xd5,0xa1,0x55,0xdc,0xc4,0x7b
|
||||
,0xbd,0xa7,0x0b,0x86,0xe5,0xab,0x9b,0x55
|
||||
,0x00,0x2b,0xd1,0x27,0x4c,0x02,0xdb,0x35
|
||||
,0x32,0x1a,0xcd,0x7a,0xf8,0xb2,0xe2,0xd2
|
||||
,0x50,0x15,0xe1,0x36,0xb7,0x67,0x94,0x58
|
||||
,0xe9,0xf4,0x32,0x43,0xbf,0x71,0x9d,0x63
|
||||
,0x9b,0xad,0xb5,0xfe,0xac,0x03,0xf8,0x0a
|
||||
,0x19,0xa9,0x6e,0xf1,0x0c,0xb1,0xd1,0x53
|
||||
,0x33,0xa8,0x37,0xb9,0x09,0x46,0xba,0x38
|
||||
,0x54,0xee,0x74,0xda,0x3f,0x25,0x85,0xef
|
||||
,0xc7,0xe1,0xe1,0x70,0xe1,0x7e,0x15,0xe5
|
||||
,0x63,0xe7,0x76,0x01,0xf4,0xf8,0x5c,0xaf
|
||||
,0xa8,0xe5,0x87,0x76,0x14,0xe1,0x43,0xe6
|
||||
,0x84,0x20
|
||||
,0xf8,0xeb,0xea,0x48,0x75,0x04,0x40,0x66
|
||||
,0xfc,0x16,0x2a,0x06,0x04,0xe1,0x71,0xfe
|
||||
,0xec,0xfb,0x3d,0x20,0x42,0x52,0x48,0x56
|
||||
,0x3b,0xcf,0xd5,0xa1,0x55,0xdc,0xc4,0x7b
|
||||
,0xbd,0xa7,0x0b,0x86,0xe5,0xab,0x9b,0x55
|
||||
,0x00,0x2b,0xd1,0x27,0x4c,0x02,0xdb,0x35
|
||||
,0x32,0x1a,0xcd,0x7a,0xf8,0xb2,0xe2,0xd2
|
||||
,0x50,0x15,0xe1,0x36,0xb7,0x67,0x94,0x58
|
||||
,0xe9,0xf4,0x32,0x43,0xbf,0x71,0x9d,0x63
|
||||
,0x9b,0xad,0xb5,0xfe,0xac,0x03,0xf8,0x0a
|
||||
,0x19,0xa9,0x6e,0xf1,0x0c,0xb1,0xd1,0x53
|
||||
,0x33,0xa8,0x37,0xb9,0x09,0x46,0xba,0x38
|
||||
,0x54,0xee,0x74,0xda,0x3f,0x25,0x85,0xef
|
||||
,0xc7,0xe1,0xe1,0x70,0xe1,0x7e,0x15,0xe5
|
||||
,0x63,0xe7,0xe0,0x96,0xe0,0x33,0xd9,0x1b
|
||||
,0x63,0xf7,0xac,0x92,0xe9,0x97,0x2e,0x0d
|
||||
,0x43,0xe5
|
||||
,0xf8,0xeb,0xea,0x48,0x75,0x04,0x40,0x66
|
||||
,0xfc,0x16,0x2a,0x06,0x04,0xe1,0x71,0xfe
|
||||
,0xec,0xfb,0x3d,0x20,0x42,0x52,0x48,0x56
|
||||
,0x3b,0xcf,0xd5,0xa1,0x55,0xdc,0xc4,0x7b
|
||||
,0xbd,0xa7,0x0b,0x86,0xe5,0xab,0x9b,0x55
|
||||
,0x00,0x2b,0xd1,0x27,0x4c,0x02,0xdb,0x35
|
||||
,0x32,0x1a,0xcd,0x7a,0xf8,0xb2,0xe2,0xd2
|
||||
,0x50,0x15,0xe1,0x36,0xb7,0x67,0x94,0x58
|
||||
,0xe9,0xf4,0x32,0x43,0xbf,0x71,0x9d,0x63
|
||||
,0x9b,0xad,0xb5,0xfe,0xac,0x03,0xf8,0x0a
|
||||
,0x19,0xa9,0x6e,0xf1,0x0c,0xb1,0xd1,0x53
|
||||
,0x33,0xa8,0x37,0xb9,0x09,0x46,0xba,0x38
|
||||
,0x54,0xee,0x74,0xda,0x3f,0x25,0x85,0xef
|
||||
,0xc7,0xe1,0xe1,0x70,0xe1,0x7e,0x15,0xe5
|
||||
,0x63,0xe7,0xe0,0x96,0xe0,0x33,0xd9,0x1b
|
||||
,0x63,0xf7,0xac,0x92,0xe9,0x97,0x2e,0x0d
|
||||
,0x43,0xe5
|
||||
141
components/espressif__libsodium/libsodium/test/default/auth.c
Normal file
141
components/espressif__libsodium/libsodium/test/default/auth.c
Normal file
@@ -0,0 +1,141 @@
|
||||
|
||||
#define TEST_NAME "auth"
|
||||
#include "cmptest.h"
|
||||
|
||||
/* "Test Case 2" from RFC 4231 */
|
||||
static unsigned char key[32] = "Jefe";
|
||||
static unsigned char c[] = "what do ya want for nothing?";
|
||||
|
||||
/* Hacker manifesto */
|
||||
static unsigned char key2[] =
|
||||
"Another one got caught today, it's all over the papers. \"Teenager "
|
||||
"Arrested in Computer Crime Scandal\", \"Hacker Arrested after Bank "
|
||||
"Tampering\"... Damn kids. They're all alike.";
|
||||
|
||||
static unsigned char a[crypto_auth_BYTES];
|
||||
static unsigned char a2[crypto_auth_hmacsha512_BYTES];
|
||||
static unsigned char a3[crypto_auth_hmacsha512_BYTES];
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
crypto_auth_hmacsha512_state st;
|
||||
crypto_auth_hmacsha256_state st256;
|
||||
crypto_auth_hmacsha512256_state st512_256;
|
||||
size_t i;
|
||||
|
||||
assert(crypto_auth_hmacsha512_statebytes() ==
|
||||
sizeof(crypto_auth_hmacsha512_state));
|
||||
crypto_auth(a, c, sizeof c - 1U, key);
|
||||
for (i = 0; i < sizeof a; ++i) {
|
||||
printf(",0x%02x", (unsigned int) a[i]);
|
||||
if (i % 8 == 7)
|
||||
printf("\n");
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
crypto_auth_hmacsha512_init(&st, key, sizeof key);
|
||||
crypto_auth_hmacsha512_update(&st, c, 1U);
|
||||
crypto_auth_hmacsha512_update(&st, c, sizeof c - 2U);
|
||||
crypto_auth_hmacsha512_final(&st, a2);
|
||||
for (i = 0; i < sizeof a2; ++i) {
|
||||
printf(",0x%02x", (unsigned int) a2[i]);
|
||||
if (i % 8 == 7)
|
||||
printf("\n");
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
crypto_auth_hmacsha512_init(&st, key2, sizeof key2);
|
||||
crypto_auth_hmacsha512_update(&st, c, 1U);
|
||||
crypto_auth_hmacsha512_update(&st, c, sizeof c - 2U);
|
||||
crypto_auth_hmacsha512_final(&st, a2);
|
||||
for (i = 0; i < sizeof a2; ++i) {
|
||||
printf(",0x%02x", (unsigned int) a2[i]);
|
||||
if (i % 8 == 7)
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
memset(a2, 0, sizeof a2);
|
||||
crypto_auth_hmacsha256_init(&st256, key2, sizeof key2);
|
||||
crypto_auth_hmacsha256_update(&st256, guard_page, 0U);
|
||||
crypto_auth_hmacsha256_update(&st256, c, 1U);
|
||||
crypto_auth_hmacsha256_update(&st256, c, sizeof c - 2U);
|
||||
crypto_auth_hmacsha256_final(&st256, a2);
|
||||
for (i = 0; i < sizeof a2; ++i) {
|
||||
printf(",0x%02x", (unsigned int) a2[i]);
|
||||
if (i % 8 == 7)
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
/* Empty message tests: HMAC-SHA512 */
|
||||
memset(a2, 0, sizeof a2);
|
||||
crypto_auth_hmacsha512_init(&st, key, sizeof key);
|
||||
crypto_auth_hmacsha512_final(&st, a2);
|
||||
|
||||
memset(a3, 0, sizeof a3);
|
||||
crypto_auth_hmacsha512_init(&st, key, sizeof key);
|
||||
crypto_auth_hmacsha512_update(&st, a2, 0U);
|
||||
crypto_auth_hmacsha512_final(&st, a3);
|
||||
assert(sodium_memcmp(a2, a3, sizeof a2) == 0);
|
||||
|
||||
memset(a3, 0, sizeof a3);
|
||||
crypto_auth_hmacsha512_init(&st, key, sizeof key);
|
||||
crypto_auth_hmacsha512_update(&st, guard_page, 0U);
|
||||
crypto_auth_hmacsha512_final(&st, a3);
|
||||
assert(sodium_memcmp(a2, a3, sizeof a2) == 0);
|
||||
|
||||
/* Empty message tests: HMAC-SHA512-256 */
|
||||
memset(a2, 0, sizeof a2);
|
||||
crypto_auth_hmacsha512256_init(&st512_256, key, sizeof key);
|
||||
crypto_auth_hmacsha512256_final(&st512_256, a2);
|
||||
|
||||
memset(a3, 0, sizeof a3);
|
||||
crypto_auth_hmacsha512256_init(&st512_256, key, sizeof key);
|
||||
crypto_auth_hmacsha512256_update(&st512_256, a2, 0U);
|
||||
crypto_auth_hmacsha512256_final(&st512_256, a3);
|
||||
assert(sodium_memcmp(a2, a3, sizeof a2) == 0);
|
||||
|
||||
memset(a3, 0, sizeof a3);
|
||||
crypto_auth_hmacsha512256_init(&st512_256, key, sizeof key);
|
||||
crypto_auth_hmacsha512256_update(&st512_256, guard_page, 0U);
|
||||
crypto_auth_hmacsha512256_final(&st512_256, a3);
|
||||
assert(sodium_memcmp(a2, a3, sizeof a2) == 0);
|
||||
|
||||
/* Empty message tests: HMAC-SHA256 */
|
||||
|
||||
memset(a2, 0, sizeof a2);
|
||||
crypto_auth_hmacsha256_init(&st256, key, sizeof key);
|
||||
crypto_auth_hmacsha256_final(&st256, a2);
|
||||
|
||||
memset(a3, 0, sizeof a3);
|
||||
crypto_auth_hmacsha256_init(&st256, key, sizeof key);
|
||||
crypto_auth_hmacsha256_update(&st256, a2, 0U);
|
||||
crypto_auth_hmacsha256_final(&st256, a3);
|
||||
assert(sodium_memcmp(a2, a3, sizeof a2) == 0);
|
||||
|
||||
memset(a3, 0, sizeof a3);
|
||||
crypto_auth_hmacsha256_init(&st256, key, sizeof key);
|
||||
crypto_auth_hmacsha256_update(&st256, guard_page, 0U);
|
||||
crypto_auth_hmacsha256_final(&st256, a3);
|
||||
assert(sodium_memcmp(a2, a3, sizeof a2) == 0);
|
||||
|
||||
/* --- */
|
||||
|
||||
assert(crypto_auth_bytes() > 0U);
|
||||
assert(crypto_auth_keybytes() > 0U);
|
||||
assert(strcmp(crypto_auth_primitive(), "hmacsha512256") == 0);
|
||||
assert(crypto_auth_hmacsha256_bytes() > 0U);
|
||||
assert(crypto_auth_hmacsha256_keybytes() > 0U);
|
||||
assert(crypto_auth_hmacsha512_bytes() > 0U);
|
||||
assert(crypto_auth_hmacsha512_keybytes() > 0U);
|
||||
assert(crypto_auth_hmacsha512256_bytes() == crypto_auth_bytes());
|
||||
assert(crypto_auth_hmacsha512256_keybytes() == crypto_auth_keybytes());
|
||||
assert(crypto_auth_hmacsha512256_statebytes() >=
|
||||
crypto_auth_hmacsha512256_keybytes());
|
||||
assert(crypto_auth_hmacsha256_statebytes() ==
|
||||
sizeof(crypto_auth_hmacsha256_state));
|
||||
assert(crypto_auth_hmacsha512_statebytes() ==
|
||||
sizeof(crypto_auth_hmacsha512_state));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
,0x16,0x4b,0x7a,0x7b,0xfc,0xf8,0x19,0xe2
|
||||
,0xe3,0x95,0xfb,0xe7,0x3b,0x56,0xe0,0xa3
|
||||
,0x87,0xbd,0x64,0x22,0x2e,0x83,0x1f,0xd6
|
||||
,0x10,0x27,0x0c,0xd7,0xea,0x25,0x05,0x54
|
||||
|
||||
,0x7b,0x9d,0x83,0x38,0xeb,0x1e,0x3d,0xdd
|
||||
,0xba,0x8a,0x9a,0x35,0x08,0xd0,0x34,0xa1
|
||||
,0xec,0xbe,0x75,0x11,0x37,0xfa,0x1b,0xcb
|
||||
,0xa0,0xf9,0x2a,0x3e,0x6d,0xfc,0x79,0x80
|
||||
,0xb8,0x81,0xa8,0x64,0x5f,0x92,0x67,0x22
|
||||
,0x74,0x37,0x96,0x4b,0xf3,0x07,0x0b,0xe2
|
||||
,0xb3,0x36,0xb3,0xa3,0x20,0xf8,0x25,0xce
|
||||
,0xc9,0x87,0x2d,0xb2,0x50,0x4b,0xf3,0x6d
|
||||
|
||||
,0x73,0xe0,0x0d,0xcb,0xf4,0xf8,0xa3,0x33
|
||||
,0x30,0xac,0x52,0xed,0x2c,0xc9,0xd1,0xb2
|
||||
,0xef,0xb1,0x77,0x13,0xd3,0xec,0xe3,0x96
|
||||
,0x14,0x9f,0x37,0x65,0x3c,0xfe,0x70,0xe7
|
||||
,0x1f,0x2c,0x6f,0x9a,0x62,0xc3,0xc5,0x3a
|
||||
,0x31,0x8a,0x9a,0x0b,0x3b,0x78,0x60,0xa4
|
||||
,0x31,0x6f,0x72,0x9b,0x8d,0x30,0x0f,0x15
|
||||
,0x9b,0x2f,0x60,0x93,0xa8,0x60,0xc1,0xed
|
||||
,0x62,0x27,0xe4,0xce,0x7c,0x7f,0xe7,0xa4
|
||||
,0xba,0x9e,0x2a,0xc3,0x42,0xc3,0x5d,0x24
|
||||
,0x03,0x3e,0x38,0x8c,0x9b,0xdc,0x29,0x9b
|
||||
,0x4a,0x50,0x50,0xf6,0x71,0x70,0xf4,0x83
|
||||
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||
@@ -0,0 +1,34 @@
|
||||
/* "Test Case AUTH256-4" from RFC 4868 */
|
||||
|
||||
#define TEST_NAME "auth2"
|
||||
#include "cmptest.h"
|
||||
|
||||
static unsigned char key[32] = {
|
||||
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
|
||||
0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
|
||||
0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20
|
||||
};
|
||||
|
||||
static unsigned char c[50] = { 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd,
|
||||
0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd,
|
||||
0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd,
|
||||
0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd,
|
||||
0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd,
|
||||
0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd,
|
||||
0xcd, 0xcd };
|
||||
|
||||
static unsigned char a[32];
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
crypto_auth_hmacsha256(a, c, sizeof c, key);
|
||||
for (i = 0; i < 32; ++i) {
|
||||
printf(",0x%02x", (unsigned int) a[i]);
|
||||
if (i % 8 == 7)
|
||||
printf("\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
,0x37,0x2e,0xfc,0xf9,0xb4,0x0b,0x35,0xc2
|
||||
,0x11,0x5b,0x13,0x46,0x90,0x3d,0x2e,0xf4
|
||||
,0x2f,0xce,0xd4,0x6f,0x08,0x46,0xe7,0x25
|
||||
,0x7b,0xb1,0x56,0xd3,0xd7,0xb3,0x0d,0x3f
|
||||
@@ -0,0 +1,36 @@
|
||||
/* "Test Case AUTH256-4" from RFC 4868 */
|
||||
|
||||
#define TEST_NAME "auth3"
|
||||
#include "cmptest.h"
|
||||
|
||||
static unsigned char key[32] = {
|
||||
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
|
||||
0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
|
||||
0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20
|
||||
};
|
||||
|
||||
static unsigned char c[50] = { 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd,
|
||||
0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd,
|
||||
0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd,
|
||||
0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd,
|
||||
0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd,
|
||||
0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd,
|
||||
0xcd, 0xcd };
|
||||
|
||||
static unsigned char a[32] = { 0x37, 0x2e, 0xfc, 0xf9, 0xb4, 0x0b, 0x35, 0xc2,
|
||||
0x11, 0x5b, 0x13, 0x46, 0x90, 0x3d, 0x2e, 0xf4,
|
||||
0x2f, 0xce, 0xd4, 0x6f, 0x08, 0x46, 0xe7, 0x25,
|
||||
0x7b, 0xb1, 0x56, 0xd3, 0xd7, 0xb3, 0x0d, 0x3f };
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
static unsigned char a2[crypto_auth_hmacsha256_BYTES];
|
||||
|
||||
printf("%d\n", crypto_auth_hmacsha256_verify(a, c, sizeof c, key));
|
||||
|
||||
crypto_auth_hmacsha256(a2, guard_page, 0U, key);
|
||||
assert(crypto_auth_hmacsha256_verify(a2, guard_page, 0U, key) == 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
0
|
||||
@@ -0,0 +1,41 @@
|
||||
|
||||
#define TEST_NAME "auth5"
|
||||
#include "cmptest.h"
|
||||
|
||||
static unsigned char key[32];
|
||||
static unsigned char c[1000];
|
||||
static unsigned char a[32];
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
size_t clen;
|
||||
|
||||
for (clen = 0; clen < 1000; ++clen) {
|
||||
crypto_auth_keygen(key);
|
||||
randombytes_buf(c, clen);
|
||||
crypto_auth(a, c, clen, key);
|
||||
if (crypto_auth_verify(a, c, clen, key) != 0) {
|
||||
printf("fail %u\n", (unsigned int) clen);
|
||||
return 100;
|
||||
}
|
||||
if (clen > 0) {
|
||||
c[rand() % clen] += 1 + (rand() % 255);
|
||||
if (crypto_auth_verify(a, c, clen, key) == 0) {
|
||||
printf("forgery %u\n", (unsigned int) clen);
|
||||
return 100;
|
||||
}
|
||||
a[rand() % sizeof a] += 1 + (rand() % 255);
|
||||
if (crypto_auth_verify(a, c, clen, key) == 0) {
|
||||
printf("forgery %u\n", (unsigned int) clen);
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
crypto_auth_keygen(key);
|
||||
crypto_auth(a, guard_page, 0U, key);
|
||||
assert(crypto_auth_verify(a, guard_page, 0U, key) == 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
|
||||
#define TEST_NAME "auth6"
|
||||
#include "cmptest.h"
|
||||
|
||||
/* "Test Case 2" from RFC 4231 */
|
||||
static unsigned char key[32] = "Jefe";
|
||||
static unsigned char c[] = "what do ya want for nothing?";
|
||||
|
||||
static unsigned char a[64];
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
crypto_auth_hmacsha512(a, c, sizeof c - 1U, key);
|
||||
for (i = 0; i < 64; ++i) {
|
||||
printf(",0x%02x", (unsigned int) a[i]);
|
||||
if (i % 8 == 7)
|
||||
printf("\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
,0x16,0x4b,0x7a,0x7b,0xfc,0xf8,0x19,0xe2
|
||||
,0xe3,0x95,0xfb,0xe7,0x3b,0x56,0xe0,0xa3
|
||||
,0x87,0xbd,0x64,0x22,0x2e,0x83,0x1f,0xd6
|
||||
,0x10,0x27,0x0c,0xd7,0xea,0x25,0x05,0x54
|
||||
,0x97,0x58,0xbf,0x75,0xc0,0x5a,0x99,0x4a
|
||||
,0x6d,0x03,0x4f,0x65,0xf8,0xf0,0xe6,0xfd
|
||||
,0xca,0xea,0xb1,0xa3,0x4d,0x4a,0x6b,0x4b
|
||||
,0x63,0x6e,0x07,0x0a,0x38,0xbc,0xe7,0x37
|
||||
@@ -0,0 +1,41 @@
|
||||
|
||||
#define TEST_NAME "auth7"
|
||||
#include "cmptest.h"
|
||||
|
||||
static unsigned char key[32];
|
||||
static unsigned char c[600];
|
||||
static unsigned char a[64];
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
size_t clen;
|
||||
|
||||
for (clen = 0; clen < sizeof c; ++clen) {
|
||||
crypto_auth_keygen(key);
|
||||
randombytes_buf(c, clen);
|
||||
crypto_auth_hmacsha512(a, c, clen, key);
|
||||
if (crypto_auth_hmacsha512_verify(a, c, clen, key) != 0) {
|
||||
printf("fail %u\n", (unsigned int) clen);
|
||||
return 100;
|
||||
}
|
||||
if (clen > 0) {
|
||||
c[(size_t) rand() % clen] += 1 + (rand() % 255);
|
||||
if (crypto_auth_hmacsha512_verify(a, c, clen, key) == 0) {
|
||||
printf("forgery %u\n", (unsigned int) clen);
|
||||
return 100;
|
||||
}
|
||||
a[rand() % sizeof a] += 1 + (rand() % 255);
|
||||
if (crypto_auth_hmacsha512_verify(a, c, clen, key) == 0) {
|
||||
printf("forgery %u\n", (unsigned int) clen);
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
crypto_auth_keygen(key);
|
||||
crypto_auth_hmacsha512(a, guard_page, 0U, key);
|
||||
assert(crypto_auth_hmacsha512_verify(a, guard_page, 0U, key) == 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
112
components/espressif__libsodium/libsodium/test/default/box.c
Normal file
112
components/espressif__libsodium/libsodium/test/default/box.c
Normal file
@@ -0,0 +1,112 @@
|
||||
|
||||
#define TEST_NAME "box"
|
||||
#include "cmptest.h"
|
||||
|
||||
static const unsigned char alicesk[32] = {
|
||||
0x77, 0x07, 0x6d, 0x0a, 0x73, 0x18, 0xa5, 0x7d, 0x3c, 0x16, 0xc1,
|
||||
0x72, 0x51, 0xb2, 0x66, 0x45, 0xdf, 0x4c, 0x2f, 0x87, 0xeb, 0xc0,
|
||||
0x99, 0x2a, 0xb1, 0x77, 0xfb, 0xa5, 0x1d, 0xb9, 0x2c, 0x2a
|
||||
};
|
||||
|
||||
static const unsigned char bobpk[32] = {
|
||||
0xde, 0x9e, 0xdb, 0x7d, 0x7b, 0x7d, 0xc1, 0xb4, 0xd3, 0x5b, 0x61,
|
||||
0xc2, 0xec, 0xe4, 0x35, 0x37, 0x3f, 0x83, 0x43, 0xc8, 0x5b, 0x78,
|
||||
0x67, 0x4d, 0xad, 0xfc, 0x7e, 0x14, 0x6f, 0x88, 0x2b, 0x4f
|
||||
};
|
||||
|
||||
static const unsigned char small_order_p[crypto_box_PUBLICKEYBYTES] = {
|
||||
0xe0, 0xeb, 0x7a, 0x7c, 0x3b, 0x41, 0xb8, 0xae, 0x16, 0x56, 0xe3,
|
||||
0xfa, 0xf1, 0x9f, 0xc4, 0x6a, 0xda, 0x09, 0x8d, 0xeb, 0x9c, 0x32,
|
||||
0xb1, 0xfd, 0x86, 0x62, 0x05, 0x16, 0x5f, 0x49, 0xb8, 0x00
|
||||
};
|
||||
|
||||
static const unsigned char nonce[24] = { 0x69, 0x69, 0x6e, 0xe9, 0x55, 0xb6,
|
||||
0x2b, 0x73, 0xcd, 0x62, 0xbd, 0xa8,
|
||||
0x75, 0xfc, 0x73, 0xd6, 0x82, 0x19,
|
||||
0xe0, 0x03, 0x6b, 0x7a, 0x0b, 0x37 };
|
||||
|
||||
/* API requires first 32 bytes to be 0 */
|
||||
static const unsigned char m[163] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0xbe, 0x07, 0x5f, 0xc5,
|
||||
0x3c, 0x81, 0xf2, 0xd5, 0xcf, 0x14, 0x13, 0x16, 0xeb, 0xeb, 0x0c, 0x7b,
|
||||
0x52, 0x28, 0xc5, 0x2a, 0x4c, 0x62, 0xcb, 0xd4, 0x4b, 0x66, 0x84, 0x9b,
|
||||
0x64, 0x24, 0x4f, 0xfc, 0xe5, 0xec, 0xba, 0xaf, 0x33, 0xbd, 0x75, 0x1a,
|
||||
0x1a, 0xc7, 0x28, 0xd4, 0x5e, 0x6c, 0x61, 0x29, 0x6c, 0xdc, 0x3c, 0x01,
|
||||
0x23, 0x35, 0x61, 0xf4, 0x1d, 0xb6, 0x6c, 0xce, 0x31, 0x4a, 0xdb, 0x31,
|
||||
0x0e, 0x3b, 0xe8, 0x25, 0x0c, 0x46, 0xf0, 0x6d, 0xce, 0xea, 0x3a, 0x7f,
|
||||
0xa1, 0x34, 0x80, 0x57, 0xe2, 0xf6, 0x55, 0x6a, 0xd6, 0xb1, 0x31, 0x8a,
|
||||
0x02, 0x4a, 0x83, 0x8f, 0x21, 0xaf, 0x1f, 0xde, 0x04, 0x89, 0x77, 0xeb,
|
||||
0x48, 0xf5, 0x9f, 0xfd, 0x49, 0x24, 0xca, 0x1c, 0x60, 0x90, 0x2e, 0x52,
|
||||
0xf0, 0xa0, 0x89, 0xbc, 0x76, 0x89, 0x70, 0x40, 0xe0, 0x82, 0xf9, 0x37,
|
||||
0x76, 0x38, 0x48, 0x64, 0x5e, 0x07, 0x05
|
||||
};
|
||||
|
||||
static unsigned char c[163];
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
unsigned char k[crypto_box_BEFORENMBYTES];
|
||||
int i;
|
||||
int ret;
|
||||
|
||||
ret = crypto_box(c, m, 163, nonce, bobpk, alicesk);
|
||||
assert(ret == 0);
|
||||
for (i = 16; i < 163; ++i) {
|
||||
printf(",0x%02x", (unsigned int) c[i]);
|
||||
if (i % 8 == 7)
|
||||
printf("\n");
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
ret = crypto_box(c, m, 163, nonce, small_order_p, alicesk);
|
||||
assert(ret == -1);
|
||||
|
||||
memset(c, 0, sizeof c);
|
||||
|
||||
ret = crypto_box_beforenm(k, bobpk, alicesk);
|
||||
assert(ret == 0);
|
||||
crypto_box_afternm(c, m, 163, nonce, k);
|
||||
for (i = 16; i < 163; ++i) {
|
||||
printf(",0x%02x", (unsigned int) c[i]);
|
||||
if (i % 8 == 7)
|
||||
printf("\n");
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
ret = crypto_box_beforenm(k, small_order_p, alicesk);
|
||||
assert(ret == -1);
|
||||
|
||||
assert(crypto_box_seedbytes() > 0U);
|
||||
assert(crypto_box_publickeybytes() > 0U);
|
||||
assert(crypto_box_secretkeybytes() > 0U);
|
||||
assert(crypto_box_beforenmbytes() > 0U);
|
||||
assert(crypto_box_noncebytes() > 0U);
|
||||
assert(crypto_box_zerobytes() > 0U);
|
||||
assert(crypto_box_boxzerobytes() > 0U);
|
||||
assert(crypto_box_macbytes() > 0U);
|
||||
assert(crypto_box_messagebytes_max() > 0U);
|
||||
assert(strcmp(crypto_box_primitive(), "curve25519xsalsa20poly1305") == 0);
|
||||
assert(crypto_box_curve25519xsalsa20poly1305_seedbytes() ==
|
||||
crypto_box_seedbytes());
|
||||
assert(crypto_box_curve25519xsalsa20poly1305_publickeybytes() ==
|
||||
crypto_box_publickeybytes());
|
||||
assert(crypto_box_curve25519xsalsa20poly1305_secretkeybytes() ==
|
||||
crypto_box_secretkeybytes());
|
||||
assert(crypto_box_curve25519xsalsa20poly1305_beforenmbytes() ==
|
||||
crypto_box_beforenmbytes());
|
||||
assert(crypto_box_curve25519xsalsa20poly1305_noncebytes() ==
|
||||
crypto_box_noncebytes());
|
||||
assert(crypto_box_curve25519xsalsa20poly1305_zerobytes() ==
|
||||
crypto_box_zerobytes());
|
||||
assert(crypto_box_curve25519xsalsa20poly1305_boxzerobytes() ==
|
||||
crypto_box_boxzerobytes());
|
||||
assert(crypto_box_curve25519xsalsa20poly1305_macbytes() ==
|
||||
crypto_box_macbytes());
|
||||
assert(crypto_box_curve25519xsalsa20poly1305_messagebytes_max() ==
|
||||
crypto_box_messagebytes_max());
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
,0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5
|
||||
,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9
|
||||
,0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73
|
||||
,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce
|
||||
,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4
|
||||
,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a
|
||||
,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b
|
||||
,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72
|
||||
,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2
|
||||
,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38
|
||||
,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a
|
||||
,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae
|
||||
,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea
|
||||
,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda
|
||||
,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde
|
||||
,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3
|
||||
,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6
|
||||
,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74
|
||||
,0xe3,0x55,0xa5
|
||||
,0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5
|
||||
,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9
|
||||
,0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73
|
||||
,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce
|
||||
,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4
|
||||
,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a
|
||||
,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b
|
||||
,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72
|
||||
,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2
|
||||
,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38
|
||||
,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a
|
||||
,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae
|
||||
,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea
|
||||
,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda
|
||||
,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde
|
||||
,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3
|
||||
,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6
|
||||
,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74
|
||||
,0xe3,0x55,0xa5
|
||||
@@ -0,0 +1,80 @@
|
||||
|
||||
#define TEST_NAME "box2"
|
||||
#include "cmptest.h"
|
||||
|
||||
static unsigned char bobsk[32] = { 0x5d, 0xab, 0x08, 0x7e, 0x62, 0x4a, 0x8a,
|
||||
0x4b, 0x79, 0xe1, 0x7f, 0x8b, 0x83, 0x80,
|
||||
0x0e, 0xe6, 0x6f, 0x3b, 0xb1, 0x29, 0x26,
|
||||
0x18, 0xb6, 0xfd, 0x1c, 0x2f, 0x8b, 0x27,
|
||||
0xff, 0x88, 0xe0, 0xeb };
|
||||
|
||||
static unsigned char alicepk[32] = { 0x85, 0x20, 0xf0, 0x09, 0x89, 0x30, 0xa7,
|
||||
0x54, 0x74, 0x8b, 0x7d, 0xdc, 0xb4, 0x3e,
|
||||
0xf7, 0x5a, 0x0d, 0xbf, 0x3a, 0x0d, 0x26,
|
||||
0x38, 0x1a, 0xf4, 0xeb, 0xa4, 0xa9, 0x8e,
|
||||
0xaa, 0x9b, 0x4e, 0x6a };
|
||||
|
||||
static const unsigned char small_order_p[crypto_box_PUBLICKEYBYTES] = {
|
||||
0xe0, 0xeb, 0x7a, 0x7c, 0x3b, 0x41, 0xb8, 0xae, 0x16, 0x56, 0xe3,
|
||||
0xfa, 0xf1, 0x9f, 0xc4, 0x6a, 0xda, 0x09, 0x8d, 0xeb, 0x9c, 0x32,
|
||||
0xb1, 0xfd, 0x86, 0x62, 0x05, 0x16, 0x5f, 0x49, 0xb8, 0x00
|
||||
};
|
||||
|
||||
static unsigned char nonce[24] = { 0x69, 0x69, 0x6e, 0xe9, 0x55, 0xb6,
|
||||
0x2b, 0x73, 0xcd, 0x62, 0xbd, 0xa8,
|
||||
0x75, 0xfc, 0x73, 0xd6, 0x82, 0x19,
|
||||
0xe0, 0x03, 0x6b, 0x7a, 0x0b, 0x37 };
|
||||
|
||||
/* API requires first 16 bytes to be 0 */
|
||||
static unsigned char c[163] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0xf3, 0xff, 0xc7, 0x70, 0x3f, 0x94, 0x00, 0xe5,
|
||||
0x2a, 0x7d, 0xfb, 0x4b, 0x3d, 0x33, 0x05, 0xd9, 0x8e, 0x99, 0x3b, 0x9f,
|
||||
0x48, 0x68, 0x12, 0x73, 0xc2, 0x96, 0x50, 0xba, 0x32, 0xfc, 0x76, 0xce,
|
||||
0x48, 0x33, 0x2e, 0xa7, 0x16, 0x4d, 0x96, 0xa4, 0x47, 0x6f, 0xb8, 0xc5,
|
||||
0x31, 0xa1, 0x18, 0x6a, 0xc0, 0xdf, 0xc1, 0x7c, 0x98, 0xdc, 0xe8, 0x7b,
|
||||
0x4d, 0xa7, 0xf0, 0x11, 0xec, 0x48, 0xc9, 0x72, 0x71, 0xd2, 0xc2, 0x0f,
|
||||
0x9b, 0x92, 0x8f, 0xe2, 0x27, 0x0d, 0x6f, 0xb8, 0x63, 0xd5, 0x17, 0x38,
|
||||
0xb4, 0x8e, 0xee, 0xe3, 0x14, 0xa7, 0xcc, 0x8a, 0xb9, 0x32, 0x16, 0x45,
|
||||
0x48, 0xe5, 0x26, 0xae, 0x90, 0x22, 0x43, 0x68, 0x51, 0x7a, 0xcf, 0xea,
|
||||
0xbd, 0x6b, 0xb3, 0x73, 0x2b, 0xc0, 0xe9, 0xda, 0x99, 0x83, 0x2b, 0x61,
|
||||
0xca, 0x01, 0xb6, 0xde, 0x56, 0x24, 0x4a, 0x9e, 0x88, 0xd5, 0xf9, 0xb3,
|
||||
0x79, 0x73, 0xf6, 0x22, 0xa4, 0x3d, 0x14, 0xa6, 0x59, 0x9b, 0x1f, 0x65,
|
||||
0x4c, 0xb4, 0x5a, 0x74, 0xe3, 0x55, 0xa5
|
||||
};
|
||||
|
||||
static unsigned char m[163];
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
unsigned char k[crypto_box_BEFORENMBYTES];
|
||||
int i;
|
||||
int ret;
|
||||
|
||||
if (crypto_box_open(m, c, 163, nonce, alicepk, bobsk) == 0) {
|
||||
for (i = 32; i < 163; ++i) {
|
||||
printf(",0x%02x", (unsigned int) m[i]);
|
||||
if (i % 8 == 7)
|
||||
printf("\n");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
ret = crypto_box_open(m, c, 163, nonce, small_order_p, bobsk);
|
||||
assert(ret == -1);
|
||||
|
||||
memset(m, 0, sizeof m);
|
||||
ret = crypto_box_beforenm(k, small_order_p, bobsk);
|
||||
assert(ret == -1);
|
||||
ret = crypto_box_beforenm(k, alicepk, bobsk);
|
||||
assert(ret == 0);
|
||||
if (crypto_box_open_afternm(m, c, 163, nonce, k) == 0) {
|
||||
for (i = 32; i < 163; ++i) {
|
||||
printf(",0x%02x", (unsigned int) m[i]);
|
||||
if (i % 8 == 7)
|
||||
printf("\n");
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
,0xbe,0x07,0x5f,0xc5,0x3c,0x81,0xf2,0xd5
|
||||
,0xcf,0x14,0x13,0x16,0xeb,0xeb,0x0c,0x7b
|
||||
,0x52,0x28,0xc5,0x2a,0x4c,0x62,0xcb,0xd4
|
||||
,0x4b,0x66,0x84,0x9b,0x64,0x24,0x4f,0xfc
|
||||
,0xe5,0xec,0xba,0xaf,0x33,0xbd,0x75,0x1a
|
||||
,0x1a,0xc7,0x28,0xd4,0x5e,0x6c,0x61,0x29
|
||||
,0x6c,0xdc,0x3c,0x01,0x23,0x35,0x61,0xf4
|
||||
,0x1d,0xb6,0x6c,0xce,0x31,0x4a,0xdb,0x31
|
||||
,0x0e,0x3b,0xe8,0x25,0x0c,0x46,0xf0,0x6d
|
||||
,0xce,0xea,0x3a,0x7f,0xa1,0x34,0x80,0x57
|
||||
,0xe2,0xf6,0x55,0x6a,0xd6,0xb1,0x31,0x8a
|
||||
,0x02,0x4a,0x83,0x8f,0x21,0xaf,0x1f,0xde
|
||||
,0x04,0x89,0x77,0xeb,0x48,0xf5,0x9f,0xfd
|
||||
,0x49,0x24,0xca,0x1c,0x60,0x90,0x2e,0x52
|
||||
,0xf0,0xa0,0x89,0xbc,0x76,0x89,0x70,0x40
|
||||
,0xe0,0x82,0xf9,0x37,0x76,0x38,0x48,0x64
|
||||
,0x5e,0x07,0x05
|
||||
,0xbe,0x07,0x5f,0xc5,0x3c,0x81,0xf2,0xd5
|
||||
,0xcf,0x14,0x13,0x16,0xeb,0xeb,0x0c,0x7b
|
||||
,0x52,0x28,0xc5,0x2a,0x4c,0x62,0xcb,0xd4
|
||||
,0x4b,0x66,0x84,0x9b,0x64,0x24,0x4f,0xfc
|
||||
,0xe5,0xec,0xba,0xaf,0x33,0xbd,0x75,0x1a
|
||||
,0x1a,0xc7,0x28,0xd4,0x5e,0x6c,0x61,0x29
|
||||
,0x6c,0xdc,0x3c,0x01,0x23,0x35,0x61,0xf4
|
||||
,0x1d,0xb6,0x6c,0xce,0x31,0x4a,0xdb,0x31
|
||||
,0x0e,0x3b,0xe8,0x25,0x0c,0x46,0xf0,0x6d
|
||||
,0xce,0xea,0x3a,0x7f,0xa1,0x34,0x80,0x57
|
||||
,0xe2,0xf6,0x55,0x6a,0xd6,0xb1,0x31,0x8a
|
||||
,0x02,0x4a,0x83,0x8f,0x21,0xaf,0x1f,0xde
|
||||
,0x04,0x89,0x77,0xeb,0x48,0xf5,0x9f,0xfd
|
||||
,0x49,0x24,0xca,0x1c,0x60,0x90,0x2e,0x52
|
||||
,0xf0,0xa0,0x89,0xbc,0x76,0x89,0x70,0x40
|
||||
,0xe0,0x82,0xf9,0x37,0x76,0x38,0x48,0x64
|
||||
,0x5e,0x07,0x05
|
||||
@@ -0,0 +1,50 @@
|
||||
|
||||
#define TEST_NAME "box7"
|
||||
#include "cmptest.h"
|
||||
|
||||
static unsigned char alicesk[crypto_box_SECRETKEYBYTES];
|
||||
static unsigned char alicepk[crypto_box_PUBLICKEYBYTES];
|
||||
static unsigned char bobsk[crypto_box_SECRETKEYBYTES];
|
||||
static unsigned char bobpk[crypto_box_PUBLICKEYBYTES];
|
||||
static unsigned char n[crypto_box_NONCEBYTES];
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
unsigned char *m;
|
||||
unsigned char *c;
|
||||
unsigned char *m2;
|
||||
size_t mlen;
|
||||
size_t mlen_max = 1000;
|
||||
size_t i;
|
||||
int ret;
|
||||
|
||||
m = (unsigned char *) sodium_malloc(mlen_max);
|
||||
c = (unsigned char *) sodium_malloc(mlen_max);
|
||||
m2 = (unsigned char *) sodium_malloc(mlen_max);
|
||||
memset(m, 0, crypto_box_ZEROBYTES);
|
||||
crypto_box_keypair(alicepk, alicesk);
|
||||
crypto_box_keypair(bobpk, bobsk);
|
||||
for (mlen = 0; mlen + crypto_box_ZEROBYTES <= mlen_max; mlen++) {
|
||||
randombytes_buf(n, crypto_box_NONCEBYTES);
|
||||
randombytes_buf(m + crypto_box_ZEROBYTES, mlen);
|
||||
ret = crypto_box(c, m, mlen + crypto_box_ZEROBYTES, n, bobpk, alicesk);
|
||||
assert(ret == 0);
|
||||
if (crypto_box_open(m2, c, mlen + crypto_box_ZEROBYTES, n, alicepk,
|
||||
bobsk) == 0) {
|
||||
for (i = 0; i < mlen + crypto_box_ZEROBYTES; ++i) {
|
||||
if (m2[i] != m[i]) {
|
||||
printf("bad decryption\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
printf("ciphertext fails verification\n");
|
||||
}
|
||||
}
|
||||
sodium_free(m);
|
||||
sodium_free(c);
|
||||
sodium_free(m2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
|
||||
#define TEST_NAME "box8"
|
||||
#include "cmptest.h"
|
||||
|
||||
static unsigned char alicesk[crypto_box_SECRETKEYBYTES];
|
||||
static unsigned char alicepk[crypto_box_PUBLICKEYBYTES];
|
||||
static unsigned char bobsk[crypto_box_SECRETKEYBYTES];
|
||||
static unsigned char bobpk[crypto_box_PUBLICKEYBYTES];
|
||||
static unsigned char n[crypto_box_NONCEBYTES];
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
unsigned char *m;
|
||||
unsigned char *c;
|
||||
unsigned char *m2;
|
||||
size_t mlen;
|
||||
size_t mlen_max = 1000;
|
||||
size_t i;
|
||||
int faults;
|
||||
int ret;
|
||||
|
||||
m = (unsigned char *) sodium_malloc(mlen_max);
|
||||
c = (unsigned char *) sodium_malloc(mlen_max);
|
||||
m2 = (unsigned char *) sodium_malloc(mlen_max);
|
||||
crypto_box_keypair(alicepk, alicesk);
|
||||
crypto_box_keypair(bobpk, bobsk);
|
||||
for (mlen = 0; mlen + crypto_box_ZEROBYTES <= mlen_max; mlen++) {
|
||||
randombytes_buf(n, crypto_box_NONCEBYTES);
|
||||
randombytes_buf(m + crypto_box_ZEROBYTES, mlen);
|
||||
ret = crypto_box(c, m, mlen + crypto_box_ZEROBYTES, n, bobpk, alicesk);
|
||||
assert(ret == 0);
|
||||
#ifdef BROWSER_TESTS
|
||||
faults = 1;
|
||||
#else
|
||||
faults = 5;
|
||||
#endif
|
||||
while (faults > 0) {
|
||||
c[rand() % (mlen + crypto_box_ZEROBYTES)] = rand();
|
||||
if (crypto_box_open(m2, c, mlen + crypto_box_ZEROBYTES, n, alicepk,
|
||||
bobsk) == 0) {
|
||||
for (i = 0; i < mlen + crypto_box_ZEROBYTES; ++i) {
|
||||
if (m2[i] != m[i]) {
|
||||
printf("forgery\n");
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
faults--;
|
||||
}
|
||||
}
|
||||
}
|
||||
sodium_free(m);
|
||||
sodium_free(c);
|
||||
sodium_free(m2);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
|
||||
#define TEST_NAME "box_easy"
|
||||
#include "cmptest.h"
|
||||
|
||||
static unsigned char alicesk[32] = { 0x77, 0x07, 0x6d, 0x0a, 0x73, 0x18, 0xa5,
|
||||
0x7d, 0x3c, 0x16, 0xc1, 0x72, 0x51, 0xb2,
|
||||
0x66, 0x45, 0xdf, 0x4c, 0x2f, 0x87, 0xeb,
|
||||
0xc0, 0x99, 0x2a, 0xb1, 0x77, 0xfb, 0xa5,
|
||||
0x1d, 0xb9, 0x2c, 0x2a };
|
||||
|
||||
static unsigned char bobpk[32] = { 0xde, 0x9e, 0xdb, 0x7d, 0x7b, 0x7d, 0xc1,
|
||||
0xb4, 0xd3, 0x5b, 0x61, 0xc2, 0xec, 0xe4,
|
||||
0x35, 0x37, 0x3f, 0x83, 0x43, 0xc8, 0x5b,
|
||||
0x78, 0x67, 0x4d, 0xad, 0xfc, 0x7e, 0x14,
|
||||
0x6f, 0x88, 0x2b, 0x4f };
|
||||
|
||||
static unsigned char nonce[24] = { 0x69, 0x69, 0x6e, 0xe9, 0x55, 0xb6,
|
||||
0x2b, 0x73, 0xcd, 0x62, 0xbd, 0xa8,
|
||||
0x75, 0xfc, 0x73, 0xd6, 0x82, 0x19,
|
||||
0xe0, 0x03, 0x6b, 0x7a, 0x0b, 0x37 };
|
||||
|
||||
static unsigned char m[131] = {
|
||||
0xbe, 0x07, 0x5f, 0xc5, 0x3c, 0x81, 0xf2, 0xd5, 0xcf, 0x14, 0x13, 0x16,
|
||||
0xeb, 0xeb, 0x0c, 0x7b, 0x52, 0x28, 0xc5, 0x2a, 0x4c, 0x62, 0xcb, 0xd4,
|
||||
0x4b, 0x66, 0x84, 0x9b, 0x64, 0x24, 0x4f, 0xfc, 0xe5, 0xec, 0xba, 0xaf,
|
||||
0x33, 0xbd, 0x75, 0x1a, 0x1a, 0xc7, 0x28, 0xd4, 0x5e, 0x6c, 0x61, 0x29,
|
||||
0x6c, 0xdc, 0x3c, 0x01, 0x23, 0x35, 0x61, 0xf4, 0x1d, 0xb6, 0x6c, 0xce,
|
||||
0x31, 0x4a, 0xdb, 0x31, 0x0e, 0x3b, 0xe8, 0x25, 0x0c, 0x46, 0xf0, 0x6d,
|
||||
0xce, 0xea, 0x3a, 0x7f, 0xa1, 0x34, 0x80, 0x57, 0xe2, 0xf6, 0x55, 0x6a,
|
||||
0xd6, 0xb1, 0x31, 0x8a, 0x02, 0x4a, 0x83, 0x8f, 0x21, 0xaf, 0x1f, 0xde,
|
||||
0x04, 0x89, 0x77, 0xeb, 0x48, 0xf5, 0x9f, 0xfd, 0x49, 0x24, 0xca, 0x1c,
|
||||
0x60, 0x90, 0x2e, 0x52, 0xf0, 0xa0, 0x89, 0xbc, 0x76, 0x89, 0x70, 0x40,
|
||||
0xe0, 0x82, 0xf9, 0x37, 0x76, 0x38, 0x48, 0x64, 0x5e, 0x07, 0x05
|
||||
};
|
||||
|
||||
static unsigned char c[147 + crypto_box_MACBYTES];
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
size_t i;
|
||||
int ret;
|
||||
|
||||
ret = crypto_box_easy(c, m, 131, nonce, bobpk, alicesk);
|
||||
assert(ret == 0);
|
||||
for (i = 0; i < 131 + crypto_box_MACBYTES; ++i) {
|
||||
printf(",0x%02x", (unsigned int) c[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
/* Null message */
|
||||
|
||||
ret = crypto_box_easy(c, guard_page, 0, nonce, bobpk, alicesk);
|
||||
assert(ret == 0);
|
||||
for (i = 0; i < 1 + crypto_box_MACBYTES; ++i) {
|
||||
printf(",0x%02x", (unsigned int) c[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
ret =
|
||||
crypto_box_open_easy(c, c, crypto_box_MACBYTES, nonce, bobpk, alicesk);
|
||||
assert(ret == 0);
|
||||
for (i = 0; i < 1 + crypto_box_MACBYTES; ++i) {
|
||||
printf(",0x%02x", (unsigned int) c[i]);
|
||||
}
|
||||
printf("\n");
|
||||
c[randombytes_uniform(crypto_box_MACBYTES)]++;
|
||||
ret = crypto_box_open_easy(c, c, crypto_box_MACBYTES, nonce, bobpk, alicesk);
|
||||
assert(ret == -1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
,0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9,0x8e,0x99,0x3b,0x9f,0x48,0x68,0x12,0x73,0xc2,0x96,0x50,0xba,0x32,0xfc,0x76,0xce,0x48,0x33,0x2e,0xa7,0x16,0x4d,0x96,0xa4,0x47,0x6f,0xb8,0xc5,0x31,0xa1,0x18,0x6a,0xc0,0xdf,0xc1,0x7c,0x98,0xdc,0xe8,0x7b,0x4d,0xa7,0xf0,0x11,0xec,0x48,0xc9,0x72,0x71,0xd2,0xc2,0x0f,0x9b,0x92,0x8f,0xe2,0x27,0x0d,0x6f,0xb8,0x63,0xd5,0x17,0x38,0xb4,0x8e,0xee,0xe3,0x14,0xa7,0xcc,0x8a,0xb9,0x32,0x16,0x45,0x48,0xe5,0x26,0xae,0x90,0x22,0x43,0x68,0x51,0x7a,0xcf,0xea,0xbd,0x6b,0xb3,0x73,0x2b,0xc0,0xe9,0xda,0x99,0x83,0x2b,0x61,0xca,0x01,0xb6,0xde,0x56,0x24,0x4a,0x9e,0x88,0xd5,0xf9,0xb3,0x79,0x73,0xf6,0x22,0xa4,0x3d,0x14,0xa6,0x59,0x9b,0x1f,0x65,0x4c,0xb4,0x5a,0x74,0xe3,0x55,0xa5
|
||||
,0x25,0x39,0x12,0x1d,0x8e,0x23,0x4e,0x65,0x2d,0x65,0x1f,0xa4,0xc8,0xcf,0xf8,0x80,0x8e
|
||||
,0x25,0x39,0x12,0x1d,0x8e,0x23,0x4e,0x65,0x2d,0x65,0x1f,0xa4,0xc8,0xcf,0xf8,0x80,0x8e
|
||||
@@ -0,0 +1,149 @@
|
||||
|
||||
#define TEST_NAME "box_easy2"
|
||||
#include "cmptest.h"
|
||||
|
||||
static const unsigned char small_order_p[crypto_box_PUBLICKEYBYTES] = {
|
||||
0xe0, 0xeb, 0x7a, 0x7c, 0x3b, 0x41, 0xb8, 0xae, 0x16, 0x56, 0xe3,
|
||||
0xfa, 0xf1, 0x9f, 0xc4, 0x6a, 0xda, 0x09, 0x8d, 0xeb, 0x9c, 0x32,
|
||||
0xb1, 0xfd, 0x86, 0x62, 0x05, 0x16, 0x5f, 0x49, 0xb8, 0x00
|
||||
};
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
unsigned char *alicepk;
|
||||
unsigned char *alicesk;
|
||||
unsigned char *bobpk;
|
||||
unsigned char *bobsk;
|
||||
unsigned char *mac;
|
||||
unsigned char *nonce;
|
||||
unsigned char *k1;
|
||||
unsigned char *k2;
|
||||
unsigned char *m;
|
||||
unsigned char *m2;
|
||||
unsigned char *c;
|
||||
size_t mlen;
|
||||
size_t i;
|
||||
size_t m_size;
|
||||
size_t m2_size;
|
||||
size_t c_size;
|
||||
int ret;
|
||||
|
||||
m2_size = m_size = 7U + randombytes_uniform(1000);
|
||||
c_size = crypto_box_MACBYTES + m_size;
|
||||
m = (unsigned char *) sodium_malloc(m_size);
|
||||
m2 = (unsigned char *) sodium_malloc(m2_size);
|
||||
c = (unsigned char *) sodium_malloc(c_size);
|
||||
alicepk = (unsigned char *) sodium_malloc(crypto_box_PUBLICKEYBYTES);
|
||||
alicesk = (unsigned char *) sodium_malloc(crypto_box_SECRETKEYBYTES);
|
||||
bobpk = (unsigned char *) sodium_malloc(crypto_box_PUBLICKEYBYTES);
|
||||
bobsk = (unsigned char *) sodium_malloc(crypto_box_SECRETKEYBYTES);
|
||||
mac = (unsigned char *) sodium_malloc(crypto_box_MACBYTES);
|
||||
nonce = (unsigned char *) sodium_malloc(crypto_box_NONCEBYTES);
|
||||
k1 = (unsigned char *) sodium_malloc(crypto_box_BEFORENMBYTES);
|
||||
k2 = (unsigned char *) sodium_malloc(crypto_box_BEFORENMBYTES);
|
||||
crypto_box_keypair(alicepk, alicesk);
|
||||
crypto_box_keypair(bobpk, bobsk);
|
||||
mlen = (size_t) randombytes_uniform((uint32_t) m_size) + 1U;
|
||||
randombytes_buf(m, mlen);
|
||||
randombytes_buf(nonce, crypto_box_NONCEBYTES);
|
||||
ret = crypto_box_easy(c, m, mlen, nonce, bobpk, alicesk);
|
||||
assert(ret == 0);
|
||||
if (crypto_box_open_easy(m2, c,
|
||||
(unsigned long long) mlen + crypto_box_MACBYTES,
|
||||
nonce, alicepk, bobsk) != 0) {
|
||||
printf("open() failed");
|
||||
return 1;
|
||||
}
|
||||
printf("%d\n", memcmp(m, m2, mlen));
|
||||
|
||||
for (i = 0; i < mlen + crypto_box_MACBYTES - 1; i++) {
|
||||
if (crypto_box_open_easy(m2, c, (unsigned long long) i, nonce, alicepk,
|
||||
bobsk) == 0) {
|
||||
printf("short open() should have failed");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
memcpy(c, m, mlen);
|
||||
ret =
|
||||
crypto_box_easy(c, c, (unsigned long long) mlen, nonce, bobpk, alicesk);
|
||||
assert(ret == 0);
|
||||
printf("%d\n", memcmp(m, c, mlen) == 0);
|
||||
printf("%d\n", memcmp(m, c + crypto_box_MACBYTES, mlen) == 0);
|
||||
if (crypto_box_open_easy(c, c,
|
||||
(unsigned long long) mlen + crypto_box_MACBYTES,
|
||||
nonce, alicepk, bobsk) != 0) {
|
||||
printf("crypto_box_open_easy() failed\n");
|
||||
}
|
||||
|
||||
ret = crypto_box_beforenm(k1, small_order_p, bobsk);
|
||||
assert(ret == -1);
|
||||
ret = crypto_box_beforenm(k2, small_order_p, alicesk);
|
||||
assert(ret == -1);
|
||||
|
||||
ret = crypto_box_beforenm(k1, alicepk, bobsk);
|
||||
assert(ret == 0);
|
||||
ret = crypto_box_beforenm(k2, bobpk, alicesk);
|
||||
assert(ret == 0);
|
||||
|
||||
memset(m2, 0, m2_size);
|
||||
|
||||
if (crypto_box_easy_afternm(c, m, 0, nonce, k1) != 0) {
|
||||
printf(
|
||||
"crypto_box_easy_afternm() with a null ciphertext should have "
|
||||
"worked\n");
|
||||
}
|
||||
crypto_box_easy_afternm(c, m, (unsigned long long) mlen, nonce, k1);
|
||||
if (crypto_box_open_easy_afternm(
|
||||
m2, c, (unsigned long long) mlen + crypto_box_MACBYTES, nonce,
|
||||
k2) != 0) {
|
||||
printf("crypto_box_open_easy_afternm() failed\n");
|
||||
}
|
||||
printf("%d\n", memcmp(m, m2, mlen));
|
||||
if (crypto_box_open_easy_afternm(m2, c, crypto_box_MACBYTES - 1U, nonce,
|
||||
k2) == 0) {
|
||||
printf(
|
||||
"crypto_box_open_easy_afternm() with a huge ciphertext should have "
|
||||
"failed\n");
|
||||
}
|
||||
memset(m2, 0, m2_size);
|
||||
ret = crypto_box_detached(c, mac, m, (unsigned long long) mlen, nonce,
|
||||
small_order_p, bobsk);
|
||||
assert(ret == -1);
|
||||
ret = crypto_box_detached(c, mac, m, (unsigned long long) mlen, nonce,
|
||||
alicepk, bobsk);
|
||||
assert(ret == 0);
|
||||
if (crypto_box_open_detached(m2, c, mac, (unsigned long long) mlen, nonce,
|
||||
small_order_p, alicesk) != -1) {
|
||||
printf("crypto_box_open_detached() with a weak key passed\n");
|
||||
}
|
||||
if (crypto_box_open_detached(m2, c, mac, (unsigned long long) mlen, nonce,
|
||||
bobpk, alicesk) != 0) {
|
||||
printf("crypto_box_open_detached() failed\n");
|
||||
}
|
||||
printf("%d\n", memcmp(m, m2, mlen));
|
||||
|
||||
memset(m2, 0, m2_size);
|
||||
crypto_box_detached_afternm(c, mac, m, (unsigned long long) mlen, nonce,
|
||||
k1);
|
||||
if (crypto_box_open_detached_afternm(m2, c, mac, (unsigned long long) mlen,
|
||||
nonce, k2) != 0) {
|
||||
printf("crypto_box_open_detached_afternm() failed\n");
|
||||
}
|
||||
printf("%d\n", memcmp(m, m2, mlen));
|
||||
|
||||
sodium_free(alicepk);
|
||||
sodium_free(alicesk);
|
||||
sodium_free(bobpk);
|
||||
sodium_free(bobsk);
|
||||
sodium_free(mac);
|
||||
sodium_free(nonce);
|
||||
sodium_free(k1);
|
||||
sodium_free(k2);
|
||||
sodium_free(m);
|
||||
sodium_free(m2);
|
||||
sodium_free(c);
|
||||
printf("OK\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
0
|
||||
OK
|
||||
@@ -0,0 +1,165 @@
|
||||
|
||||
#define TEST_NAME "box_seal"
|
||||
#include "cmptest.h"
|
||||
|
||||
static
|
||||
void tv1(void)
|
||||
{
|
||||
unsigned char pk[crypto_box_PUBLICKEYBYTES];
|
||||
unsigned char sk[crypto_box_SECRETKEYBYTES];
|
||||
unsigned char *c;
|
||||
unsigned char *m;
|
||||
unsigned char *m2;
|
||||
size_t m_len;
|
||||
size_t c_len;
|
||||
|
||||
crypto_box_keypair(pk, sk);
|
||||
m_len = (size_t) randombytes_uniform(1000);
|
||||
c_len = crypto_box_SEALBYTES + m_len;
|
||||
m = (unsigned char *) sodium_malloc(m_len);
|
||||
m2 = (unsigned char *) sodium_malloc(m_len);
|
||||
c = (unsigned char *) sodium_malloc(c_len);
|
||||
randombytes_buf(m, m_len);
|
||||
if (crypto_box_seal(c, m, m_len, pk) != 0) {
|
||||
printf("crypto_box_seal() failure\n");
|
||||
return;
|
||||
}
|
||||
if (crypto_box_seal_open(m2, c, c_len, pk, sk) != 0) {
|
||||
printf("crypto_box_seal_open() failure\n");
|
||||
return;
|
||||
}
|
||||
printf("%d\n", memcmp(m, m2, m_len));
|
||||
|
||||
printf("%d\n", crypto_box_seal_open(m, c, 0U, pk, sk));
|
||||
printf("%d\n", crypto_box_seal_open(m, c, c_len - 1U, pk, sk));
|
||||
printf("%d\n", crypto_box_seal_open(m, c, c_len, sk, pk));
|
||||
|
||||
sodium_free(c);
|
||||
sodium_free(m);
|
||||
sodium_free(m2);
|
||||
|
||||
assert(crypto_box_sealbytes() == crypto_box_SEALBYTES);
|
||||
}
|
||||
|
||||
static
|
||||
void tv2(void)
|
||||
{
|
||||
unsigned char pk[crypto_box_PUBLICKEYBYTES];
|
||||
unsigned char sk[crypto_box_SECRETKEYBYTES];
|
||||
unsigned char *cm;
|
||||
unsigned char *m2;
|
||||
size_t m_len;
|
||||
size_t cm_len;
|
||||
|
||||
crypto_box_keypair(pk, sk);
|
||||
m_len = (size_t) randombytes_uniform(1000);
|
||||
cm_len = crypto_box_SEALBYTES + m_len;
|
||||
m2 = (unsigned char *) sodium_malloc(m_len);
|
||||
cm = (unsigned char *) sodium_malloc(cm_len);
|
||||
randombytes_buf(cm, m_len);
|
||||
if (crypto_box_seal(cm, cm, m_len, pk) != 0) {
|
||||
printf("crypto_box_seal() failure\n");
|
||||
return;
|
||||
}
|
||||
if (crypto_box_seal_open(m2, cm, cm_len, pk, sk) != 0) {
|
||||
printf("crypto_box_seal_open() failure\n");
|
||||
return;
|
||||
}
|
||||
assert(m_len == 0 || memcmp(cm, m2, m_len) != 0);
|
||||
sodium_free(cm);
|
||||
sodium_free(m2);
|
||||
}
|
||||
|
||||
#ifndef SODIUM_LIBRARY_MINIMAL
|
||||
static
|
||||
void tv3(void)
|
||||
{
|
||||
unsigned char pk[crypto_box_curve25519xchacha20poly1305_PUBLICKEYBYTES];
|
||||
unsigned char sk[crypto_box_curve25519xchacha20poly1305_SECRETKEYBYTES];
|
||||
unsigned char *c;
|
||||
unsigned char *m;
|
||||
unsigned char *m2;
|
||||
size_t m_len;
|
||||
size_t c_len;
|
||||
|
||||
crypto_box_curve25519xchacha20poly1305_keypair(pk, sk);
|
||||
m_len = (size_t) randombytes_uniform(1000);
|
||||
c_len = crypto_box_curve25519xchacha20poly1305_SEALBYTES + m_len;
|
||||
m = (unsigned char *) sodium_malloc(m_len);
|
||||
m2 = (unsigned char *) sodium_malloc(m_len);
|
||||
c = (unsigned char *) sodium_malloc(c_len);
|
||||
randombytes_buf(m, m_len);
|
||||
if (crypto_box_curve25519xchacha20poly1305_seal(c, m, m_len, pk) != 0) {
|
||||
printf("crypto_box_curve25519xchacha20poly1305_seal() failure\n");
|
||||
return;
|
||||
}
|
||||
if (crypto_box_curve25519xchacha20poly1305_seal_open(m2, c, c_len, pk, sk) != 0) {
|
||||
printf("crypto_box_curve25519xchacha20poly1305_seal_open() failure\n");
|
||||
return;
|
||||
}
|
||||
printf("%d\n", memcmp(m, m2, m_len));
|
||||
|
||||
printf("%d\n", crypto_box_curve25519xchacha20poly1305_seal_open(m, c, 0U, pk, sk));
|
||||
printf("%d\n", crypto_box_curve25519xchacha20poly1305_seal_open(m, c, c_len - 1U, pk, sk));
|
||||
printf("%d\n", crypto_box_curve25519xchacha20poly1305_seal_open(m, c, c_len, sk, pk));
|
||||
|
||||
sodium_free(c);
|
||||
sodium_free(m);
|
||||
sodium_free(m2);
|
||||
|
||||
assert(crypto_box_curve25519xchacha20poly1305_sealbytes() ==
|
||||
crypto_box_curve25519xchacha20poly1305_SEALBYTES);
|
||||
}
|
||||
|
||||
static
|
||||
void tv4(void)
|
||||
{
|
||||
unsigned char pk[crypto_box_curve25519xchacha20poly1305_PUBLICKEYBYTES];
|
||||
unsigned char sk[crypto_box_curve25519xchacha20poly1305_SECRETKEYBYTES];
|
||||
unsigned char *cm;
|
||||
unsigned char *m2;
|
||||
size_t m_len;
|
||||
size_t cm_len;
|
||||
|
||||
crypto_box_curve25519xchacha20poly1305_keypair(pk, sk);
|
||||
m_len = (size_t) randombytes_uniform(1000);
|
||||
cm_len = crypto_box_curve25519xchacha20poly1305_SEALBYTES + m_len;
|
||||
m2 = (unsigned char *) sodium_malloc(m_len);
|
||||
cm = (unsigned char *) sodium_malloc(cm_len);
|
||||
randombytes_buf(cm, m_len);
|
||||
if (crypto_box_curve25519xchacha20poly1305_seal(cm, cm, m_len, pk) != 0) {
|
||||
printf("crypto_box_curve25519xchacha20poly1305_seal() failure\n");
|
||||
return;
|
||||
}
|
||||
if (crypto_box_curve25519xchacha20poly1305_seal_open(m2, cm, cm_len, pk, sk) != 0) {
|
||||
printf("crypto_box_curve25519xchacha20poly1305_seal_open() failure\n");
|
||||
return;
|
||||
}
|
||||
assert(m_len == 0 || memcmp(cm, m2, m_len) != 0);
|
||||
sodium_free(cm);
|
||||
sodium_free(m2);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static
|
||||
void tv3(void)
|
||||
{
|
||||
printf("0\n-1\n-1\n-1\n");
|
||||
}
|
||||
|
||||
static
|
||||
void tv4(void)
|
||||
{ }
|
||||
#endif
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
tv1();
|
||||
tv2();
|
||||
tv3();
|
||||
tv4();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
0
|
||||
-1
|
||||
-1
|
||||
-1
|
||||
0
|
||||
-1
|
||||
-1
|
||||
-1
|
||||
@@ -0,0 +1,30 @@
|
||||
|
||||
#define TEST_NAME "box_seed"
|
||||
#include "cmptest.h"
|
||||
|
||||
static unsigned char seed[32] = { 0x77, 0x07, 0x6d, 0x0a, 0x73, 0x18, 0xa5,
|
||||
0x7d, 0x3c, 0x16, 0xc1, 0x72, 0x51, 0xb2,
|
||||
0x66, 0x45, 0xdf, 0x4c, 0x2f, 0x87, 0xeb,
|
||||
0xc0, 0x99, 0x2a, 0xb1, 0x77, 0xfb, 0xa5,
|
||||
0x1d, 0xb9, 0x2c, 0x2a };
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
int i;
|
||||
unsigned char sk[32];
|
||||
unsigned char pk[32];
|
||||
|
||||
crypto_box_seed_keypair(pk, sk, seed);
|
||||
for (i = 0; i < 32; ++i) {
|
||||
printf(",0x%02x", (unsigned int) pk[i]);
|
||||
if (i % 8 == 7)
|
||||
printf("\n");
|
||||
}
|
||||
for (i = 0; i < 32; ++i) {
|
||||
printf(",0x%02x", (unsigned int) sk[i]);
|
||||
if (i % 8 == 7)
|
||||
printf("\n");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
,0xed,0x77,0x49,0xb4,0xd9,0x89,0xf6,0x95
|
||||
,0x7f,0x3b,0xfd,0xe6,0xc5,0x67,0x67,0xe9
|
||||
,0x88,0xe2,0x1c,0x9f,0x87,0x84,0xd9,0x1d
|
||||
,0x61,0x00,0x11,0xcd,0x55,0x3f,0x9b,0x06
|
||||
,0xac,0xcd,0x44,0xeb,0x8e,0x93,0x31,0x9c
|
||||
,0x05,0x70,0xbc,0x11,0x00,0x5c,0x0e,0x01
|
||||
,0x89,0xd3,0x4f,0xf0,0x2f,0x6c,0x17,0x77
|
||||
,0x34,0x11,0xad,0x19,0x12,0x93,0xc9,0x8f
|
||||
@@ -0,0 +1,186 @@
|
||||
|
||||
#define TEST_NAME "chacha20"
|
||||
#include "cmptest.h"
|
||||
|
||||
static
|
||||
void tv(void)
|
||||
{
|
||||
static struct {
|
||||
const char *key_hex;
|
||||
const char *nonce_hex;
|
||||
} tests[]
|
||||
= { { "0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"0000000000000000" },
|
||||
{ "0000000000000000000000000000000000000000000000000000000000000001",
|
||||
"0000000000000000" },
|
||||
{ "0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"0000000000000001" },
|
||||
{ "0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"0100000000000000" },
|
||||
{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
"0001020304050607" } };
|
||||
unsigned char key[crypto_stream_chacha20_KEYBYTES];
|
||||
unsigned char nonce[crypto_stream_chacha20_NONCEBYTES];
|
||||
unsigned char *part;
|
||||
unsigned char out[160];
|
||||
unsigned char zero[160];
|
||||
char out_hex[160 * 2 + 1];
|
||||
size_t i = 0U;
|
||||
size_t plen;
|
||||
|
||||
memset(zero, 0, sizeof zero);
|
||||
do {
|
||||
sodium_hex2bin((unsigned char *)key, sizeof key, tests[i].key_hex,
|
||||
strlen(tests[i].key_hex), NULL, NULL, NULL);
|
||||
sodium_hex2bin(nonce, sizeof nonce, tests[i].nonce_hex,
|
||||
strlen(tests[i].nonce_hex), NULL, NULL, NULL);
|
||||
crypto_stream_chacha20(out, sizeof out, nonce, key);
|
||||
sodium_bin2hex(out_hex, sizeof out_hex, out, sizeof out);
|
||||
printf("[%s]\n", out_hex);
|
||||
for (plen = 1U; plen < sizeof out; plen++) {
|
||||
part = (unsigned char *) sodium_malloc(plen);
|
||||
crypto_stream_chacha20_xor(part, out, plen, nonce, key);
|
||||
if (memcmp(part, zero, plen) != 0) {
|
||||
printf("Failed with length %lu\n", (unsigned long) plen);
|
||||
}
|
||||
sodium_free(part);
|
||||
}
|
||||
} while (++i < (sizeof tests) / (sizeof tests[0]));
|
||||
assert(66 <= sizeof out);
|
||||
for (plen = 1U; plen < 66; plen += 3) {
|
||||
memset(out, (int) (plen & 0xff), sizeof out);
|
||||
crypto_stream_chacha20(out, plen, nonce, key);
|
||||
sodium_bin2hex(out_hex, sizeof out_hex, out, sizeof out);
|
||||
printf("[%s]\n", out_hex);
|
||||
}
|
||||
randombytes_buf(out, sizeof out);
|
||||
crypto_stream_chacha20(out, sizeof out, nonce, key);
|
||||
sodium_bin2hex(out_hex, sizeof out_hex, out, sizeof out);
|
||||
printf("[%s]\n", out_hex);
|
||||
|
||||
assert(crypto_stream_chacha20(out, 0U, nonce, key) == 0);
|
||||
assert(crypto_stream_chacha20_xor(out, out, 0U, nonce, key) == 0);
|
||||
assert(crypto_stream_chacha20_xor(out, out, 0U, nonce, key) == 0);
|
||||
assert(crypto_stream_chacha20_xor_ic(out, out, 0U, nonce, 1U, key) == 0);
|
||||
|
||||
memset(out, 0x42, sizeof out);
|
||||
crypto_stream_chacha20_xor(out, out, sizeof out, nonce, key);
|
||||
sodium_bin2hex(out_hex, sizeof out_hex, out, sizeof out);
|
||||
printf("[%s]\n", out_hex);
|
||||
|
||||
crypto_stream_chacha20_xor_ic(out, out, sizeof out, nonce, 0U, key);
|
||||
sodium_bin2hex(out_hex, sizeof out_hex, out, sizeof out);
|
||||
printf("[%s]\n", out_hex);
|
||||
|
||||
crypto_stream_chacha20_xor_ic(out, out, sizeof out, nonce, 1U, key);
|
||||
sodium_bin2hex(out_hex, sizeof out_hex, out, sizeof out);
|
||||
printf("[%s]\n", out_hex);
|
||||
}
|
||||
|
||||
static
|
||||
void tv_ietf(void)
|
||||
{
|
||||
static struct {
|
||||
const char *key_hex;
|
||||
const char *nonce_hex;
|
||||
uint32_t ic;
|
||||
} tests[]
|
||||
= { { "0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"000000000000000000000000",
|
||||
0U },
|
||||
{ "0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"000000000000000000000000",
|
||||
1U },
|
||||
{ "0000000000000000000000000000000000000000000000000000000000000001",
|
||||
"000000000000000000000000",
|
||||
1U },
|
||||
{ "00ff000000000000000000000000000000000000000000000000000000000000",
|
||||
"000000000000000000000000",
|
||||
2U },
|
||||
{ "0000000000000000000000000000000000000000000000000000000000000000",
|
||||
"000000000000000000000002",
|
||||
0U },
|
||||
{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
"000000090000004a00000000",
|
||||
1U },
|
||||
{ "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f",
|
||||
"000000090000004a00000000",
|
||||
0xfeffffff }};
|
||||
unsigned char key[crypto_stream_chacha20_KEYBYTES];
|
||||
unsigned char nonce[crypto_stream_chacha20_IETF_NONCEBYTES];
|
||||
unsigned char *part;
|
||||
unsigned char out[160];
|
||||
unsigned char zero[160];
|
||||
char out_hex[160 * 2 + 1];
|
||||
size_t i = 0U;
|
||||
size_t plen;
|
||||
|
||||
memset(zero, 0, sizeof zero);
|
||||
do {
|
||||
sodium_hex2bin((unsigned char *)key, sizeof key, tests[i].key_hex,
|
||||
strlen(tests[i].key_hex), ": ", NULL, NULL);
|
||||
sodium_hex2bin(nonce, sizeof nonce, tests[i].nonce_hex,
|
||||
strlen(tests[i].nonce_hex), ": ", NULL, NULL);
|
||||
memset(out, 0, sizeof out);
|
||||
crypto_stream_chacha20_ietf_xor_ic(out, out, sizeof out, nonce, tests[i].ic, key);
|
||||
sodium_bin2hex(out_hex, sizeof out_hex, out, sizeof out);
|
||||
printf("[%s]\n", out_hex);
|
||||
for (plen = 1U; plen < sizeof out; plen++) {
|
||||
part = (unsigned char *) sodium_malloc(plen);
|
||||
crypto_stream_chacha20_ietf_xor_ic(part, out, plen, nonce, tests[i].ic, key);
|
||||
if (memcmp(part, zero, plen) != 0) {
|
||||
printf("Failed with length %lu\n", (unsigned long) plen);
|
||||
}
|
||||
sodium_free(part);
|
||||
}
|
||||
} while (++i < (sizeof tests) / (sizeof tests[0]));
|
||||
assert(66 <= sizeof out);
|
||||
for (plen = 1U; plen < 66; plen += 3) {
|
||||
memset(out, (int) (plen & 0xff), sizeof out);
|
||||
crypto_stream_chacha20_ietf(out, plen, nonce, key);
|
||||
sodium_bin2hex(out_hex, sizeof out_hex, out, sizeof out);
|
||||
printf("[%s]\n", out_hex);
|
||||
}
|
||||
randombytes_buf(out, sizeof out);
|
||||
crypto_stream_chacha20_ietf(out, sizeof out, nonce, key);
|
||||
sodium_bin2hex(out_hex, sizeof out_hex, out, sizeof out);
|
||||
printf("[%s]\n", out_hex);
|
||||
|
||||
assert(crypto_stream_chacha20_ietf(out, 0U, nonce, key) == 0);
|
||||
assert(crypto_stream_chacha20_ietf_xor(out, out, 0U, nonce, key) == 0);
|
||||
assert(crypto_stream_chacha20_ietf_xor(out, out, 0U, nonce, key) == 0);
|
||||
assert(crypto_stream_chacha20_ietf_xor_ic(out, out, 0U, nonce, 1U, key) == 0);
|
||||
|
||||
memset(out, 0x42, sizeof out);
|
||||
crypto_stream_chacha20_ietf_xor(out, out, sizeof out, nonce, key);
|
||||
sodium_bin2hex(out_hex, sizeof out_hex, out, sizeof out);
|
||||
printf("[%s]\n", out_hex);
|
||||
|
||||
crypto_stream_chacha20_ietf_xor_ic(out, out, sizeof out, nonce, 0U, key);
|
||||
sodium_bin2hex(out_hex, sizeof out_hex, out, sizeof out);
|
||||
printf("[%s]\n", out_hex);
|
||||
|
||||
crypto_stream_chacha20_ietf_xor_ic(out, out, sizeof out, nonce, 1U, key);
|
||||
sodium_bin2hex(out_hex, sizeof out_hex, out, sizeof out);
|
||||
printf("[%s]\n", out_hex);
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
tv();
|
||||
tv_ietf();
|
||||
|
||||
assert(crypto_stream_chacha20_keybytes() > 0U);
|
||||
assert(crypto_stream_chacha20_keybytes() == crypto_stream_chacha20_KEYBYTES);
|
||||
assert(crypto_stream_chacha20_noncebytes() > 0U);
|
||||
assert(crypto_stream_chacha20_noncebytes() == crypto_stream_chacha20_NONCEBYTES);
|
||||
assert(crypto_stream_chacha20_messagebytes_max() == crypto_stream_chacha20_MESSAGEBYTES_MAX);
|
||||
assert(crypto_stream_chacha20_ietf_keybytes() > 0U);
|
||||
assert(crypto_stream_chacha20_ietf_keybytes() == crypto_stream_chacha20_ietf_KEYBYTES);
|
||||
assert(crypto_stream_chacha20_ietf_noncebytes() > 0U);
|
||||
assert(crypto_stream_chacha20_ietf_noncebytes() == crypto_stream_chacha20_ietf_NONCEBYTES);
|
||||
assert(crypto_stream_chacha20_ietf_messagebytes_max() == crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
[76b8e0ada0f13d90405d6ae55386bd28bdd219b8a08ded1aa836efcc8b770dc7da41597c5157488d7724e03fb8d84a376a43b8f41518a11cc387b669b2ee65869f07e7be5551387a98ba977c732d080dcb0f29a048e3656912c6533e32ee7aed29b721769ce64e43d57133b074d839d531ed1f28510afb45ace10a1f4b794d6f2d09a0e663266ce1ae7ed1081968a0758e718e997bd362c6b0c34634a9a0b35d]
|
||||
[4540f05a9f1fb296d7736e7b208e3c96eb4fe1834688d2604f450952ed432d41bbe2a0b6ea7566d2a5d1e7e20d42af2c53d792b1c43fea817e9ad275ae5469633aeb5224ecf849929b9d828db1ced4dd832025e8018b8160b82284f3c949aa5a8eca00bbb4a73bdad192b5c42f73f2fd4e273644c8b36125a64addeb006c13a096d68b9ff7b57e7090f880392effd5b297a83bbaf2fbe8cf5d4618965e3dc776]
|
||||
[de9cba7bf3d69ef5e786dc63973f653a0b49e015adbff7134fcb7df137821031e85a050278a7084527214f73efc7fa5b5277062eb7a0433e445f41e31afab757283547e3d3d30ee0371c1e6025ff4c91b794a291cf7568d48ff84b37329e2730b12738a072a2b2c7169e326fe4893a7b2421bb910b79599a7ce4fbaee86be427c5ee0e8225eb6f48231fd504939d59eac8bd106cc138779b893c54da8758f62a]
|
||||
[ef3fdfd6c61578fbf5cf35bd3dd33b8009631634d21e42ac33960bd138e50d32111e4caf237ee53ca8ad6426194a88545ddc497a0b466e7d6bbdb0041b2f586b5305e5e44aff19b235936144675efbe4409eb7e8e5f1430f5f5836aeb49bb5328b017c4b9dc11f8a03863fa803dc71d5726b2b6b31aa32708afe5af1d6b690584d58792b271e5fdb92c486051c48b79a4d48a109bb2d0477956e74c25e93c3c2]
|
||||
[f798a189f195e66982105ffb640bb7757f579da31602fc93ec01ac56f85ac3c134a4547b733b46413042c9440049176905d3be59ea1c53f15916155c2be8241a38008b9a26bc35941e2444177c8ade6689de95264986d95889fb60e84629c9bd9a5acb1cc118be563eb9b3a4a472f82e09a7e778492b562ef7130e88dfe031c79db9d4f7c7a899151b9a475032b63fc385245fe054e3dd5a97a5f576fe064025]
|
||||
[f7010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101]
|
||||
[f798a189040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404]
|
||||
[f798a189f195e6070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707]
|
||||
[f798a189f195e66982100a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a]
|
||||
[f798a189f195e66982105ffb640d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d]
|
||||
[f798a189f195e66982105ffb640bb775101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010]
|
||||
[f798a189f195e66982105ffb640bb7757f579d131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313]
|
||||
[f798a189f195e66982105ffb640bb7757f579da31602161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616]
|
||||
[f798a189f195e66982105ffb640bb7757f579da31602fc93ec191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919]
|
||||
[f798a189f195e66982105ffb640bb7757f579da31602fc93ec01ac561c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c]
|
||||
[f798a189f195e66982105ffb640bb7757f579da31602fc93ec01ac56f85ac31f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f]
|
||||
[f798a189f195e66982105ffb640bb7757f579da31602fc93ec01ac56f85ac3c134a4222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222]
|
||||
[f798a189f195e66982105ffb640bb7757f579da31602fc93ec01ac56f85ac3c134a4547b73252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525]
|
||||
[f798a189f195e66982105ffb640bb7757f579da31602fc93ec01ac56f85ac3c134a4547b733b4641282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828]
|
||||
[f798a189f195e66982105ffb640bb7757f579da31602fc93ec01ac56f85ac3c134a4547b733b46413042c92b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b]
|
||||
[f798a189f195e66982105ffb640bb7757f579da31602fc93ec01ac56f85ac3c134a4547b733b46413042c94400492e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e]
|
||||
[f798a189f195e66982105ffb640bb7757f579da31602fc93ec01ac56f85ac3c134a4547b733b46413042c9440049176905313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131]
|
||||
[f798a189f195e66982105ffb640bb7757f579da31602fc93ec01ac56f85ac3c134a4547b733b46413042c9440049176905d3be59343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434]
|
||||
[f798a189f195e66982105ffb640bb7757f579da31602fc93ec01ac56f85ac3c134a4547b733b46413042c9440049176905d3be59ea1c53373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737]
|
||||
[f798a189f195e66982105ffb640bb7757f579da31602fc93ec01ac56f85ac3c134a4547b733b46413042c9440049176905d3be59ea1c53f159163a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a]
|
||||
[f798a189f195e66982105ffb640bb7757f579da31602fc93ec01ac56f85ac3c134a4547b733b46413042c9440049176905d3be59ea1c53f15916155c2b3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d]
|
||||
[f798a189f195e66982105ffb640bb7757f579da31602fc93ec01ac56f85ac3c134a4547b733b46413042c9440049176905d3be59ea1c53f15916155c2be8241a404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040]
|
||||
[f798a189f195e66982105ffb640bb7757f579da31602fc93ec01ac56f85ac3c134a4547b733b46413042c9440049176905d3be59ea1c53f15916155c2be8241a38008b9a26bc35941e2444177c8ade6689de95264986d95889fb60e84629c9bd9a5acb1cc118be563eb9b3a4a472f82e09a7e778492b562ef7130e88dfe031c79db9d4f7c7a899151b9a475032b63fc385245fe054e3dd5a97a5f576fe064025]
|
||||
[b5dae3cbb3d7a42bc0521db92649f5373d15dfe15440bed1ae43ee14ba18818376e616393179040372008b06420b552b4791fc1ba85e11b31b54571e69aa66587a42c9d864fe77d65c6606553ec89c24cb9cd7640bc49b1acbb922aa046b8bffd818895e835afc147cfbf1e6e630ba6c4be5a53a0b69146cb5514cca9da27385dffb96b585eadb5759d8051270f47d81c7661da216a19f18d5e7b734bc440267]
|
||||
[42424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242]
|
||||
[7a42c9d864fe77d65c6606553ec89c24cb9cd7640bc49b1acbb922aa046b8bffd818895e835afc147cfbf1e6e630ba6c4be5a53a0b69146cb5514cca9da27385dffb96b585eadb5759d8051270f47d81c7661da216a19f18d5e7b734bc440267918c466e1428f08745f37a99c77c7f2b1b244bd4162e8b86e4a8bf85358202954ced04b52fef7b3ba787744e715554285ecb0ed6e133c528d69d346abc0ce8b0]
|
||||
[76b8e0ada0f13d90405d6ae55386bd28bdd219b8a08ded1aa836efcc8b770dc7da41597c5157488d7724e03fb8d84a376a43b8f41518a11cc387b669b2ee65869f07e7be5551387a98ba977c732d080dcb0f29a048e3656912c6533e32ee7aed29b721769ce64e43d57133b074d839d531ed1f28510afb45ace10a1f4b794d6f2d09a0e663266ce1ae7ed1081968a0758e718e997bd362c6b0c34634a9a0b35d]
|
||||
[9f07e7be5551387a98ba977c732d080dcb0f29a048e3656912c6533e32ee7aed29b721769ce64e43d57133b074d839d531ed1f28510afb45ace10a1f4b794d6f2d09a0e663266ce1ae7ed1081968a0758e718e997bd362c6b0c34634a9a0b35d012737681f7b5d0f281e3afde458bc1e73d2d313c9cf94c05ff3716240a248f21320a058d7b3566bd520daaa3ed2bf0ac5b8b120fb852773c3639734b45c91a4]
|
||||
[3aeb5224ecf849929b9d828db1ced4dd832025e8018b8160b82284f3c949aa5a8eca00bbb4a73bdad192b5c42f73f2fd4e273644c8b36125a64addeb006c13a096d68b9ff7b57e7090f880392effd5b297a83bbaf2fbe8cf5d4618965e3dc776cd430d9b4e7eda8a767fb0e860319aadb5fd96a855de1fbfc92cb0489190cfdd87da6dbf1f736a2d499941ca097e5170bd685578611323120cebf296181ed4f5]
|
||||
[72d54dfbf12ec44b362692df94137f328fea8da73990265ec1bbbea1ae9af0ca13b25aa26cb4a648cb9b9d1be65b2c0924a66c54d545ec1b7374f4872e99f096bf74dbd52cc4fc95ceb6097fe5e65358c9dbc0a5ecbf7894a132a9a54ae3e951f2e9f209aa9c3d9a877ac9dab62433d2961a17d103e455dfb7337c90f6857aad233065955a212b5c7a8eab4dc8a629e5b6b8ba914afd06de7177054b33d21c96]
|
||||
[c2c64d378cd536374ae204b9ef933fcd1a8b2288b3dfa49672ab765b54ee27c78a970e0e955c14f3a88e741b97c286f75f8fc299e8148362fa198a39531bed6d1a91288c874ec254f322c2a197340c55bb3e9b3998f7de2309486a0bb494abd20c9c5ef99c1370d61e77f408ac5514f49202bcc6828d45409d2d1416f8ae106b06ebd2541256264fa415bd54cb12e1d4449ed85299a1b7a249b75ff6c89b2e3f]
|
||||
[10f1e7e4d13b5915500fdd1fa32071c4c7d1f4c733c068030422aa9ac3d46c4ed2826446079faa0914c2d705d98b02a2b5129cd1de164eb9cbd083e8a2503c4e0a88837739d7bf4ef8ccacb0ea2bb9d69d56c394aa351dfda5bf459f0a2e9fe8e721f89255f9c486bf21679c683d4f9c5cf2fa27865526005b06ca374c86af3bdcbfbdcb83be65862ed5c20eae5a43241d6a92da6dca9a156be25297f51c2718]
|
||||
[75924bad7831b25662dbac54b46827990b6168ae990e7bd7e1fd2ad282bf23ef052c7d1a0a6c1ef862070943a0d4da24705fbc006dfb85e2af18c0a264d772a44c70fbedac9d6a6867ff6be0a32826507f2c784101583211c9e2453d4cc8b283d5e86682bd4bf511271b91dbd351415f5a009d1f78b64085a9a4341be7d42e2679d57e2747097f0129950e2c9e9ca1356022d45da252af71ac37f351a2e77911]
|
||||
[8a010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101]
|
||||
[8adc91fd040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404]
|
||||
[8adc91fd9ff4f0070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707070707]
|
||||
[8adc91fd9ff4f0f51b0f0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a0a]
|
||||
[8adc91fd9ff4f0f51b0fad50ff0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d0d]
|
||||
[8adc91fd9ff4f0f51b0fad50ff15d637101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010]
|
||||
[8adc91fd9ff4f0f51b0fad50ff15d637e40efd131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313]
|
||||
[8adc91fd9ff4f0f51b0fad50ff15d637e40efda206cc161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616]
|
||||
[8adc91fd9ff4f0f51b0fad50ff15d637e40efda206cc52c783191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919191919]
|
||||
[8adc91fd9ff4f0f51b0fad50ff15d637e40efda206cc52c783a742001c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c1c]
|
||||
[8adc91fd9ff4f0f51b0fad50ff15d637e40efda206cc52c783a74200503c151f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f1f]
|
||||
[8adc91fd9ff4f0f51b0fad50ff15d637e40efda206cc52c783a74200503c1582cd98222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222]
|
||||
[8adc91fd9ff4f0f51b0fad50ff15d637e40efda206cc52c783a74200503c1582cd9833367d252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525252525]
|
||||
[8adc91fd9ff4f0f51b0fad50ff15d637e40efda206cc52c783a74200503c1582cd9833367d0a54d5282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828282828]
|
||||
[8adc91fd9ff4f0f51b0fad50ff15d637e40efda206cc52c783a74200503c1582cd9833367d0a54d57d3c9e2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b2b]
|
||||
[8adc91fd9ff4f0f51b0fad50ff15d637e40efda206cc52c783a74200503c1582cd9833367d0a54d57d3c9e998f492e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e2e]
|
||||
[8adc91fd9ff4f0f51b0fad50ff15d637e40efda206cc52c783a74200503c1582cd9833367d0a54d57d3c9e998f490ee69c313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131]
|
||||
[8adc91fd9ff4f0f51b0fad50ff15d637e40efda206cc52c783a74200503c1582cd9833367d0a54d57d3c9e998f490ee69ca34c1f343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434343434]
|
||||
[8adc91fd9ff4f0f51b0fad50ff15d637e40efda206cc52c783a74200503c1582cd9833367d0a54d57d3c9e998f490ee69ca34c1ff9e939373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737373737]
|
||||
[8adc91fd9ff4f0f51b0fad50ff15d637e40efda206cc52c783a74200503c1582cd9833367d0a54d57d3c9e998f490ee69ca34c1ff9e939a755843a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a]
|
||||
[8adc91fd9ff4f0f51b0fad50ff15d637e40efda206cc52c783a74200503c1582cd9833367d0a54d57d3c9e998f490ee69ca34c1ff9e939a75584c52d693d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d3d]
|
||||
[8adc91fd9ff4f0f51b0fad50ff15d637e40efda206cc52c783a74200503c1582cd9833367d0a54d57d3c9e998f490ee69ca34c1ff9e939a75584c52d690a35d4404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040404040]
|
||||
[8adc91fd9ff4f0f51b0fad50ff15d637e40efda206cc52c783a74200503c1582cd9833367d0a54d57d3c9e998f490ee69ca34c1ff9e939a75584c52d690a35d410f1e7e4d13b5915500fdd1fa32071c4c7d1f4c733c068030422aa9ac3d46c4ed2826446079faa0914c2d705d98b02a2b5129cd1de164eb9cbd083e8a2503c4e0a88837739d7bf4ef8ccacb0ea2bb9d69d56c394aa351dfda5bf459f0a2e9fe8]
|
||||
[c89ed3bfddb6b2b7594def12bd579475a64cbfe0448e1085c1e50042127e57c08fda71743f4816973f7edcdbcd0b4ca4dee10e5dbbab7be517c6876f2b48779652b3a5a693791b57124d9f5de16233868593b68571822a414660e8d881962e0c90c0260445dde84b568095479bc940e0f750de939c540cfb8992c1aae0127e0c48cac1357b95fd0cba8eeef2a869fb94df1481d6e8775fbfe7fd07dd486cddaa]
|
||||
[42424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242]
|
||||
[52b3a5a693791b57124d9f5de16233868593b68571822a414660e8d881962e0c90c0260445dde84b568095479bc940e0f750de939c540cfb8992c1aae0127e0c48cac1357b95fd0cba8eeef2a869fb94df1481d6e8775fbfe7fd07dd486cddaaa563bad017bb86c4fd6325de2a7f0dde1eb0b865c4176442194488750ec4ed799efdff89c1fc27c46c97804cec1801665f28d0982f88d85729a010d5b75e655a]
|
||||
238
components/espressif__libsodium/libsodium/test/default/cmptest.h
Normal file
238
components/espressif__libsodium/libsodium/test/default/cmptest.h
Normal file
@@ -0,0 +1,238 @@
|
||||
|
||||
#ifndef __CMPTEST_H__
|
||||
#define __CMPTEST_H__
|
||||
|
||||
#ifdef NDEBUG
|
||||
#/**/undef/**/ NDEBUG
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "sodium.h"
|
||||
#include "quirks.h"
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
# undef TEST_SRCDIR
|
||||
# define TEST_SRCDIR "/test-data"
|
||||
#endif
|
||||
#ifndef TEST_SRCDIR
|
||||
# define TEST_SRCDIR "."
|
||||
#endif
|
||||
|
||||
#define TEST_NAME_RES TEST_NAME ".res"
|
||||
#define TEST_NAME_OUT TEST_SRCDIR "/" TEST_NAME ".exp"
|
||||
|
||||
#ifdef HAVE_ARC4RANDOM
|
||||
# undef rand
|
||||
# define rand(X) arc4random(X)
|
||||
#endif
|
||||
|
||||
int xmain(void);
|
||||
|
||||
static unsigned char *guard_page;
|
||||
|
||||
#ifdef BENCHMARKS
|
||||
|
||||
# include <sys/time.h>
|
||||
|
||||
# ifndef ITERATIONS
|
||||
# define ITERATIONS 128
|
||||
# endif
|
||||
|
||||
struct {
|
||||
void *pnt;
|
||||
size_t size;
|
||||
} mempool[1024];
|
||||
|
||||
static size_t mempool_idx;
|
||||
|
||||
static __attribute__((malloc)) void *mempool_alloc(size_t size)
|
||||
{
|
||||
size_t i;
|
||||
if (size >= (size_t) 0x80000000 - (size_t) 0x00000fff) {
|
||||
return NULL;
|
||||
}
|
||||
size = (size + (size_t) 0x00000fff) & ~ (size_t) 0x00000fff;
|
||||
for (i = 0U; i < mempool_idx; i++) {
|
||||
if (mempool[i].size >= (size | (size_t) 0x80000000)) {
|
||||
mempool[i].size &= ~ (size_t) 0x80000000;
|
||||
return mempool[i].pnt;
|
||||
}
|
||||
}
|
||||
if (mempool_idx >= sizeof mempool / sizeof mempool[0]) {
|
||||
return NULL;
|
||||
}
|
||||
mempool[mempool_idx].size = size;
|
||||
return (mempool[mempool_idx++].pnt = (void *) malloc(size));
|
||||
}
|
||||
|
||||
static void mempool_free(void *pnt)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0U; i < mempool_idx; i++) {
|
||||
if (mempool[i].pnt == pnt) {
|
||||
if ((mempool[i].size & (size_t) 0x80000000) != (size_t) 0x0) {
|
||||
break;
|
||||
}
|
||||
mempool[i].size |= (size_t) 0x80000000;
|
||||
return;
|
||||
}
|
||||
}
|
||||
abort();
|
||||
}
|
||||
|
||||
static __attribute__((malloc)) void *mempool_allocarray(size_t count, size_t size)
|
||||
{
|
||||
if (count > (size_t) 0U && size >= (size_t) SIZE_MAX / count) {
|
||||
return NULL;
|
||||
}
|
||||
return mempool_alloc(count * size);
|
||||
}
|
||||
|
||||
static int mempool_free_all(void)
|
||||
{
|
||||
size_t i;
|
||||
int ret = 0;
|
||||
|
||||
for (i = 0U; i < mempool_idx; i++) {
|
||||
if ((mempool[i].size & (size_t) 0x80000000) == (size_t) 0x0) {
|
||||
ret = -1;
|
||||
}
|
||||
free(mempool[i].pnt);
|
||||
mempool[i].pnt = NULL;
|
||||
}
|
||||
mempool_idx = (size_t) 0U;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#define sodium_malloc(X) mempool_alloc(X)
|
||||
#define sodium_free(X) mempool_free(X)
|
||||
#define sodium_allocarray(X, Y) mempool_allocarray((X), (Y))
|
||||
|
||||
static unsigned long long now(void)
|
||||
{
|
||||
#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
|
||||
struct timespec tp;
|
||||
|
||||
if (clock_gettime(CLOCK_MONOTONIC, &tp) != 0) {
|
||||
abort();
|
||||
}
|
||||
return (unsigned long long) tp.tv_sec * 1000000ULL +
|
||||
(unsigned long long) tp.tv_nsec / 1000ULL;
|
||||
#else
|
||||
struct timeval tp;
|
||||
|
||||
if (gettimeofday(&tp, NULL) != 0) {
|
||||
abort();
|
||||
}
|
||||
return (unsigned long long) tp.tv_sec * 1000000ULL +
|
||||
(unsigned long long) tp.tv_usec;
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
unsigned long long ts_start;
|
||||
unsigned long long ts_end;
|
||||
unsigned int i;
|
||||
|
||||
if (sodium_init() != 0) {
|
||||
return 99;
|
||||
}
|
||||
|
||||
#ifndef __EMSCRIPTEN__
|
||||
randombytes_set_implementation(&randombytes_salsa20_implementation);
|
||||
#endif
|
||||
ts_start = now();
|
||||
for (i = 0; i < ITERATIONS; i++) {
|
||||
if (xmain() != 0) {
|
||||
abort();
|
||||
}
|
||||
}
|
||||
ts_end = now();
|
||||
printf("%llu\n", 1000000ULL * (ts_end - ts_start) / ITERATIONS);
|
||||
if (mempool_free_all() != 0) {
|
||||
fprintf(stderr, "** memory leaks detected **\n");
|
||||
return 99;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#undef printf
|
||||
#define printf(...) do { } while(0)
|
||||
|
||||
#elif !defined(BROWSER_TESTS)
|
||||
|
||||
static FILE *fp_res;
|
||||
|
||||
int main(void)
|
||||
{
|
||||
FILE *fp_out;
|
||||
unsigned char *_guard_page;
|
||||
int c;
|
||||
|
||||
if ((fp_res = fopen(TEST_NAME_RES, "w+")) == NULL) {
|
||||
perror("fopen(" TEST_NAME_RES ")");
|
||||
return 99;
|
||||
}
|
||||
if (sodium_init() != 0) {
|
||||
return 99;
|
||||
}
|
||||
# if defined(__EMSCRIPTEN__) || defined(__SANITIZE_ADDRESS__)
|
||||
guard_page = _guard_page = NULL;
|
||||
#else
|
||||
if ((_guard_page = (unsigned char *) sodium_malloc(0)) == NULL) {
|
||||
perror("sodium_malloc()");
|
||||
return 99;
|
||||
}
|
||||
guard_page = _guard_page + 1;
|
||||
#endif
|
||||
if (xmain() != 0) {
|
||||
return 99;
|
||||
}
|
||||
fflush(fp_res);
|
||||
rewind(fp_res);
|
||||
if ((fp_out = fopen(TEST_NAME_OUT, "r")) == NULL) {
|
||||
perror("fopen(" TEST_NAME_OUT ")");
|
||||
return 99;
|
||||
}
|
||||
do {
|
||||
if ((c = fgetc(fp_res)) != fgetc(fp_out)) {
|
||||
return 99;
|
||||
}
|
||||
} while (c != EOF);
|
||||
sodium_free(_guard_page);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#undef printf
|
||||
#define printf(...) fprintf(fp_res, __VA_ARGS__)
|
||||
|
||||
#else
|
||||
|
||||
int main(void)
|
||||
{
|
||||
if (sodium_init() != 0) {
|
||||
return 99;
|
||||
}
|
||||
if (xmain() != 0) {
|
||||
return 99;
|
||||
}
|
||||
printf("--- SUCCESS ---\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#define main xmain
|
||||
|
||||
#endif
|
||||
251
components/espressif__libsodium/libsodium/test/default/codecs.c
Normal file
251
components/espressif__libsodium/libsodium/test/default/codecs.c
Normal file
@@ -0,0 +1,251 @@
|
||||
#define TEST_NAME "codecs"
|
||||
#include "cmptest.h"
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
unsigned char buf1[1000];
|
||||
char buf3[33];
|
||||
unsigned char buf4[4];
|
||||
const char *b64;
|
||||
char *b64_;
|
||||
const char *b64_end;
|
||||
unsigned char *bin;
|
||||
const char *hex;
|
||||
const char *hex_end;
|
||||
size_t b64_len;
|
||||
size_t bin_len;
|
||||
unsigned int i;
|
||||
|
||||
printf("%s\n",
|
||||
sodium_bin2hex(buf3, 33U, (const unsigned char *) "0123456789ABCDEF",
|
||||
16U));
|
||||
printf("bin2hex(..., guard_page, 0):%s\n",
|
||||
sodium_bin2hex(buf3, sizeof buf3, guard_page, 0U));
|
||||
printf("bin2hex(..., \"\", 0):%s\n",
|
||||
sodium_bin2hex(buf3, sizeof buf3, (const unsigned char *) "", 0U));
|
||||
|
||||
hex = "Cafe : 6942";
|
||||
sodium_hex2bin(buf4, sizeof buf4, hex, strlen(hex), ": ", &bin_len,
|
||||
&hex_end);
|
||||
printf("%lu:%02x%02x%02x%02x\n", (unsigned long) bin_len,
|
||||
buf4[0], buf4[1], buf4[2], buf4[3]);
|
||||
printf("dt1: %ld\n", (long) (hex_end - hex));
|
||||
|
||||
hex = "Cafe : 6942";
|
||||
sodium_hex2bin(buf4, sizeof buf4, hex, strlen(hex), ": ", &bin_len, NULL);
|
||||
printf("%lu:%02x%02x%02x%02x\n", (unsigned long) bin_len,
|
||||
buf4[0], buf4[1], buf4[2], buf4[3]);
|
||||
|
||||
hex = "deadbeef";
|
||||
if (sodium_hex2bin(buf1, 1U, hex, 8U, NULL, &bin_len, &hex_end) != -1) {
|
||||
printf("sodium_hex2bin() overflow not detected\n");
|
||||
}
|
||||
printf("dt2: %ld\n", (long) (hex_end - hex));
|
||||
|
||||
hex = "de:ad:be:eff";
|
||||
if (sodium_hex2bin(buf1, 4U, hex, 12U, ":", &bin_len, &hex_end) != -1) {
|
||||
printf(
|
||||
"sodium_hex2bin() with an odd input length and a short output "
|
||||
"buffer\n");
|
||||
}
|
||||
printf("dt3: %ld\n", (long) (hex_end - hex));
|
||||
|
||||
hex = "de:ad:be:eff";
|
||||
if (sodium_hex2bin(buf1, sizeof buf1, hex, 12U, ":",
|
||||
&bin_len, &hex_end) != -1) {
|
||||
printf("sodium_hex2bin() with an odd input length\n");
|
||||
}
|
||||
printf("dt4: %ld\n", (long) (hex_end - hex));
|
||||
|
||||
hex = "de:ad:be:eff";
|
||||
if (sodium_hex2bin(buf1, sizeof buf1, hex, 13U, ":",
|
||||
&bin_len, &hex_end) != -1) {
|
||||
printf("sodium_hex2bin() with an odd input length (2)\n");
|
||||
}
|
||||
printf("dt5: %ld\n", (long) (hex_end - hex));
|
||||
|
||||
hex = "de:ad:be:eff";
|
||||
if (sodium_hex2bin(buf1, sizeof buf1, hex, 12U, ":",
|
||||
&bin_len, NULL) != -1) {
|
||||
printf("sodium_hex2bin() with an odd input length and no end pointer\n");
|
||||
}
|
||||
|
||||
hex = "de:ad:be:ef*";
|
||||
if (sodium_hex2bin(buf1, sizeof buf1, hex, 12U, ":",
|
||||
&bin_len, &hex_end) != 0) {
|
||||
printf("sodium_hex2bin() with an extra character and an end pointer\n");
|
||||
}
|
||||
printf("dt6: %ld\n", (long) (hex_end - hex));
|
||||
|
||||
hex = "de:ad:be:ef*";
|
||||
if (sodium_hex2bin(buf1, sizeof buf1, hex, 12U, ":",
|
||||
&bin_len, NULL) != -1) {
|
||||
printf("sodium_hex2bin() with an extra character and no end pointer\n");
|
||||
}
|
||||
|
||||
assert(sodium_hex2bin(buf4, sizeof buf4, (const char *) guard_page, 0U,
|
||||
NULL, &bin_len, NULL) == 0);
|
||||
assert(bin_len == 0);
|
||||
|
||||
assert(sodium_hex2bin(buf4, sizeof buf4, "", 0U, NULL, &bin_len, NULL) == 0);
|
||||
assert(bin_len == 0);
|
||||
|
||||
printf("%s\n",
|
||||
sodium_bin2base64(buf3, 31U, (const unsigned char *) "\xfb\xf0\xf1" "0123456789ABCDEFab",
|
||||
21U, sodium_base64_VARIANT_ORIGINAL));
|
||||
printf("%s\n",
|
||||
sodium_bin2base64(buf3, 33U, (const unsigned char *) "\xfb\xf0\xf1" "0123456789ABCDEFabc",
|
||||
22U, sodium_base64_VARIANT_ORIGINAL_NO_PADDING));
|
||||
printf("%s\n",
|
||||
sodium_bin2base64(buf3, 31U, (const unsigned char *) "\xfb\xf0\xf1" "0123456789ABCDEFab",
|
||||
21U, sodium_base64_VARIANT_URLSAFE));
|
||||
printf("%s\n",
|
||||
sodium_bin2base64(buf3, 33U, (const unsigned char *) "\xfb\xf0\xf1" "0123456789ABCDEFabc",
|
||||
22U, sodium_base64_VARIANT_URLSAFE_NO_PADDING));
|
||||
printf("%s\n",
|
||||
sodium_bin2base64(buf3, 1U, guard_page,
|
||||
0U, sodium_base64_VARIANT_ORIGINAL));
|
||||
printf("%s\n",
|
||||
sodium_bin2base64(buf3, 5U, (const unsigned char *) "a",
|
||||
1U, sodium_base64_VARIANT_ORIGINAL));
|
||||
printf("%s\n",
|
||||
sodium_bin2base64(buf3, 5U, (const unsigned char *) "ab",
|
||||
2U, sodium_base64_VARIANT_ORIGINAL));
|
||||
printf("%s\n",
|
||||
sodium_bin2base64(buf3, 5U, (const unsigned char *) "abc",
|
||||
3U, sodium_base64_VARIANT_ORIGINAL));
|
||||
printf("%s\n",
|
||||
sodium_bin2base64(buf3, 1U, guard_page,
|
||||
0U, sodium_base64_VARIANT_ORIGINAL_NO_PADDING));
|
||||
printf("%s\n",
|
||||
sodium_bin2base64(buf3, 3U, (const unsigned char *) "a",
|
||||
1U, sodium_base64_VARIANT_ORIGINAL_NO_PADDING));
|
||||
printf("%s\n",
|
||||
sodium_bin2base64(buf3, 4U, (const unsigned char *) "ab",
|
||||
2U, sodium_base64_VARIANT_ORIGINAL_NO_PADDING));
|
||||
printf("%s\n",
|
||||
sodium_bin2base64(buf3, 5U, (const unsigned char *) "abc",
|
||||
3U, sodium_base64_VARIANT_ORIGINAL_NO_PADDING));
|
||||
|
||||
b64 = "VGhpcyBpcyBhIGpvdXJu" "\n" "ZXkgaW50by" " " "Bzb3VuZA==";
|
||||
memset(buf4, '*', sizeof buf4);
|
||||
assert(sodium_base642bin(buf4, sizeof buf4, b64, strlen(b64), "\n\r ", &bin_len,
|
||||
&b64_end, sodium_base64_VARIANT_ORIGINAL) == -1);
|
||||
buf4[bin_len] = 0;
|
||||
printf("[%s]\n", (const char *) buf4);
|
||||
printf("[%s]\n", b64_end);
|
||||
|
||||
memset(buf1, '*', sizeof buf1);
|
||||
assert(sodium_base642bin(buf1, sizeof buf1, b64, strlen(b64), "\n\r ", &bin_len,
|
||||
&b64_end, sodium_base64_VARIANT_ORIGINAL) == 0);
|
||||
buf1[bin_len] = 0;
|
||||
printf("[%s]\n", (const char *) buf1);
|
||||
assert(*b64_end == 0);
|
||||
|
||||
memset(buf1, '*', sizeof buf1);
|
||||
assert(sodium_base642bin(buf1, sizeof buf1, b64, strlen(b64), NULL, &bin_len,
|
||||
&b64_end, sodium_base64_VARIANT_ORIGINAL) == 0);
|
||||
buf1[bin_len] = 0;
|
||||
printf("[%s]\n", (const char *) buf1);
|
||||
printf("[%s]\n", b64_end);
|
||||
|
||||
assert(sodium_base642bin(buf1, sizeof buf1, b64, strlen(b64), NULL, NULL,
|
||||
&b64_end, sodium_base64_VARIANT_ORIGINAL) == 0);
|
||||
assert(sodium_base642bin(buf1, sizeof buf1, b64, strlen(b64), NULL, NULL,
|
||||
&b64_end, sodium_base64_VARIANT_ORIGINAL_NO_PADDING) == 0);
|
||||
assert(sodium_base642bin(buf1, sizeof buf1, b64, strlen(b64), " \r\n", NULL,
|
||||
&b64_end, sodium_base64_VARIANT_ORIGINAL_NO_PADDING) == 0);
|
||||
assert(sodium_base642bin(buf1, sizeof buf1, b64, strlen(b64), NULL, NULL,
|
||||
&b64_end, sodium_base64_VARIANT_URLSAFE_NO_PADDING) == 0);
|
||||
assert(sodium_base642bin(buf1, sizeof buf1, b64, strlen(b64), " \r\n", NULL,
|
||||
&b64_end, sodium_base64_VARIANT_URLSAFE_NO_PADDING) == 0);
|
||||
|
||||
assert(sodium_base642bin(buf1, sizeof buf1, b64, strlen(b64), NULL, NULL,
|
||||
NULL, sodium_base64_VARIANT_ORIGINAL) == -1);
|
||||
assert(sodium_base642bin(buf1, sizeof buf1, b64, strlen(b64), NULL, NULL,
|
||||
NULL, sodium_base64_VARIANT_ORIGINAL_NO_PADDING) == -1);
|
||||
assert(sodium_base642bin(buf1, sizeof buf1, b64, strlen(b64), " \r\n", NULL,
|
||||
NULL, sodium_base64_VARIANT_ORIGINAL_NO_PADDING) == -1);
|
||||
assert(sodium_base642bin(buf1, sizeof buf1, b64, strlen(b64), NULL, NULL,
|
||||
NULL, sodium_base64_VARIANT_URLSAFE_NO_PADDING) == -1);
|
||||
assert(sodium_base642bin(buf1, sizeof buf1, b64, strlen(b64), " \r\n", NULL,
|
||||
NULL, sodium_base64_VARIANT_URLSAFE_NO_PADDING) == -1);
|
||||
|
||||
assert(sodium_base642bin(guard_page, (size_t) 10U, "a=", (size_t) 2U, NULL, NULL, NULL,
|
||||
sodium_base64_VARIANT_URLSAFE) == -1);
|
||||
assert(sodium_base642bin(guard_page, (size_t) 10U, "a*", (size_t) 2U, NULL, NULL, NULL,
|
||||
sodium_base64_VARIANT_URLSAFE) == -1);
|
||||
assert(sodium_base642bin(guard_page, (size_t) 10U, "a*", (size_t) 2U, "~", NULL, NULL,
|
||||
sodium_base64_VARIANT_URLSAFE) == -1);
|
||||
assert(sodium_base642bin(guard_page, (size_t) 10U, "a*", (size_t) 2U, "*", NULL, NULL,
|
||||
sodium_base64_VARIANT_URLSAFE) == -1);
|
||||
assert(sodium_base642bin(guard_page, (size_t) 10U, "a==", (size_t) 3U, NULL, NULL, NULL,
|
||||
sodium_base64_VARIANT_URLSAFE) == -1);
|
||||
assert(sodium_base642bin(guard_page, (size_t) 10U, "a=*", (size_t) 3U, NULL, NULL, NULL,
|
||||
sodium_base64_VARIANT_URLSAFE) == -1);
|
||||
assert(sodium_base642bin(guard_page, (size_t) 10U, "a=*", (size_t) 3U, "~", NULL, NULL,
|
||||
sodium_base64_VARIANT_URLSAFE) == -1);
|
||||
assert(sodium_base642bin(guard_page, (size_t) 10U, "a=*", (size_t) 3U, "*", NULL, NULL,
|
||||
sodium_base64_VARIANT_URLSAFE) == -1);
|
||||
|
||||
assert(sodium_base642bin(buf1, sizeof buf1, "O1R", (size_t) 3U, NULL, NULL, NULL,
|
||||
sodium_base64_VARIANT_ORIGINAL_NO_PADDING) == -1);
|
||||
assert(sodium_base642bin(buf1, sizeof buf1, "O1Q", (size_t) 3U, NULL, NULL, NULL,
|
||||
sodium_base64_VARIANT_ORIGINAL_NO_PADDING) == 0);
|
||||
assert(sodium_base642bin(buf1, sizeof buf1, "O1", (size_t) 2U, NULL, NULL, NULL,
|
||||
sodium_base64_VARIANT_ORIGINAL_NO_PADDING) == -1);
|
||||
assert(sodium_base642bin(buf1, sizeof buf1, "Ow", (size_t) 2U, NULL, NULL, NULL,
|
||||
sodium_base64_VARIANT_ORIGINAL_NO_PADDING) == 0);
|
||||
assert(sodium_base642bin(buf1, sizeof buf1, "O", (size_t) 1U, NULL, NULL, NULL,
|
||||
sodium_base64_VARIANT_ORIGINAL_NO_PADDING) == -1);
|
||||
|
||||
assert(sodium_base642bin(buf1, sizeof buf1, "", (size_t) 0U, NULL, NULL, NULL,
|
||||
sodium_base64_VARIANT_ORIGINAL) == 0);
|
||||
assert(sodium_base642bin(buf1, sizeof buf1, "A", (size_t) 1U, NULL, NULL, NULL,
|
||||
sodium_base64_VARIANT_ORIGINAL) == -1);
|
||||
assert(sodium_base642bin(buf1, sizeof buf1, "AA", (size_t) 2U, NULL, NULL, NULL,
|
||||
sodium_base64_VARIANT_ORIGINAL) == -1);
|
||||
assert(sodium_base642bin(buf1, sizeof buf1, "kaw", (size_t) 3U, NULL, NULL, NULL,
|
||||
sodium_base64_VARIANT_ORIGINAL) == -1);
|
||||
assert(sodium_base642bin(buf1, sizeof buf1, "kQ*", (size_t) 3U, "@", NULL, NULL,
|
||||
sodium_base64_VARIANT_ORIGINAL) == -1);
|
||||
assert(sodium_base642bin(buf1, sizeof buf1, "kQ*", (size_t) 3U, "*", NULL, NULL,
|
||||
sodium_base64_VARIANT_ORIGINAL) == -1);
|
||||
assert(sodium_base642bin(buf1, sizeof buf1, "kaw=**", (size_t) 6U, "*", NULL, NULL,
|
||||
sodium_base64_VARIANT_ORIGINAL) == 0);
|
||||
assert(sodium_base642bin(buf1, sizeof buf1, "kaw*=*", (size_t) 6U, "~*", NULL, NULL,
|
||||
sodium_base64_VARIANT_ORIGINAL) == 0);
|
||||
assert(sodium_base642bin(buf1, sizeof buf1, "ka*w*=*", (size_t) 7U, "*~", NULL, NULL,
|
||||
sodium_base64_VARIANT_ORIGINAL) == 0);
|
||||
|
||||
assert(sodium_base642bin(buf1, sizeof buf1, (const char *) guard_page, 0U,
|
||||
NULL, &bin_len, NULL, sodium_base64_VARIANT_ORIGINAL) == 0);
|
||||
assert(bin_len == 0);
|
||||
|
||||
assert(sodium_base642bin(buf1, sizeof buf1, "", 0U, NULL, &bin_len, NULL,
|
||||
sodium_base64_VARIANT_ORIGINAL) == 0);
|
||||
assert(bin_len == 0);
|
||||
|
||||
for (i = 0; i < 1000; i++) {
|
||||
assert(sizeof buf1 >= 100);
|
||||
bin_len = (size_t) randombytes_uniform(100);
|
||||
bin = (unsigned char *) sodium_malloc(bin_len);
|
||||
b64_len = (bin_len + 2U) / 3U * 4U + 1U;
|
||||
assert(b64_len == sodium_base64_encoded_len(bin_len, sodium_base64_VARIANT_URLSAFE));
|
||||
b64_ = (char *) sodium_malloc(b64_len);
|
||||
randombytes_buf(bin, bin_len);
|
||||
memcpy(buf1, bin, bin_len);
|
||||
b64 = sodium_bin2base64(b64_, b64_len, bin, bin_len,
|
||||
sodium_base64_VARIANT_URLSAFE);
|
||||
assert(b64 != NULL);
|
||||
assert(sodium_base642bin(bin, bin_len + 10, b64, b64_len,
|
||||
NULL, NULL, &b64_end,
|
||||
sodium_base64_VARIANT_URLSAFE) == 0);
|
||||
assert(b64_end == &b64[b64_len - 1]);
|
||||
assert(memcmp(bin, buf1, bin_len) == 0);
|
||||
sodium_free(bin);
|
||||
sodium_free(b64_);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
30313233343536373839414243444546
|
||||
bin2hex(..., guard_page, 0):
|
||||
bin2hex(..., "", 0):
|
||||
4:cafe6942
|
||||
dt1: 11
|
||||
4:cafe6942
|
||||
dt2: 2
|
||||
dt3: 11
|
||||
dt4: 11
|
||||
dt5: 11
|
||||
dt6: 11
|
||||
+/DxMDEyMzQ1Njc4OUFCQ0RFRmFi
|
||||
+/DxMDEyMzQ1Njc4OUFCQ0RFRmFiYw
|
||||
-_DxMDEyMzQ1Njc4OUFCQ0RFRmFi
|
||||
-_DxMDEyMzQ1Njc4OUFCQ0RFRmFiYw
|
||||
|
||||
YQ==
|
||||
YWI=
|
||||
YWJj
|
||||
|
||||
YQ
|
||||
YWI
|
||||
YWJj
|
||||
[]
|
||||
[BpcyBhIGpvdXJu
|
||||
ZXkgaW50by Bzb3VuZA==]
|
||||
[This is a journey into sound]
|
||||
[This is a journ]
|
||||
[
|
||||
ZXkgaW50by Bzb3VuZA==]
|
||||
@@ -0,0 +1,41 @@
|
||||
|
||||
#define TEST_NAME "core1"
|
||||
#include "cmptest.h"
|
||||
|
||||
static unsigned char shared[32] = { 0x4a, 0x5d, 0x9d, 0x5b, 0xa4, 0xce, 0x2d,
|
||||
0xe1, 0x72, 0x8e, 0x3b, 0xf4, 0x80, 0x35,
|
||||
0x0f, 0x25, 0xe0, 0x7e, 0x21, 0xc9, 0x47,
|
||||
0xd1, 0x9e, 0x33, 0x76, 0xf0, 0x9b, 0x3c,
|
||||
0x1e, 0x16, 0x17, 0x42 };
|
||||
|
||||
static unsigned char zero[32];
|
||||
|
||||
static unsigned char c[16] = { 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x20, 0x33,
|
||||
0x32, 0x2d, 0x62, 0x79, 0x74, 0x65, 0x20, 0x6b };
|
||||
|
||||
static unsigned char firstkey[32];
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
crypto_core_hsalsa20(firstkey, zero, shared, c);
|
||||
for (i = 0; i < 32; ++i) {
|
||||
if (i > 0) {
|
||||
printf(",");
|
||||
} else {
|
||||
printf(" ");
|
||||
}
|
||||
printf("0x%02x", (unsigned int) firstkey[i]);
|
||||
if (i % 8 == 7) {
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
assert(crypto_core_hsalsa20_outputbytes() > 0U);
|
||||
assert(crypto_core_hsalsa20_inputbytes() > 0U);
|
||||
assert(crypto_core_hsalsa20_keybytes() > 0U);
|
||||
assert(crypto_core_hsalsa20_constbytes() > 0U);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
0x1b,0x27,0x55,0x64,0x73,0xe9,0x85,0xd4
|
||||
,0x62,0xcd,0x51,0x19,0x7a,0x9a,0x46,0xc7
|
||||
,0x60,0x09,0x54,0x9e,0xac,0x64,0x74,0xf2
|
||||
,0x06,0xc4,0xee,0x08,0x44,0xf6,0x83,0x89
|
||||
@@ -0,0 +1,38 @@
|
||||
|
||||
#define TEST_NAME "core2"
|
||||
#include "cmptest.h"
|
||||
|
||||
static unsigned char firstkey[32] = { 0x1b, 0x27, 0x55, 0x64, 0x73, 0xe9, 0x85,
|
||||
0xd4, 0x62, 0xcd, 0x51, 0x19, 0x7a, 0x9a,
|
||||
0x46, 0xc7, 0x60, 0x09, 0x54, 0x9e, 0xac,
|
||||
0x64, 0x74, 0xf2, 0x06, 0xc4, 0xee, 0x08,
|
||||
0x44, 0xf6, 0x83, 0x89 };
|
||||
|
||||
static unsigned char nonceprefix[16] = { 0x69, 0x69, 0x6e, 0xe9, 0x55, 0xb6,
|
||||
0x2b, 0x73, 0xcd, 0x62, 0xbd, 0xa8,
|
||||
0x75, 0xfc, 0x73, 0xd6 };
|
||||
|
||||
static unsigned char c[16] = { 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x20, 0x33,
|
||||
0x32, 0x2d, 0x62, 0x79, 0x74, 0x65, 0x20, 0x6b };
|
||||
|
||||
static unsigned char secondkey[32];
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
crypto_core_hsalsa20(secondkey, nonceprefix, firstkey, c);
|
||||
for (i = 0; i < 32; ++i) {
|
||||
if (i > 0) {
|
||||
printf(",");
|
||||
} else {
|
||||
printf(" ");
|
||||
}
|
||||
printf("0x%02x", (unsigned int) secondkey[i]);
|
||||
if (i % 8 == 7) {
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
0xdc,0x90,0x8d,0xda,0x0b,0x93,0x44,0xa9
|
||||
,0x53,0x62,0x9b,0x73,0x38,0x20,0x77,0x88
|
||||
,0x80,0xf3,0xce,0xb4,0x21,0xbb,0x61,0xb9
|
||||
,0x1c,0xbd,0x4c,0x3e,0x66,0x25,0x6c,0xe4
|
||||
115
components/espressif__libsodium/libsodium/test/default/core3.c
Normal file
115
components/espressif__libsodium/libsodium/test/default/core3.c
Normal file
@@ -0,0 +1,115 @@
|
||||
|
||||
#define TEST_NAME "core3"
|
||||
#include "cmptest.h"
|
||||
|
||||
static unsigned char SECONDKEY[32] = { 0xdc, 0x90, 0x8d, 0xda, 0x0b, 0x93, 0x44,
|
||||
0xa9, 0x53, 0x62, 0x9b, 0x73, 0x38, 0x20,
|
||||
0x77, 0x88, 0x80, 0xf3, 0xce, 0xb4, 0x21,
|
||||
0xbb, 0x61, 0xb9, 0x1c, 0xbd, 0x4c, 0x3e,
|
||||
0x66, 0x25, 0x6c, 0xe4 };
|
||||
|
||||
static unsigned char NONCESUFFIX[8] = { 0x82, 0x19, 0xe0, 0x03,
|
||||
0x6b, 0x7a, 0x0b, 0x37 };
|
||||
|
||||
static unsigned char C[16] = { 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x20, 0x33,
|
||||
0x32, 0x2d, 0x62, 0x79, 0x74, 0x65, 0x20, 0x6b };
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
unsigned char *secondkey;
|
||||
unsigned char *c;
|
||||
unsigned char *noncesuffix;
|
||||
unsigned char *in;
|
||||
unsigned char *output;
|
||||
unsigned char *h;
|
||||
size_t output_len = 64 * 256 * 256;
|
||||
size_t pos = 0;
|
||||
int i;
|
||||
|
||||
pos = 0;
|
||||
secondkey = (unsigned char *) sodium_malloc(32);
|
||||
memcpy(secondkey, SECONDKEY, 32);
|
||||
noncesuffix = (unsigned char *) sodium_malloc(8);
|
||||
memcpy(noncesuffix, NONCESUFFIX, 8);
|
||||
c = (unsigned char *) sodium_malloc(16);
|
||||
memcpy(c, C, 16);
|
||||
in = (unsigned char *) sodium_malloc(16);
|
||||
output = (unsigned char *) sodium_malloc(output_len);
|
||||
h = (unsigned char *) sodium_malloc(32);
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
in[i] = noncesuffix[i];
|
||||
}
|
||||
for (; i < 16; i++) {
|
||||
in[i] = 0;
|
||||
}
|
||||
do {
|
||||
do {
|
||||
crypto_core_salsa20(output + pos, in, secondkey, c);
|
||||
pos += 64;
|
||||
in[8]++;
|
||||
} while (in[8] != 0);
|
||||
in[9]++;
|
||||
} while (in[9] != 0);
|
||||
|
||||
crypto_hash_sha256(h, output, output_len);
|
||||
|
||||
for (i = 0; i < 32; ++i) {
|
||||
printf("%02x", h[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
#ifndef SODIUM_LIBRARY_MINIMAL
|
||||
pos = 0;
|
||||
do {
|
||||
do {
|
||||
crypto_core_salsa2012(output + pos, in, secondkey, c);
|
||||
pos += 64;
|
||||
in[8]++;
|
||||
} while (in[8] != 0);
|
||||
in[9]++;
|
||||
} while (in[9] != 0);
|
||||
|
||||
crypto_hash_sha256(h, output, output_len);
|
||||
|
||||
for (i = 0; i < 32; ++i) {
|
||||
printf("%02x", h[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
pos = 0;
|
||||
do {
|
||||
do {
|
||||
crypto_core_salsa208(output + pos, in, secondkey, c);
|
||||
pos += 64;
|
||||
in[8]++;
|
||||
} while (in[8] != 0);
|
||||
in[9]++;
|
||||
} while (in[9] != 0);
|
||||
|
||||
crypto_hash_sha256(h, output, output_len);
|
||||
|
||||
for (i = 0; i < 32; ++i) {
|
||||
printf("%02x", h[i]);
|
||||
}
|
||||
printf("\n");
|
||||
#else
|
||||
printf("a4e3147dddd2ba7775939b50208a22eb3277d4e4bad8a1cfbc999c6bd392b638\n"
|
||||
"017421baa9959cbe894bd003ec87938254f47c1e757eb66cf89c353d0c2b68de\n");
|
||||
#endif
|
||||
|
||||
sodium_free(h);
|
||||
sodium_free(output);
|
||||
sodium_free(in);
|
||||
sodium_free(c);
|
||||
sodium_free(noncesuffix);
|
||||
sodium_free(secondkey);
|
||||
|
||||
assert(crypto_core_salsa20_outputbytes() == crypto_core_salsa20_OUTPUTBYTES);
|
||||
assert(crypto_core_salsa20_inputbytes() == crypto_core_salsa20_INPUTBYTES);
|
||||
assert(crypto_core_salsa20_keybytes() == crypto_core_salsa20_KEYBYTES);
|
||||
assert(crypto_core_salsa20_constbytes() == crypto_core_salsa20_CONSTBYTES);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
662b9d0e3463029156069b12f918691a98f7dfb2ca0393c96bbfc6b1fbd630a2
|
||||
a4e3147dddd2ba7775939b50208a22eb3277d4e4bad8a1cfbc999c6bd392b638
|
||||
017421baa9959cbe894bd003ec87938254f47c1e757eb66cf89c353d0c2b68de
|
||||
@@ -0,0 +1,36 @@
|
||||
|
||||
#define TEST_NAME "core4"
|
||||
#include "cmptest.h"
|
||||
|
||||
static unsigned char k[32] = { 1, 2, 3, 4, 5, 6, 7, 8,
|
||||
9, 10, 11, 12, 13, 14, 15, 16,
|
||||
201, 202, 203, 204, 205, 206, 207, 208,
|
||||
209, 210, 211, 212, 213, 214, 215, 216 };
|
||||
|
||||
static unsigned char in[16] = { 101, 102, 103, 104, 105, 106, 107, 108,
|
||||
109, 110, 111, 112, 113, 114, 115, 116 };
|
||||
|
||||
static unsigned char c[16] = { 101, 120, 112, 97, 110, 100, 32, 51,
|
||||
50, 45, 98, 121, 116, 101, 32, 107 };
|
||||
|
||||
static unsigned char out[64];
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
crypto_core_salsa20(out, in, k, c);
|
||||
for (i = 0; i < 64; ++i) {
|
||||
if (i > 0) {
|
||||
printf(",");
|
||||
} else {
|
||||
printf(" ");
|
||||
}
|
||||
printf("%3u", (unsigned int) out[i]);
|
||||
if (i % 8 == 7) {
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
69, 37, 68, 39, 41, 15,107,193
|
||||
,255,139,122, 6,170,233,217, 98
|
||||
, 89,144,182,106, 21, 51,200, 65
|
||||
,239, 49,222, 34,215,114, 40,126
|
||||
,104,197, 7,225,197,153, 31, 2
|
||||
,102, 78, 76,176, 84,245,246,184
|
||||
,177,160,133,130, 6, 72,149,119
|
||||
,192,195,132,236,234,103,246, 74
|
||||
@@ -0,0 +1,33 @@
|
||||
|
||||
#define TEST_NAME "core5"
|
||||
#include "cmptest.h"
|
||||
|
||||
static unsigned char k[32] = { 0xee, 0x30, 0x4f, 0xca, 0x27, 0x00, 0x8d, 0x8c,
|
||||
0x12, 0x6f, 0x90, 0x02, 0x79, 0x01, 0xd8, 0x0f,
|
||||
0x7f, 0x1d, 0x8b, 0x8d, 0xc9, 0x36, 0xcf, 0x3b,
|
||||
0x9f, 0x81, 0x96, 0x92, 0x82, 0x7e, 0x57, 0x77 };
|
||||
|
||||
static unsigned char in[16] = {
|
||||
0x81, 0x91, 0x8e, 0xf2, 0xa5, 0xe0, 0xda, 0x9b,
|
||||
0x3e, 0x90, 0x60, 0x52, 0x1e, 0x4b, 0xb3, 0x52
|
||||
};
|
||||
|
||||
static unsigned char c[16] = { 101, 120, 112, 97, 110, 100, 32, 51,
|
||||
50, 45, 98, 121, 116, 101, 32, 107 };
|
||||
|
||||
unsigned char out[32];
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
crypto_core_hsalsa20(out, in, k, c);
|
||||
for (i = 0; i < 32; ++i) {
|
||||
printf(",0x%02x", (unsigned int) out[i]);
|
||||
if (i % 8 == 7) {
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
,0xbc,0x1b,0x30,0xfc,0x07,0x2c,0xc1,0x40
|
||||
,0x75,0xe4,0xba,0xa7,0x31,0xb5,0xa8,0x45
|
||||
,0xea,0x9b,0x11,0xe9,0xa5,0x19,0x1f,0x94
|
||||
,0xe1,0x8c,0xba,0x8f,0xd8,0x21,0xa7,0xcd
|
||||
@@ -0,0 +1,52 @@
|
||||
|
||||
#define TEST_NAME "core6"
|
||||
#include "cmptest.h"
|
||||
|
||||
static unsigned char k[32] = { 0xee, 0x30, 0x4f, 0xca, 0x27, 0x00, 0x8d, 0x8c,
|
||||
0x12, 0x6f, 0x90, 0x02, 0x79, 0x01, 0xd8, 0x0f,
|
||||
0x7f, 0x1d, 0x8b, 0x8d, 0xc9, 0x36, 0xcf, 0x3b,
|
||||
0x9f, 0x81, 0x96, 0x92, 0x82, 0x7e, 0x57, 0x77 };
|
||||
|
||||
static unsigned char in[16] = {
|
||||
0x81, 0x91, 0x8e, 0xf2, 0xa5, 0xe0, 0xda, 0x9b,
|
||||
0x3e, 0x90, 0x60, 0x52, 0x1e, 0x4b, 0xb3, 0x52
|
||||
};
|
||||
|
||||
static unsigned char c[16] = { 101, 120, 112, 97, 110, 100, 32, 51,
|
||||
50, 45, 98, 121, 116, 101, 32, 107 };
|
||||
|
||||
static unsigned char out[64];
|
||||
|
||||
static void
|
||||
print(unsigned char *x, unsigned char *y)
|
||||
{
|
||||
int i;
|
||||
unsigned int borrow = 0;
|
||||
|
||||
for (i = 0; i < 4; ++i) {
|
||||
unsigned int xi = x[i];
|
||||
unsigned int yi = y[i];
|
||||
printf(",0x%02x", 255 & (xi - yi - borrow));
|
||||
borrow = (xi < yi + borrow);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
crypto_core_salsa20(out, in, k, c);
|
||||
print(out, c);
|
||||
print(out + 20, c + 4);
|
||||
printf("\n");
|
||||
print(out + 40, c + 8);
|
||||
print(out + 60, c + 12);
|
||||
printf("\n");
|
||||
print(out + 24, in);
|
||||
print(out + 28, in + 4);
|
||||
printf("\n");
|
||||
print(out + 32, in + 8);
|
||||
print(out + 36, in + 12);
|
||||
printf("\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
,0xbc,0x1b,0x30,0xfc,0x07,0x2c,0xc1,0x40
|
||||
,0x75,0xe4,0xba,0xa7,0x31,0xb5,0xa8,0x45
|
||||
,0xea,0x9b,0x11,0xe9,0xa5,0x19,0x1f,0x94
|
||||
,0xe1,0x8c,0xba,0x8f,0xd8,0x21,0xa7,0xcd
|
||||
@@ -0,0 +1,545 @@
|
||||
#define TEST_NAME "core_ed25519"
|
||||
#include "cmptest.h"
|
||||
|
||||
static const unsigned char non_canonical_p[32] = {
|
||||
0xf6, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f
|
||||
};
|
||||
static const unsigned char non_canonical_invalid_p[32] = {
|
||||
0xf5, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f
|
||||
};
|
||||
static const unsigned char max_canonical_p[32] = {
|
||||
0xe4, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f
|
||||
};
|
||||
static const unsigned char L_p1[32] = {
|
||||
0xee, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10
|
||||
};
|
||||
static const unsigned char L[32] = {
|
||||
0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10
|
||||
};
|
||||
static const unsigned char L_1[32] = {
|
||||
0xec, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10
|
||||
};
|
||||
static const unsigned char sc_8[32] = {
|
||||
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
};
|
||||
static const unsigned char sc_highbit[32] = {
|
||||
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80
|
||||
};
|
||||
|
||||
static void
|
||||
add_P(unsigned char * const S)
|
||||
{
|
||||
static const unsigned char P[32] = {
|
||||
0xed, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
||||
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f
|
||||
};
|
||||
|
||||
sodium_add(S, P, sizeof P);
|
||||
}
|
||||
|
||||
static void
|
||||
add_l64(unsigned char * const S)
|
||||
{
|
||||
static const unsigned char l[crypto_core_ed25519_NONREDUCEDSCALARBYTES] =
|
||||
{ 0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58,
|
||||
0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
sodium_add(S, l, sizeof l);
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
unsigned char *h, *r;
|
||||
unsigned char *p, *p2, *p3;
|
||||
unsigned char *sc, *sc2, *sc3;
|
||||
unsigned char *sc64;
|
||||
unsigned char *seed;
|
||||
char *hex;
|
||||
unsigned int i, j;
|
||||
|
||||
h = (unsigned char *) sodium_malloc(crypto_core_ed25519_HASHBYTES);
|
||||
r = (unsigned char *) sodium_malloc(crypto_core_ed25519_UNIFORMBYTES);
|
||||
p = (unsigned char *) sodium_malloc(crypto_core_ed25519_BYTES);
|
||||
for (i = 0; i < 500; i++) {
|
||||
randombytes_buf(r, crypto_core_ed25519_UNIFORMBYTES);
|
||||
if (crypto_core_ed25519_from_uniform(p, r) != 0) {
|
||||
printf("crypto_core_ed25519_from_uniform() failed\n");
|
||||
}
|
||||
if (crypto_core_ed25519_is_valid_point(p) == 0) {
|
||||
printf("crypto_core_ed25519_from_uniform() returned an invalid point\n");
|
||||
}
|
||||
crypto_core_ed25519_random(p);
|
||||
if (crypto_core_ed25519_is_valid_point(p) == 0) {
|
||||
printf("crypto_core_ed25519_random() returned an invalid point\n");
|
||||
}
|
||||
}
|
||||
|
||||
p2 = (unsigned char *) sodium_malloc(crypto_core_ed25519_BYTES);
|
||||
p3 = (unsigned char *) sodium_malloc(crypto_core_ed25519_BYTES);
|
||||
|
||||
crypto_core_ed25519_random(p2);
|
||||
|
||||
j = 1 + (unsigned int) randombytes_uniform(100);
|
||||
memcpy(p3, p, crypto_core_ed25519_BYTES);
|
||||
for (i = 0; i < j; i++) {
|
||||
crypto_core_ed25519_add(p, p, p2);
|
||||
if (crypto_core_ed25519_is_valid_point(p) != 1) {
|
||||
printf("crypto_core_add() returned an invalid point\n");
|
||||
}
|
||||
}
|
||||
if (memcmp(p, p3, crypto_core_ed25519_BYTES) == 0) {
|
||||
printf("crypto_core_add() failed\n");
|
||||
}
|
||||
for (i = 0; i < j; i++) {
|
||||
crypto_core_ed25519_sub(p, p, p2);
|
||||
}
|
||||
if (memcmp(p, p3, crypto_core_ed25519_BYTES) != 0) {
|
||||
printf("crypto_core_add() or crypto_core_sub() failed\n");
|
||||
}
|
||||
sc = (unsigned char *) sodium_malloc(crypto_scalarmult_ed25519_SCALARBYTES);
|
||||
memset(sc, 0, crypto_scalarmult_ed25519_SCALARBYTES);
|
||||
sc[0] = 8;
|
||||
memcpy(p2, p, crypto_core_ed25519_BYTES);
|
||||
memcpy(p3, p, crypto_core_ed25519_BYTES);
|
||||
|
||||
for (i = 0; i < 254; i++) {
|
||||
crypto_core_ed25519_add(p2, p2, p2);
|
||||
}
|
||||
for (i = 0; i < 8; i++) {
|
||||
crypto_core_ed25519_add(p2, p2, p);
|
||||
}
|
||||
if (crypto_scalarmult_ed25519(p3, sc, p) != 0) {
|
||||
printf("crypto_scalarmult_ed25519() failed\n");
|
||||
}
|
||||
if (memcmp(p2, p3, crypto_core_ed25519_BYTES) != 0) {
|
||||
printf("crypto_scalarmult_ed25519() is inconsistent with crypto_core_ed25519_add()\n");
|
||||
}
|
||||
|
||||
assert(crypto_core_ed25519_is_valid_point(p) == 1);
|
||||
|
||||
memset(p, 0, crypto_core_ed25519_BYTES);
|
||||
assert(crypto_core_ed25519_is_valid_point(p) == 0);
|
||||
|
||||
p[0] = 1;
|
||||
assert(crypto_core_ed25519_is_valid_point(p) == 0);
|
||||
|
||||
p[0] = 2;
|
||||
assert(crypto_core_ed25519_is_valid_point(p) == 0);
|
||||
|
||||
p[0] = 9;
|
||||
assert(crypto_core_ed25519_is_valid_point(p) == 1);
|
||||
|
||||
assert(crypto_core_ed25519_is_valid_point(max_canonical_p) == 1);
|
||||
assert(crypto_core_ed25519_is_valid_point(non_canonical_invalid_p) == 0);
|
||||
assert(crypto_core_ed25519_is_valid_point(non_canonical_p) == 0);
|
||||
|
||||
memcpy(p2, p, crypto_core_ed25519_BYTES);
|
||||
add_P(p2);
|
||||
crypto_core_ed25519_add(p3, p2, p2);
|
||||
crypto_core_ed25519_sub(p3, p3, p2);
|
||||
assert(memcmp(p2, p, crypto_core_ed25519_BYTES) != 0);
|
||||
assert(memcmp(p3, p, crypto_core_ed25519_BYTES) == 0);
|
||||
|
||||
p[0] = 2;
|
||||
assert(crypto_core_ed25519_add(p3, p2, p) == -1);
|
||||
assert(crypto_core_ed25519_add(p3, p2, non_canonical_p) == 0);
|
||||
assert(crypto_core_ed25519_add(p3, p2, non_canonical_invalid_p) == -1);
|
||||
assert(crypto_core_ed25519_add(p3, p, p3) == -1);
|
||||
assert(crypto_core_ed25519_add(p3, non_canonical_p, p3) == 0);
|
||||
assert(crypto_core_ed25519_add(p3, non_canonical_invalid_p, p3) == -1);
|
||||
|
||||
assert(crypto_core_ed25519_sub(p3, p2, p) == -1);
|
||||
assert(crypto_core_ed25519_sub(p3, p2, non_canonical_p) == 0);
|
||||
assert(crypto_core_ed25519_sub(p3, p2, non_canonical_invalid_p) == -1);
|
||||
assert(crypto_core_ed25519_sub(p3, p, p3) == -1);
|
||||
assert(crypto_core_ed25519_sub(p3, non_canonical_p, p3) == 0);
|
||||
assert(crypto_core_ed25519_sub(p3, non_canonical_invalid_p, p3) == -1);
|
||||
|
||||
for (i = 0; i < 1000; i++) {
|
||||
crypto_core_ed25519_random(p);
|
||||
do {
|
||||
crypto_core_ed25519_scalar_random(sc);
|
||||
} while (sodium_is_zero(sc, crypto_core_ed25519_SCALARBYTES));
|
||||
if (crypto_scalarmult_ed25519_noclamp(p2, sc, p) != 0) {
|
||||
printf("crypto_scalarmult_ed25519_noclamp() failed\n");
|
||||
}
|
||||
assert(crypto_core_ed25519_is_valid_point(p2));
|
||||
if (crypto_core_ed25519_scalar_invert(sc, sc) != 0) {
|
||||
printf("crypto_core_ed25519_scalar_invert() failed\n");
|
||||
}
|
||||
if (crypto_scalarmult_ed25519_noclamp(p3, sc, p2) != 0) {
|
||||
printf("crypto_scalarmult_ed25519_noclamp() failed\n");
|
||||
}
|
||||
assert(memcmp(p3, p, crypto_core_ed25519_BYTES) == 0);
|
||||
}
|
||||
|
||||
sc64 = (unsigned char *) sodium_malloc(64);
|
||||
crypto_core_ed25519_scalar_random(sc);
|
||||
memcpy(sc64, sc, crypto_core_ed25519_BYTES);
|
||||
memset(sc64 + crypto_core_ed25519_BYTES, 0,
|
||||
64 - crypto_core_ed25519_BYTES);
|
||||
i = (unsigned int) randombytes_uniform(100);
|
||||
do {
|
||||
add_l64(sc64);
|
||||
} while (i-- > 0);
|
||||
crypto_core_ed25519_scalar_reduce(sc64, sc64);
|
||||
if (memcmp(sc64, sc, crypto_core_ed25519_BYTES) != 0) {
|
||||
printf("crypto_core_ed25519_scalar_reduce() failed\n");
|
||||
}
|
||||
|
||||
randombytes_buf(r, crypto_core_ed25519_UNIFORMBYTES);
|
||||
crypto_core_ed25519_from_uniform(p, r);
|
||||
memcpy(p2, p, crypto_core_ed25519_BYTES);
|
||||
crypto_core_ed25519_scalar_random(sc);
|
||||
if (crypto_scalarmult_ed25519_noclamp(p, sc, p) != 0) {
|
||||
printf("crypto_scalarmult_ed25519_noclamp() failed (1)\n");
|
||||
}
|
||||
crypto_core_ed25519_scalar_complement(sc, sc);
|
||||
if (crypto_scalarmult_ed25519_noclamp(p2, sc, p2) != 0) {
|
||||
printf("crypto_scalarmult_ed25519_noclamp() failed (2)\n");
|
||||
}
|
||||
crypto_core_ed25519_add(p3, p, p2);
|
||||
crypto_core_ed25519_from_uniform(p, r);
|
||||
crypto_core_ed25519_sub(p, p, p3);
|
||||
assert(p[0] == 0x01);
|
||||
for (i = 1; i < crypto_core_ed25519_BYTES; i++) {
|
||||
assert(p[i] == 0);
|
||||
}
|
||||
|
||||
crypto_core_ed25519_random(p);
|
||||
memcpy(p2, p, crypto_core_ed25519_BYTES);
|
||||
crypto_core_ed25519_scalar_random(sc);
|
||||
if (crypto_scalarmult_ed25519_noclamp(p, sc, p) != 0) {
|
||||
printf("crypto_scalarmult_ed25519_noclamp() failed (3)\n");
|
||||
}
|
||||
crypto_core_ed25519_scalar_negate(sc, sc);
|
||||
if (crypto_scalarmult_ed25519_noclamp(p2, sc, p2) != 0) {
|
||||
printf("crypto_scalarmult_ed25519_noclamp() failed (4)\n");
|
||||
}
|
||||
crypto_core_ed25519_add(p, p, p2);
|
||||
assert(p[0] == 0x01);
|
||||
for (i = 1; i < crypto_core_ed25519_BYTES; i++) {
|
||||
assert(p[i] == 0);
|
||||
}
|
||||
|
||||
hex = (char *) sodium_malloc(crypto_core_ed25519_SCALARBYTES * 2 + 1);
|
||||
|
||||
for (i = 0; i < crypto_core_ed25519_SCALARBYTES; i++) {
|
||||
sc[i] = 255 - i;
|
||||
}
|
||||
if (crypto_core_ed25519_scalar_invert(sc, sc) != 0) {
|
||||
printf("crypto_core_ed25519_scalar_invert() failed\n");
|
||||
}
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("inv1: %s\n", hex);
|
||||
if (crypto_core_ed25519_scalar_invert(sc, sc) != 0) {
|
||||
printf("crypto_core_ed25519_scalar_invert() failed\n");
|
||||
}
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("inv2: %s\n", hex);
|
||||
for (i = 0; i < crypto_core_ed25519_SCALARBYTES; i++) {
|
||||
sc[i] = 32 - i;
|
||||
}
|
||||
if (crypto_core_ed25519_scalar_invert(sc, sc) != 0) {
|
||||
printf("crypto_core_ed25519_scalar_invert() failed\n");
|
||||
}
|
||||
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("inv3: %s\n", hex);
|
||||
if (crypto_core_ed25519_scalar_invert(sc, sc) != 0) {
|
||||
printf("crypto_core_ed25519_scalar_invert() failed\n");
|
||||
}
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("inv4: %s\n", hex);
|
||||
|
||||
for (i = 0; i < crypto_core_ed25519_SCALARBYTES; i++) {
|
||||
sc[i] = 255 - i;
|
||||
}
|
||||
crypto_core_ed25519_scalar_negate(sc, sc);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("neg1: %s\n", hex);
|
||||
crypto_core_ed25519_scalar_negate(sc, sc);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("neg2: %s\n", hex);
|
||||
for (i = 0; i < crypto_core_ed25519_SCALARBYTES; i++) {
|
||||
sc[i] = 32 - i;
|
||||
}
|
||||
crypto_core_ed25519_scalar_negate(sc, sc);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("neg3: %s\n", hex);
|
||||
crypto_core_ed25519_scalar_negate(sc, sc);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("neg4: %s\n", hex);
|
||||
|
||||
for (i = 0; i < crypto_core_ed25519_SCALARBYTES; i++) {
|
||||
sc[i] = 255 - i;
|
||||
}
|
||||
crypto_core_ed25519_scalar_complement(sc, sc);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("comp1: %s\n", hex);
|
||||
crypto_core_ed25519_scalar_complement(sc, sc);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("comp2: %s\n", hex);
|
||||
for (i = 0; i < crypto_core_ed25519_SCALARBYTES; i++) {
|
||||
sc[i] = 32 - i;
|
||||
}
|
||||
crypto_core_ed25519_scalar_complement(sc, sc);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("comp3: %s\n", hex);
|
||||
crypto_core_ed25519_scalar_complement(sc, sc);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("comp4: %s\n", hex);
|
||||
|
||||
sc2 = (unsigned char *) sodium_malloc(crypto_core_ed25519_SCALARBYTES);
|
||||
sc3 = (unsigned char *) sodium_malloc(crypto_core_ed25519_SCALARBYTES);
|
||||
for (i = 0; i < 1000; i++) {
|
||||
randombytes_buf(sc, crypto_core_ed25519_SCALARBYTES);
|
||||
randombytes_buf(sc2, crypto_core_ed25519_SCALARBYTES);
|
||||
sc[crypto_core_ed25519_SCALARBYTES - 1] &= 0x7f;
|
||||
sc2[crypto_core_ed25519_SCALARBYTES - 1] &= 0x7f;
|
||||
crypto_core_ed25519_scalar_add(sc3, sc, sc2);
|
||||
assert(!sodium_is_zero(sc, crypto_core_ed25519_SCALARBYTES));
|
||||
crypto_core_ed25519_scalar_sub(sc3, sc3, sc2);
|
||||
assert(!sodium_is_zero(sc, crypto_core_ed25519_SCALARBYTES));
|
||||
crypto_core_ed25519_scalar_sub(sc3, sc3, sc);
|
||||
assert(sodium_is_zero(sc3, crypto_core_ed25519_SCALARBYTES));
|
||||
}
|
||||
|
||||
memset(sc, 0x69, crypto_core_ed25519_SCALARBYTES);
|
||||
memset(sc2, 0x42, crypto_core_ed25519_SCALARBYTES);
|
||||
crypto_core_ed25519_scalar_add(sc, sc, sc2);
|
||||
crypto_core_ed25519_scalar_add(sc, sc2, sc);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("add1: %s\n", hex);
|
||||
|
||||
crypto_core_ed25519_scalar_sub(sc, sc2, sc);
|
||||
crypto_core_ed25519_scalar_sub(sc, sc, sc2);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("sub1: %s\n", hex);
|
||||
|
||||
memset(sc, 0xcd, crypto_core_ed25519_SCALARBYTES);
|
||||
memset(sc2, 0x42, crypto_core_ed25519_SCALARBYTES);
|
||||
crypto_core_ed25519_scalar_add(sc, sc, sc2);
|
||||
crypto_core_ed25519_scalar_add(sc, sc2, sc);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("add2: %s\n", hex);
|
||||
|
||||
crypto_core_ed25519_scalar_sub(sc, sc2, sc);
|
||||
crypto_core_ed25519_scalar_sub(sc, sc, sc2);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("sub2: %s\n", hex);
|
||||
|
||||
memset(sc, 0x69, crypto_core_ed25519_SCALARBYTES);
|
||||
memset(sc2, 0x42, crypto_core_ed25519_SCALARBYTES);
|
||||
for (i = 0; i < 100; i++) {
|
||||
crypto_core_ed25519_scalar_mul(sc, sc, sc2);
|
||||
crypto_core_ed25519_scalar_mul(sc2, sc, sc2);
|
||||
}
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc2, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("mul: %s\n", hex);
|
||||
for (i = 0; i < 1000; i++) {
|
||||
crypto_core_ed25519_scalar_random(sc);
|
||||
memset(sc2, 0, crypto_core_ed25519_SCALARBYTES);
|
||||
crypto_core_ed25519_scalar_mul(sc3, sc, sc2);
|
||||
assert(sodium_is_zero(sc3, crypto_core_ed25519_SCALARBYTES));
|
||||
|
||||
sc2[0]++;
|
||||
crypto_core_ed25519_scalar_mul(sc3, sc, sc2);
|
||||
assert(memcmp(sc3, sc, crypto_core_ed25519_SCALARBYTES) == 0);
|
||||
|
||||
sc2[0]++;
|
||||
crypto_core_ed25519_scalar_mul(sc3, sc, sc2);
|
||||
crypto_core_ed25519_scalar_sub(sc3, sc3, sc);
|
||||
crypto_core_ed25519_scalar_sub(sc3, sc3, sc);
|
||||
assert(sodium_is_zero(sc3, crypto_core_ed25519_SCALARBYTES));
|
||||
|
||||
do {
|
||||
crypto_core_ed25519_scalar_random(sc2);
|
||||
} while (sodium_is_zero(sc2, crypto_core_ed25519_SCALARBYTES));
|
||||
crypto_core_ed25519_scalar_mul(sc3, sc, sc2);
|
||||
crypto_core_ed25519_scalar_invert(sc2, sc2);
|
||||
crypto_core_ed25519_scalar_mul(sc3, sc3, sc2);
|
||||
assert(memcmp(sc3, sc, crypto_core_ed25519_SCALARBYTES) == 0);
|
||||
|
||||
sc[31] |= 0x11;
|
||||
memset(sc2, 0, crypto_core_ed25519_SCALARBYTES);
|
||||
sc2[0] = 1;
|
||||
crypto_core_ed25519_scalar_mul(sc3, sc, sc2);
|
||||
assert(memcmp(sc3, sc, crypto_core_ed25519_SCALARBYTES) != 0);
|
||||
}
|
||||
|
||||
seed = (unsigned char *) sodium_malloc(randombytes_SEEDBYTES);
|
||||
for (i = 0; i < 15; i++) {
|
||||
randombytes_buf_deterministic(r, crypto_core_ed25519_UNIFORMBYTES, seed);
|
||||
if (crypto_core_ed25519_from_uniform(p, r) != 0) {
|
||||
printf("crypto_core_ed25519_from_uniform() failed\n");
|
||||
}
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
p, crypto_core_ed25519_BYTES);
|
||||
printf("from_uniform_deterministic (%u): %s\n", i, hex);
|
||||
sodium_increment(seed, randombytes_SEEDBYTES);
|
||||
}
|
||||
crypto_core_ed25519_scalar_mul(sc, L_1, sc_8);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("(L-1)*8: %s\n", hex);
|
||||
crypto_core_ed25519_scalar_mul(sc, sc_8, L_1);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("8(L-1): %s\n", hex);
|
||||
crypto_core_ed25519_scalar_mul(sc, L_1, L_1);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("(L-1)^2: %s\n", hex);
|
||||
crypto_core_ed25519_scalar_mul(sc, L, sc_8);
|
||||
|
||||
crypto_core_ed25519_scalar_mul(sc, L_p1, sc_8);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("(L+1)*8: %s\n", hex);
|
||||
crypto_core_ed25519_scalar_mul(sc, sc_8, L_p1);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("8(L+1): %s\n", hex);
|
||||
crypto_core_ed25519_scalar_mul(sc, L_p1, L_p1);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("(L+1)^2: %s\n", hex);
|
||||
|
||||
crypto_core_ed25519_scalar_mul(sc, L_1, sc_highbit);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("(L-1)h: %s\n", hex);
|
||||
crypto_core_ed25519_scalar_mul(sc, sc_highbit, L_1);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("h(L-1): %s\n", hex);
|
||||
crypto_core_ed25519_scalar_mul(sc, L_p1, sc_highbit);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("(L+1)h: %s\n", hex);
|
||||
crypto_core_ed25519_scalar_mul(sc, sc_highbit, L_p1);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("h(L+1): %s\n", hex);
|
||||
crypto_core_ed25519_scalar_mul(sc, sc_highbit, sc_highbit);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("h^2: %s\n", hex);
|
||||
|
||||
crypto_core_ed25519_scalar_mul(sc, L, sc_8);
|
||||
assert(sodium_is_zero(sc, crypto_core_ed25519_SCALARBYTES));
|
||||
crypto_core_ed25519_scalar_mul(sc, sc_8, L);
|
||||
assert(sodium_is_zero(sc, crypto_core_ed25519_SCALARBYTES));
|
||||
crypto_core_ed25519_scalar_mul(sc, L, L);
|
||||
assert(sodium_is_zero(sc, crypto_core_ed25519_SCALARBYTES));
|
||||
crypto_core_ed25519_scalar_mul(sc, L, L_1);
|
||||
assert(sodium_is_zero(sc, crypto_core_ed25519_SCALARBYTES));
|
||||
crypto_core_ed25519_scalar_mul(sc, L_1, L);
|
||||
assert(sodium_is_zero(sc, crypto_core_ed25519_SCALARBYTES));
|
||||
|
||||
crypto_core_ed25519_scalar_add(sc, L_1, sc_8);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("(L-1)+8: %s\n", hex);
|
||||
crypto_core_ed25519_scalar_add(sc, sc_8, L_1);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("8+(L-1): %s\n", hex);
|
||||
crypto_core_ed25519_scalar_add(sc, L_1, L_1);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("(L-1)*2: %s\n", hex);
|
||||
crypto_core_ed25519_scalar_add(sc, L, sc_8);
|
||||
|
||||
crypto_core_ed25519_scalar_add(sc, L_p1, sc_8);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("(L+1)+8: %s\n", hex);
|
||||
crypto_core_ed25519_scalar_add(sc, sc_8, L_p1);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("8+(L+1): %s\n", hex);
|
||||
crypto_core_ed25519_scalar_add(sc, L_p1, L_p1);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("(L+1)*2: %s\n", hex);
|
||||
|
||||
crypto_core_ed25519_scalar_add(sc, L_1, sc_highbit);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("(L-1)+h: %s\n", hex);
|
||||
crypto_core_ed25519_scalar_add(sc, sc_highbit, L_1);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("h+(L-1): %s\n", hex);
|
||||
crypto_core_ed25519_scalar_add(sc, L_p1, sc_highbit);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("(L+1)+h: %s\n", hex);
|
||||
crypto_core_ed25519_scalar_add(sc, sc_highbit, L_p1);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("h+(L+1): %s\n", hex);
|
||||
crypto_core_ed25519_scalar_add(sc, sc_highbit, sc_highbit);
|
||||
sodium_bin2hex(hex, crypto_core_ed25519_SCALARBYTES * 2 + 1,
|
||||
sc, crypto_core_ed25519_SCALARBYTES);
|
||||
printf("h*2: %s\n", hex);
|
||||
|
||||
sodium_free(seed);
|
||||
sodium_free(hex);
|
||||
sodium_free(sc64);
|
||||
sodium_free(sc3);
|
||||
sodium_free(sc2);
|
||||
sodium_free(sc);
|
||||
sodium_free(p3);
|
||||
sodium_free(p2);
|
||||
sodium_free(p);
|
||||
sodium_free(r);
|
||||
sodium_free(h);
|
||||
|
||||
assert(crypto_core_ed25519_BYTES == crypto_core_ed25519_bytes());
|
||||
assert(crypto_core_ed25519_SCALARBYTES == crypto_core_ed25519_scalarbytes());
|
||||
assert(crypto_core_ed25519_NONREDUCEDSCALARBYTES == crypto_core_ed25519_nonreducedscalarbytes());
|
||||
assert(crypto_core_ed25519_NONREDUCEDSCALARBYTES >= crypto_core_ed25519_SCALARBYTES);
|
||||
assert(crypto_core_ed25519_UNIFORMBYTES == crypto_core_ed25519_uniformbytes());
|
||||
assert(crypto_core_ed25519_UNIFORMBYTES >= crypto_core_ed25519_BYTES);
|
||||
assert(crypto_core_ed25519_HASHBYTES == crypto_core_ed25519_hashbytes());
|
||||
assert(crypto_core_ed25519_HASHBYTES >= 2 * crypto_core_ed25519_BYTES);
|
||||
|
||||
printf("OK\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
inv1: 5858cdec40a044b1548b3bb08f8ce0d71103d1f887df84ebc502643dac4df40b
|
||||
inv2: 09688ce78a8ff8273f636b0bc748c0cceeeeedecebeae9e8e7e6e5e4e3e2e100
|
||||
inv3: f70b4f272b47bd6a1015a511fb3c9fc1b9c21ca4ca2e17d5a225b4c410b9b60d
|
||||
inv4: 201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a090807060504030201
|
||||
neg1: e46b69758fd3193097398c9717b11e48111112131415161718191a1b1c1d1e0f
|
||||
neg2: 09688ce78a8ff8273f636b0bc748c0cceeeeedecebeae9e8e7e6e5e4e3e2e100
|
||||
neg3: cdb4d73ffe47f83ebe85e18dcae6cc03f0f0f1f2f3f4f5f6f7f8f9fafbfcfd0e
|
||||
neg4: 201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a090807060504030201
|
||||
comp1: e56b69758fd3193097398c9717b11e48111112131415161718191a1b1c1d1e0f
|
||||
comp2: 09688ce78a8ff8273f636b0bc748c0cceeeeedecebeae9e8e7e6e5e4e3e2e100
|
||||
comp3: ceb4d73ffe47f83ebe85e18dcae6cc03f0f0f1f2f3f4f5f6f7f8f9fafbfcfd0e
|
||||
comp4: 201f1e1d1c1b1a191817161514131211100f0e0d0c0b0a090807060504030201
|
||||
add1: f7567cd87c82ec1c355a6304c143bcc9ecedededededededededededededed0d
|
||||
sub1: f67c79849de0253ba142949e1db6224b13121212121212121212121212121202
|
||||
add2: b02e8581ce62f69922427c23f970f7e951525252525252525252525252525202
|
||||
sub2: 3da570db4b001cbeb35a7b7fe588e72aaeadadadadadadadadadadadadadad0d
|
||||
mul: 4453ef38408c06677c1b810e4bf8b1991f01c88716fbfa2f075a518b77da400b
|
||||
from_uniform_deterministic (0): b18e62cf804b022fec392b0e2d6539d0f059732616c11913f510f73ae2544ebc
|
||||
from_uniform_deterministic (1): b9d23004e78c58e22da72e109550133e3d3bb9e46afcc066b82326319653d62c
|
||||
from_uniform_deterministic (2): 14063782c8b8a677dce09c4e51719b1cf942bf71bc765c1ec9832a8b4446983c
|
||||
from_uniform_deterministic (3): 02d6dbac70f6a14de72f4e17386016b08d6506336a086f10e719fbad8831d550
|
||||
from_uniform_deterministic (4): 11c851408e7892c2eae37584423a8f9c797e3649d45946b53e64319318a750b0
|
||||
from_uniform_deterministic (5): d4b9eaf70ffdc238c88725e294bdd02a6ce85577c5e7add7ca07041873019842
|
||||
from_uniform_deterministic (6): 740a6141079285c1b9e84ed463dcce5d3d40a167fa13129463eaf97d2a7bf654
|
||||
from_uniform_deterministic (7): e504a3e00bbf506cbe388784d85e85b10c428c37eba04ebd19a60948b71ad2cf
|
||||
from_uniform_deterministic (8): 67cd50902c40c943f22c479c587fb3e5da2f8f1ad402049ac49ddc45ec20884c
|
||||
from_uniform_deterministic (9): 658bffa23b425a91268ee17559073c4b1548209054ed7cf00ffe582696dda8dc
|
||||
from_uniform_deterministic (10): b55b93e7a0fe554f86f1f4c991871a27756fee359a8c6bb7554ec91d5d552c49
|
||||
from_uniform_deterministic (11): fbc2bb45df1d806489a5a6415898c719c45c932d3467b6ce948ee80c0e8122c9
|
||||
from_uniform_deterministic (12): 93164e57b5e3ae6826ac9e0c31ddecf94e21a39a29ba9d1d24e9e588fe065d95
|
||||
from_uniform_deterministic (13): 16824d74c9482890dc57b0ec843a0a5231b581d2ce3909934d7658389f169093
|
||||
from_uniform_deterministic (14): 2f5b0336c7f0af520badeae99450f92835c27224ab4cd117f55b176afb6f0001
|
||||
(L-1)*8: e5d3f55c1a631258d69cf7a2def9de1400000000000000000000000000000010
|
||||
8(L-1): e5d3f55c1a631258d69cf7a2def9de1400000000000000000000000000000010
|
||||
(L-1)^2: 0100000000000000000000000000000000000000000000000000000000000000
|
||||
(L+1)*8: 0800000000000000000000000000000000000000000000000000000000000000
|
||||
8(L+1): 0800000000000000000000000000000000000000000000000000000000000000
|
||||
(L+1)^2: 0100000000000000000000000000000000000000000000000000000000000000
|
||||
(L-1)h: 609faee7d21893c0b2e6bc17f5cef7a600000000000000000000000000000000
|
||||
h(L-1): 609faee7d21893c0b2e6bc17f5cef7a600000000000000000000000000000000
|
||||
(L+1)h: 8d344775474a7f9723b63a8be92ae76dffffffffffffffffffffffffffffff0f
|
||||
h(L+1): 8d344775474a7f9723b63a8be92ae76dffffffffffffffffffffffffffffff0f
|
||||
h^2: 726cf51b9ec1dda146af8c58ffd22d148f6ffd85f41cbb738f260cdf4650e60c
|
||||
(L-1)+8: 0700000000000000000000000000000000000000000000000000000000000000
|
||||
8+(L-1): 0700000000000000000000000000000000000000000000000000000000000000
|
||||
(L-1)*2: ebd3f55c1a631258d69cf7a2def9de1400000000000000000000000000000010
|
||||
(L+1)+8: 0900000000000000000000000000000000000000000000000000000000000000
|
||||
8+(L+1): 0900000000000000000000000000000000000000000000000000000000000000
|
||||
(L+1)*2: 0200000000000000000000000000000000000000000000000000000000000000
|
||||
(L-1)+h: 8c344775474a7f9723b63a8be92ae76dffffffffffffffffffffffffffffff0f
|
||||
h+(L-1): 8c344775474a7f9723b63a8be92ae76dffffffffffffffffffffffffffffff0f
|
||||
(L+1)+h: 8e344775474a7f9723b63a8be92ae76dffffffffffffffffffffffffffffff0f
|
||||
h+(L+1): 8e344775474a7f9723b63a8be92ae76dffffffffffffffffffffffffffffff0f
|
||||
h*2: 1000000000000000000000000000000000000000000000000000000000000000
|
||||
OK
|
||||
@@ -0,0 +1,271 @@
|
||||
#define TEST_NAME "core_ristretto255"
|
||||
#include "cmptest.h"
|
||||
|
||||
static void
|
||||
tv1(void)
|
||||
{
|
||||
static const char *bad_encodings_hex[] = {
|
||||
/* Non-canonical field encodings */
|
||||
"00ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
|
||||
"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
|
||||
"f3ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
|
||||
"edffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
|
||||
"0100000000000000000000000000000000000000000000000000000000000080",
|
||||
|
||||
/* Negative field elements */
|
||||
"0100000000000000000000000000000000000000000000000000000000000000",
|
||||
"01ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f",
|
||||
"ed57ffd8c914fb201471d1c3d245ce3c746fcbe63a3679d51b6a516ebebe0e20",
|
||||
"c34c4e1826e5d403b78e246e88aa051c36ccf0aafebffe137d148a2bf9104562",
|
||||
"c940e5a4404157cfb1628b108db051a8d439e1a421394ec4ebccb9ec92a8ac78",
|
||||
"47cfc5497c53dc8e61c91d17fd626ffb1c49e2bca94eed052281b510b1117a24",
|
||||
"f1c6165d33367351b0da8f6e4511010c68174a03b6581212c71c0e1d026c3c72",
|
||||
"87260f7a2f12495118360f02c26a470f450dadf34a413d21042b43b9d93e1309",
|
||||
|
||||
/* Non-square x^2 */
|
||||
"26948d35ca62e643e26a83177332e6b6afeb9d08e4268b650f1f5bbd8d81d371",
|
||||
"4eac077a713c57b4f4397629a4145982c661f48044dd3f96427d40b147d9742f",
|
||||
"de6a7b00deadc788eb6b6c8d20c0ae96c2f2019078fa604fee5b87d6e989ad7b",
|
||||
"bcab477be20861e01e4a0e295284146a510150d9817763caf1a6f4b422d67042",
|
||||
"2a292df7e32cababbd9de088d1d1abec9fc0440f637ed2fba145094dc14bea08",
|
||||
"f4a9e534fc0d216c44b218fa0c42d99635a0127ee2e53c712f70609649fdff22",
|
||||
"8268436f8c4126196cf64b3c7ddbda90746a378625f9813dd9b8457077256731",
|
||||
"2810e5cbc2cc4d4eece54f61c6f69758e289aa7ab440b3cbeaa21995c2f4232b",
|
||||
|
||||
/* Negative xy value */
|
||||
"3eb858e78f5a7254d8c9731174a94f76755fd3941c0ac93735c07ba14579630e",
|
||||
"a45fdc55c76448c049a1ab33f17023edfb2be3581e9c7aade8a6125215e04220",
|
||||
"d483fe813c6ba647ebbfd3ec41adca1c6130c2beeee9d9bf065c8d151c5f396e",
|
||||
"8a2e1d30050198c65a54483123960ccc38aef6848e1ec8f5f780e8523769ba32",
|
||||
"32888462f8b486c68ad7dd9610be5192bbeaf3b443951ac1a8118419d9fa097b",
|
||||
"227142501b9d4355ccba290404bde41575b037693cef1f438c47f8fbf35d1165",
|
||||
"5c37cc491da847cfeb9281d407efc41e15144c876e0170b499a96a22ed31e01e",
|
||||
"445425117cb8c90edcbc7c1cc0e74f747f2c1efa5630a967c64f287792a48a4b",
|
||||
|
||||
/* s = -1, which causes y = 0 */
|
||||
"ecffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f"
|
||||
};
|
||||
unsigned char *s;
|
||||
size_t i;
|
||||
|
||||
s = (unsigned char *) sodium_malloc(crypto_core_ristretto255_BYTES);
|
||||
for (i = 0; i < sizeof bad_encodings_hex / sizeof bad_encodings_hex[0]; i++) {
|
||||
sodium_hex2bin(s, crypto_core_ristretto255_BYTES, bad_encodings_hex[i],
|
||||
crypto_core_ristretto255_BYTES * 2 + 1,
|
||||
NULL, NULL, NULL);
|
||||
if (crypto_core_ristretto255_is_valid_point(s)) {
|
||||
printf("[%s] was not rejected\n", bad_encodings_hex[i]);
|
||||
}
|
||||
}
|
||||
sodium_free(s);
|
||||
};
|
||||
|
||||
static void
|
||||
tv2(void)
|
||||
{
|
||||
static const char *hash_hex[] = {
|
||||
"5d1be09e3d0c82fc538112490e35701979d99e06ca3e2b5b54bffe8b4dc772c1"
|
||||
"4d98b696a1bbfb5ca32c436cc61c16563790306c79eaca7705668b47dffe5bb6",
|
||||
|
||||
"f116b34b8f17ceb56e8732a60d913dd10cce47a6d53bee9204be8b44f6678b27"
|
||||
"0102a56902e2488c46120e9276cfe54638286b9e4b3cdb470b542d46c2068d38",
|
||||
|
||||
"8422e1bbdaab52938b81fd602effb6f89110e1e57208ad12d9ad767e2e25510c"
|
||||
"27140775f9337088b982d83d7fcf0b2fa1edffe51952cbe7365e95c86eaf325c",
|
||||
|
||||
"ac22415129b61427bf464e17baee8db65940c233b98afce8d17c57beeb7876c2"
|
||||
"150d15af1cb1fb824bbd14955f2b57d08d388aab431a391cfc33d5bafb5dbbaf",
|
||||
|
||||
"165d697a1ef3d5cf3c38565beefcf88c0f282b8e7dbd28544c483432f1cec767"
|
||||
"5debea8ebb4e5fe7d6f6e5db15f15587ac4d4d4a1de7191e0c1ca6664abcc413",
|
||||
|
||||
"a836e6c9a9ca9f1e8d486273ad56a78c70cf18f0ce10abb1c7172ddd605d7fd2"
|
||||
"979854f47ae1ccf204a33102095b4200e5befc0465accc263175485f0e17ea5c",
|
||||
|
||||
"2cdc11eaeb95daf01189417cdddbf95952993aa9cb9c640eb5058d09702c7462"
|
||||
"2c9965a697a3b345ec24ee56335b556e677b30e6f90ac77d781064f866a3c982"
|
||||
};
|
||||
unsigned char *s;
|
||||
unsigned char *u;
|
||||
char *hex;
|
||||
size_t i;
|
||||
|
||||
s = (unsigned char *) sodium_malloc(crypto_core_ristretto255_BYTES);
|
||||
u = (unsigned char *) sodium_malloc(crypto_core_ristretto255_HASHBYTES);
|
||||
hex = (char *) sodium_malloc(crypto_core_ristretto255_BYTES * 2 + 1);
|
||||
for (i = 0; i < sizeof hash_hex / sizeof hash_hex[0]; i++) {
|
||||
sodium_hex2bin(u, crypto_core_ristretto255_HASHBYTES, hash_hex[i],
|
||||
crypto_core_ristretto255_HASHBYTES * 2 + 1,
|
||||
NULL, NULL, NULL);
|
||||
crypto_core_ristretto255_from_hash(s, u);
|
||||
sodium_bin2hex(hex, crypto_core_ristretto255_BYTES * 2 + 1,
|
||||
s, crypto_core_ristretto255_BYTES);
|
||||
printf("%s\n", hex);
|
||||
}
|
||||
sodium_free(hex);
|
||||
sodium_free(u);
|
||||
sodium_free(s);
|
||||
}
|
||||
|
||||
static void
|
||||
tv3(void)
|
||||
{
|
||||
static const unsigned char l[crypto_core_ed25519_BYTES] =
|
||||
{ 0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58,
|
||||
0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10 };
|
||||
|
||||
unsigned char *r =
|
||||
(unsigned char *) sodium_malloc(crypto_core_ristretto255_SCALARBYTES);
|
||||
unsigned char *r_inv =
|
||||
(unsigned char *) sodium_malloc(crypto_core_ristretto255_SCALARBYTES);
|
||||
unsigned char *ru =
|
||||
(unsigned char *) sodium_malloc(crypto_core_ristretto255_HASHBYTES);
|
||||
unsigned char *s =
|
||||
(unsigned char *) sodium_malloc(crypto_core_ristretto255_BYTES);
|
||||
unsigned char *s_ =
|
||||
(unsigned char *) sodium_malloc(crypto_core_ristretto255_BYTES);
|
||||
unsigned char *s2 =
|
||||
(unsigned char *) sodium_malloc(crypto_core_ristretto255_BYTES);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 1000; i++) {
|
||||
crypto_core_ristretto255_scalar_random(r);
|
||||
if (crypto_scalarmult_ristretto255_base(s, r) != 0 ||
|
||||
crypto_core_ristretto255_is_valid_point(s) != 1) {
|
||||
printf("crypto_scalarmult_ristretto255_base() failed\n");
|
||||
}
|
||||
crypto_core_ristretto255_random(s);
|
||||
if (crypto_core_ristretto255_is_valid_point(s) != 1) {
|
||||
printf("crypto_core_ristretto255_random() failed\n");
|
||||
}
|
||||
if (crypto_scalarmult_ristretto255(s, l, s) == 0) {
|
||||
printf("s*l != inf (1)\n");
|
||||
}
|
||||
randombytes_buf(ru, crypto_core_ristretto255_HASHBYTES);
|
||||
if (crypto_core_ristretto255_from_hash(s, ru) != 0 ||
|
||||
crypto_core_ristretto255_is_valid_point(s) != 1) {
|
||||
printf("crypto_core_ristretto255_from_hash() failed\n");
|
||||
}
|
||||
if (crypto_scalarmult_ristretto255(s2, l, s) == 0) {
|
||||
printf("s*l != inf (2)\n");
|
||||
}
|
||||
if (crypto_scalarmult_ristretto255(s2, r, s) != 0 ||
|
||||
crypto_core_ristretto255_is_valid_point(s2) != 1) {
|
||||
printf("crypto_scalarmult_ristretto255() failed\n");
|
||||
}
|
||||
if (crypto_core_ristretto255_scalar_invert(r_inv, r) != 0) {
|
||||
printf("crypto_core_ristretto255_scalar_invert() failed\n");
|
||||
}
|
||||
if (crypto_scalarmult_ristretto255(s_, r_inv, s2) != 0 ||
|
||||
crypto_core_ristretto255_is_valid_point(s_) != 1) {
|
||||
printf("crypto_scalarmult_ristretto255() failed\n");
|
||||
}
|
||||
if (memcmp(s, s_, crypto_core_ristretto255_BYTES) != 0) {
|
||||
printf("inversion failed\n");
|
||||
}
|
||||
if (crypto_scalarmult_ristretto255(s2, l, s2) == 0) {
|
||||
printf("s*l != inf (3)\n");
|
||||
}
|
||||
if (crypto_core_ristretto255_add(s2, s, s_) != 0) {
|
||||
printf("addition failed");
|
||||
}
|
||||
if (crypto_core_ristretto255_sub(s2, s2, s_) != 0) {
|
||||
printf("subtraction failed");
|
||||
}
|
||||
if (crypto_core_ristretto255_is_valid_point(s2) == 0) {
|
||||
printf("invalid point");
|
||||
}
|
||||
if (memcmp(s, s2, crypto_core_ristretto255_BYTES) != 0) {
|
||||
printf("s2 + s - s_ != s\n");
|
||||
}
|
||||
if (crypto_core_ristretto255_sub(s2, s2, s) != 0) {
|
||||
printf("subtraction failed");
|
||||
}
|
||||
if (crypto_core_ristretto255_is_valid_point(s2) == -1) {
|
||||
printf("s + s' - s - s' != 0");
|
||||
}
|
||||
}
|
||||
|
||||
crypto_core_ristretto255_random(s);
|
||||
memset(s_, 0xfe, crypto_core_ristretto255_BYTES);
|
||||
assert(crypto_core_ristretto255_add(s2, s_, s) == -1);
|
||||
assert(crypto_core_ristretto255_add(s2, s, s_) == -1);
|
||||
assert(crypto_core_ristretto255_add(s2, s_, s_) == -1);
|
||||
assert(crypto_core_ristretto255_add(s2, s, s) == 0);
|
||||
assert(crypto_core_ristretto255_sub(s2, s_, s) == -1);
|
||||
assert(crypto_core_ristretto255_sub(s2, s, s_) == -1);
|
||||
assert(crypto_core_ristretto255_sub(s2, s_, s_) == -1);
|
||||
assert(crypto_core_ristretto255_sub(s2, s, s) == 0);
|
||||
|
||||
sodium_free(s2);
|
||||
sodium_free(s_);
|
||||
sodium_free(s);
|
||||
sodium_free(ru);
|
||||
sodium_free(r_inv);
|
||||
sodium_free(r);
|
||||
}
|
||||
|
||||
static void
|
||||
tv4(void)
|
||||
{
|
||||
unsigned char *r;
|
||||
unsigned char *s1;
|
||||
unsigned char *s2;
|
||||
unsigned char *s3;
|
||||
unsigned char *s4;
|
||||
|
||||
r = (unsigned char *) sodium_malloc(crypto_core_ristretto255_NONREDUCEDSCALARBYTES);
|
||||
s1 = (unsigned char *) sodium_malloc(crypto_core_ristretto255_SCALARBYTES);
|
||||
s2 = (unsigned char *) sodium_malloc(crypto_core_ristretto255_SCALARBYTES);
|
||||
s3 = (unsigned char *) sodium_malloc(crypto_core_ristretto255_SCALARBYTES);
|
||||
s4 = (unsigned char *) sodium_malloc(crypto_core_ristretto255_SCALARBYTES);
|
||||
|
||||
crypto_core_ristretto255_scalar_random(s1);
|
||||
randombytes_buf(r, crypto_core_ristretto255_NONREDUCEDSCALARBYTES);
|
||||
crypto_core_ristretto255_scalar_reduce(s2, r);
|
||||
memcpy(s4, s1, crypto_core_ristretto255_SCALARBYTES);
|
||||
crypto_core_ristretto255_scalar_add(s3, s1, s2);
|
||||
crypto_core_ristretto255_scalar_sub(s4, s1, s2);
|
||||
crypto_core_ristretto255_scalar_add(s2, s3, s4);
|
||||
crypto_core_ristretto255_scalar_sub(s2, s2, s1);
|
||||
crypto_core_ristretto255_scalar_mul(s2, s3, s2);
|
||||
crypto_core_ristretto255_scalar_invert(s4, s3);
|
||||
crypto_core_ristretto255_scalar_mul(s2, s2, s4);
|
||||
crypto_core_ristretto255_scalar_negate(s1, s1);
|
||||
crypto_core_ristretto255_scalar_add(s2, s2, s1);
|
||||
crypto_core_ristretto255_scalar_complement(s1, s2);
|
||||
s1[0]--;
|
||||
assert(sodium_is_zero(s1, crypto_core_ristretto255_SCALARBYTES));
|
||||
|
||||
sodium_free(s1);
|
||||
sodium_free(s2);
|
||||
sodium_free(s3);
|
||||
sodium_free(s4);
|
||||
sodium_free(r);
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
tv1();
|
||||
tv2();
|
||||
tv3();
|
||||
tv4();
|
||||
|
||||
assert(crypto_core_ristretto255_BYTES == crypto_core_ristretto255_bytes());
|
||||
assert(crypto_core_ristretto255_SCALARBYTES == crypto_core_ristretto255_scalarbytes());
|
||||
assert(crypto_core_ristretto255_NONREDUCEDSCALARBYTES == crypto_core_ristretto255_nonreducedscalarbytes());
|
||||
assert(crypto_core_ristretto255_NONREDUCEDSCALARBYTES >= crypto_core_ristretto255_SCALARBYTES);
|
||||
assert(crypto_core_ristretto255_HASHBYTES == crypto_core_ristretto255_hashbytes());
|
||||
assert(crypto_core_ristretto255_HASHBYTES >= crypto_core_ristretto255_BYTES);
|
||||
assert(crypto_core_ristretto255_BYTES == crypto_core_ed25519_BYTES);
|
||||
assert(crypto_core_ristretto255_SCALARBYTES == crypto_core_ed25519_SCALARBYTES);
|
||||
assert(crypto_core_ristretto255_NONREDUCEDSCALARBYTES == crypto_core_ed25519_NONREDUCEDSCALARBYTES);
|
||||
assert(crypto_core_ristretto255_HASHBYTES >= 2 * crypto_core_ed25519_UNIFORMBYTES);
|
||||
|
||||
printf("OK\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
3066f82a1a747d45120d1740f14358531a8f04bbffe6a819f86dfe50f44a0a46
|
||||
f26e5b6f7d362d2d2a94c5d0e7602cb4773c95a2e5c31a64f133189fa76ed61b
|
||||
006ccd2a9e6867e6a2c5cea83d3302cc9de128dd2a9a57dd8ee7b9d7ffe02826
|
||||
f8f0c87cf237953c5890aec3998169005dae3eca1fbb04548c635953c817f92a
|
||||
ae81e7dedf20a497e10c304a765c1767a42d6e06029758d2d7e8ef7cc4c41179
|
||||
e2705652ff9f5e44d3e841bf1c251cf7dddb77d140870d1ab2ed64f1a9ce8628
|
||||
80bd07262511cdde4863f8a7434cef696750681cb9510eea557088f76d9e5065
|
||||
OK
|
||||
@@ -0,0 +1,70 @@
|
||||
|
||||
#define TEST_NAME "ed25519_convert"
|
||||
#include "cmptest.h"
|
||||
|
||||
static const unsigned char keypair_seed[crypto_sign_ed25519_SEEDBYTES] = {
|
||||
0x42, 0x11, 0x51, 0xa4, 0x59, 0xfa, 0xea, 0xde, 0x3d, 0x24, 0x71,
|
||||
0x15, 0xf9, 0x4a, 0xed, 0xae, 0x42, 0x31, 0x81, 0x24, 0x09, 0x5a,
|
||||
0xfa, 0xbe, 0x4d, 0x14, 0x51, 0xa5, 0x59, 0xfa, 0xed, 0xee
|
||||
};
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
unsigned char ed25519_pk[crypto_sign_ed25519_PUBLICKEYBYTES];
|
||||
unsigned char ed25519_skpk[crypto_sign_ed25519_SECRETKEYBYTES];
|
||||
unsigned char curve25519_pk[crypto_scalarmult_curve25519_BYTES];
|
||||
unsigned char curve25519_pk2[crypto_scalarmult_curve25519_BYTES];
|
||||
unsigned char curve25519_sk[crypto_scalarmult_curve25519_BYTES];
|
||||
char curve25519_pk_hex[crypto_scalarmult_curve25519_BYTES * 2 + 1];
|
||||
char curve25519_sk_hex[crypto_scalarmult_curve25519_BYTES * 2 + 1];
|
||||
unsigned int i;
|
||||
|
||||
assert(crypto_sign_ed25519_SEEDBYTES <= crypto_hash_sha512_BYTES);
|
||||
crypto_sign_ed25519_seed_keypair(ed25519_pk, ed25519_skpk, keypair_seed);
|
||||
|
||||
if (crypto_sign_ed25519_pk_to_curve25519(curve25519_pk, ed25519_pk) != 0) {
|
||||
printf("conversion failed\n");
|
||||
}
|
||||
crypto_sign_ed25519_sk_to_curve25519(curve25519_sk, ed25519_skpk);
|
||||
sodium_bin2hex(curve25519_pk_hex, sizeof curve25519_pk_hex, curve25519_pk,
|
||||
sizeof curve25519_pk);
|
||||
sodium_bin2hex(curve25519_sk_hex, sizeof curve25519_sk_hex, curve25519_sk,
|
||||
sizeof curve25519_sk);
|
||||
|
||||
printf("curve25519 pk: [%s]\n", curve25519_pk_hex);
|
||||
printf("curve25519 sk: [%s]\n", curve25519_sk_hex);
|
||||
|
||||
for (i = 0U; i < 500U; i++) {
|
||||
crypto_sign_ed25519_keypair(ed25519_pk, ed25519_skpk);
|
||||
if (crypto_sign_ed25519_pk_to_curve25519(curve25519_pk, ed25519_pk) !=
|
||||
0) {
|
||||
printf("conversion failed\n");
|
||||
}
|
||||
crypto_sign_ed25519_sk_to_curve25519(curve25519_sk, ed25519_skpk);
|
||||
crypto_scalarmult_curve25519_base(curve25519_pk2, curve25519_sk);
|
||||
if (memcmp(curve25519_pk, curve25519_pk2, sizeof curve25519_pk) != 0) {
|
||||
printf("conversion failed\n");
|
||||
}
|
||||
}
|
||||
|
||||
sodium_hex2bin(ed25519_pk, crypto_sign_ed25519_PUBLICKEYBYTES,
|
||||
"0000000000000000000000000000000000000000000000000000000000000000"
|
||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||
64, NULL, NULL, NULL);
|
||||
assert(crypto_sign_ed25519_pk_to_curve25519(curve25519_pk, ed25519_pk) == -1);
|
||||
sodium_hex2bin(ed25519_pk, crypto_sign_ed25519_PUBLICKEYBYTES,
|
||||
"0200000000000000000000000000000000000000000000000000000000000000"
|
||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||
64, NULL, NULL, NULL);
|
||||
assert(crypto_sign_ed25519_pk_to_curve25519(curve25519_pk, ed25519_pk) == -1);
|
||||
sodium_hex2bin(ed25519_pk, crypto_sign_ed25519_PUBLICKEYBYTES,
|
||||
"0500000000000000000000000000000000000000000000000000000000000000"
|
||||
"0000000000000000000000000000000000000000000000000000000000000000",
|
||||
64, NULL, NULL, NULL);
|
||||
assert(crypto_sign_ed25519_pk_to_curve25519(curve25519_pk, ed25519_pk) == -1);
|
||||
|
||||
printf("ok\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
curve25519 pk: [f1814f0e8ff1043d8a44d25babff3cedcae6c22c3edaa48f857ae70de2baae50]
|
||||
curve25519 sk: [8052030376d47112be7f73ed7a019293dd12ad910b654455798b4667d73de166]
|
||||
ok
|
||||
1406
components/espressif__libsodium/libsodium/test/default/generichash.c
Normal file
1406
components/espressif__libsodium/libsodium/test/default/generichash.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,65 @@
|
||||
05
|
||||
5d8c
|
||||
22221b
|
||||
d4974470
|
||||
be8492fb36
|
||||
edc178279907
|
||||
26848f2ae0c2e6
|
||||
045cf1235112b9f6
|
||||
5110bad569356dfa6c
|
||||
1339d95145bc8a33d3aa
|
||||
3dbb39b4d57c5566808a88
|
||||
22378260939cee01022686a2
|
||||
e18b37abcead6cc520e6504dac
|
||||
3cbb356604cf862e62ad2f534323
|
||||
44c41ba227b191961b475ec5875057
|
||||
0c7c9c3922d41a7b2b3b20f92685d560
|
||||
8508c01d19709bdd881866aa1f8c63ca06
|
||||
f6b2dddfbece6d7d52e114c7e5a97772e18d
|
||||
d36b5af9591d0cd3747254e26bc6e1de5b6081
|
||||
f7f7ce69149418d7ec33327bd86e14bcca4b8ed7
|
||||
2c9aba9a56de21165753c4f3cee9310a9c8fe546b9
|
||||
ee5e08cee5fbbcb51900341bb30db6695920faecda6a
|
||||
fe9ffb56dc5716b91bc7d77ce7b05e7cc39c31683bec91
|
||||
c500ae0f5bff0f1106ce104ae9c291add7207e0d8ebcb1ed
|
||||
68e23d12000b387158afd6458d3bcef9c26936ca68b5c0f3d6
|
||||
220efa2c09f67dbb02aa623bbc0cb92107a30f53b633e78d4b44
|
||||
54df984b47e4bcd489d9c045c488743fac91c9b3e0cbcc37495fac
|
||||
b4852cf66c6ce164c002bbb62ded0faeb4a39c39fdffb372ff14dd31
|
||||
d79cafb5565e7775616e1c9b09100d61fb71efaf25affcf2d480d2c980
|
||||
ae557883145e374adef583ba0550429d5cdd86b254c33bf52d02e070efda
|
||||
9f53d28c0df7b327c2eb4c8a12c742829225b7f30fda7baf64135098fdb01b
|
||||
a9f51bb7f6a3e9cdb96ce652c07d177962a348a9cced1b92f948187e59b44463
|
||||
f2960cf5fd57fc92f549cd5a2803147964f60e7703e1b8897c088cded74c7bd39f
|
||||
89981acbb690eb03ed2a67510d1d85a1b4f9d496fdfe134550ae14146bb05fd5fedd
|
||||
6d8245383fd7c418b46511339e711b9d4a0d1f5fdf6de45fdd3d0664164b7bf878a124
|
||||
1f0b6b083d524e0741710ddef499ce88f51083bb3ad80a1815cc57acf006436e9b6ad72b
|
||||
fc35bfe34c915020bb8b44fa0a19933774eaaf61919780fd55564e085bc31646dfc1d426e9
|
||||
117d58f1f8cb2c036102686035975be90550795e5a0e3469a8f7a2cba9bc88961852b18c8ae3
|
||||
c679c950818729c799bb7f39cef2d89fa80a147817f379a073ef1ccafea5d369815c70373bf5be
|
||||
d487ad2143024ee8c645a066c035b74abe3a11f1c9fcd738b154b8ca37134d74fb78c40d1a2274cf
|
||||
2d3ee00828b0ccea6812b40f214fab6d4f23f7e74ae228115bcb208ced2d5e1cb9cdff41de912af7a8
|
||||
a697b26d4c4475e312288b98ae2ec4954d3c74c8e144c0ab518616ff9f52918a946fd765af75e761178c
|
||||
f647bcba2a711f431d6d453aa7d75dcf5bb9ab6f8b83f89117230f633e7580f27c71c4f4c211cadd04f587
|
||||
1fc1d6a4db753e2f4fd1456b2b709dd70ad58547eeda9d5a55762b5cd4097a7a1bd73cc633ec27168ee65631
|
||||
1cfe0f63ab155379b4a1b5bf694a33635097b8e4b6dbd3b983d62454d36d7bf4550bece301abdd27b2dd76ca9f
|
||||
73dee8a0a558e7b6f6eefe411280e253b05ef006d499849fea5d6a95f9141ee160322fff3a3f70e10c84025e02ce
|
||||
edf9e706f4acae4f4bed72404f14458ba075d2b9d9a4a1ed46d1f1c5e23113a74cce9f7735432a922a3d8097f22c7a
|
||||
95d5cd54c6722ac4335fa0ab38d388c9fd0baea48a9078605e400534ef38f13abb1d770da84b90b0256e1c1b64f54ba9
|
||||
fe6b85ee8b5eb7da035264ed46e6dcd948571018d1f6976de4102fcb4bb5f1422e7df1b5aaa5b6b56c5961966db29ead6e
|
||||
499ab83c01e4bf74ea5036392f9f810eae8a066fff49e316e4288baccb2001efa24f64cef7bfae70c90f139b198e53ad87f1
|
||||
eac6c9d97264241a8adba22ee925438ed9787a547018608a10676a7594bc51c60294bd9159fbcada9022b44880a37c5b07c1b4
|
||||
0771e3ae24bbfe424800d4bae776fef3da1607990019e7c4b30bc8140061ebf0b64aad7b018a878d579caa67154b98a04402735e
|
||||
d569e5f5fe197387451441911a2be2effa606dad39820af44cea056bd9d1499dde41fa1c6c3a0459d5866c944bec2ac83328953726
|
||||
68e523ded865c4d8318d61c312189a59597bbc3995e312e85137611af761a5f73508ac79e359edf729d4508830fc642b432f09185914
|
||||
601af664ae596166707244adbb4f704593b355c6a659c844d853c6647fb265cdbcea26ed43657251dec37f2d6453fa0ace55f22d303cb0
|
||||
703d8e552236b2090143444545f0a61a809d8ef9843bcf6883f61671fb31c8d6ac9fd373e7f9f79a0c72fa6a37dc655ba1fb01a5f41e36d1
|
||||
03896f594afd1bf97acb862106eb05a1d8b54ec08d184812a79f4dc7b287a7486e60927b6c23e5f51fcbc94798648b28fd13438300567bec95
|
||||
cc66a891768e95a2717b040c111996f14942f10f2475c33aa5f1c97476e6f8386733d6b21c16102d01ff1f715475f01099e1f19aa763238a38a9
|
||||
007aac8eae29e5bf2be1b54857f5fe80c324424a3273b46e55482fbc4ae1033df4a97016b60c81a5344abd6366f56d8cee2c2e94619418293990de
|
||||
50c81e92605a6111ea4c7c602acfb3945d4c2631c8c08fa4b594134577f5c2ffcca90d48604162cfdb2a0bb40416ff9134a275461b829ff1b875f995
|
||||
661b7a1c70170aa7559aa82639fa65c1bdcfb5e336cb23b40a9edf5b4f6eeca1a176a9844da705cafb990dd94b9dc6194eb6b2de3eca9dbd255bb267a1
|
||||
9ff11c233aaf5e0242b0dbe6e110a42e58b86141ad0ef130fd2bb895700019782de66d435bf0a8d6f5eda5d7d1105e7a6f3ef17a9da8f9c16fc21075431a
|
||||
bdd3d0fafe8ba2b29d1ac0b79aa46e249cc9d3a82d0f772d690637bbdd353722356658d00436ff5dd5239ab747979329345eb8c7ed11b7331456ae87350fcf
|
||||
bd965bf31e87d70327536f2a341cebc4768eca275fa05ef98f7f1b71a0351298de006fba73fe6733ed01d75801b4a928e54231b38e38c562b2e33ea1284992fa
|
||||
2fc6e69fa26a89a5ed269092cb9b2a449a4409a7a44011eecad13d7c4b0456602d402fa5844f1a7a758136ce3d5d8d0e8b86921ffff4f692dd95bdc8e5ff0052
|
||||
@@ -0,0 +1,62 @@
|
||||
|
||||
#define TEST_NAME "generichash2"
|
||||
#include "cmptest.h"
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
#define MAXLEN 64
|
||||
crypto_generichash_state *st;
|
||||
unsigned char in[MAXLEN];
|
||||
unsigned char out[crypto_generichash_BYTES_MAX];
|
||||
unsigned char k[crypto_generichash_KEYBYTES_MAX];
|
||||
size_t h, i, j;
|
||||
|
||||
assert(crypto_generichash_statebytes() >= sizeof *st);
|
||||
st = (crypto_generichash_state *)
|
||||
sodium_malloc(crypto_generichash_statebytes());
|
||||
for (h = 0; h < crypto_generichash_KEYBYTES_MAX; ++h) {
|
||||
k[h] = (unsigned char) h;
|
||||
}
|
||||
for (i = 0; i < MAXLEN; ++i) {
|
||||
in[i] = (unsigned char) i;
|
||||
if (crypto_generichash_init(st, k,
|
||||
1 + i % crypto_generichash_KEYBYTES_MAX,
|
||||
1 + i % crypto_generichash_BYTES_MAX) != 0) {
|
||||
printf("crypto_generichash_init()\n");
|
||||
return 1;
|
||||
}
|
||||
crypto_generichash_update(st, in, i);
|
||||
crypto_generichash_update(st, in, i);
|
||||
crypto_generichash_update(st, in, i);
|
||||
if (crypto_generichash_final(st, out,
|
||||
1 + i % crypto_generichash_BYTES_MAX) != 0) {
|
||||
printf("crypto_generichash_final() should have returned 0\n");
|
||||
}
|
||||
for (j = 0; j < 1 + i % crypto_generichash_BYTES_MAX; ++j) {
|
||||
printf("%02x", (unsigned int) out[j]);
|
||||
}
|
||||
printf("\n");
|
||||
if (crypto_generichash_final(st, out,
|
||||
1 + i % crypto_generichash_BYTES_MAX) != -1) {
|
||||
printf("crypto_generichash_final() should have returned -1\n");
|
||||
}
|
||||
}
|
||||
|
||||
assert(crypto_generichash_init(st, k, sizeof k, 0U) == -1);
|
||||
assert(crypto_generichash_init(st, k, sizeof k,
|
||||
crypto_generichash_BYTES_MAX + 1U) == -1);
|
||||
assert(crypto_generichash_init(st, k, crypto_generichash_KEYBYTES_MAX + 1U,
|
||||
sizeof out) == -1);
|
||||
assert(crypto_generichash_init(st, k, 0U, sizeof out) == 0);
|
||||
assert(crypto_generichash_init(st, k, 1U, sizeof out) == 0);
|
||||
assert(crypto_generichash_init(st, NULL, 1U, 0U) == -1);
|
||||
assert(crypto_generichash_init(st, NULL, crypto_generichash_KEYBYTES,
|
||||
1U) == 0);
|
||||
assert(crypto_generichash_init(st, NULL, crypto_generichash_KEYBYTES,
|
||||
0U) == -1);
|
||||
|
||||
sodium_free(st);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
05
|
||||
22a8
|
||||
287a9d
|
||||
d8eeab1c
|
||||
d4ce34973f
|
||||
584f7ac46f0c
|
||||
32c848bb67545b
|
||||
8438e21361bca125
|
||||
27a6faae998b4fabb4
|
||||
508c05a4f2daee150bad
|
||||
68c886c97dce370e8c72fa
|
||||
d41e90824ace31ba7bf512ac
|
||||
6e0d7a1e2b92a68e45ea867895
|
||||
1fc5ee8715312db38da9066152a5
|
||||
3138504ba58fcd56c62752bc98a6d2
|
||||
b689ecd5357cb5276007627fbdf4082e
|
||||
afe251881beb8b9dfa3d4f76aafc7b2995
|
||||
980eaa215cb0911027c5564db809bb8ac0a1
|
||||
56048436883efdfc8feaa239d960fa5ce24d42
|
||||
fce905b6d57fd841f58899a77887a4988e6aa2d1
|
||||
6f7afd81d24ccf4d98188b71bdbb7e6c637620879b
|
||||
50406b4c37b48621505942b35dff30a75f7d2868146b
|
||||
32c21792e18e7a79a4a20ef291721d7eab4e4cf99fbe79
|
||||
4b9d9ac5dbfb825acd87588667e6683e0fde4cdcd0a532f9
|
||||
2b55a3ebb461623e5de4fbacfb8b26819cfa8adeb094c8c13b
|
||||
4c7d261780b25a864a008352ad64d1ae7fc21d608317813cf63f
|
||||
f0ca06b8e12c48f1511d0991ba562f06dbe6ba6d5e18280224cc6a
|
||||
838a5f7056bfbca65a245796dd3510cb07ff1614b44989d91ac650b2
|
||||
a58a8da276577160441f8b9e9c52a041b7caf7cd316acc506f620ab0e1
|
||||
e03940a7231049ff2b86c47a28e4951f105d2a3aa3421190fe0ed6aa4ad6
|
||||
a7af977c0b34294b1a03d0cc2dcf6eb72f9a32721c3f70128384aeb1f56047
|
||||
0e5625d74ada70b8a3b23ca76894e9a0f9dee88f5e3e370e27ad25061ea9dd6f
|
||||
775fd9257b265997a16557a445985091798af60e68d06e3ae8e2e886d23ed12f6e
|
||||
852e8d4208166a990e215ed06b86c708f491e014584ac9b08f97f24d9f08a84c8e83
|
||||
fbdca0db9a933fcffcce2ae694d7e16e7571b100564fcb3d69cec82ea42f254a493a32
|
||||
50530ae5eb9780f3fafc5d179f7b363a0d69314a8545d68588b5fec28c8e8d1a011857f6
|
||||
5eb71553ff1ac4aba3f84faeb70281c738e3428aae68edc9842ebf55ffd7184a015e323445
|
||||
39b279c6d9cca89f8052f953abf71041faf3491b2b965cef503d715e8bf339e02a58fd0e0fba
|
||||
e315bef5f4918e881dc8d39d3c6b3948c2ea8e21ac00ee7c7ab875a53e194add0c3d9b8bcba5b2
|
||||
4e950f0e1da3111d054136fbdf10b4b88b20de6ad0c6bd5024a5e0a8b4cd7059685c0b663a00cbfa
|
||||
b1ed8d99fd62a4f504ecdd58a01759a85932a7783f88f314cdca5019e05063dcc1fcb3c39b8c07758e
|
||||
e4d78e734b0cb5bbd83e22bc67f97bbc8a3644f789f6c26a3ec2fe72c75b4d48a3bc000e6f2f2f0726fe
|
||||
162e01beb796433a2771eab54611fc93677ed12c73a93ea4d75e148bec7ab14b3e31ab7f395456fb2b47ab
|
||||
759c30631fd52e80a22f0614125dcd136287db65079908b75fb5b03be1cdf6dd0a1c9de0cc759cdd82c33758
|
||||
af2992acdaf0908f03a2025854de6446123c919b1e24db711df6cb070091343b4e6f5b2716c20c2547f50f1fde
|
||||
b833064955778a611fe41a9f1a2de730a16fb4e61a7e2fb67425ce199101d4e71dd7b0c731ea4188e9cc30e9bc52
|
||||
e546ee327168d9b4e0d73d9a043f9ef03f880bc8aee91b0923704eb7361ac916b00f5c71c872e2f911a77ef76704b5
|
||||
83d86f056729fa1a6e1d3fe8c3d2ebe42b327025747f2e6ba923d2b7b893e31571839937222852033844e585b17d462f
|
||||
5d70402524fbef569552a3ff6854087e090ff9ac9ea03aba92cf9f33a28845fa6a1631090dca10e05cdd3341b391a15fcf
|
||||
64f4d3ebf0717900f7c04512d1e18f9985975991d4254d76c4e2ee02c0edd6f912f715991984731b808b8370be1f201e53bf
|
||||
7d45eae6626dfc9ec3591764b8c39c72ca67e6c1893ab590963a75922719937d1d0ff188a510ffbdf9c777a4d565b3683cbf38
|
||||
68e007db5067874548c0d12a9ca709221f9bd352e3eb9847fde6c5de4a8550f4b85b67fe4e5aad70626ebb27d71e5b528effb2e6
|
||||
b0dc4dc0bd0d41a8ccfa45a127542079bc4e6f63a63863a9ce21f44481d23eff1060ea03851759b9317209405d5b7cc4387cc2759b
|
||||
adf6a9df484e93eb3a6113c3fd68a49b2166878fc652833c9cbef3fd8dd281d385ad0374bc25bc865b216ca395e21c30b9eda1d58a8d
|
||||
f1df9bc169323da338daa8a94867db96a1a2a6feb26569198fb4591ae602ba6f766a879e745d71e93b6cb8886b914f2bf4aa55d4c48045
|
||||
0c7446078a5077f33bba1ebfad60bbf1b1df47aab2eb3f3f3274ce56ead7800cf095af8208b6d570c4c832fe33227bbbc0842a13e1e82ad9
|
||||
accd0b4682e56698ecc55a60a8db8b3f950b6bffc5a1d160daf6ca25e13e3b4983ced5903df0bdc21f70c2ec5adb1a2ec9617df645cdd17ac9
|
||||
b787bae190ff2608eb383e0299cc10d6b7232de67ab74285e7bfa933d79f91226066537d74a9d40140d7b1683c2d42cd1935f6430cc554db2b69
|
||||
d09b717a0c80f581c07b8813e0ae79cec2188f77122f7477954610655a20420f13eb1b68cacde8c1fdf7a9a398efa72f40c85f0122812eaa33aba0
|
||||
87fff156d9895917468e92848fdcfacc134ca3bfc7fce484bd6db41c682ee2ee47151df0fa863d5641633d908c0328e6cbe080e80d8293530ffd2c4f
|
||||
1b17b2c0e7afcd224ec9bbe9ce9a13a00bd0a336b863f1b4d5304043778244323bd23fb6154a2e1e94aa48f6ff0e12787a50ca09e9e72ece9e038f6218
|
||||
23ac1ccd5e7df51b65b284650158d662e7ef51ebae01b879f39cec484b688c792f8e854bd8ca31ffe8796d28f10e49ab402dab47878a21cb95556dc32b0a
|
||||
f8f5323ebcc28bf927e72d342b5b70d80ba67794afb4c28debad21b0dae24c7a9252e862eb4b83bea6d9c0bb7c108983c987f13d73f250c7f14483f0454a24
|
||||
55b97ca594d68ccf69a0a93fe7fa4004c7e2947a8cac4ca4a44e17ac6876f472e3f221b341a28004cd35a79cfad7fabb9378ce5af03e4c0445ebbe9540943bbd
|
||||
@@ -0,0 +1,176 @@
|
||||
|
||||
#define TEST_NAME "generichash3"
|
||||
#include "cmptest.h"
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
#define MAXLEN 64
|
||||
crypto_generichash_blake2b_state st;
|
||||
unsigned char salt[crypto_generichash_blake2b_SALTBYTES]
|
||||
= { '5', 'b', '6', 'b', '4', '1', 'e', 'd',
|
||||
'9', 'b', '3', '4', '3', 'f', 'e', '0' };
|
||||
unsigned char personal[crypto_generichash_blake2b_PERSONALBYTES]
|
||||
= { '5', '1', '2', '6', 'f', 'b', '2', 'a',
|
||||
'3', '7', '4', '0', '0', 'd', '2', 'a' };
|
||||
unsigned char in[MAXLEN];
|
||||
unsigned char out[crypto_generichash_blake2b_BYTES_MAX];
|
||||
unsigned char k[crypto_generichash_blake2b_KEYBYTES_MAX];
|
||||
size_t h;
|
||||
size_t i;
|
||||
size_t j;
|
||||
|
||||
assert(crypto_generichash_blake2b_statebytes() >= sizeof st);
|
||||
for (h = 0; h < crypto_generichash_blake2b_KEYBYTES_MAX; ++h) {
|
||||
k[h] = (unsigned char) h;
|
||||
}
|
||||
|
||||
for (i = 0; i < MAXLEN; ++i) {
|
||||
in[i] = (unsigned char) i;
|
||||
crypto_generichash_blake2b_init_salt_personal(
|
||||
&st, k, 1 + i % crypto_generichash_blake2b_KEYBYTES_MAX,
|
||||
1 + i % crypto_generichash_blake2b_BYTES_MAX, salt, personal);
|
||||
crypto_generichash_blake2b_update(&st, in, (unsigned long long) i);
|
||||
crypto_generichash_blake2b_final(
|
||||
&st, out, 1 + i % crypto_generichash_blake2b_BYTES_MAX);
|
||||
for (j = 0; j < 1 + i % crypto_generichash_blake2b_BYTES_MAX; ++j) {
|
||||
printf("%02x", (unsigned int) out[j]);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
memset(out, 0, sizeof out);
|
||||
crypto_generichash_blake2b_init_salt_personal(
|
||||
&st, k, 0U, crypto_generichash_blake2b_BYTES_MAX, salt, personal);
|
||||
crypto_generichash_blake2b_update(&st, in, MAXLEN);
|
||||
crypto_generichash_blake2b_final(&st, out,
|
||||
crypto_generichash_blake2b_BYTES_MAX);
|
||||
for (j = 0; j < crypto_generichash_blake2b_BYTES_MAX; ++j) {
|
||||
printf("%02x", (unsigned int) out[j]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
memset(out, 0, sizeof out);
|
||||
crypto_generichash_blake2b_init_salt_personal(
|
||||
&st, NULL, 1U, crypto_generichash_blake2b_BYTES_MAX, salt, personal);
|
||||
crypto_generichash_blake2b_update(&st, in, MAXLEN);
|
||||
crypto_generichash_blake2b_final(&st, out,
|
||||
crypto_generichash_blake2b_BYTES_MAX);
|
||||
for (j = 0; j < crypto_generichash_blake2b_BYTES_MAX; ++j) {
|
||||
printf("%02x", (unsigned int) out[j]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
memset(out, 0, sizeof out);
|
||||
crypto_generichash_blake2b_init_salt_personal(
|
||||
&st, k, crypto_generichash_blake2b_KEYBYTES_MAX,
|
||||
crypto_generichash_blake2b_BYTES_MAX, NULL, personal);
|
||||
crypto_generichash_blake2b_update(&st, in, MAXLEN);
|
||||
crypto_generichash_blake2b_final(&st, out,
|
||||
crypto_generichash_blake2b_BYTES_MAX);
|
||||
for (j = 0; j < crypto_generichash_blake2b_BYTES_MAX; ++j) {
|
||||
printf("%02x", (unsigned int) out[j]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
memset(out, 0, sizeof out);
|
||||
crypto_generichash_blake2b_init_salt_personal(
|
||||
&st, k, crypto_generichash_blake2b_KEYBYTES_MAX,
|
||||
crypto_generichash_blake2b_BYTES_MAX, salt, NULL);
|
||||
crypto_generichash_blake2b_update(&st, in, MAXLEN);
|
||||
crypto_generichash_blake2b_final(
|
||||
&st, out, crypto_generichash_blake2b_BYTES_MAX);
|
||||
for (j = 0; j < crypto_generichash_blake2b_BYTES_MAX; ++j) {
|
||||
printf("%02x", (unsigned int) out[j]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
memset(out, 0, sizeof out);
|
||||
crypto_generichash_blake2b_salt_personal(
|
||||
out, crypto_generichash_blake2b_BYTES_MAX, in, MAXLEN,
|
||||
k, 0U, salt, personal);
|
||||
for (j = 0; j < crypto_generichash_blake2b_BYTES_MAX; ++j) {
|
||||
printf("%02x", (unsigned int) out[j]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
memset(out, 0, sizeof out);
|
||||
crypto_generichash_blake2b_salt_personal(
|
||||
out, crypto_generichash_blake2b_BYTES_MAX, in, MAXLEN,
|
||||
NULL, 0U, salt, personal);
|
||||
for (j = 0; j < crypto_generichash_blake2b_BYTES_MAX; ++j) {
|
||||
printf("%02x", (unsigned int) out[j]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
memset(out, 0, sizeof out);
|
||||
crypto_generichash_blake2b_salt_personal(
|
||||
out, crypto_generichash_blake2b_BYTES_MAX, in, MAXLEN,
|
||||
k, crypto_generichash_blake2b_KEYBYTES_MAX, salt, personal);
|
||||
for (j = 0; j < crypto_generichash_blake2b_BYTES_MAX; ++j) {
|
||||
printf("%02x", (unsigned int) out[j]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
memset(out, 0, sizeof out);
|
||||
crypto_generichash_blake2b_salt_personal(
|
||||
out, crypto_generichash_blake2b_BYTES_MAX, in, MAXLEN,
|
||||
k, crypto_generichash_blake2b_KEYBYTES_MAX, NULL, personal);
|
||||
for (j = 0; j < crypto_generichash_blake2b_BYTES_MAX; ++j) {
|
||||
printf("%02x", (unsigned int) out[j]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
memset(out, 0, sizeof out);
|
||||
crypto_generichash_blake2b_salt_personal(
|
||||
out, crypto_generichash_blake2b_BYTES_MAX, in, MAXLEN,
|
||||
k, crypto_generichash_blake2b_KEYBYTES_MAX, salt, NULL);
|
||||
for (j = 0; j < crypto_generichash_blake2b_BYTES_MAX; ++j) {
|
||||
printf("%02x", (unsigned int) out[j]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
assert(crypto_generichash_blake2b_salt_personal
|
||||
(guard_page, 0,
|
||||
in, (unsigned long long) sizeof in,
|
||||
k, sizeof k, NULL, NULL) == -1);
|
||||
assert(crypto_generichash_blake2b_salt_personal
|
||||
(guard_page, crypto_generichash_BYTES_MAX + 1,
|
||||
in, (unsigned long long) sizeof in,
|
||||
k, sizeof k, NULL, NULL) == -1);
|
||||
assert(crypto_generichash_blake2b_salt_personal
|
||||
(guard_page, (unsigned long long) sizeof in,
|
||||
in, (unsigned long long) sizeof in,
|
||||
k, crypto_generichash_KEYBYTES_MAX + 1, NULL, NULL) == -1);
|
||||
|
||||
crypto_generichash_blake2b_init_salt_personal(&st, NULL, 0U, crypto_generichash_BYTES,
|
||||
NULL, personal);
|
||||
crypto_generichash_blake2b_update(&st, in, MAXLEN);
|
||||
crypto_generichash_blake2b_final(&st, out, crypto_generichash_blake2b_BYTES_MAX);
|
||||
for (j = 0; j < crypto_generichash_blake2b_BYTES_MAX; ++j) {
|
||||
printf("%02x", (unsigned int) out[j]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
crypto_generichash_blake2b_init_salt_personal(&st, NULL, 0U, crypto_generichash_BYTES,
|
||||
salt, NULL);
|
||||
crypto_generichash_blake2b_update(&st, in, MAXLEN);
|
||||
crypto_generichash_blake2b_final(&st, out, crypto_generichash_blake2b_BYTES_MAX);
|
||||
for (j = 0; j < crypto_generichash_blake2b_BYTES_MAX; ++j) {
|
||||
printf("%02x", (unsigned int) out[j]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
assert(crypto_generichash_blake2b_init_salt_personal
|
||||
(&st, k, sizeof k, 0, NULL, NULL) == -1);
|
||||
assert(crypto_generichash_blake2b_init_salt_personal
|
||||
(&st, k, sizeof k, crypto_generichash_blake2b_BYTES_MAX + 1, NULL, NULL) == -1);
|
||||
assert(crypto_generichash_blake2b_init_salt_personal
|
||||
(&st, k, crypto_generichash_blake2b_KEYBYTES_MAX + 1, sizeof out, NULL, NULL) == -1);
|
||||
|
||||
assert(crypto_generichash_blake2b_init_salt_personal(&st, k, sizeof k, crypto_generichash_BYTES,
|
||||
NULL, personal) == 0);
|
||||
assert(crypto_generichash_blake2b_init_salt_personal(&st, k, sizeof k, crypto_generichash_BYTES,
|
||||
salt, NULL) == 0);
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
ba
|
||||
6139
|
||||
3a1666
|
||||
5797e9d0
|
||||
834a26efe6
|
||||
d7e9e862bbce
|
||||
40d8b84c374750
|
||||
276789189244cf04
|
||||
16f73ffe0673cc9992
|
||||
b3835bfaf6eb71d94078
|
||||
8c624e844d34f4a59f34cc
|
||||
e0a394962413ad09975df3cf
|
||||
47f043c3aacb501f97e0458ae3
|
||||
b4a11f2fb72a7e6f96fdacf98d49
|
||||
f434079e9adeb244047cb6855f9854
|
||||
5fbe885c4b2d4e0d78dc5905622a277a
|
||||
e262ba3e2ab76efdf83513108e3b987d1b
|
||||
add93dde78d32e77bc039c34a49043f19d26
|
||||
093842ac10e2eb1237ddc9ca9e7990cf397772
|
||||
09e7f6a0e2ea4888f1dbf6562effd1561c65029c
|
||||
bd33a9ec914f5b81864a49184338e4062d6c6b2b2e
|
||||
8dc46295235d94f5881d429a5ad47f9db9e35cf8c6b3
|
||||
ba5df554dca7ac1cba4889fa88adf3070fbf4ab5d187b5
|
||||
1ff84715e71c66214d271d421395fb6166db97b1d47ed697
|
||||
75a0d227c70549f5b0c933b7b21f151355bd47e04b6085c91f
|
||||
a32a5c9439a0fa771dcbe7f338b5dcef62a754edc4952614d6f0
|
||||
53a87de519cdcc7f64730d58bce6baaf7b44c5c428a4611a208ad4
|
||||
5e5ad8f0c4f083f9b7a5154d9c0dfd0f3d2fce94cf54fc215450314a
|
||||
9c76b9e63c77e6564b1e5111c2fb140046e1e5a4f900a7cfc2bac3fcfa
|
||||
bb919251ca310eb9b994e5d7883bc9fa2144b59b8d5d940677b7130ac777
|
||||
faa492a66f08ef0c7adb868fcb7b523aedd35b8ff1414bd1d554794f144474
|
||||
9b273ebe335540b87be899abe169389ed61ed262c3a0a16e4998bbf752f0bee3
|
||||
1e0070b92429c151b33bdd1bb4430a0e650a3dfc94d404054e93c8568330ecc505
|
||||
e3b64149f1b76231686d592d1d4af984ce2826ba03c2224a92f95f9526130ce4eb40
|
||||
5f8e378120b73db9eefa65ddcdcdcb4acd8046c31a5e47f298caa400937d5623f1394b
|
||||
74c757a4165a1782c933e587353a9fd8f6d7bf26b7f51b52c542747030bfb3d560c2e5c2
|
||||
2d5ee85cc238b923806dd98db18919d1924f2340ec88917d4ce1799cbfd5f2cb9df99db2e1
|
||||
c93ff727e6f9822efec0a77eed0025c0eff19127bf8746b7c71c2a098f57cef02febb86a1e6c
|
||||
adfb6d7ba13779a5dd1bbf268e400f4156f0f5c9d5b670ff539e1d9c1a63373416f3001f338407
|
||||
3a6900e58a448887d77c5911e4bdde620e64f25b2d71723fa60f7cb3efa7c320b6153bdbc3287949
|
||||
413eb0fd379b32dd88e82242a87cc58ce3e64c72352387a4c70f92ee5c8d23fa7ecd86f6df170a32d2
|
||||
92d0d3cacc3e25628caf6f2c4cd50d25d154ac45098f531d690230b859f37cfe089eb169f76bba72a3ff
|
||||
92f6ccc11a9a3bee520b17e0cddc4550c0e9cf47ddd9a6161284259ffb161c1d0675b505cb1066872768e8
|
||||
a3cd675804e6be7f120138a9eaadcd56bb7763d1c046e87fe0d358c8276b0d24621f46c60b46e397933b75b4
|
||||
304a1af53cbdd6486b8419d1ebd5e9528c540d8dc46a10be49067f46a0617229577015d776783f702b2954df43
|
||||
d8a6358970446453ac0c82c758644ab68989b5b4f06f9768807ce0c5f2a0dbac1e8450f4e3a02deecf7b54b6a45d
|
||||
1264b8dee9ac4aa8de69a43ada95cc95f20230f33836d4a1db8c2466ab38361686e5ac282025ccc2e0f6a1cd98a4dd
|
||||
7eed787abaa7f4e8b8aa3090f0676201cfbaaf350899661cdd5216ac0b5cd874443f5c0688ffd7ca1ccbfe1ca7e1a3f5
|
||||
8907f0218585167962a8e8213559a643dd03c2bf1a7a5ad3e3bc5f88c0ff1532ee8cd29880e7e0e68da22a5798aef27cc5
|
||||
12dea17b0733e5060751b1115e10c3d4b2f4583bcd009d9f1f42ec23d4a6a0df1185d3abbdbe86de08569e70583d6de1c1fe
|
||||
8ff75e91f1de547dc3a25472db2f51f5910a290c449603da54207b5e39bd735d240ec913b52df90709b5d29357971d6c341452
|
||||
4a3b16b12400f38e74778efc3a4caa52ec6fdf6b0180a5bfac9189e52e162c10e8911a54ab33e2b389ee1949e58edaa119e2b2b9
|
||||
c9943e7186fdc9bbfa1d7087fa7086babe6fcf95a6196d1772187854071304e2f1fff39e6e6f48f76addb16d5c00249e0523aac91f
|
||||
0297f16fdd34add9cc87b4adf816525b590ba08ac733c43f8d225d194df4f9c83b4dce617be51e25b5f6c80dff249f27c707de20e422
|
||||
576bb891eab9930998e2e73b5d0498e3c5f040f8dec9397a8c7a622c17de01fee7cc936e3bd4de1f7fd8b31dea9e70c65462bbb5dc7b50
|
||||
9416a57ae7c8c51c6e008f940fe06d8ebc02c350c19a2f71583a6d260b085670d73a95248fef0f4cae5292ba7db1189a7cd9c51122ba7913
|
||||
ea644b9051cca5eee8868a553e3f0f4e14739e1555474151156e10578256b288a233870dd43a380765400ea446df7f452c1e03a9e5b6731256
|
||||
f99cc1603de221abc1ecb1a7eb4bbf06e99561d1cc5541d8d601bae2b1dd3cbe448ac276667f26de5e269183a09f7deaf35d33174b3cc8ad4aa2
|
||||
ee2be1ec57fdac23f89402a534177eca0f4b982a4ed2c2e900b6a79e1f47a2d023eff2e647baf4f4c0da3a28d08a44bc780516974074e2523e6651
|
||||
9cda001868949a2bad96c5b3950a8315e6e5214d0b54dcd596280565d351806ef22cf3053f63623da72fcad9afa3896641658632334c9ec4f644c984
|
||||
c6d6722a916651a8671383d8260873347d9c248696b4cb3dac4dea9ba57ed971127cb18e44211d7e14177ace248b3c6e0785356ee261ebdc6ef0faf143
|
||||
5dd258a3e7505bc6b9776b0df25676a1c19e2c8258c7b5f2e361423523d96299eb6827bc7c27e7bca2d2b59d717c2ebcb05e6dcaa32289d96fae9a4077ef
|
||||
19c14de35fe19c92cc0e624280e4136355d4cfa9a0a98b090c4b06f5665021920725852ff1f566b0c8c37157b25fb9f947a2e70b40577a17860a0732c170ac
|
||||
5fcdcc02be7714a0dbc77df498bf999ea9225d564adca1c121c9af03af92cac8177b9b4a86bcc47c79aa32aac58a3fef967b2132e9352d4613fe890beed2571b
|
||||
1afc8ec818bef0a479d2b4cac81d40a52cafa27f6d80c42fc23cbaf4141882ab59ab1101922fcb6e707ef2f61efd07cce5d09094e6bee420b1b96998c7cee96d
|
||||
1afc8ec818bef0a479d2b4cac81d40a52cafa27f6d80c42fc23cbaf4141882ab59ab1101922fcb6e707ef2f61efd07cce5d09094e6bee420b1b96998c7cee96d
|
||||
5789f474edd5206ededaccfc35e7dd3ed730748125b5395abf802b2601126b19b109a1db67556945bc79bb25e1ab59610599d155070e0e04354f11a6a5d6f3ac
|
||||
e78efc663a5547c089f2b3b08973c974c4bfd365eac18b80c68bdb3b1ba4554b54d6b8465a68a3b9aa0bc020621f16efd5b8dd8c7c01ed9ee3ec5544aae465ff
|
||||
1afc8ec818bef0a479d2b4cac81d40a52cafa27f6d80c42fc23cbaf4141882ab59ab1101922fcb6e707ef2f61efd07cce5d09094e6bee420b1b96998c7cee96d
|
||||
1afc8ec818bef0a479d2b4cac81d40a52cafa27f6d80c42fc23cbaf4141882ab59ab1101922fcb6e707ef2f61efd07cce5d09094e6bee420b1b96998c7cee96d
|
||||
fb4e2ad6b7fe6afd2ba06d5c1d79379c5bf10e336a35c89a1aaf408a805171716e0635a5b1d18190131e15b6888510bcb3e3752b050f892a09dbbde60b051495
|
||||
5789f474edd5206ededaccfc35e7dd3ed730748125b5395abf802b2601126b19b109a1db67556945bc79bb25e1ab59610599d155070e0e04354f11a6a5d6f3ac
|
||||
e78efc663a5547c089f2b3b08973c974c4bfd365eac18b80c68bdb3b1ba4554b54d6b8465a68a3b9aa0bc020621f16efd5b8dd8c7c01ed9ee3ec5544aae465ff
|
||||
4f9875a42ba0da8ae3448d2d62b1ff51be672eb1b8a1b0fa5bcd5334c861eff06b5903d672d318fd04e0ef94ddd37eca6d4ad2051a36a0236dc4cc09a5a44358
|
||||
ec9f272db92d1fa99324115f34cda8b4690ad029c1df36986cf9e1f844d8fdeca8e8e8311620ad24cbbfa12eccb676b979565405c8e2e20a2e4f18fb27c93d76
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
#define TEST_NAME "hash"
|
||||
#include "cmptest.h"
|
||||
|
||||
static unsigned char x[] = "testing\n";
|
||||
static unsigned char x2[] =
|
||||
"The Conscience of a Hacker is a small essay written January 8, 1986 by a "
|
||||
"computer security hacker who went by the handle of The Mentor, who "
|
||||
"belonged to the 2nd generation of Legion of Doom.";
|
||||
static unsigned char h[crypto_hash_BYTES];
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
crypto_hash(h, x, sizeof x - 1U);
|
||||
for (i = 0; i < crypto_hash_BYTES; ++i) {
|
||||
printf("%02x", (unsigned int) h[i]);
|
||||
}
|
||||
printf("\n");
|
||||
crypto_hash(h, x2, sizeof x2 - 1U);
|
||||
for (i = 0; i < crypto_hash_BYTES; ++i) {
|
||||
printf("%02x", (unsigned int) h[i]);
|
||||
}
|
||||
printf("\n");
|
||||
crypto_hash_sha256(h, x, sizeof x - 1U);
|
||||
for (i = 0; i < crypto_hash_sha256_BYTES; ++i) {
|
||||
printf("%02x", (unsigned int) h[i]);
|
||||
}
|
||||
printf("\n");
|
||||
crypto_hash_sha256(h, x2, sizeof x2 - 1U);
|
||||
for (i = 0; i < crypto_hash_sha256_BYTES; ++i) {
|
||||
printf("%02x", (unsigned int) h[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
assert(crypto_hash_bytes() > 0U);
|
||||
assert(strcmp(crypto_hash_primitive(), "sha512") == 0);
|
||||
assert(crypto_hash_sha256_bytes() > 0U);
|
||||
assert(crypto_hash_sha512_bytes() >= crypto_hash_sha256_bytes());
|
||||
assert(crypto_hash_sha512_bytes() == crypto_hash_bytes());
|
||||
assert(crypto_hash_sha256_statebytes() == sizeof(crypto_hash_sha256_state));
|
||||
assert(crypto_hash_sha512_statebytes() == sizeof(crypto_hash_sha512_state));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
24f950aac7b9ea9b3cb728228a0c82b67c39e96b4b344798870d5daee93e3ae5931baae8c7cacfea4b629452c38026a81d138bc7aad1af3ef7bfd5ec646d6c28
|
||||
a77abe1ccf8f5497e228fbc0acd73a521ededb21b89726684a6ebbc3baa32361aca5a244daa84f24bf19c68baf78e6907625a659b15479eb7bd426fc62aafa73
|
||||
12a61f4e173fb3a11c05d6471f74728f76231b4a5fcd9667cef3af87a3ae4dc2
|
||||
71cc8123fef8c236e451d3c3ddf1adae9aa6cd9521e7041769d737024900a03a
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
#define TEST_NAME "hash3"
|
||||
#include "cmptest.h"
|
||||
|
||||
static unsigned char x[] = "testing\n";
|
||||
static unsigned char h[crypto_hash_BYTES];
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
crypto_hash(h, x, sizeof x - 1U);
|
||||
for (i = 0; i < crypto_hash_BYTES; ++i) {
|
||||
printf("%02x", (unsigned int) h[i]);
|
||||
}
|
||||
printf("\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
24f950aac7b9ea9b3cb728228a0c82b67c39e96b4b344798870d5daee93e3ae5931baae8c7cacfea4b629452c38026a81d138bc7aad1af3ef7bfd5ec646d6c28
|
||||
@@ -0,0 +1,98 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta name="google" content="notranslate" />
|
||||
<style>
|
||||
body {
|
||||
background: white;
|
||||
color: black;
|
||||
}
|
||||
.test p {
|
||||
margin: 1px;
|
||||
}
|
||||
.test {
|
||||
font-family: monospace;
|
||||
white-space: pre;
|
||||
}
|
||||
.err {
|
||||
background: red;
|
||||
color: white;
|
||||
}
|
||||
.passed {
|
||||
background: green;
|
||||
color: white;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1></h1>
|
||||
<section class="test" id="test-res"></section>
|
||||
<script>
|
||||
var performance;
|
||||
if (typeof performance !== 'object') {
|
||||
performance = {
|
||||
mark: function(s) { this[s] = new Date() },
|
||||
measure: function(_t, s1, s2) { this.t = this[s2] - this[s1] },
|
||||
getEntriesByName: function() { return [ { duration: this.t } ] }
|
||||
};
|
||||
}
|
||||
|
||||
var Module = { preRun: function() { performance.mark('bench_start') } };
|
||||
|
||||
function runTest(tname) {
|
||||
var xhr, expected, hn, idx = 0, passed = true;
|
||||
|
||||
function outputReceived(e) {
|
||||
var found = e.data;
|
||||
var p = document.createElement('p');
|
||||
if (found !== expected[idx++]) {
|
||||
p.className = 'err';
|
||||
passed = false;
|
||||
}
|
||||
p.appendChild(document.createTextNode(found));
|
||||
document.getElementById('test-res').appendChild(p);
|
||||
if (idx >= expected.length) {
|
||||
if (passed) {
|
||||
performance.mark('bench_end')
|
||||
performance.measure('bench', 'bench_start', 'bench_end');
|
||||
var duration = Math.round(performance.getEntriesByName('bench')[0].duration);
|
||||
hn.appendChild(document.createTextNode(' - PASSED (time: ' + duration + ' ms)'));
|
||||
hn.className = 'passed';
|
||||
} else {
|
||||
hn.appendChild(document.createTextNode(' - FAILED'));
|
||||
hn.className = 'err';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hn = document.getElementsByTagName('h1')[0];
|
||||
hn.appendChild(document.createTextNode('Test: ' + tname));
|
||||
|
||||
try {
|
||||
xhr = new ActiveXObject('Microsoft.XMLHTTP');
|
||||
} catch (e) {
|
||||
xhr = new XMLHttpRequest();
|
||||
}
|
||||
xhr.open('GET', tname + '.exp');
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState != 4 ||
|
||||
(xhr.status != 200 && xhr.status != 302 && xhr.status != 0)) {
|
||||
return;
|
||||
}
|
||||
expected = xhr.responseText.split('\n');
|
||||
if (expected.length > 0 && expected[expected.length - 1] === '') {
|
||||
expected.pop();
|
||||
}
|
||||
expected.push('--- SUCCESS ---');
|
||||
window.addEventListener('test-output', outputReceived, false);
|
||||
var s = document.getElementsByTagName('script')[0];
|
||||
var st = document.createElement('script');
|
||||
st.src = tname + '.js';
|
||||
s.parentNode.insertBefore(st, s);
|
||||
}
|
||||
xhr.send(null);
|
||||
}
|
||||
runTest('{{tname}}');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
71
components/espressif__libsodium/libsodium/test/default/kdf.c
Normal file
71
components/espressif__libsodium/libsodium/test/default/kdf.c
Normal file
@@ -0,0 +1,71 @@
|
||||
|
||||
#define TEST_NAME "kdf"
|
||||
#include "cmptest.h"
|
||||
|
||||
static void
|
||||
tv_kdf(void)
|
||||
{
|
||||
unsigned char *master_key;
|
||||
unsigned char *subkey;
|
||||
char *context;
|
||||
char hex[crypto_kdf_BYTES_MAX * 2 + 1];
|
||||
uint64_t i;
|
||||
int ret;
|
||||
|
||||
context = (char *) sodium_malloc(crypto_kdf_CONTEXTBYTES);
|
||||
master_key = (unsigned char *) sodium_malloc(crypto_kdf_KEYBYTES);
|
||||
|
||||
memcpy(context, "KDF test", sizeof "KDF test" - 1U);
|
||||
for (i = 0; i < crypto_kdf_KEYBYTES; i++) {
|
||||
master_key[i] = i;
|
||||
}
|
||||
subkey = (unsigned char *) sodium_malloc(crypto_kdf_BYTES_MAX);
|
||||
for (i = 0; i < 10; i++) {
|
||||
ret = crypto_kdf_derive_from_key(subkey, crypto_kdf_BYTES_MAX,
|
||||
i, context, master_key);
|
||||
assert(ret == 0);
|
||||
sodium_bin2hex(hex, sizeof hex, subkey, crypto_kdf_BYTES_MAX);
|
||||
printf("%s\n", hex);
|
||||
}
|
||||
sodium_free(subkey);
|
||||
|
||||
for (i = 0; i < crypto_kdf_BYTES_MAX + 2; i++) {
|
||||
subkey = (unsigned char *) sodium_malloc(crypto_kdf_BYTES_MAX);
|
||||
if (crypto_kdf_derive_from_key(subkey, (size_t) i,
|
||||
i, context, master_key) == 0) {
|
||||
sodium_bin2hex(hex, sizeof hex, subkey, (size_t) i);
|
||||
printf("%s\n", hex);
|
||||
} else {
|
||||
printf("Failure -- probably expected for output length=%u\n",
|
||||
(unsigned int) i);
|
||||
}
|
||||
sodium_free(subkey);
|
||||
}
|
||||
|
||||
sodium_free(master_key);
|
||||
sodium_free(context);
|
||||
|
||||
assert(strcmp(crypto_kdf_primitive(), crypto_kdf_PRIMITIVE) == 0);
|
||||
assert(crypto_kdf_BYTES_MAX > 0);
|
||||
assert(crypto_kdf_BYTES_MIN <= crypto_kdf_BYTES_MAX);
|
||||
assert(crypto_kdf_bytes_min() == crypto_kdf_BYTES_MIN);
|
||||
assert(crypto_kdf_bytes_max() == crypto_kdf_BYTES_MAX);
|
||||
assert(crypto_kdf_CONTEXTBYTES > 0);
|
||||
assert(crypto_kdf_contextbytes() == crypto_kdf_CONTEXTBYTES);
|
||||
assert(crypto_kdf_KEYBYTES >= 16);
|
||||
assert(crypto_kdf_keybytes() == crypto_kdf_KEYBYTES);
|
||||
assert(crypto_kdf_bytes_min() == crypto_kdf_blake2b_bytes_min());
|
||||
assert(crypto_kdf_bytes_max() == crypto_kdf_blake2b_bytes_max());
|
||||
assert(crypto_kdf_contextbytes() == crypto_kdf_blake2b_contextbytes());
|
||||
assert(crypto_kdf_keybytes() == crypto_kdf_blake2b_keybytes());
|
||||
|
||||
printf("tv_kdf: ok\n");
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
tv_kdf();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
a0c724404728c8bb95e5433eb6a9716171144d61efb23e74b873fcbeda51d8071b5d70aae12066dfc94ce943f145aa176c055040c3dd73b0a15e36254d450614
|
||||
02507f144fa9bf19010bf7c70b235b4c2663cc00e074f929602a5e2c10a780757d2a3993d06debc378a90efdac196dd841817b977d67b786804f6d3cd585bab5
|
||||
1944da61ff18dc2028c3578ac85be904931b83860896598f62468f1cb5471c6a344c945dbc62c9aaf70feb62472d17775ea5db6ed5494c68b7a9a59761f39614
|
||||
131c0ca1633ed074986215b264f6e0474f362c52b029effc7b0f75977ee89cc95d85c3db87f7e399197a25411592beeeb7e5128a74646a460ecd6deb4994b71e
|
||||
a7023a0bf9be245d078aed26bcde0465ff0cc0961196a5482a0ff4ff8b4015971e13611f50529cb408f5776b14a90e7c3dd9160a22211db64ff4b5c0b9953680
|
||||
50f49313f3a05b2e565c13feedb44daa675cafd42c2b2cf9edbce9c949fbfc3f175dcb738671509ae2ea66fb85e552394d479afa7fa3affe8791744796b94176
|
||||
13b58d6d69780089293862cd59a1a8a4ef79bb850e3f3ba41fb22446a7dd1dc4da4667d37b33bf1225dcf8173c4c349a5d911c5bd2db9c5905ed70c11e809e3b
|
||||
15d44b4b44ffa006eeceeb508c98a970aaa573d65905687b9e15854dec6d49c612757e149f78268f727660dedf9abce22a9691feb20a01b0525f4b47a3cf19db
|
||||
9aebba11c5428ae8225716369e30a48943be39159a899f804e9963ef78822e186c21fe95bb0b85e60ef03a6f58d0b9d06e91f79d0ab998450b8810c73ca935b4
|
||||
70f9b83e463fb441e7a4c43275125cd5b19d8e2e4a5d179a39f5db10bbce745a199104563d308cf8d4c6b27bbb759ded232f5bdb7c367dd632a9677320dfe416
|
||||
Failure -- probably expected for output length=0
|
||||
Failure -- probably expected for output length=1
|
||||
Failure -- probably expected for output length=2
|
||||
Failure -- probably expected for output length=3
|
||||
Failure -- probably expected for output length=4
|
||||
Failure -- probably expected for output length=5
|
||||
Failure -- probably expected for output length=6
|
||||
Failure -- probably expected for output length=7
|
||||
Failure -- probably expected for output length=8
|
||||
Failure -- probably expected for output length=9
|
||||
Failure -- probably expected for output length=10
|
||||
Failure -- probably expected for output length=11
|
||||
Failure -- probably expected for output length=12
|
||||
Failure -- probably expected for output length=13
|
||||
Failure -- probably expected for output length=14
|
||||
Failure -- probably expected for output length=15
|
||||
a529216624ef9161e4cf117272aafff2
|
||||
068bd6940b80c6cc2530a68c31d9f4e323
|
||||
0acf4f6c74a590c8a1c0997ec9a1a3f48b2a
|
||||
ac17a37ce74c0efece75f9337de20795dbadcc
|
||||
268214dc9477a2e3c1022829f934ab992a5a3d84
|
||||
33b76197b4531665e494760909eda1cc570e7da9bb
|
||||
3d4efbc569ca7f858ad4f49c56b820986a406e6eebbc
|
||||
983fea27520f507c40231f9557908f07c095bdf4a4ce5d
|
||||
94d678717625e011995c7355f2092267dee47bf0722dd380
|
||||
198901896c4f51e74ffa8b2805415c6eaba5accfc85a6e6b34
|
||||
4ffabb81d49021f85ef5d2a713ab02ae86bc2e7d1522f5e077fe
|
||||
eebc3d55b3f4fc8b64d2474063254da7db98e7398dfdd510e28075
|
||||
22c134b9d664e1bdb14dc309a936bf1512b19e4f5175642efb1a0df7
|
||||
4b179762bfc8e27a9e575113faa76247b9c046d6f22d5a02e2910a299b
|
||||
abc45eb2b031307b8822c7e59a43f4108850c34a7445936bc848422251c4
|
||||
d6565bd3265b6373f4f6a6b6458e981006da5e9d532ce94ca4737e188995e9
|
||||
154b291f11196737f8b7f491e4ca11764e0227d34f94295408a869f007aa8618
|
||||
e9dd395570e09ebb523ffc6ba098a38b17bc4944f14bd3725bdd7edbd8bcff54fb
|
||||
7248294d37159e85bacde68c7762a673794c91b811e05f4e3b9e3ecc82bfcf63a2cd
|
||||
d060ee4d93f8de6d9ae60fca9596413455183a1f83c7a2381227cec8f7a217e4072f85
|
||||
20790290347b9b0f413a954f40e52e270b3b45417e96c8733161672188701c08dd76cc3d
|
||||
7674188112a1ab8d3926d468be8e51d788ce4144bb20ff842034e4d1ddab3929a4f1a13a74
|
||||
a2ab1f980a47472d8a539f20410cc9bf143d941331ab2259ea73684c0608939c5b23e9cbcb3d
|
||||
f4cfbe3050f15ebbaf8d2f3bf3a678c01fc21ee1f4be07d0744c7fbf4835ea9d9472a3d785c24c
|
||||
66efa5dfe3efd4cc8ca25f2d622c97a20a192d7add965f26b002b7eb81aae4203c0e5f07fd945845
|
||||
ad5d8031055c96dc9db10285206d7edc38d3af85736df8a3b5fdd30a318e80c28d9b26c95a60fa3e68
|
||||
9107c8a57a2c9ca40158f33ca0bfb64c095d2f21ca98bb7138477599330a36cdfc2ae5751e370d0e024e
|
||||
b0c190177358b955ebebc5e0b86ec91dde3b6f1982ea4d68ec5ec3bdd6527c362e5275600b263601c98452
|
||||
31bfaaad4adde0f87d87372e398c42cb7befe065ab2957ebb91ef9dc534b410783899b2e1e84221286f3bab4
|
||||
2258dd1f3e516cb8e3d1f6c45808573c365192f073698939721af8961a02a8bdd002a31fd239b9498663a01f27
|
||||
7c7a88016610493bb44a9432a88b50f97e2e94383972ff95da826692d96c52d82f86899b3561ec9c95a8b1bf3213
|
||||
3929dc7473be4c633be9e08801a8abd284dc0c6154c5c81a4c18259699dd86753c5e14fbd723be46ebb04f4ab3058c
|
||||
30b720220015fa60daa69c83f9754d772b1b2dd12ab6baaa2f4edab458d4d251c1cddb8c4a554f3eb13969316b890fbd
|
||||
33fa2412a5c3294d49e964419e96d043a2099a72b3351e3bed0f07e12255c95b509ea9bf2963a4c0fe9cc2314dbc44f673
|
||||
ca891d2c82a6a8f833dc1a05f190bab6de221307eab1dd2c88341d4d2537a2fc0056b0d04d8104fd3fe89e1ea20877893e81
|
||||
fd78ac89a64d03672ad99d663f2613d15277cda1636e334a1706b7211ff1f3a3b3d2e671e391c75e3d242c482ce7e1b8b427ed
|
||||
36a6072743d3aafd3ee89344b9ef92cb58a2853ae92b20283520439fcb55afffd3d4b5e4e8c92a85d3cf74497bdcf68bbf1fcf93
|
||||
a90afcfaffec1105ad05fdaa9473fb5daf1bf8fb376b7326db46ef4c120c553188c69131933371d409eb56d66d5adca618e1dac65b
|
||||
9b990d1fcddbdb5e5c7a48a6a2a666e02e7d4d4a814ece40660d99e1c02d5f023c56ae82526fc6dc8c933d0add92fc376efcddd55a42
|
||||
ec545dcf456d1b0907c07418a42bf2b3d668b4797ba6874bf0d563f5f429a820f02177dd4d05e639a06807c9619fee54ffe07712493543
|
||||
b0106957626894586682a275f69ed4533e2f94334cc0430394b68d82679aca00dd579e712bdd2d7f5bbce9a050269739bd8427b75b06027f
|
||||
05751bfeebb480c9bca0d25d8197e2673845f405d7fb9793e29169ac19956c525f6e637f3d5ea50597b04342afed4ca16f988b4f21a34f1902
|
||||
7b4e4294d3f64085b5c09be73548f1f5cb5c6f04e57ce6cdd3077e2fb37640bf1ca0c6393b87d48a6b7e3e42628bd30fca132ded03ce51f71d9d
|
||||
082d248862cbfd71a634769a4b1cf52a4af47ace5b9ea4d583ca52207efc7234a6d321788130cbdec122579ad03afe00bc68c9fb3f68dd0532a96f
|
||||
a2b39b4428d981013e8a9c0e41b3eed504983fc18dc4b60332b1ab28b9705228147bdb95cc17889d5f0f9cfb7fd16f9d414b1a829346a8922e945b40
|
||||
efbf0f8bda1b9ef24fe389f1cf0c0c8a08bca03fc95badabb79a487d8ce1351683f59183aa6229f880d69ad60114ac128f69b2be250109972ab1f3fc3b
|
||||
dfe0ba2a6de25fa06b47375e9d9cf6c6fa1493a8a2a81c28d6e09bc161057b445659db76e92e349ff44f34a2a9e3bcaa6b84b21bae56f1499c170ab81af0
|
||||
02f9cbdb10759314515b01379c474ad74a1b575137bd3949776dbcfc3e18060cb13ee1f6dcf86035768fc7be63e01de321cacbfade209900dd94273fd8e176
|
||||
06ae14308eeeda62a00cb6d5edf18d1707029515db98f472bbf0617419301b1d4f4f2ab65849446be46f87e1d31c6c74283897b9976f70d8a16253ac927e0d9f
|
||||
Failure -- probably expected for output length=65
|
||||
tv_kdf: ok
|
||||
@@ -0,0 +1,100 @@
|
||||
|
||||
#define TEST_NAME "kdf_hkdf"
|
||||
#include "cmptest.h"
|
||||
|
||||
static void
|
||||
tv_kdf_hkdf(void)
|
||||
{
|
||||
unsigned char *master_key;
|
||||
size_t master_key_len = 66;
|
||||
unsigned char *prk256;
|
||||
size_t prk256_len = crypto_kdf_hkdf_sha256_KEYBYTES;
|
||||
unsigned char *prk512;
|
||||
size_t prk512_len = crypto_kdf_hkdf_sha512_KEYBYTES;
|
||||
unsigned char *salt;
|
||||
size_t salt_len = 77;
|
||||
char *context;
|
||||
size_t context_len = 88;
|
||||
unsigned char *out;
|
||||
size_t out_len = 99;
|
||||
char hex[99 * 2 + 1];
|
||||
size_t i;
|
||||
int ret;
|
||||
|
||||
master_key = (unsigned char *) sodium_malloc(master_key_len);
|
||||
prk256 = (unsigned char *) sodium_malloc(prk256_len);
|
||||
prk512 = (unsigned char *) sodium_malloc(prk512_len);
|
||||
salt = (unsigned char *) sodium_malloc(salt_len);
|
||||
context = (char *) sodium_malloc(context_len);
|
||||
out = (unsigned char *) sodium_malloc(out_len);
|
||||
for (i = 0; i < master_key_len; i++) {
|
||||
master_key[i] = i;
|
||||
}
|
||||
for (i = 0; i < salt_len; i++) {
|
||||
salt[i] = (unsigned char) ~i;
|
||||
}
|
||||
for (i = 0; i < context_len; i++) {
|
||||
context[i] = (unsigned char) (i + 111);
|
||||
}
|
||||
|
||||
printf("\nHKDF/SHA-256:\n");
|
||||
crypto_kdf_hkdf_sha256_keygen(prk256);
|
||||
if (crypto_kdf_hkdf_sha256_extract(prk256, salt, salt_len,
|
||||
master_key, master_key_len) != 0) {
|
||||
printf("hkdf_sha256_extract() failed\n");
|
||||
}
|
||||
printf("PRK: %s\n", sodium_bin2hex(hex, sizeof hex, prk256, prk256_len));
|
||||
|
||||
for (i = 0; i < out_len; i++) {
|
||||
context[0] = i;
|
||||
if (crypto_kdf_hkdf_sha256_expand(out, i,
|
||||
context, context_len, prk256) != 0) {
|
||||
printf("hkdf_sha256_expand() failed\n");
|
||||
}
|
||||
printf("%s\n", sodium_bin2hex(hex, sizeof hex, out, i));
|
||||
}
|
||||
|
||||
printf("\nHKDF/SHA-512:\n");
|
||||
crypto_kdf_hkdf_sha256_keygen(prk512);
|
||||
if (crypto_kdf_hkdf_sha512_extract(prk512, salt, salt_len,
|
||||
master_key, master_key_len) != 0) {
|
||||
printf("hkdf_sha512_extract() failed\n");
|
||||
}
|
||||
printf("PRK: %s\n", sodium_bin2hex(hex, sizeof hex, prk512, prk512_len));
|
||||
|
||||
for (i = 0; i < out_len; i++) {
|
||||
context[0] = i;
|
||||
if (crypto_kdf_hkdf_sha512_expand(out, i,
|
||||
context, context_len, prk512) != 0) {
|
||||
printf("hkdf_sha512_expand() failed\n");
|
||||
}
|
||||
printf("%s\n", sodium_bin2hex(hex, sizeof hex, out, i));
|
||||
}
|
||||
|
||||
sodium_free(out);
|
||||
sodium_free(context);
|
||||
sodium_free(salt);
|
||||
sodium_free(master_key);
|
||||
sodium_free(prk512);
|
||||
sodium_free(prk256);
|
||||
|
||||
assert(crypto_kdf_hkdf_sha512_bytes_min() == crypto_kdf_hkdf_sha512_BYTES_MIN);
|
||||
assert(crypto_kdf_hkdf_sha512_bytes_max() == crypto_kdf_hkdf_sha512_BYTES_MAX);
|
||||
assert(crypto_kdf_hkdf_sha512_keybytes() == crypto_kdf_hkdf_sha512_KEYBYTES);
|
||||
|
||||
assert(crypto_kdf_hkdf_sha256_bytes_min() == crypto_kdf_hkdf_sha256_BYTES_MIN);
|
||||
assert(crypto_kdf_hkdf_sha256_bytes_max() == crypto_kdf_hkdf_sha256_BYTES_MAX);
|
||||
assert(crypto_kdf_hkdf_sha256_keybytes() == crypto_kdf_hkdf_sha256_KEYBYTES);
|
||||
|
||||
assert(crypto_kdf_hkdf_sha256_KEYBYTES < crypto_kdf_hkdf_sha512_KEYBYTES);
|
||||
|
||||
printf("tv_kdf_hkdf: ok\n");
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
tv_kdf_hkdf();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
|
||||
HKDF/SHA-256:
|
||||
PRK: 8c3725c0ea8e14106d8c342887ccd1218cc205acecd8095ae1efc099ec195e7e
|
||||
|
||||
92
|
||||
2ebf
|
||||
e29531
|
||||
8e563a1b
|
||||
1fa58d77ee
|
||||
50f1a4e15ba2
|
||||
4fb3724b7d4174
|
||||
d10853ceb46b11db
|
||||
0fdf31228221242833
|
||||
98acb29e0993ec45f8cc
|
||||
f4481a5e6d263d7bdc59ed
|
||||
e620eb399337a9aace16765c
|
||||
dbe8924351577475584731979f
|
||||
371a112305dfd4264feb29c28a2f
|
||||
d0a4b022f748c96141ec6b4aac6dcb
|
||||
d2b38fe15e0f95bcff87822ff4df3d90
|
||||
e4bf8fde7d77899a5f85d68b039ee7119b
|
||||
6766b092971ec2e616286925708c7ed6c9e9
|
||||
c4f9d36cddfe89b3194282a084881e6c429099
|
||||
49be5bc10c278f39b5be391a55e765560deca0ad
|
||||
6e7d3031d08c5658a19a7d647dad0250418435febc
|
||||
07cb6356aa7f978cbab87e7814fa90af9ce729aa2b3f
|
||||
2ea1c08eb04c75806f80ccf0fca683a8998bb663e99993
|
||||
bb111699f6c32263474dc5569a6950c767e3b8201f838345
|
||||
e81e9086d3e035cc1a288fa521ce8b43b7f93d3d9bbac5085b
|
||||
29c398bfafa672bc315e192110575691607118759f9e7669f3c5
|
||||
60840e8bc6d86733752787232a0321257c82d691722bfba07af839
|
||||
b0ec22e547dae3f04fc6ef146203604f0d604a8ce8a20fce229a688f
|
||||
81ae6add3344b25d14115a38bc10553a75ce0a4be3aa8f3579299227f7
|
||||
242c65f95ee0bce1c5e1b01b1ff68e8634fac096edb18997dfd3baf3817d
|
||||
14b5afe2cc0d8fe10e5359667b2b310365fba93d62f7fd3df2dddfc34c1de5
|
||||
24a79d4c0c69e0a524ca91f356e64ab40345973ba82ce68992dbdd16bf161cbe
|
||||
3edbfc22f9a1e3a5c774cfec8fff3cc4febdfc61d98aecedf6a16eca0546316b56
|
||||
b8bad2b04b9b382f9ad2559afc33b8dece4a7fe9b8ac9d74557dfc51ed8949b78ee8
|
||||
1d01316d7767f068171f08a8c2f05d2cd571f623fd5fc9916b3476115aac9d7f635cb4
|
||||
a7c5763a3b678ee2fa05a57dab377b67e448a38f94531ce83bab9eff8035e105e8889b91
|
||||
ab6721825aefb2cb9f9d0ce5123882573abebe94404e0e3a923a7aac84efc084f84ee5b2ed
|
||||
4815da740c872a9816850c8757be64cb3096dca7994f3af7bd8c10e83a2d3bbb14b40da93d40
|
||||
abb141fbb64faec34c09e9c784b1e8aba15b6e916f70996ad803b963d2de676669ebff3ed4b711
|
||||
231a7a47a81c21dd6a0969c67b6ff446a73a145fb1d4f0a2d268af8fd56ac6d67b6ef55d13194440
|
||||
74e40130ca102c22acc109cc6b8b66d840b984fe729c156edd05eb4f44d1869e6ae6260b41931179ff
|
||||
3817d2cf7b7c7c7bfe4ab51e9178343f31fa8eea20899ec96d21eebdbf55f44327e7dc23cf669e215c02
|
||||
d5ab755f5631d08b70718d2ba3e2775fbc3cdfe69b7ac74afcc73ffbd7b91b9d3a7fef364cda9816c8c367
|
||||
93c15afc2cf1baec84b8e3c89f50a3e4cc3a2c1b72aeaa894a45bf09f22aac0711994f0873ac69b099e47d02
|
||||
7b359dd2abb995a8bb0d1a01a986bfcf28d47b9215f000b240f5080dc78a84cc65e34ff098074ae237a0238b6f
|
||||
182ec78776f5ba3818c2ccc7b84aa7bb1a54386134b3215e8f8f709757f3c8e4f9bef3800e3a9eda8b9794e95f8a
|
||||
0cf1874215b38ab1900ce7137d9b8817fbe99d3196eab5b845971a46a38c479d81fc8033a641533e2c39dd550e672a
|
||||
3f5a283ca862e6a5f79c5ab39f8d4984b54a86e132d40adcca249f6419caf5b61fbbf61d54d80e78af3e613adfea5f9e
|
||||
ce6bceffd4ae50e8465c3d5179c661da2f18dcb37f95f9cc66808d2f848b55dd0c1d2201bb37a2e339e9385233e687a711
|
||||
7ce3f4575d3edab2f989b0a975b279ac21af117184130911dba4e7c70e19f96b5595ec8910e737c019f3392390f8b9af6439
|
||||
9c1b37296ed2ad9b556938d30814c47f822807be8cf9bfb26a05651061015493d4ed551f8a6f1a5cef7df88dd7426f03681935
|
||||
0d1f6f49c38c4d6fbc57103193b544ec1a73f40ed8aaac53da2b1a28a4a35838036ec9d50d719af22f3f89ebb7f340f50ce8c180
|
||||
fe6786d7d7728a1ed057c329f68cf698b163ae1e6c1b48290e6ba2c325740155f0f90f216111f3bc16d61b8338d910d429241899c4
|
||||
c729c63757fa5a421704ba88f8c13f23606e59cb1e7d2396a130742c31b98dc9461cc1fa9d8d24f79f7303dd416bf66adbb08562f832
|
||||
44cf07d63adc85de7c0aa524962c29dfad1b37b253fc9559fd1f5b8237d8bd6e6449e5f3997d6b0571ae50da1e164be845523c8630b1df
|
||||
c1040513a53f652e0ba7bc30f84deaaec13a15919855dd76148ae1fc86cd147ba686ff0ee025f9a00cbf7b6e190c7b87ea458974cf147ae3
|
||||
0a67afc69f00ddbdd6794ed7b06285c00d70fd86fb8b959bd8c686e96c72032f2726c4f0fb607a7f4d4f66b410eff17354b6db803c9c910a72
|
||||
faad9414932446902309147f8f2c1d2d48c95a7ddb8856219aa36ed30f971e160542ed8272ef9bdf72551cd059ca6c81ea76b5a3b49cbfb07738
|
||||
14ee2fc3899650164beb828a557afc7253e4b89cba8a1908d3641d47eb23d50ef34a0dafaa1388328fc33b1db37f2f74db6934d398bacbec785f03
|
||||
2333128e004f61ba45c524dbf72a9973fdcc288d76236402f63b0f4a39867b18e73135f35945f1791ae537b215c69941194258103419558c0a477fa9
|
||||
70f1a4c027d950573c5ea8f9b34069d1b85ac0b6daabc9de5c4cd1844d6781c0b15ca7b01c2a33dd06272e7c8729b74ea71a0f35486252461a3d83bc62
|
||||
8b9199ebc5ae61365d6cc78c9d1b1a466565639c50c317cddcdc13db96b4f6ec612bbc1c6e5d2479147040f313a168e4471b9093f47548899265d8472aab
|
||||
5f420864258d597766beb7c55ef0dc9c85aab5e296677e1fd9201a8c8a0c7b74b573276b0ce11f797a5816e5ed7ea3a02ca5c338f78c0c6a41322e0cdbb5d6
|
||||
13029325fb0fbbe2221caaa6c3797a967335c4a857fafe23b4fb221433afc84da6876cbd74ac631d18f2478aae8def5a85a227b3bb496a81e9d29171a5b501fc
|
||||
44ef825de340dbcb1b2ce9325eb78650d574d1c9fc13ed3b4517ee3f2f95bd97c8ab62988455a1639d0e4b2e404d661c3881dbdb52d86b7bd5593713b10e8d1086
|
||||
2c67d0e2fbdb55cf649c97e1053c717636c526ee4f58f86e9671a1086e5ef6ef7ae109eca2cd482affb1add956aad7225debca3420c4cae6cf590e8e8c1a0398a9cd
|
||||
6900b97c5783d5856e4eda7816e27326cb71f8c9cda3bfdc88c4a5aa49b580aa4341cd100fd3084b447a24c9d521c8ddb7a55af52c998c4a9b53bae6c86caa02424df6
|
||||
c63f43dd3d29e0e92fc2adf18a50e33f11dbe9746f16bfc518397e0df3bd4eff491963cd2a0d25022c535a425fe3cfcea4ffd7dfbe98e2ae9fb40a007012acc31460ef25
|
||||
dd61268207f4452ce4a1f212aa4f4ffff1d0cd4df9ac1730b0f4acc07f75e86afb02c0d99aeb512bf3bb138183364a4b800af446b403add2b30d73eca024fb5e3eeebf10dc
|
||||
4eb2c6dc6159bb82eba32aa839bc4b3d46be87cd358f47aeb7b488d91230414a40fe35a2c0bcde81de243b6974c49ac0af113904a8995928931e867f5b7d131c2c9caf4adde5
|
||||
22cef8bbb9f6874c1be53adc6687e3b28d0b9b8574d22212e4d60074585d17751fdcb80a1ed6143a7471fd3b1a0dddbce5b8b1ae859441413d99b069252f39c3a0b7eafc65ab34
|
||||
6f0a07f43c6d00649b516cc986fce770aed949875a17164beed5305ceaf74131574eb2cf489dc13fad53e2b10cb757b69eecb481a76a8d99a7cfb2e0aee40dde6f7d44c2be5a5e63
|
||||
bf701b835481d47ee85d390caa8f63bd3e7dfa48f4307d51989b4660e465de31329589bd5e3293f75b63d320b8f53211cf1209e426869c3c3b506dde3f819cae07672af9ef74f36de6
|
||||
92cc25c67b65fc9c57381457e7752441782dc4d2d62828c13992a7c2eda57811fe7c2de66b725e08f361fee4d8370d3dff2cdba6c603cd03ae54d813e44793387ded1add2c006b320058
|
||||
e3ec7f8ccf313fac832d3ef5c3b8b10f1faf5ae8ec32bce0f5f98b9f4464624a58b0f74ffdb827d52d94fa77a8456ca550017f3c31d8e8e6827b6a9ac9664355bc57e9b46cc66b6e396a50
|
||||
636ffbeb1cb2e834ae37213247ca8e615fc52f00e79c13f37874edc549f4b629901312b685f3e1ae3394a6beebc5e0c1364c562b3579f34cbbe9ed80c5cc045b9ab7a749950d005e785832e0
|
||||
3ae686a5e1abf936d472963d6272226f920c8df4eed5c4b26d9afc910f509c205ffb56a0289fb62d38790dca4f85028f76b4339e9eee32c1c2690abd02c74ef9a7cc822f901ae596ef1b2f2f42
|
||||
e542066a18aed627ea3feea7a962b9c69a9a2f00bc0f22c7186c389701283807801d2cd79d678010d91379cfc6d72cf30830a34fd9983a0c011e775be61eb0d093a1432493abb703c8b5bf99ad63
|
||||
1392b4676365c1ee01f75811cabe0fa989faa6a222b65e72bf4016f7767c0e9f822de2ad0034098dd9867a787abe9b97adb1a345e96b345aea898682d71fc3febc0e2ef579874da073285d0ba4edc4
|
||||
2ddd472dd4090528036d7bf01cacfca7c71ce3d89bab2299b3d6f1b987c51e5f884cfed55ca25008811fa4f44d9bb8563d83cfeccc580865978972cec981f431e4b74857e2a565e5d6e0bc9f0a3c45ec
|
||||
d2a855d0e2a912ce3ff5ffa99c464c215d9ae1195e92b022d4518dde9fa5ecbdbac4f1877c1a94df35421a122a04073dbe7fce959c87497cb30774bac3441140089b4b714e025509fa3cd41d683ab46edf
|
||||
00bcf365897640b9268fad068977a11b7eb3006482b51c97543ba4359db31adcd18497d174844c9ec47a0f6132b16d14aa5a02c42583aabd033e520a8a9c5c430cc6708e8b9cdd4fd56c1023a744af67fd14
|
||||
0e20beb1a84e9c252b54c4db895324e85436f29e4855cdfa5bf4bbe7868bdbc51b7f0ac428ce54750e2cd16829051e95cd97f2f40c5a1a3db17f90b68570a05ac55a9eaa7c8bf377c7a752666de779ef46764f
|
||||
20ddf3ccd89c8bf4c084324858c0f0c7d4dcfd4a76a7526183a5bf4344f62320f29e7c0650d3c55ad587128e667d5d4e69689850fa741b49d3ceef45b134327ac89186248d1157aa4b16263731138777811e508b
|
||||
2a8fadda7001128cf59e3fcc93dc5c98e75ac92d66d536330eb90a558920e4416c210658b3bf44a451db23c62caac1a79fad1437a81d66ab98e4423d8a1ce9ed9a0586a160c4819a019a93781775c6510c6ed09cb9
|
||||
9049524d223052ee507450e65112e1f4331c4d7fd71e8237b8f79feb2fa30504c856d6907cc4eb814694e9a7b8a8b10d85f956df72062c5f4752dc42d37f164eae1a3155a11ecb413f92a0e49e0a89d398c21d76e100
|
||||
86a92236b4e0dc16e0a17e92825e31b66a417784b7f6c0a53c274ca5100847a929c0a30430ff67e6c8913a41c3437d8313fd11b2c0eebc75e5bdffeb95a4d100c7eb36216494f3c7a8f19403080941e3d1c9e319ede000
|
||||
4b15b094db5789ff78fafabdd0f0aa06d3f4ded903c89e8ae22982d152017295de63ad0b43d3d303243de1bbf2637e8e0c042024e307739ab3b02a5b7d299167909edd51f82229c0093a68768d56c2e774285ed95bdc24d9
|
||||
9bbca463a5142ea7dad0522f073eabc7eed63e4baea13efec9d7c198b75a9c4db88623c406edc5bf61ec61e047357358541aa66e44a364b779b6a8842c1b1e8131c594ac8298755ba532937b5bdbcbbd1f2c2152d03af55120
|
||||
edc5fe50b3f3a7de5ddc14b467e41ec0ce68a44f734c4cd46b5ee1d98337d8a917cf1dd13e09946d22918eaf31f83de1e035209a6f2de32bb7caf119d0db73e4075cb9a714adb84b4d0a6163aac56bb4299a71e8979a97e363f4
|
||||
e2770541945a0395fbf597fb58cc4e6f6a2883b707aa79df9c2da5a7165a8838b1e7f4736b5418bd2f99d3eb8020f9b4cb7ff3a620f8bef276f22f3e98ffe20adeac2f62a9e5758136d222a9c562f81f151d3980bdad54f52dbf55
|
||||
248474ddc86ce5e07be50fdd3a6a113ab7f2319e3fb86f1d2d361372fa1d89926ef501c5a62b9d2efeb409d0be8fb67f12c1624d04bcf9d555dad09dffdba76948b0eecba430110ab9e738db70e51c4e2f27350a49aecf1282410ab8
|
||||
37d75ee27cc14c95c9d930bb1324d8aa6cc77ba833504253d91002fb622d9e578a3f3b1439dad7d9d7af8ea17cebee86fe13c59f316434d46208c019c2e673168b5aaa397525cbce3a0b2f1c59c853600711e719218311e15d1ab9a0cf
|
||||
981461afd5756cc5d6a953c188b0a537fbcd18b41034cc4f40870cc2c97bcc48e3e4d563c2ee1d60d8c9f714996fc32e2977aaf7c3544e437f40f61d7281548efc22d7c298853304444c4184605b7b55148c24e88f362e41a8c919bf0288
|
||||
d65ac485824f9490c5f70fe674fe1da39b4583b25f3580b636a06135761eb0fb5e36a59dcb070dd9bfd5b2d69503a5c3ef295eb9cb3a9346578556d56fdd0c81cbdd960d292f8410681643af154b2550e2d586119b82cb17a79c1447cb26f6
|
||||
cdd5bd495ed8c2c41dc511577051ffa30ee02eddb95b3650337e8aeae161d2b81a9ebc1514524c52dbe2c4d0739706dbdcea1a7ba21d9cab36ca10f753fc82b218c01094e288bbcd96d6678e06e1a03f55c3bc6aea67b9637e87a4ce8e2aa0e8
|
||||
1d07389dad745981eb7ae03162bf249996cb836316872a4de4241d1fea49044541b9ababc2a10f7d5455ad3c0519997698a52039fd5517c53f7963aea8917e1b8ce3c63c5a2b23331cc473c1ff0986b08e8dd1257847256ded17e6d0409855f8e5
|
||||
a1245e0117a0e7c3cfbcd3d3eeb21a5aa7f2a73aea4465f4d83c8d0c6237c5c093ada99ada6ad75dcf18d1eb58982c7316d5c366ce5128a832d433c960e6bf7be42e4dce2747e3cc78101ed44aebcdbbf6bcd42f5160ca40784ea3ee3dd6be537475
|
||||
|
||||
HKDF/SHA-512:
|
||||
PRK: 2502bc897dc1b23f9f2d8c35d519c5280ea960bf9154ebb07d377a12a81a4794ea8bdc0cb6ec59ab3303f5cbd713027825715f8af2ac0203e560fd2e55f4ff2b
|
||||
|
||||
4c
|
||||
abec
|
||||
6d7647
|
||||
a3397e73
|
||||
15b3f69cec
|
||||
fb5c266f8785
|
||||
7147d8a6bff246
|
||||
1dd7f9b2ab2583ab
|
||||
725aee4e2d8d7f1f90
|
||||
046f63a1e2d606d7893e
|
||||
fc2026603b032dc6c862de
|
||||
03127d298ea441e3ae1d3781
|
||||
a8f163b5b9476eb50dcb304bc2
|
||||
9430c3aa31857951320feaa65e4e
|
||||
14e4918f7b7eaa9c6d39dc08e9abc1
|
||||
3480c9854b8f0bb4a97920338dce7573
|
||||
42714ad1af787467b0388cb6663864ba89
|
||||
700cd7f28075fc3a28d98672207b45df5b20
|
||||
528c93053c63c5fa5ff1f0a6e7cde8d4aec5a8
|
||||
d225940fcd325eecf827666ebcb9ea3881dbfc3f
|
||||
0341475a114b87cdae767a4a68432889145748b0aa
|
||||
bbbf499a74a2c22dc4a2295bc904fdcd7d4e91b32060
|
||||
deb06fe0b094b65da9febfed81f990ae77fd3f458a1bf3
|
||||
f64b7ac1473232a727ff461af2f650cc8a8419d7c97b7298
|
||||
3ca9c302e1096302185e2288beb6d91124c6abc9f9f97d5a4f
|
||||
81dfa7213143feb429dae2c641d25bf913aca03feead6ab7df10
|
||||
5d428190aad0539c0c2e6037e7745218dbf4e5c5aa0102996ceead
|
||||
7e76c9dcd614d730eaab145be60584c7bbe925bddc64d9dccde16142
|
||||
4b2be1c3dd5cd41d53ead2ce0aa220823ec4f3cf8656b14449e50cb48b
|
||||
4ceb80935422dba37af63ba59a460204dcd6639741d478185fd1a1e48de6
|
||||
633e555556c5288d808b2483d7e99bcc9876b42b61cbcc4d3e9ed42bcaee33
|
||||
0d28411da5a660b2eb063af0ed7e031c463a64eddd6c48882add6fad4cc9da92
|
||||
30b734f5768d26c4f8d641037b3e425c3d75c5c0c97cf8a3e684d1d2f1ba4f37b6
|
||||
970db4152321c2bac15898927aa25db90246c494017765b01ff21ae9a6aef7b89b88
|
||||
f168959f62696ea32a46ee67cdd3375684533f799e346fd1d26ad29aecd51de7c2c473
|
||||
76a81fa4b90ee1d1b05986c837f10f098cf1ac8f7d6be8097caec980b125185e8f9ee56d
|
||||
ed95ff4a9919f45c08151fb7f610f5155dac10c92e84bebf2a6bf0fc653585158c19ef59fe
|
||||
16ff87fb87760dfbaa53a2820c9ef365ee3b539b4a7fd1a4e626d313f24db495319f98c247d3
|
||||
f514b605b74bb3a35b86f8c96fb08e751d916b3ecd8b5e84b364e57f1fb6e5928a3a46f4cf7b1a
|
||||
ecef871f30ca56fbd6b242b9d095a33b9d60472da4914af80dbb8672a84d8ba4640ff1b459cb9b1d
|
||||
9220ed520c628b7e7e249c334573ff2402d573e34b27c25c4ba22e2b472ccdd2ef4d060eeef5387dc6
|
||||
b431fd9eaba69bc20967d1d02014913637df29c855faa6e93a8571ea3c27ad2c542700c77f9f3d19e5bb
|
||||
7ebd91db579ec5879f81a922c58ee82a91b8cb648294f63b97f728a53411438f54157cb6459ae762b5ef3f
|
||||
c28a1322e46a89f7a2b6b3dd6d39cbcaa84368bca33a53c04bb7bc90c3f51065143d8e93a279a403aea8ca8a
|
||||
089ca5fb6e4de86c77cac49f92c8d3356697a1fa51c8e4a207ec44428c4da0b82aadad5f196510d0ae7abc25ab
|
||||
31b08873dafc0d8c11afacb5efd3fcabbb7cc5ff7aab6e1d40a7451ec715de4a4a6e7e15f9d1f9f832a0e1bc39d7
|
||||
984f57235036e6d44777a7bf41fa4333f3077d3f2d92b46bc36c29b123de8580d81e22b2969d9a5abf3bb5fb7b422d
|
||||
2730edbf85f4e35152af0f22fbc4f23f7968cb430fde9685cf4e1bb64611ba6459acedad777fe1a6d70c88733d83661f
|
||||
0eb2a97a6d6a5901535399caa5ccb7192e1f1488f9a06d3150ccafe1eeaa8d6e50e039a9344f68d1783973fcb34719c2fa
|
||||
24d7e154d4b7382daa4d1fb47a8badf0d1020e97f75efe74f302b983584e26bc1865d44c3761b65c4d745766da0bfce5682a
|
||||
cb7503ad874932bfc2c7b18176d3e03f3e66666613e3e8e2ac83a29965b56afb0aa74d1080ac2ffeb1c43ee160c9f120cc4c61
|
||||
0ad5086f6cf363dfbf14c13e82faf14dde185b7142bd0ae44da8692339ed31f47f10773578af23cd7a632352087d07a7f4133474
|
||||
72873f68ad5874e1146a70e96c98360ccf0e5e9a5e31e4e38c7829241a531b0712eee8f22729e244da3d94d92703d975e54d84c36c
|
||||
b05200d914edd05309a7aaafcde50cfbc201d988387d2b7fb7b7315b56d58ecaebc2f7c7b5d2607d041dfd3486e849cf2535c8ef76f4
|
||||
6324ea52a00274312457f451953302d02e3e9107aed0a4007c04d26f4b5ce37f31fbc5a2606575a464f64b507691646e2d773c62aac387
|
||||
e0c68ed5571a90bc8db36c948b5ffd9179cd80218ae47b86cc7bf4aa4adccc438ddf670ea817d324ca709b612522d510913eb64012462acb
|
||||
61d3ec6537c084df5981a79545847cbf204c3a267080e2cba06a29b4fa591bc43668f701cc0d9e33e123b774b066e212fd1989d253120bfdf6
|
||||
7b74db37484227d237eb7d4039ddade342827d0075322c14de32985d616ffe38c4786e2e0df89de856051796e1f922b6b47578c3428fade6b372
|
||||
feea8d891c65fb37dc20095946b9f5db5aa936a2331fc9609ea45ee146107bf561710edceef2cea29e7c25032cb6764bc361eac0c148553e62ca5d
|
||||
a95341f8f7536d95f14181e4aa01c540a345bd172b67279f5b6dfebe2c8fb7b366edb8ad7e4545eed29903eeb6f486fa9f9d825185a0333eeddd2b45
|
||||
5b7fd7b9d6623c25d508712d585fd541089c8b4721b9dc219baa9cfe14022b5ffb0ded9a546ddf183c543d1f26f9c4183f4c7ff012d61de8cb822bccb4
|
||||
fa0fc08f49144cf85dcefd25717f37de8469a943fdeaa8c764bbf483af7a37b0dcf1f50451b20e693635e94976c44ead0ef83ac632eec781e9d50efb2f9d
|
||||
6ec1e621af3a878ad836aeb322e67752de29a310d7e6fbe6d164bb79e8f939d7a8f9f77a72733482d323c50ae7dc2170b90a48c59da782865eb7a9e254aba3
|
||||
10d13645bc853dcac6b71dadf4327ea0c7497822a6e0691d93a5e9d32cbafb883f9ff0c245126e391666fed31747e92c81ab886d5e75bb057faac5b3b0f1afa8
|
||||
dfb3872da01656cddd9abcb389e75a4a01d89d0d49f571e77655ad1ae0c14c87d4146accaf59f3e402767e6666228ef8e52aa32cd18306f69666769159423d8141
|
||||
d3a86236f119fa35c480d5b4b71d3aec93e226db5d2173c04e5d1d88c696594f51ec36470487fb72044a039cc081607be2a99e5d8f1c653848176f97cd2e9d50a742
|
||||
0d1f5a47c4917f6158b039e68fdeda5fa3889bbac6dff571f6353f83ada55c26bb99dac4416b2dea7d0fec2b585877aed2709f2b25516551004fee20b68e21efded761
|
||||
79a910c7f74b303d5844b609148a5a723e31c6b00d16a773547fb6d97fd35bf4a452eefd7ac3466ea520d61be4b75493156c9ae39ce6698e7120e92ebb366adeafb21d09
|
||||
a893878e100dc628ec674c4b48556c067419a3c317be94ed37cfd8ed8cae2ff035985579238f4dc13576677d527f21cde829a54466a911ab81888016c2094fda50e6dab622
|
||||
6faefe6e6bad59fab2a801aefd26d05ea3ac3ce546b0abfff524ec2ea80f3cc5c8c7015d18ae766cc84a2de75bc4c8a44cafb3743c6147e934d5de803d74ff8ca507d505065b
|
||||
ef32b102fb18681c02cee796ba8bb602d927d3428c4387150a5c342532380d3234d69e58a607396af5802cfeece1554de5722931f4e09fe51ae4b74dcd7e851e9a95cf4218f96e
|
||||
efe653c021ff38cabba1a76f8df2b0737ccffe6dba0506074143c88f6547afb06bcf1a36ba8e48bad9e7ee76c70717e089e1c31f052ee8859f65d6cc0d4bdccf845c8a8955d316bb
|
||||
8bf54ff6ef8b0f73a569d908ef432227d7fff0e1300503c1d41f3b2618b089ba76873cc5abd22039f3bffd2bb88b4a169e1f55b8280ba8b474aee9a19a93710cdc05a51062ea5970a2
|
||||
126a003e4194b577fbf4070e8ecd47f3807afc7d9e733760a23b350649e924ebe702eaefedb70490b77fc8dbccd068baab02bcd64517aee6005d37a496f8dd92093ec34f5ec6af703836
|
||||
3b025057a1a889389b105956cffae970b21e3a1179382bb626856c793727ba9ca14706741b94b4704ce0089a378c1efadb7961fbbfd146d657b6ee605231d9ffc60eadcc6af32c43ec7e75
|
||||
0c2eadac7883bb59c278aa115b10b8d1459066b9e0061b7e4e2e1ec4caca02c6fc443e5f78c80779360f260507bc2d49beae6bf7470da5c8dca5ee51d251ed1db892db23a43c62fe088d07fc
|
||||
2f40a09aea1a9b7c32e7b68845de40452c9b753c31c46118d14d3b34c8c7f3eae0f3c0018300ce4d583715debeb9bac31de392080fe2630225a0f0e0d4c5b6e19ff1fa5bf5a0cb8840fed794fc
|
||||
155e5eef1e32ec06bd7a51741fbeafcbd82bddbb18fc34a984e9018f4b62d1b7ed4fc0b0d7843d4e8983ccdba6bb30d28f964994650e692a5b0b746171563be70a0c622f6a022ac4c655f216bb68
|
||||
142e1d62a31895b3a916453a0c01ca2a096d9b0747b3a2c9584822819cbffdab6c6461d4e4374e4d9363f8cc52861e2be1f4ad4edbdf4a72f1fc3667903df83a32a8810398e156ea8dd3385d416e9a
|
||||
08a01d87455bfb057d64a6374f8da7ae52f4575af5085e7aa3c390de0fe528c14767525b9af87e7e5ef053bf03b2390c98f7eef36161ae1c0d9eba83c4a78d9ae5d4322cbd0b3f7aaed183f18616e49d
|
||||
1c8ccae6d387f360c2fca138f1c65410918ca0cb47c15cbdee931ed03cbcec6e871f11f2692a9b9136f82b274a338805e863f87c5c0f99604c03484b1a2020732e5473bec84ced8ba05cd9490e75563628
|
||||
ac3916dc874442f05ca2409bd5c63957bca4c5363dda23846a5901010818c57874aff1787bd7c554c95aae8e354ec55beb1b79966bae64197d4383c894485c8a509064957abe7f3fa4154dc0f0e958121fcc
|
||||
f0b7a82a962c7faa238acb98ebe4b904e8d5998e1856dbf68aea0933dfb3d80a44f0eaad678dacf31ee5c985fe6f9844f9490319745e89bf790d3e0cf2a788a177de8401119ebc9f7e48f58c279ef723fda7cc
|
||||
6d87c3942bc4ebbc224fac383f1b22af13a4ccdfae5ee66ab8f954ebbb874f583ef07152872ce03de5c3584574b91d91d2f6fc4b14625e3e2bdfd04fc7b9441d73f9c09411f08938429c9f12e31caea17e094d9d
|
||||
2e0d7c7f1c03ce9d4479fa800645abda4aade87bca0bbe547e889f8d32af7530d212171baae32831ecbd84cc27bb3da8496982a183e2785a0731220677341bcf75ae345ddb8bcdb7dccd2c4e1094d33ca53b0768cf
|
||||
9bec3f01c35ba5436e44b01a96077f41aa61516dff5cef6185818e7f57d2dd0b9d9ebfeb35a0cff1ae8d98975a0cdcf2b626dd7b1f8fa2534ffc058abc1b81e1c68aaeaf8e9b255c3eabe1d675399220d4b6d967fc5f
|
||||
b0d54ba8f86b01d511acb7ddb567198dabe835512d0033991a221b2bdf815d8063d073d1bbf5704f954df8f73a4ecec48417c2fec643f9e15d1d41b51f955f2422a69a2a8f73b6154881e6f6721f8e73a80efa5bfb1717
|
||||
cd41ad000e15e9b261e52b459bf79c7f7ffeb281629fba3c986c08b90a058abf76799dc72e430a1df8b64641cc2e03339ebb37fe7eabced490f77b58b3dcf492f981687036dcb94328cd9ad9f4e489de5d06bbd3671a9bf1
|
||||
21233d332c3fa9b056520c06fe55aa388773ee12ae893395df1d75c4932b54a5d679637d33930f2f8afa22be2fb4b1fd36a6c83b51057611c8119bd8cdb1efd8ee7063d5f13c09d2f8e5f8888eda3ece738e34f667aee451b9
|
||||
86418350d07d8f9d8b7e1190eb13634dc0a59f267730afe9409cecab0ac4f57feacaee8dec7321b8512991d51d4fe3b7cc2cbb5e6728ba115f022087606d15b39810032b3945e052574c7464c2b2434b2a54a801991d093f9390
|
||||
5501bfd8c7b1784515a192c0db6516b1fda893702ed45db7a5c07b32b3d9d41f396f9ed61cc4f9a143d4b4ab16c9f6975ee0a8851c62f80ddd4fdfef6c9f6f27c130a13109cd20779e4bab78200129900ecedae564c790153d2227
|
||||
7d45d142bdeff8e1b941537dab8685697988e60cd0ca0926dacc9a227de9f33e0dca5c7c17bcb3f3d3a1f39c4999313786933cb931c725b6359a1b10e31b77cd30f28e3bd4ebe898ef0ae1ee5e3a28a911fdc3759d04929c74321a9d
|
||||
36f11d276af5958a737c5f457ae997455025cde0503ecf1431ea68b6567530cf3abeee2391c1c549fd3bb274120b0613828839ae74b6a071ee9d29b6247ca6a8a1cd2195d24c6215f58be04e197b541828b99e3a71d0991be8245303ad
|
||||
efe64e5b4341239a2e60d342b89a302c2b8cbd45a33a5301936a051f69dd1644164bf7e24d269d341285a2c22aaa93517b1e9ae6a3d6b18961d4b1f58b357a113a12e9c6519ce7533f602b026dbd885c0584f21e099e74516d5db197dec0
|
||||
e5d90cf622738f73973fc448b7be40b044fac3dfc65d36db47f3fa9d01d41fb9808ad83e51729c0c2c35cc08226fbcd20a988ea24bb8373991e702c911d1764b309eda4d1500592ce0fee42fe111e9f9e346734b9e2758194ff9f0713613d1
|
||||
1444dfb0694d36937eb77a0b1f04c2e29e9904d1dcf03cf8d420315c5cb38463f8f3327df5cd34485b0e6db3eefedcd9015f4953a99c125f3ee803c4727c10e0ca943408d82a0c6c1b797a7a3a9e6446df53b8de29894309e81d09a321564b40
|
||||
171e9fb9e3867ac3ae4cbe09884cccb7561c2c0773ea8200c492ac338512f2017bc843b1ae5fb998c7d1f155b01b707f70dcbf68dab56d74a561b5fe7759788b5651a9ab0fe7006d0c096cacbc9ba93736bda0b967b7f1ebfb4c7a032e73f40392
|
||||
db14a6d9c6311aadd73d9fb5b38b654bf306e0ea3880d22a12032971115d22dc38f9bf03ac83a177a0e36be7f710d4a903934601d15911942f11364692d77958be02be75eb6c697e3d963f6ca2c26449272bd05cd3ec41b884a6a97381f57f19d70c
|
||||
tv_kdf_hkdf: ok
|
||||
@@ -0,0 +1,67 @@
|
||||
|
||||
#define TEST_NAME "keygen"
|
||||
#include "cmptest.h"
|
||||
|
||||
typedef struct KeygenTV_ {
|
||||
void (*fn)(unsigned char *k);
|
||||
size_t key_len;
|
||||
} KeygenTV;
|
||||
|
||||
static void
|
||||
tv_keygen(void)
|
||||
{
|
||||
static const KeygenTV tvs[] = {
|
||||
{ crypto_auth_keygen, crypto_auth_KEYBYTES },
|
||||
{ crypto_auth_hmacsha256_keygen, crypto_auth_hmacsha256_KEYBYTES },
|
||||
{ crypto_aead_aes256gcm_keygen, crypto_aead_aes256gcm_KEYBYTES },
|
||||
{ crypto_auth_hmacsha512_keygen, crypto_auth_hmacsha512_KEYBYTES },
|
||||
{ crypto_auth_hmacsha512256_keygen, crypto_auth_hmacsha512256_KEYBYTES },
|
||||
{ crypto_generichash_keygen, crypto_generichash_KEYBYTES },
|
||||
{ crypto_generichash_blake2b_keygen, crypto_generichash_blake2b_KEYBYTES },
|
||||
{ crypto_kdf_keygen, crypto_kdf_KEYBYTES },
|
||||
{ crypto_onetimeauth_keygen, crypto_onetimeauth_KEYBYTES },
|
||||
{ crypto_onetimeauth_poly1305_keygen, crypto_onetimeauth_poly1305_KEYBYTES },
|
||||
{ crypto_aead_chacha20poly1305_ietf_keygen, crypto_aead_chacha20poly1305_ietf_KEYBYTES },
|
||||
{ crypto_aead_chacha20poly1305_keygen, crypto_aead_chacha20poly1305_KEYBYTES },
|
||||
{ crypto_aead_chacha20poly1305_ietf_keygen, crypto_aead_chacha20poly1305_ietf_KEYBYTES },
|
||||
{ crypto_aead_xchacha20poly1305_ietf_keygen, crypto_aead_xchacha20poly1305_ietf_KEYBYTES },
|
||||
{ crypto_secretbox_xsalsa20poly1305_keygen, crypto_secretbox_xsalsa20poly1305_KEYBYTES },
|
||||
{ crypto_secretbox_keygen, crypto_secretbox_KEYBYTES },
|
||||
{ crypto_secretstream_xchacha20poly1305_keygen, crypto_secretstream_xchacha20poly1305_KEYBYTES },
|
||||
{ crypto_shorthash_keygen, crypto_shorthash_KEYBYTES },
|
||||
{ crypto_stream_keygen, crypto_stream_KEYBYTES },
|
||||
{ crypto_stream_chacha20_keygen, crypto_stream_chacha20_KEYBYTES },
|
||||
{ crypto_stream_chacha20_ietf_keygen, crypto_stream_chacha20_ietf_KEYBYTES },
|
||||
{ crypto_stream_salsa20_keygen, crypto_stream_salsa20_KEYBYTES },
|
||||
{ crypto_stream_xsalsa20_keygen, crypto_stream_xsalsa20_KEYBYTES }
|
||||
};
|
||||
const KeygenTV *tv;
|
||||
unsigned char *key;
|
||||
size_t i;
|
||||
int j;
|
||||
|
||||
for (i = 0; i < (sizeof tvs) / (sizeof tvs[0]); i++) {
|
||||
tv = &tvs[i];
|
||||
key = (unsigned char *) sodium_malloc(tv->key_len);
|
||||
key[tv->key_len - 1U] = 0;
|
||||
for (j = 0; j < 10000; j++) {
|
||||
tv->fn(key);
|
||||
if (key[tv->key_len - 1U] != 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
sodium_free(key);
|
||||
if (j >= 10000) {
|
||||
printf("Buffer underflow with test vector %u\n", (unsigned int) i);
|
||||
}
|
||||
}
|
||||
printf("tv_keygen: ok\n");
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
tv_keygen();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
tv_keygen: ok
|
||||
149
components/espressif__libsodium/libsodium/test/default/kx.c
Normal file
149
components/espressif__libsodium/libsodium/test/default/kx.c
Normal file
@@ -0,0 +1,149 @@
|
||||
|
||||
#define TEST_NAME "kx"
|
||||
#include "cmptest.h"
|
||||
|
||||
static const unsigned char small_order_p[crypto_scalarmult_BYTES] = {
|
||||
0xe0, 0xeb, 0x7a, 0x7c, 0x3b, 0x41, 0xb8, 0xae, 0x16, 0x56, 0xe3,
|
||||
0xfa, 0xf1, 0x9f, 0xc4, 0x6a, 0xda, 0x09, 0x8d, 0xeb, 0x9c, 0x32,
|
||||
0xb1, 0xfd, 0x86, 0x62, 0x05, 0x16, 0x5f, 0x49, 0xb8, 0x00
|
||||
};
|
||||
|
||||
static void
|
||||
tv_kx(void)
|
||||
{
|
||||
unsigned char *seed;
|
||||
unsigned char *client_pk, *client_sk;
|
||||
unsigned char *client_rx, *client_tx;
|
||||
unsigned char *server_pk, *server_sk;
|
||||
unsigned char *server_rx, *server_tx;
|
||||
char hex[65];
|
||||
int i;
|
||||
|
||||
seed = (unsigned char *) sodium_malloc(crypto_kx_SEEDBYTES);
|
||||
for (i = 0; i < crypto_kx_SEEDBYTES; i++) {
|
||||
seed[i] = (unsigned char) i;
|
||||
}
|
||||
client_pk = (unsigned char *) sodium_malloc(crypto_kx_PUBLICKEYBYTES);
|
||||
client_sk = (unsigned char *) sodium_malloc(crypto_kx_SECRETKEYBYTES);
|
||||
crypto_kx_seed_keypair(client_pk, client_sk, seed);
|
||||
|
||||
sodium_bin2hex(hex, sizeof hex, client_pk, crypto_kx_PUBLICKEYBYTES);
|
||||
printf("client_pk: [%s]\n", hex);
|
||||
sodium_bin2hex(hex, sizeof hex, client_sk, crypto_kx_SECRETKEYBYTES);
|
||||
printf("client_sk: [%s]\n", hex);
|
||||
|
||||
server_pk = (unsigned char *) sodium_malloc(crypto_kx_PUBLICKEYBYTES);
|
||||
server_sk = (unsigned char *) sodium_malloc(crypto_kx_SECRETKEYBYTES);
|
||||
crypto_kx_keypair(server_pk, server_sk);
|
||||
|
||||
client_rx = (unsigned char *) sodium_malloc(crypto_kx_SESSIONKEYBYTES);
|
||||
client_tx = (unsigned char *) sodium_malloc(crypto_kx_SESSIONKEYBYTES);
|
||||
|
||||
assert(crypto_kx_client_session_keys(client_rx, client_tx,
|
||||
client_pk, client_sk,
|
||||
small_order_p) == -1);
|
||||
if (crypto_kx_client_session_keys(client_rx, client_tx,
|
||||
client_pk, client_sk, server_pk) != 0) {
|
||||
printf("crypto_kx_client_session_keys() failed\n");
|
||||
}
|
||||
|
||||
server_rx = (unsigned char *) sodium_malloc(crypto_kx_SESSIONKEYBYTES);
|
||||
server_tx = (unsigned char *) sodium_malloc(crypto_kx_SESSIONKEYBYTES);
|
||||
|
||||
assert(crypto_kx_server_session_keys(server_rx, server_tx,
|
||||
server_pk, server_sk,
|
||||
small_order_p) == -1);
|
||||
if (crypto_kx_server_session_keys(server_rx, server_tx,
|
||||
server_pk, server_sk, client_pk) != 0) {
|
||||
printf("crypto_kx_server_session_keys() failed\n");
|
||||
}
|
||||
if (memcmp(server_rx, client_tx, crypto_kx_SESSIONKEYBYTES) != 0 ||
|
||||
memcmp(server_tx, client_rx, crypto_kx_SESSIONKEYBYTES) != 0) {
|
||||
printf("client session keys != server session keys\n");
|
||||
}
|
||||
|
||||
sodium_increment(client_pk, crypto_kx_PUBLICKEYBYTES);
|
||||
if (crypto_kx_server_session_keys(server_rx, server_tx,
|
||||
server_pk, server_sk, client_pk) != 0) {
|
||||
printf("crypto_kx_server_session_keys() failed\n");
|
||||
}
|
||||
if (memcmp(server_rx, client_tx, crypto_kx_SESSIONKEYBYTES) == 0 &&
|
||||
memcmp(server_tx, client_rx, crypto_kx_SESSIONKEYBYTES) == 0) {
|
||||
printf("peer's public key is ignored\n");
|
||||
}
|
||||
|
||||
crypto_kx_keypair(client_pk, client_sk);
|
||||
if (crypto_kx_server_session_keys(server_rx, server_tx,
|
||||
server_pk, server_sk, client_pk) != 0) {
|
||||
printf("crypto_kx_server_session_keys() failed\n");
|
||||
}
|
||||
if (memcmp(server_rx, client_tx, crypto_kx_SESSIONKEYBYTES) == 0 ||
|
||||
memcmp(server_tx, client_rx, crypto_kx_SESSIONKEYBYTES) == 0) {
|
||||
printf("session keys are constant\n");
|
||||
}
|
||||
|
||||
crypto_kx_seed_keypair(client_pk, client_sk, seed);
|
||||
sodium_increment(seed, crypto_kx_SEEDBYTES);
|
||||
crypto_kx_seed_keypair(server_pk, server_sk, seed);
|
||||
if (crypto_kx_server_session_keys(server_rx, server_tx,
|
||||
server_pk, server_sk, client_pk) != 0) {
|
||||
printf("crypto_kx_server_session_keys() failed\n");
|
||||
}
|
||||
sodium_bin2hex(hex, sizeof hex, server_rx, crypto_kx_SESSIONKEYBYTES);
|
||||
printf("server_rx: [%s]\n", hex);
|
||||
sodium_bin2hex(hex, sizeof hex, server_tx, crypto_kx_SESSIONKEYBYTES);
|
||||
printf("server_tx: [%s]\n", hex);
|
||||
|
||||
if (crypto_kx_client_session_keys(client_rx, client_tx,
|
||||
client_pk, client_sk, server_pk) != 0) {
|
||||
printf("crypto_kx_client_session_keys() failed\n");
|
||||
}
|
||||
sodium_bin2hex(hex, sizeof hex, client_rx, crypto_kx_SESSIONKEYBYTES);
|
||||
printf("client_rx: [%s]\n", hex);
|
||||
sodium_bin2hex(hex, sizeof hex, client_tx, crypto_kx_SESSIONKEYBYTES);
|
||||
printf("client_tx: [%s]\n", hex);
|
||||
|
||||
randombytes_buf(client_rx, crypto_kx_SESSIONKEYBYTES);
|
||||
randombytes_buf(client_tx, crypto_kx_SESSIONKEYBYTES);
|
||||
randombytes_buf(server_rx, crypto_kx_SESSIONKEYBYTES);
|
||||
randombytes_buf(server_tx, crypto_kx_SESSIONKEYBYTES);
|
||||
if (crypto_kx_client_session_keys(client_rx, NULL,
|
||||
client_pk, client_sk, server_pk) != 0 ||
|
||||
crypto_kx_client_session_keys(NULL, client_tx,
|
||||
client_pk, client_sk, server_pk) != 0 ||
|
||||
crypto_kx_server_session_keys(server_rx, NULL,
|
||||
server_pk, server_sk, client_pk) != 0 ||
|
||||
crypto_kx_server_session_keys(NULL, server_tx,
|
||||
server_pk, server_sk, client_pk) != 0) {
|
||||
printf("failure when one of the pointers happens to be NULL");
|
||||
}
|
||||
assert(memcmp(client_rx, client_tx, crypto_kx_SESSIONKEYBYTES) == 0);
|
||||
assert(memcmp(client_tx, server_rx, crypto_kx_SESSIONKEYBYTES) == 0);
|
||||
assert(memcmp(server_rx, server_tx, crypto_kx_SESSIONKEYBYTES) == 0);
|
||||
|
||||
sodium_free(client_rx);
|
||||
sodium_free(client_tx);
|
||||
sodium_free(server_rx);
|
||||
sodium_free(server_tx);
|
||||
sodium_free(server_sk);
|
||||
sodium_free(server_pk);
|
||||
sodium_free(client_sk);
|
||||
sodium_free(client_pk);
|
||||
sodium_free(seed);
|
||||
|
||||
assert(strcmp(crypto_kx_primitive(), crypto_kx_PRIMITIVE) == 0);
|
||||
assert(crypto_kx_publickeybytes() == crypto_kx_PUBLICKEYBYTES);
|
||||
assert(crypto_kx_secretkeybytes() == crypto_kx_SECRETKEYBYTES);
|
||||
assert(crypto_kx_seedbytes() == crypto_kx_SEEDBYTES);
|
||||
assert(crypto_kx_sessionkeybytes() == crypto_kx_SESSIONKEYBYTES);
|
||||
|
||||
printf("tv_kx: ok\n");
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
tv_kx();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
client_pk: [0e0216223f147143d32615a91189c288c1728cba3cc5f9f621b1026e03d83129]
|
||||
client_sk: [cb2f5160fc1f7e05a55ef49d340b48da2e5a78099d53393351cd579dd42503d6]
|
||||
server_rx: [62c8f4fa81800abd0577d99918d129b65deb789af8c8351f391feb0cbf238604]
|
||||
server_tx: [749519c68059bce69f7cfcc7b387a3de1a1e8237d110991323bf62870115731a]
|
||||
client_rx: [749519c68059bce69f7cfcc7b387a3de1a1e8237d110991323bf62870115731a]
|
||||
client_tx: [62c8f4fa81800abd0577d99918d129b65deb789af8c8351f391feb0cbf238604]
|
||||
tv_kx: ok
|
||||
@@ -0,0 +1,187 @@
|
||||
|
||||
#define TEST_NAME "metamorphic"
|
||||
#include "cmptest.h"
|
||||
|
||||
#define MAXLEN 512
|
||||
#define MAX_ITER 1000
|
||||
|
||||
static void
|
||||
mm_generichash(void)
|
||||
{
|
||||
crypto_generichash_state st;
|
||||
unsigned char *h, *h2;
|
||||
unsigned char *k;
|
||||
unsigned char *m;
|
||||
size_t hlen;
|
||||
size_t klen;
|
||||
size_t mlen;
|
||||
size_t l1, l2;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_ITER; i++) {
|
||||
mlen = randombytes_uniform(MAXLEN);
|
||||
m = (unsigned char *) sodium_malloc(mlen);
|
||||
klen = randombytes_uniform(crypto_generichash_KEYBYTES_MAX -
|
||||
crypto_generichash_KEYBYTES_MIN + 1U)
|
||||
+ crypto_generichash_KEYBYTES_MIN;
|
||||
k = (unsigned char *) sodium_malloc(klen);
|
||||
hlen = randombytes_uniform(crypto_generichash_BYTES_MAX -
|
||||
crypto_generichash_BYTES_MIN + 1U)
|
||||
+ crypto_generichash_BYTES_MIN;
|
||||
h = (unsigned char *) sodium_malloc(hlen);
|
||||
h2 = (unsigned char *) sodium_malloc(hlen);
|
||||
|
||||
randombytes_buf(k, klen);
|
||||
randombytes_buf(m, mlen);
|
||||
|
||||
crypto_generichash_init(&st, k, klen, hlen);
|
||||
l1 = randombytes_uniform((uint32_t) mlen);
|
||||
l2 = randombytes_uniform((uint32_t) (mlen - l1));
|
||||
crypto_generichash_update(&st, m, l1);
|
||||
crypto_generichash_update(&st, m + l1, l2);
|
||||
crypto_generichash_update(&st, m + l1 + l2, mlen - l1 - l2);
|
||||
crypto_generichash_final(&st, h, hlen);
|
||||
|
||||
crypto_generichash(h2, hlen, m, mlen, k, klen);
|
||||
|
||||
assert(memcmp(h, h2, hlen) == 0);
|
||||
|
||||
sodium_free(h2);
|
||||
sodium_free(h);
|
||||
sodium_free(k);
|
||||
sodium_free(m);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
mm_onetimeauth(void)
|
||||
{
|
||||
crypto_onetimeauth_state st;
|
||||
unsigned char *h, *h2;
|
||||
unsigned char *k;
|
||||
unsigned char *m;
|
||||
size_t mlen;
|
||||
size_t l1, l2;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_ITER; i++) {
|
||||
mlen = randombytes_uniform(MAXLEN);
|
||||
m = (unsigned char *) sodium_malloc(mlen);
|
||||
k = (unsigned char *) sodium_malloc(crypto_onetimeauth_KEYBYTES);
|
||||
h = (unsigned char *) sodium_malloc(crypto_onetimeauth_BYTES);
|
||||
h2 = (unsigned char *) sodium_malloc(crypto_onetimeauth_BYTES);
|
||||
|
||||
crypto_onetimeauth_keygen(k);
|
||||
randombytes_buf(m, mlen);
|
||||
|
||||
crypto_onetimeauth_init(&st, k);
|
||||
l1 = randombytes_uniform((uint32_t) mlen);
|
||||
l2 = randombytes_uniform((uint32_t) (mlen - l1));
|
||||
crypto_onetimeauth_update(&st, m, l1);
|
||||
crypto_onetimeauth_update(&st, m + l1, l2);
|
||||
crypto_onetimeauth_update(&st, m + l1 + l2, mlen - l1 - l2);
|
||||
crypto_onetimeauth_final(&st, h);
|
||||
|
||||
crypto_onetimeauth(h2, m, mlen, k);
|
||||
|
||||
assert(memcmp(h, h2, crypto_onetimeauth_BYTES) == 0);
|
||||
|
||||
sodium_free(h2);
|
||||
sodium_free(h);
|
||||
sodium_free(k);
|
||||
sodium_free(m);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
mm_hmacsha256(void)
|
||||
{
|
||||
crypto_auth_hmacsha256_state st;
|
||||
unsigned char *h, *h2;
|
||||
unsigned char *k;
|
||||
unsigned char *m;
|
||||
size_t mlen;
|
||||
size_t l1, l2;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_ITER; i++) {
|
||||
mlen = randombytes_uniform(MAXLEN);
|
||||
m = (unsigned char *) sodium_malloc(mlen);
|
||||
k = (unsigned char *) sodium_malloc(crypto_auth_hmacsha256_KEYBYTES);
|
||||
h = (unsigned char *) sodium_malloc(crypto_auth_hmacsha256_BYTES);
|
||||
h2 = (unsigned char *) sodium_malloc(crypto_auth_hmacsha256_BYTES);
|
||||
|
||||
crypto_auth_hmacsha256_keygen(k);
|
||||
randombytes_buf(m, mlen);
|
||||
|
||||
crypto_auth_hmacsha256_init(&st, k, crypto_auth_hmacsha256_KEYBYTES);
|
||||
l1 = randombytes_uniform((uint32_t) mlen);
|
||||
l2 = randombytes_uniform((uint32_t) (mlen - l1));
|
||||
crypto_auth_hmacsha256_update(&st, m, l1);
|
||||
crypto_auth_hmacsha256_update(&st, m + l1, l2);
|
||||
crypto_auth_hmacsha256_update(&st, m + l1 + l2, mlen - l1 - l2);
|
||||
crypto_auth_hmacsha256_final(&st, h);
|
||||
|
||||
crypto_auth_hmacsha256(h2, m, mlen, k);
|
||||
|
||||
assert(memcmp(h, h2, crypto_auth_hmacsha256_BYTES) == 0);
|
||||
|
||||
sodium_free(h2);
|
||||
sodium_free(h);
|
||||
sodium_free(k);
|
||||
sodium_free(m);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
mm_hmacsha512(void)
|
||||
{
|
||||
crypto_auth_hmacsha512_state st;
|
||||
unsigned char *h, *h2;
|
||||
unsigned char *k;
|
||||
unsigned char *m;
|
||||
size_t mlen;
|
||||
size_t l1, l2;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < MAX_ITER; i++) {
|
||||
mlen = randombytes_uniform(MAXLEN);
|
||||
m = (unsigned char *) sodium_malloc(mlen);
|
||||
k = (unsigned char *) sodium_malloc(crypto_auth_hmacsha512_KEYBYTES);
|
||||
h = (unsigned char *) sodium_malloc(crypto_auth_hmacsha512_BYTES);
|
||||
h2 = (unsigned char *) sodium_malloc(crypto_auth_hmacsha512_BYTES);
|
||||
|
||||
crypto_auth_hmacsha512_keygen(k);
|
||||
randombytes_buf(m, mlen);
|
||||
|
||||
crypto_auth_hmacsha512_init(&st, k, crypto_auth_hmacsha512_KEYBYTES);
|
||||
l1 = randombytes_uniform((uint32_t) mlen);
|
||||
l2 = randombytes_uniform((uint32_t) (mlen - l1));
|
||||
crypto_auth_hmacsha512_update(&st, m, l1);
|
||||
crypto_auth_hmacsha512_update(&st, m + l1, l2);
|
||||
crypto_auth_hmacsha512_update(&st, m + l1 + l2, mlen - l1 - l2);
|
||||
crypto_auth_hmacsha512_final(&st, h);
|
||||
|
||||
crypto_auth_hmacsha512(h2, m, mlen, k);
|
||||
|
||||
assert(memcmp(h, h2, crypto_auth_hmacsha512_BYTES) == 0);
|
||||
|
||||
sodium_free(h2);
|
||||
sodium_free(h);
|
||||
sodium_free(k);
|
||||
sodium_free(m);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
mm_generichash();
|
||||
mm_onetimeauth();
|
||||
mm_hmacsha256();
|
||||
mm_hmacsha512();
|
||||
|
||||
printf("OK\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
OK
|
||||
187
components/espressif__libsodium/libsodium/test/default/misuse.c
Normal file
187
components/espressif__libsodium/libsodium/test/default/misuse.c
Normal file
@@ -0,0 +1,187 @@
|
||||
|
||||
#define TEST_NAME "misuse"
|
||||
#include "cmptest.h"
|
||||
|
||||
#ifdef HAVE_CATCHABLE_ABRT
|
||||
# include <signal.h>
|
||||
#ifndef _WIN32
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
static void
|
||||
sigabrt_handler_15(int sig)
|
||||
{
|
||||
(void) sig;
|
||||
_exit(0);
|
||||
}
|
||||
|
||||
# ifndef SODIUM_LIBRARY_MINIMAL
|
||||
static void
|
||||
sigabrt_handler_14(int sig)
|
||||
{
|
||||
(void) sig;
|
||||
signal(SIGABRT, sigabrt_handler_15);
|
||||
assert(crypto_box_curve25519xchacha20poly1305_easy
|
||||
(guard_page, guard_page, crypto_stream_xchacha20_MESSAGEBYTES_MAX - 1,
|
||||
guard_page, guard_page, guard_page) == -1);
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
static void
|
||||
sigabrt_handler_13(int sig)
|
||||
{
|
||||
(void) sig;
|
||||
signal(SIGABRT, sigabrt_handler_14);
|
||||
assert(crypto_box_curve25519xchacha20poly1305_easy_afternm
|
||||
(guard_page, guard_page, crypto_stream_xchacha20_MESSAGEBYTES_MAX - 1,
|
||||
guard_page, guard_page) == -1);
|
||||
_exit(1);
|
||||
}
|
||||
# endif
|
||||
|
||||
static void
|
||||
sigabrt_handler_12(int sig)
|
||||
{
|
||||
(void) sig;
|
||||
# ifdef SODIUM_LIBRARY_MINIMAL
|
||||
signal(SIGABRT, sigabrt_handler_15);
|
||||
# else
|
||||
signal(SIGABRT, sigabrt_handler_13);
|
||||
# endif
|
||||
assert(crypto_pwhash_str_alg((char *) guard_page,
|
||||
"", 0U, 1U, 1U, -1) == -1);
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
static void
|
||||
sigabrt_handler_11(int sig)
|
||||
{
|
||||
(void) sig;
|
||||
signal(SIGABRT, sigabrt_handler_12);
|
||||
assert(crypto_box_easy(guard_page, guard_page,
|
||||
crypto_stream_xsalsa20_MESSAGEBYTES_MAX,
|
||||
guard_page, guard_page, guard_page) == -1);
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
static void
|
||||
sigabrt_handler_10(int sig)
|
||||
{
|
||||
(void) sig;
|
||||
signal(SIGABRT, sigabrt_handler_11);
|
||||
assert(crypto_box_easy_afternm(guard_page, guard_page,
|
||||
crypto_stream_xsalsa20_MESSAGEBYTES_MAX,
|
||||
guard_page, guard_page) == -1);
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
static void
|
||||
sigabrt_handler_9(int sig)
|
||||
{
|
||||
(void) sig;
|
||||
signal(SIGABRT, sigabrt_handler_10);
|
||||
assert(sodium_base642bin(guard_page, 1, (const char *) guard_page, 1,
|
||||
NULL, NULL, NULL, -1) == -1);
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
static void
|
||||
sigabrt_handler_8(int sig)
|
||||
{
|
||||
(void) sig;
|
||||
signal(SIGABRT, sigabrt_handler_9);
|
||||
assert(sodium_bin2base64((char *) guard_page, 1, guard_page, 1,
|
||||
sodium_base64_VARIANT_ORIGINAL) == NULL);
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
static void
|
||||
sigabrt_handler_7(int sig)
|
||||
{
|
||||
(void) sig;
|
||||
signal(SIGABRT, sigabrt_handler_8);
|
||||
assert(sodium_bin2base64((char *) guard_page, 1,
|
||||
guard_page, 1, -1) == NULL);
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
static void
|
||||
sigabrt_handler_6(int sig)
|
||||
{
|
||||
(void) sig;
|
||||
signal(SIGABRT, sigabrt_handler_7);
|
||||
assert(sodium_pad(NULL, guard_page, SIZE_MAX, 16, 1) == -1);
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
static void
|
||||
sigabrt_handler_5(int sig)
|
||||
{
|
||||
(void) sig;
|
||||
signal(SIGABRT, sigabrt_handler_6);
|
||||
assert(crypto_aead_xchacha20poly1305_ietf_encrypt(guard_page, NULL, NULL, UINT64_MAX,
|
||||
NULL, 0, NULL,
|
||||
guard_page, guard_page) == -1);
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
static void
|
||||
sigabrt_handler_4(int sig)
|
||||
{
|
||||
(void) sig;
|
||||
signal(SIGABRT, sigabrt_handler_5);
|
||||
assert(crypto_aead_chacha20poly1305_ietf_encrypt(guard_page, NULL, NULL, UINT64_MAX,
|
||||
NULL, 0, NULL,
|
||||
guard_page, guard_page) == -1);
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
static void
|
||||
sigabrt_handler_3(int sig)
|
||||
{
|
||||
(void) sig;
|
||||
signal(SIGABRT, sigabrt_handler_4);
|
||||
assert(crypto_aead_chacha20poly1305_encrypt(guard_page, NULL, NULL, UINT64_MAX,
|
||||
NULL, 0, NULL,
|
||||
guard_page, guard_page) == -1);
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
static void
|
||||
sigabrt_handler_2(int sig)
|
||||
{
|
||||
(void) sig;
|
||||
signal(SIGABRT, sigabrt_handler_3);
|
||||
#if SIZE_MAX > 0x4000000000ULL
|
||||
randombytes_buf_deterministic(guard_page, 0x4000000001ULL, guard_page);
|
||||
#else
|
||||
abort();
|
||||
#endif
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
static void
|
||||
sigabrt_handler_1(int sig)
|
||||
{
|
||||
(void) sig;
|
||||
signal(SIGABRT, sigabrt_handler_2);
|
||||
assert(crypto_kx_server_session_keys(NULL, NULL, guard_page, guard_page,
|
||||
guard_page) == -1);
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
signal(SIGABRT, sigabrt_handler_1);
|
||||
assert(crypto_kx_client_session_keys(NULL, NULL, guard_page, guard_page,
|
||||
guard_page) == -1);
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,63 @@
|
||||
|
||||
#define TEST_NAME "onetimeauth"
|
||||
#include "cmptest.h"
|
||||
|
||||
static unsigned char rs[32] = {
|
||||
0xee, 0xa6, 0xa7, 0x25, 0x1c, 0x1e, 0x72, 0x91, 0x6d, 0x11, 0xc2,
|
||||
0xcb, 0x21, 0x4d, 0x3c, 0x25, 0x25, 0x39, 0x12, 0x1d, 0x8e, 0x23,
|
||||
0x4e, 0x65, 0x2d, 0x65, 0x1f, 0xa4, 0xc8, 0xcf, 0xf8, 0x80
|
||||
};
|
||||
|
||||
static unsigned char c[131] = {
|
||||
0x8e, 0x99, 0x3b, 0x9f, 0x48, 0x68, 0x12, 0x73, 0xc2, 0x96, 0x50, 0xba,
|
||||
0x32, 0xfc, 0x76, 0xce, 0x48, 0x33, 0x2e, 0xa7, 0x16, 0x4d, 0x96, 0xa4,
|
||||
0x47, 0x6f, 0xb8, 0xc5, 0x31, 0xa1, 0x18, 0x6a, 0xc0, 0xdf, 0xc1, 0x7c,
|
||||
0x98, 0xdc, 0xe8, 0x7b, 0x4d, 0xa7, 0xf0, 0x11, 0xec, 0x48, 0xc9, 0x72,
|
||||
0x71, 0xd2, 0xc2, 0x0f, 0x9b, 0x92, 0x8f, 0xe2, 0x27, 0x0d, 0x6f, 0xb8,
|
||||
0x63, 0xd5, 0x17, 0x38, 0xb4, 0x8e, 0xee, 0xe3, 0x14, 0xa7, 0xcc, 0x8a,
|
||||
0xb9, 0x32, 0x16, 0x45, 0x48, 0xe5, 0x26, 0xae, 0x90, 0x22, 0x43, 0x68,
|
||||
0x51, 0x7a, 0xcf, 0xea, 0xbd, 0x6b, 0xb3, 0x73, 0x2b, 0xc0, 0xe9, 0xda,
|
||||
0x99, 0x83, 0x2b, 0x61, 0xca, 0x01, 0xb6, 0xde, 0x56, 0x24, 0x4a, 0x9e,
|
||||
0x88, 0xd5, 0xf9, 0xb3, 0x79, 0x73, 0xf6, 0x22, 0xa4, 0x3d, 0x14, 0xa6,
|
||||
0x59, 0x9b, 0x1f, 0x65, 0x4c, 0xb4, 0x5a, 0x74, 0xe3, 0x55, 0xa5
|
||||
};
|
||||
|
||||
static unsigned char a[16];
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
crypto_onetimeauth_state st;
|
||||
int i;
|
||||
|
||||
assert(crypto_onetimeauth_statebytes() == sizeof st);
|
||||
crypto_onetimeauth(a, c, 131, rs);
|
||||
for (i = 0; i < 16; ++i) {
|
||||
printf(",0x%02x", (unsigned int) a[i]);
|
||||
if (i % 8 == 7)
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
memset(a, 0, sizeof a);
|
||||
crypto_onetimeauth_init(&st, rs);
|
||||
crypto_onetimeauth_update(&st, c, 100);
|
||||
crypto_onetimeauth_update(&st, c, 0);
|
||||
crypto_onetimeauth_update(&st, c + 100, 31);
|
||||
crypto_onetimeauth_final(&st, a);
|
||||
for (i = 0; i < 16; ++i) {
|
||||
printf(",0x%02x", (unsigned int) a[i]);
|
||||
if (i % 8 == 7)
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
assert(crypto_onetimeauth_bytes() > 0U);
|
||||
assert(crypto_onetimeauth_keybytes() > 0U);
|
||||
assert(strcmp(crypto_onetimeauth_primitive(), "poly1305") == 0);
|
||||
assert(crypto_onetimeauth_poly1305_bytes() == crypto_onetimeauth_bytes());
|
||||
assert(crypto_onetimeauth_poly1305_keybytes() ==
|
||||
crypto_onetimeauth_keybytes());
|
||||
assert(crypto_onetimeauth_statebytes() > 0);
|
||||
assert(crypto_onetimeauth_statebytes() == crypto_onetimeauth_poly1305_statebytes());
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
,0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5
|
||||
,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9
|
||||
,0xf3,0xff,0xc7,0x70,0x3f,0x94,0x00,0xe5
|
||||
,0x2a,0x7d,0xfb,0x4b,0x3d,0x33,0x05,0xd9
|
||||
@@ -0,0 +1,33 @@
|
||||
|
||||
#define TEST_NAME "onetimeauth2"
|
||||
#include "cmptest.h"
|
||||
|
||||
static unsigned char rs[32] = {
|
||||
0xee, 0xa6, 0xa7, 0x25, 0x1c, 0x1e, 0x72, 0x91, 0x6d, 0x11, 0xc2,
|
||||
0xcb, 0x21, 0x4d, 0x3c, 0x25, 0x25, 0x39, 0x12, 0x1d, 0x8e, 0x23,
|
||||
0x4e, 0x65, 0x2d, 0x65, 0x1f, 0xa4, 0xc8, 0xcf, 0xf8, 0x80
|
||||
};
|
||||
|
||||
static unsigned char c[131] = {
|
||||
0x8e, 0x99, 0x3b, 0x9f, 0x48, 0x68, 0x12, 0x73, 0xc2, 0x96, 0x50, 0xba,
|
||||
0x32, 0xfc, 0x76, 0xce, 0x48, 0x33, 0x2e, 0xa7, 0x16, 0x4d, 0x96, 0xa4,
|
||||
0x47, 0x6f, 0xb8, 0xc5, 0x31, 0xa1, 0x18, 0x6a, 0xc0, 0xdf, 0xc1, 0x7c,
|
||||
0x98, 0xdc, 0xe8, 0x7b, 0x4d, 0xa7, 0xf0, 0x11, 0xec, 0x48, 0xc9, 0x72,
|
||||
0x71, 0xd2, 0xc2, 0x0f, 0x9b, 0x92, 0x8f, 0xe2, 0x27, 0x0d, 0x6f, 0xb8,
|
||||
0x63, 0xd5, 0x17, 0x38, 0xb4, 0x8e, 0xee, 0xe3, 0x14, 0xa7, 0xcc, 0x8a,
|
||||
0xb9, 0x32, 0x16, 0x45, 0x48, 0xe5, 0x26, 0xae, 0x90, 0x22, 0x43, 0x68,
|
||||
0x51, 0x7a, 0xcf, 0xea, 0xbd, 0x6b, 0xb3, 0x73, 0x2b, 0xc0, 0xe9, 0xda,
|
||||
0x99, 0x83, 0x2b, 0x61, 0xca, 0x01, 0xb6, 0xde, 0x56, 0x24, 0x4a, 0x9e,
|
||||
0x88, 0xd5, 0xf9, 0xb3, 0x79, 0x73, 0xf6, 0x22, 0xa4, 0x3d, 0x14, 0xa6,
|
||||
0x59, 0x9b, 0x1f, 0x65, 0x4c, 0xb4, 0x5a, 0x74, 0xe3, 0x55, 0xa5
|
||||
};
|
||||
|
||||
static unsigned char a[16] = { 0xf3, 0xff, 0xc7, 0x70, 0x3f, 0x94, 0x00, 0xe5,
|
||||
0x2a, 0x7d, 0xfb, 0x4b, 0x3d, 0x33, 0x05, 0xd9 };
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
printf("%d\n", crypto_onetimeauth_verify(a, c, 131, rs));
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
0
|
||||
@@ -0,0 +1,36 @@
|
||||
|
||||
#define TEST_NAME "onetimeauth7"
|
||||
#include "cmptest.h"
|
||||
|
||||
static unsigned char key[32];
|
||||
static unsigned char c[1000];
|
||||
static unsigned char a[16];
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
int clen;
|
||||
|
||||
for (clen = 0; clen < 1000; ++clen) {
|
||||
crypto_onetimeauth_keygen(key);
|
||||
randombytes_buf(c, clen);
|
||||
crypto_onetimeauth(a, c, clen, key);
|
||||
if (crypto_onetimeauth_verify(a, c, clen, key) != 0) {
|
||||
printf("fail %d\n", clen);
|
||||
return 100;
|
||||
}
|
||||
if (clen > 0) {
|
||||
c[rand() % clen] += 1 + (rand() % 255);
|
||||
if (crypto_onetimeauth_verify(a, c, clen, key) == 0) {
|
||||
printf("forgery %d\n", clen);
|
||||
return 100;
|
||||
}
|
||||
a[rand() % sizeof a] += 1 + (rand() % 255);
|
||||
if (crypto_onetimeauth_verify(a, c, clen, key) == 0) {
|
||||
printf("forgery %d\n", clen);
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
try {
|
||||
this['Module'] = Module;
|
||||
Module.test;
|
||||
} catch(e) {
|
||||
this['Module'] = Module = {};
|
||||
}
|
||||
if (typeof process === 'object') {
|
||||
if (typeof(FS) === 'object') {
|
||||
Module['preRun'] = Module['preRun'] || [];
|
||||
Module['preRun'].push(function() {
|
||||
FS.init();
|
||||
FS.mkdir('/test-data');
|
||||
FS.mount(NODEFS, { root: '.' }, '/test-data');
|
||||
});
|
||||
}
|
||||
} else {
|
||||
Module['print'] = function(x) {
|
||||
var event = new Event('test-output');
|
||||
event.data = x;
|
||||
window.dispatchEvent(event);
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,467 @@
|
||||
|
||||
#define TEST_NAME "pwhash_argon2i"
|
||||
#include "cmptest.h"
|
||||
|
||||
#define OUT_LEN 128
|
||||
#define OPSLIMIT 3
|
||||
#define MEMLIMIT 5000000
|
||||
|
||||
static void
|
||||
tv(void)
|
||||
{
|
||||
static struct {
|
||||
const char * passwd_hex;
|
||||
size_t passwd_len;
|
||||
const char * salt_hex;
|
||||
size_t outlen;
|
||||
unsigned long long opslimit;
|
||||
size_t memlimit;
|
||||
unsigned int lanes;
|
||||
} tests[] = {
|
||||
{ "a347ae92bce9f80f6f595a4480fc9c2fe7e7d7148d371e9487d75f5c23008ffae0"
|
||||
"65577a928febd9b1973a5a95073acdbeb6a030cfc0d79caa2dc5cd011cef02c08d"
|
||||
"a232d76d52dfbca38ca8dcbd665b17d1665f7cf5fe59772ec909733b24de97d6f5"
|
||||
"8d220b20c60d7c07ec1fd93c52c31020300c6c1facd77937a597c7a6",
|
||||
127,
|
||||
"5541fbc995d5c197ba290346d2c559dedf405cf97e5f95482143202f9e74f5c2",
|
||||
155, 5, 7256678, 1 },
|
||||
{ "e125cee61c8cb7778d9e5ad0a6f5d978ce9f84de213a8556d9ffe202020ab4a6ed"
|
||||
"9074a4eb3416f9b168f137510f3a30b70b96cbfa219ff99f6c6eaffb15c06b60e0"
|
||||
"0cc2890277f0fd3c622115772f7048adaebed86e",
|
||||
86,
|
||||
"f1192dd5dc2368b9cd421338b22433455ee0a3699f9379a08b9650ea2c126f0d",
|
||||
250, 4, 7849083, 1 },
|
||||
{ "92263cbf6ac376499f68a4289d3bb59e5a22335eba63a32e6410249155b956b6a3"
|
||||
"b48d4a44906b18b897127300b375b8f834f1ceffc70880a885f47c33876717e392"
|
||||
"be57f7da3ae58da4fd1f43daa7e44bb82d3717af4319349c24cd31e46d295856b0"
|
||||
"441b6b289992a11ced1cc3bf3011604590244a3eb737ff221129215e4e4347f491"
|
||||
"5d41292b5173d196eb9add693be5319fdadc242906178bb6c0286c9b6ca6012746"
|
||||
"711f58c8c392016b2fdfc09c64f0f6b6ab7b",
|
||||
183,
|
||||
"3b840e20e9555e9fb031c4ba1f1747ce25cc1d0ff664be676b9b4a90641ff194",
|
||||
249, 3, 7994791, 1 },
|
||||
{ "027b6d8e8c8c474e9b69c7d9ed4f9971e8e1ce2f6ba95048414c3970f0f09b70e3"
|
||||
"b6c5ae05872b3d8678705b7d381829c351a5a9c88c233569b35d6b0b809df44b64"
|
||||
"51a9c273f1150e2ef8a0b5437eb701e373474cd44b97ef0248ebce2ca0400e1b53"
|
||||
"f3d86221eca3f18eb45b702b9172440f774a82cbf1f6f525df30a6e293c873cce6"
|
||||
"9bb078ed1f0d31e7f9b8062409f37f19f8550aae",
|
||||
152,
|
||||
"eb2a3056a09ad2d7d7f975bcd707598f24cd32518cde3069f2e403b34bfee8a5", 5,
|
||||
4, 1397645, 1 },
|
||||
{ "4a857e2ee8aa9b6056f2424e84d24a72473378906ee04a46cb05311502d5250b82"
|
||||
"ad86b83c8f20a23dbb74f6da60b0b6ecffd67134d45946ac8ebfb3064294bc097d"
|
||||
"43ced68642bfb8bbbdd0f50b30118f5e",
|
||||
82,
|
||||
"39d82eef32010b8b79cc5ba88ed539fbaba741100f2edbeca7cc171ffeabf258",
|
||||
190, 3, 1432947, 1 },
|
||||
{ "c7b09aec680e7b42fedd7fc792e78b2f6c1bea8f4a884320b648f81e8cf515e8ba"
|
||||
"9dcfb11d43c4aae114c1734aa69ca82d44998365db9c93744fa28b63fd16000e82"
|
||||
"61cbbe083e7e2da1e5f696bde0834fe53146d7e0e35e7de9920d041f5a5621aabe"
|
||||
"02da3e2b09b405b77937efef3197bd5772e41fdb73fb5294478e45208063b5f58e"
|
||||
"089dbeb6d6342a909c1307b3fff5fe2cf4da56bdae50848f",
|
||||
156,
|
||||
"039c056d933b475032777edbaffac50f143f64c123329ed9cf59e3b65d3f43b6",
|
||||
178, 3, 4886999, 1 },
|
||||
{ "b540beb016a5366524d4605156493f9874514a5aa58818cd0c6dfffaa9e90205f1"
|
||||
"7b",
|
||||
34,
|
||||
"44071f6d181561670bda728d43fb79b443bb805afdebaf98622b5165e01b15fb",
|
||||
231, 1, 1631659, 1 },
|
||||
{ "a14975c26c088755a8b715ff2528d647cd343987fcf4aa25e7194a8417fb2b4b3f"
|
||||
"7268da9f3182b4cfb22d138b2749d673a47ecc7525dd15a0a3c66046971784bb63"
|
||||
"d7eae24cc84f2631712075a10e10a96b0e0ee67c43e01c423cb9c44e5371017e9c"
|
||||
"496956b632158da3fe12addecb88912e6759bc37f9af2f45af72c5cae3b179ffb6"
|
||||
"76a697de6ebe45cd4c16d4a9d642d29ddc0186a0a48cb6cd62bfc3dd229d313b30"
|
||||
"1560971e740e2cf1f99a9a090a5b283f35475057e96d7064e2e0fc81984591068d"
|
||||
"55a3b4169f22cccb0745a2689407ea1901a0a766eb99",
|
||||
220,
|
||||
"3d968b2752b8838431165059319f3ff8910b7b8ecb54ea01d3f54769e9d98daf",
|
||||
167, 3, 1784128, 1 },
|
||||
};
|
||||
char passwd[256];
|
||||
unsigned char salt[crypto_pwhash_SALTBYTES];
|
||||
unsigned char out[256];
|
||||
char out_hex[256 * 2 + 1];
|
||||
size_t i = 0U;
|
||||
|
||||
do {
|
||||
sodium_hex2bin((unsigned char *) passwd, sizeof passwd,
|
||||
tests[i].passwd_hex, strlen(tests[i].passwd_hex), NULL,
|
||||
NULL, NULL);
|
||||
sodium_hex2bin(salt, sizeof salt, tests[i].salt_hex,
|
||||
strlen(tests[i].salt_hex), NULL, NULL, NULL);
|
||||
if (crypto_pwhash(out, (unsigned long long) tests[i].outlen, passwd,
|
||||
tests[i].passwd_len, (const unsigned char *) salt,
|
||||
tests[i].opslimit, tests[i].memlimit,
|
||||
crypto_pwhash_alg_argon2i13()) != 0) {
|
||||
printf("[tv] pwhash failure (maybe intentional): [%u]\n",
|
||||
(unsigned int) i);
|
||||
continue;
|
||||
}
|
||||
sodium_bin2hex(out_hex, sizeof out_hex, out, tests[i].outlen);
|
||||
printf("%s\n", out_hex);
|
||||
} while (++i < (sizeof tests) / (sizeof tests[0]));
|
||||
}
|
||||
|
||||
static void
|
||||
tv2(void)
|
||||
{
|
||||
static struct {
|
||||
const char * passwd_hex;
|
||||
size_t passwd_len;
|
||||
const char * salt_hex;
|
||||
size_t outlen;
|
||||
unsigned long long opslimit;
|
||||
size_t memlimit;
|
||||
unsigned int lanes;
|
||||
} tests[] = {
|
||||
{ "a347ae92bce9f80f6f595a4480fc9c2fe7e7d7148d371e9487d75f5c23008ffae0"
|
||||
"65577a928febd9b1973a5a95073acdbeb6a030cfc0d79caa2dc5cd011cef02c08d"
|
||||
"a232d76d52dfbca38ca8dcbd665b17d1665f7cf5fe59772ec909733b24de97d6f5"
|
||||
"8d220b20c60d7c07ec1fd93c52c31020300c6c1facd77937a597c7a6",
|
||||
127,
|
||||
"5541fbc995d5c197ba290346d2c559dedf405cf97e5f95482143202f9e74f5c2",
|
||||
155, 4, 397645, 1 },
|
||||
{ "a347ae92bce9f80f6f595a4480fc9c2fe7e7d7148d371e9487d75f5c23008ffae0"
|
||||
"65577a928febd9b1973a5a95073acdbeb6a030cfc0d79caa2dc5cd011cef02c08d"
|
||||
"a232d76d52dfbca38ca8dcbd665b17d1665f7cf5fe59772ec909733b24de97d6f5"
|
||||
"8d220b20c60d7c07ec1fd93c52c31020300c6c1facd77937a597c7a6",
|
||||
127,
|
||||
"5541fbc995d5c197ba290346d2c559dedf405cf97e5f95482143202f9e74f5c2",
|
||||
155, 3, 397645, 1 },
|
||||
};
|
||||
char passwd[256];
|
||||
unsigned char salt[crypto_pwhash_SALTBYTES];
|
||||
unsigned char out[256];
|
||||
char out_hex[256 * 2 + 1];
|
||||
size_t i = 0U;
|
||||
|
||||
do {
|
||||
sodium_hex2bin((unsigned char *) passwd, sizeof passwd,
|
||||
tests[i].passwd_hex, strlen(tests[i].passwd_hex), NULL,
|
||||
NULL, NULL);
|
||||
sodium_hex2bin(salt, sizeof salt, tests[i].salt_hex,
|
||||
strlen(tests[i].salt_hex), NULL, NULL, NULL);
|
||||
if (crypto_pwhash(out, (unsigned long long) tests[i].outlen, passwd,
|
||||
tests[i].passwd_len, (const unsigned char *) salt,
|
||||
tests[i].opslimit, tests[i].memlimit,
|
||||
crypto_pwhash_alg_argon2i13()) != 0) {
|
||||
printf("[tv2] pwhash failure: [%u]\n", (unsigned int) i);
|
||||
continue;
|
||||
}
|
||||
sodium_bin2hex(out_hex, sizeof out_hex, out, tests[i].outlen);
|
||||
printf("%s\n", out_hex);
|
||||
} while (++i < (sizeof tests) / (sizeof tests[0]));
|
||||
|
||||
if (crypto_pwhash(out, sizeof out, "password", strlen("password"), salt, 3,
|
||||
1ULL << 12, 0) != -1) {
|
||||
printf("[tv2] pwhash should have failed (0)\n");
|
||||
}
|
||||
if (crypto_pwhash_argon2i(out, sizeof out, "password", strlen("password"), salt, 3,
|
||||
1ULL << 12, 0) != -1) {
|
||||
printf("[tv2] pwhash should have failed (0')\n");
|
||||
}
|
||||
if (crypto_pwhash(out, sizeof out, "password", strlen("password"), salt, 3,
|
||||
1, crypto_pwhash_alg_argon2i13()) != -1) {
|
||||
printf("[tv2] pwhash should have failed (1)\n");
|
||||
}
|
||||
if (crypto_pwhash(out, sizeof out, "password", strlen("password"), salt, 3,
|
||||
1ULL << 12, crypto_pwhash_alg_argon2i13()) != -1) {
|
||||
printf("[tv2] pwhash should have failed (2)\n");
|
||||
}
|
||||
if (crypto_pwhash(out, sizeof out, "password", strlen("password"), salt, 2,
|
||||
1ULL << 12, crypto_pwhash_alg_argon2i13()) != -1) {
|
||||
printf("[tv2] pwhash should have failed (3)\n");
|
||||
}
|
||||
if (crypto_pwhash(out, 15, "password", strlen("password"), salt, 3,
|
||||
1ULL << 12, crypto_pwhash_alg_argon2i13()) != -1) {
|
||||
printf("[tv2] pwhash with a short output length should have failed\n");
|
||||
}
|
||||
if (crypto_pwhash(out, sizeof out, "password", 0x100000000ULL, salt, 3,
|
||||
1ULL << 12, crypto_pwhash_alg_argon2i13()) != -1) {
|
||||
printf("[tv2] pwhash with a long password length should have failed\n");
|
||||
}
|
||||
assert(crypto_pwhash_argon2i(out, sizeof out, "password", strlen("password"), salt,
|
||||
OPSLIMIT, MEMLIMIT, crypto_pwhash_alg_argon2id13()) == -1);
|
||||
}
|
||||
|
||||
static void
|
||||
tv3(void)
|
||||
{
|
||||
static struct {
|
||||
const char *passwd;
|
||||
const char *out;
|
||||
} tests[] = {
|
||||
{ "",
|
||||
"$argon2i$v=19$m=4096,t=1,p=1$X1NhbHQAAAAAAAAAAAAAAA$bWh++"
|
||||
"MKN1OiFHKgIWTLvIi1iHicmHH7+Fv3K88ifFfI" },
|
||||
{ "",
|
||||
"$argon2i$v=19$m=2048,t=4,p=1$SWkxaUhpY21ISDcrRnYzSw$Mbg/"
|
||||
"Eck1kpZir5T9io7C64cpffdTBaORgyriLQFgQj8" },
|
||||
{ "^T5H$JYt39n%K*j:W]!1s?vg!:jGi]Ax?..l7[p0v:1jHTpla9;]bUN;?bWyCbtqg ",
|
||||
"$argon2i$v=19$m=4096,t=3,p=2$X1NhbHQAAAAAAAAAAAAAAA$z/QMiU4lQxGsYNc/"
|
||||
"+K/bizwsA1P11UG2dj/7+aILJ4I" },
|
||||
{ "K3S=KyH#)36_?]LxeR8QNKw6X=gFbxai$C%29V*",
|
||||
"$argon2i$v=19$m=4096,t=3,p=1$X1NhbHQAAAAAAAAAAAAAAA$fu2Wsecyt+"
|
||||
"yPnBvSvYN16oP5ozRmkp0ixJ1YL19V3Uo" }
|
||||
};
|
||||
char *out;
|
||||
char *passwd;
|
||||
size_t i = 0U;
|
||||
int ret;
|
||||
|
||||
do {
|
||||
out = (char *) sodium_malloc(strlen(tests[i].out) + 1U);
|
||||
assert(out != NULL);
|
||||
memcpy(out, tests[i].out, strlen(tests[i].out) + 1U);
|
||||
passwd = (char *) sodium_malloc(strlen(tests[i].passwd) + 1U);
|
||||
assert(passwd != NULL);
|
||||
memcpy(passwd, tests[i].passwd, strlen(tests[i].passwd) + 1U);
|
||||
ret = crypto_pwhash_str_verify(out, passwd, strlen(passwd));
|
||||
sodium_free(out);
|
||||
sodium_free(passwd);
|
||||
if (ret != 0) {
|
||||
printf("[tv3] pwhash_str failure (maybe intentional): [%u]\n",
|
||||
(unsigned int) i);
|
||||
}
|
||||
} while (++i < (sizeof tests) / (sizeof tests[0]));
|
||||
}
|
||||
|
||||
static void
|
||||
str_tests(void)
|
||||
{
|
||||
char *str_out;
|
||||
char *str_out2;
|
||||
char *salt;
|
||||
const char *passwd = "Correct Horse Battery Staple";
|
||||
|
||||
salt = (char *) sodium_malloc(crypto_pwhash_SALTBYTES);
|
||||
str_out = (char *) sodium_malloc(crypto_pwhash_STRBYTES);
|
||||
str_out2 = (char *) sodium_malloc(crypto_pwhash_STRBYTES);
|
||||
memcpy(salt, ">A 16-bytes salt", crypto_pwhash_SALTBYTES);
|
||||
if (crypto_pwhash_argon2i_str(str_out, passwd, strlen(passwd), OPSLIMIT,
|
||||
MEMLIMIT) != 0) {
|
||||
printf("pwhash_argon2i_str failure\n");
|
||||
}
|
||||
if (crypto_pwhash_argon2i_str(str_out2, passwd, strlen(passwd), OPSLIMIT,
|
||||
MEMLIMIT) != 0) {
|
||||
printf("pwhash_argon2i_str(2) failure\n");
|
||||
}
|
||||
if (strcmp(str_out, str_out2) == 0) {
|
||||
printf("pwhash_argon2i_str() doesn't generate different salts\n");
|
||||
}
|
||||
if (crypto_pwhash_argon2i_str_needs_rehash(str_out, OPSLIMIT, MEMLIMIT) != 0) {
|
||||
printf("needs_rehash() false positive\n");
|
||||
}
|
||||
if (crypto_pwhash_argon2i_str_needs_rehash(str_out, OPSLIMIT, MEMLIMIT / 2) != 1 ||
|
||||
crypto_pwhash_argon2i_str_needs_rehash(str_out, OPSLIMIT / 2, MEMLIMIT) != 1 ||
|
||||
crypto_pwhash_argon2i_str_needs_rehash(str_out, OPSLIMIT, MEMLIMIT * 2) != 1 ||
|
||||
crypto_pwhash_argon2i_str_needs_rehash(str_out, OPSLIMIT * 2, MEMLIMIT) != 1) {
|
||||
printf("needs_rehash() false negative\n");
|
||||
}
|
||||
if (crypto_pwhash_str_needs_rehash(str_out, OPSLIMIT, MEMLIMIT / 2) != 1) {
|
||||
printf("pwhash_str_needs_rehash() didn't handle argon2i\n");
|
||||
}
|
||||
if (crypto_pwhash_str_needs_rehash(str_out + 1, OPSLIMIT, MEMLIMIT) != -1 ||
|
||||
crypto_pwhash_argon2i_str_needs_rehash(str_out + 1, OPSLIMIT, MEMLIMIT) != -1) {
|
||||
printf("needs_rehash() didn't fail with an invalid hash string\n");
|
||||
}
|
||||
if (sodium_is_zero((const unsigned char *) str_out + strlen(str_out),
|
||||
crypto_pwhash_STRBYTES - strlen(str_out)) != 1 ||
|
||||
sodium_is_zero((const unsigned char *) str_out2 + strlen(str_out2),
|
||||
crypto_pwhash_STRBYTES - strlen(str_out2)) != 1) {
|
||||
printf("pwhash_str() doesn't properly pad with zeros\n");
|
||||
}
|
||||
if (crypto_pwhash_argon2i_str_verify(str_out, passwd, strlen(passwd)) != 0) {
|
||||
printf("pwhash_str_verify(1) failure\n");
|
||||
}
|
||||
str_out[14]++;
|
||||
if (crypto_pwhash_argon2i_str_verify(str_out, passwd, strlen(passwd)) != -1) {
|
||||
printf("pwhash_str_verify(2) failure\n");
|
||||
}
|
||||
str_out[14]--;
|
||||
assert(str_out[crypto_pwhash_STRBYTES - 1U] == 0);
|
||||
|
||||
if (crypto_pwhash_argon2i_str(str_out2, passwd, 0x100000000ULL, OPSLIMIT,
|
||||
MEMLIMIT) != -1) {
|
||||
printf("pwhash_str() with a large password should have failed\n");
|
||||
}
|
||||
if (crypto_pwhash_argon2i_str(str_out2, passwd, strlen(passwd), 1, MEMLIMIT) !=
|
||||
-1) {
|
||||
printf("pwhash_str() with a small opslimit should have failed\n");
|
||||
}
|
||||
{
|
||||
const char *str_in_ = "$argon2i$m=65536,t=2,p=1c29tZXNhbHQ"
|
||||
"$9sTbSlTio3Biev89thdrlKKiCaYsjjYVJxGAL3swxpQ";
|
||||
char *str_in = (char *) sodium_malloc(strlen(str_in_) + 1U);
|
||||
|
||||
const char *password_in_ = "password";
|
||||
char *password_in = (char *) sodium_malloc(strlen(password_in_) + 1U);
|
||||
|
||||
memcpy(str_in, str_in_, strlen(str_in_) + 1U);
|
||||
memcpy(password_in, password_in_, strlen(password_in_) + 1U);
|
||||
|
||||
if (crypto_pwhash_argon2i_str_verify(str_in, password_in,
|
||||
0x100000000ULL) != -1) {
|
||||
printf("pwhash_str_verify(invalid(0)) failure\n");
|
||||
}
|
||||
|
||||
sodium_free(password_in);
|
||||
sodium_free(str_in);
|
||||
}
|
||||
if (crypto_pwhash_argon2i_str_verify("$argon2i$m=65536,t=2,p=1c29tZXNhbHQ"
|
||||
"$9sTbSlTio3Biev89thdrlKKiCaYsjjYVJxGAL3swxpQ",
|
||||
"password", strlen("password")) != -1) {
|
||||
printf("pwhash_str_verify(invalid(1)) failure %d\n", errno);
|
||||
}
|
||||
if (crypto_pwhash_argon2i_str_verify("$argon2i$m=65536,t=2,p=1$c29tZXNhbHQ"
|
||||
"9sTbSlTio3Biev89thdrlKKiCaYsjjYVJxGAL3swxpQ",
|
||||
"password", strlen("password")) != -1) {
|
||||
printf("pwhash_str_verify(invalid(2)) failure\n");
|
||||
}
|
||||
if (crypto_pwhash_str_verify("$argon2i$m=65536,t=2,p=1$c29tZXNhbHQ"
|
||||
"$b2G3seW+uPzerwQQC+/E1K50CLLO7YXy0JRcaTuswRo",
|
||||
"password", strlen("password")) != -1) {
|
||||
printf("pwhash_str_verify(invalid(3)) failure\n");
|
||||
}
|
||||
if (crypto_pwhash_str_verify("$argon2i$v=19$m=65536,t=2,p=1c29tZXNhbHQ"
|
||||
"$wWKIMhR9lyDFvRz9YTZweHKfbftvj+qf+YFY4NeBbtA",
|
||||
"password", strlen("password")) != -1) {
|
||||
printf("pwhash_str_verify(invalid(4)) failure\n");
|
||||
}
|
||||
if (crypto_pwhash_str_verify("$argon2i$v=19$m=65536,t=2,p=1$c29tZXNhbHQ"
|
||||
"wWKIMhR9lyDFvRz9YTZweHKfbftvj+qf+YFY4NeBbtA",
|
||||
"password", strlen("password")) != -1) {
|
||||
printf("pwhash_str_verify(invalid(5)) failure\n");
|
||||
}
|
||||
if (crypto_pwhash_str_verify("$argon2i$v=19$m=65536,t=2,p=1$c29tZXNhbHQ"
|
||||
"$8iIuixkI73Js3G1uMbezQXD0b8LG4SXGsOwoQkdAQIM",
|
||||
"password", strlen("password")) != -1) {
|
||||
printf("pwhash_str_verify(invalid(6)) failure\n");
|
||||
}
|
||||
if (crypto_pwhash_str_verify(
|
||||
"$argon2i$v=19$m=4096,t=3,p=2$b2RpZHVlamRpc29kaXNrdw"
|
||||
"$TNnWIwlu1061JHrnCqIAmjs3huSxYIU+0jWipu7Kc9M",
|
||||
"password", strlen("password")) != 0) {
|
||||
printf("pwhash_str_verify(valid(7)) failure\n");
|
||||
}
|
||||
if (crypto_pwhash_str_verify(
|
||||
"$argon2i$v=19$m=4096,t=3,p=2$b2RpZHVlamRpc29kaXNrdw"
|
||||
"$TNnWIwlu1061JHrnCqIAmjs3huSxYIU+0jWipu7Kc9M",
|
||||
"passwore", strlen("passwore")) != -1 || errno != EINVAL) {
|
||||
printf("pwhash_str_verify(invalid(7)) failure\n");
|
||||
}
|
||||
if (crypto_pwhash_str_verify(
|
||||
"$Argon2i$v=19$m=4096,t=3,p=2$b2RpZHVlamRpc29kaXNrdw"
|
||||
"$TNnWIwlu1061JHrnCqIAmjs3huSxYIU+0jWipu7Kc9M",
|
||||
"password", strlen("password")) != -1 || errno != EINVAL) {
|
||||
printf("pwhash_str_verify(invalid(8)) failure\n");
|
||||
}
|
||||
if (crypto_pwhash_str_verify(
|
||||
"$argon2i$v=1$m=4096,t=3,p=2$b2RpZHVlamRpc29kaXNrdw"
|
||||
"$TNnWIwlu1061JHrnCqIAmjs3huSxYIU+0jWipu7Kc9M",
|
||||
"password", strlen("password")) != -1 || errno != EINVAL) {
|
||||
printf("pwhash_str_verify(invalid(9)) failure\n");
|
||||
}
|
||||
if (crypto_pwhash_str_verify(
|
||||
"$argon2i$v=1$m=4096,t=3,p=2$b2RpZHVla~=mRpc29kaXNrdw"
|
||||
"$TNnWIwlu1061JHrnCqIAmjs3huSxYIU+0jWipu7Kc9M",
|
||||
"password", strlen("password")) != -1 || errno != EINVAL) {
|
||||
printf("pwhash_str_verify(invalid(10)) failure\n");
|
||||
}
|
||||
if (crypto_pwhash_str_verify(
|
||||
"$argon2i$v=1$m=4096,t=3,p=2$b2RpZHVlamRpc29kaXNrdw"
|
||||
"$TNnWIwlu1061JHrnCqIAmjs3huSxYI~=U+0jWipu7Kc9M",
|
||||
"password", strlen("password")) != -1 || errno != EINVAL) {
|
||||
printf("pwhash_str_verify(invalid(11)) failure\n");
|
||||
}
|
||||
assert(crypto_pwhash_str_alg(str_out, "test", 4, OPSLIMIT, MEMLIMIT,
|
||||
crypto_pwhash_ALG_ARGON2I13) == 0);
|
||||
assert(crypto_pwhash_argon2i_str_verify(str_out, "test", 4) == 0);
|
||||
assert(crypto_pwhash_argon2i_str_needs_rehash(str_out,
|
||||
OPSLIMIT, MEMLIMIT) == 0);
|
||||
assert(crypto_pwhash_argon2i_str_needs_rehash(str_out,
|
||||
OPSLIMIT / 2, MEMLIMIT) == 1);
|
||||
assert(crypto_pwhash_argon2i_str_needs_rehash(str_out,
|
||||
OPSLIMIT, MEMLIMIT / 2) == 1);
|
||||
assert(crypto_pwhash_argon2i_str_needs_rehash(str_out, 0, 0) == 1);
|
||||
assert(crypto_pwhash_argon2id_str_needs_rehash(str_out, 0, 0) == -1);
|
||||
assert(crypto_pwhash_argon2i_str_needs_rehash(str_out + 1,
|
||||
OPSLIMIT, MEMLIMIT) == -1);
|
||||
assert(crypto_pwhash_argon2id_str_needs_rehash(str_out, 0, 0) == -1);
|
||||
assert(crypto_pwhash_argon2id_str_needs_rehash("", OPSLIMIT, MEMLIMIT) == -1);
|
||||
assert(crypto_pwhash_str_alg(str_out, "test", 4, OPSLIMIT, MEMLIMIT,
|
||||
crypto_pwhash_ALG_ARGON2ID13) == 0);
|
||||
assert(crypto_pwhash_argon2id_str_verify(str_out, "test", 4) == 0);
|
||||
assert(crypto_pwhash_argon2id_str_needs_rehash(str_out,
|
||||
OPSLIMIT, MEMLIMIT) == 0);
|
||||
assert(crypto_pwhash_argon2id_str_needs_rehash(str_out,
|
||||
OPSLIMIT / 2, MEMLIMIT) == 1);
|
||||
assert(crypto_pwhash_argon2id_str_needs_rehash(str_out,
|
||||
OPSLIMIT, MEMLIMIT / 2) == 1);
|
||||
assert(crypto_pwhash_argon2id_str_needs_rehash(str_out, 0, 0) == 1);
|
||||
assert(crypto_pwhash_argon2i_str_needs_rehash(str_out, 0, 0) == -1);
|
||||
assert(crypto_pwhash_argon2id_str_needs_rehash("", OPSLIMIT, MEMLIMIT) == -1);
|
||||
assert(crypto_pwhash_argon2id_str_needs_rehash(str_out + 1,
|
||||
OPSLIMIT, MEMLIMIT) == -1);
|
||||
sodium_free(salt);
|
||||
sodium_free(str_out);
|
||||
sodium_free(str_out2);
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
tv();
|
||||
tv2();
|
||||
tv3();
|
||||
str_tests();
|
||||
|
||||
assert(crypto_pwhash_argon2i_bytes_min() > 0U);
|
||||
assert(crypto_pwhash_argon2i_bytes_max() > crypto_pwhash_argon2i_bytes_min());
|
||||
assert(crypto_pwhash_argon2i_passwd_max() > crypto_pwhash_argon2i_passwd_min());
|
||||
assert(crypto_pwhash_argon2i_saltbytes() > 0U);
|
||||
assert(crypto_pwhash_argon2i_strbytes() > 1U);
|
||||
assert(crypto_pwhash_argon2i_strbytes() > strlen(crypto_pwhash_argon2i_strprefix()));
|
||||
|
||||
assert(crypto_pwhash_argon2i_opslimit_min() > 0U);
|
||||
assert(crypto_pwhash_argon2i_opslimit_max() > 0U);
|
||||
assert(crypto_pwhash_argon2i_memlimit_min() > 0U);
|
||||
assert(crypto_pwhash_argon2i_memlimit_max() > 0U);
|
||||
assert(crypto_pwhash_argon2i_opslimit_interactive() > 0U);
|
||||
assert(crypto_pwhash_argon2i_memlimit_interactive() > 0U);
|
||||
assert(crypto_pwhash_argon2i_opslimit_moderate() > 0U);
|
||||
assert(crypto_pwhash_argon2i_memlimit_moderate() > 0U);
|
||||
assert(crypto_pwhash_argon2i_opslimit_sensitive() > 0U);
|
||||
assert(crypto_pwhash_argon2i_memlimit_sensitive() > 0U);
|
||||
|
||||
assert(crypto_pwhash_argon2i_bytes_min() == crypto_pwhash_argon2i_BYTES_MIN);
|
||||
assert(crypto_pwhash_argon2i_bytes_max() == crypto_pwhash_argon2i_BYTES_MAX);
|
||||
assert(crypto_pwhash_argon2i_passwd_min() == crypto_pwhash_argon2i_PASSWD_MIN);
|
||||
assert(crypto_pwhash_argon2i_passwd_max() == crypto_pwhash_argon2i_PASSWD_MAX);
|
||||
assert(crypto_pwhash_argon2i_saltbytes() == crypto_pwhash_argon2i_SALTBYTES);
|
||||
assert(crypto_pwhash_argon2i_strbytes() == crypto_pwhash_argon2i_STRBYTES);
|
||||
|
||||
assert(crypto_pwhash_argon2i_opslimit_min() == crypto_pwhash_argon2i_OPSLIMIT_MIN);
|
||||
assert(crypto_pwhash_argon2i_opslimit_max() == crypto_pwhash_argon2i_OPSLIMIT_MAX);
|
||||
assert(crypto_pwhash_argon2i_memlimit_min() == crypto_pwhash_argon2i_MEMLIMIT_MIN);
|
||||
assert(crypto_pwhash_argon2i_memlimit_max() == crypto_pwhash_argon2i_MEMLIMIT_MAX);
|
||||
assert(crypto_pwhash_argon2i_opslimit_interactive() ==
|
||||
crypto_pwhash_argon2i_OPSLIMIT_INTERACTIVE);
|
||||
assert(crypto_pwhash_argon2i_memlimit_interactive() ==
|
||||
crypto_pwhash_argon2i_MEMLIMIT_INTERACTIVE);
|
||||
assert(crypto_pwhash_argon2i_opslimit_moderate() ==
|
||||
crypto_pwhash_argon2i_OPSLIMIT_MODERATE);
|
||||
assert(crypto_pwhash_argon2i_memlimit_moderate() ==
|
||||
crypto_pwhash_argon2i_MEMLIMIT_MODERATE);
|
||||
assert(crypto_pwhash_argon2i_opslimit_sensitive() ==
|
||||
crypto_pwhash_argon2i_OPSLIMIT_SENSITIVE);
|
||||
assert(crypto_pwhash_argon2i_memlimit_sensitive() ==
|
||||
crypto_pwhash_argon2i_MEMLIMIT_SENSITIVE);
|
||||
|
||||
assert(crypto_pwhash_argon2i_alg_argon2i13() == crypto_pwhash_argon2i_ALG_ARGON2I13);
|
||||
|
||||
printf("OK\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
23b803c84eaa25f4b44634cc1e5e37792c53fcd9b1eb20f865329c68e09cbfa9f1968757901b383fce221afe27713f97914a041395bbe1fb70e079e5bed2c7145b1f6154046f5958e9b1b29055454e264d1f2231c316f26be2e3738e83a80315e9a0951ce4b137b52e7d5ee7b37f7d936dcee51362bcf792595e3c896ad5042734fc90c92cae572ce63ff659a2f7974a3bd730d04d525d253ccc38
|
||||
0bb3769b064b9c43a9460476ab38c4a9a2470d55d4c992c6e723af895e4c07c09af41f22f90eab583a0c362d177f4677f212482fd145bfb9ac6211635e48461122bb49097b5fb0739d2cd22a39bf03d268e7495d4fd8d710aa156202f0a06e932ff513e6e7c76a4e98b6df5cf922f124791b1076ad904e6897271f5d7d24c5929e2a3b836d0f2f2697c2d758ee79bf1264f3fae65f3744e0f6d7d07ef6e8b35b70c0f88e9036325bfb24ac7f550351486da87aef10d6b0cb77d1cf6e31cf98399c6f241c605c6530dffb4764784f6c0b0bf601d4e4431e8b18dabdc3079c6e264302ade79f61cbd5497c95486340bb891a737223100be0429650
|
||||
e9aa073b0b872f15c083d1d7ce52c09f493b827ca78f13a06c1721b45b1e17b24c04e19fe869333135360197a7eb55994fee3e8d9680aedfdf7674f3ad7b84d59d7eab03579ffc10c7093093bc48ec84252aa1b30f40f5e838f1443e15e2772a39f4e774eb052097e8881e94f15457b779fa2af2bbc9a993687657c7704ac8a37c25c1df4289eb4c70da45f2fd46bc0f78259767d3dd478a7c369cf866758bc36d9bd8e2e3c9fb0cf7fd6073ebf630c1f67fa7d303c07da40b36749d157ea37965fef810f2ea05ae6fc7d96a8f3470d73e15b22b42e8d6986dbfe5303256b2b3560372c4452ffb2a04fb7c6691489f70cb46831be0679117f7
|
||||
[tv] pwhash failure (maybe intentional): [3]
|
||||
c121209f0ba70aed93d49200e5dc82cce013cef25ea31e160bf8db3cf448a59d1a56f6c19259e18ea020553cb75781761d112b2d949a297584c65e60df95ad89c4109825a3171dc6f20b1fd6b0cdfd194861bc2b414295bee5c6c52619e544abce7d520659c3d51de2c60e89948d830695ab38dcb75dd7ab06a4770dd4bc7c8f335519e04b038416b1a7dbd25c026786a8105c5ffe7a0931364f0376ae5772be39b51d91d3281464e0f3a128e7155a68e87cf79626ffca0b2a3022fc8420
|
||||
91c337ce8918a5805a59b00bd1819d3eb4356807cbd2a80b271c4b482dce03f5b02ae4eb831ff668cbb327b93c300b41da4852e5547bea8342d518dd9311aaeb5f90eccf66d548f9275631f0b1fd4b299cec5d2e86a59e55dc7b3afab6204447b21d1ef1da824abaf31a25a0d6135c4fe81d34a06816c8a6eab19141f5687108500f3719a862af8c5fee36e130c69921e11ce83dfc72c5ec3b862c1bccc5fd63ad57f432fbcca6f9e18d5a59015950cdf053
|
||||
[tv] pwhash failure (maybe intentional): [6]
|
||||
e942951dfbc2d508294b10f9e97b47d0cd04e668a043cb95679cc1139df7c27cd54367688725be9d069f5704c12223e7e4ca181fbd0bed18bb4634795e545a6c04a7306933a41a794baedbb628d41bc285e0b9084055ae136f6b63624c874f5a1e1d8be7b0b7227a171d2d7ed578d88bfdcf18323198962d0dcad4126fd3f21adeb1e11d66252ea0c58c91696e91031bfdcc2a9dc0e028d17b9705ba2d7bcdcd1e3ba75b4b1fea
|
||||
fd329873387429cb79faaec4f65c35649f65de0aabc1f092ca9dee20029d8ae6c3a97e9940763e1703a7fef5a20eb7f210123fc8c6d3f1745d19d5e3c1eb392ab4a6070c8a6b9ecbeabae0711326e81530099541a882d4bd7733c4a7477ae72b6928c46cd07264172a9d2cfb7d649594f877f8b447d9c01b17996b85db5a71f733f8cc5fd0436540a5b7a1d79de09e20c3abe6515501b3156cd51e
|
||||
bbbc4c7963593601d4d685ed9d89682374f8e6b3ce92ce8ccc702728ec8bf839fd7cb8e37ddb09be8c18c7e0ed099949665227a00fb33e1f63ca830dbeb13b29d987b445b3e081cd8428bdb2f9e003e12bea98230fd30842fa193af9169171b550322072c88330ea464cbe02b6ee044374d3f3d174c23617b707159a11926c56601123dcc30508ec84fdb0797b7ab23a77eeefb2a0be2ef45e903c
|
||||
OK
|
||||
@@ -0,0 +1,517 @@
|
||||
|
||||
#define TEST_NAME "pwhash_argon2id"
|
||||
#include "cmptest.h"
|
||||
|
||||
#define OUT_LEN 128
|
||||
#define OPSLIMIT 3
|
||||
#define MEMLIMIT 5000000
|
||||
|
||||
static void
|
||||
tv(void)
|
||||
{
|
||||
static struct {
|
||||
const char * passwd_hex;
|
||||
size_t passwd_len;
|
||||
const char * salt_hex;
|
||||
size_t outlen;
|
||||
unsigned long long opslimit;
|
||||
size_t memlimit;
|
||||
unsigned int lanes;
|
||||
} tests[] = {
|
||||
{ "a347ae92bce9f80f6f595a4480fc9c2fe7e7d7148d371e9487d75f5c23008ffae0"
|
||||
"65577a928febd9b1973a5a95073acdbeb6a030cfc0d79caa2dc5cd011cef02c08d"
|
||||
"a232d76d52dfbca38ca8dcbd665b17d1665f7cf5fe59772ec909733b24de97d6f5"
|
||||
"8d220b20c60d7c07ec1fd93c52c31020300c6c1facd77937a597c7a6",
|
||||
127,
|
||||
"5541fbc995d5c197ba290346d2c559dedf405cf97e5f95482143202f9e74f5c2",
|
||||
155, 5, 7256678, 1 },
|
||||
{ "e125cee61c8cb7778d9e5ad0a6f5d978ce9f84de213a8556d9ffe202020ab4a6ed"
|
||||
"9074a4eb3416f9b168f137510f3a30b70b96cbfa219ff99f6c6eaffb15c06b60e0"
|
||||
"0cc2890277f0fd3c622115772f7048adaebed86e",
|
||||
86,
|
||||
"f1192dd5dc2368b9cd421338b22433455ee0a3699f9379a08b9650ea2c126f0d",
|
||||
250, 4, 7849083, 1 },
|
||||
{ "92263cbf6ac376499f68a4289d3bb59e5a22335eba63a32e6410249155b956b6a3"
|
||||
"b48d4a44906b18b897127300b375b8f834f1ceffc70880a885f47c33876717e392"
|
||||
"be57f7da3ae58da4fd1f43daa7e44bb82d3717af4319349c24cd31e46d295856b0"
|
||||
"441b6b289992a11ced1cc3bf3011604590244a3eb737ff221129215e4e4347f491"
|
||||
"5d41292b5173d196eb9add693be5319fdadc242906178bb6c0286c9b6ca6012746"
|
||||
"711f58c8c392016b2fdfc09c64f0f6b6ab7b",
|
||||
183,
|
||||
"3b840e20e9555e9fb031c4ba1f1747ce25cc1d0ff664be676b9b4a90641ff194",
|
||||
249, 3, 7994791, 1 },
|
||||
{ "027b6d8e8c8c474e9b69c7d9ed4f9971e8e1ce2f6ba95048414c3970f0f09b70e3"
|
||||
"b6c5ae05872b3d8678705b7d381829c351a5a9c88c233569b35d6b0b809df44b64"
|
||||
"51a9c273f1150e2ef8a0b5437eb701e373474cd44b97ef0248ebce2ca0400e1b53"
|
||||
"f3d86221eca3f18eb45b702b9172440f774a82cbf1f6f525df30a6e293c873cce6"
|
||||
"9bb078ed1f0d31e7f9b8062409f37f19f8550aae",
|
||||
152,
|
||||
"eb2a3056a09ad2d7d7f975bcd707598f24cd32518cde3069f2e403b34bfee8a5", 5,
|
||||
4, 1397645, 1 },
|
||||
{ "4a857e2ee8aa9b6056f2424e84d24a72473378906ee04a46cb05311502d5250b82"
|
||||
"ad86b83c8f20a23dbb74f6da60b0b6ecffd67134d45946ac8ebfb3064294bc097d"
|
||||
"43ced68642bfb8bbbdd0f50b30118f5e",
|
||||
82,
|
||||
"39d82eef32010b8b79cc5ba88ed539fbaba741100f2edbeca7cc171ffeabf258",
|
||||
190, 3, 1432947, 1 },
|
||||
{ "c7b09aec680e7b42fedd7fc792e78b2f6c1bea8f4a884320b648f81e8cf515e8ba"
|
||||
"9dcfb11d43c4aae114c1734aa69ca82d44998365db9c93744fa28b63fd16000e82"
|
||||
"61cbbe083e7e2da1e5f696bde0834fe53146d7e0e35e7de9920d041f5a5621aabe"
|
||||
"02da3e2b09b405b77937efef3197bd5772e41fdb73fb5294478e45208063b5f58e"
|
||||
"089dbeb6d6342a909c1307b3fff5fe2cf4da56bdae50848f",
|
||||
156,
|
||||
"039c056d933b475032777edbaffac50f143f64c123329ed9cf59e3b65d3f43b6",
|
||||
178, 3, 4886999, 1 },
|
||||
{ "b540beb016a5366524d4605156493f9874514a5aa58818cd0c6dfffaa9e90205f1"
|
||||
"7b",
|
||||
34,
|
||||
"44071f6d181561670bda728d43fb79b443bb805afdebaf98622b5165e01b15fb",
|
||||
231, 1, 1631659, 1 },
|
||||
{ "a14975c26c088755a8b715ff2528d647cd343987fcf4aa25e7194a8417fb2b4b3f"
|
||||
"7268da9f3182b4cfb22d138b2749d673a47ecc7525dd15a0a3c66046971784bb63"
|
||||
"d7eae24cc84f2631712075a10e10a96b0e0ee67c43e01c423cb9c44e5371017e9c"
|
||||
"496956b632158da3fe12addecb88912e6759bc37f9af2f45af72c5cae3b179ffb6"
|
||||
"76a697de6ebe45cd4c16d4a9d642d29ddc0186a0a48cb6cd62bfc3dd229d313b30"
|
||||
"1560971e740e2cf1f99a9a090a5b283f35475057e96d7064e2e0fc81984591068d"
|
||||
"55a3b4169f22cccb0745a2689407ea1901a0a766eb99",
|
||||
220,
|
||||
"3d968b2752b8838431165059319f3ff8910b7b8ecb54ea01d3f54769e9d98daf",
|
||||
167, 3, 1784128, 1 },
|
||||
};
|
||||
char passwd[256];
|
||||
unsigned char salt[crypto_pwhash_SALTBYTES];
|
||||
unsigned char out[256];
|
||||
char out_hex[256 * 2 + 1];
|
||||
size_t i = 0U;
|
||||
|
||||
do {
|
||||
sodium_hex2bin((unsigned char *) passwd, sizeof passwd,
|
||||
tests[i].passwd_hex, strlen(tests[i].passwd_hex), NULL,
|
||||
NULL, NULL);
|
||||
sodium_hex2bin(salt, sizeof salt, tests[i].salt_hex,
|
||||
strlen(tests[i].salt_hex), NULL, NULL, NULL);
|
||||
if (crypto_pwhash(out, (unsigned long long) tests[i].outlen, passwd,
|
||||
tests[i].passwd_len, (const unsigned char *) salt,
|
||||
tests[i].opslimit, tests[i].memlimit,
|
||||
crypto_pwhash_alg_default()) != 0) {
|
||||
printf("[tv] pwhash failure (maybe intentional): [%u]\n",
|
||||
(unsigned int) i);
|
||||
continue;
|
||||
}
|
||||
sodium_bin2hex(out_hex, sizeof out_hex, out, tests[i].outlen);
|
||||
printf("%s\n", out_hex);
|
||||
} while (++i < (sizeof tests) / (sizeof tests[0]));
|
||||
}
|
||||
|
||||
static void
|
||||
tv2(void)
|
||||
{
|
||||
static struct {
|
||||
const char * passwd_hex;
|
||||
size_t passwd_len;
|
||||
const char * salt_hex;
|
||||
size_t outlen;
|
||||
unsigned long long opslimit;
|
||||
size_t memlimit;
|
||||
unsigned int lanes;
|
||||
} tests[] = {
|
||||
{ "a347ae92bce9f80f6f595a4480fc9c2fe7e7d7148d371e9487d75f5c23008ffae0"
|
||||
"65577a928febd9b1973a5a95073acdbeb6a030cfc0d79caa2dc5cd011cef02c08d"
|
||||
"a232d76d52dfbca38ca8dcbd665b17d1665f7cf5fe59772ec909733b24de97d6f5"
|
||||
"8d220b20c60d7c07ec1fd93c52c31020300c6c1facd77937a597c7a6",
|
||||
127,
|
||||
"5541fbc995d5c197ba290346d2c559dedf405cf97e5f95482143202f9e74f5c2",
|
||||
155, 4, 397645, 1 },
|
||||
{ "a347ae92bce9f80f6f595a4480fc9c2fe7e7d7148d371e9487d75f5c23008ffae0"
|
||||
"65577a928febd9b1973a5a95073acdbeb6a030cfc0d79caa2dc5cd011cef02c08d"
|
||||
"a232d76d52dfbca38ca8dcbd665b17d1665f7cf5fe59772ec909733b24de97d6f5"
|
||||
"8d220b20c60d7c07ec1fd93c52c31020300c6c1facd77937a597c7a6",
|
||||
127,
|
||||
"5541fbc995d5c197ba290346d2c559dedf405cf97e5f95482143202f9e74f5c2",
|
||||
155, 3, 397645, 1 },
|
||||
};
|
||||
char passwd[256];
|
||||
unsigned char salt[crypto_pwhash_SALTBYTES];
|
||||
unsigned char out[256];
|
||||
char out_hex[256 * 2 + 1];
|
||||
size_t i = 0U;
|
||||
|
||||
do {
|
||||
sodium_hex2bin((unsigned char *) passwd, sizeof passwd,
|
||||
tests[i].passwd_hex, strlen(tests[i].passwd_hex), NULL,
|
||||
NULL, NULL);
|
||||
sodium_hex2bin(salt, sizeof salt, tests[i].salt_hex,
|
||||
strlen(tests[i].salt_hex), NULL, NULL, NULL);
|
||||
if (crypto_pwhash(out, (unsigned long long) tests[i].outlen, passwd,
|
||||
tests[i].passwd_len, (const unsigned char *) salt,
|
||||
tests[i].opslimit, tests[i].memlimit,
|
||||
crypto_pwhash_alg_default()) != 0) {
|
||||
printf("[tv2] pwhash failure: [%u]\n", (unsigned int) i);
|
||||
continue;
|
||||
}
|
||||
sodium_bin2hex(out_hex, sizeof out_hex, out, tests[i].outlen);
|
||||
printf("%s\n", out_hex);
|
||||
} while (++i < (sizeof tests) / (sizeof tests[0]));
|
||||
|
||||
if (crypto_pwhash_argon2id(out, sizeof out, "password", strlen("password"), salt, 3,
|
||||
1ULL << 12, 0) != -1) {
|
||||
printf("[tv2] pwhash should have failed (0)\n");
|
||||
}
|
||||
if (crypto_pwhash_argon2id(out, sizeof out, "password", strlen("password"), salt, 3,
|
||||
1, crypto_pwhash_argon2id_alg_argon2id13()) != -1) {
|
||||
printf("[tv2] pwhash should have failed (1)\n");
|
||||
}
|
||||
if (crypto_pwhash_argon2id(out, sizeof out, "password", strlen("password"), salt, 3,
|
||||
1ULL << 12, crypto_pwhash_argon2id_alg_argon2id13()) != -1) {
|
||||
printf("[tv2] pwhash should have failed (2)\n");
|
||||
}
|
||||
if (crypto_pwhash_argon2id(out, sizeof out, "password", strlen("password"), salt, 2,
|
||||
1ULL << 12, crypto_pwhash_argon2id_alg_argon2id13()) != -1) {
|
||||
printf("[tv2] pwhash should have failed (3)\n");
|
||||
}
|
||||
if (crypto_pwhash_argon2id(out, 15, "password", strlen("password"), salt, 3,
|
||||
1ULL << 12, crypto_pwhash_argon2id_alg_argon2id13()) != -1) {
|
||||
printf("[tv2] pwhash with a short output length should have failed\n");
|
||||
}
|
||||
if (crypto_pwhash_argon2id(out, sizeof out, "password", 0x100000000ULL, salt, 3,
|
||||
1ULL << 12, crypto_pwhash_argon2id_alg_argon2id13()) != -1) {
|
||||
printf("[tv2] pwhash with a long password length should have failed\n");
|
||||
}
|
||||
assert(crypto_pwhash_argon2id(out, sizeof out, "password", strlen("password"), salt,
|
||||
OPSLIMIT, MEMLIMIT, crypto_pwhash_alg_argon2i13()) == -1);
|
||||
}
|
||||
|
||||
static void
|
||||
tv3(void)
|
||||
{
|
||||
static struct {
|
||||
const char *passwd;
|
||||
const char *out;
|
||||
} tests[] = {
|
||||
{ "",
|
||||
"$argon2id$v=19$m=4096,t=0,p=1$X1NhbHQAAAAAAAAAAAAAAA$bWh++MKN1OiFHKgIWTLvIi1iHicmHH7+Fv3K88ifFfI" },
|
||||
{ "",
|
||||
"$argon2id$v=19$m=2048,t=4,p=1$SWkxaUhpY21ISDcrRnYzSw$Mbg/Eck1kpZir5T9io7C64cpffdTBaORgyriLQFgQj8" },
|
||||
{ "",
|
||||
"$argon2id$v=19$m=4882,t=2,p=1$bA81arsiXysd3WbTRzmEOw$Nm8QBM+7RH1DXo9rvp5cwKEOOOfD2g6JuxlXihoNcpE" },
|
||||
{ "^T5H$JYt39n%K*j:W]!1s?vg!:jGi]Ax?..l7[p0v:1jHTpla9;]bUN;?bWyCbtqg ",
|
||||
"$argon2id$v=19$m=4096,t=0,p=1$PkEgMTYtYnl0ZXMgc2FsdA$ltB/ue1kPtBMBGfsysMpPigE6hiNEKZ9vs8vLNVDQGA" },
|
||||
{ "^T5H$JYt39n%K*j:W]!1s?vg!:jGi]Ax?..l7[p0v:1jHTpla9;]bUN;?bWyCbtqg ",
|
||||
"$argon2id$v=19$m=4096,t=19,p=1$PkEgMTYtYnl0ZXMgc2FsdA$ltB/ue1kPtBMBGfsysMpPigE6hiNEKZ9vs8vLNVDQGA" },
|
||||
{ "K3S=KyH#)36_?]LxeR8QNKw6X=gFbxai$C%29V*",
|
||||
"$argon2id$v=19$m=4096,t=1,p=3$PkEgcHJldHR5IGxvbmcgc2FsdA$HUqx5Z1b/ZypnUrvvJ5UC2Q+T6Q1WwASK/Kr9dRbGA0" }
|
||||
};
|
||||
char *out;
|
||||
char *passwd;
|
||||
size_t i = 0U;
|
||||
int ret;
|
||||
|
||||
do {
|
||||
out = (char *) sodium_malloc(strlen(tests[i].out) + 1U);
|
||||
assert(out != NULL);
|
||||
memcpy(out, tests[i].out, strlen(tests[i].out) + 1U);
|
||||
passwd = (char *) sodium_malloc(strlen(tests[i].passwd) + 1U);
|
||||
assert(passwd != NULL);
|
||||
memcpy(passwd, tests[i].passwd, strlen(tests[i].passwd) + 1U);
|
||||
ret = crypto_pwhash_str_verify(out, passwd, strlen(passwd));
|
||||
sodium_free(out);
|
||||
sodium_free(passwd);
|
||||
if (ret != 0) {
|
||||
printf("[tv3] pwhash_argon2id_str failure (maybe intentional): [%u]\n",
|
||||
(unsigned int) i);
|
||||
}
|
||||
} while (++i < (sizeof tests) / (sizeof tests[0]));
|
||||
}
|
||||
|
||||
static void
|
||||
str_tests(void)
|
||||
{
|
||||
char *str_out;
|
||||
char *str_out2;
|
||||
char *salt;
|
||||
const char *passwd = "Correct Horse Battery Staple";
|
||||
|
||||
salt = (char *) sodium_malloc(crypto_pwhash_argon2id_SALTBYTES);
|
||||
str_out = (char *) sodium_malloc(crypto_pwhash_argon2id_STRBYTES);
|
||||
str_out2 = (char *) sodium_malloc(crypto_pwhash_argon2id_STRBYTES);
|
||||
memcpy(salt, ">A 16-bytes salt", crypto_pwhash_argon2id_SALTBYTES);
|
||||
if (crypto_pwhash_str(str_out, passwd, strlen(passwd), OPSLIMIT,
|
||||
MEMLIMIT) != 0) {
|
||||
printf("pwhash_str failure\n");
|
||||
}
|
||||
if (crypto_pwhash_str(str_out2, passwd, strlen(passwd), OPSLIMIT,
|
||||
MEMLIMIT) != 0) {
|
||||
printf("pwhash_str(2) failure\n");
|
||||
}
|
||||
if (strcmp(str_out, str_out2) == 0) {
|
||||
printf("pwhash_str() doesn't generate different salts\n");
|
||||
}
|
||||
if (crypto_pwhash_str_needs_rehash(str_out, OPSLIMIT, MEMLIMIT) != 0 ||
|
||||
crypto_pwhash_str_needs_rehash(str_out, OPSLIMIT, MEMLIMIT) != 0) {
|
||||
printf("needs_rehash() false positive\n");
|
||||
}
|
||||
if (crypto_pwhash_str_needs_rehash(str_out, OPSLIMIT, MEMLIMIT / 2) != 1 ||
|
||||
crypto_pwhash_str_needs_rehash(str_out, OPSLIMIT - 1, MEMLIMIT) != 1 ||
|
||||
crypto_pwhash_str_needs_rehash(str_out, OPSLIMIT, MEMLIMIT * 2) != 1 ||
|
||||
crypto_pwhash_str_needs_rehash(str_out, OPSLIMIT + 1, MEMLIMIT) != 1) {
|
||||
printf("needs_rehash() false negative (0)\n");
|
||||
}
|
||||
if (crypto_pwhash_argon2id_str_needs_rehash(str_out, OPSLIMIT, MEMLIMIT / 2) != 1 ||
|
||||
crypto_pwhash_argon2id_str_needs_rehash(str_out, OPSLIMIT - 1, MEMLIMIT) != 1 ||
|
||||
crypto_pwhash_argon2id_str_needs_rehash(str_out, OPSLIMIT, MEMLIMIT * 2) != 1 ||
|
||||
crypto_pwhash_argon2id_str_needs_rehash(str_out, OPSLIMIT + 1, MEMLIMIT) != 1) {
|
||||
printf("needs_rehash() false negative (1)\n");
|
||||
}
|
||||
if (crypto_pwhash_argon2i_str_needs_rehash(str_out, OPSLIMIT, MEMLIMIT / 2) != -1 ||
|
||||
crypto_pwhash_argon2i_str_needs_rehash(str_out, OPSLIMIT - 1, MEMLIMIT) != -1 ||
|
||||
crypto_pwhash_argon2i_str_needs_rehash(str_out, OPSLIMIT, MEMLIMIT * 2) != -1 ||
|
||||
crypto_pwhash_argon2i_str_needs_rehash(str_out, OPSLIMIT + 1, MEMLIMIT) != -1) {
|
||||
printf("needs_rehash() false negative (2)\n");
|
||||
}
|
||||
if (crypto_pwhash_str_needs_rehash(str_out, OPSLIMIT, MEMLIMIT / 2) != 1) {
|
||||
printf("pwhash_str_needs_rehash() didn't handle argon2id\n");
|
||||
}
|
||||
if (crypto_pwhash_str_needs_rehash(str_out + 1, OPSLIMIT, MEMLIMIT) != -1 ||
|
||||
crypto_pwhash_argon2id_str_needs_rehash(str_out + 1, OPSLIMIT, MEMLIMIT) != -1) {
|
||||
printf("needs_rehash() didn't fail with an invalid hash string\n");
|
||||
}
|
||||
if (sodium_is_zero((const unsigned char *) str_out + strlen(str_out),
|
||||
crypto_pwhash_STRBYTES - strlen(str_out)) != 1 ||
|
||||
sodium_is_zero((const unsigned char *) str_out2 + strlen(str_out2),
|
||||
crypto_pwhash_STRBYTES - strlen(str_out2)) != 1) {
|
||||
printf("pwhash_argon2id_str() doesn't properly pad with zeros\n");
|
||||
}
|
||||
if (crypto_pwhash_argon2id_str_verify(str_out, passwd, strlen(passwd)) != 0) {
|
||||
printf("pwhash_argon2id_str_verify(1) failure\n");
|
||||
}
|
||||
if (crypto_pwhash_str_verify(str_out, passwd, strlen(passwd)) != 0) {
|
||||
printf("pwhash_str_verify(1') failure\n");
|
||||
}
|
||||
str_out[14]++;
|
||||
if (crypto_pwhash_str_verify(str_out, passwd, strlen(passwd)) != -1) {
|
||||
printf("pwhash_argon2id_str_verify(2) failure\n");
|
||||
}
|
||||
str_out[14]--;
|
||||
assert(str_out[crypto_pwhash_argon2id_STRBYTES - 1U] == 0);
|
||||
|
||||
if (crypto_pwhash_str(str_out2, passwd, 0x100000000ULL, OPSLIMIT,
|
||||
MEMLIMIT) != -1) {
|
||||
printf("pwhash_str() with a large password should have failed\n");
|
||||
}
|
||||
if (crypto_pwhash_str(str_out2, passwd, strlen(passwd), 1, MEMLIMIT) != 0) {
|
||||
printf("pwhash_str() with a small opslimit should not have failed\n");
|
||||
}
|
||||
if (crypto_pwhash_str(str_out2, passwd, strlen(passwd), 0, MEMLIMIT) != -1) {
|
||||
printf("pwhash_argon2id_str() with a null opslimit should have failed\n");
|
||||
}
|
||||
{
|
||||
const char *str_in_ ="$argon2id$m=65536,t=2,p=1c29tZXNhbHQ"
|
||||
"$9sTbSlTio3Biev89thdrlKKiCaYsjjYVJxGAL3swxpQ";
|
||||
char *str_in = (char *) sodium_malloc(strlen(str_in_) + 1U);
|
||||
|
||||
const char *password_in_ = "password";
|
||||
char *password_in = (char *) sodium_malloc(strlen(password_in_) + 1U);
|
||||
|
||||
memcpy(str_in, str_in_, strlen(str_in_) + 1U);
|
||||
memcpy(password_in, password_in_, strlen(password_in_) + 1U);
|
||||
|
||||
if (crypto_pwhash_argon2i_str_verify(str_in, password_in,
|
||||
0x100000000ULL) != -1) {
|
||||
printf("pwhash_str_verify(invalid(0)) failure\n");
|
||||
}
|
||||
|
||||
sodium_free(password_in);
|
||||
sodium_free(str_in);
|
||||
}
|
||||
if (crypto_pwhash_str_verify("$argon2id$m=65536,t=2,p=1c29tZXNhbHQ"
|
||||
"$9sTbSlTio3Biev89thdrlKKiCaYsjjYVJxGAL3swxpQ",
|
||||
"password", strlen("password")) != -1) {
|
||||
printf("pwhash_str_verify(invalid(1)) failure %d\n", errno);
|
||||
}
|
||||
if (crypto_pwhash_str_verify("$argon2id$m=65536,t=2,p=1$c29tZXNhbHQ"
|
||||
"9sTbSlTio3Biev89thdrlKKiCaYsjjYVJxGAL3swxpQ",
|
||||
"password", strlen("password")) != -1) {
|
||||
printf("pwhash_str_verify(invalid(2)) failure\n");
|
||||
}
|
||||
if (crypto_pwhash_str_verify("$argon2id$m=65536,t=2,p=1$c29tZXNhbHQ"
|
||||
"$b2G3seW+uPzerwQQC+/E1K50CLLO7YXy0JRcaTuswRo",
|
||||
"password", strlen("password")) != -1) {
|
||||
printf("pwhash_str_verify(invalid(3)) failure\n");
|
||||
}
|
||||
if (crypto_pwhash_str_verify("$argon2id$v=19$m=65536,t=2,p=1c29tZXNhbHQ"
|
||||
"$wWKIMhR9lyDFvRz9YTZweHKfbftvj+qf+YFY4NeBbtA",
|
||||
"password", strlen("password")) != -1) {
|
||||
printf("pwhash_str_verify(invalid(4)) failure\n");
|
||||
}
|
||||
if (crypto_pwhash_str_verify("$argon2id$v=19$m=65536,t=2,p=1$c29tZXNhbHQ"
|
||||
"wWKIMhR9lyDFvRz9YTZweHKfbftvj+qf+YFY4NeBbtA",
|
||||
"password", strlen("password")) != -1) {
|
||||
printf("pwhash_str_verify(invalid(5)) failure\n");
|
||||
}
|
||||
if (crypto_pwhash_str_verify("$argon2id$v=19$m=65536,t=2,p=1$c29tZXNhbHQ"
|
||||
"$8iIuixkI73Js3G1uMbezQXD0b8LG4SXGsOwoQkdAQIM",
|
||||
"password", strlen("password")) != -1) {
|
||||
printf("pwhash_str_verify(invalid(6)) failure\n");
|
||||
}
|
||||
if (crypto_pwhash_str_verify("$argon2id$v=19$m=256,t=3,p=1$MDEyMzQ1Njc"
|
||||
"$G5ajKFCoUzaXRLdz7UJb5wGkb2Xt+X5/GQjUYtS2+TE",
|
||||
"password", strlen("password")) != 0) {
|
||||
printf("pwhash_str_verify(valid(7)) failure\n");
|
||||
}
|
||||
if (crypto_pwhash_str_verify("$argon2id$v=19$m=256,t=3,p=1$MDEyMzQ1Njc"
|
||||
"$G5ajKFCoUzaXRLdz7UJb5wGkb2Xt+X5/GQjUYtS2+TE",
|
||||
"passwore", strlen("passwore")) != -1 || errno != EINVAL) {
|
||||
printf("pwhash_str_verify(invalid(7)) failure\n");
|
||||
}
|
||||
if (crypto_pwhash_str_verify("$Argon2id$v=19$m=256,t=3,p=1$MDEyMzQ1Njc"
|
||||
"$G5ajKFCoUzaXRLdz7UJb5wGkb2Xt+X5/GQjUYtS2+TE",
|
||||
"password", strlen("password")) != -1 || errno != EINVAL) {
|
||||
printf("pwhash_str_verify(invalid(8)) failure\n");
|
||||
}
|
||||
if (crypto_pwhash_str_verify("$argon2id$v=19$m=256,t=3,p=2$MDEyMzQ1Njc"
|
||||
"$G5ajKFCoUzaXRLdz7UJb5wGkb2Xt+X5/GQjUYtS2+TE",
|
||||
"password", strlen("password")) != -1 || errno != EINVAL) {
|
||||
printf("pwhash_str_verify(invalid(9)) failure\n");
|
||||
}
|
||||
assert(crypto_pwhash_str_alg(str_out, "test", 4, OPSLIMIT, MEMLIMIT,
|
||||
crypto_pwhash_ALG_ARGON2ID13) == 0);
|
||||
assert(crypto_pwhash_argon2id_str_verify(str_out, "test", 4) == 0);
|
||||
assert(crypto_pwhash_argon2id_str_needs_rehash(str_out,
|
||||
OPSLIMIT, MEMLIMIT) == 0);
|
||||
assert(crypto_pwhash_argon2id_str_needs_rehash(str_out,
|
||||
OPSLIMIT / 2, MEMLIMIT) == 1);
|
||||
assert(crypto_pwhash_argon2id_str_needs_rehash(str_out,
|
||||
OPSLIMIT, MEMLIMIT / 2) == 1);
|
||||
assert(crypto_pwhash_argon2id_str_needs_rehash(str_out, 0, 0) == 1);
|
||||
assert(crypto_pwhash_argon2i_str_needs_rehash(str_out, 0, 0) == -1);
|
||||
assert(crypto_pwhash_argon2id_str_needs_rehash(str_out + 1,
|
||||
OPSLIMIT, MEMLIMIT) == -1);
|
||||
assert(crypto_pwhash_argon2i_str_needs_rehash(str_out, 0, 0) == -1);
|
||||
assert(crypto_pwhash_argon2i_str_needs_rehash("", OPSLIMIT, MEMLIMIT) == -1);
|
||||
assert(crypto_pwhash_str_alg(str_out, "test", 4, OPSLIMIT, MEMLIMIT,
|
||||
crypto_pwhash_ALG_ARGON2I13) == 0);
|
||||
assert(crypto_pwhash_argon2i_str_verify(str_out, "test", 4) == 0);
|
||||
assert(crypto_pwhash_argon2i_str_needs_rehash(str_out,
|
||||
OPSLIMIT, MEMLIMIT) == 0);
|
||||
assert(crypto_pwhash_argon2i_str_needs_rehash(str_out,
|
||||
OPSLIMIT / 2, MEMLIMIT) == 1);
|
||||
assert(crypto_pwhash_argon2i_str_needs_rehash(str_out,
|
||||
OPSLIMIT, MEMLIMIT / 2) == 1);
|
||||
assert(crypto_pwhash_argon2i_str_needs_rehash(str_out, 0, 0) == 1);
|
||||
assert(crypto_pwhash_argon2id_str_needs_rehash(str_out, 0, 0) == -1);
|
||||
assert(crypto_pwhash_argon2i_str_needs_rehash("", OPSLIMIT, MEMLIMIT) == -1);
|
||||
assert(crypto_pwhash_argon2i_str_needs_rehash(str_out + 1,
|
||||
OPSLIMIT, MEMLIMIT) == -1);
|
||||
sodium_free(salt);
|
||||
sodium_free(str_out);
|
||||
sodium_free(str_out2);
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
tv();
|
||||
tv2();
|
||||
tv3();
|
||||
str_tests();
|
||||
|
||||
assert(crypto_pwhash_bytes_min() > 0U);
|
||||
assert(crypto_pwhash_bytes_max() > crypto_pwhash_bytes_min());
|
||||
assert(crypto_pwhash_passwd_max() > crypto_pwhash_passwd_min());
|
||||
assert(crypto_pwhash_saltbytes() > 0U);
|
||||
assert(crypto_pwhash_strbytes() > 1U);
|
||||
assert(crypto_pwhash_strbytes() > strlen(crypto_pwhash_strprefix()));
|
||||
|
||||
assert(crypto_pwhash_opslimit_min() > 0U);
|
||||
assert(crypto_pwhash_opslimit_max() > 0U);
|
||||
assert(crypto_pwhash_memlimit_min() > 0U);
|
||||
assert(crypto_pwhash_memlimit_max() > 0U);
|
||||
assert(crypto_pwhash_opslimit_interactive() > 0U);
|
||||
assert(crypto_pwhash_memlimit_interactive() > 0U);
|
||||
assert(crypto_pwhash_opslimit_moderate() > 0U);
|
||||
assert(crypto_pwhash_memlimit_moderate() > 0U);
|
||||
assert(crypto_pwhash_opslimit_sensitive() > 0U);
|
||||
assert(crypto_pwhash_memlimit_sensitive() > 0U);
|
||||
assert(strcmp(crypto_pwhash_primitive(), "argon2i") == 0);
|
||||
|
||||
assert(crypto_pwhash_bytes_min() == crypto_pwhash_BYTES_MIN);
|
||||
assert(crypto_pwhash_bytes_max() == crypto_pwhash_BYTES_MAX);
|
||||
assert(crypto_pwhash_passwd_min() == crypto_pwhash_PASSWD_MIN);
|
||||
assert(crypto_pwhash_passwd_max() == crypto_pwhash_PASSWD_MAX);
|
||||
assert(crypto_pwhash_saltbytes() == crypto_pwhash_SALTBYTES);
|
||||
assert(crypto_pwhash_strbytes() == crypto_pwhash_STRBYTES);
|
||||
|
||||
assert(crypto_pwhash_opslimit_min() == crypto_pwhash_OPSLIMIT_MIN);
|
||||
assert(crypto_pwhash_opslimit_max() == crypto_pwhash_OPSLIMIT_MAX);
|
||||
assert(crypto_pwhash_memlimit_min() == crypto_pwhash_MEMLIMIT_MIN);
|
||||
assert(crypto_pwhash_memlimit_max() == crypto_pwhash_MEMLIMIT_MAX);
|
||||
assert(crypto_pwhash_opslimit_interactive() ==
|
||||
crypto_pwhash_OPSLIMIT_INTERACTIVE);
|
||||
assert(crypto_pwhash_memlimit_interactive() ==
|
||||
crypto_pwhash_MEMLIMIT_INTERACTIVE);
|
||||
assert(crypto_pwhash_opslimit_moderate() ==
|
||||
crypto_pwhash_OPSLIMIT_MODERATE);
|
||||
assert(crypto_pwhash_memlimit_moderate() ==
|
||||
crypto_pwhash_MEMLIMIT_MODERATE);
|
||||
assert(crypto_pwhash_opslimit_sensitive() ==
|
||||
crypto_pwhash_OPSLIMIT_SENSITIVE);
|
||||
assert(crypto_pwhash_memlimit_sensitive() ==
|
||||
crypto_pwhash_MEMLIMIT_SENSITIVE);
|
||||
|
||||
assert(crypto_pwhash_argon2id_bytes_min() == crypto_pwhash_bytes_min());
|
||||
assert(crypto_pwhash_argon2id_bytes_max() == crypto_pwhash_bytes_max());
|
||||
assert(crypto_pwhash_argon2id_passwd_min() == crypto_pwhash_passwd_min());
|
||||
assert(crypto_pwhash_argon2id_passwd_max() == crypto_pwhash_passwd_max());
|
||||
assert(crypto_pwhash_argon2id_saltbytes() == crypto_pwhash_saltbytes());
|
||||
assert(crypto_pwhash_argon2id_strbytes() == crypto_pwhash_strbytes());
|
||||
assert(strcmp(crypto_pwhash_argon2id_strprefix(),
|
||||
crypto_pwhash_strprefix()) == 0);
|
||||
assert(crypto_pwhash_argon2id_opslimit_min() ==
|
||||
crypto_pwhash_opslimit_min());
|
||||
assert(crypto_pwhash_argon2id_opslimit_max() ==
|
||||
crypto_pwhash_opslimit_max());
|
||||
assert(crypto_pwhash_argon2id_memlimit_min() ==
|
||||
crypto_pwhash_memlimit_min());
|
||||
assert(crypto_pwhash_argon2id_memlimit_max() ==
|
||||
crypto_pwhash_memlimit_max());
|
||||
assert(crypto_pwhash_argon2id_opslimit_interactive() ==
|
||||
crypto_pwhash_opslimit_interactive());
|
||||
assert(crypto_pwhash_argon2id_opslimit_moderate() ==
|
||||
crypto_pwhash_opslimit_moderate());
|
||||
assert(crypto_pwhash_argon2id_opslimit_sensitive() ==
|
||||
crypto_pwhash_opslimit_sensitive());
|
||||
assert(crypto_pwhash_argon2id_memlimit_interactive() ==
|
||||
crypto_pwhash_memlimit_interactive());
|
||||
assert(crypto_pwhash_argon2id_memlimit_moderate() ==
|
||||
crypto_pwhash_memlimit_moderate());
|
||||
assert(crypto_pwhash_argon2id_memlimit_sensitive() ==
|
||||
crypto_pwhash_memlimit_sensitive());
|
||||
assert(crypto_pwhash_alg_argon2id13() ==
|
||||
crypto_pwhash_argon2id_alg_argon2id13());
|
||||
assert(crypto_pwhash_alg_argon2i13() == crypto_pwhash_ALG_ARGON2I13);
|
||||
assert(crypto_pwhash_alg_argon2i13() != crypto_pwhash_alg_default());
|
||||
assert(crypto_pwhash_alg_argon2id13() == crypto_pwhash_ALG_ARGON2ID13);
|
||||
assert(crypto_pwhash_alg_argon2id13() != crypto_pwhash_alg_argon2i13());
|
||||
assert(crypto_pwhash_alg_argon2id13() == crypto_pwhash_alg_default());
|
||||
|
||||
assert(crypto_pwhash_argon2id(guard_page, 0, (const char *) guard_page, 0, guard_page,
|
||||
crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE,
|
||||
crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE,
|
||||
0) == -1);
|
||||
assert(crypto_pwhash_argon2id(guard_page, 0, (const char *) guard_page, 0, guard_page,
|
||||
crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE,
|
||||
crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE,
|
||||
crypto_pwhash_ALG_ARGON2I13) == -1);
|
||||
assert(crypto_pwhash_argon2i(guard_page, 0, (const char *) guard_page, 0, guard_page,
|
||||
crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE,
|
||||
crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE,
|
||||
0) == -1);
|
||||
assert(crypto_pwhash_argon2i(guard_page, 0, (const char *) guard_page, 0, guard_page,
|
||||
crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE,
|
||||
crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE,
|
||||
crypto_pwhash_ALG_ARGON2ID13) == -1);
|
||||
|
||||
printf("OK\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
18acec5d6507739f203d1f5d9f1d862f7c2cdac4f19d2bdff64487e60d969e3ced615337b9eec6ac4461c6ca07f0939741e57c24d0005c7ea171a0ee1e7348249d135b38f222e4dad7b9a033ed83f5ca27277393e316582033c74affe2566a2bea47f91f0fd9fe49ece7e1f79f3ad6e9b23e0277c8ecc4b313225748dd2a80f5679534a0700e246a79a49b3f74eb89ec6205fe1eeb941c73b1fcf1
|
||||
26bab5f101560e48c711da4f05e81f5a3802b7a93d5155b9cab153069cc42b8e9f910bfead747652a0708d70e4de0bada37218bd203a1201c36b42f9a269b675b1f30cfc36f35a3030e9c7f57dfba0d341a974c1886f708c3e8297efbfe411bb9d51375264bd7c70d57a8a56fc9de2c1c97c08776803ec2cd0140bba8e61dc0f4ad3d3d1a89b4b710af81bfe35a0eea193e18a6da0f5ec05542c9eefc4584458e1da715611ba09617384748bd43b9bf1f3a6df4ecd091d0875e08d6e2fd8a5c7ce08904b5160cd38167b76ec76ef2d310049055a564da23d4ebd2b87e421cc33c401e12d5cd8d936c9baf75ebdfb557d342d2858fc781da31860
|
||||
6eb45e668582d63788ca8f6e930ca60b045a795fca987344f9a7a135aa3b5132b50a34a3864c26581f1f56dd0bcbfafbfa92cd9bff6b24a734cfe88f854aef4bda0a7983120f44936e8ff31d29728ac08ccce6f3f916b3c63962755c23a1fa9bb4e8823fc867bfd18f28980d94bc5874423ab7f96cc0ab78d8fa21fbd00cd3a1d96a73fa439ccc3fc4eab1590677b06cc78b0f674dfb680f23022fb902022dd8620803229c6ddf79a8156ccfce48bbd76c05ab670634f206e5b2e896230baa74a856964dbd8511acb71d75a1506766a125d8ce037f1db72086ebc3bccaefbd8cd9380167c2530386544ebfbeadbe237784d102bb92a10fd242
|
||||
[tv] pwhash failure (maybe intentional): [3]
|
||||
08d8cd330c57e1b4643241d05bb468ba4ee4e932cd0858816be9ef15360b27bbd06a87130ee92222be267a29b81f5ae8fe8613324cfc4832dc49387fd0602f1c57b4d0f3855db94fb7e12eb05f9a484aed4a4307abf586cd3d55c809bc081541e00b682772fb2066504ff935b8ebc551a2083882f874bc0fae68e56848ae34c91097c3bf0cca8e75c0797eef3efde3f75e005815018db3cf7c109a812264c4de69dcb22322dbbcfa447f5b00ecd1b04a7be1569c8e556adb7bba48adf81d
|
||||
d6e9d6cabd42fb9ba7162fe9b8e41d59d3c7034756cb460c9affe393308bd0225ce0371f2e6c3ca32aca2002bf2d3909c6b6e7dfc4a00e850ff4f570f8f749d4bb6f0091e554be67a9095ae1eefaa1a933316cbec3c2fd4a14a5b6941bda9b7eabd821d79abde2475a53af1a8571c7ee46460be415882e0b393f48c12f740a6a72cba9773000602e13b40d3dfa6ac1d4ec43a838b7e3e165fecad4b2498389e60a3ff9f0f8f4b9fca1126e64f49501e38690
|
||||
7fb72409b0987f8190c3729710e98c3f80c5a8727d425fdcde7f3644d467fe973f5b5fee683bd3fce812cb9ae5e9921a2d06c2f1905e4e839692f2b934b682f11a2fe2b90482ea5dd234863516dba6f52dc0702d324ec77d860c2e181f84472bd7104fedce071ffa93c5309494ad51623d214447a7b2b1462dc7d5d55a1f6fd5b54ce024118d86f0c6489d16545aaa87b6689dad9f2fb47fda9894f8e12b87d978b483ccd4cc5fd9595cdc7a818452f915ce2f7df95ec12b1c72e3788d473441d884f9748eb14703c21b45d82fd667b85f5b2d98c13303b3fe76285531a826b6fc0fe8e3dddecf
|
||||
4e702bc5f891df884c6ddaa243aa846ce3c087fe930fef0f36b3c2be34164ccc295db509254743f18f947159c813bcd5dd8d94a3aec93bbe57605d1fad1aef1112687c3d4ef1cb329d21f1632f626818d766915d886e8d819e4b0b9c9307f4b6afc081e13b0cf31db382ff1bf05a16aac7af696336d75e99f82163e0f371e1d25c4add808e215697ad3f779a51a462f8bf52610af21fc69dba6b072606f2dabca7d4ae1d91d919
|
||||
20e7ba6faa2c0a4b07f3ff38e15e252a069c2c62bac3f2785d311764d73e67fd713be342ee938e6df4de6af1a89a44b8589838864457bcfe3cf0f2d329b800ab9f5810b6325588eb4e0c56f99192b2cc76dc8194dc1097fe5ed12ac4214481c03c3597131ba164a56e7187e2da565a8cd529668e9a37faa58a1701c49a14edf7a50dec4143b456cba6d14c957bb655e99ce96bc506961216ef887a
|
||||
8fb6ed1862cdd2a399e10956c60dc9b2670338ea59c3414d0443216925ba24c6e89a17f3e56c12893dcbc9bc498e8308aea9627d9c9e47912d6342b631008719edfa2db364b97e60cf47a97ad9aa3b7f139d80ddda44f1ef2af881ce027a15644218cac6cc74751469ae56be0469fbc760825882b3e8abca55daaae5753575106cf867cd69932602c63ec880ad8811d9aa4870a9e0b39fef47c92e
|
||||
[tv3] pwhash_argon2id_str failure (maybe intentional): [0]
|
||||
[tv3] pwhash_argon2id_str failure (maybe intentional): [1]
|
||||
[tv3] pwhash_argon2id_str failure (maybe intentional): [3]
|
||||
OK
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user