Skip to content

Commit ecaa4e9

Browse files
committed
fix: type inconsistencies in CBMC proof harnesses
These changes add necessary forward declarations (or system headers includes) and address inconsistencies in how we invoke functions from CBMC proof harnesses as compared to their original signatures.
1 parent 2158a7c commit ecaa4e9

30 files changed

+123
-33
lines changed

verification/cbmc/include/make_common_data_structures.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <aws/cryptosdk/materials.h>
2020
#include <aws/cryptosdk/private/framefmt.h>
2121
#include <aws/cryptosdk/private/header.h>
22+
#include <aws/cryptosdk/private/hkdf.h>
2223
#include <proof_helpers/make_common_data_structures.h>
2324
#include <proof_helpers/proof_allocators.h>
2425
#include <proof_helpers/utils.h>
@@ -114,4 +115,6 @@ struct aws_cryptosdk_enc_request *ensure_enc_request_attempt_allocation(const si
114115
struct aws_cryptosdk_enc_materials *ensure_enc_materials_attempt_allocation();
115116

116117
/* Allocates the members of the default_cmm and ensures that internal pointers are pointing to the correct objects. */
117-
struct aws_cryptosdk_cmm *ensure_default_cmm_attempt_allocation(const struct aws_cryptosdk_keyring_vt *vtable);
118+
struct aws_cryptosdk_cmm *ensure_default_cmm_attempt_allocation(
119+
const struct aws_cryptosdk_cmm_vt *cmm_vtable,
120+
const struct aws_cryptosdk_keyring_vt *vtable);

verification/cbmc/include/openssl/evp.h

+1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ EVP_MD_CTX *EVP_MD_CTX_new(void);
6262
int EVP_MD_CTX_size(const EVP_MD_CTX *ctx);
6363
void EVP_MD_CTX_free(EVP_MD_CTX *ctx);
6464
int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl);
65+
int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type);
6566
int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, size_t cnt);
6667
int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s);
6768
int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s);

verification/cbmc/include/openssl/rand.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
* permissions and limitations under the License.
1515
*/
1616

17-
/* Empty header. Necessary just because it is included in cipher.c */
17+
int RAND_bytes(unsigned char *buf, int num);

verification/cbmc/proofs/aws_cryptosdk_cmm_decrypt_materials/aws_cryptosdk_cmm_decrypt_materials_harness.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ void aws_cryptosdk_cmm_decrypt_materials_harness() {
120120
*/
121121
__CPROVER_assume(aws_cryptosdk_dec_request_is_valid(request));
122122

123-
struct aws_cryptosdk_enc_materials **output = can_fail_malloc(sizeof(*output));
123+
struct aws_cryptosdk_dec_materials **output = can_fail_malloc(sizeof(*output));
124124
__CPROVER_assume(output);
125125

126126
// Run the function under test.

verification/cbmc/proofs/aws_cryptosdk_edk_list_copy_all/aws_cryptosdk_edk_list_copy_all_harness.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818

1919
#include <aws/cryptosdk/edk.h>
20+
#include <aws/cryptosdk/list_utils.h>
2021
#include <make_common_data_structures.h>
2122
#include <proof_helpers/make_common_data_structures.h>
2223
#include <proof_helpers/proof_allocators.h>
@@ -65,14 +66,17 @@ const size_t g_item_size = sizeof(struct aws_cryptosdk_edk);
6566
* These stubs capture the key aspect of checking that the element is allocated.
6667
* It writes/reads a magic constant to ensure that we only ever _clean_up() data that we cloned
6768
*/
68-
int aws_cryptosdk_edk_init_clone(struct aws_allocator *alloc, void *dest, void *src) {
69+
int aws_cryptosdk_edk_init_clone(
70+
struct aws_allocator *alloc,
71+
struct aws_cryptosdk_edk *dest,
72+
const struct aws_cryptosdk_edk *src) {
6973
assert(AWS_MEM_IS_READABLE(src, g_item_size));
7074
uint8_t *d = (uint8_t *)dest;
7175
*d = 0xab;
7276
return nondet_int();
7377
}
7478

75-
void aws_cryptosdk_edk_clean_up(void *p) {
79+
void aws_cryptosdk_edk_clean_up(struct aws_cryptosdk_edk *p) {
7680
uint8_t *d = (uint8_t *)p;
7781
assert(*d == 0xab);
7882
}

verification/cbmc/proofs/aws_cryptosdk_enc_ctx_clear/aws_cryptosdk_enc_ctx_clear_harness.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ void aws_cryptosdk_enc_ctx_clear_harness() {
3131
aws_cryptosdk_enc_ctx_clear(&map);
3232
assert(aws_hash_table_is_valid(&map));
3333
struct hash_table_state *impl = map.p_impl;
34-
assert_all_zeroes(&impl->slots[0], impl->size * sizeof(impl->slots[0]));
34+
assert_all_zeroes((const uint8_t *)&impl->slots[0], impl->size * sizeof(impl->slots[0]));
3535
}

verification/cbmc/proofs/aws_cryptosdk_enc_ctx_deserialize/aws_cryptosdk_enc_ctx_deserialize_harness.c

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <aws/common/hash_table.h>
1717
#include <aws/common/private/hash_table_impl.h>
1818
#include <aws/cryptosdk/enc_ctx.h>
19+
#include <aws/cryptosdk/private/enc_ctx.h>
1920
#include <proof_helpers/make_common_data_structures.h>
2021
#include <proof_helpers/proof_allocators.h>
2122
#include <proof_helpers/utils.h>

verification/cbmc/proofs/aws_cryptosdk_enc_ctx_serialize/aws_cryptosdk_enc_ctx_serialize_harness.c

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <aws/common/hash_table.h>
1717
#include <aws/common/private/hash_table_impl.h>
1818
#include <aws/cryptosdk/enc_ctx.h>
19+
#include <aws/cryptosdk/private/enc_ctx.h>
1920
#include <proof_helpers/make_common_data_structures.h>
2021
#include <proof_helpers/proof_allocators.h>
2122
#include <proof_helpers/utils.h>

verification/cbmc/proofs/aws_cryptosdk_enc_ctx_size/aws_cryptosdk_enc_ctx_size_harness.c

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <aws/common/hash_table.h>
1717
#include <aws/common/private/hash_table_impl.h>
1818
#include <aws/cryptosdk/enc_ctx.h>
19+
#include <aws/cryptosdk/private/enc_ctx.h>
1920
#include <proof_helpers/make_common_data_structures.h>
2021
#include <proof_helpers/proof_allocators.h>
2122
#include <proof_helpers/utils.h>

verification/cbmc/proofs/aws_cryptosdk_enc_materials_new/aws_cryptosdk_enc_materials_new_harness.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void aws_cryptosdk_enc_materials_new_harness() {
3232
__CPROVER_assume(aws_allocator_is_valid(alloc));
3333

3434
/* Operation under verification. */
35-
struct aws_cryptosdk_dec_materials *enc_mat = aws_cryptosdk_enc_materials_new(alloc, alg);
35+
struct aws_cryptosdk_enc_materials *enc_mat = aws_cryptosdk_enc_materials_new(alloc, alg);
3636

3737
/* Post-conditions. */
3838
if (enc_mat != NULL) {

verification/cbmc/proofs/aws_cryptosdk_hkdf/aws_cryptosdk_hkdf_harness.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,17 @@
1515

1616
#include <aws/cryptosdk/cipher.h>
1717
#include <aws/cryptosdk/private/cipher.h>
18+
#include <aws/cryptosdk/private/hkdf.h>
1819

1920
#include <make_common_data_structures.h>
2021

22+
int aws_cryptosdk_hkdf(
23+
struct aws_byte_buf *okm,
24+
enum aws_cryptosdk_sha_version which_sha,
25+
const struct aws_byte_buf *salt,
26+
const struct aws_byte_buf *ikm,
27+
const struct aws_byte_buf *info);
28+
2129
void aws_cryptosdk_hkdf_harness() {
2230
/* arguments */
2331

@@ -58,7 +66,7 @@ void aws_cryptosdk_hkdf_harness() {
5866
struct store_byte_from_buffer old_byte_from_info;
5967
save_byte_from_array(info.buffer, info.len, &old_byte_from_info);
6068

61-
aws_cryptosdk_hkdf(&okm, alg_id, &salt, &ikm, &info);
69+
aws_cryptosdk_hkdf(&okm, which_sha, &salt, &ikm, &info);
6270

6371
/* assertions */
6472
assert(aws_byte_buf_is_valid(&salt));

verification/cbmc/proofs/aws_cryptosdk_keyring_trace_copy_all/aws_cryptosdk_keyring_trace_copy_all_harness.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818

1919
#include <aws/cryptosdk/keyring_trace.h>
20+
#include <aws/cryptosdk/list_utils.h>
2021
#include <make_common_data_structures.h>
2122
#include <proof_helpers/make_common_data_structures.h>
2223
#include <proof_helpers/proof_allocators.h>
@@ -96,14 +97,17 @@ const size_t g_item_size = sizeof(struct aws_cryptosdk_keyring_trace_record);
9697
* These stubs capture the key aspect of checking that the element is allocated.
9798
* It writes/reads a magic constant to ensure that we only ever _clean_up() data that we cloned
9899
*/
99-
int aws_cryptosdk_keyring_trace_record_init_clone(struct aws_allocator *alloc, void *dest, const void *src) {
100+
int aws_cryptosdk_keyring_trace_record_init_clone(
101+
struct aws_allocator *alloc,
102+
struct aws_cryptosdk_keyring_trace_record *dest,
103+
const struct aws_cryptosdk_keyring_trace_record *src) {
100104
assert(AWS_MEM_IS_READABLE(src, g_item_size));
101105
uint8_t *d = (uint8_t *)dest;
102106
*d = 0xab;
103107
return nondet_int();
104108
}
105109

106-
void aws_cryptosdk_keyring_trace_record_clean_up(void *p) {
110+
void aws_cryptosdk_keyring_trace_record_clean_up(struct aws_cryptosdk_keyring_trace_record *p) {
107111
uint8_t *d = (uint8_t *)p;
108112
assert(*d == 0xab);
109113
}

verification/cbmc/proofs/aws_cryptosdk_multi_keyring_add_child/aws_cryptosdk_multi_keyring_add_child_harness.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ void aws_cryptosdk_multi_keyring_add_child_harness() {
3939
* structure must have as base member the static aws_cryptosdk_keyring_vt (vt) defined
4040
* in the multi_keyring.c file.
4141
*/
42-
struct multi_keyring *multi = aws_cryptosdk_multi_keyring_new(alloc, &generator);
42+
struct aws_cryptosdk_keyring *multi = aws_cryptosdk_multi_keyring_new(alloc, &generator);
4343
__CPROVER_assume(aws_cryptosdk_multi_keyring_is_valid(multi));
4444

4545
const struct aws_cryptosdk_keyring_vt vtable_child = { .vt_size = sizeof(struct aws_cryptosdk_keyring_vt),
@@ -52,13 +52,13 @@ void aws_cryptosdk_multi_keyring_add_child_harness() {
5252
__CPROVER_assume(aws_cryptosdk_keyring_is_valid(&child));
5353

5454
/* save current state of the data structure */
55-
struct aws_array_list old = multi->children;
55+
struct aws_array_list old = ((struct multi_keyring *)multi)->children;
5656

5757
/* Operation under verification. */
5858
if (aws_cryptosdk_multi_keyring_add_child(multi, &child) == AWS_OP_SUCCESS) {
59-
assert(multi->children.length == (old.length + 1));
59+
assert(((struct multi_keyring *)multi)->children.length == (old.length + 1));
6060
} else {
61-
assert(multi->children.length == old.length);
61+
assert(((struct multi_keyring *)multi)->children.length == old.length);
6262
}
6363

6464
/* Post-conditions. */

verification/cbmc/proofs/aws_cryptosdk_private_derive_key_v1/aws_cryptosdk_private_derive_key_v1_harness.c

+6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@
1919
#include <make_common_data_structures.h>
2020
#include <utils.h>
2121

22+
int __CPROVER_file_local_cipher_c_aws_cryptosdk_private_derive_key_v1(
23+
const struct aws_cryptosdk_alg_properties *props,
24+
struct content_key *content_key,
25+
const struct data_key *data_key,
26+
const struct aws_byte_buf *message_id);
27+
2228
void aws_cryptosdk_private_derive_key_v1_harness() {
2329
struct aws_cryptosdk_alg_properties *props = ensure_alg_properties_attempt_allocation(MAX_STRING_LEN);
2430
struct content_key *content_key = ensure_content_key_attempt_allocation();

verification/cbmc/proofs/aws_cryptosdk_private_derive_key_v2/aws_cryptosdk_private_derive_key_v2_harness.c

+7
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818
#include <aws/cryptosdk/private/hkdf.h>
1919
#include <make_common_data_structures.h>
2020

21+
int __CPROVER_file_local_cipher_c_aws_cryptosdk_private_derive_key_v2(
22+
const struct aws_cryptosdk_alg_properties *props,
23+
struct content_key *content_key,
24+
const struct data_key *data_key,
25+
struct aws_byte_buf *commitment,
26+
const struct aws_byte_buf *message_id);
27+
2128
void aws_cryptosdk_private_derive_key_v2_harness() {
2229
struct aws_cryptosdk_alg_properties *props = ensure_alg_properties_attempt_allocation(MAX_STRING_LEN);
2330
struct content_key *content_key = ensure_content_key_attempt_allocation();

verification/cbmc/proofs/aws_cryptosdk_transfer_list/aws_cryptosdk_transfer_list_harness.c

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
*/
1818

1919
#include <aws/cryptosdk/edk.h>
20+
#include <aws/cryptosdk/list_utils.h>
2021
#include <proof_helpers/cryptosdk/make_common_data_structures.h>
2122
#include <proof_helpers/make_common_data_structures.h>
2223
#include <proof_helpers/proof_allocators.h>

verification/cbmc/proofs/default_cmm_generate_enc_materials/default_cmm_generate_enc_materials_harness.c

+16-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
#include <aws/cryptosdk/materials.h>
2121
#include <make_common_data_structures.h>
2222

23+
int generate_enc_materials(
24+
struct aws_cryptosdk_cmm *cmm,
25+
struct aws_cryptosdk_enc_materials **output,
26+
struct aws_cryptosdk_enc_request *request);
27+
2328
int on_encrypt(
2429
struct aws_cryptosdk_keyring *keyring,
2530
struct aws_allocator *request_alloc,
@@ -29,14 +34,24 @@ int on_encrypt(
2934
const struct aws_hash_table *enc_ctx,
3035
enum aws_cryptosdk_alg_id alg);
3136

37+
int __CPROVER_file_local_default_cmm_c_default_cmm_generate_enc_materials(
38+
struct aws_cryptosdk_cmm *cmm,
39+
struct aws_cryptosdk_enc_materials **output,
40+
struct aws_cryptosdk_enc_request *request);
41+
3242
void default_cmm_generate_enc_materials_harness() {
43+
const struct aws_cryptosdk_cmm_vt cmm_vtable = { .vt_size = nondet_size_t(),
44+
.name = ensure_c_str_is_allocated(SIZE_MAX),
45+
.destroy = nondet_voidp(),
46+
.generate_enc_materials = nondet_bool() ? NULL : generate_enc_materials,
47+
.decrypt_materials = nondet_voidp() };
3348
const struct aws_cryptosdk_keyring_vt vtable = { .vt_size = nondet_size_t(),
3449
.name = ensure_c_str_is_allocated(SIZE_MAX),
3550
.destroy = nondet_voidp(),
3651
.on_encrypt = nondet_bool() ? NULL : on_encrypt,
3752
.on_decrypt = nondet_voidp() };
3853
/* Nondet input */
39-
struct aws_cryptosdk_cmm *cmm = ensure_default_cmm_attempt_allocation(&vtable);
54+
struct aws_cryptosdk_cmm *cmm = ensure_default_cmm_attempt_allocation(&cmm_vtable, &vtable);
4055
struct aws_cryptosdk_enc_materials *output = ensure_enc_materials_attempt_allocation();
4156
struct aws_cryptosdk_enc_request *request = ensure_enc_request_attempt_allocation(MAX_TABLE_SIZE);
4257

verification/cbmc/proofs/derive_data_key/derive_data_key_harness.c

+4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
#include <aws/cryptosdk/session.h>
2424
#include <make_common_data_structures.h>
2525

26+
int __CPROVER_file_local_session_decrypt_c_derive_data_key(
27+
struct aws_cryptosdk_session *session,
28+
struct aws_cryptosdk_dec_materials *materials);
29+
2630
void derive_data_key_harness() {
2731
/* Setup functions include nondet. allocation and common assumptions */
2832
struct aws_cryptosdk_session *session =

verification/cbmc/proofs/list_copy_all/list_copy_all_harness.c

+7
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ bool aws_array_list_is_valid_deep(const struct aws_array_list *AWS_RESTRICT list
5959
typedef int (*clone_item_fn)(struct aws_allocator *, void *, const void *);
6060
typedef void (*clean_up_item_fn)(void *);
6161

62+
int __CPROVER_file_local_list_utils_c_list_copy_all(
63+
struct aws_allocator *alloc,
64+
struct aws_array_list *dest,
65+
const struct aws_array_list *src,
66+
clone_item_fn cloner,
67+
clean_up_item_fn cleaner);
68+
6269
size_t g_item_size;
6370

6471
/**

verification/cbmc/proofs/sign_header/sign_header_harness.c

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#include <make_common_data_structures.h>
2121
#include <proof_helpers/make_common_data_structures.h>
2222

23+
int __CPROVER_file_local_session_encrypt_c_sign_header(struct aws_cryptosdk_session *session);
24+
2325
/**
2426
* A generator function as described in the comment in aws_cryptosdk_hash_elems_array_init_stub.c.
2527
* Also see DEFINES += -DAWS_CRYPTOSDK_HASH_ELEMS_ARRAY_INIT_GENERATOR=array_list_item_generator

verification/cbmc/sources/make_common_data_structures.c

+10-7
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ struct default_cmm {
3838
struct aws_cryptosdk_keyring *kr;
3939
/* Invariant: this is either DEFAULT_ALG_UNSET or is a valid algorithm ID */
4040
enum aws_cryptosdk_alg_id default_alg;
41+
bool default_alg_is_set;
4142
};
4243

4344
const EVP_MD *nondet_EVP_MD_ptr(void);
@@ -46,10 +47,10 @@ const EVP_CIPHER *nondet_EVP_CIPHER_ptr(void);
4647
struct aws_cryptosdk_alg_impl *ensure_impl_attempt_allocation(const size_t max_len) {
4748
struct aws_cryptosdk_alg_impl *impl = malloc(sizeof(struct aws_cryptosdk_alg_impl));
4849
if (impl) {
49-
*(const EVP_MD **)(&impl->md_ctor) = (nondet_bool()) ? NULL : &nondet_EVP_MD_ptr;
50-
*(const EVP_MD **)(&impl->sig_md_ctor) = (nondet_bool()) ? NULL : &nondet_EVP_MD_ptr;
51-
*(const EVP_CIPHER **)(&impl->cipher_ctor) = (nondet_bool()) ? NULL : &nondet_EVP_CIPHER_ptr;
52-
*(const char **)(&impl->curve_name) = ensure_c_str_is_allocated(max_len);
50+
impl->md_ctor = (nondet_bool()) ? NULL : &nondet_EVP_MD_ptr;
51+
impl->sig_md_ctor = (nondet_bool()) ? NULL : &nondet_EVP_MD_ptr;
52+
impl->cipher_ctor = (nondet_bool()) ? NULL : &nondet_EVP_CIPHER_ptr;
53+
impl->curve_name = ensure_c_str_is_allocated(max_len);
5354
}
5455
return impl;
5556
}
@@ -398,14 +399,16 @@ struct aws_cryptosdk_enc_materials *ensure_enc_materials_attempt_allocation() {
398399
if (materials) {
399400
materials->alloc = nondet_bool() ? NULL : can_fail_allocator();
400401
materials->signctx = ensure_nondet_sig_ctx_has_allocated_members();
401-
ensure_byte_buf_has_allocated_buffer_member(&materials->encrypted_data_keys);
402+
ensure_array_list_has_allocated_data_member(&materials->encrypted_data_keys);
402403
ensure_array_list_has_allocated_data_member(&materials->keyring_trace);
403404
ensure_array_list_has_allocated_data_member(&materials->encrypted_data_keys);
404405
}
405406
return materials;
406407
}
407408

408-
struct aws_cryptosdk_cmm *ensure_default_cmm_attempt_allocation(const struct aws_cryptosdk_keyring_vt *vtable) {
409+
struct aws_cryptosdk_cmm *ensure_default_cmm_attempt_allocation(
410+
const struct aws_cryptosdk_cmm_vt *cmm_vtable,
411+
const struct aws_cryptosdk_keyring_vt *vtable) {
409412
/* Nondet input required to init cmm */
410413
struct aws_cryptosdk_keyring *keyring = malloc(sizeof(*keyring));
411414

@@ -416,7 +419,7 @@ struct aws_cryptosdk_cmm *ensure_default_cmm_attempt_allocation(const struct aws
416419

417420
struct aws_cryptosdk_cmm *cmm = malloc(sizeof(struct default_cmm));
418421
if (cmm) {
419-
cmm->vtable = vtable;
422+
cmm->vtable = cmm_vtable;
420423
}
421424

422425
struct default_cmm *self = NULL;

verification/cbmc/sources/openssl/asn1_override.c

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ void ASN1_STRING_clear_free(ASN1_STRING *a) {
3232
free(a);
3333
}
3434

35+
bool asn1_integer_is_valid(ASN1_INTEGER *ai);
36+
3537
/*
3638
* Description: ASN1_INTEGER_to_BN() converts ASN1_INTEGER ai into a BIGNUM. If bn is NULL a new BIGNUM structure is
3739
* returned. If bn is not NULL then the existing structure will be used instead. Return values: ASN1_INTEGER_to_BN() and

verification/cbmc/sources/openssl/bio_override.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@ BIO *BIO_new_mem_buf(const void *buf, signed int len) {
4343
* SubjectPublicKeyInfo structure.
4444
*/
4545
EVP_PKEY *PEM_read_bio_PUBKEY(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u) {
46-
x = EVP_PKEY_new();
47-
return x;
46+
*x = EVP_PKEY_new();
47+
return *x;
4848
}
4949

5050
/*
5151
* Read a private key from a BIO.
5252
*/
5353
EVP_PKEY *PEM_read_bio_PrivateKey(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u) {
54-
x = EVP_PKEY_new();
55-
return x;
54+
*x = EVP_PKEY_new();
55+
return *x;
5656
}
5757

5858
/*

verification/cbmc/sources/openssl/ec_override.c

+4
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ void EC_GROUP_set_point_conversion_form(EC_GROUP *group, point_conversion_form_t
5959
group->asn1_form = form;
6060
}
6161

62+
bool ec_group_is_valid(EC_GROUP *group);
63+
6264
/*
6365
* Return values: EC_GROUP_get0_order() returns an internal pointer to the group order.
6466
*/
@@ -283,6 +285,8 @@ struct ECDSA_SIG_st {
283285
BIGNUM *s;
284286
};
285287

288+
bool ecdsa_sig_is_valid(ECDSA_SIG *sig);
289+
286290
/*
287291
* Description: ECDSA_SIG_get0() returns internal pointers the r and s values contained in sig and stores them in *pr
288292
* and *ps, respectively. The pointer pr or ps can be NULL, in which case the corresponding value is not returned.

0 commit comments

Comments
 (0)