Debian Codegraph @

crt/s2n/tests/cbmc/proofs/s2n_socket_read/s2n_socket_read_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_read_harness.c
6 * @brief Implements the proof harness for s2n_socket_read 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_read_harness()
15 {
16 /* Non-deterministic inputs. */
17 void *io_context = cbmc_allocate_s2n_socket_read_io_context();
18 const uint8_t *buf = malloc(sizeof(*buf));
19 uint32_t len;
20
21 /* Operation under verification. */
22 int result = s2n_socket_read(io_context, buf, len);
23
24 /* Post-condition. */
25 assert(S2N_IMPLIES(result >= 0, io_context != NULL));
26 assert(S2N_IMPLIES(io_context == NULL, result != S2N_SUCCESS));
27 }