awslabs / awslabs/aws-crypto-tools-test-vector-framework
003 generate script incorrectly calculates expected number of KMS and RSA cases
- Dominant language
- Python
- Stars
- 4
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
During the self-check, the `0003-awses-message-encryption-generate.py` script defines the number of expected KMS and RSA test cases as equal to the number of keys defined times the number of "iterations" (combinations of various other values).
This works as long as each set of keys contains exactly one key that can both encrypt and decrypt and exactly one key that can encrypt but not decrypt.
The current logic for generating the actual test cases[2][3] follow the pattern of:
```
for each encrypt-decrypt key:
add one test case with just this key
for each encrypt-only key:
add one test case with the encrypt-decrypt and and one encrypt-only key
```
If we define:
* `C` is the number of encrypt-decrypt keys
* `B` is the number of encrypt-only keys
* `I` is the number of "iterations"
The previous formula for expected test cases was `(C + B) * I`.
The correct formula is: `(C + (C * B)) * I`.
Whether the aforementioned mechanism for generating tests is the best pattern, now that we are introducing more keys, is a different question.
[1] https://github.com/awslabs/aws-crypto-tools-test-vector-framework/blob/master/features/0003-awses-message-encryption-generate.py#L292
[2] https://github.com/awslabs/aws-crypto-tools-test-vector-framework/blob/master/features/0003-awses-message-encryption-generate.py#L138-L144
[3] https://github.com/awslabs/aws-crypto-tools-test-vector-framework/blob/master/features/0003-awses-message-encryption-generate.py#L182-L193
Contributor guide
Research direction
Open features/0003-awses-message-encryption-generate.py and compare the expected-count logic around line 292 with test-case generation at lines 138-144 and 182-193. Verify the count for C encrypt-decrypt keys, B encrypt-only keys, and I iterations, then run the self-check to confirm the generated cases match the expected total.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100