Skip to content

Commit

Permalink
Fix segfault when seal block is removed (#8517)
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalnayak committed Apr 14, 2020
1 parent b98401d commit bb4b2b0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions command/server_util.go
Expand Up @@ -103,17 +103,17 @@ func adjustCoreForSealMigration(logger log.Logger, core *vault.Core, barrierSeal

// Set the appropriate barrier and recovery configs.
switch {
case migrationSeal.RecoveryKeySupported() && newSeal.RecoveryKeySupported():
case migrationSeal != nil && newSeal != nil && migrationSeal.RecoveryKeySupported() && newSeal.RecoveryKeySupported():
// Migrating from auto->auto, copy the configs over
newSeal.SetCachedBarrierConfig(existBarrierSealConfig)
newSeal.SetCachedRecoveryConfig(existRecoverySealConfig)
case migrationSeal.RecoveryKeySupported():
case migrationSeal != nil && newSeal != nil && migrationSeal.RecoveryKeySupported():
// Migrating from auto->shamir, clone auto's recovery config and set
// stored keys to 1.
newSealConfig := existRecoverySealConfig.Clone()
newSealConfig.StoredShares = 1
newSeal.SetCachedBarrierConfig(newSealConfig)
case newSeal.RecoveryKeySupported():
case newSeal != nil && newSeal.RecoveryKeySupported():
// Migrating from shamir->auto, set a new barrier config and set
// recovery config to a clone of shamir's barrier config with stored
// keys set to 0.
Expand Down

0 comments on commit bb4b2b0

Please sign in to comment.