Debian Codegraph @

docs/vectors/index.rst

raw
1 Reference vectors
2 =================
3
4 In addition to the policy of keeping any code path in PyNaCl covered by
5 unit tests, the output from cryptographic primitives and constructions
6 must be verified as being conformant to the reference implementations
7 or standards.
8
9 Imported reference vectors
10 --------------------------
11
12 Wherever possible it is the PyNaCl project's policy to use existing
13 reference vectors for primitives or constructions. These vectors should
14 ideally be in their original format, but it is acceptable to make minimal
15 changes to ease parsing at our discretion.
16
17
18 Box construction
19 ^^^^^^^^^^^^^^^^
20
21 The reference vector for testing the :py:class:`nacl.public.Box`
22 implementation come from libsodium's ``test/default/box.c`` and
23 ``test/default/box2.c`` and the corresponding expected outputs
24 in ``test/default/box.exp`` and ``test/default/box2.exp``
25
26 SecretBox construction
27 ^^^^^^^^^^^^^^^^^^^^^^
28
29 The reference vector for testing the :py:class:`nacl.secret.SecretBox`
30 implementation come from libsodium's ``test/default/secretbox.c``
31 and the corresponding expected outputs in ``test/default/secretbox.exp``
32
33 chacha20poly1305
34 ^^^^^^^^^^^^^^^^
35
36 The reference vectors for both the legacy draft-agl-tls-chacha20poly1305
37 and the IETF ratified rfc7539 chacha20poly1305 constructions are taken
38 from libressl version 2.5.5 tests/aeadtests.txt, excluding the shortened
39 authentication tag vectors, since libsodium only supports full sized tags.
40
41 xchacha20poly1305
42 ^^^^^^^^^^^^^^^^^
43
44 The reference vector for the xchacha20poly1305 construction is taken
45 from the first test in libsodium's test/default/aead_xchacha20poly1305.c,
46 which defines the parameters, and the corresponding expected output from
47 aead_xchacha20poly1305.exp.
48
49 siphash24 and siphashx24
50 ^^^^^^^^^^^^^^^^^^^^^^^^
51
52 The reference vectors for both the original and the 128 bit variants of
53 the siphash-2-4 construction are taken from the reference code sources.
54 In particular, the original expected results come from siphash's vectors.h,
55 while the key and the input messages have been generated following
56 the respective definitions in siphash's test.c.
57
58 Custom generated reference vectors
59 ----------------------------------
60
61 In cases where there are no standardized test vectors, or the available ones
62 are not applicable to libsodium's implementation, test vectors are custom
63 generated.
64
65
66 .. toctree::
67 :glob:
68
69 *_vectors
70 bundled_library_build