Skip to content

Conversation

@karel-m
Copy link
Member

@karel-m karel-m commented Oct 7, 2018

This is basically a revert of my PR - Less strict ecc_verify_hash_ex (as it was before ecc_recover_key) #443

It enforces the strict verification mode for LTC_ECCSIG_RFC7518 but allow relaxed variant via LTC_ECCSIG_RFC7518_RELAXED.

I have changed my mind after investigation the latest wycheproof test suit. it seems that since approx. a yar ago wycheproof guys (=google) did change the status of some "acceptable" cases to "invalid". In other words what is declared today as "acceptable" is a candidate for tomorrow's "invalid".

So my new proposal is either enforce the strict length validation (the size of the signature should always be twice the number of bytes of the size of the order) or this PR.

Cc: @sjaeckel @rmw42

Copy link
Member

@sjaeckel sjaeckel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My personal preference would be to not have relaxed API's for security critical stuff!

/* raw R, S values - both values strictly padded to the size of the curve order*/
LTC_ECCSIG_RFC7518 = 0x1,
/* raw R, S values - without strict padding check (used just for verification) */
LTC_ECCSIG_RFC7518_RELAXED = 0x2,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we really change it, would it probably make more sense to make this enum (at least partially) a bitfield and relaxed is a flag (e.g. 0x80) where there's currently only a relaxed implementation of RFC 7518?

0x01,0x8a,0x79,0xb3,0xe0,0x26,0x3d,0x91,0xa8,0xba,0x90,0x62,0x2d,0xf6,0xf2,0xf0
};
const unsigned char sig1[] = { 0x05, 0x01 };
/* msg+pub2+sig2 test vector is from wycheproof - ecdsa_webcrypto_test (incorrect size of signature) */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this testcase stay in there for the relaxed api where it was okay before?

@karel-m karel-m force-pushed the pr/ecc-LTC_ECCSIG_RFC7518_RELAXED branch from 763b25b to 2efe8e2 Compare October 7, 2018 20:11
@karel-m karel-m changed the title Introducing LTC_ECCSIG_RFC7518_RELAXED Make LTC_ECCSIG_RFC7518 strict (again) Oct 7, 2018
@karel-m
Copy link
Member Author

karel-m commented Oct 7, 2018

changed to the strict approach

@karel-m karel-m force-pushed the pr/ecc-LTC_ECCSIG_RFC7518_RELAXED branch from 2efe8e2 to c2cdaaa Compare October 13, 2018 16:49
@karel-m karel-m merged commit fba6ae3 into develop Oct 13, 2018
@karel-m karel-m deleted the pr/ecc-LTC_ECCSIG_RFC7518_RELAXED branch October 13, 2018 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants