/* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. */
/* SPDX-License-Identifier: Apache-2.0 */

/**
 * @file s2n_socket_write_harness.c
 * @brief Implements the proof harness for s2n_socket_write function.
 */

#include <utils/s2n_socket.h>
#include <cbmc_proof/make_common_datastructures.h>

void s2n_socket_write_harness()
{
  /* Non-deterministic inputs. */
  void *io_context = cbmc_allocate_s2n_socket_write_io_context();
  const uint8_t *buf = malloc(sizeof(*buf));
  uint32_t len;
  if (io_context != NULL) {
      ((struct s2n_socket_write_io_context*) io_context)->fd;
  }
  
  /* Operation under verification. */
  int result = s2n_socket_write(io_context, buf, len);

  /* Post-condition. */
  assert(S2N_IMPLIES(result == S2N_SUCCESS, io_context != NULL));
  assert(S2N_IMPLIES(io_context == NULL, result != S2N_SUCCESS));
}
