good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
open
bor
Commits
fc3000d6
Commit
fc3000d6
authored
5 years ago
by
Guillaume Ballet
Browse files
Options
Downloads
Patches
Plain Diff
more review feedback
parent
d2daff42
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
accounts/scwallet/hub.go
+6
-7
6 additions, 7 deletions
accounts/scwallet/hub.go
accounts/scwallet/securechannel.go
+4
-4
4 additions, 4 deletions
accounts/scwallet/securechannel.go
with
10 additions
and
11 deletions
accounts/scwallet/hub.go
+
6
−
7
View file @
fc3000d6
...
...
@@ -36,6 +36,7 @@ import (
"encoding/json"
"io/ioutil"
"os"
"path/filepath"
"sort"
"sync"
"time"
...
...
@@ -111,10 +112,11 @@ func (hub *Hub) readPairings() error {
}
func
(
hub
*
Hub
)
writePairings
()
error
{
pairingFile
,
err
:=
os
.
OpenFile
(
filepath
.
Join
(
hub
.
datadir
,
"smartcards.json"
),
os
.
O_RDWR
|
os
.
O_CREATE
,
0755
)
pairingFile
,
err
:=
os
.
OpenFile
(
filepath
.
Join
(
hub
.
datadir
,
"smartcards.json"
),
os
.
O_RDWR
|
os
.
O_CREATE
,
0755
)
if
err
!=
nil
{
return
err
}
defer
pairingFile
.
Close
()
pairings
:=
make
([]
smartcardPairing
,
0
,
len
(
hub
.
pairings
))
for
_
,
pairing
:=
range
hub
.
pairings
{
...
...
@@ -130,15 +132,11 @@ func (hub *Hub) writePairings() error {
return
err
}
return
pairingFile
.
Close
()
return
nil
}
func
(
hub
*
Hub
)
pairing
(
wallet
*
Wallet
)
*
smartcardPairing
{
if
pairing
,
ok
:=
hub
.
pairings
[
string
(
wallet
.
PublicKey
)];
ok
{
return
&
pairing
}
return
nil
if
ok
{
if
pairing
,
ok
:=
hub
.
pairings
[
string
(
wallet
.
PublicKey
)];
ok
{
return
&
pairing
}
return
nil
...
...
@@ -209,6 +207,7 @@ func (hub *Hub) refreshWallets() {
// want to fill the user's log with errors, so filter those out.
if
err
.
Error
()
!=
"scard: Cannot find a smart card reader."
{
log
.
Error
(
"Failed to enumerate smart card readers"
,
"err"
,
err
)
return
}
}
// Transform the current list of wallets into the new one
...
...
This diff is collapsed.
Click to expand it.
accounts/scwallet/securechannel.go
+
4
−
4
View file @
fc3000d6
...
...
@@ -229,8 +229,8 @@ func (s *SecureChannelSession) transmitEncrypted(cla, ins, p1, p2 byte, data []b
if
err
!=
nil
{
return
nil
,
err
}
meta
:=
[]
byte
{
cla
,
ins
,
p1
,
p2
,
byte
(
len
(
data
)
+
scBlockSize
)
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
}
if
err
=
s
.
updateIV
(
meta
,
data
);
err
!=
nil
{
meta
:=
[
16
]
byte
{
cla
,
ins
,
p1
,
p2
,
byte
(
len
(
data
)
+
scBlockSize
)}
if
err
=
s
.
updateIV
(
meta
[
:
]
,
data
);
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -249,7 +249,7 @@ func (s *SecureChannelSession) transmitEncrypted(cla, ins, p1, p2 byte, data []b
return
nil
,
err
}
rmeta
:=
[]
byte
{
byte
(
len
(
response
.
Data
))
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
}
rmeta
:=
[
16
]
byte
{
byte
(
len
(
response
.
Data
))}
rmac
:=
response
.
Data
[
:
len
(
s
.
iv
)]
rdata
:=
response
.
Data
[
len
(
s
.
iv
)
:
]
plainData
,
err
:=
s
.
decryptAPDU
(
rdata
)
...
...
@@ -257,7 +257,7 @@ func (s *SecureChannelSession) transmitEncrypted(cla, ins, p1, p2 byte, data []b
return
nil
,
err
}
if
err
=
s
.
updateIV
(
rmeta
,
rdata
);
err
!=
nil
{
if
err
=
s
.
updateIV
(
rmeta
[
:
]
,
rdata
);
err
!=
nil
{
return
nil
,
err
}
if
!
bytes
.
Equal
(
s
.
iv
,
rmac
)
{
...
...
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