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
Evp parser tweak #3506
Evp parser tweak #3506
Conversation
test/evpdigest.txt
Outdated
@@ -90,7 +91,8 @@ Digest = BLAKE2b512 | |||
Input = 000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F8081 | |||
Output = DF0A9D0C212843A6A934E3902B2DD30D17FBA5F969D2030B12A546D8A6A45E80CF5635F071F0452E9C919275DA99BED51EB1173C1AF0518726B75B0EC3BAE2B5 | |||
|
|||
# SHA tests from RFC6234 section 8.5 | |||
Title = SHA(1) tests (from shatest.c) |
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.
shatest.c is not present anymore, no point to mention it. I'd suggest just "SHA1 tests" here and either "SHA2 tests" prior SHA224/256/384/512 or separate SHAxxx titles...
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 just made it "SHA tests"
test/evppbe.txt
Outdated
Result = SCRYPT_ERROR | ||
#maxmem = 10000000000 |
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.
What does move of #maxmem mean? That parser wouldn't tolerate it in old position?
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.
yes. that will be fixed in a future PR.
test/evppkey.txt
Outdated
# TEST CURVE secp112r1 | ||
Title = ECDH Tests: test with randomly generated keys for all the listed curves |
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.
This is kind broken. In this case Title refers to multiple curves, secp112r1 being just one, and flipping order kind of suggests that there is one curve and we exercise different algorithms on it.
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.
fixed
additional commit pushed |
test/evpdigest.txt
Outdated
@@ -90,7 +91,8 @@ Digest = BLAKE2b512 | |||
Input = 000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F8081 | |||
Output = DF0A9D0C212843A6A934E3902B2DD30D17FBA5F969D2030B12A546D8A6A45E80CF5635F071F0452E9C919275DA99BED51EB1173C1AF0518726B75B0EC3BAE2B5 | |||
|
|||
# SHA tests from RFC6234 section 8.5 | |||
Title = SHA tests |
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'd say it's inappropriate to drop the reference to doc/spec.
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.
If anything there should be more references, not less...
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.
That makes sense; restored comment; updated commit pushed.
test/evppkey.txt
Outdated
|
||
|
||
# TEST CURVE secp112r1 | ||
Title = TEST CURVE secp112r1 |
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.
But this implies that you would have to entitle changes from one curve to next. Suggestion was rather to entitle it with "EDCH tests" and then have comments delimiting different curves...
I misunderstood. Updated commit pushed. |
test/evppkey.txt
Outdated
@@ -693,7 +695,7 @@ Result = KEYOP_INIT_ERROR | |||
Function = pkey_pss_init | |||
Reason = invalid salt length | |||
|
|||
# ECDH tests | |||
Title ECDH tests |
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.
[When red-crossing] CI says
# ERROR:
# Line 364993016: Missing '=' in test file
I assume it's talking about this line. But error message calls even for question about line number!
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.
error message calls even for question about line number!
I naturally mean 364993016, which is not helpful.
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.
right. that's a puzzle. looking at it.
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 think i fixed it. updated commit pushed.
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 see no extra commits...
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.
doh! pushed.
Line numbering is still broken. If I corrupt first Title in evpciph.txt it complains about line number -1185918280. But line numbers for corrupted test data are correct. |
While you are at it and since you refer to bn_test. Can you look at line numbering in failed tests in bn_test? For example if you corrupt first test, it gets attributed to line 0. If you corrupt other than first, it gets attributed to line past previous test. While they should be attributed to first significant line of current test [like evp_test]. |
I don't see the Title line number bug:
I'll look at bn_test. My plan is for the next PR to merge the parsing routines... |
Speaking of Titles. There are too little of them. For example if you run evpciph.txt it |
What can I say? I get different number every time I run, e.g. 1751751624, -2011814616, -525217528, 1936404088... What's your top? Mine is 135cffc27b9adb6df2a0d071e7f5168ddd59b73a |
#3528 to fix the bntest issue you found.
And I just now did a push -f. |
I've got f672095875ab6c5a0bfe03586a15020422234a66 now, but it still prints random line numbers in reply to Title without =... |
I'm using clang with debug flags. I'll try GCC. |
ah, gcc shows the error. dang. |
well this is strange:
I believe the problem is that
|
pushed a new commit with that fix. |
What about others? E.g. evpdigest.txt says ISO/IEC 10118-3 and does Whirlpool test. Yes, Whirlpool is there, but so are SHA and RIPEMD-160... evpmac.txt has only SIPHASH Title, but more algorithms than that... |
I promise to do this in a separate PR. Will start shortl. Don't want to distract from this, which is all asbout the C code. |
Fair enough. Then it makes perfect sense to omit evpciph.txt commit here :-) |
Confirmed. |
#3529 has the additional titles stuff. |
Moved all title changes to #3529 |
I expect this to be re-based after #3529 is merged, and pass through travis, only then I'll look into it... |
Re-order and comment on the functions
rebased an squashed and pushed. waiting for travis. |
} | ||
return 1; | ||
} | ||
|
||
static int compare_mem(unsigned char *expected, size_t expected_len, | ||
unsigned char *got, size_t got_len) | ||
{ | ||
if (!TEST_mem_eq(expected, expected_len, got, got_len)) | ||
return 0; | ||
return 1; | ||
} |
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.
On side note one can probably argue that it calls to compare_mem should be replaced with TEST_mem_eq with rationale that __LINE__
would be more meaningful if it was compare_mem caller's.
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.
So that was done because the diff output wasn't totally useful before and having the local variables named expected and got was more helpful. Removing it is trivial, should I?
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.
Note "probably" in the side note. It means it's just an idea that might be worth considering. It might be sensible or it might not. But I can't prevent you from testing and telling how it looks. For example with regard to expected appearing in printout. It might be important, but then it might be possible to solve it by renaming some structure fields... Once again, something to consider...
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.
Yeah, I know. But you're the one who has raised this issue before. So tell me which you prefer:
# ERROR: (memory) 'mdata->output == mac' failed @ test/evp_test.c:1381
# --- mdata->output
# +++ mac
# 0000:-b3817f04ba25a8e6 6df67214c7550293
# 0000:+a3817f04ba25a8e6 6df67214c7550293
# ^^
Or this
# ERROR: (memory) 'expected == got' failed @ test/evp_test.c:328
# --- expected
# +++ got
# 0000:-b3817f04ba25a8e6 6df67214c7550293
# 0000:+a3817f04ba25a8e6 6df67214c7550293
# ^^
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 for one do care for line number in first output. And it's possible to make output more explicit by renaming output
field to expected
, so that it would read mdata->expected
. However! Since going through this request was hell (coloured "Files changed" is impossible to follow), I'd insist on merging it as it is now and do further improvements in separate request. I can't handle going trough it again...
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.
:) It's not like you're review @levitte's STORE stuff :) Merged this. New PR coming to rename the fields. Thanks for the careful review and feedback!
Re-order and comment on the functions Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from #3506)
Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from #3506)
See #3539 |
This is the evp_test part of #3471. It moves the parsing to be more similar to bn_test. I hope my text PR in this area will refactor out common code.