Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
OpenSK
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
koenigl2
OpenSK
Commits
9c23c369
Commit
9c23c369
authored
5 years ago
by
Guillaume Endignoux
Browse files
Options
Downloads
Patches
Plain Diff
Update the ring dev dependency version.
parent
8cbffc5e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
libraries/crypto/Cargo.toml
+2
-2
2 additions, 2 deletions
libraries/crypto/Cargo.toml
libraries/crypto/src/ecdsa.rs
+21
-22
21 additions, 22 deletions
libraries/crypto/src/ecdsa.rs
with
23 additions
and
24 deletions
libraries/crypto/Cargo.toml
+
2
−
2
View file @
9c23c369
...
...
@@ -16,8 +16,8 @@ arrayref = "0.3.6"
subtle
=
{
version
=
"2.2"
,
default-features
=
false
,
features
=
[
"nightly"
]
}
byteorder
=
{
version
=
"1"
,
default-features
=
false
}
hex
=
{
version
=
"0.3.2"
,
default-features
=
false
,
optional
=
true
}
ring
=
{
version
=
"0.1
4.6
"
,
optional
=
true
}
untrusted
=
{
version
=
"0.
6.2
"
,
optional
=
true
}
ring
=
{
version
=
"0.1
6.11
"
,
optional
=
true
}
untrusted
=
{
version
=
"0.
7.0
"
,
optional
=
true
}
rand
=
{
version
=
"0.6.5"
,
optional
=
true
}
serde
=
{
version
=
"1.0"
,
optional
=
true
,
features
=
[
"derive"
]
}
serde_json
=
{
version
=
"1.0"
,
optional
=
true
}
...
...
This diff is collapsed.
Click to expand it.
libraries/crypto/src/ecdsa.rs
+
21
−
22
View file @
9c23c369
...
...
@@ -495,14 +495,13 @@ mod test {
#[test]
fn
test_ring_sign_ring_verify
()
{
use
ring
::
rand
::
SecureRandom
;
use
ring
::
signature
::
KeyPair
;
use
ring
::
signature
::
{
KeyPair
,
VerificationAlgorithm
}
;
let
ring_rng
=
ring
::
rand
::
SystemRandom
::
new
();
for
_
in
0
..
ITERATIONS
{
let
mut
msg_bytes
:
[
u8
;
64
]
=
[
Default
::
default
();
64
];
ring_rng
.fill
(
&
mut
msg_bytes
)
.unwrap
();
let
msg
=
untrusted
::
Input
::
from
(
&
msg_bytes
);
let
pkcs8_bytes
=
ring
::
signature
::
EcdsaKeyPair
::
generate_pkcs8
(
&
ring
::
signature
::
ECDSA_P256_SHA256_FIXED_SIGNING
,
...
...
@@ -511,21 +510,21 @@ mod test {
.unwrap
();
let
key_pair
=
ring
::
signature
::
EcdsaKeyPair
::
from_pkcs8
(
&
ring
::
signature
::
ECDSA_P256_SHA256_FIXED_SIGNING
,
untrusted
::
Input
::
from
(
pkcs8_bytes
.as_ref
()
)
,
pkcs8_bytes
.as_ref
(),
)
.unwrap
();
let
public_key_bytes
=
key_pair
.public_key
()
.as_ref
();
let
sig
=
key_pair
.sign
(
&
ring_rng
,
msg
)
.unwrap
();
let
sig
=
key_pair
.sign
(
&
ring_rng
,
&
msg
_bytes
)
.unwrap
();
let
sig_bytes
=
sig
.as_ref
();
assert!
(
ring
::
signature
::
verify
(
&
ring
::
signature
::
ECDSA_P256_SHA256_FIXED
,
untrusted
::
Input
::
from
(
public_key_bytes
),
msg
,
untrusted
::
Input
::
from
(
sig_bytes
)
)
.is_ok
());
assert!
(
ring
::
signature
::
ECDSA_P256_SHA256_FIXED
.verify
(
untrusted
::
Input
::
from
(
public_key_bytes
),
untrusted
::
Input
::
from
(
&
msg_bytes
)
,
untrusted
::
Input
::
from
(
sig_bytes
)
)
.is_ok
());
}
}
...
...
@@ -548,14 +547,12 @@ mod test {
.unwrap
();
let
key_pair
=
ring
::
signature
::
EcdsaKeyPair
::
from_pkcs8
(
&
ring
::
signature
::
ECDSA_P256_SHA256_FIXED_SIGNING
,
untrusted
::
Input
::
from
(
pkcs8_bytes
.as_ref
()
)
,
pkcs8_bytes
.as_ref
(),
)
.unwrap
();
let
public_key_bytes
=
key_pair
.public_key
()
.as_ref
();
let
sig
=
key_pair
.sign
(
&
ring_rng
,
untrusted
::
Input
::
from
(
&
msg_bytes
))
.unwrap
();
let
sig
=
key_pair
.sign
(
&
ring_rng
,
&
msg_bytes
)
.unwrap
();
let
sig_bytes
=
sig
.as_ref
();
let
pk
=
PubKey
::
from_bytes_uncompressed
(
public_key_bytes
)
.unwrap
();
...
...
@@ -567,6 +564,8 @@ mod test {
// Test that messages signed by this code are correctly verified by the ring crate.
#[test]
fn
test_self_sign_ring_verify
()
{
use
ring
::
signature
::
VerificationAlgorithm
;
let
mut
rng
=
ThreadRng256
{};
for
_
in
0
..
ITERATIONS
{
...
...
@@ -580,13 +579,13 @@ mod test {
let
mut
sig_bytes
:
[
u8
;
64
]
=
[
Default
::
default
();
64
];
sign
.to_bytes
(
&
mut
sig_bytes
);
assert!
(
ring
::
signature
::
verify
(
&
ring
::
signature
::
ECDSA_P256_SHA256_FIXED
,
untrusted
::
Input
::
from
(
&
public_key_bytes
),
untrusted
::
Input
::
from
(
&
msg_bytes
),
untrusted
::
Input
::
from
(
&
sig_bytes
)
)
.is_ok
());
assert!
(
ring
::
signature
::
ECDSA_P256_SHA256_FIXED
.verify
(
untrusted
::
Input
::
from
(
&
public_key_bytes
),
untrusted
::
Input
::
from
(
&
msg_bytes
),
untrusted
::
Input
::
from
(
&
sig_bytes
)
)
.is_ok
());
}
}
...
...
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