()
| 1217 | } |
| 1218 | |
| 1219 | func (m *certificateMsg) marshal() (x []byte) { |
| 1220 | if m.raw != nil { |
| 1221 | return m.raw |
| 1222 | } |
| 1223 | |
| 1224 | var i int |
| 1225 | for _, slice := range m.certificates { |
| 1226 | i += len(slice) |
| 1227 | } |
| 1228 | |
| 1229 | length := 3 + 3*len(m.certificates) + i |
| 1230 | x = make([]byte, 4+length) |
| 1231 | x[0] = typeCertificate |
| 1232 | x[1] = uint8(length >> 16) |
| 1233 | x[2] = uint8(length >> 8) |
| 1234 | x[3] = uint8(length) |
| 1235 | |
| 1236 | certificateOctets := length - 3 |
| 1237 | x[4] = uint8(certificateOctets >> 16) |
| 1238 | x[5] = uint8(certificateOctets >> 8) |
| 1239 | x[6] = uint8(certificateOctets) |
| 1240 | |
| 1241 | y := x[7:] |
| 1242 | for _, slice := range m.certificates { |
| 1243 | y[0] = uint8(len(slice) >> 16) |
| 1244 | y[1] = uint8(len(slice) >> 8) |
| 1245 | y[2] = uint8(len(slice)) |
| 1246 | copy(y[3:], slice) |
| 1247 | y = y[3+len(slice):] |
| 1248 | } |
| 1249 | |
| 1250 | m.raw = x |
| 1251 | return |
| 1252 | } |
| 1253 | |
| 1254 | func (m *certificateMsg) unmarshal(data []byte) bool { |
| 1255 | if len(data) < 7 { |
nothing calls this directly
no outgoing calls
no test coverage detected