Skip to content

JML Specifications for KeyBlob #72

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

Merged
merged 7 commits into from
Sep 11, 2018

Conversation

slyubomirsky
Copy link
Contributor

@slyubomirsky slyubomirsky commented Sep 1, 2018

Issue #, if available:
N/A

Description of changes:
These changes add JML (Java Modeling Language) formal specifications to several files that have been verified using OpenJML (https://github.com/OpenJML/OpenJML). Included also is a README-JML file that gives a summary of the semantics of JML (with a short summary at the top). From the perspective of the Java compiler, JML annotations are all comments, so annotations should not force changes to ordinary code.

The files annotated in this request were meant to be those needed to ensure a specification for KeyBlob could verify. The following is a listing:

  • the exceptions in encryptionsdk.exception
  • encryptionsdk.internal.PrimitivesParser
  • encryptionsdk.EncryptionDataKey
  • encryptionsdk.model.KeyBlob

All the annotations verify (i.e., the implementation is guaranteed to match the behavior described in the JML specification) using the development version of OpenJML.

Note that this version of KeyBlob.java includes code that addresses the issues identified in #71, so this code will have to be synced to the changes in that PR once it is approved. (Done)

Most of the annotations in this PR were supplied by @RustanLeino and @davidcok. We are in the process of annotating and verifying more files that we can submit as PRs later; we would be very interested to know what you think would be the best ways to supply these annotations and the best ways to have them correspond to the intent of the code (and the message format specifications).

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@mattsb42-aws
Copy link
Member

mattsb42-aws commented Sep 4, 2018

Some thoughts before digging into this in detail.

  • Does the JML readme contain anything specific to this project? From a brief skim it looks like it's just a general overview of JML. It seems to me that it would be better to simply give a brief intro to "what is JML" and link to the relevant components of the OpenJML docs (that I assume exist).
  • How would we run OpenJML to verify these specifications? We will need to have tests that we can run (probably manually at first, but eventually as part of our CI) that will actually perform the verification.

@slyubomirsky
Copy link
Contributor Author

slyubomirsky commented Sep 4, 2018

The JML readme is not specific to this project. I had included it in a previous JML annotation project as a simpler guide than the official docs (http://www.eecs.ucf.edu/~leavens/JML/jmlrefman/jmlrefman_toc.html), so I included it here as well, but we could stick to the official docs if that's preferable.

As for running OpenJML, the Github project includes installation instructions here: https://github.com/OpenJML/OpenJML/wiki/OpenJML-Development-Environment-Setup
The files included here verify using the development build of OpenJML in Eclipse with the following arguments (I believe the Eclipse setup will have most of these bundled in a predefined $ARGS macro):
-esc -no-staticInitWarning -progress -timeout 60 -spec-math=bigint -code-math=safe -minQuant -classpath src/main/java -specspath src/main/java -dir src/main/java/com/amazonaws/encryptionsdk/model

@SalusaSecondus SalusaSecondus merged commit a43c5d3 into aws:master Sep 11, 2018
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