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
6db7df70
Commit
6db7df70
authored
Jul 12, 2021
by
Benjamin Wenger
Browse files
Options
Downloads
Plain Diff
Merge branch 'hotfix/sentRequest' into 'release'
Fix bug with SentRequest See merge request
!639
parents
9a8efb99
9a398006
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!23
Release
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
auth/callback.go
+10
-3
10 additions, 3 deletions
auth/callback.go
auth/request.go
+5
-1
5 additions, 1 deletion
auth/request.go
storage/auth/sentRequest.go
+29
-5
29 additions, 5 deletions
storage/auth/sentRequest.go
with
44 additions
and
9 deletions
auth/callback.go
+
10
−
3
View file @
6db7df70
...
...
@@ -91,12 +91,16 @@ func (m *Manager) handleRequest(cmixMsg format.Message,
jww
.
TRACE
.
Printf
(
"handleRequest PARTNERPUBKEY: %v"
,
partnerPubKey
.
Bytes
())
//decrypt the message
jww
.
TRACE
.
Printf
(
"handleRequest SALT: %v"
,
baseFmt
.
GetSalt
())
jww
.
TRACE
.
Printf
(
"handleRequest ECRPAYLOAD: %v"
,
baseFmt
.
GetEcrPayload
())
jww
.
TRACE
.
Printf
(
"handleRequest MAC: %v"
,
cmixMsg
.
GetMac
())
success
,
payload
:=
cAuth
.
Decrypt
(
myHistoricalPrivKey
,
partnerPubKey
,
baseFmt
.
GetSalt
(),
baseFmt
.
GetEcrPayload
(),
cmixMsg
.
GetMac
(),
grp
)
if
!
success
{
jww
.
WARN
.
Printf
(
"Rec
i
eved auth request failed "
+
jww
.
WARN
.
Printf
(
"Rece
i
ved auth request failed "
+
"its mac check"
)
return
}
...
...
@@ -151,7 +155,7 @@ func (m *Manager) handleRequest(cmixMsg format.Message,
switch
rType
{
// if this is a duplicate, ignore the message
case
auth
.
Receive
:
jww
.
WARN
.
Printf
(
"Rec
i
eved new Auth request for %s, "
+
jww
.
WARN
.
Printf
(
"Rece
i
ved new Auth request for %s, "
+
"is a duplicate"
,
partnerID
)
return
// if we sent a request, then automatically confirm
...
...
@@ -230,12 +234,15 @@ func (m *Manager) handleConfirm(cmixMsg format.Message, sr *auth.SentRequest,
jww
.
TRACE
.
Printf
(
"handleConfirm SRMYPUBKEY: %v"
,
sr
.
GetMyPubKey
()
.
Bytes
())
// decrypt the payload
jww
.
TRACE
.
Printf
(
"handleConfirm SALT: %v"
,
baseFmt
.
GetSalt
())
jww
.
TRACE
.
Printf
(
"handleConfirm ECRPAYLOAD: %v"
,
baseFmt
.
GetEcrPayload
())
jww
.
TRACE
.
Printf
(
"handleConfirm MAC: %v"
,
cmixMsg
.
GetMac
())
success
,
payload
:=
cAuth
.
Decrypt
(
sr
.
GetMyPrivKey
(),
partnerPubKey
,
baseFmt
.
GetSalt
(),
baseFmt
.
GetEcrPayload
(),
cmixMsg
.
GetMac
(),
grp
)
if
!
success
{
jww
.
WARN
.
Printf
(
"Rec
i
eved auth confirmation failed its mac "
+
jww
.
WARN
.
Printf
(
"Rece
i
ved auth confirmation failed its mac "
+
"check"
)
m
.
storage
.
Auth
()
.
Done
(
sr
.
GetPartner
())
return
...
...
This diff is collapsed.
Click to expand it.
auth/request.go
+
5
−
1
View file @
6db7df70
...
...
@@ -140,12 +140,16 @@ func RequestAuth(partner, me contact.Contact, message string, rng io.Reader,
cmixMsg
.
SetMac
(
mac
)
cmixMsg
.
SetContents
(
baseFmt
.
Marshal
())
jww
.
TRACE
.
Printf
(
"RequestAuth SALT: %v"
,
salt
)
jww
.
TRACE
.
Printf
(
"RequestAuth ECRPAYLOAD: %v"
,
baseFmt
.
GetEcrPayload
())
jww
.
TRACE
.
Printf
(
"RequestAuth MAC: %v"
,
mac
)
/*store state*/
//fixme: channel is bricked if the first store succedes but the second fails
//store the in progress auth
if
!
resend
{
err
=
storage
.
Auth
()
.
AddSent
(
partner
.
ID
,
partner
.
DhPubKey
,
newPrivKey
,
newP
riv
Key
,
confirmFp
)
newP
ub
Key
,
confirmFp
)
if
err
!=
nil
{
return
0
,
errors
.
Errorf
(
"Failed to store auth request: %s"
,
err
)
}
...
...
This diff is collapsed.
Click to expand it.
storage/auth/sentRequest.go
+
29
−
5
View file @
6db7df70
...
...
@@ -8,8 +8,10 @@
package
auth
import
(
"encoding/hex"
"encoding/json"
"github.com/pkg/errors"
jww
"github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/storage/versioned"
"gitlab.com/elixxir/crypto/cyclic"
"gitlab.com/elixxir/primitives/format"
...
...
@@ -51,8 +53,8 @@ func loadSentRequest(kv *versioned.KV, partner *id.ID, grp *cyclic.Group) (*Sent
"SentRequest Auth with %s"
,
partner
)
}
historicalP
riv
Key
:=
grp
.
NewInt
(
1
)
if
err
=
historicalP
riv
Key
.
GobDecode
(
srd
.
PartnerHistoricalPubKey
);
err
!=
nil
{
historicalP
ub
Key
:=
grp
.
NewInt
(
1
)
if
err
=
historicalP
ub
Key
.
GobDecode
(
srd
.
PartnerHistoricalPubKey
);
err
!=
nil
{
return
nil
,
errors
.
WithMessagef
(
err
,
"Failed to decode historical "
+
"private key with %s for SentRequest Auth"
,
partner
)
}
...
...
@@ -72,10 +74,21 @@ func loadSentRequest(kv *versioned.KV, partner *id.ID, grp *cyclic.Group) (*Sent
fp
:=
format
.
Fingerprint
{}
copy
(
fp
[
:
],
srd
.
Fingerprint
)
jww
.
INFO
.
Printf
(
"loadSentRequest partner: %s"
,
hex
.
EncodeToString
(
partner
[
:
]))
jww
.
INFO
.
Printf
(
"loadSentRequest historicalPubKey: %s"
,
hex
.
EncodeToString
(
historicalPubKey
.
Bytes
()))
jww
.
INFO
.
Printf
(
"loadSentRequest myPrivKey: %s"
,
hex
.
EncodeToString
(
myPrivKey
.
Bytes
()))
jww
.
INFO
.
Printf
(
"loadSentRequest myPubKey: %s"
,
hex
.
EncodeToString
(
myPubKey
.
Bytes
()))
jww
.
INFO
.
Printf
(
"loadSentRequest fingerprint: %s"
,
hex
.
EncodeToString
(
fp
[
:
]))
return
&
SentRequest
{
kv
:
kv
,
partner
:
partner
,
partnerHistoricalPubKey
:
historicalP
riv
Key
,
partnerHistoricalPubKey
:
historicalP
ub
Key
,
myPrivKey
:
myPrivKey
,
myPubKey
:
myPubKey
,
fingerprint
:
fp
,
...
...
@@ -93,13 +106,24 @@ func (sr *SentRequest) save() error {
return
err
}
historicalP
riv
Key
,
err
:=
sr
.
partnerHistoricalPubKey
.
GobEncode
()
historicalP
ub
Key
,
err
:=
sr
.
partnerHistoricalPubKey
.
GobEncode
()
if
err
!=
nil
{
return
err
}
jww
.
INFO
.
Printf
(
"saveSentRequest partner: %s"
,
hex
.
EncodeToString
(
sr
.
partner
[
:
]))
jww
.
INFO
.
Printf
(
"saveSentRequest historicalPubKey: %s"
,
hex
.
EncodeToString
(
sr
.
partnerHistoricalPubKey
.
Bytes
()))
jww
.
INFO
.
Printf
(
"saveSentRequest myPrivKey: %s"
,
hex
.
EncodeToString
(
sr
.
myPrivKey
.
Bytes
()))
jww
.
INFO
.
Printf
(
"saveSentRequest myPubKey: %s"
,
hex
.
EncodeToString
(
sr
.
myPubKey
.
Bytes
()))
jww
.
INFO
.
Printf
(
"saveSentRequest fingerprint: %s"
,
hex
.
EncodeToString
(
sr
.
fingerprint
[
:
]))
ipd
:=
sentRequestDisk
{
PartnerHistoricalPubKey
:
historicalP
riv
Key
,
PartnerHistoricalPubKey
:
historicalP
ub
Key
,
MyPrivKey
:
privKey
,
MyPubKey
:
pubKey
,
Fingerprint
:
sr
.
fingerprint
[
:
],
...
...
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