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

Statically enforce the size of PrivateKey.{zero_values, one_values} #13

Open
romac opened this issue Mar 19, 2018 · 0 comments
Open

Statically enforce the size of PrivateKey.{zero_values, one_values} #13

romac opened this issue Mar 19, 2018 · 0 comments

Comments

@romac
Copy link
Member

romac commented Mar 19, 2018

As @nvesely found out in #12, we are currently not enforcing the length of the one_values and zero_values fields of the PrivateKey structs.

If one_values: Vec<Vec<u8>> is different in len() than zero_values, the
code can either panic, or it's possible different PrivateKeys are evaluated
as equal. In both these examples, at least one key would be of invalid
structure, but there's nothing about the PrivateKey struct that enforces
valid structure in this sense.

Perhaps this is an argument to create key-length-specific types*.

* E.g.,

pub struct PrivateKey512 {
    zero_values: [[u8; 512 / 8]; 512],
    one_values: [[u8; 512 / 8]; 512],
    // ...
}
@romac romac changed the title Statically enforce the size of PrivateKey.{ Statically enforce the size of PrivateKey.{zero_values, one_values} Mar 19, 2018
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

1 participant