Implemented modified and somewhat faster initialization code.

As this unavoidably breaks compatibility with pre-1.3.x versions, added a new flag to 'slunkparam_t' that enables backwards compatibility mode.
Also extended the self-test code to test the new initialization, in addition to the "legacy" initialization.
This commit is contained in:
LoRd_MuldeR 2022-10-13 02:26:51 +02:00
parent e4c3343d0c
commit 147d762ebc
Signed by: mulder
GPG Key ID: 2B5913365F57E03F
11 changed files with 74 additions and 41 deletions

View File

@ -67,6 +67,7 @@ static void init_slunk_param(slunkparam_t *const param, const crypt_options_t *c
slunkcrypt_bzero(param, sizeof(slunkparam_t)); slunkcrypt_bzero(param, sizeof(slunkparam_t));
param->version = SLUNKCRYPT_PARAM_VERSION; param->version = SLUNKCRYPT_PARAM_VERSION;
param->thread_count = options->thread_count; param->thread_count = options->thread_count;
param->legacy_init = options->legacy_init;
} }
#define UPDATE_PROGRESS_INDICATOR(CLK_UPDATE, CURRENT, TOTAL) do \ #define UPDATE_PROGRESS_INDICATOR(CLK_UPDATE, CURRENT, TOTAL) do \

View File

@ -11,6 +11,7 @@
typedef struct typedef struct
{ {
int keep_incomplete; int keep_incomplete;
int legacy_init;
size_t thread_count; size_t thread_count;
} }
crypt_options_t; crypt_options_t;

View File

@ -36,6 +36,7 @@ static const size_t DFLT_PWDLEN_LENGTH = 24U;
static const CHR* const ENV_PASSWORD = T("SLUNK_PASSPHRASE"); static const CHR* const ENV_PASSWORD = T("SLUNK_PASSPHRASE");
static const CHR* const ENV_KEEPFILE = T("SLUNK_KEEP_INCOMPLETE"); static const CHR* const ENV_KEEPFILE = T("SLUNK_KEEP_INCOMPLETE");
static const CHR* const ENV_NTHREADS = T("SLUNK_THREADS"); static const CHR* const ENV_NTHREADS = T("SLUNK_THREADS");
static const CHR* const ENV_LGCYCMPT = T("SLUNK_LEGACY_COMPAT");
static const CHR* const PREFIX_PASS = T("pass:"); static const CHR* const PREFIX_PASS = T("pass:");
static const CHR* const PREFIX_FILE = T("file:"); static const CHR* const PREFIX_FILE = T("file:");
@ -120,7 +121,7 @@ static uint32_t environ_get_uint(const CHR *const name)
static int environ_get_flag(const CHR *const name) static int environ_get_flag(const CHR *const name)
{ {
return (environ_get_uint(name) != 0); return (environ_get_uint(name) != 0U);
} }
static void check_excess_arguments(const int argc, int maximum) static void check_excess_arguments(const int argc, int maximum)
@ -287,7 +288,7 @@ int MAIN(const int argc, CHR *const argv[])
/* ----------------------------------------------------- */ /* ----------------------------------------------------- */
const uint64_t clk_start = clock_read(); const uint64_t clk_start = clock_read();
const crypt_options_t options = { environ_get_flag(ENV_KEEPFILE), environ_get_uint(ENV_NTHREADS) }; const crypt_options_t options = { environ_get_flag(ENV_KEEPFILE), environ_get_flag(ENV_LGCYCMPT), environ_get_uint(ENV_NTHREADS) };
switch (slunk_mode) switch (slunk_mode)
{ {

View File

@ -204,36 +204,40 @@ int run_selftest_routine(const size_t thread_count)
const struct const struct
{ {
const char* text; const char* text;
uint64_t check_orig, check_encr[2U]; uint64_t check_orig, check_encr[2U][2U];
} }
TEST_STAGE[] = TEST_STAGE[] =
{ {
{ TEST_DATA_0, TEST_CHCK_ORIG_0, { TEST_CHCK_ENCR_0[0U], TEST_CHCK_ENCR_0[1U] } }, { TEST_DATA_0, TEST_CHCK_ORIG_0, { { TEST_CHCK_ENCR_0[0U], TEST_CHCK_ENCR_0[1U] }, { TEST_CHCK_ENCR_0[2U], TEST_CHCK_ENCR_0[3U] } } },
{ TEST_DATA_1, TEST_CHCK_ORIG_1, { TEST_CHCK_ENCR_1[0U], TEST_CHCK_ENCR_1[1U] } }, { TEST_DATA_1, TEST_CHCK_ORIG_1, { { TEST_CHCK_ENCR_1[0U], TEST_CHCK_ENCR_1[1U] }, { TEST_CHCK_ENCR_1[2U], TEST_CHCK_ENCR_1[3U] } } },
{ TEST_DATA_2, TEST_CHCK_ORIG_2, { TEST_CHCK_ENCR_2[0U], TEST_CHCK_ENCR_2[1U] } }, { TEST_DATA_2, TEST_CHCK_ORIG_2, { { TEST_CHCK_ENCR_2[0U], TEST_CHCK_ENCR_2[1U] }, { TEST_CHCK_ENCR_2[2U], TEST_CHCK_ENCR_2[3U] } } },
{ TEST_DATA_3, TEST_CHCK_ORIG_3, { TEST_CHCK_ENCR_3[0U], TEST_CHCK_ENCR_3[1U] } }, { TEST_DATA_3, TEST_CHCK_ORIG_3, { { TEST_CHCK_ENCR_3[0U], TEST_CHCK_ENCR_3[1U] }, { TEST_CHCK_ENCR_3[2U], TEST_CHCK_ENCR_3[3U] } } }
}; };
const size_t total = ARRAY_SIZE(TEST_NONCE) * (ITERATIONS + ARRAY_SIZE(TEST_STAGE)); const size_t total = ARRAY_SIZE(TEST_NONCE) * (ITERATIONS + (ITERATIONS * ARRAY_SIZE(TEST_STAGE)));
size_t count = 0U; size_t count = 0U;
FPRINTF(stderr, T("Self-test is in progress, please be patient... stage %2u/%2u "), 0U, (unsigned)total); FPRINTF(stderr, T("Self-test is in progress, please be patient... stage %2u/%2u "), 0U, (unsigned)total);
fflush(stderr); fflush(stderr);
const slunkparam_t param = { SLUNKCRYPT_PARAM_VERSION, thread_count };
for (size_t i = 0U; i < ARRAY_SIZE(TEST_STAGE); ++i) for (size_t i = 0U; i < ARRAY_SIZE(TEST_STAGE); ++i)
{ {
for (size_t j = 0U; j < ARRAY_SIZE(TEST_NONCE); ++j) for (size_t j = 0U; j < ITERATIONS; ++j)
{ {
FPRINTF(stderr, T("\b\b\b\b\b\b%2u/%2u "), (unsigned)++count, (unsigned)total); const slunkparam_t param = { SLUNKCRYPT_PARAM_VERSION, thread_count, (j > 0) };
fflush(stderr); for (size_t k = 0U; k < ARRAY_SIZE(TEST_NONCE); ++k)
if (run_testcase(TEST_STAGE[i].text, TEST_NONCE[j], TEST_STAGE[i].check_orig, TEST_STAGE[i].check_encr[j], &param) != EXIT_SUCCESS)
{ {
return EXIT_FAILURE; FPRINTF(stderr, T("\b\b\b\b\b\b%2u/%2u "), (unsigned)++count, (unsigned)total);
fflush(stderr);
if (run_testcase(TEST_STAGE[i].text, TEST_NONCE[k], TEST_STAGE[i].check_orig, TEST_STAGE[i].check_encr[j][k], &param) != EXIT_SUCCESS)
{
return EXIT_FAILURE;
}
} }
} }
} }
const slunkparam_t param = { SLUNKCRYPT_PARAM_VERSION, thread_count, 0 };
for (size_t i = 0U; i < ITERATIONS; ++i) for (size_t i = 0U; i < ITERATIONS; ++i)
{ {
for (size_t j = 0U; j < ARRAY_SIZE(TEST_NONCE); ++j) for (size_t j = 0U; j < ARRAY_SIZE(TEST_NONCE); ++j)

View File

@ -13,7 +13,7 @@
// Test #1 // Test #1
// ========================================================================== // ==========================================================================
const uint64_t TEST_CHCK_ORIG_0 = 0x407DA53F1660C8C7, TEST_CHCK_ENCR_0[2U] = { 0x3329F2A405D3DF93, 0x9B8E256B3437468B }; const uint64_t TEST_CHCK_ORIG_0 = 0x407DA53F1660C8C7, TEST_CHCK_ENCR_0[4U] = { 0x9A6C6847A4B81265, 0xF91724F2DAAC320E, 0x3329F2A405D3DF93, 0x9B8E256B3437468B };
const char* const TEST_DATA_0 = const char* const TEST_DATA_0 =
"Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit" "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit"
@ -53,7 +53,7 @@ const char* const TEST_DATA_0 =
// Test #2 // Test #2
// ========================================================================== // ==========================================================================
const uint64_t TEST_CHCK_ORIG_1 = 0xE6EB3C50FAA52062, TEST_CHCK_ENCR_1[2U] = { 0x38E126F893A67351, 0xAB929BFE9FDD40F8 }; const uint64_t TEST_CHCK_ORIG_1 = 0xE6EB3C50FAA52062, TEST_CHCK_ENCR_1[4U] = { 0x08CB7843CBA7D4FC, 0x28DDFD9383347AC6, 0x38E126F893A67351, 0xAB929BFE9FDD40F8 };
const char* const TEST_DATA_1 = const char* const TEST_DATA_1 =
"agcttttcattctgactgcaacgggcaatatgtctctgtgtggattaaaaaaagagtgtctgatagcagcttctgaactggttacctgccgtgagtaaattaaaattttattgacttaggtcactaaatactttaaccaatataggcatagcgcacagacagataaaaattacagagtacacaacatccatgaaacgcattagcaccaccattaccaccaccatcaccattaccacaggtaacggtgcgggctgacgcgtacaggaaacacagaaaaaagcccgcacctgacagtgcgggctttttttttcgaccaaaggtaacgaggtaacaaccatgcgagtgttgaagttcggcggtacatcagtggcaaatgcagaacgttttctgcgtgttgccgatattctggaaagcaatgccaggcaggggcaggtggccaccgtcctctctgcccccgccaaaatcaccaaccacctggtggcgatgattgaaaaaaccattagcggccaggatgctttacccaatatcagcgatgccgaacgtatttttgccgaacttttgacgggactcgccgccgcccagccggggttcccgctggcgcaattgaaaactttcgtcgatcaggaatttgcccaaataaaacatgtcctgcatggcattagtttgttggggcagtgcccggatagcatcaacgctgcgctgatttgccgtggcgagaaaatgtcgatcgccattatggccggcgtattagaagcgcgcggtcacaacgttactgttatcgatccggtcgaaaaactgctggcagtggggcattacctcgaatctaccgtcgatattgctgagtccacccgccgtattgcggcaagccgcattccggctgatcacatggtgctgatggcaggtttcaccgccggtaatgaaaaaggcgaactggtggtgcttggacgcaacggttccgactactctgctgcggtgctggctgcctgtttacgcgccgattgttgcgagatttggacggacgttgacggggtctatacctgcgacccgcgtcaggtgcccgatgcgaggttgttgaagtcgatgtcctaccaggaagcgatggagctttcctacttcggcgctaaagttcttcacccccgcaccattacccccatcgcccagttccagatcccttgcctgattaaaaataccggaaatcctcaagcaccaggtacgctcattggtgccagccgtgatgaagacgaattaccggtcaagggcatttccaatctgaataacatggcaatgttcagcgtttctggtccggggatgaaagggatggtcggcatggcggcgcgcgtctttgcagcgatgtcacgcgcccgtatttccgtggtgctgattacgcaatcatcttccgaatacagcatcagtttctgcgttccacaaagcgactgtgtgcgagctgaacgggcaatgcaggaagagttctacctggaactgaaagaaggcttactggagccgctggcagtgacggaacggctggccattatctcggtggtaggtgatggtatgcgcaccttgcgtgggatctcggcgaaattctttgccgcactggcccgcgccaatatcaacattgtcgccattgctcagggatcttctgaacgctcaatctctgtcgtggtaaataacgatgatgcgaccactggcgtgcgcgttactcatcagatgctgttcaataccgatcaggttatcgaagtgtttgtgattggcgtcggtggcgttggcggtgcgctgctggagcaactgaagcgtcagcaaagctggctgaagaataaacatatcgacttacgtgtctgcggtgttgccaactcgaaggctctgctcaccaatgtacatggccttaatctggaaaactggcaggaagaactggcgcaagccaaagagccgtttaatctcgggcgcttaattcgcctcgtgaaagaatatcatctgctgaacccggtcattgttgactgcacttccagccaggcagtggcggatcaatatgccgacttcctgcgcgaagg" "agcttttcattctgactgcaacgggcaatatgtctctgtgtggattaaaaaaagagtgtctgatagcagcttctgaactggttacctgccgtgagtaaattaaaattttattgacttaggtcactaaatactttaaccaatataggcatagcgcacagacagataaaaattacagagtacacaacatccatgaaacgcattagcaccaccattaccaccaccatcaccattaccacaggtaacggtgcgggctgacgcgtacaggaaacacagaaaaaagcccgcacctgacagtgcgggctttttttttcgaccaaaggtaacgaggtaacaaccatgcgagtgttgaagttcggcggtacatcagtggcaaatgcagaacgttttctgcgtgttgccgatattctggaaagcaatgccaggcaggggcaggtggccaccgtcctctctgcccccgccaaaatcaccaaccacctggtggcgatgattgaaaaaaccattagcggccaggatgctttacccaatatcagcgatgccgaacgtatttttgccgaacttttgacgggactcgccgccgcccagccggggttcccgctggcgcaattgaaaactttcgtcgatcaggaatttgcccaaataaaacatgtcctgcatggcattagtttgttggggcagtgcccggatagcatcaacgctgcgctgatttgccgtggcgagaaaatgtcgatcgccattatggccggcgtattagaagcgcgcggtcacaacgttactgttatcgatccggtcgaaaaactgctggcagtggggcattacctcgaatctaccgtcgatattgctgagtccacccgccgtattgcggcaagccgcattccggctgatcacatggtgctgatggcaggtttcaccgccggtaatgaaaaaggcgaactggtggtgcttggacgcaacggttccgactactctgctgcggtgctggctgcctgtttacgcgccgattgttgcgagatttggacggacgttgacggggtctatacctgcgacccgcgtcaggtgcccgatgcgaggttgttgaagtcgatgtcctaccaggaagcgatggagctttcctacttcggcgctaaagttcttcacccccgcaccattacccccatcgcccagttccagatcccttgcctgattaaaaataccggaaatcctcaagcaccaggtacgctcattggtgccagccgtgatgaagacgaattaccggtcaagggcatttccaatctgaataacatggcaatgttcagcgtttctggtccggggatgaaagggatggtcggcatggcggcgcgcgtctttgcagcgatgtcacgcgcccgtatttccgtggtgctgattacgcaatcatcttccgaatacagcatcagtttctgcgttccacaaagcgactgtgtgcgagctgaacgggcaatgcaggaagagttctacctggaactgaaagaaggcttactggagccgctggcagtgacggaacggctggccattatctcggtggtaggtgatggtatgcgcaccttgcgtgggatctcggcgaaattctttgccgcactggcccgcgccaatatcaacattgtcgccattgctcagggatcttctgaacgctcaatctctgtcgtggtaaataacgatgatgcgaccactggcgtgcgcgttactcatcagatgctgttcaataccgatcaggttatcgaagtgtttgtgattggcgtcggtggcgttggcggtgcgctgctggagcaactgaagcgtcagcaaagctggctgaagaataaacatatcgacttacgtgtctgcggtgttgccaactcgaaggctctgctcaccaatgtacatggccttaatctggaaaactggcaggaagaactggcgcaagccaaagagccgtttaatctcgggcgcttaattcgcctcgtgaaagaatatcatctgctgaacccggtcattgttgactgcacttccagccaggcagtggcggatcaatatgccgacttcctgcgcgaagg"
@ -93,7 +93,7 @@ const char* const TEST_DATA_1 =
// Test #3 // Test #3
// ========================================================================== // ==========================================================================
const uint64_t TEST_CHCK_ORIG_2 = 0xA0F9B63134DEF8B8, TEST_CHCK_ENCR_2[2U] = { 0xB4D0230508931578, 0x537B8A98B4F857AC }; const uint64_t TEST_CHCK_ORIG_2 = 0xA0F9B63134DEF8B8, TEST_CHCK_ENCR_2[4U] = { 0x8C4ABE00FFC5C079, 0xD30E4FF176F8022E, 0xB4D0230508931578, 0x537B8A98B4F857AC };
const char* const TEST_DATA_2 = const char* const TEST_DATA_2 =
"In the beginning God created the heaven and the earth. And the earth was without form, and void; and darkness was upon the face of the deep. And the Spirit of God moved upon the face of the waters. And God said, Let there be light: and there was light. And God saw the light, that it was good: and God divided the light from the darkness. And God called the light Day, and the darkness he called Night. And the evening and the morning were the first day. And God said, Let there be a firmament in the midst of the waters, and let it divide the waters from the waters. And God made the firmament, and divided the waters which were under the firmament from the waters which were above the firmament: and it was so. And God called the firmament Heaven. And the evening and the morning were the second day. And God said, Let the waters under the heaven be gathered together unto one place, and let the dry land appear: and it was so. And God called the dry land Earth; and the gathering together of the waters called he Seas: and God saw that it was good. And God said, Let the earth bring forth grass, the herb yielding seed, and the fruit tree yielding fruit after his kind, whose seed is in itself, upon the earth: and it was so. And the earth brought forth grass, and herb yielding seed after his kind, and the tree yielding fruit, whose seed was in itself, after his kind: and God saw that it was good. And the evening and the morning were the third day. And God said, Let there be lights in the firmament of the heaven to divide the day from the night; and let them be for signs, and for seasons, and for days, and years: And let them be for lights in the firmament of the heaven to give light upon the earth: and it was so. And God made two great lights; the greater light to rule the day, and the lesser light to rule the night: he made the stars also. And God set them in the firmament of the heaven to give light upon the earth, And to rule over the day and over the night, and to divide the light from the darkness: and God saw that it was g" "In the beginning God created the heaven and the earth. And the earth was without form, and void; and darkness was upon the face of the deep. And the Spirit of God moved upon the face of the waters. And God said, Let there be light: and there was light. And God saw the light, that it was good: and God divided the light from the darkness. And God called the light Day, and the darkness he called Night. And the evening and the morning were the first day. And God said, Let there be a firmament in the midst of the waters, and let it divide the waters from the waters. And God made the firmament, and divided the waters which were under the firmament from the waters which were above the firmament: and it was so. And God called the firmament Heaven. And the evening and the morning were the second day. And God said, Let the waters under the heaven be gathered together unto one place, and let the dry land appear: and it was so. And God called the dry land Earth; and the gathering together of the waters called he Seas: and God saw that it was good. And God said, Let the earth bring forth grass, the herb yielding seed, and the fruit tree yielding fruit after his kind, whose seed is in itself, upon the earth: and it was so. And the earth brought forth grass, and herb yielding seed after his kind, and the tree yielding fruit, whose seed was in itself, after his kind: and God saw that it was good. And the evening and the morning were the third day. And God said, Let there be lights in the firmament of the heaven to divide the day from the night; and let them be for signs, and for seasons, and for days, and years: And let them be for lights in the firmament of the heaven to give light upon the earth: and it was so. And God made two great lights; the greater light to rule the day, and the lesser light to rule the night: he made the stars also. And God set them in the firmament of the heaven to give light upon the earth, And to rule over the day and over the night, and to divide the light from the darkness: and God saw that it was g"
@ -133,7 +133,7 @@ const char* const TEST_DATA_2 =
// Test #4 // Test #4
// ========================================================================== // ==========================================================================
const uint64_t TEST_CHCK_ORIG_3 = 0x4B28AB3A096F81C8, TEST_CHCK_ENCR_3[2U] = { 0xCE2B6BDF11631CD1, 0x9A6E766CF732F29A }; const uint64_t TEST_CHCK_ORIG_3 = 0x4B28AB3A096F81C8, TEST_CHCK_ENCR_3[4U] = { 0x19D4C458C939F90C, 0xC010654E9959F418, 0xC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&>^*A=dOV,;:^lWRNQ((Qx6mP9(ddmF:s';lkv4$GLbov<!u[iI?t*n13:32\"qM[fL{be?Vp9<~TIj&Y^t#c"

View File

@ -13,9 +13,9 @@ extern const char* const TEST_DATA_1;
extern const char* const TEST_DATA_2; extern const char* const TEST_DATA_2;
extern const char* const TEST_DATA_3; extern const char* const TEST_DATA_3;
extern const uint64_t TEST_CHCK_ORIG_0, TEST_CHCK_ENCR_0[2U]; extern const uint64_t TEST_CHCK_ORIG_0, TEST_CHCK_ENCR_0[4U];
extern const uint64_t TEST_CHCK_ORIG_1, TEST_CHCK_ENCR_1[2U]; extern const uint64_t TEST_CHCK_ORIG_1, TEST_CHCK_ENCR_1[4U];
extern const uint64_t TEST_CHCK_ORIG_2, TEST_CHCK_ENCR_2[2U]; extern const uint64_t TEST_CHCK_ORIG_2, TEST_CHCK_ENCR_2[4U];
extern const uint64_t TEST_CHCK_ORIG_3, TEST_CHCK_ENCR_3[2U]; extern const uint64_t TEST_CHCK_ORIG_3, TEST_CHCK_ENCR_3[4U];
#endif #endif

View File

@ -78,11 +78,12 @@ static const size_t SLUNKCRYPT_PWDLEN_MAX = 256U;
/* /*
* Optional parameters * Optional parameters
*/ */
static const uint16_t SLUNKCRYPT_PARAM_VERSION = 1U; static const uint16_t SLUNKCRYPT_PARAM_VERSION = 2U;
typedef struct typedef struct
{ {
uint16_t version; /* Must set to SLUNKCRYPT_PARAM_VERSION */ uint16_t version; /* Must set to SLUNKCRYPT_PARAM_VERSION */
size_t thread_count; /* Number of threads, set to 0 for auto-detection */ size_t thread_count; /* Number of threads, set to 0 for auto-detection */
int legacy_init; /* Compatibility with pre-1.3.x versions */
} }
slunkparam_t; slunkparam_t;

View File

@ -83,11 +83,11 @@ static INLINE uint128_t hash_code(const uint128_t *const seed, const uint8_t *co
// Key derivation // Key derivation
// ========================================================================== // ==========================================================================
static INLINE uint64_t keygen_loop(uint64_t seed, const uint64_t i, const uint8_t *const passwd, const size_t passwd_len) static INLINE uint64_t keygen_loop(uint64_t seed, const uint64_t i, const uint8_t *const passwd, const size_t passwd_len, const size_t iterations)
{ {
uint128_t hash = { seed, i }; uint128_t hash = { seed, i };
size_t u; size_t u;
for (u = 0U, seed = 0U; u < 99971U; ++u) for (u = 0U, seed = 0U; u < iterations; ++u)
{ {
hash = hash_code(&hash, passwd, passwd_len); hash = hash_code(&hash, passwd, passwd_len);
seed ^= hash.hi ^ hash.lo; seed ^= hash.hi ^ hash.lo;
@ -95,9 +95,9 @@ static INLINE uint64_t keygen_loop(uint64_t seed, const uint64_t i, const uint8_
return seed; return seed;
} }
void slunkcrypt_keygen(keydata_t *const key, const uint64_t salt, const uint16_t pepper, const uint8_t *const passwd, const size_t passwd_len) void slunkcrypt_keygen(keydata_t *const key, const uint64_t salt, const uint16_t pepper, const uint8_t *const passwd, const size_t passwd_len, const size_t iterations)
{ {
key->a = keygen_loop(salt, 0x162603FA1CDA99D3 + (uint64_t)pepper, passwd, passwd_len); key->a = keygen_loop(salt, 0x162603FA1CDA99D3 + (uint64_t)pepper, passwd, passwd_len, iterations);
key->b = keygen_loop(salt, 0xBFDEC4A6C1A46E09 + (uint64_t)pepper, passwd, passwd_len); key->b = keygen_loop(salt, 0xBFDEC4A6C1A46E09 + (uint64_t)pepper, passwd, passwd_len, iterations);
key->c = keygen_loop(salt, 0x6BA17D11624973EE + (uint64_t)pepper, passwd, passwd_len); key->c = keygen_loop(salt, 0x6BA17D11624973EE + (uint64_t)pepper, passwd, passwd_len, iterations);
} }

View File

@ -15,6 +15,6 @@ typedef struct
} }
keydata_t; keydata_t;
void slunkcrypt_keygen(keydata_t *const key, const uint64_t salt, const uint16_t pepper, const uint8_t* const passwd, const size_t passwd_len); void slunkcrypt_keygen(keydata_t *const key, const uint64_t salt, const uint16_t pepper, const uint8_t* const passwd, const size_t passwd_len, const size_t iterations);
#endif #endif

View File

@ -56,6 +56,7 @@ crypt_data_t;
typedef struct typedef struct
{ {
int legacy_init;
thrdpl_t *thread_pool; thrdpl_t *thread_pool;
crypt_data_t data; crypt_data_t data;
} }
@ -125,12 +126,12 @@ static INLINE void random_skip(rand_state_t *const state, const size_t skip_coun
} }
} }
static INLINE void random_seed(rand_state_t *const state, uint64_t salt, const uint16_t pepper, const uint8_t *const passwd, const size_t passwd_len) static INLINE void random_seed(rand_state_t *const state, uint64_t salt, const uint16_t pepper, const uint8_t *const passwd, const size_t passwd_len, const int legacy)
{ {
keydata_t key; keydata_t key;
do do
{ {
slunkcrypt_keygen(&key, salt++, pepper, passwd, passwd_len); slunkcrypt_keygen(&key, salt++, pepper, passwd, passwd_len, legacy ? 99971U : 16487L);
random_init(state, &key); random_init(state, &key);
slunkcrypt_bzero(&key, sizeof(keydata_t)); slunkcrypt_bzero(&key, sizeof(keydata_t));
} }
@ -142,7 +143,27 @@ static INLINE void random_seed(rand_state_t *const state, uint64_t salt, const u
// Initialization // Initialization
// ========================================================================== // ==========================================================================
static int initialize_state(crypt_data_t *const data, const size_t thread_count, const uint64_t nonce, const uint8_t *const passwd, const size_t passwd_len, const int mode) static const uint16_t INITIALIZER[256U] =
{
0x5C33, 0x5C4B, 0x5C6F, 0x5D0B, 0x5D47, 0x5DD7, 0x5E13, 0x5E8B, 0x5EAF, 0x5F57, 0x5FCF, 0x6053, 0x62DB, 0x62FF, 0x63EF, 0x642B,
0x64C7, 0x64F7, 0x653F, 0x6593, 0x65F3, 0x675B, 0x6803, 0x6917, 0x692F, 0x69E3, 0x6A67, 0x6AA3, 0x6B87, 0x6C77, 0x6C9B, 0x6CB3,
0x6D73, 0x6E03, 0x6E93, 0x6E9F, 0x6F53, 0x6FBF, 0x6FE3, 0x7133, 0x71C3, 0x723B, 0x729B, 0x72D7, 0x732B, 0x737F, 0x73DF, 0x743F,
0x74B7, 0x75FB, 0x7673, 0x768B, 0x7703, 0x774B, 0x7853, 0x79A3, 0x7A1B, 0x7B3B, 0x7B5F, 0x7B77, 0x7C67, 0x7D03, 0x7DB7, 0x7EFB,
0x7F5B, 0x804B, 0x80DB, 0x8153, 0x8243, 0x8357, 0x836F, 0x83E7, 0x8447, 0x860F, 0x863F, 0x8717, 0x876B, 0x878F, 0x8957, 0x8A0B,
0x8A23, 0x8C27, 0x8C7B, 0x8CF3, 0x8DA7, 0x8DCB, 0x8E1F, 0x8E73, 0x8F4B, 0x9017, 0x903B, 0x9257, 0x92AB, 0x92E7, 0x93A7, 0x95B7,
0x96CB, 0x96EF, 0x975B, 0x977F, 0x97D3, 0x98C3, 0x98CF, 0x999B, 0x99FB, 0x9A4F, 0x9B63, 0x9B93, 0x9B9F, 0x9C2F, 0x9CBF, 0x9E33,
0x9F23, 0x9F53, 0x9F77, 0x9FB3, 0xA1AB, 0xA223, 0xA22F, 0xA247, 0xA26B, 0xA31F, 0xA373, 0xA397, 0xA3C7, 0xA427, 0xA4C3, 0xA53B,
0xA577, 0xA5CB, 0xA6BB, 0xA70F, 0xA757, 0xA8D7, 0xA98B, 0xA9A3, 0xAA57, 0xAB0B, 0xABFB, 0xAC7F, 0xACEB, 0xADE7, 0xADFF, 0xAE8F,
0xAE9B, 0xAF13, 0xAF43, 0xAF8B, 0xAFA3, 0xB01B, 0xB1BF, 0xB28B, 0xB33F, 0xB477, 0xB5DF, 0xB633, 0xB657, 0xB747, 0xB813, 0xB867,
0xB8EB, 0xB993, 0xBA17, 0xBACB, 0xBB5B, 0xBD17, 0xBD5F, 0xBDB3, 0xBF33, 0xBF7B, 0xBFCF, 0xC047, 0xC0D7, 0xC15B, 0xC317, 0xC3E3,
0xC51B, 0xC767, 0xC803, 0xC857, 0xC893, 0xC8CF, 0xC98F, 0xC9E3, 0xCA73, 0xCA7F, 0xCBFF, 0xCC9B, 0xCEB7, 0xCF0B, 0xCF9B, 0xD013,
0xD1C3, 0xD1FF, 0xD217, 0xD2E3, 0xD40F, 0xD523, 0xD6AF, 0xD727, 0xD73F, 0xD77B, 0xD8BF, 0xD8FB, 0xD943, 0xD9EB, 0xDA9F, 0xDAC3,
0xDAE7, 0xDDE7, 0xDEA7, 0xDF1F, 0xDF37, 0xDFC7, 0xE09F, 0xE0F3, 0xE177, 0xE1CB, 0xE22B, 0xE243, 0xE2BB, 0xE2D3, 0xE423, 0xE537,
0xE567, 0xE61B, 0xE657, 0xE6B7, 0xE837, 0xE963, 0xEC7B, 0xECE7, 0xED6B, 0xEDE3, 0xEF9F, 0xEFC3, 0xF06B, 0xF107, 0xF20F, 0xF257,
0xF35F, 0xF42B, 0xF4AF, 0xF5DB, 0xF743, 0xF7D3, 0xF863, 0xF86F, 0xF8E7, 0xFA07, 0xFA13, 0xFB1B, 0xFB3F, 0xFCFB, 0xFE27, 0xFE63
};
static int initialize_state(crypt_data_t *const data, const size_t thread_count, const uint64_t nonce, const uint8_t *const passwd, const size_t passwd_len, const int mode, const int legacy)
{ {
uint8_t temp[256U][256U]; uint8_t temp[256U][256U];
size_t r, i; size_t r, i;
@ -152,13 +173,13 @@ static int initialize_state(crypt_data_t *const data, const size_t thread_count,
slunkcrypt_bzero(data, sizeof(crypt_data_t)); slunkcrypt_bzero(data, sizeof(crypt_data_t));
/* initialize counter */ /* initialize counter */
random_seed(&data->thread_data[0].random, nonce, (uint16_t)(-1), passwd, passwd_len); random_seed(&data->thread_data[0].random, nonce, legacy ? ((uint16_t)(-1)) : 0xFE7B, passwd, passwd_len, legacy);
data->thread_data[0].counter = random_next(&data->thread_data[0].random); data->thread_data[0].counter = random_next(&data->thread_data[0].random);
/* set up the wheel permutations */ /* set up the wheel permutations */
for (r = 0U; r < 256U; ++r) for (r = 0U; r < 256U; ++r)
{ {
random_seed(&data->thread_data[0].random, nonce, (uint16_t)r, passwd, passwd_len); random_seed(&data->thread_data[0].random, nonce, legacy ? ((uint16_t)r) : INITIALIZER[r], passwd, passwd_len, legacy);
for (i = 0U; i < 256U; ++i) for (i = 0U; i < 256U; ++i)
{ {
const size_t j = random_next(&data->thread_data[0].random) % (i + 1U); const size_t j = random_next(&data->thread_data[0].random) % (i + 1U);
@ -193,7 +214,7 @@ static int initialize_state(crypt_data_t *const data, const size_t thread_count,
data->thread_data[0].reverse_mode = reverse_mode; data->thread_data[0].reverse_mode = reverse_mode;
data->thread_data[0].wheel = (const uint8_t(*)[256]) data->wheel; data->thread_data[0].wheel = (const uint8_t(*)[256]) data->wheel;
data->thread_data[0].index_off = 0U; data->thread_data[0].index_off = 0U;
random_seed(&data->thread_data[0].random, nonce, 256U, passwd, passwd_len); random_seed(&data->thread_data[0].random, nonce, legacy ? 256U : 0xFEF3, passwd, passwd_len, legacy);
for (i = 1U; i < thread_count; ++i) for (i = 1U; i < thread_count; ++i)
{ {
data->thread_data[i].reverse_mode = data->thread_data[0].reverse_mode; data->thread_data[i].reverse_mode = data->thread_data[0].reverse_mode;
@ -293,7 +314,7 @@ int slunkcrypt_generate_nonce(uint64_t *const nonce)
slunkcrypt_t slunkcrypt_alloc(const uint64_t nonce, const uint8_t *const passwd, const size_t passwd_len, const int mode) slunkcrypt_t slunkcrypt_alloc(const uint64_t nonce, const uint8_t *const passwd, const size_t passwd_len, const int mode)
{ {
slunkparam_t param = { SLUNKCRYPT_PARAM_VERSION, 0U }; slunkparam_t param = { SLUNKCRYPT_PARAM_VERSION, 0U, 1 };
return slunkcrypt_alloc_ext(nonce, passwd, passwd_len, mode, &param); return slunkcrypt_alloc_ext(nonce, passwd, passwd_len, mode, &param);
} }
@ -322,7 +343,9 @@ slunkcrypt_t slunkcrypt_alloc_ext(const uint64_t nonce, const uint8_t *const pas
} }
} }
if (initialize_state(&state->data, THREAD_COUNT(state), nonce, passwd, passwd_len, mode) == SLUNKCRYPT_SUCCESS) state->legacy_init = (param->version > 1U) ? BOOLIFY(param->legacy_init) : 1;
if (initialize_state(&state->data, THREAD_COUNT(state), nonce, passwd, passwd_len, mode, state->legacy_init) == SLUNKCRYPT_SUCCESS)
{ {
return (slunkcrypt_t)state; return (slunkcrypt_t)state;
} }
@ -340,10 +363,12 @@ int slunkcrypt_reset(const slunkcrypt_t context, const uint64_t nonce, const uin
{ {
return SLUNKCRYPT_FAILURE; return SLUNKCRYPT_FAILURE;
} }
if ((result = initialize_state(&state->data, THREAD_COUNT(state), nonce, passwd, passwd_len, mode)) != SLUNKCRYPT_SUCCESS)
if ((result = initialize_state(&state->data, THREAD_COUNT(state), nonce, passwd, passwd_len, mode, state->legacy_init)) != SLUNKCRYPT_SUCCESS)
{ {
slunkcrypt_bzero(&state->data, sizeof(crypt_data_t)); slunkcrypt_bzero(&state->data, sizeof(crypt_data_t));
} }
return result; return result;
} }

View File

@ -7,7 +7,7 @@
#define INC_SLUNKCRYPT_VERSION_H #define INC_SLUNKCRYPT_VERSION_H
#define LIB_VERSION_MAJOR 1 #define LIB_VERSION_MAJOR 1
#define LIB_VERSION_MINOR 2 #define LIB_VERSION_MINOR 3
#define LIB_VERSION_PATCH 1 #define LIB_VERSION_PATCH 0
#endif #endif