OpenCL Kernels: Remove password length restriction to 16 for Cisco-PIX and Cisco-ASA hashes

Fixes #1488
This commit is contained in:
jsteube
2018-01-27 22:21:44 +01:00
parent 4c981ea0ba
commit e877c30ebc
8 changed files with 441 additions and 164 deletions
+67 -25
View File
@@ -3,7 +3,7 @@
* License.....: MIT
*/
#define NEW_SIMD_CODE
//#define NEW_SIMD_CODE
#include "inc_vendor.cl"
#include "inc_hash_constants.h"
@@ -57,18 +57,39 @@ __kernel void m02400_m04 (__global pw_t *pws, __constant const kernel_rule_t *ru
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
w1[0] = 0x80;
w1[1] = 0;
w1[2] = 0;
w1[3] = 0;
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 16 * 8;
w3[3] = 0;
if (out_len <= 16)
{
w1[0] = 0x80;
w1[1] = 0;
w1[2] = 0;
w1[3] = 0;
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 16 * 8;
w3[3] = 0;
}
else if (out_len <= 32)
{
w2[0] = 0x80;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 32 * 8;
w3[3] = 0;
}
else if (out_len <= 48)
{
w3[0] = 0x80;
w3[1] = 0;
w3[2] = 48 * 8;
w3[3] = 0;
}
u32x a = MD5M_A;
u32x b = MD5M_B;
@@ -217,18 +238,39 @@ __kernel void m02400_s04 (__global pw_t *pws, __constant const kernel_rule_t *ru
const u32x out_len = apply_rules_vect (pw_buf0, pw_buf1, pw_len, rules_buf, il_pos, w0, w1);
w1[0] = 0x80;
w1[1] = 0;
w1[2] = 0;
w1[3] = 0;
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 16 * 8;
w3[3] = 0;
if (out_len <= 16)
{
w1[0] = 0x80;
w1[1] = 0;
w1[2] = 0;
w1[3] = 0;
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 16 * 8;
w3[3] = 0;
}
else if (out_len <= 32)
{
w2[0] = 0x80;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 32 * 8;
w3[3] = 0;
}
else if (out_len <= 48)
{
w3[0] = 0x80;
w3[1] = 0;
w3[2] = 48 * 8;
w3[3] = 0;
}
u32x a = MD5M_A;
u32x b = MD5M_B;
+67 -25
View File
@@ -3,7 +3,7 @@
* License.....: MIT
*/
#define NEW_SIMD_CODE
//#define NEW_SIMD_CODE
#include "inc_vendor.cl"
#include "inc_hash_constants.h"
@@ -119,18 +119,39 @@ __kernel void m02400_m04 (__global pw_t *pws, __global const kernel_rule_t *rule
* md5
*/
w1[0] = 0x80;
w1[1] = 0;
w1[2] = 0;
w1[3] = 0;
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 16 * 8;
w3[3] = 0;
if (pw_len <= 16)
{
w1[0] = 0x80;
w1[1] = 0;
w1[2] = 0;
w1[3] = 0;
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 16 * 8;
w3[3] = 0;
}
else if (pw_len <= 32)
{
w2[0] = 0x80;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 32 * 8;
w3[3] = 0;
}
else if (pw_len <= 48)
{
w3[0] = 0x80;
w3[1] = 0;
w3[2] = 48 * 8;
w3[3] = 0;
}
u32x a = MD5M_A;
u32x b = MD5M_B;
@@ -343,18 +364,39 @@ __kernel void m02400_s04 (__global pw_t *pws, __global const kernel_rule_t *rule
* md5
*/
w1[0] = 0x80;
w1[1] = 0;
w1[2] = 0;
w1[3] = 0;
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 16 * 8;
w3[3] = 0;
if (pw_len <= 16)
{
w1[0] = 0x80;
w1[1] = 0;
w1[2] = 0;
w1[3] = 0;
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 16 * 8;
w3[3] = 0;
}
else if (pw_len <= 32)
{
w2[0] = 0x80;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 32 * 8;
w3[3] = 0;
}
else if (pw_len <= 48)
{
w3[0] = 0x80;
w3[1] = 0;
w3[2] = 48 * 8;
w3[3] = 0;
}
u32x a = MD5M_A;
u32x b = MD5M_B;
+66 -24
View File
@@ -25,18 +25,39 @@ void m02400m (u32 w[16], const u32 pw_len, __global pw_t *pws, __global const ke
* algorithm specific
*/
w[ 4] = 0x80;
w[ 5] = 0;
w[ 6] = 0;
w[ 7] = 0;
w[ 8] = 0;
w[ 9] = 0;
w[10] = 0;
w[11] = 0;
w[12] = 0;
w[13] = 0;
w[14] = 16 * 8;
w[15] = 0;
if (pw_len <= 16)
{
w[ 4] = 0x80;
w[ 5] = 0;
w[ 6] = 0;
w[ 7] = 0;
w[ 8] = 0;
w[ 9] = 0;
w[10] = 0;
w[11] = 0;
w[12] = 0;
w[13] = 0;
w[14] = 16 * 8;
w[15] = 0;
}
else if (pw_len <= 32)
{
w[ 8] = 0x80;
w[ 9] = 0;
w[10] = 0;
w[11] = 0;
w[12] = 0;
w[13] = 0;
w[14] = 32 * 8;
w[15] = 0;
}
else if (pw_len <= 48)
{
w[12] = 0x80;
w[13] = 0;
w[14] = 48 * 8;
w[15] = 0;
}
/**
* base
@@ -219,18 +240,39 @@ void m02400s (u32 w[16], const u32 pw_len, __global pw_t *pws, __global const ke
* algorithm specific
*/
w[ 4] = 0x80;
w[ 5] = 0;
w[ 6] = 0;
w[ 7] = 0;
w[ 8] = 0;
w[ 9] = 0;
w[10] = 0;
w[11] = 0;
w[12] = 0;
w[13] = 0;
w[14] = 16 * 8;
w[15] = 0;
if (pw_len <= 16)
{
w[ 4] = 0x80;
w[ 5] = 0;
w[ 6] = 0;
w[ 7] = 0;
w[ 8] = 0;
w[ 9] = 0;
w[10] = 0;
w[11] = 0;
w[12] = 0;
w[13] = 0;
w[14] = 16 * 8;
w[15] = 0;
}
else if (pw_len <= 32)
{
w[ 8] = 0x80;
w[ 9] = 0;
w[10] = 0;
w[11] = 0;
w[12] = 0;
w[13] = 0;
w[14] = 32 * 8;
w[15] = 0;
}
else if (pw_len <= 48)
{
w[12] = 0x80;
w[13] = 0;
w[14] = 48 * 8;
w[15] = 0;
}
/**
* base
+75 -25
View File
@@ -3,7 +3,7 @@
* License.....: MIT
*/
#define NEW_SIMD_CODE
//#define NEW_SIMD_CODE
#include "inc_vendor.cl"
#include "inc_hash_constants.h"
@@ -70,6 +70,8 @@ __kernel void m02410_m04 (__global pw_t *pws, __constant const kernel_rule_t *ru
salt_buf3[2] = 0;
salt_buf3[3] = 0;
const u32 salt_len = salt_bufs[salt_pos].salt_len;
/**
* loop
*/
@@ -132,18 +134,41 @@ __kernel void m02410_m04 (__global pw_t *pws, __constant const kernel_rule_t *ru
* md5
*/
w1[0] = 0x80;
w1[1] = 0;
w1[2] = 0;
w1[3] = 0;
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 16 * 8;
w3[3] = 0;
const u32x out_salt_len = out_len + salt_len;
if (out_salt_len <= 16)
{
w1[0] = 0x80;
w1[1] = 0;
w1[2] = 0;
w1[3] = 0;
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 16 * 8;
w3[3] = 0;
}
else if (out_salt_len <= 32)
{
w2[0] = 0x80;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 32 * 8;
w3[3] = 0;
}
else if (out_salt_len <= 48)
{
w3[0] = 0x80;
w3[1] = 0;
w3[2] = 48 * 8;
w3[3] = 0;
}
u32x a = MD5M_A;
u32x b = MD5M_B;
@@ -293,6 +318,8 @@ __kernel void m02410_s04 (__global pw_t *pws, __constant const kernel_rule_t *ru
salt_buf3[2] = 0;
salt_buf3[3] = 0;
const u32 salt_len = salt_bufs[salt_pos].salt_len;
/**
* digest
*/
@@ -367,18 +394,41 @@ __kernel void m02410_s04 (__global pw_t *pws, __constant const kernel_rule_t *ru
* md5
*/
w1[0] = 0x80;
w1[1] = 0;
w1[2] = 0;
w1[3] = 0;
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 16 * 8;
w3[3] = 0;
const u32x out_salt_len = out_len + salt_len;
if (out_salt_len <= 16)
{
w1[0] = 0x80;
w1[1] = 0;
w1[2] = 0;
w1[3] = 0;
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 16 * 8;
w3[3] = 0;
}
else if (out_salt_len <= 32)
{
w2[0] = 0x80;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 32 * 8;
w3[3] = 0;
}
else if (out_salt_len <= 48)
{
w3[0] = 0x80;
w3[1] = 0;
w3[2] = 48 * 8;
w3[3] = 0;
}
u32x a = MD5M_A;
u32x b = MD5M_B;
+75 -25
View File
@@ -3,7 +3,7 @@
* License.....: MIT
*/
#define NEW_SIMD_CODE
//#define NEW_SIMD_CODE
#include "inc_vendor.cl"
#include "inc_hash_constants.h"
@@ -68,6 +68,8 @@ __kernel void m02410_m04 (__global pw_t *pws, __global const kernel_rule_t *rule
salt_buf3[2] = 0;
salt_buf3[3] = 0;
const u32 salt_len = salt_bufs[salt_pos].salt_len;
/**
* loop
*/
@@ -190,18 +192,41 @@ __kernel void m02410_m04 (__global pw_t *pws, __global const kernel_rule_t *rule
* md5
*/
w1[0] = 0x80;
w1[1] = 0;
w1[2] = 0;
w1[3] = 0;
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 16 * 8;
w3[3] = 0;
const u32x pw_salt_len = pw_len + salt_len;
if (pw_salt_len <= 16)
{
w1[0] = 0x80;
w1[1] = 0;
w1[2] = 0;
w1[3] = 0;
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 16 * 8;
w3[3] = 0;
}
else if (pw_salt_len <= 32)
{
w2[0] = 0x80;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 32 * 8;
w3[3] = 0;
}
else if (pw_salt_len <= 48)
{
w3[0] = 0x80;
w3[1] = 0;
w3[2] = 48 * 8;
w3[3] = 0;
}
u32x a = MD5M_A;
u32x b = MD5M_B;
@@ -351,6 +376,8 @@ __kernel void m02410_s04 (__global pw_t *pws, __global const kernel_rule_t *rule
salt_buf3[2] = 0;
salt_buf3[3] = 0;
const u32 salt_len = salt_bufs[salt_pos].salt_len;
/**
* digest
*/
@@ -485,18 +512,41 @@ __kernel void m02410_s04 (__global pw_t *pws, __global const kernel_rule_t *rule
* md5
*/
w1[0] = 0x80;
w1[1] = 0;
w1[2] = 0;
w1[3] = 0;
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 16 * 8;
w3[3] = 0;
const u32x pw_salt_len = pw_len + salt_len;
if (pw_salt_len <= 16)
{
w1[0] = 0x80;
w1[1] = 0;
w1[2] = 0;
w1[3] = 0;
w2[0] = 0;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 16 * 8;
w3[3] = 0;
}
else if (pw_salt_len <= 32)
{
w2[0] = 0x80;
w2[1] = 0;
w2[2] = 0;
w2[3] = 0;
w3[0] = 0;
w3[1] = 0;
w3[2] = 32 * 8;
w3[3] = 0;
}
else if (pw_salt_len <= 48)
{
w3[0] = 0x80;
w3[1] = 0;
w3[2] = 48 * 8;
w3[3] = 0;
}
u32x a = MD5M_A;
u32x b = MD5M_B;
+74 -24
View File
@@ -47,6 +47,8 @@ void m02410m (u32 w[16], const u32 pw_len, __global pw_t *pws, __global const ke
salt_buf3[2] = 0;
salt_buf3[3] = 0;
const u32 salt_len = salt_bufs[salt_pos].salt_len;
switch_buffer_by_offset_le_S (salt_buf0, salt_buf1, salt_buf2, salt_buf3, pw_len);
w[ 0] |= salt_buf0[0];
@@ -70,18 +72,41 @@ void m02410m (u32 w[16], const u32 pw_len, __global pw_t *pws, __global const ke
* algorithm specific
*/
w[ 4] = 0x80;
w[ 5] = 0;
w[ 6] = 0;
w[ 7] = 0;
w[ 8] = 0;
w[ 9] = 0;
w[10] = 0;
w[11] = 0;
w[12] = 0;
w[13] = 0;
w[14] = 16 * 8;
w[15] = 0;
const u32 pw_salt_len = pw_len + salt_len;
if (pw_salt_len <= 16)
{
w[ 4] = 0x80;
w[ 5] = 0;
w[ 6] = 0;
w[ 7] = 0;
w[ 8] = 0;
w[ 9] = 0;
w[10] = 0;
w[11] = 0;
w[12] = 0;
w[13] = 0;
w[14] = 16 * 8;
w[15] = 0;
}
else if (pw_salt_len <= 32)
{
w[ 8] = 0x80;
w[ 9] = 0;
w[10] = 0;
w[11] = 0;
w[12] = 0;
w[13] = 0;
w[14] = 32 * 8;
w[15] = 0;
}
else if (pw_salt_len <= 48)
{
w[12] = 0x80;
w[13] = 0;
w[14] = 48 * 8;
w[15] = 0;
}
/**
* base
@@ -286,6 +311,8 @@ void m02410s (u32 w[16], const u32 pw_len, __global pw_t *pws, __global const ke
salt_buf3[2] = 0;
salt_buf3[3] = 0;
const u32 salt_len = salt_bufs[salt_pos].salt_len;
switch_buffer_by_offset_le_S (salt_buf0, salt_buf1, salt_buf2, salt_buf3, pw_len);
w[ 0] |= salt_buf0[0];
@@ -309,18 +336,41 @@ void m02410s (u32 w[16], const u32 pw_len, __global pw_t *pws, __global const ke
* algorithm specific
*/
w[ 4] = 0x80;
w[ 5] = 0;
w[ 6] = 0;
w[ 7] = 0;
w[ 8] = 0;
w[ 9] = 0;
w[10] = 0;
w[11] = 0;
w[12] = 0;
w[13] = 0;
w[14] = 16 * 8;
w[15] = 0;
const u32 pw_salt_len = pw_len + salt_len;
if (pw_salt_len <= 16)
{
w[ 4] = 0x80;
w[ 5] = 0;
w[ 6] = 0;
w[ 7] = 0;
w[ 8] = 0;
w[ 9] = 0;
w[10] = 0;
w[11] = 0;
w[12] = 0;
w[13] = 0;
w[14] = 16 * 8;
w[15] = 0;
}
else if (pw_salt_len <= 32)
{
w[ 8] = 0x80;
w[ 9] = 0;
w[10] = 0;
w[11] = 0;
w[12] = 0;
w[13] = 0;
w[14] = 32 * 8;
w[15] = 0;
}
else if (pw_salt_len <= 48)
{
w[12] = 0x80;
w[13] = 0;
w[14] = 48 * 8;
w[15] = 0;
}
/**
* base