return ErrKeysDropped when sealer keys were already dropped

This commit is contained in:
Marten Seemann
2019-06-25 13:38:11 +08:00
parent 1e148c20c5
commit acba7d4e77

View File

@@ -551,6 +551,9 @@ func (h *cryptoSetup) GetInitialSealer() (LongHeaderSealer, error) {
h.mutex.Lock() h.mutex.Lock()
defer h.mutex.Unlock() defer h.mutex.Unlock()
if h.initialSealer == nil {
return nil, ErrKeysDropped
}
return h.initialSealer, nil return h.initialSealer, nil
} }
@@ -559,6 +562,9 @@ func (h *cryptoSetup) GetHandshakeSealer() (LongHeaderSealer, error) {
defer h.mutex.Unlock() defer h.mutex.Unlock()
if h.handshakeSealer == nil { if h.handshakeSealer == nil {
if h.initialSealer == nil {
return nil, ErrKeysDropped
}
return nil, errors.New("CryptoSetup: no sealer with encryption level Handshake") return nil, errors.New("CryptoSetup: no sealer with encryption level Handshake")
} }
return h.handshakeSealer, nil return h.handshakeSealer, nil