Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
babeld
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
babeld
Commits
bf40cd70
Commit
bf40cd70
authored
Aug 10, 2019
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix HMAC-SHA-256 computation.
This was completely wrong.
parent
78430f86
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
9 deletions
+16
-9
configuration.c
configuration.c
+12
-1
hmac.c
hmac.c
+4
-8
No files found.
configuration.c
View file @
bf40cd70
...
@@ -1231,11 +1231,22 @@ parse_config_line(int c, gnc_t gnc, void *closure,
...
@@ -1231,11 +1231,22 @@ parse_config_line(int c, gnc_t gnc, void *closure,
}
}
switch
(
key
->
type
)
{
switch
(
key
->
type
)
{
case
AUTH_TYPE_SHA256
:
case
AUTH_TYPE_SHA256
:
if
(
key
->
len
!=
32
)
{
if
(
key
->
len
>
64
)
{
free
(
key
->
value
);
free
(
key
->
value
);
free
(
key
);
free
(
key
);
goto
fail
;
goto
fail
;
}
}
if
(
key
->
len
<
64
)
{
unsigned
char
*
v
=
realloc
(
key
->
value
,
64
);
if
(
v
==
NULL
)
{
free
(
key
->
value
);
free
(
key
);
goto
fail
;
}
memset
(
v
+
key
->
len
,
0
,
64
-
key
->
len
);
key
->
value
=
v
;
key
->
len
=
64
;
}
break
;
break
;
case
AUTH_TYPE_BLAKE2S
:
case
AUTH_TYPE_BLAKE2S
:
if
(
key
->
len
!=
16
)
{
if
(
key
->
len
!=
16
)
{
...
...
hmac.c
View file @
bf40cd70
...
@@ -120,12 +120,10 @@ compute_hmac(const unsigned char *src, const unsigned char *dst,
...
@@ -120,12 +120,10 @@ compute_hmac(const unsigned char *src, const unsigned char *dst,
case
AUTH_TYPE_SHA256
:
{
case
AUTH_TYPE_SHA256
:
{
SHA256Context
inner
,
outer
;
SHA256Context
inner
,
outer
;
unsigned
char
ipad
[
64
],
ihash
[
32
],
opad
[
64
];
unsigned
char
ipad
[
64
],
ihash
[
32
],
opad
[
64
];
if
(
key
->
len
!=
32
)
if
(
key
->
len
!=
64
)
return
-
1
;
return
-
1
;
for
(
int
i
=
0
;
i
<
32
;
i
++
)
for
(
int
i
=
0
;
i
<
64
;
i
++
)
ipad
[
i
]
=
key
->
value
[
i
]
^
0x36
;
ipad
[
i
]
=
key
->
value
[
i
]
^
0x36
;
for
(
int
i
=
32
;
i
<
64
;
i
++
)
ipad
[
i
]
=
0x36
;
rc
=
SHA256Reset
(
&
inner
);
rc
=
SHA256Reset
(
&
inner
);
if
(
rc
<
0
)
if
(
rc
<
0
)
return
-
1
;
return
-
1
;
...
@@ -156,10 +154,8 @@ compute_hmac(const unsigned char *src, const unsigned char *dst,
...
@@ -156,10 +154,8 @@ compute_hmac(const unsigned char *src, const unsigned char *dst,
if
(
rc
!=
0
)
if
(
rc
!=
0
)
return
-
1
;
return
-
1
;
for
(
int
i
=
0
;
i
<
32
;
i
++
)
for
(
int
i
=
0
;
i
<
64
;
i
++
)
opad
[
i
]
=
ihash
[
i
]
^
0x5c
;
opad
[
i
]
=
key
->
value
[
i
]
^
0x5c
;
for
(
int
i
=
32
;
i
<
64
;
i
++
)
opad
[
i
]
=
0x5c
;
rc
=
SHA256Reset
(
&
outer
);
rc
=
SHA256Reset
(
&
outer
);
if
(
rc
!=
0
)
if
(
rc
!=
0
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment