Skip to content
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

test vectors? #27

Open
mimoo opened this issue Oct 3, 2018 · 4 comments
Open

test vectors? #27

mimoo opened this issue Oct 3, 2018 · 4 comments

Comments

@mimoo
Copy link
Owner

mimoo commented Oct 3, 2018

No description provided.

@Fasjeit
Copy link
Contributor

Fasjeit commented Nov 27, 2018

For testing purposes I think it would be better to have an option to "disable" all crypto randomness, and just set all random results to zero. So all private keys and nonces will be zero, and it allows to implement test vectors and achieve deterministic results.

In c-like languages we can use preprocessor directive (like I do in DiscoNet), in others (go and python) the only way to deal with it is to define global variables for the same purpose.

The only places to add this is GenerateKeyPair, EncryptAndAuthenticate, Encrypt.

@mimoo
Copy link
Owner Author

mimoo commented Nov 27, 2018

If possible, I think it'd be good to follow the Noise test vectors format.

I test for them here and they require you to set the ephemeral key for each test. So in my Noise implementation I have an extra field


type handshakeState struct {
    // ...
    // for test vectors
    debugEphemeral *KeyPair
}

(Now that I'm thinking about it, I probably don't need this extra field since I'm inside the library.)

If you want I can get that done this week end, as I already have this code it should be pretty straight forward for me to output the test vectors instead of reading from them.

@Fasjeit
Copy link
Contributor

Fasjeit commented Nov 27, 2018

I got the idea about Key Pairs, but what about the nonces? As we call Ad operation on random nonce the state is updated in non deterministic way, so each call give new strobe state.

I don't need test vectors right now. I have some other "Disco" things to do at this moment, so don't hurry.

@mimoo
Copy link
Owner Author

mimoo commented Nov 28, 2018

Are you talking about the nonces of the symmetric library? In this case I don't think it is necessary to cover this via the test vectors since we already cover strobe with test vectors and this is a pretty simple wrapper around strobe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants