-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update harness for aws_cryptosdk_enc_ctx_clone #611
Changes from 8 commits
7707cba
4b96898
cf4e7d8
90c4f6a
f03a664
57e7799
575610f
e32a09e
d8c5b1c
d169da6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,19 +20,24 @@ | |
#include <proof_helpers/proof_allocators.h> | ||
#include <proof_helpers/utils.h> | ||
|
||
void make_hash_table_with_no_backing_store(struct aws_hash_table *map, size_t max_table_entries); | ||
|
||
/** | ||
* The actual proof | ||
*/ | ||
void aws_cryptosdk_enc_ctx_clone_harness() { | ||
/* Nondet Input */ | ||
struct aws_hash_table dest; | ||
make_hash_table_with_no_backing_store(&dest, MAX_NUM_ELEMS); | ||
struct aws_hash_table src; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated! |
||
|
||
/* Assumptions */ | ||
ensure_allocated_hash_table(&dest, MAX_TABLE_SIZE); | ||
__CPROVER_assume(dest.p_impl != NULL); | ||
__CPROVER_assume(dest.p_impl->entry_count <= MAX_TABLE_SIZE); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is there no There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nope, I couldn't find anything ensuring this condition which is needed for the loop unwinding. I also haven't come across another proof needing this condition which is why I didn't make an auxiliary function for it. |
||
__CPROVER_assume(aws_hash_table_is_valid(&dest)); | ||
ensure_hash_table_has_valid_destroy_functions(&dest); | ||
|
||
struct aws_hash_table src; | ||
make_hash_table_with_no_backing_store(&src, MAX_NUM_ELEMS); | ||
ensure_allocated_hash_table(&src, MAX_TABLE_SIZE); | ||
__CPROVER_assume(src.p_impl != NULL); | ||
__CPROVER_assume(src.p_impl->entry_count <= MAX_TABLE_SIZE); | ||
__CPROVER_assume(aws_hash_table_is_valid(&src)); | ||
ensure_hash_table_has_valid_destroy_functions(&src); | ||
|
||
/* Operation under verification */ | ||
int rval = aws_cryptosdk_enc_ctx_clone(can_fail_allocator(), &dest, &src); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this changes the time? Why was this necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before, there was both a MAX_NUM_ELEMS and a MAX_TABLE_SIZE, so I just stuck with MAX_TABLE_SIZE (which was always 2). I've just run it locally, and setting MAX_TABLE_SIZE to 4 is fine. The proof isn't horribly slow so 4 would be fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the time comment still correct?