From f31f057113ec85ffb62a006ee3ed316a3277c43d Mon Sep 17 00:00:00 2001 From: DoZ10 Date: Mon, 15 May 2017 22:49:44 -0400 Subject: [PATCH] Fixed minor error in offset calculation. --- OpenCL/m15400_a0.cl | 6 +++++- OpenCL/m15400_a1.cl | 6 +++++- OpenCL/m15400_a3.cl | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/OpenCL/m15400_a0.cl b/OpenCL/m15400_a0.cl index c030a9245..1d7cd50c0 100644 --- a/OpenCL/m15400_a0.cl +++ b/OpenCL/m15400_a0.cl @@ -111,7 +111,7 @@ void chacha20_transform (const u32x w0[4], const u32x w1[4], const u32 position[ x[14] += ctx[14]; x[15] += ctx[15]; - if (offset > 36) + if (offset > 56) { /** * Generate a second 64 byte keystream @@ -171,6 +171,10 @@ void chacha20_transform (const u32x w0[4], const u32x w1[4], const u32 position[ x[31] += ctx[15]; } + /** + * Encrypt plaintext with keystream + */ + u32 index = offset / 4; u32 remain = offset % 4; diff --git a/OpenCL/m15400_a1.cl b/OpenCL/m15400_a1.cl index 9fd51913c..ab7c2f570 100644 --- a/OpenCL/m15400_a1.cl +++ b/OpenCL/m15400_a1.cl @@ -111,7 +111,7 @@ void chacha20_transform (const u32x w0[4], const u32x w1[4], const u32 position[ x[14] += ctx[14]; x[15] += ctx[15]; - if (offset > 36) + if (offset > 56) { /** * Generate a second 64 byte keystream @@ -171,6 +171,10 @@ void chacha20_transform (const u32x w0[4], const u32x w1[4], const u32 position[ x[31] += ctx[15]; } + /** + * Encrypt plaintext with keystream + */ + u32 index = offset / 4; u32 remain = offset % 4; diff --git a/OpenCL/m15400_a3.cl b/OpenCL/m15400_a3.cl index 3896a8c23..3ef55c615 100644 --- a/OpenCL/m15400_a3.cl +++ b/OpenCL/m15400_a3.cl @@ -109,7 +109,7 @@ void chacha20_transform (const u32x w0[4], const u32x w1[4], const u32 position[ x[14] += ctx[14]; x[15] += ctx[15]; - if (offset > 36) + if (offset > 56) { /** * Generate a second 64 byte keystream @@ -169,6 +169,10 @@ void chacha20_transform (const u32x w0[4], const u32x w1[4], const u32 position[ x[31] += ctx[15]; } + /** + * Encrypt plaintext with keystream + */ + u32 index = offset / 4; u32 remain = offset % 4;