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

Tink update #198

Merged
merged 4 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Tink/src/DeterministicAeadKeyTemplates.crysl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* - aes256_siv
*/


Copy link
Contributor

Choose a reason for hiding this comment

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

e.g., remove this line and make a commit message "MINOR"

SPEC com.google.crypto.tink.daead.DeterministicAeadKeyTemplates

OBJECTS
Expand Down
16 changes: 7 additions & 9 deletions Tink/src/KeyTemplate.crysl
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
/*
* A CrySL specification for using the AEAD Factory
* of the Google Google library.
*/
SPEC com.google.crypto.tink.proto.KeyTemplate
SPEC com.google.crypto.tink.KeyTemplate

OBJECTS
int x;
com.google.crypto.tink.KeyTemplate template
com.google.crypto.tink.Parameters params

EVENTS
evt : newBuilder();
cre: template = createFrom(params)
ORDER
evt*
cre+
ENSURES
readyForInstantiating[this];
genKeyTemplate[template]
15 changes: 15 additions & 0 deletions Tink/src/KeyTemplateOld.crysl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* A CrySL specification for using the AEAD Factory
* of the Google Google library.
*/
SPEC com.google.crypto.tink.proto.KeyTemplate

OBJECTS
int x;

EVENTS
evt : newBuilder();
ORDER
evt*
ENSURES
readyForInstantiating[this];
12 changes: 9 additions & 3 deletions Tink/src/KeysetHandle.crysl
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,27 @@
SPEC com.google.crypto.tink.KeysetHandle

OBJECTS
com.google.crypto.tink.proto.KeyTemplate kt;
com.google.crypto.tink.KeyTemplate kt;
com.google.crypto.tink.KeysetHandle publicKeysetHandle;
com.google.crypto.tink.mac.HmacParameters hmacParams;


EVENTS
gen_evt : generateNew(kt);
gen_hmac_evt : generateNew(hmacParams);
gen_public_evt : publicKeysetHandle = getPublicKeysetHandle();
read_evt : read(_, _);
export_evt : write(_, _);
get_prim : getPrimitive(_);

ORDER
(gen_evt | read_evt), gen_public_evt?, export_evt?
(gen_evt | read_evt), gen_public_evt?, export_evt?, get_prim*


REQUIRES
keyTemplate[kt];
genKeyTemplate[kt];
hmacParams[hmacParams];


ENSURES
generatedKeySet[this];
Expand Down
14 changes: 14 additions & 0 deletions Tink/src/PredefinedDeterministicAeadParameters.crysl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
SPEC com.google.crypto.tink.daead.PredefinedDeterministicAeadParameters

OBJECTS
com.google.crypto.tink.daead.AesSivParameters params;
com.google.crypto.tink.daead.PredefinedDeterministicAeadParameters aeadParams;

EVENTS
aead256: params = aeadParams.AES256_SIV;

ORDER
con*

ENSURES
genAeadParams[params];
16 changes: 16 additions & 0 deletions Tink/src/PredefinedMacParameters.crysl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
SPEC com.google.crypto.tink.mac.PredefinedMacParameters

OBJECTS
com.google.crypto.tink.mac.HmacParameters hmacParams;
com.google.crypto.tink.mac.PredefinedMacParameters macParams

EVENTS
hmac_sha256_128 : hmac_sha256 = macParams.HMAC_SHA256_128BITTAG
hmac_sha256_256 : hmac_sha256 = macParams.HMAC_SHA256_256BITTAG
Hmac_sha256: hmac_sha256_128 | hmac_sha256_256

ORDER
Hmac_sha256+

ENSURES
hmacParams[hmacParams]