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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
bd8bb2d0
Commit
bd8bb2d0
authored
3 years ago
by
Richard T. Carback III
Browse files
Options
Downloads
Patches
Plain Diff
Add more debug info
parent
1f6e3d8f
No related branches found
No related tags found
1 merge request
!23
Release
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
auth/request.go
+15
-11
15 additions, 11 deletions
auth/request.go
with
15 additions
and
11 deletions
auth/request.go
+
15
−
11
View file @
bd8bb2d0
...
@@ -61,13 +61,13 @@ func RequestAuth(partner, me contact.Contact, message string, rng io.Reader,
...
@@ -61,13 +61,13 @@ func RequestAuth(partner, me contact.Contact, message string, rng io.Reader,
"receiving a request"
)
"receiving a request"
)
}
else
if
rqType
==
auth
.
Sent
{
}
else
if
rqType
==
auth
.
Sent
{
resend
=
true
resend
=
true
}
else
{
}
else
{
return
0
,
errors
.
Errorf
(
"Cannot send a request after "
+
return
0
,
errors
.
Errorf
(
"Cannot send a request after "
+
" a stored request with unknown rqType: %d"
,
rqType
)
" a stored request with unknown rqType: %d"
,
rqType
)
}
}
}
else
if
!
strings
.
Contains
(
err
.
Error
(),
auth
.
NoRequest
){
}
else
if
!
strings
.
Contains
(
err
.
Error
(),
auth
.
NoRequest
)
{
return
0
,
errors
.
WithMessage
(
err
,
return
0
,
errors
.
WithMessage
(
err
,
"Cannot send a request after receiving unknown error "
+
"Cannot send a request after receiving unknown error "
+
"on requesting contact status"
)
"on requesting contact status"
)
}
}
...
@@ -105,11 +105,11 @@ func RequestAuth(partner, me contact.Contact, message string, rng io.Reader,
...
@@ -105,11 +105,11 @@ func RequestAuth(partner, me contact.Contact, message string, rng io.Reader,
// in this case we have an ongoing request so we can resend the extant
// in this case we have an ongoing request so we can resend the extant
// request
// request
if
resend
{
if
resend
{
newPrivKey
=
sr
.
GetMyPrivKey
()
newPrivKey
=
sr
.
GetMyPrivKey
()
newPubKey
=
sr
.
GetMyPubKey
()
newPubKey
=
sr
.
GetMyPubKey
()
//in this case it is a new request and we must generate new keys
//in this case it is a new request and we must generate new keys
}
else
{
}
else
{
//generate new keypair
//generate new keypair
newPrivKey
=
diffieHellman
.
GeneratePrivateKey
(
256
,
grp
,
rng
)
newPrivKey
=
diffieHellman
.
GeneratePrivateKey
(
256
,
grp
,
rng
)
newPubKey
=
diffieHellman
.
GeneratePublicKey
(
newPrivKey
,
grp
)
newPubKey
=
diffieHellman
.
GeneratePublicKey
(
newPrivKey
,
grp
)
...
@@ -119,8 +119,8 @@ func RequestAuth(partner, me contact.Contact, message string, rng io.Reader,
...
@@ -119,8 +119,8 @@ func RequestAuth(partner, me contact.Contact, message string, rng io.Reader,
ownership
:=
cAuth
.
MakeOwnershipProof
(
storage
.
E2e
()
.
GetDHPrivateKey
(),
ownership
:=
cAuth
.
MakeOwnershipProof
(
storage
.
E2e
()
.
GetDHPrivateKey
(),
partner
.
DhPubKey
,
storage
.
E2e
()
.
GetGroup
())
partner
.
DhPubKey
,
storage
.
E2e
()
.
GetGroup
())
jww
.
TRACE
.
Printf
(
"RequestAuth MYPUBKEY: %v"
,
newPubKey
.
Bytes
())
jww
.
INFO
.
Printf
(
"RequestAuth MYPUBKEY: %v"
,
newPubKey
.
Bytes
())
jww
.
TRACE
.
Printf
(
"RequestAuth THEIRPUBKEY: %v"
,
partner
.
DhPubKey
.
Bytes
())
jww
.
INFO
.
Printf
(
"RequestAuth THEIRPUBKEY: %v"
,
partner
.
DhPubKey
.
Bytes
())
/*encrypt payload*/
/*encrypt payload*/
requestFmt
.
SetID
(
storage
.
GetUser
()
.
ReceptionID
)
requestFmt
.
SetID
(
storage
.
GetUser
()
.
ReceptionID
)
...
@@ -140,10 +140,14 @@ func RequestAuth(partner, me contact.Contact, message string, rng io.Reader,
...
@@ -140,10 +140,14 @@ func RequestAuth(partner, me contact.Contact, message string, rng io.Reader,
cmixMsg
.
SetMac
(
mac
)
cmixMsg
.
SetMac
(
mac
)
cmixMsg
.
SetContents
(
baseFmt
.
Marshal
())
cmixMsg
.
SetContents
(
baseFmt
.
Marshal
())
jww
.
INFO
.
Printf
(
"RequestAuth SALT: %v"
,
salt
)
jww
.
INFO
.
Printf
(
"RequestAuth ECRPAYLOAD: %v"
,
baseFmt
.
GetEcrPayload
())
jww
.
INFO
.
Printf
(
"RequestAuth MAC: %v"
,
mac
)
/*store state*/
/*store state*/
//fixme: channel is bricked if the first store succedes but the second fails
//fixme: channel is bricked if the first store succedes but the second fails
//store the in progress auth
//store the in progress auth
if
!
resend
{
if
!
resend
{
err
=
storage
.
Auth
()
.
AddSent
(
partner
.
ID
,
partner
.
DhPubKey
,
newPrivKey
,
err
=
storage
.
Auth
()
.
AddSent
(
partner
.
ID
,
partner
.
DhPubKey
,
newPrivKey
,
newPrivKey
,
confirmFp
)
newPrivKey
,
confirmFp
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -160,7 +164,7 @@ func RequestAuth(partner, me contact.Contact, message string, rng io.Reader,
...
@@ -160,7 +164,7 @@ func RequestAuth(partner, me contact.Contact, message string, rng io.Reader,
if
err
!=
nil
{
if
err
!=
nil
{
// if the send fails just set it to failed, it will
// if the send fails just set it to failed, it will
// but automatically retried
// but automatically retried
return
0
,
errors
.
WithMessagef
(
err
,
"Auth Request with %s "
+
return
0
,
errors
.
WithMessagef
(
err
,
"Auth Request with %s "
+
"(msgDigest: %s) failed to transmit: %+v"
,
partner
.
ID
,
"(msgDigest: %s) failed to transmit: %+v"
,
partner
.
ID
,
cmixMsg
.
Digest
(),
err
)
cmixMsg
.
Digest
(),
err
)
}
}
...
...
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