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
bce4a56f
Commit
bce4a56f
authored
Dec 19, 2021
by
Richard T. Carback III
Browse files
Options
Downloads
Patches
Plain Diff
Fix callback logic per conversation with ben
parent
dfb66f11
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!117
Release
,
!73
Quantum secure xx messenger key negotiation
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
auth/callback.go
+56
-22
56 additions, 22 deletions
auth/callback.go
with
56 additions
and
22 deletions
auth/callback.go
+
56
−
22
View file @
bce4a56f
...
@@ -26,7 +26,6 @@ import (
...
@@ -26,7 +26,6 @@ import (
"gitlab.com/elixxir/primitives/fact"
"gitlab.com/elixxir/primitives/fact"
"gitlab.com/elixxir/primitives/format"
"gitlab.com/elixxir/primitives/format"
"strings"
"strings"
util
"gitlab.com/elixxir/client/storage/utility"
"gitlab.com/elixxir/crypto/fastRNG"
"gitlab.com/elixxir/crypto/fastRNG"
"gitlab.com/xx_network/crypto/csprng"
"gitlab.com/xx_network/crypto/csprng"
)
)
...
@@ -181,31 +180,66 @@ func (m *Manager) handleRequest(cmixMsg format.Message,
...
@@ -181,31 +180,66 @@ func (m *Manager) handleRequest(cmixMsg format.Message,
jww
.
INFO
.
Printf
(
"Received AuthRequest from %s,"
+
jww
.
INFO
.
Printf
(
"Received AuthRequest from %s,"
+
" msgDigest: %s which has been requested, auto-confirming"
,
" msgDigest: %s which has been requested, auto-confirming"
,
partnerID
,
cmixMsg
.
Digest
())
partnerID
,
cmixMsg
.
Digest
())
// Note that our sent request SIDH key needs to
// change to be compatible
// Verify this request is legit
ownership
:=
ecrFmt
.
GetOwnership
()
if
!
cAuth
.
VerifyOwnershipProof
(
myHistoricalPrivKey
,
partnerPubKey
,
grp
,
ownership
)
{
jww
.
WARN
.
Printf
(
"Invalid ownership proof from %s received, discarding msdDigest: %s"
,
partnerID
,
cmixMsg
.
Digest
())
}
// Check if I need to resend by comparing the
// SIDH Keys
mySIDH
:=
sr2
.
GetMySIDHPubKey
()
theirSIDH
:=
partnerSIDHPubKey
myBytes
:=
make
([]
byte
,
mySIDH
.
Size
())
theirBytes
:=
make
([]
byte
,
theirSIDH
.
Size
())
mySIDH
.
Export
(
myBytes
)
theirSIDH
.
Export
(
theirBytes
)
for
i
:=
0
;
i
<
len
(
myBytes
);
i
++
{
if
myBytes
[
i
]
>
theirBytes
[
i
]
{
// OK, this side is dropping
// the request
// Do we need to delete
// something here?
// No, because we will
// now wait to receive
// confirmation.
return
}
else
if
myBytes
[
i
]
<
theirBytes
[
i
]
{
break
}
}
// If I do, delete my request on disk
_
,
_
,
partnerContact
,
_
:=
m
.
storage
.
Auth
()
.
GetRequest
(
partnerID
)
m
.
storage
.
Auth
()
.
Delete
(
partnerID
)
// add a confirmation to disk
if
err
=
m
.
storage
.
Auth
()
.
AddReceived
(
partnerContact
,
partnerSIDHPubKey
);
err
!=
nil
{
em
:=
fmt
.
Sprintf
(
"failed to store contact Auth "
+
"Request: %s"
,
err
)
jww
.
WARN
.
Print
(
em
)
events
.
Report
(
10
,
"Auth"
,
"RequestError"
,
em
)
}
// Call ConfirmRequestAuth to send confirmation
rngGen
:=
fastRNG
.
NewStreamGenerator
(
1
,
1
,
rngGen
:=
fastRNG
.
NewStreamGenerator
(
1
,
1
,
csprng
.
NewSystemRNG
)
csprng
.
NewSystemRNG
)
rng
:=
rngGen
.
GetStream
()
rng
:=
rngGen
.
GetStream
()
myVariant
:=
util
.
GetCompatibleSIDHVariant
(
rndNum
,
err
:=
ConfirmRequestAuth
(
partnerContact
,
partnerSIDHPubKey
.
Variant
())
rng
,
m
.
storage
,
m
.
net
)
myPriv
,
myPub
:=
util
.
GenerateSIDHKeyPair
(
if
err
!=
nil
{
myVariant
,
rng
)
jww
.
ERROR
.
Printf
(
"Could not ConfirmRequestAuth: %+v"
,
sr2
.
OverwriteSIDHKeys
(
myPriv
,
myPub
)
err
)
rng
.
Close
()
return
// do the confirmation
if
err
:=
m
.
doConfirm
(
sr2
,
grp
,
partnerPubKey
,
m
.
storage
.
E2e
()
.
GetDHPrivateKey
(),
sr2
.
GetPartnerHistoricalPubKey
(),
ecrFmt
.
GetOwnership
(),
partnerSIDHPubKey
);
err
!=
nil
{
em
:=
fmt
.
Sprintf
(
"Auto Confirmation with %s failed: %s"
,
partnerID
,
err
)
jww
.
WARN
.
Print
(
em
)
events
.
Report
(
10
,
"Auth"
,
"RequestError"
,
em
)
}
}
//exit
jww
.
INFO
.
Printf
(
"ConfirmRequestAuth to %s on round %d"
,
partnerID
,
rndNum
)
return
return
}
}
}
}
...
...
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