DSA cdf tests#280
Conversation
|
Well, it turned out that the case when ltc is on "signing" side is OK. So this PR is complete. |
f4e3820 to
719be6e
Compare
719be6e to
0d090f0
Compare
0d090f0 to
656c57b
Compare
|
@sjaeckel ping |
sjaeckel
left a comment
There was a problem hiding this comment.
Looks good, but somehow it seems now to be slightly inconsistent with what dsa_verify_key() checks, shouldn't this be updated as well? or should we probably have two versions of dsa_verify_key()? I'm just thinking that dsa_set_pqg_dsaparam() does the same as dsa_set_pqg() but lacks these newly added checks...
|
We could e.g. have an internal (say |
|
something like this? |
|
Do we really need such extensive tests? (the 2 exptmod's?)
|
|
we should perhaps keep the name |
damn, sorry - sure I'll just update the branch |
The thing is that at the end of |
but it looks to me like part of it was required for the cdf tests to pass, right? |
pushed |
|
What we need is to avoid loading/setting/creating a DSA key with It would be better to check it in |
|
I have slightly updated your pr/fix-dsa-cdf-2 - which works and can be merged |
Okay, but the different parts of the implementation I saw had checks for I think it'd make sense to have 2 private functions Flow could be something like this: What do you think? |
|
I'll check FIPS 186-4 but meanwhile another approach for |
0eb5481 to
444d9f3
Compare
|
@sjaeckel could you please review this PR again? |
| void *tmp1, *tmp2; | ||
| int err; | ||
|
|
||
| *stat = 0; |
There was a problem hiding this comment.
ew, de-referencing stat before checking for NULL
| int dsa_export(unsigned char *out, unsigned long *outlen, int type, dsa_key *key); | ||
| int dsa_verify_key(dsa_key *key, int *stat); | ||
|
|
||
| #ifdef LTC_SOURCE |
There was a problem hiding this comment.
can you please add the obligatory /* internal helper functions */ comment
| err = CRYPT_OK; | ||
| *stat = 1; | ||
| error: | ||
| mp_clear_multi(tmp1, tmp2, NULL); |
There was a problem hiding this comment.
can you please (always) reverse the order when clearing MPI's
| goto LBL_ERR; | ||
| } | ||
| if (stat == 0) { | ||
| err = CRYPT_INVALID_PACKET; |
There was a problem hiding this comment.
Looks like we inconsistently return either CRYPT_INVALID_PACKET or CRYPT_INVALID_ARG, we should always use the same error code. I'd say we should go for CRYPT_INVALID_PACKET (an alternative could be to introduce a new error code, but not sure if that's really necessary).
| /* first make sure key->q and key->p are prime */ | ||
| if ((err = mp_prime_is_prime(key->q, 8, &res)) != CRYPT_OK) { | ||
| /* key->q prime? */ | ||
| if ((err = mp_prime_is_prime(key->q, LTC_MILLER_RABIN_REPS, &res)) != CRYPT_OK) { |
|
Oh sorry, I should perhaps wait for Travis-CI |
|
Too late, the build's going to fail ;) |
|
but nvm, as the merge will be built as well... |
Another crypto test bench https://github.com/kudelskisecurity/cdf
Good news - our RSA implementation seems to pass. But we have couple of DSA related troubles.
The first commit fixes failures when ltc is on "validating" side. There are still some failures when ltc is on "signing" side, I'll try to analyze those later.