Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
pkgar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
redox-os
pkgar
Commits
2871ad9a
Commit
2871ad9a
authored
4 years ago
by
SamwiseFilmore
Browse files
Options
Downloads
Patches
Plain Diff
Clean up old code/comments
parent
069b96b3
No related branches found
No related tags found
1 merge request
!4
Port to libsodium
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/header.rs
+0
-5
0 additions, 5 deletions
src/header.rs
src/key.rs
+0
-52
0 additions, 52 deletions
src/key.rs
src/lib.rs
+1
-2
1 addition, 2 deletions
src/lib.rs
with
1 addition
and
59 deletions
src/header.rs
+
0
−
5
View file @
2871ad9a
...
...
@@ -29,11 +29,6 @@ impl Header {
let
signed
=
data
.get
(
..
mem
::
size_of
::
<
Header
>
())
.ok_or
(
Error
::
Plain
(
plain
::
Error
::
TooShort
))
?
;
// Verify signature and retrieve verified data
//let mut verified = [0; mem::size_of::<Header>()];
//let count = sodalite::sign_attached_open(&mut verified, signed, public_key.as_data())
// .map_err(|_err| Error::InvalidSignature)?;
let
verified
=
sign
::
verify
(
signed
,
public_key
)
.map_err
(|
_err
|
Error
::
InvalidSignature
)
?
;
...
...
This diff is collapsed.
Click to expand it.
src/key.rs
deleted
100644 → 0
+
0
−
52
View file @
069b96b3
use
rand_core
::{
CryptoRng
,
Error
,
RngCore
};
pub
struct
PublicKey
([
u8
;
32
]);
impl
PublicKey
{
pub
fn
from_data
(
data
:
[
u8
;
32
])
->
Self
{
Self
(
data
)
}
pub
fn
as_data
(
&
self
)
->
&
[
u8
;
32
]
{
&
self
.0
}
pub
fn
into_data
(
self
)
->
[
u8
;
32
]
{
self
.0
}
}
pub
struct
SecretKey
([
u8
;
64
]);
impl
SecretKey
{
pub
fn
new
<
R
:
CryptoRng
+
RngCore
>
(
rng
:
&
mut
R
)
->
Result
<
Self
,
Error
>
{
let
mut
seed
=
[
0
;
32
];
rng
.try_fill_bytes
(
&
mut
seed
)
?
;
let
mut
public_key
=
[
0
;
32
];
let
mut
secret_key
=
[
0
;
64
];
sodalite
::
sign_keypair_seed
(
&
mut
public_key
,
&
mut
secret_key
,
&
seed
);
assert_eq!
(
public_key
,
secret_key
[
32
..
]);
Ok
(
Self
::
from_data
(
secret_key
))
}
pub
fn
from_data
(
data
:
[
u8
;
64
])
->
Self
{
Self
(
data
)
}
pub
fn
as_data
(
&
self
)
->
&
[
u8
;
64
]
{
&
self
.0
}
pub
fn
into_data
(
self
)
->
[
u8
;
64
]
{
self
.0
}
pub
fn
public_key
(
&
self
)
->
PublicKey
{
let
mut
public_key
=
[
0
;
32
];
public_key
.copy_from_slice
(
&
self
.0
[
32
..
]);
PublicKey
::
from_data
(
public_key
)
}
}
This diff is collapsed.
Click to expand it.
src/lib.rs
+
1
−
2
View file @
2871ad9a
...
...
@@ -3,13 +3,11 @@
pub
use
crate
::
entry
::
Entry
;
pub
use
crate
::
error
::
Error
;
pub
use
crate
::
header
::
Header
;
//pub use crate::key::{PublicKey, SecretKey};
pub
use
crate
::
package
::{
Package
,
PackageSrc
};
mod
entry
;
mod
error
;
mod
header
;
//mod key;
mod
package
;
#[cfg(feature
=
"std"
)]
...
...
@@ -31,3 +29,4 @@ mod tests {
assert_eq!
(
mem
::
size_of
::
<
Entry
>
(),
308
);
}
}
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