mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-19 10:05:05 -07:00
Indent
This commit is contained in:
parent
5351efb122
commit
20b12aa9d4
@ -8,7 +8,8 @@ static unsigned char bobsk[crypto_box_SECRETKEYBYTES];
|
||||
static unsigned char bobpk[crypto_box_PUBLICKEYBYTES];
|
||||
static unsigned char n[crypto_box_NONCEBYTES];
|
||||
|
||||
int main(void)
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
unsigned char *m;
|
||||
unsigned char *c;
|
||||
@ -18,8 +19,8 @@ int main(void)
|
||||
size_t i;
|
||||
int ret;
|
||||
|
||||
m = (unsigned char *) sodium_malloc(mlen_max);
|
||||
c = (unsigned char *) sodium_malloc(mlen_max);
|
||||
m = (unsigned char *) sodium_malloc(mlen_max);
|
||||
c = (unsigned char *) sodium_malloc(mlen_max);
|
||||
m2 = (unsigned char *) sodium_malloc(mlen_max);
|
||||
memset(m, 0, crypto_box_ZEROBYTES);
|
||||
crypto_box_keypair(alicepk, alicesk);
|
||||
|
@ -8,7 +8,8 @@ static unsigned char bobsk[crypto_box_SECRETKEYBYTES];
|
||||
static unsigned char bobpk[crypto_box_PUBLICKEYBYTES];
|
||||
static unsigned char n[crypto_box_NONCEBYTES];
|
||||
|
||||
int main(void)
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
unsigned char *m;
|
||||
unsigned char *c;
|
||||
@ -19,8 +20,8 @@ int main(void)
|
||||
int faults;
|
||||
int ret;
|
||||
|
||||
m = (unsigned char *) sodium_malloc(mlen_max);
|
||||
c = (unsigned char *) sodium_malloc(mlen_max);
|
||||
m = (unsigned char *) sodium_malloc(mlen_max);
|
||||
c = (unsigned char *) sodium_malloc(mlen_max);
|
||||
m2 = (unsigned char *) sodium_malloc(mlen_max);
|
||||
crypto_box_keypair(alicepk, alicesk);
|
||||
crypto_box_keypair(bobpk, bobsk);
|
||||
|
@ -2,25 +2,27 @@
|
||||
#define TEST_NAME "box_seed"
|
||||
#include "cmptest.h"
|
||||
|
||||
static unsigned char seed[32]
|
||||
= { 0x77, 0x07, 0x6d, 0x0a, 0x73, 0x18, 0xa5, 0x7d, 0x3c, 0x16, 0xc1,
|
||||
0x72, 0x51, 0xb2, 0x66, 0x45, 0xdf, 0x4c, 0x2f, 0x87, 0xeb, 0xc0,
|
||||
0x99, 0x2a, 0xb1, 0x77, 0xfb, 0xa5, 0x1d, 0xb9, 0x2c, 0x2a };
|
||||
static unsigned char seed[32] = { 0x77, 0x07, 0x6d, 0x0a, 0x73, 0x18, 0xa5,
|
||||
0x7d, 0x3c, 0x16, 0xc1, 0x72, 0x51, 0xb2,
|
||||
0x66, 0x45, 0xdf, 0x4c, 0x2f, 0x87, 0xeb,
|
||||
0xc0, 0x99, 0x2a, 0xb1, 0x77, 0xfb, 0xa5,
|
||||
0x1d, 0xb9, 0x2c, 0x2a };
|
||||
|
||||
int main(void)
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
unsigned char sk[32];
|
||||
unsigned char pk[32];
|
||||
|
||||
crypto_box_seed_keypair(pk, sk, seed);
|
||||
for (i = 0; i < 32; ++i) {
|
||||
printf(",0x%02x", (unsigned int)pk[i]);
|
||||
printf(",0x%02x", (unsigned int) pk[i]);
|
||||
if (i % 8 == 7)
|
||||
printf("\n");
|
||||
}
|
||||
for (i = 0; i < 32; ++i) {
|
||||
printf(",0x%02x", (unsigned int)sk[i]);
|
||||
printf(",0x%02x", (unsigned int) sk[i]);
|
||||
if (i % 8 == 7)
|
||||
printf("\n");
|
||||
}
|
||||
|
@ -2,20 +2,21 @@
|
||||
#define TEST_NAME "core1"
|
||||
#include "cmptest.h"
|
||||
|
||||
static unsigned char shared[32]
|
||||
= { 0x4a, 0x5d, 0x9d, 0x5b, 0xa4, 0xce, 0x2d, 0xe1, 0x72, 0x8e, 0x3b,
|
||||
0xf4, 0x80, 0x35, 0x0f, 0x25, 0xe0, 0x7e, 0x21, 0xc9, 0x47, 0xd1,
|
||||
0x9e, 0x33, 0x76, 0xf0, 0x9b, 0x3c, 0x1e, 0x16, 0x17, 0x42 };
|
||||
static unsigned char shared[32] = { 0x4a, 0x5d, 0x9d, 0x5b, 0xa4, 0xce, 0x2d,
|
||||
0xe1, 0x72, 0x8e, 0x3b, 0xf4, 0x80, 0x35,
|
||||
0x0f, 0x25, 0xe0, 0x7e, 0x21, 0xc9, 0x47,
|
||||
0xd1, 0x9e, 0x33, 0x76, 0xf0, 0x9b, 0x3c,
|
||||
0x1e, 0x16, 0x17, 0x42 };
|
||||
|
||||
static unsigned char zero[32];
|
||||
|
||||
static unsigned char c[16]
|
||||
= { 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x20, 0x33,
|
||||
0x32, 0x2d, 0x62, 0x79, 0x74, 0x65, 0x20, 0x6b };
|
||||
static unsigned char c[16] = { 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x20, 0x33,
|
||||
0x32, 0x2d, 0x62, 0x79, 0x74, 0x65, 0x20, 0x6b };
|
||||
|
||||
static unsigned char firstkey[32];
|
||||
|
||||
int main(void)
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -26,7 +27,7 @@ int main(void)
|
||||
} else {
|
||||
printf(" ");
|
||||
}
|
||||
printf("0x%02x", (unsigned int)firstkey[i]);
|
||||
printf("0x%02x", (unsigned int) firstkey[i]);
|
||||
if (i % 8 == 7) {
|
||||
printf("\n");
|
||||
}
|
||||
|
@ -2,22 +2,23 @@
|
||||
#define TEST_NAME "core2"
|
||||
#include "cmptest.h"
|
||||
|
||||
static unsigned char firstkey[32]
|
||||
= { 0x1b, 0x27, 0x55, 0x64, 0x73, 0xe9, 0x85, 0xd4, 0x62, 0xcd, 0x51,
|
||||
0x19, 0x7a, 0x9a, 0x46, 0xc7, 0x60, 0x09, 0x54, 0x9e, 0xac, 0x64,
|
||||
0x74, 0xf2, 0x06, 0xc4, 0xee, 0x08, 0x44, 0xf6, 0x83, 0x89 };
|
||||
static unsigned char firstkey[32] = { 0x1b, 0x27, 0x55, 0x64, 0x73, 0xe9, 0x85,
|
||||
0xd4, 0x62, 0xcd, 0x51, 0x19, 0x7a, 0x9a,
|
||||
0x46, 0xc7, 0x60, 0x09, 0x54, 0x9e, 0xac,
|
||||
0x64, 0x74, 0xf2, 0x06, 0xc4, 0xee, 0x08,
|
||||
0x44, 0xf6, 0x83, 0x89 };
|
||||
|
||||
static unsigned char nonceprefix[16]
|
||||
= { 0x69, 0x69, 0x6e, 0xe9, 0x55, 0xb6, 0x2b, 0x73,
|
||||
0xcd, 0x62, 0xbd, 0xa8, 0x75, 0xfc, 0x73, 0xd6 };
|
||||
static unsigned char nonceprefix[16] = { 0x69, 0x69, 0x6e, 0xe9, 0x55, 0xb6,
|
||||
0x2b, 0x73, 0xcd, 0x62, 0xbd, 0xa8,
|
||||
0x75, 0xfc, 0x73, 0xd6 };
|
||||
|
||||
static unsigned char c[16]
|
||||
= { 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x20, 0x33,
|
||||
0x32, 0x2d, 0x62, 0x79, 0x74, 0x65, 0x20, 0x6b };
|
||||
static unsigned char c[16] = { 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x20, 0x33,
|
||||
0x32, 0x2d, 0x62, 0x79, 0x74, 0x65, 0x20, 0x6b };
|
||||
|
||||
static unsigned char secondkey[32];
|
||||
|
||||
int main(void)
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -28,7 +29,7 @@ int main(void)
|
||||
} else {
|
||||
printf(" ");
|
||||
}
|
||||
printf("0x%02x", (unsigned int)secondkey[i]);
|
||||
printf("0x%02x", (unsigned int) secondkey[i]);
|
||||
if (i % 8 == 7) {
|
||||
printf("\n");
|
||||
}
|
||||
|
@ -2,17 +2,17 @@
|
||||
#define TEST_NAME "core3"
|
||||
#include "cmptest.h"
|
||||
|
||||
static unsigned char secondkey[32]
|
||||
= { 0xdc, 0x90, 0x8d, 0xda, 0x0b, 0x93, 0x44, 0xa9, 0x53, 0x62, 0x9b,
|
||||
0x73, 0x38, 0x20, 0x77, 0x88, 0x80, 0xf3, 0xce, 0xb4, 0x21, 0xbb,
|
||||
0x61, 0xb9, 0x1c, 0xbd, 0x4c, 0x3e, 0x66, 0x25, 0x6c, 0xe4 };
|
||||
static unsigned char secondkey[32] = { 0xdc, 0x90, 0x8d, 0xda, 0x0b, 0x93, 0x44,
|
||||
0xa9, 0x53, 0x62, 0x9b, 0x73, 0x38, 0x20,
|
||||
0x77, 0x88, 0x80, 0xf3, 0xce, 0xb4, 0x21,
|
||||
0xbb, 0x61, 0xb9, 0x1c, 0xbd, 0x4c, 0x3e,
|
||||
0x66, 0x25, 0x6c, 0xe4 };
|
||||
|
||||
static unsigned char noncesuffix[8]
|
||||
= { 0x82, 0x19, 0xe0, 0x03, 0x6b, 0x7a, 0x0b, 0x37 };
|
||||
static unsigned char noncesuffix[8] = { 0x82, 0x19, 0xe0, 0x03,
|
||||
0x6b, 0x7a, 0x0b, 0x37 };
|
||||
|
||||
static unsigned char c[16]
|
||||
= { 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x20, 0x33,
|
||||
0x32, 0x2d, 0x62, 0x79, 0x74, 0x65, 0x20, 0x6b };
|
||||
static unsigned char c[16] = { 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x20, 0x33,
|
||||
0x32, 0x2d, 0x62, 0x79, 0x74, 0x65, 0x20, 0x6b };
|
||||
|
||||
static unsigned char in[16];
|
||||
|
||||
@ -20,12 +20,13 @@ static unsigned char output[64 * 256 * 256];
|
||||
|
||||
static unsigned char h[32];
|
||||
|
||||
int main(void)
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
long long pos = 0;
|
||||
|
||||
for (i = 0; i < 8; ++i)
|
||||
for (i = 0; i < 8; ++i)
|
||||
in[i] = noncesuffix[i];
|
||||
do {
|
||||
do {
|
||||
|
@ -2,22 +2,21 @@
|
||||
#define TEST_NAME "core4"
|
||||
#include "cmptest.h"
|
||||
|
||||
static unsigned char k[32]
|
||||
= { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
|
||||
12, 13, 14, 15, 16, 201, 202, 203, 204, 205, 206,
|
||||
207, 208, 209, 210, 211, 212, 213, 214, 215, 216 };
|
||||
static unsigned char k[32] = { 1, 2, 3, 4, 5, 6, 7, 8,
|
||||
9, 10, 11, 12, 13, 14, 15, 16,
|
||||
201, 202, 203, 204, 205, 206, 207, 208,
|
||||
209, 210, 211, 212, 213, 214, 215, 216 };
|
||||
|
||||
static unsigned char in[16]
|
||||
= { 101, 102, 103, 104, 105, 106, 107, 108,
|
||||
109, 110, 111, 112, 113, 114, 115, 116 };
|
||||
static unsigned char in[16] = { 101, 102, 103, 104, 105, 106, 107, 108,
|
||||
109, 110, 111, 112, 113, 114, 115, 116 };
|
||||
|
||||
static unsigned char c[16]
|
||||
= { 101, 120, 112, 97, 110, 100, 32, 51,
|
||||
50, 45, 98, 121, 116, 101, 32, 107 };
|
||||
static unsigned char c[16] = { 101, 120, 112, 97, 110, 100, 32, 51,
|
||||
50, 45, 98, 121, 116, 101, 32, 107 };
|
||||
|
||||
static unsigned char out[64];
|
||||
|
||||
int main(void)
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -28,7 +27,7 @@ int main(void)
|
||||
} else {
|
||||
printf(" ");
|
||||
}
|
||||
printf("%3d", (unsigned int)out[i]);
|
||||
printf("%3d", (unsigned int) out[i]);
|
||||
if (i % 8 == 7) {
|
||||
printf("\n");
|
||||
}
|
||||
|
@ -2,28 +2,29 @@
|
||||
#define TEST_NAME "core5"
|
||||
#include "cmptest.h"
|
||||
|
||||
static unsigned char k[32]
|
||||
= { 0xee, 0x30, 0x4f, 0xca, 0x27, 0x00, 0x8d, 0x8c, 0x12, 0x6f, 0x90,
|
||||
0x02, 0x79, 0x01, 0xd8, 0x0f, 0x7f, 0x1d, 0x8b, 0x8d, 0xc9, 0x36,
|
||||
0xcf, 0x3b, 0x9f, 0x81, 0x96, 0x92, 0x82, 0x7e, 0x57, 0x77 };
|
||||
static unsigned char k[32] = { 0xee, 0x30, 0x4f, 0xca, 0x27, 0x00, 0x8d, 0x8c,
|
||||
0x12, 0x6f, 0x90, 0x02, 0x79, 0x01, 0xd8, 0x0f,
|
||||
0x7f, 0x1d, 0x8b, 0x8d, 0xc9, 0x36, 0xcf, 0x3b,
|
||||
0x9f, 0x81, 0x96, 0x92, 0x82, 0x7e, 0x57, 0x77 };
|
||||
|
||||
static unsigned char in[16]
|
||||
= { 0x81, 0x91, 0x8e, 0xf2, 0xa5, 0xe0, 0xda, 0x9b,
|
||||
0x3e, 0x90, 0x60, 0x52, 0x1e, 0x4b, 0xb3, 0x52 };
|
||||
static unsigned char in[16] = {
|
||||
0x81, 0x91, 0x8e, 0xf2, 0xa5, 0xe0, 0xda, 0x9b,
|
||||
0x3e, 0x90, 0x60, 0x52, 0x1e, 0x4b, 0xb3, 0x52
|
||||
};
|
||||
|
||||
static unsigned char c[16]
|
||||
= { 101, 120, 112, 97, 110, 100, 32, 51,
|
||||
50, 45, 98, 121, 116, 101, 32, 107 };
|
||||
static unsigned char c[16] = { 101, 120, 112, 97, 110, 100, 32, 51,
|
||||
50, 45, 98, 121, 116, 101, 32, 107 };
|
||||
|
||||
unsigned char out[32];
|
||||
|
||||
int main(void)
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
crypto_core_hsalsa20(out, in, k, c);
|
||||
for (i = 0; i < 32; ++i) {
|
||||
printf(",0x%02x", (unsigned int)out[i]);
|
||||
printf(",0x%02x", (unsigned int) out[i]);
|
||||
if (i % 8 == 7) {
|
||||
printf("\n");
|
||||
}
|
||||
|
@ -2,24 +2,25 @@
|
||||
#define TEST_NAME "core6"
|
||||
#include "cmptest.h"
|
||||
|
||||
static unsigned char k[32]
|
||||
= { 0xee, 0x30, 0x4f, 0xca, 0x27, 0x00, 0x8d, 0x8c, 0x12, 0x6f, 0x90,
|
||||
0x02, 0x79, 0x01, 0xd8, 0x0f, 0x7f, 0x1d, 0x8b, 0x8d, 0xc9, 0x36,
|
||||
0xcf, 0x3b, 0x9f, 0x81, 0x96, 0x92, 0x82, 0x7e, 0x57, 0x77 };
|
||||
static unsigned char k[32] = { 0xee, 0x30, 0x4f, 0xca, 0x27, 0x00, 0x8d, 0x8c,
|
||||
0x12, 0x6f, 0x90, 0x02, 0x79, 0x01, 0xd8, 0x0f,
|
||||
0x7f, 0x1d, 0x8b, 0x8d, 0xc9, 0x36, 0xcf, 0x3b,
|
||||
0x9f, 0x81, 0x96, 0x92, 0x82, 0x7e, 0x57, 0x77 };
|
||||
|
||||
static unsigned char in[16]
|
||||
= { 0x81, 0x91, 0x8e, 0xf2, 0xa5, 0xe0, 0xda, 0x9b,
|
||||
0x3e, 0x90, 0x60, 0x52, 0x1e, 0x4b, 0xb3, 0x52 };
|
||||
static unsigned char in[16] = {
|
||||
0x81, 0x91, 0x8e, 0xf2, 0xa5, 0xe0, 0xda, 0x9b,
|
||||
0x3e, 0x90, 0x60, 0x52, 0x1e, 0x4b, 0xb3, 0x52
|
||||
};
|
||||
|
||||
static unsigned char c[16]
|
||||
= { 101, 120, 112, 97, 110, 100, 32, 51,
|
||||
50, 45, 98, 121, 116, 101, 32, 107 };
|
||||
static unsigned char c[16] = { 101, 120, 112, 97, 110, 100, 32, 51,
|
||||
50, 45, 98, 121, 116, 101, 32, 107 };
|
||||
|
||||
static unsigned char out[64];
|
||||
|
||||
static void print(unsigned char *x, unsigned char *y)
|
||||
static void
|
||||
print(unsigned char *x, unsigned char *y)
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
unsigned int borrow = 0;
|
||||
|
||||
for (i = 0; i < 4; ++i) {
|
||||
@ -30,7 +31,8 @@ static void print(unsigned char *x, unsigned char *y)
|
||||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
crypto_core_salsa20(out, in, k, c);
|
||||
print(out, c);
|
||||
|
Loading…
Reference in New Issue
Block a user