Precompute byteswap for salt in -m 28200

pull/3533/head
jsteube 1 year ago
parent 3035f4c24f
commit 57fe66dd10

@ -291,7 +291,7 @@ KERNEL_FQ void m28200_init (KERN_ATTR_TMPS_ESALT (exodus_tmp_t, exodus_t))
sha256_hmac_init_global_swap (&sha256_hmac_ctx, pws[gid].i, pws[gid].pw_len);
sha256_hmac_update_global_swap (&sha256_hmac_ctx, salt_bufs[SALT_POS_HOST].salt_buf, salt_bufs[SALT_POS_HOST].salt_len);
sha256_hmac_update_global (&sha256_hmac_ctx, salt_bufs[SALT_POS_HOST].salt_buf, salt_bufs[SALT_POS_HOST].salt_len);
for (u32 i = 0, j = 1, k = 0; i < SCRYPT_CNT; i += 8, j += 1, k += 2)
{

@ -369,6 +369,8 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
memcpy (salt->salt_buf, tmp_buf, tmp_len);
for (int i = 0; i < 8; i++) salt->salt_buf[i] = byte_swap_32 (salt->salt_buf[i]);
salt->salt_len = tmp_len;
// iv
@ -428,9 +430,13 @@ int module_hash_encode (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSE
// salt
u32 tmp_salt[8] = { 0 };
for (int i = 0; i < 8; i++) tmp_salt[i] = byte_swap_32 (salt->salt_buf[i]);
char base64_salt[64];
int base64_salt_len = base64_encode (int_to_base64, (const u8 *) salt->salt_buf, salt->salt_len, (u8 *) base64_salt);
int base64_salt_len = base64_encode (int_to_base64, (const u8 *) tmp_salt, salt->salt_len, (u8 *) base64_salt);
base64_salt[base64_salt_len] = 0;

Loading…
Cancel
Save