func (jv *JVSS) handleSecInit(m WSecInitMsg) error { msg := m.SecInitMsg // Initialise shared secret if err := jv.initSecret(msg.SID); err != nil { return err } // Unmarshal received deal deal := new(poly.Deal).UnmarshalInit(jv.info.T, jv.info.R, jv.info.N, jv.keyPair.Suite) if err := deal.UnmarshalBinary(msg.Deal); err != nil { return err } // Buffer received deal for later secret, ok := jv.secrets[msg.SID] if !ok { return fmt.Errorf("Error, shared secret does not exist") } secret.deals[msg.Src] = deal // Finalise shared secret if err := jv.finaliseSecret(msg.SID); err != nil { return err } return nil }
func (jv *JVSS) handleSecInit(m WSecInitMsg) error { msg := m.SecInitMsg log.Lvl4(jv.Name(), jv.Index(), "Received SecInit from", m.TreeNode.Name()) // Initialise shared secret if err := jv.initSecret(msg.SID); err != nil { return err } // Unmarshal received deal deal := new(poly.Deal).UnmarshalInit(jv.info.T, jv.info.R, jv.info.N, jv.keyPair.Suite) if err := deal.UnmarshalBinary(msg.Deal); err != nil { return err } // Buffer received deal for later secret, err := jv.secrets.secret(msg.SID) if err != nil { return err } secret.deals[msg.Src] = deal // Finalise shared secret if err := jv.finaliseSecret(msg.SID); err != nil { log.Error(jv.Index(), err) return err } log.Lvl4("Finished handleSecInit", jv.Name(), msg.SID) return nil }