| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
#pragma once |
| 17 |
|
| 18 |
#include <cbmc_proof/cbmc_utils.h> |
| 19 |
|
| 20 |
#include "api/s2n.h" |
| 21 |
#include "crypto/s2n_certificate.h" |
| 22 |
#include "crypto/s2n_dhe.h" |
| 23 |
#include "crypto/s2n_evp.h" |
| 24 |
#include "crypto/s2n_hash.h" |
| 25 |
#include "crypto/s2n_hmac.h" |
| 26 |
#include "crypto/s2n_libcrypto.h" |
| 27 |
#include "stuffer/s2n_stuffer.h" |
| 28 |
#include "tls/s2n_config.h" |
| 29 |
#include "tls/s2n_connection.h" |
| 30 |
#include "tls/s2n_security_policies.h" |
| 31 |
#include "utils/s2n_array.h" |
| 32 |
#include "utils/s2n_blob.h" |
| 33 |
#include "utils/s2n_map_internal.h" |
| 34 |
#include "utils/s2n_safety_macros.h" |
| 35 |
#include "utils/s2n_socket.h" |
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
bool s2n_blob_is_bounded(const struct s2n_blob *blob, const size_t max_size); |
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
bool s2n_stuffer_is_bounded(const struct s2n_stuffer *stuffer, const size_t max_size); |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
void cbmc_populate_s2n_blob(struct s2n_blob *blob); |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
struct s2n_blob *cbmc_allocate_s2n_blob(); |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
void cbmc_populate_s2n_stuffer(struct s2n_stuffer *stuffer); |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
struct s2n_stuffer *cbmc_allocate_s2n_stuffer(); |
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
const char *ensure_c_str_is_allocated(size_t max_size); |
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
const char *nondet_c_str_is_allocated(size_t max_size); |
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
void cbmc_populate_s2n_stuffer_reservation(struct s2n_stuffer_reservation *reservation); |
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
struct s2n_stuffer_reservation *cbmc_allocate_s2n_stuffer_reservation(); |
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
bool s2n_array_is_bounded(const struct s2n_array *array, const size_t max_len, const size_t max_element_size); |
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
void cbmc_populate_s2n_array(struct s2n_array *array); |
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
struct s2n_array *cbmc_allocate_s2n_array(); |
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
void cbmc_populate_s2n_dh_params(struct s2n_dh_params *s2n_dh_params); |
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
struct s2n_dh_params *cbmc_allocate_dh_params(); |
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
void cbmc_populate_BIGNUM(BIGNUM *bignum); |
| 118 |
|
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
BIGNUM *cbmc_allocate_BIGNUM(); |
| 123 |
|
| 124 |
|
| 125 |
|
| 126 |
|
| 127 |
void cbmc_populate_EC_GROUP(EC_GROUP *ec_group); |
| 128 |
|
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
EC_GROUP *cbmc_allocate_EC_GROUP(); |
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
void cbmc_populate_EC_KEY(EC_KEY *ec_key); |
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
EC_KEY *cbmc_allocate_EC_KEY(); |
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
void cbmc_populate_EVP_PKEY(EVP_PKEY *evp_pkey); |
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
EVP_PKEY *cbmc_allocate_EVP_PKEY(); |
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
void cbmc_populate_EVP_PKEY_CTX(EVP_PKEY_CTX *evp_pkey_ctx); |
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
EVP_PKEY_CTX *cbmc_allocate_EVP_PKEY_CTX(); |
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
void cbmc_populate_EVP_MD_CTX(EVP_MD_CTX *ctx); |
| 168 |
|
| 169 |
|
| 170 |
|
| 171 |
|
| 172 |
EVP_MD_CTX* cbmc_allocate_EVP_MD_CTX(); |
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
void cbmc_populate_s2n_evp_digest(struct s2n_evp_digest *evp_digest); |
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
|
| 182 |
struct s2n_evp_digest* cbmc_allocate_s2n_evp_digest(); |
| 183 |
|
| 184 |
|
| 185 |
|
| 186 |
|
| 187 |
void cbmc_populate_s2n_hash_state(struct s2n_hash_state *state); |
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
struct s2n_hash_state *cbmc_allocate_s2n_hash_state(); |
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
void cbmc_populate_s2n_hmac_state(struct s2n_hmac_state *state); |
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
struct s2n_hmac_state* cbmc_allocate_s2n_hmac_state(); |
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
void cbmc_populate_s2n_hmac_evp_backup(struct s2n_hmac_evp_backup *backup); |
| 208 |
|
| 209 |
|
| 210 |
|
| 211 |
|
| 212 |
struct s2n_hmac_evp_backup* cbmc_allocate_s2n_hmac_evp_backup(); |
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
void cbmc_populate_s2n_map(struct s2n_map *s2n_map); |
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
struct s2n_map *cbmc_allocate_s2n_map(); |
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
struct s2n_cipher_preferences *cbmc_allocate_s2n_cipher_preferences(); |
| 228 |
|
| 229 |
|
| 230 |
|
| 231 |
|
| 232 |
struct s2n_kem_preferences *cbmc_allocate_s2n_kem_preferences(); |
| 233 |
|
| 234 |
|
| 235 |
|
| 236 |
|
| 237 |
struct s2n_signature_preferences *cbmc_allocate_s2n_signature_preferences(); |
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
struct s2n_ecc_preferences *cbmc_allocate_s2n_ecc_preferences(); |
| 243 |
|
| 244 |
|
| 245 |
|
| 246 |
|
| 247 |
struct s2n_security_policy *cbmc_allocate_s2n_security_policy(); |
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
X509_STORE *cbmc_allocate_X509_STORE(); |
| 253 |
|
| 254 |
|
| 255 |
|
| 256 |
|
| 257 |
void cbmc_populate_s2n_x509_trust_store(struct s2n_x509_trust_store *s2n_x509_trust_store); |
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
|
| 262 |
struct s2n_config *cbmc_allocate_s2n_config(); |
| 263 |
|
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
void cbmc_populate_s2n_pkey(struct s2n_pkey *s2n_pkey); |
| 268 |
|
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
struct s2n_pkey *cbmc_allocate_s2n_pkey(); |
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
void cbmc_populate_s2n_ecc_evp_params(struct s2n_ecc_evp_params *s2n_ecc_evp_params); |
| 278 |
|
| 279 |
|
| 280 |
|
| 281 |
|
| 282 |
struct s2n_ecc_named_curve *cbmc_allocate_s2n_ecc_named_curve(); |
| 283 |
|
| 284 |
|
| 285 |
|
| 286 |
|
| 287 |
struct s2n_kem *cbmc_allocate_s2n_kem(); |
| 288 |
|
| 289 |
|
| 290 |
|
| 291 |
|
| 292 |
struct s2n_kem_group *cbmc_allocate_s2n_kem_group(); |
| 293 |
|
| 294 |
|
| 295 |
|
| 296 |
|
| 297 |
void cbmc_populate_s2n_kem_params(struct s2n_kem_params *s2n_kem_params); |
| 298 |
|
| 299 |
|
| 300 |
|
| 301 |
|
| 302 |
void cbmc_populate_s2n_kem_group_params(struct s2n_kem_group_params *s2n_kem_group_params); |
| 303 |
|
| 304 |
|
| 305 |
|
| 306 |
|
| 307 |
struct s2n_kem_group_params *cbmc_allocate_s2n_kem_group_params(); |
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
|
| 312 |
void cbmc_populate_s2n_signature_scheme(struct s2n_signature_scheme *s2n_signature_scheme); |
| 313 |
|
| 314 |
|
| 315 |
|
| 316 |
|
| 317 |
struct s2n_kex *cbmc_allocate_s2n_kex(); |
| 318 |
|
| 319 |
|
| 320 |
|
| 321 |
|
| 322 |
struct s2n_cipher *cbmc_allocate_s2n_cipher(); |
| 323 |
|
| 324 |
|
| 325 |
|
| 326 |
|
| 327 |
struct s2n_record_algorithm *cbmc_allocate_s2n_record_algorithm(); |
| 328 |
|
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
struct s2n_cipher_suite *cbmc_allocate_s2n_cipher_suite(); |
| 333 |
|
| 334 |
|
| 335 |
|
| 336 |
|
| 337 |
void cbmc_populate_s2n_session_key(struct s2n_session_key *s2n_session_key); |
| 338 |
|
| 339 |
|
| 340 |
|
| 341 |
|
| 342 |
void cbmc_populate_s2n_crypto_parameters(struct s2n_crypto_parameters *s2n_crypto_parameters); |
| 343 |
|
| 344 |
|
| 345 |
|
| 346 |
|
| 347 |
struct s2n_crypto_parameters *cbmc_allocate_s2n_crypto_parameters(); |
| 348 |
|
| 349 |
|
| 350 |
|
| 351 |
|
| 352 |
void cbmc_populate_s2n_cert(struct s2n_cert *s2n_cert); |
| 353 |
|
| 354 |
|
| 355 |
|
| 356 |
|
| 357 |
struct s2n_cert *cbmc_allocate_s2n_cert(); |
| 358 |
|
| 359 |
|
| 360 |
|
| 361 |
|
| 362 |
void cbmc_populate_s2n_cert_chain(struct s2n_cert_chain *s2n_cert_chain); |
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
struct s2n_cert_chain *cbmc_allocate_s2n_cert_chain(); |
| 368 |
|
| 369 |
|
| 370 |
|
| 371 |
|
| 372 |
void cbmc_populate_s2n_cert_chain_and_key(struct s2n_cert_chain_and_key *s2n_cert_chain_and_key); |
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
|
| 377 |
void cbmc_populate_s2n_handshake_parameters(struct s2n_handshake_parameters *s2n_handshake_parameters); |
| 378 |
|
| 379 |
|
| 380 |
|
| 381 |
|
| 382 |
void cbmc_populate_s2n_early_data_config(struct s2n_early_data_config *s2n_early_data_config); |
| 383 |
|
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
void cbmc_populate_s2n_psk(struct s2n_psk *s2n_psk); |
| 388 |
|
| 389 |
|
| 390 |
|
| 391 |
|
| 392 |
struct s2n_psk *cbmc_allocate_s2n_psk(); |
| 393 |
|
| 394 |
|
| 395 |
|
| 396 |
|
| 397 |
void cbmc_populate_s2n_psk_parameters(struct s2n_psk_parameters *s2n_psk_parameters); |
| 398 |
|
| 399 |
|
| 400 |
|
| 401 |
|
| 402 |
void cbmc_populate_s2n_prf_working_space(struct s2n_prf_working_space *s2n_prf_working_space); |
| 403 |
|
| 404 |
|
| 405 |
|
| 406 |
|
| 407 |
void cbmc_populate_s2n_handshake(struct s2n_handshake *s2n_handshake); |
| 408 |
|
| 409 |
|
| 410 |
|
| 411 |
|
| 412 |
void cbmc_populate_s2n_client_hello(struct s2n_client_hello *s2n_client_hello); |
| 413 |
|
| 414 |
|
| 415 |
|
| 416 |
|
| 417 |
void cbmc_populate_s2n_x509_validator(struct s2n_x509_validator *s2n_x509_validator); |
| 418 |
|
| 419 |
|
| 420 |
|
| 421 |
|
| 422 |
void cbmc_populate_s2n_ticket_fields(struct s2n_ticket_fields *s2n_ticket_fields); |
| 423 |
|
| 424 |
|
| 425 |
|
| 426 |
|
| 427 |
void cbmc_populate_s2n_connection(struct s2n_connection *s2n_connection); |
| 428 |
|
| 429 |
|
| 430 |
|
| 431 |
|
| 432 |
struct s2n_connection *cbmc_allocate_s2n_connection(); |
| 433 |
|
| 434 |
struct s2n_socket_read_io_context *cbmc_allocate_s2n_socket_read_io_context(); |
| 435 |
|
| 436 |
struct s2n_socket_write_io_context *cbmc_allocate_s2n_socket_write_io_context(); |