Skip to content
Snippets Groups Projects
Commit a914d073 authored by Malte Bauch's avatar Malte Bauch
Browse files

Add to remoteKMSMapping if remot kms information is present

See merge request !84
parent 67b80b3b
Branches
No related tags found
1 merge request!84Add to remoteKMSMapping if remot kms information is present
Pipeline #188441 passed
......@@ -226,6 +226,14 @@ func (kms *EKMS) AssignForwardingRoute(pId, pHop, nHop string, remoteKMS *Remote
kms.routingTable[pathId] = tmpRoute
kms.routingTableMutex.Unlock()
if tmpRoute.RemoteKMS != nil {
kms.remoteKMSMappingMutex.Lock()
if _, ok := kms.remoteKMSMapping[tmpRoute.RemoteKMS.Id]; !ok {
kms.remoteKMSMapping[tmpRoute.RemoteKMS.Id] = tmpRoute.RemoteKMS
}
kms.remoteKMSMappingMutex.Unlock()
}
if tmpRoute.Previous == nil && tmpRoute.Next != nil && tmpRoute.RemoteKMS != nil {
// generate pk key
pk, err := crypto.Random256BitKey()
......@@ -242,12 +250,6 @@ func (kms *EKMS) AssignForwardingRoute(pId, pHop, nHop string, remoteKMS *Remote
return err
}
kms.remoteKMSMappingMutex.Lock()
if _, ok := kms.remoteKMSMapping[tmpRoute.RemoteKMS.Id]; !ok {
kms.remoteKMSMapping[tmpRoute.RemoteKMS.Id] = tmpRoute.RemoteKMS
}
kms.remoteKMSMappingMutex.Unlock()
// update PKStore
kms.PKStoreMutex.Lock()
keys, ok := kms.PKStore[tmpRoute.RemoteKMS.Id]
......
......@@ -255,11 +255,6 @@ func (s *kmsTalkerServer) KeyForwarding(ctx context.Context, in *pb.KeyForwardin
}, pathId, processId)
} else {
log.Infof("%s received the final payload: %s", s.eKMS.kmsName, string(decryptedKey))
s.eKMS.remoteKMSMappingMutex.Lock()
if _, ok := s.eKMS.remoteKMSMapping[route.RemoteKMS.Id]; !ok {
s.eKMS.remoteKMSMapping[route.RemoteKMS.Id] = route.RemoteKMS
}
s.eKMS.remoteKMSMappingMutex.Unlock()
s.eKMS.PKStoreMutex.Lock()
keys, ok := s.eKMS.PKStore[route.RemoteKMS.Id]
if !ok {
......
......@@ -218,7 +218,7 @@ type ETSI014HTTPQuantumModule struct {
}
func NewETSI014HTTPQuantumModule(addr, kmsId, slaveSAEID, masterSAEID string, master bool) (*ETSI014HTTPQuantumModule, error) {
parsedUrl, err := url.Parse("http://" + addr)
parsedUrl, err := url.Parse(addr)
if err != nil {
return nil, err
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment