Skip to content

Commit 16cce90

Browse files
authored
Merge pull request #412 from eclipse-cognicrypt/update-crysl-version
Update crysl version
2 parents 661fbd8 + 55e2445 commit 16cce90

5 files changed

Lines changed: 105 additions & 56 deletions

File tree

features/de.cognicrypt.cryslhandler.feature/feature.xml

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
2-
<feature
3-
id="de.cognicrypt.cryslhandler.feature"
4-
label="CogniCrypt CrySL Handler"
5-
version="1.0.0.qualifier"
6-
provider-name="Technical University Darmstadt, Paderborn University">
7-
8-
<description url="https://cognicrypt.de">
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<feature
3+
id="de.cognicrypt.cryslhandler.feature"
4+
label="CogniCrypt CrySL Handler"
5+
version="1.0.0.qualifier"
6+
provider-name="Technical University Darmstadt, Paderborn University">
7+
8+
<description url="https://cognicrypt.de">
99
CogniCrypt is an Eclipse plugin that supports Java developers
1010
in using cryptographic APIs. It supports developers in two ways.
1111
First, it may generate code snippets for a number of programming
1212
tasks that involve cryptography, e.g., communication over a secure
1313
channel, data encryption, and long-term archiving. Second, it
1414
continuously runs a suite of static analyses in the background
1515
that check the developer&apos;s code for misuses of cryptographic
16-
APIs.
17-
</description>
18-
19-
<copyright>
20-
Copyrights reserved.
21-
</copyright>
22-
23-
<license url="https://www.eclipse.org/legal/epl-2.0/">
16+
APIs.
17+
</description>
18+
19+
<copyright>
20+
Copyrights reserved.
21+
</copyright>
22+
23+
<license url="https://www.eclipse.org/legal/epl-2.0/">
2424
Eclipse Public License - v 2.0
2525
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (“AGREEMENT”). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT&apos;S ACCEPTANCE OF THIS AGREEMENT.
2626
1. DEFINITIONS
@@ -96,34 +96,34 @@ All Recipient&apos;s rights under this Agreement shall terminate if it fails to
9696

9797
Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be Distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to Distribute the Program (including its Contributions) under the new version.
9898

99-
Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. Nothing in this Agreement is intended to be enforceable by any entity that is not a Contributor or Recipient. No third-party beneficiary rights are created under this Agreement.
100-
</license>
101-
102-
<url>
103-
<update url="http://download.eclipse.org/cognicrypt"/>
104-
</url>
105-
106-
<requires>
107-
<import plugin="org.eclipse.ui"/>
108-
<import plugin="org.eclipse.core.runtime"/>
109-
<import plugin="org.eclipse.ui.workbench"/>
110-
<import plugin="org.eclipse.core.resources"/>
111-
<import plugin="org.eclipse.ui.ide"/>
112-
<import plugin="org.eclipse.jdt.core"/>
113-
<import plugin="org.eclipse.xtext"/>
114-
<import plugin="org.eclipse.xtext.common.types.ui"/>
115-
<import plugin="de.darmstadt.tu.crossing.CrySL.ui" version="2.0.0" match="perfect"/>
116-
<import plugin="de.darmstadt.tu.crossing.CrySL" version="2.0.0" match="perfect"/>
117-
<import plugin="de.darmstadt.tu.crossing.CrySL.ide" version="2.0.0" match="perfect"/>
118-
<import plugin="de.cognicrypt.core" version="1.0.0" match="greaterOrEqual"/>
119-
<import plugin="org.junit"/>
120-
</requires>
121-
122-
<plugin
123-
id="de.cognicrypt.crysl.handler"
124-
download-size="0"
125-
install-size="0"
126-
version="0.0.0"
127-
unpack="false"/>
128-
129-
</feature>
99+
Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. Nothing in this Agreement is intended to be enforceable by any entity that is not a Contributor or Recipient. No third-party beneficiary rights are created under this Agreement.
100+
</license>
101+
102+
<url>
103+
<update url="http://download.eclipse.org/cognicrypt"/>
104+
</url>
105+
106+
<requires>
107+
<import plugin="org.eclipse.ui"/>
108+
<import plugin="org.eclipse.core.runtime"/>
109+
<import plugin="org.eclipse.ui.workbench"/>
110+
<import plugin="org.eclipse.core.resources"/>
111+
<import plugin="org.eclipse.ui.ide"/>
112+
<import plugin="org.eclipse.jdt.core"/>
113+
<import plugin="org.eclipse.xtext"/>
114+
<import plugin="org.eclipse.xtext.common.types.ui"/>
115+
<import plugin="de.darmstadt.tu.crossing.CrySL.ui" version="2.0.1" match="perfect"/>
116+
<import plugin="de.darmstadt.tu.crossing.CrySL" version="2.0.1" match="perfect"/>
117+
<import plugin="de.darmstadt.tu.crossing.CrySL.ide" version="2.0.1" match="perfect"/>
118+
<import plugin="de.cognicrypt.core" version="1.0.0" match="greaterOrEqual"/>
119+
<import plugin="org.junit"/>
120+
</requires>
121+
122+
<plugin
123+
id="de.cognicrypt.crysl.handler"
124+
download-size="0"
125+
install-size="0"
126+
version="0.0.0"
127+
unpack="false"/>
128+
129+
</feature>

plugins/de.cognicrypt.crysl.handler/META-INF/MANIFEST.MF

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ Require-Bundle: org.eclipse.ui,
1313
org.eclipse.jdt.core,
1414
org.eclipse.xtext,
1515
org.eclipse.xtext.common.types.ui,
16-
de.darmstadt.tu.crossing.CrySL.ui;bundle-version="2.0.0",
17-
de.darmstadt.tu.crossing.CrySL;bundle-version="2.0.0",
18-
de.darmstadt.tu.crossing.CrySL.ide;bundle-version="2.0.0",
16+
de.darmstadt.tu.crossing.CrySL.ui;bundle-version="2.0.1",
17+
de.darmstadt.tu.crossing.CrySL;bundle-version="2.0.1",
18+
de.darmstadt.tu.crossing.CrySL.ide;bundle-version="2.0.1",
1919
de.cognicrypt.core;bundle-version="1.0.0",
2020
org.junit
2121
Bundle-RequiredExecutionEnvironment: JavaSE-1.8

plugins/de.cognicrypt.crysl.handler/pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,17 +158,17 @@
158158
<dependency>
159159
<groupId>de.darmstadt.tu.crossing.CrySL</groupId>
160160
<artifactId>de.darmstadt.tu.crossing.CrySL</artifactId>
161-
<version>2.0.0</version>
161+
<version>2.0.1</version>
162162
</dependency>
163163
<dependency>
164164
<groupId>de.darmstadt.tu.crossing.CrySL</groupId>
165165
<artifactId>de.darmstadt.tu.crossing.CrySL.ide</artifactId>
166-
<version>2.0.0</version>
166+
<version>2.0.1</version>
167167
</dependency>
168168
<dependency>
169169
<groupId>de.darmstadt.tu.crossing.CrySL</groupId>
170170
<artifactId>de.darmstadt.tu.crossing.CrySL.ui</artifactId>
171-
<version>2.0.0</version>
171+
<version>2.0.1</version>
172172
</dependency>
173173
</dependencies>
174174
</project>

plugins/de.cognicrypt.crysl.handler/src/main/java/de/cognicrypt/crysl/reader/CrySLParser.java

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
import de.darmstadt.tu.crossing.crySL.UseBlock;
102102
import de.darmstadt.tu.crossing.crySL.impl.DomainmodelImpl;
103103
import de.darmstadt.tu.crossing.crySL.impl.ObjectImpl;
104+
import com.google.common.base.CharMatcher;
104105

105106
public class CrySLParser {
106107

@@ -340,7 +341,13 @@ private List<CrySLPredicate> retrieveReqPredFromAltPreds(ReqPred left) {
340341
private CrySLPredicate extractReqPred(final ReqPred pred) {
341342
final List<ICrySLPredicateParameter> variables = new ArrayList<>();
342343
PredLit innerPred = (PredLit) pred;
343-
final Constraint conditional = (Constraint) innerPred.getCons();
344+
EObject cons = innerPred.getCons();
345+
ISLConstraint conditional = null;
346+
if (cons instanceof Constraint) {
347+
conditional = getConstraint((Constraint) cons);
348+
} else if (cons instanceof Pred) {
349+
conditional = getPredicate((Pred) cons);
350+
}
344351
if (innerPred.getPred().getParList() != null) {
345352
for (final SuPar var : innerPred.getPred().getParList().getParameters()) {
346353
if (var.getVal() != null) {
@@ -361,7 +368,45 @@ private CrySLPredicate extractReqPred(final ReqPred pred) {
361368
}
362369
}
363370
}
364-
return new CrySLPredicate(null, innerPred.getPred().getPredName(), variables, (innerPred.getNot() != null ? true : false), getConstraint(conditional));
371+
return new CrySLPredicate(null, innerPred.getPred().getPredName(), variables, (innerPred.getNot() != null ? true : false), conditional);
372+
}
373+
374+
private ISLConstraint getPredicate(Pred pred) {
375+
final List<ICrySLPredicateParameter> variables = new ArrayList<>();
376+
if (pred.getParList() != null) {
377+
for (final SuPar var : pred.getParList().getParameters()) {
378+
if (var.getVal() != null) {
379+
final LiteralExpression lit = var.getVal();
380+
final ObjectImpl object = (ObjectImpl) ((LiteralExpression) lit.getLit().getName()).getValue();
381+
final String type = ((ObjectDecl) object.eContainer()).getObjectType().getQualifiedName();
382+
final String variable = object.getName();
383+
final String part = var.getVal().getPart();
384+
if (part != null) {
385+
variables.add(new CrySLObject(variable, type, new CrySLSplitter(Integer.parseInt(lit.getInd()), filterQuotes(lit.getSplit()))));
386+
} else {
387+
final String consPred = var.getVal().getConsPred();
388+
int ind;
389+
if (consPred != null) {
390+
if (consPred.equals("alg(")) {
391+
ind = 0;
392+
variables.add(new CrySLObject(variable, type, new CrySLSplitter(ind, filterQuotes("/"))));
393+
} else if (consPred.equals("mode(")) {
394+
ind = 1;
395+
variables.add(new CrySLObject(variable, type, new CrySLSplitter(ind, filterQuotes("/"))));
396+
} else if (consPred.equals("pad(")) {
397+
ind = 2;
398+
variables.add(new CrySLObject(variable, type, new CrySLSplitter(ind, filterQuotes("/"))));
399+
}
400+
} else {
401+
variables.add(new CrySLObject(variable, type));
402+
}
403+
}
404+
} else {
405+
variables.add(new CrySLObject(UNDERSCORE, NULL));
406+
}
407+
}
408+
}
409+
return new CrySLPredicate(null, pred.getPredName(), variables, (((PredLit)pred.eContainer()).getNot() != null ? true : false), null);
365410
}
366411

367412
private CrySLArithmeticConstraint convertLiteralToArithmetic(final Constraint expression) {
@@ -752,4 +797,8 @@ private String getValueOfLiteral(final EObject name) {
752797
}
753798
return Utils.filterQuotes(value);
754799
}
800+
801+
private static String filterQuotes(final String dirty) {
802+
return CharMatcher.anyOf("\"").removeFrom(dirty);
803+
}
755804
}

repository/category.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<feature url="features/de.cognicrypt.cryslhandler.feature_1.0.0.qualifier.jar" id="de.cognicrypt.cryslhandler.feature" version="1.0.0.qualifier">
1010
<category name="de.cognicrypt.catergory"/>
1111
</feature>
12-
<feature url="features/de.darmstadt.tu.crossing.CrySL.feature_2.0.0.jar" id="de.darmstadt.tu.crossing.CrySL.feature" version="2.0.0">
12+
<feature url="features/de.darmstadt.tu.crossing.CrySL.feature_2.0.1.jar" id="de.darmstadt.tu.crossing.CrySL.feature" version="2.0.1">
1313
<category name="de.darmstadt.tu.crysl"/>
1414
</feature>
1515
<feature url="features/de.cognicrypt.core.feature_1.0.0.qualifier.jar" id="de.cognicrypt.core.feature" version="1.0.0.qualifier">

0 commit comments

Comments
 (0)