1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
pub const crypto_sign_ed25519_BYTES: usize = 64;
pub const crypto_sign_ed25519_SEEDBYTES: usize = 32;
pub const crypto_sign_ed25519_PUBLICKEYBYTES: usize = 32;
pub const crypto_sign_ed25519_SECRETKEYBYTES: usize = 64;
extern {
pub fn crypto_sign_ed25519_keypair(
pk: *mut [u8; crypto_sign_ed25519_PUBLICKEYBYTES],
sk: *mut [u8; crypto_sign_ed25519_SECRETKEYBYTES]) -> c_int;
pub fn crypto_sign_ed25519_seed_keypair(
pk: *mut [u8; crypto_sign_ed25519_PUBLICKEYBYTES],
sk: *mut [u8; crypto_sign_ed25519_SECRETKEYBYTES],
seed: *const [u8; crypto_sign_ed25519_SEEDBYTES]) -> c_int;
pub fn crypto_sign_ed25519(
sm: *mut u8,
smlen: *mut c_ulonglong,
m: *const u8,
mlen: c_ulonglong,
sk: *const [u8; crypto_sign_ed25519_SECRETKEYBYTES]) -> c_int;
pub fn crypto_sign_ed25519_open(
m: *mut u8,
mlen: *mut c_ulonglong,
sm: *const u8,
smlen: c_ulonglong,
pk: *const [u8; crypto_sign_ed25519_PUBLICKEYBYTES]) -> c_int;
pub fn crypto_sign_ed25519_detached(
sig: *mut [u8; crypto_sign_ed25519_BYTES],
siglen: *mut c_ulonglong,
m: *const u8,
mlen: c_ulonglong,
sk: *const [u8; crypto_sign_ed25519_SECRETKEYBYTES]) -> c_int;
pub fn crypto_sign_ed25519_verify_detached(
sig: *const [u8; crypto_sign_ed25519_BYTES],
m: *const u8,
mlen: c_ulonglong,
pk: *const [u8; crypto_sign_ed25519_PUBLICKEYBYTES]) -> c_int;
pub fn crypto_sign_ed25519_bytes() -> size_t;
pub fn crypto_sign_ed25519_seedbytes() -> size_t;
pub fn crypto_sign_ed25519_publickeybytes() -> size_t;
pub fn crypto_sign_ed25519_secretkeybytes() -> size_t;
}
#[test]
fn test_crypto_sign_ed25519_bytes() {
assert!(unsafe {
crypto_sign_ed25519_bytes() as usize
} == crypto_sign_ed25519_BYTES)
}
#[test]
fn test_crypto_sign_ed25519_seedbytes() {
assert!(unsafe {
crypto_sign_ed25519_seedbytes() as usize
} == crypto_sign_ed25519_SEEDBYTES)
}
#[test]
fn test_crypto_sign_ed25519_publickeybytes() {
assert!(unsafe {
crypto_sign_ed25519_publickeybytes() as usize
} == crypto_sign_ed25519_PUBLICKEYBYTES)
}
#[test]
fn test_crypto_sign_ed25519_secretkeybytes() {
assert!(unsafe {
crypto_sign_ed25519_secretkeybytes() as usize
} == crypto_sign_ed25519_SECRETKEYBYTES)
}