From 23609d60e4dd61bd11d0911dc660d7719c91f917 Mon Sep 17 00:00:00 2001 From: Letitia Li <leli@enst.fr> Date: Fri, 15 Apr 2016 11:42:59 +0000 Subject: [PATCH] security pattern changes --- src/tmltranslator/TMLMapping.java | 2 +- src/tmltranslator/TMLModeling.java | 2 +- src/tmltranslator/toavatar/TML2Avatar.java | 13 +++---------- src/ui/GTMLModeling.java | 2 -- src/ui/tmlad/TMLADReadChannel.java | 2 +- src/ui/tmlad/TMLADWriteChannel.java | 2 +- src/ui/tmlcompd/TMLCPrimitivePort.java | 12 ++++++------ 7 files changed, 13 insertions(+), 22 deletions(-) diff --git a/src/tmltranslator/TMLMapping.java b/src/tmltranslator/TMLMapping.java index 127ae3fc83..ca41c09728 100755 --- a/src/tmltranslator/TMLMapping.java +++ b/src/tmltranslator/TMLMapping.java @@ -61,7 +61,7 @@ public List<String> securityPatterns = new ArrayList<String>(); private ArrayList<HwExecutionNode> onnodes; private ArrayList<TMLTask> mappedtasks; private ArrayList<HwCommunicationNode> oncommnodes; - private ArrayList<TMLElement> mappedcommelts; + public ArrayList<TMLElement> mappedcommelts; private ArrayList<TMLCP> mappedCPs; private ArrayList<TMLElement> commEltsMappedOnCPs; diff --git a/src/tmltranslator/TMLModeling.java b/src/tmltranslator/TMLModeling.java index 0bc9fc62b4..3ab1d08bda 100755 --- a/src/tmltranslator/TMLModeling.java +++ b/src/tmltranslator/TMLModeling.java @@ -1628,7 +1628,7 @@ public class TMLModeling { if ((elt0 instanceof TMLExecC) && (elt0.getNbNext() == 1)) { elt1 = elt0.getNextElement(0); - if (elt1 instanceof TMLExecC) { + if (elt1 instanceof TMLExecC && ((TMLExecC)elt1).securityPattern==null) { // Concate both elements concateActivityElementWithActions(activity, (TMLActivityElementWithAction)elt0, (TMLActivityElementWithAction)elt1); diff --git a/src/tmltranslator/toavatar/TML2Avatar.java b/src/tmltranslator/toavatar/TML2Avatar.java index ccf91a5ef8..f263988fa9 100644 --- a/src/tmltranslator/toavatar/TML2Avatar.java +++ b/src/tmltranslator/toavatar/TML2Avatar.java @@ -95,6 +95,7 @@ public class TML2Avatar { List<String> allStates; public TML2Avatar(TMLMapping tmlmap) { this.tmlmap = tmlmap; + System.out.println(tmlmap.mappedcommelts); this.tmlmodel = tmlmap.getTMLModeling(); allStates = new ArrayList<String>(); attrsToCheck=new ArrayList<String>(); @@ -192,7 +193,6 @@ public class TML2Avatar { List<HwBus> buses = new ArrayList<HwBus>(); HwNode node2 = tmlmap.getHwNodeOf(t); if (node1==node2){ - // System.out.println("Channel "+channel.getName() + " between Task "+ a.getTaskName() + " and Task " + t.getTaskName() + " is confidential"); channelMap.put(channel, channelPrivate); } if (node1!=node2){ @@ -662,8 +662,7 @@ public class TML2Avatar { sencrypt.addParameter(block.getAvatarAttributeWithName("key")); block.addMethod(sencrypt); tran.addAction(ae.securityPattern.name+"_encrypted = sencrypt("+ae.securityPattern.name+", key)"); - System.out.println("ADDING ACTION ENCRYPT"); - System.out.println("Found security pattern "+ae.securityPattern.name); + ae.securityPattern.originTask=block.getName(); ae.securityPattern.state1=as; AvatarAttributeState authOrigin = new AvatarAttributeState(ae.securityPattern.name+"1",ae.getReferenceObject(),block.getAvatarAttributeWithName(ae.securityPattern.name), as); @@ -686,11 +685,7 @@ public class TML2Avatar { tran.addAction(ae.securityPattern.name+" = sdecrypt("+ae.securityPattern.name+"_encrypted, key)"); - - System.out.println("ADDING ACTION DECRYPT"); ae.securityPattern.state2=as; - System.out.println("Found security pattern decrypt "+ae.securityPattern.name); - elementList.add(as); elementList.add(tran); as.addNext(tran); @@ -742,7 +737,6 @@ public class TML2Avatar { if (ae.securityPattern!=null){ secChannelMap.put(ae.securityPattern.name,ch.getName()); - System.out.println(block.getName() + " readchannel has security pattern" + ae.securityPattern.name); as.addValue(ae.securityPattern.name+"_encrypted"); AvatarAttribute data= new AvatarAttribute(ae.securityPattern.name+"_encrypted", AvatarType.INTEGER, block, null); block.addAttribute(data); @@ -809,14 +803,13 @@ public class TML2Avatar { AvatarActionOnSignal as = new AvatarActionOnSignal(ae.getName(), sig, ae.getReferenceObject()); if (ae.securityPattern!=null){ - System.out.println(block.getName() + " writechannel has security pattern " + ae.securityPattern.name); as.addValue(ae.securityPattern.name+"_encrypted"); AvatarAttribute data= new AvatarAttribute(ae.securityPattern.name+"_encrypted", AvatarType.INTEGER, block, null); block.addAttribute(data); secChannelMap.put(ae.securityPattern.name,ch.getName()); } else { - System.out.println(block.getName() + " writechannel has no security pattern "); + //No security pattern as.addValue(ch.getName()+"__chData"); } diff --git a/src/ui/GTMLModeling.java b/src/ui/GTMLModeling.java index f0628ec670..f97abeb651 100755 --- a/src/ui/GTMLModeling.java +++ b/src/ui/GTMLModeling.java @@ -1945,8 +1945,6 @@ public class GTMLModeling { tmlwritechannel.addChannel(channel); } //add sec pattern - System.out.println("All security patterns "+securityPatterns); - System.out.println(((TMLADWriteChannel)tgc).securityContext); if (securityPatterns.get(((TMLADWriteChannel)tgc).securityContext)!=null){ System.out.println("Security context "+((TMLADWriteChannel)tgc).securityContext+"!"); tmlwritechannel.securityPattern= securityPatterns.get(((TMLADWriteChannel)tgc).securityContext); diff --git a/src/ui/tmlad/TMLADReadChannel.java b/src/ui/tmlad/TMLADReadChannel.java index b7ce127d18..24b4b6fb20 100755 --- a/src/ui/tmlad/TMLADReadChannel.java +++ b/src/ui/tmlad/TMLADReadChannel.java @@ -150,7 +150,7 @@ public class TMLADReadChannel extends TGCWithoutInternalComponent implements Che g.drawString(value, x + linebreak + textX0, y + textY1); if (!securityContext.equals("")){ - g.drawString("sec:"+securityContext, x+width/2, y+height+textY1); + g.drawString("sec:"+securityContext, x+3*width/4, y+height+textY1); } drawReachabilityInformation(g); diff --git a/src/ui/tmlad/TMLADWriteChannel.java b/src/ui/tmlad/TMLADWriteChannel.java index 7d4bb51fb8..12a637aa86 100755 --- a/src/ui/tmlad/TMLADWriteChannel.java +++ b/src/ui/tmlad/TMLADWriteChannel.java @@ -148,7 +148,7 @@ public class TMLADWriteChannel extends TGCWithoutInternalComponent implements Ch g.drawString("chl", x+(width-w) / 2, y); g.drawString(value, x + (width - w) / 2 , y + textY); if (!securityContext.equals("")){ - g.drawString("sec:"+securityContext, x+width/2, y+height+textY); + g.drawString("sec:"+securityContext, x+3*width/4, y+height+textY); } drawReachabilityInformation(g); diff --git a/src/ui/tmlcompd/TMLCPrimitivePort.java b/src/ui/tmlcompd/TMLCPrimitivePort.java index a3b78f1f89..9fb3fb5b7c 100755 --- a/src/ui/tmlcompd/TMLCPrimitivePort.java +++ b/src/ui/tmlcompd/TMLCPrimitivePort.java @@ -322,7 +322,7 @@ public abstract class TMLCPrimitivePort extends TGCScalableWithInternalComponent public void drawAuthVerification(Graphics g){ - g.drawString(secName, x-20, y+8); + g.drawString(secName, x-20, y+10); Color c = g.getColor(); Color c1; Color c2; @@ -347,12 +347,12 @@ public abstract class TMLCPrimitivePort extends TGCScalableWithInternalComponent c2= c1; } - g.drawOval(x-18, y+8, 10, 15); + g.drawOval(x-18, y+12, 10, 15); g.setColor(c1); int[] xps = new int[]{x-20, x-20, x-4}; - int[] yps = new int[]{y+14, y+28, y+28}; + int[] yps = new int[]{y+18, y+32, y+32}; int[] xpw = new int[]{x-4, x-4, x-20}; - int[] ypw = new int[]{y+28, y+14, y+14}; + int[] ypw = new int[]{y+32, y+18, y+18}; g.fillPolygon(xps, yps,3); g.setColor(c2); @@ -360,8 +360,8 @@ public abstract class TMLCPrimitivePort extends TGCScalableWithInternalComponent g.setColor(c); g.drawPolygon(xps, yps,3); g.drawPolygon(xpw, ypw, 3); - g.drawString("S", x-18, y+26); - g.drawString("W", x-11, y+22); + g.drawString("S", x-18, y+30); + g.drawString("W", x-11, y+26); } public void drawConfVerification(Graphics g){ Color c = g.getColor(); -- GitLab