(session, s)
| 133 | name: "handshakeProtocol", |
| 134 | |
| 135 | unpacketize(session, s) { |
| 136 | session.traceProtocol(this); |
| 137 | let tbuf = new Uint8Array(4); |
| 138 | tbuf[0] = s.readChar(0); // msgType |
| 139 | let body = s.readChars(3); |
| 140 | body = body > 0 ? s.readChunk(body, true) : undefined; |
| 141 | switch (tbuf[0]) { |
| 142 | case 0 /* hello_request */: |
| 143 | s = this.helloRequest; |
| 144 | break; |
| 145 | case 1 /* client_hello */: |
| 146 | s = this.clientHello; |
| 147 | break; |
| 148 | case 2 /* server_hello */: |
| 149 | s = this.serverHello; |
| 150 | break; |
| 151 | case 11 /* certificate */: |
| 152 | s = this.certificate; |
| 153 | break; |
| 154 | case 12 /* server_key_exchange */: |
| 155 | s = this.serverKeyExchange; |
| 156 | break; |
| 157 | case 13 /* certificate_request */: |
| 158 | s = this.certificateRequest; |
| 159 | break; |
| 160 | case 14 /* server_hello_done */: |
| 161 | s = this.serverHelloDone; |
| 162 | break; |
| 163 | case 15 /* certificate_verify */: |
| 164 | s = this.certificateVerify; |
| 165 | break; |
| 166 | case 16 /* client_key_exchange */: |
| 167 | s = this.clientKeyExchange; |
| 168 | break; |
| 169 | case 20 /* finished */: |
| 170 | s = this.finished; |
| 171 | break; |
| 172 | default: |
| 173 | throw new TLSError("handshake: unknown type: " + tbuf[0]); |
| 174 | } |
| 175 | s.unpacketize(session, body ? new SSLStream(body) : undefined); |
| 176 | |
| 177 | session.handshakeProcess = tbuf[0]; |
| 178 | |
| 179 | // update the digest of the whole handshake message |
| 180 | if (body) { |
| 181 | tbuf[1] = body.byteLength >>> 16; |
| 182 | tbuf[2] = body.byteLength >>> 8; |
| 183 | tbuf[3] = body.byteLength; |
| 184 | } |
| 185 | |
| 186 | handshakeDigestUpdate(session, tbuf.buffer); |
| 187 | if (body) |
| 188 | handshakeDigestUpdate(session, body); |
| 189 | }, |
| 190 | packetize(session, msgType, body) { |
| 191 | session.traceProtocol(this); |
| 192 | body = body.getChunk(); |
nothing calls this directly
no test coverage detected