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

Outline Proof Correctness Message Body #237

Merged
merged 37 commits into from
Apr 29, 2020
Merged

Outline Proof Correctness Message Body #237

merged 37 commits into from
Apr 29, 2020

Conversation

WouterSchols
Copy link

feat(MessageBody): Added outline proving correctness EncryptMessageBody body. Includes all requirements, expected function definitions. Avoids arithmetic problems in EncryptMessageBody method

Includes all requirements, expected function definitions. Avoids arithmetic problems in EncryptMessageBody method
@lavaleri
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: DafnyESDK
  • Commit ID: 35e6058
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link
Contributor

@lavaleri lavaleri left a comment

Choose a reason for hiding this comment

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

Great job so far interpreting the spec! The one big issue that needs to be fixed is the fact that frameLength isn't the length of the serialized frame (I know, bad name), but instead the length of the plaintext that is encrypted by that frame. That has some implications on what we are able to verify here because we can't assume that the encrypted content will have the same length as the plaintext.

If there is anywhere in the spec that is misleading on that point, please point it out so we can fix it.

src/SDK/MessageBody.dfy Outdated Show resolved Hide resolved
src/SDK/MessageBody.dfy Outdated Show resolved Hide resolved
src/SDK/MessageBody.dfy Outdated Show resolved Hide resolved
src/SDK/MessageBody.dfy Outdated Show resolved Hide resolved
src/SDK/MessageBody.dfy Outdated Show resolved Hide resolved
src/SDK/MessageBody.dfy Outdated Show resolved Hide resolved
src/SDK/MessageBody.dfy Outdated Show resolved Hide resolved
src/SDK/MessageBody.dfy Outdated Show resolved Hide resolved
src/SDK/MessageBody.dfy Outdated Show resolved Hide resolved
src/SDK/MessageBody.dfy Outdated Show resolved Hide resolved
@lavaleri
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: DafnyESDK
  • Commit ID: 8ef5257
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@lavaleri
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: DafnyESDK
  • Commit ID: 116956c
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Export does not support exporting predicates from datatypes. This will cause errors if the methods are called outside of the module.
@lavaleri
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: DafnyESDK
  • Commit ID: 2be9ca7
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@lavaleri
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: DafnyESDK
  • Commit ID: cf0fbba
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

wouter added 2 commits March 27, 2020 13:25
feat: Added draft of postconditions DecryptFrame
@lavaleri
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: DafnyESDK
  • Commit ID: 90a01a6
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

fix: Finished the proof of DecryptFrame method
@lavaleri
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: DafnyESDK
  • Commit ID: 176cd5b
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

wouter added 2 commits March 27, 2020 18:00
@lavaleri
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: DafnyESDK
  • Commit ID: f06c51b
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@lavaleri
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: DafnyESDK
  • Commit ID: a085df7
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

feat: Small strengtening encrypt post conditions
@lavaleri
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: DafnyESDK
  • Commit ID: 89207e8
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

fix: Moved EncryptMock and DecryptMock yo AESEncryption
@lavaleri
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: DafnyESDK
  • Commit ID: 8049dfb
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

fix:Added export back
@lavaleri
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: DafnyESDK
  • Commit ID: 2f8140c
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@lavaleri
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: DafnyESDK
  • Commit ID: 5eb44d2
  • Result: FAILED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@lavaleri
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: DafnyESDK
  • Commit ID: 22c32df
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@WouterSchols WouterSchols requested review from acioc and lavaleri April 13, 2020 22:13
Copy link
Contributor

@lavaleri lavaleri left a comment

Choose a reason for hiding this comment

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

Finished review of Frame Decrypt operations.

Good job so far! The major things are I think we can still improve on readability by thinking about the names of ghosts a bit more. Finally, I just noticed that we are lacking unit tests here. Since this PR will change behavior (even if very slightly), it shouldn't go in until we have the framed encrypt/decrypt behavior covered by unit tests. I will ask team how we want to go forward with this.

src/SDK/MessageBody.dfy Show resolved Hide resolved
src/SDK/MessageBody.dfy Outdated Show resolved Hide resolved
src/SDK/MessageBody.dfy Outdated Show resolved Hide resolved
src/SDK/MessageBody.dfy Outdated Show resolved Hide resolved
return Success(plaintext);
}

datatype FrameWithGhostSeq = FrameWithGhostSeq(frame: Frame, ghost ciphertext: seq<uint8>)
Copy link
Contributor

Choose a reason for hiding this comment

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

Creating a new datatype to pair these together makes sense, but we should think about the name a bit. This is a thing that contains the ghost Frame representation of the data, and then that same data, but serialized and compiled into a seq. @RustanLeino Is there any idiom for naming a thing which is paired with some ghost representation of itself?

Copy link
Contributor

Choose a reason for hiding this comment

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

There's no such naming convention that I know of. Whatever the name, we could add such a type to the standard library, in a generic way. For example:

datatype ExtendWithGhost<A, B> = ExtendWithGhost(a: A, ghost b: B)

The use of this type in Wouter's code gives us a way to return some ghost value along with the result. With language support, a better solution would be for Dafny to allow :- to be used with more than one out-parameter. I just submitted an Issue to request such a feature, dafny-lang/dafny#603.

Comment on lines 426 to 428
var decryptedFrame := frameWithGhostSeq.frame;
var ciphertext := frameWithGhostSeq.ciphertext;
var final := decryptedFrame.FinalFrameConstructor?;
Copy link
Contributor

Choose a reason for hiding this comment

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

I would expect these to line up with the &&s. @RustanLeino do you have preferences on this styling?

src/SDK/MessageBody.dfy Outdated Show resolved Hide resolved
src/SDK/MessageBody.dfy Outdated Show resolved Hide resolved
src/SDK/MessageBody.dfy Show resolved Hide resolved
src/SDK/MessageBody.dfy Outdated Show resolved Hide resolved
chore: Added extra comments
chore: General refactoring
@lavaleri
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: DafnyESDK
  • Commit ID: 5b3959b
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link
Contributor

@lavaleri lavaleri left a comment

Choose a reason for hiding this comment

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

file .vs/EncryptionSDK/v16/.suo should be removed from this PR
and one small fix

src/SDK/MessageBody.dfy Outdated Show resolved Hide resolved
wouter and others added 3 commits April 22, 2020 14:52
Chore: Updated comments and removed unwanted commit
Chore: Changed sloppy error message removed unwanted file changes
@lavaleri
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: DafnyESDK
  • Commit ID: a00840f
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@lavaleri
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: DafnyESDK
  • Commit ID: dda2caa
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

lavaleri
lavaleri previously approved these changes Apr 22, 2020
Copy link
Contributor

@lavaleri lavaleri left a comment

Choose a reason for hiding this comment

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

lgtm! Thanks for the great work here. Make sure that @acioc takes a look at the updated documentation/comments and his concerns are addressed before merging.

Copy link

@acioc acioc left a comment

Choose a reason for hiding this comment

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

Overall, looks good. A few np's but blocking change is the expect

src/Crypto/AESEncryption.dfy Outdated Show resolved Hide resolved
src/SDK/MessageBody.dfy Outdated Show resolved Hide resolved
src/SDK/MessageBody.dfy Outdated Show resolved Hide resolved
src/SDK/MessageBody.dfy Outdated Show resolved Hide resolved
src/SDK/MessageBody.dfy Outdated Show resolved Hide resolved
src/SDK/MessageBody.dfy Outdated Show resolved Hide resolved
@WouterSchols WouterSchols requested review from acioc and lavaleri April 29, 2020 20:20
@lavaleri
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: DafnyESDK
  • Commit ID: 2dfbe9d
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@lavaleri
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: DafnyESDK
  • Commit ID: 54c17d8
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link

@acioc acioc left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks!

@lavaleri
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: DafnyESDK
  • Commit ID: be95895
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@WouterSchols WouterSchols merged commit ff7f001 into aws:develop Apr 29, 2020
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.

5 participants