simplify the CryptoSetup.SetDiversificationNonce interface

Pass the diversification nonce via a channel instead of setting it
directly. That way there is no need to protect the diversificationNonce
member by a mutex. Also prevents a possible deadlock that occurred when
SetDiversificationNonce was called before maybeUpgradeCrypto returned.
This commit is contained in:
Marten Seemann
2017-05-11 10:15:47 +08:00
parent 8c4fe4ff80
commit adc4ef464a
6 changed files with 39 additions and 44 deletions

View File

@@ -435,7 +435,7 @@ func (h *cryptoSetupServer) DiversificationNonce() []byte {
return h.diversificationNonce
}
func (h *cryptoSetupServer) SetDiversificationNonce(data []byte) error {
func (h *cryptoSetupServer) SetDiversificationNonce(data []byte) {
panic("not needed for cryptoSetupServer")
}