mirror of
https://github.com/hashcat/hashcat.git
synced 2025-01-22 05:31:11 +00:00
Renumber PEM module to 22900
Also took the liberty of removing old PKCS1 naming everywhere, so as to prevent future confusion.
This commit is contained in:
parent
f6322dccd5
commit
70441138ed
@ -5,7 +5,7 @@
|
||||
|
||||
#include "inc_types.h"
|
||||
#include "inc_vendor.h"
|
||||
#include "inc_pkcs1_common.h"
|
||||
#include "inc_pem_common.h"
|
||||
|
||||
#ifdef KERNEL_STATIC
|
||||
#include "inc_hash_md5.cl"
|
||||
@ -28,7 +28,7 @@ DECLSPEC void generate_key (u32 *salt_buf, u32 *pw, size_t pw_len, u32 *key)
|
||||
|
||||
md5_init (&md_ctx);
|
||||
md5_update (&md_ctx, pw, pw_len);
|
||||
md5_update (&md_ctx, salt_buf, HC_PKCS1_SALT_LENGTH);
|
||||
md5_update (&md_ctx, salt_buf, HC_PEM_SALT_LENGTH);
|
||||
md5_final (&md_ctx);
|
||||
|
||||
key[0] = md_ctx.h[0];
|
||||
@ -50,15 +50,15 @@ DECLSPEC void generate_key (u32 *salt_buf, u32 *pw, size_t pw_len, u32 *key)
|
||||
#ifdef _unroll
|
||||
#pragma unroll
|
||||
#endif
|
||||
for (u32 i = 0; i < HC_PKCS1_MD_LENGTH / 4; i++)
|
||||
for (u32 i = 0; i < HC_PEM_MD_LENGTH / 4; i++)
|
||||
{
|
||||
md_buf[i] = md_ctx.h[i];
|
||||
}
|
||||
|
||||
md5_init (&md_ctx);
|
||||
md5_update (&md_ctx, md_buf, HC_PKCS1_MD_LENGTH);
|
||||
md5_update (&md_ctx, md_buf, HC_PEM_MD_LENGTH);
|
||||
md5_update (&md_ctx, pw, pw_len);
|
||||
md5_update (&md_ctx, salt_buf, HC_PKCS1_SALT_LENGTH);
|
||||
md5_update (&md_ctx, salt_buf, HC_PEM_SALT_LENGTH);
|
||||
md5_final (&md_ctx);
|
||||
|
||||
key[4] = md_ctx.h[0];
|
||||
@ -107,7 +107,7 @@ DECLSPEC void generate_key_vector (u32 *salt_buf, u32x *pw, size_t pw_len, u32x
|
||||
|
||||
md5_init_vector (&md_ctx);
|
||||
md5_update_vector (&md_ctx, pw, pw_len);
|
||||
md5_update_vector_from_scalar (&md_ctx, salt_buf, HC_PKCS1_SALT_LENGTH);
|
||||
md5_update_vector_from_scalar (&md_ctx, salt_buf, HC_PEM_SALT_LENGTH);
|
||||
md5_final_vector (&md_ctx);
|
||||
|
||||
key[0] = md_ctx.h[0];
|
||||
@ -129,15 +129,15 @@ DECLSPEC void generate_key_vector (u32 *salt_buf, u32x *pw, size_t pw_len, u32x
|
||||
#ifdef _unroll
|
||||
#pragma unroll
|
||||
#endif
|
||||
for (u32 i = 0; i < HC_PKCS1_MD_LENGTH / 4; i++)
|
||||
for (u32 i = 0; i < HC_PEM_MD_LENGTH / 4; i++)
|
||||
{
|
||||
md_buf[i] = md_ctx.h[i];
|
||||
}
|
||||
|
||||
md5_init_vector (&md_ctx);
|
||||
md5_update_vector (&md_ctx, md_buf, HC_PKCS1_MD_LENGTH);
|
||||
md5_update_vector (&md_ctx, md_buf, HC_PEM_MD_LENGTH);
|
||||
md5_update_vector (&md_ctx, pw, pw_len);
|
||||
md5_update_vector_from_scalar (&md_ctx, salt_buf, HC_PKCS1_SALT_LENGTH);
|
||||
md5_update_vector_from_scalar (&md_ctx, salt_buf, HC_PEM_SALT_LENGTH);
|
||||
md5_final_vector (&md_ctx);
|
||||
|
||||
key[4] = md_ctx.h[0];
|
||||
@ -169,12 +169,12 @@ DECLSPEC void generate_key_vector (u32 *salt_buf, u32x *pw, size_t pw_len, u32x
|
||||
#endif // DEBUG
|
||||
}
|
||||
|
||||
DECLSPEC void prep_buffers(u32 *salt_buf, u32 *salt_iv, u32 *first_block, PSEUDO_SHM_TYPE u32 *data, GLOBAL_AS const pkcs1_t *esalt)
|
||||
DECLSPEC void prep_buffers(u32 *salt_buf, u32 *salt_iv, u32 *first_block, PSEUDO_SHM_TYPE u32 *data, GLOBAL_AS const pem_t *esalt)
|
||||
{
|
||||
#ifdef _unroll
|
||||
#pragma unroll
|
||||
#endif
|
||||
for (u32 i = 0; i < HC_PKCS1_SALT_LENGTH / 4; i++)
|
||||
for (u32 i = 0; i < HC_PEM_SALT_LENGTH / 4; i++)
|
||||
{
|
||||
salt_buf[i] = esalt->salt_iv[i];
|
||||
}
|
35
OpenCL/inc_pem_common.h
Normal file
35
OpenCL/inc_pem_common.h
Normal file
@ -0,0 +1,35 @@
|
||||
/**
|
||||
* Author......: See docs/credits.txt
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
#ifndef _INC_PEM_COMMON_H
|
||||
#define _INC_PEM_COMMON_H
|
||||
|
||||
#define HC_PEM_SALT_LENGTH 8
|
||||
#define HC_PEM_MD_LENGTH 16
|
||||
|
||||
#define HC_PEM_MAX_BLOCK_SIZE 16
|
||||
#define HC_PEM_MAX_KEY_LENGTH 32
|
||||
#define HC_PEM_MAX_DATA_LENGTH 12288
|
||||
|
||||
typedef struct pem
|
||||
{
|
||||
void *chosen_cipher;
|
||||
u32 salt_iv[HC_PEM_MAX_BLOCK_SIZE / 4];
|
||||
|
||||
u32 data[HC_PEM_MAX_DATA_LENGTH / 4];
|
||||
size_t data_len;
|
||||
} pem_t;
|
||||
|
||||
#ifdef REAL_SHM
|
||||
#define PSEUDO_SHM_TYPE LOCAL_AS
|
||||
#else
|
||||
#define PSEUDO_SHM_TYPE
|
||||
#endif
|
||||
|
||||
DECLSPEC void generate_key (u32 *salt_buf, u32 *pw, size_t pw_len, u32 *key);
|
||||
DECLSPEC void generate_key_vector (u32 *salt_buf, u32x *pw, size_t pw_len, u32x *key);
|
||||
DECLSPEC void prep_buffers (u32 *salt_buf, u32 *salt_iv, u32 *first_block, PSEUDO_SHM_TYPE u32 *data, GLOBAL_AS const pem_t *esalt);
|
||||
|
||||
#endif // _INC_PEM_COMMON_H
|
@ -1,35 +0,0 @@
|
||||
/**
|
||||
* Author......: See docs/credits.txt
|
||||
* License.....: MIT
|
||||
*/
|
||||
|
||||
#ifndef _INC_PKCS1_COMMON_H
|
||||
#define _INC_PKCS1_COMMON_H
|
||||
|
||||
#define HC_PKCS1_SALT_LENGTH 8
|
||||
#define HC_PKCS1_MD_LENGTH 16
|
||||
|
||||
#define HC_PKCS1_MAX_BLOCK_SIZE 16
|
||||
#define HC_PKCS1_MAX_KEY_LENGTH 32
|
||||
#define HC_PKCS1_MAX_DATA_LENGTH 12288
|
||||
|
||||
typedef struct pkcs1
|
||||
{
|
||||
void *chosen_cipher;
|
||||
u32 salt_iv[HC_PKCS1_MAX_BLOCK_SIZE / 4];
|
||||
|
||||
u32 data[HC_PKCS1_MAX_DATA_LENGTH / 4];
|
||||
size_t data_len;
|
||||
} pkcs1_t;
|
||||
|
||||
#ifdef REAL_SHM
|
||||
#define PSEUDO_SHM_TYPE LOCAL_AS
|
||||
#else
|
||||
#define PSEUDO_SHM_TYPE
|
||||
#endif
|
||||
|
||||
DECLSPEC void generate_key (u32 *salt_buf, u32 *pw, size_t pw_len, u32 *key);
|
||||
DECLSPEC void generate_key_vector (u32 *salt_buf, u32x *pw, size_t pw_len, u32x *key);
|
||||
DECLSPEC void prep_buffers (u32 *salt_buf, u32 *salt_iv, u32 *first_block, PSEUDO_SHM_TYPE u32 *data, GLOBAL_AS const pkcs1_t *esalt);
|
||||
|
||||
#endif // _INC_PKCS1_COMMON_H
|
@ -13,10 +13,10 @@
|
||||
#include "inc_common.cl"
|
||||
#include "inc_rp.cl"
|
||||
#include "inc_cipher_des.cl"
|
||||
#include "inc_pkcs1_common.cl"
|
||||
#include "inc_pem_common.cl"
|
||||
#endif // KERNEL_STATIC
|
||||
|
||||
KERNEL_FQ void m24111_sxx (KERN_ATTR_RULES_ESALT (pkcs1_t))
|
||||
KERNEL_FQ void m22911_sxx (KERN_ATTR_RULES_ESALT (pem_t))
|
||||
{
|
||||
/**
|
||||
* base
|
||||
@ -33,7 +33,7 @@ KERNEL_FQ void m24111_sxx (KERN_ATTR_RULES_ESALT (pkcs1_t))
|
||||
LOCAL_VK u32 data_len;
|
||||
data_len = esalt_bufs[digests_offset].data_len;
|
||||
|
||||
LOCAL_VK u32 data[HC_PKCS1_MAX_DATA_LENGTH / 4];
|
||||
LOCAL_VK u32 data[HC_PEM_MAX_DATA_LENGTH / 4];
|
||||
|
||||
for (u32 i = lid; i <= data_len / 4; i += lsz)
|
||||
{
|
||||
@ -69,7 +69,7 @@ KERNEL_FQ void m24111_sxx (KERN_ATTR_RULES_ESALT (pkcs1_t))
|
||||
#else
|
||||
|
||||
const size_t data_len = esalt_bufs[digests_offset].data_len;
|
||||
u32 data[HC_PKCS1_MAX_DATA_LENGTH / 4];
|
||||
u32 data[HC_PEM_MAX_DATA_LENGTH / 4];
|
||||
|
||||
#ifdef _unroll
|
||||
#pragma unroll
|
||||
@ -97,7 +97,7 @@ KERNEL_FQ void m24111_sxx (KERN_ATTR_RULES_ESALT (pkcs1_t))
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
||||
{
|
||||
u32 key[HC_PKCS1_MAX_KEY_LENGTH / 4];
|
||||
u32 key[HC_PEM_MAX_KEY_LENGTH / 4];
|
||||
|
||||
pw_t tmp = PASTE_PW;
|
||||
|
@ -12,10 +12,10 @@
|
||||
#include "inc_platform.cl"
|
||||
#include "inc_common.cl"
|
||||
#include "inc_cipher_des.cl"
|
||||
#include "inc_pkcs1_common.cl"
|
||||
#include "inc_pem_common.cl"
|
||||
#endif // KERNEL_STATIC
|
||||
|
||||
KERNEL_FQ void m24111_sxx (KERN_ATTR_ESALT (pkcs1_t))
|
||||
KERNEL_FQ void m22911_sxx (KERN_ATTR_ESALT (pem_t))
|
||||
{
|
||||
/**
|
||||
* base
|
||||
@ -32,7 +32,7 @@ KERNEL_FQ void m24111_sxx (KERN_ATTR_ESALT (pkcs1_t))
|
||||
LOCAL_VK u32 data_len;
|
||||
data_len = esalt_bufs[digests_offset].data_len;
|
||||
|
||||
LOCAL_VK u32 data[HC_PKCS1_MAX_DATA_LENGTH / 4];
|
||||
LOCAL_VK u32 data[HC_PEM_MAX_DATA_LENGTH / 4];
|
||||
|
||||
for (u32 i = lid; i <= data_len / 4; i += lsz)
|
||||
{
|
||||
@ -68,7 +68,7 @@ KERNEL_FQ void m24111_sxx (KERN_ATTR_ESALT (pkcs1_t))
|
||||
#else
|
||||
|
||||
const size_t data_len = esalt_bufs[digests_offset].data_len;
|
||||
u32 data[HC_PKCS1_MAX_DATA_LENGTH / 4];
|
||||
u32 data[HC_PEM_MAX_DATA_LENGTH / 4];
|
||||
|
||||
#ifdef _unroll
|
||||
#pragma unroll
|
||||
@ -124,7 +124,7 @@ KERNEL_FQ void m24111_sxx (KERN_ATTR_ESALT (pkcs1_t))
|
||||
c[i] |= w[i];
|
||||
}
|
||||
|
||||
u32 key[HC_PKCS1_MAX_KEY_LENGTH / 4];
|
||||
u32 key[HC_PEM_MAX_KEY_LENGTH / 4];
|
||||
|
||||
generate_key (salt_buf, c, pw_len + comb_len, key);
|
||||
|
@ -15,10 +15,10 @@
|
||||
#include "inc_common.cl"
|
||||
#include "inc_simd.cl"
|
||||
#include "inc_cipher_des.cl"
|
||||
#include "inc_pkcs1_common.cl"
|
||||
#include "inc_pem_common.cl"
|
||||
#endif // KERNEL_STATIC
|
||||
|
||||
KERNEL_FQ void m24111_sxx (KERN_ATTR_VECTOR_ESALT (pkcs1_t))
|
||||
KERNEL_FQ void m22911_sxx (KERN_ATTR_VECTOR_ESALT (pem_t))
|
||||
{
|
||||
/**
|
||||
* base
|
||||
@ -35,7 +35,7 @@ KERNEL_FQ void m24111_sxx (KERN_ATTR_VECTOR_ESALT (pkcs1_t))
|
||||
LOCAL_VK u32 data_len;
|
||||
data_len = esalt_bufs[digests_offset].data_len;
|
||||
|
||||
LOCAL_VK u32 data[HC_PKCS1_MAX_DATA_LENGTH / 4];
|
||||
LOCAL_VK u32 data[HC_PEM_MAX_DATA_LENGTH / 4];
|
||||
|
||||
for (u32 i = lid; i <= data_len / 4; i += lsz)
|
||||
{
|
||||
@ -71,7 +71,7 @@ KERNEL_FQ void m24111_sxx (KERN_ATTR_VECTOR_ESALT (pkcs1_t))
|
||||
#else
|
||||
|
||||
const size_t data_len = esalt_bufs[digests_offset].data_len;
|
||||
u32 data[HC_PKCS1_MAX_DATA_LENGTH / 4];
|
||||
u32 data[HC_PEM_MAX_DATA_LENGTH / 4];
|
||||
|
||||
#ifdef _unroll
|
||||
#pragma unroll
|
||||
@ -113,7 +113,7 @@ KERNEL_FQ void m24111_sxx (KERN_ATTR_VECTOR_ESALT (pkcs1_t))
|
||||
|
||||
w[0] = w0;
|
||||
|
||||
u32x key[HC_PKCS1_MAX_KEY_LENGTH / 4];
|
||||
u32x key[HC_PEM_MAX_KEY_LENGTH / 4];
|
||||
|
||||
generate_key_vector (salt_buf, w, pw_len, key);
|
||||
|
@ -13,10 +13,10 @@
|
||||
#include "inc_common.cl"
|
||||
#include "inc_rp.cl"
|
||||
#include "inc_cipher_des.cl"
|
||||
#include "inc_pkcs1_common.cl"
|
||||
#include "inc_pem_common.cl"
|
||||
#endif // KERNEL_STATIC
|
||||
|
||||
KERNEL_FQ void m24121_sxx (KERN_ATTR_RULES_ESALT (pkcs1_t))
|
||||
KERNEL_FQ void m22921_sxx (KERN_ATTR_RULES_ESALT (pem_t))
|
||||
{
|
||||
/**
|
||||
* base
|
||||
@ -33,7 +33,7 @@ KERNEL_FQ void m24121_sxx (KERN_ATTR_RULES_ESALT (pkcs1_t))
|
||||
LOCAL_VK u32 data_len;
|
||||
data_len = esalt_bufs[digests_offset].data_len;
|
||||
|
||||
LOCAL_VK u32 data[HC_PKCS1_MAX_DATA_LENGTH / 4];
|
||||
LOCAL_VK u32 data[HC_PEM_MAX_DATA_LENGTH / 4];
|
||||
|
||||
for (u32 i = lid; i <= data_len / 4; i += lsz)
|
||||
{
|
||||
@ -69,7 +69,7 @@ KERNEL_FQ void m24121_sxx (KERN_ATTR_RULES_ESALT (pkcs1_t))
|
||||
#else
|
||||
|
||||
const size_t data_len = esalt_bufs[digests_offset].data_len;
|
||||
u32 data[HC_PKCS1_MAX_DATA_LENGTH / 4];
|
||||
u32 data[HC_PEM_MAX_DATA_LENGTH / 4];
|
||||
|
||||
#ifdef _unroll
|
||||
#pragma unroll
|
||||
@ -97,7 +97,7 @@ KERNEL_FQ void m24121_sxx (KERN_ATTR_RULES_ESALT (pkcs1_t))
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
||||
{
|
||||
u32 key[HC_PKCS1_MAX_KEY_LENGTH / 4];
|
||||
u32 key[HC_PEM_MAX_KEY_LENGTH / 4];
|
||||
|
||||
pw_t tmp = PASTE_PW;
|
||||
|
@ -12,10 +12,10 @@
|
||||
#include "inc_platform.cl"
|
||||
#include "inc_common.cl"
|
||||
#include "inc_cipher_des.cl"
|
||||
#include "inc_pkcs1_common.cl"
|
||||
#include "inc_pem_common.cl"
|
||||
#endif // KERNEL_STATIC
|
||||
|
||||
KERNEL_FQ void m24121_sxx (KERN_ATTR_ESALT (pkcs1_t))
|
||||
KERNEL_FQ void m22921_sxx (KERN_ATTR_ESALT (pem_t))
|
||||
{
|
||||
/**
|
||||
* base
|
||||
@ -32,7 +32,7 @@ KERNEL_FQ void m24121_sxx (KERN_ATTR_ESALT (pkcs1_t))
|
||||
LOCAL_VK u32 data_len;
|
||||
data_len = esalt_bufs[digests_offset].data_len;
|
||||
|
||||
LOCAL_VK u32 data[HC_PKCS1_MAX_DATA_LENGTH / 4];
|
||||
LOCAL_VK u32 data[HC_PEM_MAX_DATA_LENGTH / 4];
|
||||
|
||||
for (u32 i = lid; i <= data_len / 4; i += lsz)
|
||||
{
|
||||
@ -68,7 +68,7 @@ KERNEL_FQ void m24121_sxx (KERN_ATTR_ESALT (pkcs1_t))
|
||||
#else
|
||||
|
||||
const size_t data_len = esalt_bufs[digests_offset].data_len;
|
||||
u32 data[HC_PKCS1_MAX_DATA_LENGTH / 4];
|
||||
u32 data[HC_PEM_MAX_DATA_LENGTH / 4];
|
||||
|
||||
#ifdef _unroll
|
||||
#pragma unroll
|
||||
@ -124,7 +124,7 @@ KERNEL_FQ void m24121_sxx (KERN_ATTR_ESALT (pkcs1_t))
|
||||
c[i] |= w[i];
|
||||
}
|
||||
|
||||
u32 key[HC_PKCS1_MAX_KEY_LENGTH / 4];
|
||||
u32 key[HC_PEM_MAX_KEY_LENGTH / 4];
|
||||
|
||||
generate_key (salt_buf, c, pw_len + comb_len, key);
|
||||
|
@ -15,10 +15,10 @@
|
||||
#include "inc_common.cl"
|
||||
#include "inc_simd.cl"
|
||||
#include "inc_cipher_des.cl"
|
||||
#include "inc_pkcs1_common.cl"
|
||||
#include "inc_pem_common.cl"
|
||||
#endif // KERNEL_STATIC
|
||||
|
||||
KERNEL_FQ void m24121_sxx (KERN_ATTR_VECTOR_ESALT (pkcs1_t))
|
||||
KERNEL_FQ void m22921_sxx (KERN_ATTR_VECTOR_ESALT (pem_t))
|
||||
{
|
||||
/**
|
||||
* base
|
||||
@ -35,7 +35,7 @@ KERNEL_FQ void m24121_sxx (KERN_ATTR_VECTOR_ESALT (pkcs1_t))
|
||||
LOCAL_VK u32 data_len;
|
||||
data_len = esalt_bufs[digests_offset].data_len;
|
||||
|
||||
LOCAL_VK u32 data[HC_PKCS1_MAX_DATA_LENGTH / 4];
|
||||
LOCAL_VK u32 data[HC_PEM_MAX_DATA_LENGTH / 4];
|
||||
|
||||
for (u32 i = lid; i <= data_len / 4; i += lsz)
|
||||
{
|
||||
@ -71,7 +71,7 @@ KERNEL_FQ void m24121_sxx (KERN_ATTR_VECTOR_ESALT (pkcs1_t))
|
||||
#else
|
||||
|
||||
const size_t data_len = esalt_bufs[digests_offset].data_len;
|
||||
u32 data[HC_PKCS1_MAX_DATA_LENGTH / 4];
|
||||
u32 data[HC_PEM_MAX_DATA_LENGTH / 4];
|
||||
|
||||
#ifdef _unroll
|
||||
#pragma unroll
|
||||
@ -113,7 +113,7 @@ KERNEL_FQ void m24121_sxx (KERN_ATTR_VECTOR_ESALT (pkcs1_t))
|
||||
|
||||
w[0] = w0;
|
||||
|
||||
u32x key[HC_PKCS1_MAX_KEY_LENGTH / 4];
|
||||
u32x key[HC_PEM_MAX_KEY_LENGTH / 4];
|
||||
|
||||
generate_key_vector (salt_buf, w, pw_len, key);
|
||||
|
@ -13,10 +13,10 @@
|
||||
#include "inc_common.cl"
|
||||
#include "inc_rp.cl"
|
||||
#include "inc_cipher_aes.cl"
|
||||
#include "inc_pkcs1_common.cl"
|
||||
#include "inc_pem_common.cl"
|
||||
#endif // KERNEL_STATIC
|
||||
|
||||
KERNEL_FQ void m24131_sxx (KERN_ATTR_RULES_ESALT (pkcs1_t))
|
||||
KERNEL_FQ void m22931_sxx (KERN_ATTR_RULES_ESALT (pem_t))
|
||||
{
|
||||
/**
|
||||
* base
|
||||
@ -33,7 +33,7 @@ KERNEL_FQ void m24131_sxx (KERN_ATTR_RULES_ESALT (pkcs1_t))
|
||||
LOCAL_VK u32 data_len;
|
||||
data_len = esalt_bufs[digests_offset].data_len;
|
||||
|
||||
LOCAL_VK u32 data[HC_PKCS1_MAX_DATA_LENGTH / 4];
|
||||
LOCAL_VK u32 data[HC_PEM_MAX_DATA_LENGTH / 4];
|
||||
|
||||
for (u32 i = lid; i <= data_len / 4; i += lsz)
|
||||
{
|
||||
@ -72,7 +72,7 @@ KERNEL_FQ void m24131_sxx (KERN_ATTR_RULES_ESALT (pkcs1_t))
|
||||
#else
|
||||
|
||||
const size_t data_len = esalt_bufs[digests_offset].data_len;
|
||||
u32 data[HC_PKCS1_MAX_DATA_LENGTH / 4];
|
||||
u32 data[HC_PEM_MAX_DATA_LENGTH / 4];
|
||||
|
||||
#ifdef _unroll
|
||||
#pragma unroll
|
||||
@ -109,7 +109,7 @@ KERNEL_FQ void m24131_sxx (KERN_ATTR_RULES_ESALT (pkcs1_t))
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
||||
{
|
||||
u32 key[HC_PKCS1_MAX_KEY_LENGTH / 4];
|
||||
u32 key[HC_PEM_MAX_KEY_LENGTH / 4];
|
||||
|
||||
pw_t tmp = PASTE_PW;
|
||||
|
@ -12,10 +12,10 @@
|
||||
#include "inc_platform.cl"
|
||||
#include "inc_common.cl"
|
||||
#include "inc_cipher_aes.cl"
|
||||
#include "inc_pkcs1_common.cl"
|
||||
#include "inc_pem_common.cl"
|
||||
#endif // KERNEL_STATIC
|
||||
|
||||
KERNEL_FQ void m24131_sxx (KERN_ATTR_ESALT (pkcs1_t))
|
||||
KERNEL_FQ void m22931_sxx (KERN_ATTR_ESALT (pem_t))
|
||||
{
|
||||
/**
|
||||
* base
|
||||
@ -32,7 +32,7 @@ KERNEL_FQ void m24131_sxx (KERN_ATTR_ESALT (pkcs1_t))
|
||||
LOCAL_VK u32 data_len;
|
||||
data_len = esalt_bufs[digests_offset].data_len;
|
||||
|
||||
LOCAL_VK u32 data[HC_PKCS1_MAX_DATA_LENGTH / 4];
|
||||
LOCAL_VK u32 data[HC_PEM_MAX_DATA_LENGTH / 4];
|
||||
|
||||
for (u32 i = lid; i <= data_len / 4; i += lsz)
|
||||
{
|
||||
@ -71,7 +71,7 @@ KERNEL_FQ void m24131_sxx (KERN_ATTR_ESALT (pkcs1_t))
|
||||
#else
|
||||
|
||||
const size_t data_len = esalt_bufs[digests_offset].data_len;
|
||||
u32 data[HC_PKCS1_MAX_DATA_LENGTH / 4];
|
||||
u32 data[HC_PEM_MAX_DATA_LENGTH / 4];
|
||||
|
||||
#ifdef _unroll
|
||||
#pragma unroll
|
||||
@ -136,7 +136,7 @@ KERNEL_FQ void m24131_sxx (KERN_ATTR_ESALT (pkcs1_t))
|
||||
c[i] |= w[i];
|
||||
}
|
||||
|
||||
u32 key[HC_PKCS1_MAX_KEY_LENGTH / 4];
|
||||
u32 key[HC_PEM_MAX_KEY_LENGTH / 4];
|
||||
|
||||
generate_key (salt_buf, c, pw_len + comb_len, key);
|
||||
|
@ -15,10 +15,10 @@
|
||||
#include "inc_common.cl"
|
||||
#include "inc_simd.cl"
|
||||
#include "inc_cipher_aes.cl"
|
||||
#include "inc_pkcs1_common.cl"
|
||||
#include "inc_pem_common.cl"
|
||||
#endif // KERNEL_STATIC
|
||||
|
||||
KERNEL_FQ void m24131_sxx (KERN_ATTR_VECTOR_ESALT (pkcs1_t))
|
||||
KERNEL_FQ void m22931_sxx (KERN_ATTR_VECTOR_ESALT (pem_t))
|
||||
{
|
||||
/**
|
||||
* base
|
||||
@ -35,7 +35,7 @@ KERNEL_FQ void m24131_sxx (KERN_ATTR_VECTOR_ESALT (pkcs1_t))
|
||||
LOCAL_VK u32 data_len;
|
||||
data_len = esalt_bufs[digests_offset].data_len;
|
||||
|
||||
LOCAL_VK u32 data[HC_PKCS1_MAX_DATA_LENGTH / 4];
|
||||
LOCAL_VK u32 data[HC_PEM_MAX_DATA_LENGTH / 4];
|
||||
|
||||
for (u32 i = lid; i <= data_len / 4; i += lsz)
|
||||
{
|
||||
@ -74,7 +74,7 @@ KERNEL_FQ void m24131_sxx (KERN_ATTR_VECTOR_ESALT (pkcs1_t))
|
||||
#else
|
||||
|
||||
const size_t data_len = esalt_bufs[digests_offset].data_len;
|
||||
u32 data[HC_PKCS1_MAX_DATA_LENGTH / 4];
|
||||
u32 data[HC_PEM_MAX_DATA_LENGTH / 4];
|
||||
|
||||
#ifdef _unroll
|
||||
#pragma unroll
|
@ -13,10 +13,10 @@
|
||||
#include "inc_common.cl"
|
||||
#include "inc_rp.cl"
|
||||
#include "inc_cipher_aes.cl"
|
||||
#include "inc_pkcs1_common.cl"
|
||||
#include "inc_pem_common.cl"
|
||||
#endif // KERNEL_STATIC
|
||||
|
||||
KERNEL_FQ void m24151_sxx (KERN_ATTR_RULES_ESALT (pkcs1_t))
|
||||
KERNEL_FQ void m22951_sxx (KERN_ATTR_RULES_ESALT (pem_t))
|
||||
{
|
||||
/**
|
||||
* base
|
||||
@ -33,7 +33,7 @@ KERNEL_FQ void m24151_sxx (KERN_ATTR_RULES_ESALT (pkcs1_t))
|
||||
LOCAL_VK u32 data_len;
|
||||
data_len = esalt_bufs[digests_offset].data_len;
|
||||
|
||||
LOCAL_VK u32 data[HC_PKCS1_MAX_DATA_LENGTH / 4];
|
||||
LOCAL_VK u32 data[HC_PEM_MAX_DATA_LENGTH / 4];
|
||||
|
||||
for (u32 i = lid; i <= data_len / 4; i += lsz)
|
||||
{
|
||||
@ -72,7 +72,7 @@ KERNEL_FQ void m24151_sxx (KERN_ATTR_RULES_ESALT (pkcs1_t))
|
||||
#else
|
||||
|
||||
const size_t data_len = esalt_bufs[digests_offset].data_len;
|
||||
u32 data[HC_PKCS1_MAX_DATA_LENGTH / 4];
|
||||
u32 data[HC_PEM_MAX_DATA_LENGTH / 4];
|
||||
|
||||
#ifdef _unroll
|
||||
#pragma unroll
|
||||
@ -109,7 +109,7 @@ KERNEL_FQ void m24151_sxx (KERN_ATTR_RULES_ESALT (pkcs1_t))
|
||||
|
||||
for (u32 il_pos = 0; il_pos < il_cnt; il_pos++)
|
||||
{
|
||||
u32 key[HC_PKCS1_MAX_KEY_LENGTH / 4];
|
||||
u32 key[HC_PEM_MAX_KEY_LENGTH / 4];
|
||||
|
||||
pw_t tmp = PASTE_PW;
|
||||
|
@ -12,10 +12,10 @@
|
||||
#include "inc_platform.cl"
|
||||
#include "inc_common.cl"
|
||||
#include "inc_cipher_aes.cl"
|
||||
#include "inc_pkcs1_common.cl"
|
||||
#include "inc_pem_common.cl"
|
||||
#endif // KERNEL_STATIC
|
||||
|
||||
KERNEL_FQ void m24151_sxx (KERN_ATTR_ESALT (pkcs1_t))
|
||||
KERNEL_FQ void m22951_sxx (KERN_ATTR_ESALT (pem_t))
|
||||
{
|
||||
/**
|
||||
* base
|
||||
@ -32,7 +32,7 @@ KERNEL_FQ void m24151_sxx (KERN_ATTR_ESALT (pkcs1_t))
|
||||
LOCAL_VK u32 data_len;
|
||||
data_len = esalt_bufs[digests_offset].data_len;
|
||||
|
||||
LOCAL_VK u32 data[HC_PKCS1_MAX_DATA_LENGTH / 4];
|
||||
LOCAL_VK u32 data[HC_PEM_MAX_DATA_LENGTH / 4];
|
||||
|
||||
for (u32 i = lid; i <= data_len / 4; i += lsz)
|
||||
{
|
||||
@ -71,7 +71,7 @@ KERNEL_FQ void m24151_sxx (KERN_ATTR_ESALT (pkcs1_t))
|
||||
#else
|
||||
|
||||
const size_t data_len = esalt_bufs[digests_offset].data_len;
|
||||
u32 data[HC_PKCS1_MAX_DATA_LENGTH / 4];
|
||||
u32 data[HC_PEM_MAX_DATA_LENGTH / 4];
|
||||
|
||||
#ifdef _unroll
|
||||
#pragma unroll
|
||||
@ -136,7 +136,7 @@ KERNEL_FQ void m24151_sxx (KERN_ATTR_ESALT (pkcs1_t))
|
||||
c[i] |= w[i];
|
||||
}
|
||||
|
||||
u32 key[HC_PKCS1_MAX_KEY_LENGTH / 4];
|
||||
u32 key[HC_PEM_MAX_KEY_LENGTH / 4];
|
||||
|
||||
generate_key (salt_buf, c, pw_len + comb_len, key);
|
||||
|
@ -15,10 +15,10 @@
|
||||
#include "inc_common.cl"
|
||||
#include "inc_simd.cl"
|
||||
#include "inc_cipher_aes.cl"
|
||||
#include "inc_pkcs1_common.cl"
|
||||
#include "inc_pem_common.cl"
|
||||
#endif // KERNEL_STATIC
|
||||
|
||||
KERNEL_FQ void m24151_sxx (KERN_ATTR_VECTOR_ESALT (pkcs1_t))
|
||||
KERNEL_FQ void m22951_sxx (KERN_ATTR_VECTOR_ESALT (pem_t))
|
||||
{
|
||||
/**
|
||||
* base
|
||||
@ -35,7 +35,7 @@ KERNEL_FQ void m24151_sxx (KERN_ATTR_VECTOR_ESALT (pkcs1_t))
|
||||
LOCAL_VK u32 data_len;
|
||||
data_len = esalt_bufs[digests_offset].data_len;
|
||||
|
||||
LOCAL_VK u32 data[HC_PKCS1_MAX_DATA_LENGTH / 4];
|
||||
LOCAL_VK u32 data[HC_PEM_MAX_DATA_LENGTH / 4];
|
||||
|
||||
for (u32 i = lid; i <= data_len / 4; i += lsz)
|
||||
{
|
||||
@ -74,7 +74,7 @@ KERNEL_FQ void m24151_sxx (KERN_ATTR_VECTOR_ESALT (pkcs1_t))
|
||||
#else
|
||||
|
||||
const size_t data_len = esalt_bufs[digests_offset].data_len;
|
||||
u32 data[HC_PKCS1_MAX_DATA_LENGTH / 4];
|
||||
u32 data[HC_PEM_MAX_DATA_LENGTH / 4];
|
||||
|
||||
#ifdef _unroll
|
||||
#pragma unroll
|
||||
@ -125,7 +125,7 @@ KERNEL_FQ void m24151_sxx (KERN_ATTR_VECTOR_ESALT (pkcs1_t))
|
||||
|
||||
w[0] = w0;
|
||||
|
||||
u32x keys[HC_PKCS1_MAX_KEY_LENGTH / 4];
|
||||
u32x keys[HC_PEM_MAX_KEY_LENGTH / 4];
|
||||
|
||||
generate_key_vector (salt_buf, w, pw_len, keys);
|
||||
|
@ -11,14 +11,14 @@
|
||||
#include "shared.h"
|
||||
#include "memory.h"
|
||||
|
||||
#define HC_PKCS1_SALT_LENGTH 8
|
||||
#define HC_PKCS1_MAX_BLOCK_SIZE 16
|
||||
#define HC_PKCS1_MAX_KEY_LENGTH 32
|
||||
#define HC_PKCS1_MAX_DATA_LENGTH 12288
|
||||
#define HC_PEM_SALT_LENGTH 8
|
||||
#define HC_PEM_MAX_BLOCK_SIZE 16
|
||||
#define HC_PEM_MAX_KEY_LENGTH 32
|
||||
#define HC_PEM_MAX_DATA_LENGTH 12288
|
||||
|
||||
// The longest OpenSSL cipher name I can find is 24 characters, so add on seven
|
||||
// more characters for luck and one for the \0 gives us 32.
|
||||
#define HC_PKCS1_MAX_CIPHER_NAME_LENGTH 32
|
||||
#define HC_PEM_MAX_CIPHER_NAME_LENGTH 32
|
||||
|
||||
static const u32 ATTACK_EXEC = ATTACK_EXEC_INSIDE_KERNEL;
|
||||
static const u32 DGST_POS0 = 0;
|
||||
@ -28,7 +28,7 @@ static const u32 DGST_POS3 = 3;
|
||||
static const u32 DGST_SIZE = DGST_SIZE_4_4;
|
||||
static const u32 HASH_CATEGORY = HASH_CATEGORY_DOCUMENTS;
|
||||
static const char *HASH_NAME = "PEM encrypted private key";
|
||||
static const u64 KERN_TYPE = 24111; // Kernel used for the benchmark esalt; will likely be overridden in production
|
||||
static const u64 KERN_TYPE = 22911; // Kernel used for the benchmark esalt; will likely be overridden in production
|
||||
static const u32 OPTI_TYPE = OPTI_TYPE_ZERO_BYTE;
|
||||
static const u64 OPTS_TYPE = OPTS_TYPE_PT_GENERATE_LE
|
||||
| OPTS_TYPE_BINARY_HASHFILE;
|
||||
@ -51,30 +51,21 @@ u32 module_salt_type (MAYBE_UNUSED const hashconfig_t *hashconfig,
|
||||
const char *module_st_hash (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_HASH; }
|
||||
const char *module_st_pass (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra) { return ST_PASS; }
|
||||
|
||||
typedef enum kern_type_pkcs1
|
||||
typedef enum hc_pem_cipher_type
|
||||
{
|
||||
KERN_TYPE_PKCS1_3DES_CBC = 24111,
|
||||
KERN_TYPE_PKCS1_DES_CBC = 24121,
|
||||
KERN_TYPE_PKCS1_AES128_CBC = 24131,
|
||||
KERN_TYPE_PKCS1_AES192_CBC = 24141,
|
||||
KERN_TYPE_PKCS1_AES256_CBC = 24151,
|
||||
} kern_type_pkcs1_t;
|
||||
HC_PEM_CIPHER_TYPE_3DES = 1,
|
||||
HC_PEM_CIPHER_TYPE_DES = 2,
|
||||
HC_PEM_CIPHER_TYPE_AES128 = 3,
|
||||
HC_PEM_CIPHER_TYPE_AES192 = 4,
|
||||
HC_PEM_CIPHER_TYPE_AES256 = 5,
|
||||
} hc_pem_cipher_type_t;
|
||||
|
||||
typedef enum hc_pkcs1_cipher_type
|
||||
typedef enum hc_pem_cipher_mode
|
||||
{
|
||||
HC_PKCS1_CIPHER_TYPE_3DES = 1,
|
||||
HC_PKCS1_CIPHER_TYPE_DES = 2,
|
||||
HC_PKCS1_CIPHER_TYPE_AES128 = 3,
|
||||
HC_PKCS1_CIPHER_TYPE_AES192 = 4,
|
||||
HC_PKCS1_CIPHER_TYPE_AES256 = 5,
|
||||
} hc_pkcs1_cipher_type_t;
|
||||
HC_PEM_CIPHER_MODE_CBC = 1,
|
||||
} hc_pem_cipher_mode_t;
|
||||
|
||||
typedef enum hc_pkcs1_cipher_mode
|
||||
{
|
||||
HC_PKCS1_CIPHER_MODE_CBC = 1,
|
||||
} hc_pkcs1_cipher_mode_t;
|
||||
|
||||
typedef struct pkcs1_cipher
|
||||
typedef struct pem_cipher
|
||||
{
|
||||
char *name;
|
||||
|
||||
@ -82,31 +73,31 @@ typedef struct pkcs1_cipher
|
||||
u32 key_length;
|
||||
u32 cipher_type;
|
||||
u32 cipher_mode;
|
||||
} hc_pkcs1_cipher_t;
|
||||
} hc_pem_cipher_t;
|
||||
|
||||
static hc_pkcs1_cipher_t pkcs1_ciphers[] = {
|
||||
{"des-ede3-cbc", 8, 24, HC_PKCS1_CIPHER_TYPE_3DES, HC_PKCS1_CIPHER_MODE_CBC},
|
||||
{"des-cbc", 8, 8, HC_PKCS1_CIPHER_TYPE_DES, HC_PKCS1_CIPHER_MODE_CBC},
|
||||
{"aes-128-cbc", 16, 16, HC_PKCS1_CIPHER_TYPE_AES128, HC_PKCS1_CIPHER_MODE_CBC},
|
||||
{"aes-192-cbc", 16, 24, HC_PKCS1_CIPHER_TYPE_AES192, HC_PKCS1_CIPHER_MODE_CBC},
|
||||
{"aes-256-cbc", 16, 32, HC_PKCS1_CIPHER_TYPE_AES256, HC_PKCS1_CIPHER_MODE_CBC},
|
||||
static hc_pem_cipher_t pem_ciphers[] = {
|
||||
{"des-ede3-cbc", 8, 24, HC_PEM_CIPHER_TYPE_3DES, HC_PEM_CIPHER_MODE_CBC},
|
||||
{"des-cbc", 8, 8, HC_PEM_CIPHER_TYPE_DES, HC_PEM_CIPHER_MODE_CBC},
|
||||
{"aes-128-cbc", 16, 16, HC_PEM_CIPHER_TYPE_AES128, HC_PEM_CIPHER_MODE_CBC},
|
||||
{"aes-192-cbc", 16, 24, HC_PEM_CIPHER_TYPE_AES192, HC_PEM_CIPHER_MODE_CBC},
|
||||
{"aes-256-cbc", 16, 32, HC_PEM_CIPHER_TYPE_AES256, HC_PEM_CIPHER_MODE_CBC},
|
||||
{NULL, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
typedef struct pkcs1
|
||||
typedef struct pem
|
||||
{
|
||||
hc_pkcs1_cipher_t *chosen_cipher;
|
||||
hc_pem_cipher_t *chosen_cipher;
|
||||
|
||||
u32 salt_iv[HC_PKCS1_MAX_BLOCK_SIZE / 4];
|
||||
u32 salt_iv[HC_PEM_MAX_BLOCK_SIZE / 4];
|
||||
|
||||
u32 data[HC_PKCS1_MAX_DATA_LENGTH / 4];
|
||||
u32 data[HC_PEM_MAX_DATA_LENGTH / 4];
|
||||
size_t data_len;
|
||||
} pkcs1_t;
|
||||
} pem_t;
|
||||
|
||||
typedef struct pkcs1_tmp
|
||||
typedef struct pem_tmp
|
||||
{
|
||||
u32 key[HC_PKCS1_MAX_KEY_LENGTH / 4];
|
||||
} pkcs1_tmp_t;
|
||||
u32 key[HC_PEM_MAX_KEY_LENGTH / 4];
|
||||
} pem_tmp_t;
|
||||
|
||||
|
||||
u32 module_pw_max (MAYBE_UNUSED const hashconfig_t * hashconfig, MAYBE_UNUSED const user_options_t * user_options, MAYBE_UNUSED const user_options_extra_t * user_options_extra)
|
||||
@ -134,7 +125,7 @@ int module_hash_binary_parse (MAYBE_UNUSED const hashconfig_t * hashconfig, MAYB
|
||||
hash_t *hash = &hashes_buf[0];
|
||||
|
||||
memset (hash->salt, 0, sizeof (salt_t));
|
||||
memset (hash->esalt, 0, sizeof (pkcs1_t));
|
||||
memset (hash->esalt, 0, sizeof (pem_t));
|
||||
|
||||
return module_hash_decode (hashconfig, hash->digest, hash->salt, hash->esalt, hash->hook_salt, hash->hash_info, hashes->hashfile, strlen (hashes->hashfile));
|
||||
}
|
||||
@ -203,14 +194,14 @@ static int parse_dek_info (char *line, char *cipher_name, u8 * salt)
|
||||
|
||||
salt[salty++] = hex_to_u8 ((u8 *) line);
|
||||
|
||||
if (salty > HC_PKCS1_MAX_BLOCK_SIZE)
|
||||
if (salty > HC_PEM_MAX_BLOCK_SIZE)
|
||||
{
|
||||
return PARSER_SALT_LENGTH;
|
||||
}
|
||||
}
|
||||
else if (line[1] == '\0')
|
||||
{
|
||||
if (salty < HC_PKCS1_SALT_LENGTH)
|
||||
if (salty < HC_PEM_SALT_LENGTH)
|
||||
{
|
||||
// Malformed salt, not long enough for PKCS5's liking
|
||||
return PARSER_SALT_LENGTH;
|
||||
@ -230,7 +221,7 @@ static int parse_dek_info (char *line, char *cipher_name, u8 * salt)
|
||||
else
|
||||
{
|
||||
cipher_name[i++] = *line;
|
||||
if (i >= HC_PKCS1_MAX_CIPHER_NAME_LENGTH)
|
||||
if (i >= HC_PEM_MAX_CIPHER_NAME_LENGTH)
|
||||
{
|
||||
return PARSER_CIPHER;
|
||||
}
|
||||
@ -240,7 +231,7 @@ static int parse_dek_info (char *line, char *cipher_name, u8 * salt)
|
||||
return PARSER_SALT_VALUE;
|
||||
}
|
||||
|
||||
static int parse_pkcs1_key_data (char *buf, char *cipher_name, u8 * salt, u8 * data, size_t * data_len)
|
||||
static int parse_pem_key_data (char *buf, char *cipher_name, u8 * salt, u8 * data, size_t * data_len)
|
||||
{
|
||||
char *pemdata;
|
||||
size_t pemdata_len;
|
||||
@ -304,7 +295,7 @@ static int parse_pkcs1_key_data (char *buf, char *cipher_name, u8 * salt, u8 * d
|
||||
}
|
||||
}
|
||||
|
||||
if (b64_idx * 6 / 8 > HC_PKCS1_MAX_DATA_LENGTH)
|
||||
if (b64_idx * 6 / 8 > HC_PEM_MAX_DATA_LENGTH)
|
||||
{
|
||||
return PARSER_TOKEN_LENGTH;
|
||||
}
|
||||
@ -316,7 +307,7 @@ static int parse_pkcs1_key_data (char *buf, char *cipher_name, u8 * salt, u8 * d
|
||||
|
||||
int module_hash_decode (MAYBE_UNUSED const hashconfig_t * hashconfig, MAYBE_UNUSED void *digest_buf, salt_t * salt, void *esalt_buf, MAYBE_UNUSED void *hook_salt_buf, MAYBE_UNUSED hashinfo_t * hash_info, const char *line_buf, MAYBE_UNUSED const int line_len)
|
||||
{
|
||||
pkcs1_t *pkcs1 = (pkcs1_t *) esalt_buf;
|
||||
pem_t *pem = (pem_t *) esalt_buf;
|
||||
|
||||
HCFILE fp;
|
||||
struct stat fileinfo;
|
||||
@ -342,11 +333,11 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t * hashconfig, MAYBE_UNUS
|
||||
|
||||
filebuf[fileinfo.st_size] = '\0';
|
||||
|
||||
char cipher_name[HC_PKCS1_MAX_CIPHER_NAME_LENGTH] = { 0 };
|
||||
u8 saltbytes[MAX(HC_PKCS1_SALT_LENGTH, HC_PKCS1_MAX_BLOCK_SIZE)];
|
||||
char cipher_name[HC_PEM_MAX_CIPHER_NAME_LENGTH] = { 0 };
|
||||
u8 saltbytes[MAX(HC_PEM_SALT_LENGTH, HC_PEM_MAX_BLOCK_SIZE)];
|
||||
int err;
|
||||
|
||||
if ((err = parse_pkcs1_key_data ((char *) filebuf, cipher_name, saltbytes, (u8 *) pkcs1->data, &pkcs1->data_len)) < 0)
|
||||
if ((err = parse_pem_key_data ((char *) filebuf, cipher_name, saltbytes, (u8 *) pem->data, &pem->data_len)) < 0)
|
||||
{
|
||||
hcfree (filebuf);
|
||||
|
||||
@ -355,12 +346,12 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t * hashconfig, MAYBE_UNUS
|
||||
|
||||
u32 *saltwords = (u32 *) saltbytes;
|
||||
|
||||
for (u32 i = 0; i < HC_PKCS1_SALT_LENGTH / 4; i++)
|
||||
for (u32 i = 0; i < HC_PEM_SALT_LENGTH / 4; i++)
|
||||
{
|
||||
pkcs1->salt_iv[i] = saltwords[i];
|
||||
pem->salt_iv[i] = saltwords[i];
|
||||
}
|
||||
|
||||
hc_pkcs1_cipher_t *candidate_cipher = pkcs1_ciphers, *chosen_cipher = NULL;
|
||||
hc_pem_cipher_t *candidate_cipher = pem_ciphers, *chosen_cipher = NULL;
|
||||
|
||||
while (candidate_cipher->name)
|
||||
{
|
||||
@ -382,29 +373,29 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t * hashconfig, MAYBE_UNUS
|
||||
return PARSER_CIPHER;
|
||||
}
|
||||
|
||||
if (chosen_cipher->block_size > HC_PKCS1_MAX_BLOCK_SIZE)
|
||||
if (chosen_cipher->block_size > HC_PEM_MAX_BLOCK_SIZE)
|
||||
{
|
||||
hcfree (filebuf);
|
||||
|
||||
return PARSER_BLOCK_SIZE;
|
||||
}
|
||||
|
||||
if (pkcs1->data_len % chosen_cipher->block_size)
|
||||
if (pem->data_len % chosen_cipher->block_size)
|
||||
{
|
||||
hcfree (filebuf);
|
||||
|
||||
return PARSER_HASH_LENGTH;
|
||||
}
|
||||
|
||||
if (chosen_cipher->key_length > HC_PKCS1_MAX_KEY_LENGTH)
|
||||
if (chosen_cipher->key_length > HC_PEM_MAX_KEY_LENGTH)
|
||||
{
|
||||
// Nope nope nopety nope
|
||||
return PARSER_KEY_SIZE;
|
||||
}
|
||||
|
||||
pkcs1->chosen_cipher = chosen_cipher;
|
||||
pem->chosen_cipher = chosen_cipher;
|
||||
|
||||
memcpy (salt->salt_buf, pkcs1->salt_iv, MIN (HC_PKCS1_SALT_LENGTH, 64 * 4));
|
||||
memcpy (salt->salt_buf, pem->salt_iv, MIN (HC_PEM_SALT_LENGTH, 64 * 4));
|
||||
salt->salt_iter = 1;
|
||||
|
||||
return 1;
|
||||
@ -412,13 +403,13 @@ int module_hash_decode (MAYBE_UNUSED const hashconfig_t * hashconfig, MAYBE_UNUS
|
||||
|
||||
void *module_benchmark_esalt (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
|
||||
{
|
||||
pkcs1_t *pkcs1 = (pkcs1_t *) hcmalloc (sizeof (pkcs1_t));
|
||||
pem_t *pem = (pem_t *) hcmalloc (sizeof (pem_t));
|
||||
|
||||
pkcs1->chosen_cipher = &pkcs1_ciphers[0];
|
||||
hex_decode ((u8 *) "7CC48DB27D461D30", 16, (u8 *) pkcs1->salt_iv);
|
||||
pkcs1->data_len = base64_decode (base64_to_int, (u8 *) "ysVmp6tkcZXRqHyy3YMk5zd4bsT9D97kFcDIKkD2g5o/OBgc0pGQ/iSwJm/V+A2IkwgQlwvLW1OfKkAWdjcSFNKhmiWApVQB", 96, (u8 *) pkcs1->data);
|
||||
pem->chosen_cipher = &pem_ciphers[0];
|
||||
hex_decode ((u8 *) "7CC48DB27D461D30", 16, (u8 *) pem->salt_iv);
|
||||
pem->data_len = base64_decode (base64_to_int, (u8 *) "ysVmp6tkcZXRqHyy3YMk5zd4bsT9D97kFcDIKkD2g5o/OBgc0pGQ/iSwJm/V+A2IkwgQlwvLW1OfKkAWdjcSFNKhmiWApVQB", 96, (u8 *) pem->data);
|
||||
|
||||
return pkcs1;
|
||||
return pem;
|
||||
}
|
||||
|
||||
salt_t *module_benchmark_salt (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYBE_UNUSED const user_options_t *user_options, MAYBE_UNUSED const user_options_extra_t *user_options_extra)
|
||||
@ -433,19 +424,19 @@ salt_t *module_benchmark_salt (MAYBE_UNUSED const hashconfig_t *hashconfig, MAYB
|
||||
|
||||
u64 module_kern_type_dynamic (MAYBE_UNUSED const hashconfig_t * hashconfig, MAYBE_UNUSED const void *digest_buf, MAYBE_UNUSED const salt_t * salt, MAYBE_UNUSED const void *esalt_buf, MAYBE_UNUSED const void *hook_salt_buf, MAYBE_UNUSED const hashinfo_t * hash_info)
|
||||
{
|
||||
const pkcs1_t *pkcs1 = (const pkcs1_t *) esalt_buf;
|
||||
const pem_t *pem = (const pem_t *) esalt_buf;
|
||||
|
||||
u64 kern_type = 24100;
|
||||
u64 kern_type = 22900;
|
||||
|
||||
kern_type += pkcs1->chosen_cipher->cipher_type * 10;
|
||||
kern_type += pkcs1->chosen_cipher->cipher_mode;
|
||||
kern_type += pem->chosen_cipher->cipher_type * 10;
|
||||
kern_type += pem->chosen_cipher->cipher_mode;
|
||||
|
||||
return kern_type;
|
||||
}
|
||||
|
||||
u64 module_esalt_size (MAYBE_UNUSED const hashconfig_t * hashconfig, MAYBE_UNUSED const user_options_t * user_options, MAYBE_UNUSED const user_options_extra_t * user_options_extra)
|
||||
{
|
||||
const u64 esalt_size = (const u64) sizeof (pkcs1_t);
|
||||
const u64 esalt_size = (const u64) sizeof (pem_t);
|
||||
|
||||
return esalt_size;
|
||||
}
|
Loading…
Reference in New Issue
Block a user