/** * Change the authorization protocol being used to receive messages on the connection. This * routine must be called when the RecvThread is synchronized with the Vat thread. This assertion * is checked by setting myChangeProtocolIsOk just before calling into the Vat with a new incoming * message and resetting it when the call returns. This routine will throw an Assertion failure if * that boolean is not true. * * @param protocolParms is the parameter bundle for the protocol suite to use. This routine must, * of course, support the selected suite. */ void changeProtocol(AuthSecrets protocolParms) { if (Trace.comm.verbose && Trace.ON) { Trace.comm.verbosem("ProtocolChange, pp=" + protocolParms); } T.require( myChangeProtocolIsOk, "Must only be called while caller " + "is processing an input message"); // For calculating the header length int headerLengthIndex = HEADER_INVALID; if (StartUpProtocol.PROTO_NONE.equals(protocolParms.myProtocolSuite)) { myIsAggragating = false; myIsDoingMac = false; mySequence = null; headerLengthIndex = HEADER_INT_LENGTH; // begin daffE -> E } else if (StartUpProtocol.PROTO_3DES_SDH_M.equals(protocolParms.myProtocolSuite)) { myIsAggragating = true; MessageDigest md5 = setSHA1(protocolParms); headerLengthIndex = HEADER_VLEN_SHA1; mySequence = null; byte[] raw_3des_key = TripleDESKeyConstructor.make(protocolParms.myDHSecret); myTransform = new Decrypt3DES(raw_3des_key, protocolParms.myIncomingSequence); // end daffE -> E // begin improved E protocol } else if (StartUpProtocol.PROTO_3DES_SDH_M2.equals(protocolParms.myProtocolSuite)) { myIsAggragating = true; MessageDigest md5 = setSHA1(protocolParms); headerLengthIndex = HEADER_VLEN_HMAC; mySequence = new byte[4]; // Assume initialized to zero byte[] raw_3des_key = TripleDESKeyConstructor.make(protocolParms.myDHSecret); myTransform = new Decrypt3DES(raw_3des_key, protocolParms.myIncomingSequence); myTransform.init(); myIsStandardCBC = true; myIsDoingHMAC = true; // end improved E protocol } else { T.fail("Invalid protocol type " + protocolParms); } myIsCompressingMsgLengths = myIsAggragating; int len = theHeaderLengths[headerLengthIndex]; T.require(0 <= len, "Invalid header length code"); myHeader = new byte[len]; }