more work - documentation o.0
This commit is contained in:
parent
52b5a6a819
commit
d52b3a7046
BIN
ed25519.dll
Normal file
BIN
ed25519.dll
Normal file
Binary file not shown.
15
readme.txt
Normal file
15
readme.txt
Normal file
@ -0,0 +1,15 @@
|
||||
This is a portable implementation of Ed25519.
|
||||
|
||||
Quoting from the homepage:
|
||||
|
||||
Ed25519 is a public-key signature system with several attractive features:
|
||||
Fast single-signature verification. The software takes only 273364 cycles to verify a signature on Intel's widely deployed Nehalem/Westmere lines of CPUs. (This performance measurement is for short messages; for very long messages, verification time is dominated by hashing time.) Nehalem and Westmere include all Core i7, i5, and i3 CPUs released between 2008 and 2010, and most Xeon CPUs released in the same period.
|
||||
Very fast signing. The software takes only 87548 cycles to sign a message. A quad-core 2.4GHz Westmere signs 109000 messages per second.
|
||||
Fast key generation. Key generation is almost as fast as signing. There is a slight penalty for key generation to obtain a secure random number from the operating system; /dev/urandom under Linux costs about 6000 cycles.
|
||||
High security level. This system has a 2^128 security target; breaking it has similar difficulty to breaking NIST P-256, RSA with ~3000-bit keys, strong 128-bit block ciphers, etc. The best attacks known actually cost more than 2^140 bit operations on average, and degrade quadratically in success probability as the number of bit operations drops.
|
||||
Foolproof session keys. Signatures are generated deterministically; key generation consumes new randomness but new signatures do not. This is not only a speed feature but also a security feature, directly relevant to the recent collapse of the Sony PlayStation 3 security system.
|
||||
Collision resilience. Hash-function collisions do not break this system. This adds a layer of defense against the possibility of weakness in the selected hash function.
|
||||
No secret array indices. The software never reads or writes data from secret addresses in RAM; the pattern of addresses is completely predictable. The software is therefore immune to cache-timing attacks, hyperthreading attacks, and other side-channel attacks that rely on leakage of addresses through the CPU cache.
|
||||
No secret branch conditions. The software never performs conditional branches based on secret data; the pattern of jumps is completely predictable. The software is therefore immune to side-channel attacks that rely on leakage of information through the branch-prediction unit.
|
||||
Small signatures. Signatures fit into 64 bytes. These signatures are actually compressed versions of longer signatures; the times for compression and decompression are included in the cycle counts reported above.
|
||||
Small keys. Public keys consume only 32 bytes. The times for compression and decompression are again included.
|
@ -3,12 +3,33 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
int ed25519_sign(unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *sign_key);
|
||||
int ed25519_verify(const unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *verify_key);
|
||||
int ed25519_create_keypair(unsigned char *verify_key, unsigned char *sign_key, unsigned char *seed);
|
||||
#if defined(_WIN32)
|
||||
#if defined(ED25519_BUILD_DLL)
|
||||
#define ED25519_DECLSPEC __declspec(dllexport)
|
||||
#elif defined(ED25519_DLL)
|
||||
#define ED25519_DECLSPEC __declspec(dllimport)
|
||||
#else
|
||||
#define ED25519_DECLSPEC
|
||||
#endif
|
||||
#else
|
||||
#define ED25519_DECLSPEC
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int ED25519_DECLSPEC ed25519_sign(unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *sign_key);
|
||||
int ED25519_DECLSPEC ed25519_verify(const unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *verify_key);
|
||||
int ED25519_DECLSPEC ed25519_create_keypair(unsigned char *verify_key, unsigned char *sign_key, unsigned char *seed);
|
||||
|
||||
#ifndef ED25519_NO_SEED
|
||||
int ed25519_create_seed(unsigned char *seed);
|
||||
int ED25519_DECLSPEC ed25519_create_seed(unsigned char *seed);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,3 +1,5 @@
|
||||
#include "ed25519.h"
|
||||
|
||||
#ifndef ED25519_NO_SEED
|
||||
|
||||
#ifdef _WIN32
|
||||
@ -31,7 +33,7 @@ int ed25519_create_seed(unsigned char *seed) {
|
||||
freadf(seed, 1, 32, f);
|
||||
fclose(f);
|
||||
#endif
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,8 @@
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "ed25519.h"
|
||||
#define ED25519_DLL
|
||||
#include "src/ed25519.h"
|
||||
|
||||
const char message[] = "Hello, world!";
|
||||
|
||||
@ -46,7 +47,6 @@ int main(int argc, char *argv[]) {
|
||||
end = clock();
|
||||
|
||||
printf("%fus per signature\n", ((double) ((end - start) * 1000)) / CLOCKS_PER_SEC / i * 1000);
|
||||
printf("%f\n", (double) (end - start) / CLOCKS_PER_SEC);
|
||||
|
||||
printf("testing verify performance: ");
|
||||
start = clock();
|
Loading…
Reference in New Issue
Block a user