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
b83ad5f4
Commit
b83ad5f4
authored
2 years ago
by
Josh Brooks
Browse files
Options
Downloads
Patches
Plain Diff
Add residue to top level of e2e/
parent
9c54675d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!510
Release
,
!344
Xx 4084/send e2e residue
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
e2e/processor.go
+2
-2
2 additions, 2 deletions
e2e/processor.go
e2e/sendE2E.go
+15
-10
15 additions, 10 deletions
e2e/sendE2E.go
with
17 additions
and
12 deletions
e2e/processor.go
+
2
−
2
View file @
b83ad5f4
...
@@ -23,7 +23,7 @@ func (p *processor) Process(ecrMsg format.Message,
...
@@ -23,7 +23,7 @@ func (p *processor) Process(ecrMsg format.Message,
// ensure the key will be marked used before returning
// ensure the key will be marked used before returning
defer
p
.
cy
.
Use
()
defer
p
.
cy
.
Use
()
contents
,
err
:=
p
.
cy
.
Decrypt
(
ecrMsg
)
contents
,
residue
,
err
:=
p
.
cy
.
Decrypt
(
ecrMsg
)
if
err
!=
nil
{
if
err
!=
nil
{
jww
.
ERROR
.
Printf
(
"decrypt failed of %s (fp: %s), dropping: %+v"
,
jww
.
ERROR
.
Printf
(
"decrypt failed of %s (fp: %s), dropping: %+v"
,
ecrMsg
.
Digest
(),
p
.
cy
.
Fingerprint
(),
err
)
ecrMsg
.
Digest
(),
p
.
cy
.
Fingerprint
(),
err
)
...
@@ -32,7 +32,7 @@ func (p *processor) Process(ecrMsg format.Message,
...
@@ -32,7 +32,7 @@ func (p *processor) Process(ecrMsg format.Message,
sess
:=
p
.
cy
.
GetSession
()
sess
:=
p
.
cy
.
GetSession
()
message
,
done
:=
p
.
m
.
partitioner
.
HandlePartition
(
sess
.
GetPartner
(),
message
,
done
:=
p
.
m
.
partitioner
.
HandlePartition
(
sess
.
GetPartner
(),
contents
,
sess
.
GetRelationshipFingerprint
())
contents
,
sess
.
GetRelationshipFingerprint
()
,
residue
)
if
done
{
if
done
{
message
.
RecipientID
=
receptionID
.
Source
message
.
RecipientID
=
receptionID
.
Source
message
.
EphemeralID
=
receptionID
.
EphId
message
.
EphemeralID
=
receptionID
.
EphId
...
...
This diff is collapsed.
Click to expand it.
e2e/sendE2E.go
+
15
−
10
View file @
b83ad5f4
...
@@ -35,7 +35,7 @@ func (m *manager) SendE2E(mt catalog.MessageType, recipient *id.ID,
...
@@ -35,7 +35,7 @@ func (m *manager) SendE2E(mt catalog.MessageType, recipient *id.ID,
params
.
Critical
=
false
params
.
Critical
=
false
}
}
rounds
,
msgID
,
t
,
err
:=
m
.
sendE2E
(
mt
,
recipient
,
payload
,
params
)
rounds
,
msgID
,
t
,
residue
,
err
:=
m
.
sendE2E
(
mt
,
recipient
,
payload
,
params
)
if
handleCritical
{
if
handleCritical
{
m
.
crit
.
handle
(
mt
,
recipient
,
payload
,
rounds
,
err
)
m
.
crit
.
handle
(
mt
,
recipient
,
payload
,
rounds
,
err
)
...
@@ -46,7 +46,7 @@ func (m *manager) SendE2E(mt catalog.MessageType, recipient *id.ID,
...
@@ -46,7 +46,7 @@ func (m *manager) SendE2E(mt catalog.MessageType, recipient *id.ID,
// sendE2eFn contains a prepared sendE2E operation and sends an E2E message when
// sendE2eFn contains a prepared sendE2E operation and sends an E2E message when
// called, returning the results of the send.
// called, returning the results of the send.
type
sendE2eFn
func
()
([]
id
.
Round
,
e2e
.
MessageID
,
time
.
Time
,
error
)
type
sendE2eFn
func
()
([]
id
.
Round
,
e2e
.
MessageID
,
time
.
Time
,
e2e
.
KeyResidue
,
error
)
// prepareSendE2E makes a prepared function that does the e2e send.
// prepareSendE2E makes a prepared function that does the e2e send.
// This is so that when doing deletePartner we can prepare the send before
// This is so that when doing deletePartner we can prepare the send before
...
@@ -63,7 +63,8 @@ func (m *manager) prepareSendE2E(mt catalog.MessageType, recipient *id.ID,
...
@@ -63,7 +63,8 @@ func (m *manager) prepareSendE2E(mt catalog.MessageType, recipient *id.ID,
partitions
,
internalMsgId
,
err
:=
m
.
partitioner
.
Partition
(
recipient
,
partitions
,
internalMsgId
,
err
:=
m
.
partitioner
.
Partition
(
recipient
,
mt
,
ts
,
payload
)
mt
,
ts
,
payload
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
errors
.
WithMessage
(
err
,
"failed to send unsafe message"
)
return
nil
,
errors
.
WithMessage
(
err
,
"failed to send unsafe message"
)
}
}
jww
.
INFO
.
Printf
(
"E2E sending %d messages to %s"
,
len
(
partitions
),
recipient
)
jww
.
INFO
.
Printf
(
"E2E sending %d messages to %s"
,
len
(
partitions
),
recipient
)
...
@@ -85,7 +86,7 @@ func (m *manager) prepareSendE2E(mt catalog.MessageType, recipient *id.ID,
...
@@ -85,7 +86,7 @@ func (m *manager) prepareSendE2E(mt catalog.MessageType, recipient *id.ID,
partner
.
SendRelationshipFingerprint
(),
internalMsgId
)
partner
.
SendRelationshipFingerprint
(),
internalMsgId
)
wg
:=
sync
.
WaitGroup
{}
wg
:=
sync
.
WaitGroup
{}
var
keyResidue
e2e
.
KeyResidue
for
i
,
p
:=
range
partitions
{
for
i
,
p
:=
range
partitions
{
if
mt
!=
catalog
.
KeyExchangeTrigger
{
if
mt
!=
catalog
.
KeyExchangeTrigger
{
// Check if any rekeys need to happen and trigger them
// Check if any rekeys need to happen and trigger them
...
@@ -118,7 +119,11 @@ func (m *manager) prepareSendE2E(mt catalog.MessageType, recipient *id.ID,
...
@@ -118,7 +119,11 @@ func (m *manager) prepareSendE2E(mt catalog.MessageType, recipient *id.ID,
// This does not encrypt for cMix but instead end-to-end encrypts the
// This does not encrypt for cMix but instead end-to-end encrypts the
// cMix message
// cMix message
contentsEnc
,
mac
:=
key
.
Encrypt
(
p
)
contentsEnc
,
mac
,
residue
:=
key
.
Encrypt
(
p
)
// Carry the first key residue to the top level
if
i
==
0
{
keyResidue
=
residue
}
jww
.
INFO
.
Printf
(
jww
.
INFO
.
Printf
(
"E2E sending %d/%d to %s with key fp: %s, msgID: %s (msgDigest %s)"
,
"E2E sending %d/%d to %s with key fp: %s, msgID: %s (msgDigest %s)"
,
...
@@ -150,7 +155,7 @@ func (m *manager) prepareSendE2E(mt catalog.MessageType, recipient *id.ID,
...
@@ -150,7 +155,7 @@ func (m *manager) prepareSendE2E(mt catalog.MessageType, recipient *id.ID,
sendFuncs
=
append
(
sendFuncs
,
thisSendFunc
)
sendFuncs
=
append
(
sendFuncs
,
thisSendFunc
)
}
}
sendE2E
=
func
()
([]
id
.
Round
,
e2e
.
MessageID
,
time
.
Time
,
error
)
{
sendE2E
=
func
()
([]
id
.
Round
,
e2e
.
MessageID
,
time
.
Time
,
e2e
.
KeyResidue
,
error
)
{
for
i
:=
range
sendFuncs
{
for
i
:=
range
sendFuncs
{
sendFuncs
[
i
]()
sendFuncs
[
i
]()
}
}
...
@@ -161,7 +166,7 @@ func (m *manager) prepareSendE2E(mt catalog.MessageType, recipient *id.ID,
...
@@ -161,7 +166,7 @@ func (m *manager) prepareSendE2E(mt catalog.MessageType, recipient *id.ID,
if
numFail
>
0
{
if
numFail
>
0
{
jww
.
INFO
.
Printf
(
"Failed to E2E send %d/%d to %s"
,
jww
.
INFO
.
Printf
(
"Failed to E2E send %d/%d to %s"
,
numFail
,
len
(
partitions
),
recipient
)
numFail
,
len
(
partitions
),
recipient
)
return
nil
,
e2e
.
MessageID
{},
time
.
Time
{},
errors
.
Errorf
(
return
nil
,
e2e
.
MessageID
{},
time
.
Time
{},
keyResidue
,
errors
.
Errorf
(
"Failed to E2E send %v/%v sub payloads: %s"
,
"Failed to E2E send %v/%v sub payloads: %s"
,
numFail
,
len
(
partitions
),
errRtn
)
numFail
,
len
(
partitions
),
errRtn
)
}
else
{
}
else
{
...
@@ -172,16 +177,16 @@ func (m *manager) prepareSendE2E(mt catalog.MessageType, recipient *id.ID,
...
@@ -172,16 +177,16 @@ func (m *manager) prepareSendE2E(mt catalog.MessageType, recipient *id.ID,
jww
.
INFO
.
Printf
(
"Successful E2E Send of %d messages to %s with msgID %s"
,
jww
.
INFO
.
Printf
(
"Successful E2E Send of %d messages to %s with msgID %s"
,
len
(
partitions
),
recipient
,
msgID
)
len
(
partitions
),
recipient
,
msgID
)
return
roundIds
,
msgID
,
ts
,
nil
return
roundIds
,
msgID
,
ts
,
keyResidue
,
nil
}
}
return
sendE2E
,
nil
return
sendE2E
,
nil
}
}
func
(
m
*
manager
)
sendE2E
(
mt
catalog
.
MessageType
,
recipient
*
id
.
ID
,
func
(
m
*
manager
)
sendE2E
(
mt
catalog
.
MessageType
,
recipient
*
id
.
ID
,
payload
[]
byte
,
params
Params
)
([]
id
.
Round
,
e2e
.
MessageID
,
time
.
Time
,
error
)
{
payload
[]
byte
,
params
Params
)
([]
id
.
Round
,
e2e
.
MessageID
,
time
.
Time
,
e2e
.
KeyResidue
,
error
)
{
sendFunc
,
err
:=
m
.
prepareSendE2E
(
mt
,
recipient
,
payload
,
params
)
sendFunc
,
err
:=
m
.
prepareSendE2E
(
mt
,
recipient
,
payload
,
params
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
e2e
.
MessageID
{},
time
.
Time
{},
err
return
nil
,
e2e
.
MessageID
{},
time
.
Time
{},
e2e
.
KeyResidue
{},
err
}
}
return
sendFunc
()
return
sendFunc
()
}
}
...
...
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