-
Notifications
You must be signed in to change notification settings - Fork 49
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
KEM libraries (non-ROM and ROM) #672
base: main
Are you sure you want to change the base?
Conversation
This is too large for me to do a proper review before the holidays. (In fact, it is so large that the non-ROM file's diff does not get displayed by default.) I've left a couple of single comments and will keep throwing some at it, but feel free to make updates to the branch before we break off—and I'll look at them after January 2. |
Of course, that is all good. I wasn't expecting you to review this in its entirety anytime soon, and I think it is fine if this takes quite a while and some discussion before being ready for merging. I was mostly interested in discussing the points of interest before anything else. However, do whatever you can or feel like is best. |
So I got back to this a lot later than I expected, but here are some thoughts. On functors for oracle types: being interface-oriented helps in coming up with generic definitions (to some extent). I would define the oracle type without dependency on the scheme, then define the default oracle wrappers as functors. (And you can also define a type for oracle wrappers at almost no cost once you have those.) On distribution mappings: I think this is something we do all the time. For example, the PROM theory allows the distribution we sample the output of the "random oracle" from to depend on the input to the query. (This allows us to use the same theory to also capture "probabilistic computation oracles.") If we go deep into the complexity theory, then there is a potential issue with manipulating arbitrary mappings like this in definitions that are trusted components of a security claim. This strengthens the case for having a layered library: a bunch of weird overcomplicated theories that capture super generic intuition and abstract away some of the gory details of the proof, but that computationally make no sense (for the initiated: Igor would be one of those), and then a collection of well-behaved top-level definitions that are clean, make concrete sense, and can be formally related to their abstract brethren. How to do that nicely is an open question. As a concrete example of this that also addresses your request to extend the PROM theory with public parameters: what you're asking for can be done as a thin layer around the PROM theory. (Outer init takes and stores the parameters pm, then calls inner init; outer get takes in input X, then calls inner get with pm and X.) Having a clean top-level definition that is not defined by wrapping would be good. (But it adds maintenance burden.) One big question to answer here is whether you wish to allow reinitialisation, and whether you wish to allow reinitialisation to change the public parameters. More to come, but I'm typing this on my phone and my hands are cold. |
I know there is still more of your reply to come, so I'll wait with commenting on most of it, but I wanted to already respond to the oracle type part. So, maybe it is because I am not fully following on the "wrapper type" part, but having this "non-functor type but functor default" means that any generic lemma of the form |
If you have lemmas that need to talk about both the scheme and the way in which the oracles wrap it, then you lose (some) genericity anyway, and those only work when you know the oracles are defined as wrappers around the scheme. So you fall back to that less generic mode of definition just for those lemmas. (But importantly, the experiments themselves still remain expressed over oracles.) I don't think any of the relations you have expressed right now require this, though:
So you could express all those lemmas without ever quantifying over the scheme |
… adjust comments.
… consistency in parameters and adjust comments.
Initial attempt at libraries for KEM (both in standard model and ROM).
There are several points of interest/discussion listed below which I think should be agreed upon before merging.
The resulting conclusions for these discussion points will directly translate to several other libraries I have coming up, meaning the merging of them will be smoother.
Points of Interest/Discussion (standard model):
Relations
). If the oracle type is a non-functor type, these generic lemmas would require memory separation between the (generic) scheme and the (generic) oracles. This then prevents us from instantiating any of these lemmas with the provided oracle defaults (using a generic scheme), as these take the scheme as a parameter (and hence their memory is not separated from the scheme's memory by definition). In summary, I am a bit torn between the approaches: 1) functor oracle type (forcing all oracles to be given a scheme, which you might not always want or need; however, allows for proving completely generic lemmas and instantiating them with the defaults), and (2) non-functor type oracles (allowing for the usage oracles without a scheme parameter; however, does not allow instantiating completely generic lemmas with the default oracles).sk2pk
to denote a mapping from secret keys to public keys which the key generation is supposed to conform to. Since this operator will be fixed when instantiating the theory, everything is only usable for schemes that adhere to this specificsk2pk
instantiation. So, one might argue that there is no flexibility gain from havingencaps
in the module type as opposed to having anencaps
operator. However, I would say that a singlesk2pk
is somewhat likely to cover multiple schemes, think of schemes just adding the public key as a whole to the secret key, whileencaps
is almost always unique to a single scheme.)Relations
theory below the definitions, meant to contain relations only using KEMs (i.e., no other cryptographic primitives involved). Currently, it mainly contains relatively simple hierarchical relations. Do we want this to be in this file? If so, I currently crudely import all necessary abstract theories (from the definitions) in a row at the top of this theory. Is this a satisfactory way to go about it, or do we want to have some more code encapsulation here?Points of Interest/Discussion (ROM):
Miscellaneous Points of Interest: