Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
be9f66c6
Commit
be9f66c6
authored
Nov 29, 2023
by
Hans Leidekker
Committed by
Alexandre Julliard
Nov 30, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bcrypt: Add support for duplicating DH keys.
parent
36e1c938
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
57 deletions
+58
-57
gnutls.c
dlls/bcrypt/gnutls.c
+58
-57
No files found.
dlls/bcrypt/gnutls.c
View file @
be9f66c6
...
...
@@ -2320,37 +2320,22 @@ static NTSTATUS dup_privkey( struct key *key_orig, struct key *key_copy )
case
ALG_ID_RSA_SIGN
:
{
gnutls_datum_t
m
,
e
,
d
,
p
,
q
,
u
,
e1
,
e2
;
if
((
ret
=
pgnutls_privkey_export_rsa_raw
(
key_data
(
key_orig
)
->
a
.
privkey
,
&
m
,
&
e
,
&
d
,
&
p
,
&
q
,
&
u
,
&
e1
,
&
e2
)))
{
pgnutls_perror
(
ret
);
return
STATUS_INTERNAL_ERROR
;
}
break
;
ret
=
pgnutls_privkey_import_rsa_raw
(
privkey
,
&
m
,
&
e
,
&
d
,
&
p
,
&
q
,
&
u
,
&
e1
,
&
e2
);
free
(
m
.
data
);
free
(
e
.
data
);
free
(
d
.
data
);
free
(
p
.
data
);
free
(
q
.
data
);
free
(
u
.
data
);
free
(
e1
.
data
);
free
(
e2
.
data
);
if
(
ret
)
{
pgnutls_perror
(
ret
);
return
STATUS_INTERNAL_ERROR
;
}
break
;
}
case
ALG_ID_DSA
:
{
gnutls_datum_t
p
,
q
,
g
,
y
,
x
;
if
((
ret
=
pgnutls_privkey_export_dsa_raw
(
key_data
(
key_orig
)
->
a
.
privkey
,
&
p
,
&
q
,
&
g
,
&
y
,
&
x
)))
{
pgnutls_perror
(
ret
);
return
STATUS_INTERNAL_ERROR
;
}
if
((
ret
=
pgnutls_privkey_export_dsa_raw
(
key_data
(
key_orig
)
->
a
.
privkey
,
&
p
,
&
q
,
&
g
,
&
y
,
&
x
)))
break
;
ret
=
pgnutls_privkey_import_dsa_raw
(
privkey
,
&
p
,
&
q
,
&
g
,
&
y
,
&
x
);
free
(
p
.
data
);
free
(
q
.
data
);
free
(
g
.
data
);
free
(
y
.
data
);
free
(
x
.
data
);
if
(
ret
)
{
pgnutls_perror
(
ret
);
return
STATUS_INTERNAL_ERROR
;
}
key_copy
->
u
.
a
.
dss_seed
=
key_orig
->
u
.
a
.
dss_seed
;
if
(
!
ret
)
key_copy
->
u
.
a
.
dss_seed
=
key_orig
->
u
.
a
.
dss_seed
;
break
;
}
case
ALG_ID_ECDH_P256
:
...
...
@@ -2360,22 +2345,38 @@ static NTSTATUS dup_privkey( struct key *key_orig, struct key *key_copy )
{
gnutls_ecc_curve_t
curve
;
gnutls_datum_t
x
,
y
,
k
;
if
((
ret
=
pgnutls_privkey_export_ecc_raw
(
key_data
(
key_orig
)
->
a
.
privkey
,
&
curve
,
&
x
,
&
y
,
&
k
)))
{
pgnutls_perror
(
ret
);
return
STATUS_INTERNAL_ERROR
;
}
if
((
ret
=
pgnutls_privkey_export_ecc_raw
(
key_data
(
key_orig
)
->
a
.
privkey
,
&
curve
,
&
x
,
&
y
,
&
k
)))
break
;
ret
=
pgnutls_privkey_import_ecc_raw
(
privkey
,
curve
,
&
x
,
&
y
,
&
k
);
free
(
x
.
data
);
free
(
y
.
data
);
free
(
k
.
data
);
if
(
ret
)
break
;
}
case
ALG_ID_DH
:
{
gnutls_dh_params_t
params
;
gnutls_datum_t
y
,
x
;
if
((
ret
=
pgnutls_dh_params_init
(
&
params
))
<
0
)
break
;
if
((
ret
=
pgnutls_privkey_export_dh_raw
(
key_data
(
key_orig
)
->
a
.
privkey
,
params
,
&
y
,
&
x
,
0
))
<
0
)
{
pgnutls_
perror
(
ret
);
return
STATUS_INTERNAL_ERROR
;
pgnutls_
dh_params_deinit
(
params
);
break
;
}
ret
=
pgnutls_privkey_import_dh_raw
(
privkey
,
params
,
&
y
,
&
x
);
pgnutls_dh_params_deinit
(
params
);
free
(
x
.
data
);
free
(
y
.
data
);
break
;
}
default:
ERR
(
"unhandled algorithm %u
\n
"
,
key_orig
->
alg_id
);
pgnutls_privkey_deinit
(
privkey
);
return
STATUS_INTERNAL_ERROR
;
}
if
(
ret
<
0
)
{
pgnutls_perror
(
ret
);
pgnutls_privkey_deinit
(
privkey
);
return
STATUS_INTERNAL_ERROR
;
}
...
...
@@ -2400,36 +2401,20 @@ static NTSTATUS dup_pubkey( struct key *key_orig, struct key *key_copy )
case
ALG_ID_RSA_SIGN
:
{
gnutls_datum_t
m
,
e
;
if
((
ret
=
pgnutls_pubkey_export_rsa_raw
(
key_data
(
key_orig
)
->
a
.
pubkey
,
&
m
,
&
e
)))
{
pgnutls_perror
(
ret
);
return
STATUS_INTERNAL_ERROR
;
}
if
((
ret
=
pgnutls_pubkey_export_rsa_raw
(
key_data
(
key_orig
)
->
a
.
pubkey
,
&
m
,
&
e
)))
break
;
ret
=
pgnutls_pubkey_import_rsa_raw
(
pubkey
,
&
m
,
&
e
);
free
(
m
.
data
);
free
(
e
.
data
);
if
(
ret
)
{
pgnutls_perror
(
ret
);
return
STATUS_INTERNAL_ERROR
;
}
break
;
}
case
ALG_ID_DSA
:
{
gnutls_datum_t
p
,
q
,
g
,
y
;
if
((
ret
=
pgnutls_pubkey_export_dsa_raw
(
key_data
(
key_orig
)
->
a
.
pubkey
,
&
p
,
&
q
,
&
g
,
&
y
)))
{
pgnutls_perror
(
ret
);
return
STATUS_INTERNAL_ERROR
;
}
if
((
ret
=
pgnutls_pubkey_export_dsa_raw
(
key_data
(
key_orig
)
->
a
.
pubkey
,
&
p
,
&
q
,
&
g
,
&
y
)))
break
;
ret
=
pgnutls_pubkey_import_dsa_raw
(
pubkey
,
&
p
,
&
q
,
&
g
,
&
y
);
free
(
p
.
data
);
free
(
q
.
data
);
free
(
g
.
data
);
free
(
y
.
data
);
if
(
ret
)
{
pgnutls_perror
(
ret
);
return
STATUS_INTERNAL_ERROR
;
}
key_copy
->
u
.
a
.
dss_seed
=
key_orig
->
u
.
a
.
dss_seed
;
if
(
!
ret
)
key_copy
->
u
.
a
.
dss_seed
=
key_orig
->
u
.
a
.
dss_seed
;
break
;
}
case
ALG_ID_ECDH_P256
:
...
...
@@ -2439,22 +2424,38 @@ static NTSTATUS dup_pubkey( struct key *key_orig, struct key *key_copy )
{
gnutls_ecc_curve_t
curve
;
gnutls_datum_t
x
,
y
;
if
((
ret
=
pgnutls_pubkey_export_ecc_raw
(
key_data
(
key_orig
)
->
a
.
pubkey
,
&
curve
,
&
x
,
&
y
)))
{
pgnutls_perror
(
ret
);
return
STATUS_INTERNAL_ERROR
;
}
if
((
ret
=
pgnutls_pubkey_export_ecc_raw
(
key_data
(
key_orig
)
->
a
.
pubkey
,
&
curve
,
&
x
,
&
y
)))
break
;
ret
=
pgnutls_pubkey_import_ecc_raw
(
pubkey
,
curve
,
&
x
,
&
y
);
free
(
x
.
data
);
free
(
y
.
data
);
if
(
ret
)
break
;
}
case
ALG_ID_DH
:
{
gnutls_dh_params_t
params
;
gnutls_datum_t
y
;
if
((
ret
=
pgnutls_dh_params_init
(
&
params
))
<
0
)
break
;
if
((
ret
=
pgnutls_pubkey_export_dh_raw
(
key_data
(
key_orig
)
->
a
.
pubkey
,
params
,
&
y
,
0
))
<
0
)
{
pgnutls_
perror
(
ret
);
return
STATUS_INTERNAL_ERROR
;
pgnutls_
dh_params_deinit
(
params
);
break
;
}
ret
=
pgnutls_pubkey_import_dh_raw
(
pubkey
,
params
,
&
y
);
pgnutls_dh_params_deinit
(
params
);
free
(
y
.
data
);
break
;
}
default:
ERR
(
"unhandled algorithm %u
\n
"
,
key_orig
->
alg_id
);
pgnutls_pubkey_deinit
(
pubkey
);
return
STATUS_INTERNAL_ERROR
;
}
if
(
ret
<
0
)
{
pgnutls_perror
(
ret
);
pgnutls_pubkey_deinit
(
pubkey
);
return
STATUS_INTERNAL_ERROR
;
}
...
...
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