Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
cd2de626
Commit
cd2de626
authored
Jun 21, 2022
by
Josh Brooks
Browse files
Options
Downloads
Patches
Plain Diff
Fix UDB login bug
parent
47a807b7
No related branches found
No related tags found
2 merge requests
!510
Release
,
!245
Josh/fix ud
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
storage/session.go
+2
-1
2 additions, 1 deletion
storage/session.go
xxdk/cmix.go
+20
-15
20 additions, 15 deletions
xxdk/cmix.go
xxdk/e2e.go
+15
-14
15 additions, 14 deletions
xxdk/e2e.go
with
37 additions
and
30 deletions
storage/session.go
+
2
−
1
View file @
cd2de626
...
...
@@ -104,7 +104,8 @@ func initStore(baseDir, password string) (*session, error) {
// Creates new UserData in the session
func
New
(
baseDir
,
password
string
,
u
user
.
Info
,
currentVersion
version
.
Version
,
cmixGrp
,
e2eGrp
*
cyclic
.
Group
)
(
Session
,
error
)
{
currentVersion
version
.
Version
,
cmixGrp
,
e2eGrp
*
cyclic
.
Group
)
(
Session
,
error
)
{
s
,
err
:=
initStore
(
baseDir
,
password
)
if
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
xxdk/cmix.go
+
20
−
15
View file @
cd2de626
...
...
@@ -167,10 +167,12 @@ func OpenCmix(storageDir string, password []byte,
// NewProtoClient_Unsafe initializes a client object from a JSON containing
// predefined cryptographic which defines a user. This is designed for some
// specific deployment procedures and is generally unsafe.
func
NewProtoClient_Unsafe
(
ndfJSON
,
storageDir
string
,
password
,
proto
ClientJSON
[]
byte
)
error
{
func
NewProtoClient_Unsafe
(
ndfJSON
,
storageDir
string
,
password
[]
byte
,
proto
User
*
user
.
Proto
)
error
{
jww
.
INFO
.
Printf
(
"NewProtoClient_Unsafe"
)
usr
:=
user
.
NewUserFromProto
(
protoUser
)
def
,
err
:=
ParseNDF
(
ndfJSON
)
if
err
!=
nil
{
return
err
...
...
@@ -178,14 +180,6 @@ func NewProtoClient_Unsafe(ndfJSON, storageDir string, password,
cmixGrp
,
e2eGrp
:=
DecodeGroups
(
def
)
protoUser
:=
&
user
.
Proto
{}
err
=
json
.
Unmarshal
(
protoClientJSON
,
protoUser
)
if
err
!=
nil
{
return
err
}
usr
:=
user
.
NewUserFromProto
(
protoUser
)
storageSess
,
err
:=
CheckVersionAndSetupStorage
(
def
,
storageDir
,
password
,
usr
,
cmixGrp
,
e2eGrp
,
protoUser
.
RegCode
)
if
err
!=
nil
{
...
...
@@ -267,7 +261,7 @@ func LoadCmix(storageDir string, password []byte, parameters Params) (*Cmix, err
// while replacing the base NDF. This is designed for some specific deployment
// procedures and is generally unsafe.
func
LoginWithNewBaseNDF_UNSAFE
(
storageDir
string
,
password
[]
byte
,
newBaseNdf
string
,
params
Params
)
(
*
Cmix
,
error
)
{
newBaseNdf
string
,
params
Params
)
(
*
E2e
,
error
)
{
jww
.
INFO
.
Printf
(
"LoginWithNewBaseNDF_UNSAFE()"
)
def
,
err
:=
ParseNDF
(
newBaseNdf
)
...
...
@@ -304,7 +298,7 @@ func LoginWithNewBaseNDF_UNSAFE(storageDir string, password []byte,
return
nil
,
err
}
return
c
,
nil
return
LoginLegacy
(
c
,
nil
)
}
// LoginWithProtoClient creates a client object with a protoclient
...
...
@@ -312,7 +306,7 @@ func LoginWithNewBaseNDF_UNSAFE(storageDir string, password []byte,
// some specific deployment procedures and is generally unsafe.
func
LoginWithProtoClient
(
storageDir
string
,
password
[]
byte
,
protoClientJSON
[]
byte
,
newBaseNdf
string
,
params
Params
)
(
*
Cmix
,
error
)
{
params
Params
)
(
*
E2e
,
error
)
{
jww
.
INFO
.
Printf
(
"LoginWithProtoClient()"
)
def
,
err
:=
ParseNDF
(
newBaseNdf
)
...
...
@@ -320,8 +314,14 @@ func LoginWithProtoClient(storageDir string, password []byte,
return
nil
,
err
}
protoUser
:=
&
user
.
Proto
{}
err
=
json
.
Unmarshal
(
protoClientJSON
,
protoUser
)
if
err
!=
nil
{
return
nil
,
err
}
err
=
NewProtoClient_Unsafe
(
newBaseNdf
,
storageDir
,
password
,
proto
ClientJSON
)
proto
User
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -356,7 +356,12 @@ func LoginWithProtoClient(storageDir string, password []byte,
return
nil
,
err
}
return
c
,
nil
return
Login
(
c
,
nil
,
ReceptionIdentity
{
ID
:
protoUser
.
ReceptionID
,
RSAPrivatePem
:
protoUser
.
ReceptionRSA
,
Salt
:
protoUser
.
ReceptionSalt
,
DHKeyPrivate
:
protoUser
.
E2eDhPrivateKey
,
})
}
func
(
c
*
Cmix
)
initComms
()
error
{
...
...
This diff is collapsed.
Click to expand it.
xxdk/e2e.go
+
15
−
14
View file @
cd2de626
...
...
@@ -146,7 +146,6 @@ func LoadOrInitE2e(client *Cmix) (e2e.Handler, error) {
e2eHandler
,
err
=
e2e
.
Load
(
kv
,
client
.
GetCmix
(),
usr
.
ReceptionID
,
e2eGrp
,
client
.
GetRng
(),
client
.
GetEventReporter
())
//if no new e2e handler exists, initialize an e2e user
if
err
!=
nil
{
jww
.
WARN
.
Printf
(
"Failed to load e2e instance for %s, "
+
"creating a new one"
,
usr
.
ReceptionID
)
...
...
@@ -233,8 +232,10 @@ func (m *E2e) ConstructProtoUserFile() ([]byte, error) {
Precanned
:
m
.
GetUser
()
.
Precanned
,
RegistrationTimestamp
:
m
.
GetUser
()
.
RegistrationTimestamp
,
RegCode
:
regCode
,
TransmissionRegValidationSig
:
m
.
GetStorage
()
.
GetTransmissionRegistrationValidationSignature
(),
ReceptionRegValidationSig
:
m
.
GetStorage
()
.
GetReceptionRegistrationValidationSignature
(),
TransmissionRegValidationSig
:
m
.
GetStorage
()
.
GetTransmissionRegistrationValidationSignature
(),
ReceptionRegValidationSig
:
m
.
GetStorage
()
.
GetReceptionRegistrationValidationSignature
(),
E2eDhPrivateKey
:
m
.
e2e
.
GetHistoricalDHPrivkey
(),
E2eDhPublicKey
:
m
.
e2e
.
GetHistoricalDHPubkey
(),
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment