Debian Codegraph @

crt/s2n/tests/cbmc/proofs/s2n_socket_write/s2n_socket_write_harness.c

raw symbols SCIP
1 /* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. */
2 /* SPDX-License-Identifier: Apache-2.0 */
3
4 /**
5 * @file s2n_socket_write_harness.c
6 * @brief Implements the proof harness for s2n_socket_write function.
7 */
8
9 #include <utils/s2n_socket.h>
10 #include <cbmc_proof/make_common_datastructures.h>
11
12 #include <assert.h>
13
14 void s2n_socket_write_harness()
15 {
16 /* Non-deterministic inputs. */
17 void *io_context = cbmc_allocate_s2n_socket_write_io_context();
18 const uint8_t *buf = malloc(sizeof(*buf));
19 uint32_t len;
20 if (io_context != NULL) {
21 ((struct s2n_socket_write_io_context*) io_context)->fd;
22 }
23
24 /* Operation under verification. */
25 int result = s2n_socket_write(io_context, buf, len);
26
27 /* Post-condition. */
28 assert(S2N_IMPLIES(result == S2N_SUCCESS, io_context != NULL));
29 assert(S2N_IMPLIES(io_context == NULL, result != S2N_SUCCESS));
30 }