Debian Codegraph @

crt/s2n/tests/README.md

raw symbols SCIP
1 # s2n-tls testing
2 s2n-tls has a wide variety of tests covering a wide variety of different functionality. This document serves as a "quick reference", providing an overview of all the testing that s2n-tls does and linking to additional documentation.
3
4 ## Unit Tests
5 _Is the internal functionality of s2n-tls correct?_
6
7 These test the correctness of low-level s2n-tls functions. These functions are commonly private. We have unit tests for both the C library and the [rust bindings](../bindings/rust).
8
9 ### Sanitizers
10 The C unit tests are additionally run with the following sanitizers enabled
11 - Valgrind: used to detect memory errors
12 - Address Sanitizer (ASAN): used to detect memory errors
13 - Thread Sanitizer (TSAN): used to detect race conditions
14
15 Further information:
16 - [C tests](unit/)
17 - [Valgrind memcheck documentation](https://valgrind.org/docs/manual/mc-manual.html)
18 - [ASAN documentation](https://clang.llvm.org/docs/AddressSanitizer.html)
19 - [TSAN documentation](https://clang.llvm.org/docs/ThreadSanitizer.html)
20
21 ## Integration Tests
22 _Is the functionality of s2n-tls correct and compatible with other implementations?_
23
24 Our integration tests involve interoperation with other TLS implementations, because testing against another implementation improves confidence that s2n-tls has implemented the feature correctly and is compliant with relevant RFCs.
25
26 s2n-tls integration tests are run using our integrationv2 framework. Tests are implemented using "client" and "server" executables from various implementations like Openssl and Boringssl. The client and server interactions are coordinated with pytest.
27
28 Further information:
29 - [readme](integrationv2/README.md)
30 - [tests](integrationv2/)
31 - [pytest documentation](https://docs.pytest.org/en/stable/)
32
33 ## Fuzz Tests
34 Fuzz Tests provide additional confidence in s2n-tls correctness by testing s2n-tls functionality under a wide variety of inputs.
35
36 s2n-tls fuzz tests use LibFuzzer as the fuzzing engine. Fuzzing is generally only applied to functions that take external input.
37
38 Further information:
39 - [readme](fuzz/Readme.md)
40 - [tests](fuzz/)
41 - [libFuzzer documentation](https://llvm.org/docs/LibFuzzer.html)
42
43 ## Formal Methods
44 s2n-tls includes a variety of formal methods which are used to _prove_ that s2n-tls has certain behaviors.
45
46 ### CBMC
47 > CBMC verifies memory safety (which includes array bounds checks and checks for the safe use of pointers), checks for various further variants of undefined behavior, and user-specified assertions.
48 > [C Bounded Model Checker](https://www.cprover.org/cbmc/)
49
50 s2n-tls writes CBMC proofs for a number of sensitive or commonly used functions in the codebase.
51
52 Further information:
53 - [readme](cbmc/README.md)
54 - [proofs](cbmc/proofs/)
55 - [CBMC project](https://www.cprover.org/cbmc/)
56
57 ### SAW
58 SAW verifies the correctness of code. More specifically, SAW can verify that some LLVM bitcode (compiled from C) matches the behavior of a cryptol specification. s2n-tls includes SAW proofs for its HMAC implementation as well as the TLS handshake state machine.
59
60 Further information:
61 - [readme](saw/README.md)
62 - [proofs](saw/)
63 - [cryptol documentation](http://www.cryptol.net/)
64 - [SAW project](https://saw.galois.com/)
65
66 ### Sidetrail
67 Sidetrail verifies the absence of timing side-channels, and is implemented using the smack toolchain. Our SideTrail proofs cover a number of the record processing functions.
68
69 Further information:
70 - [readme](sidetrail/README.md)
71 - [proofs](sidetrail/working/)
72 - [smack repo](https://github.com/smackers/smack)
73
74 ### ctverif
75 `ctverif` is another tool that verifies the absence of timing side-channels and is also implemented using the smack toolchain. Our ctverif proofs verify that `s2n_constant_time_equals` and `s2n_constant_time_copy_or_dont` are both constant time.
76
77 Further information:
78 - [readme](ctverif/README.md)
79 - [proofs](ctverif/Makefile)
80 - [smack repo](https://github.com/smackers/smack)
81
82 ## Benchmarks
83 s2n-tls maintains a set of Rust criterion benchmarks to assess the performance of s2n-tls. The most commonly used benchmarks cover
84 - performance of handshakes
85 - performance of data transfer (bulk encryption)
86
87 But a number of other low-level benchmarks are also included.
88
89 Further information:
90 - [readme](../bindings/rust/bench/README.md)
91 - [benchmarks](../bindings/rust/bench/benches/)
92 - [criterion book](https://bheisler.github.io/criterion.rs/book/)