-
Notifications
You must be signed in to change notification settings - Fork 41
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
Error testing a predicate of Google Tink specification #92
Comments
@rbonifacio Could you grant me access to the binary files of the rules? That would simplify the testing on my side. |
@johspaeth the binary files are available in a particular branch issue-89 |
I debugged the test case, fixed some issues for the specification and observed the following in this commit
|
Hi @johspaeth, I fixed the Google Tink specifications. Thanks for reporting the errors. The test cases for the AEAD are passing now, and I reverted your previous changes on classes AnalysisSeedWithSpecification and ConstraintSolver. I sent these contributions using the branch #92. There are two points that I would like to discuss (perhaps in your next meeting, if you prefer). (a) I think that it should be possible to specify a CrySL rule in a file with a different name of the class (or interface), or perhaps we should have to design a different approach to avoid name conflicts. For instance, both JCA and Google Tink have an interface named Mac, and it is not possible to have two specifications with the same name. For this reason, I decided to name the CrySL files for the Tink primitives with the suffix "Primitive", like AeadPrimitive and MacPrimitive (though the names of the interfaces are Aead and Mac). Nevertheless, based on your last message, it seems to me that this is not possible (or at least not recommended). For some reason, it is working for the MacPrimitive. (b) As I said, the current test cases on branch #92 are leading to a "green bar". However, I could not understand one situation. This next test case runs and leads to green bar. @Test
public void generateNewAES128GCMKeySet() throws GeneralSecurityException {
KeyTemplate kt = AeadKeyTemplates.AES128_GCM;
KeysetHandle ksh = KeysetHandle.generateNew(kt);
Assertions.hasEnsuredPredicate(kt);
Assertions.mustBeInAcceptingState(kt);
Assertions.mustBeInAcceptingState(ksh);
} This next test case also runs and leads to a green bar. @Test
public void encryptUsingAES128GCM() throws GeneralSecurityException {
KeyTemplate kt = AeadKeyTemplates.AES128_GCM;
KeysetHandle ksh = KeysetHandle.generateNew(kt);
final String plainText = "Just testing the encryption mode of AEAD";
final String aad = "cryptsl";
Aead aead = AeadFactory.getPrimitive(ksh);
byte[] out = aead.encrypt(plainText.getBytes(), aad.getBytes());
Assertions.mustBeInAcceptingState(aead);
Assertions.hasEnsuredPredicate(out);
} However, if I add this assertion |
Regarding (a): I agree, it is confusing especially as we do warn the CrySL developer about this issue. There are only one or two lines in the code that use the actual filename of the rule, we should instead use the string listed in the SPEC clause at these points. (b) That seems like a bug. I investigate it further. |
# Conflicts: # CryptoAnalysis/pom.xml
I had a quick look. In my environment, the test cases in Also, as of now, the analysis does not properly model the static field flows. The simple difference is that by unsing the first line, the JVM implicitly calls the class initializer () of The test cases do not properly model the calls as they are not explicit within the code. I work on that and give you an update here. Until then line (2) in your test cases. |
I've just updated and built the WPDS project. Now I am getting the same results as yours (some test cases are failing). At least this might explain the different results that we were getting. |
Good...or well bad. :) Then I know where to look at. |
While debuggnig, I still saw that the constraints lists Did you update the rules (and cryptslbin files) accordingly? In the repository, I cannot see any update on the master: We really need to be able to read in rules in CrySL-source code format...@kruegers is working on that! 👍 |
Hi @johspaeth , I've just commited some changes to the test cases and binary versions of the specifications. The test cases are running again, and I hope that our environment is the same now. The source code of the specifications is available at: |
Great, it works on my machine as well. I will have a look at the data-flows of static fields, such that you can properly model the usages. |
The following test case is failing, because a predicate to the key template object (kt) is not being generated.
The goal here is to verify if the specification for the class AeadKeyTemplates is correct. The Google Tink specifications are available at the Crypto-API-Rules repository
The test code is available at the branch issue-89. To run this test cases, it is necessary to configure Soot to find the Google Tink libraries. To this end, we have to add these lines
to the method initializeSootWithEntryPoint (class AbstractTestingFramework of the WPDS project).
The text was updated successfully, but these errors were encountered: