@@ -85,22 +85,18 @@ public Boolean isVulnerable() {
8585 EllipticCurve curve = CurveFactory .getCurve (config .getNamedGroup ());
8686 Point point = Point .createPoint (config .getPublicPointBaseX (), config .getPublicPointBaseY (),
8787 config .getNamedGroup ());
88- for (int i = 0 ; i < getConfig ().getProtocolFlows (); i ++) {
89- if (config .getPremasterSecret () != null ) {
90- premasterSecret = config .getPremasterSecret ();
91- } else {
92- Point sharedPoint = curve .mult (new BigInteger ("" + i + 1 ), point );
93- premasterSecret = sharedPoint .getX ().getData ();
94- if (premasterSecret == null ) {
95- premasterSecret = BigInteger .ZERO ;
96- }
97- LOGGER .debug ("PMS: " + premasterSecret .toString ());
98- }
88+
89+ int protocolFlows = getConfig ().getProtocolFlows ();
90+ if (config .getPremasterSecret () != null ) {
91+ protocolFlows = 1 ;
92+ }
93+
94+ for (int i = 0 ; i < protocolFlows ; i ++) {
95+ setPremasterSecret (curve , i , point );
9996 try {
10097 WorkflowTrace trace = executeProtocolFlow ();
10198 if (!WorkflowTraceUtil .didReceiveMessage (HandshakeMessageType .SERVER_HELLO , trace )) {
10299 LOGGER .info ("Did not receive ServerHello. Check your config" );
103-
104100 return null ;
105101 }
106102 if (!WorkflowTraceUtil .didReceiveMessage (HandshakeMessageType .FINISHED , trace )) {
@@ -116,6 +112,19 @@ public Boolean isVulnerable() {
116112 return false ;
117113 }
118114
115+ private void setPremasterSecret (EllipticCurve curve , int i , Point point ) {
116+ if (config .getPremasterSecret () != null ) {
117+ premasterSecret = config .getPremasterSecret ();
118+ } else {
119+ Point sharedPoint = curve .mult (new BigInteger ("" + (i + 1 )), point );
120+ premasterSecret = sharedPoint .getX ().getData ();
121+ if (premasterSecret == null ) {
122+ premasterSecret = BigInteger .ZERO ;
123+ }
124+ LOGGER .debug ("PMS: " + premasterSecret .toString ());
125+ }
126+ }
127+
119128 private WorkflowTrace executeProtocolFlow () {
120129 Config tlsConfig = getTlsConfig ();
121130 WorkflowTrace trace = new WorkflowConfigurationFactory (tlsConfig ).createWorkflowTrace (WorkflowTraceType .HELLO ,
0 commit comments