Skip to content

Commit

Permalink
Workaround added for AMDGPU-Pro OpenCL runtime: AES encrypt and decry…
Browse files Browse the repository at this point in the history
…pt Invertkey function was calculated wrong in certain cases
  • Loading branch information
jsteube committed Jan 11, 2017
1 parent bb5663e commit a1c1377
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 14 deletions.
2 changes: 1 addition & 1 deletion OpenCL/m06600.cl
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ static void AES128_ExpandKey (u32 *userkey, u32 *rek, __local u32 *s_te0, __loca

static void AES128_InvertKey (u32 *rdk, __local u32 *s_td0, __local u32 *s_td1, __local u32 *s_td2, __local u32 *s_td3, __local u32 *s_td4, __local u32 *s_te0, __local u32 *s_te1, __local u32 *s_te2, __local u32 *s_te3, __local u32 *s_te4)
{
for (u32 i = 0, j = 40; i < j; i += 4, j -= 4)
for (u32 i = 0, j = 40; i < 20; i += 4, j -= 4)
{
u32 temp;

Expand Down
2 changes: 1 addition & 1 deletion OpenCL/m06800.cl
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ static void AES256_ExpandKey (u32 *userkey, u32 *rek, __local u32 *s_te0, __loca

static void AES256_InvertKey (u32 *rdk, __local u32 *s_td0, __local u32 *s_td1, __local u32 *s_td2, __local u32 *s_td3, __local u32 *s_td4, __local u32 *s_te0, __local u32 *s_te1, __local u32 *s_te2, __local u32 *s_te3, __local u32 *s_te4)
{
for (u32 i = 0, j = 56; i < j; i += 4, j -= 4)
for (u32 i = 0, j = 56; i < 28; i += 4, j -= 4)
{
u32 temp;

Expand Down
4 changes: 2 additions & 2 deletions OpenCL/m08800.cl
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ static void AES128_ExpandKey (u32 *userkey, u32 *rek, __local u32 *s_te0, __loca

static void AES128_InvertKey (u32 *rdk, __local u32 *s_td0, __local u32 *s_td1, __local u32 *s_td2, __local u32 *s_td3, __local u32 *s_td4, __local u32 *s_te0, __local u32 *s_te1, __local u32 *s_te2, __local u32 *s_te3, __local u32 *s_te4)
{
for (u32 i = 0, j = 40; i < j; i += 4, j -= 4)
for (u32 i = 0, j = 40; i < 20; i += 4, j -= 4)
{
u32 temp;

Expand Down Expand Up @@ -896,7 +896,7 @@ static void AES256_ExpandKey (u32 *userkey, u32 *rek, __local u32 *s_te0, __loca

static void AES256_InvertKey (u32 *rdk, __local u32 *s_td0, __local u32 *s_td1, __local u32 *s_td2, __local u32 *s_td3, __local u32 *s_td4, __local u32 *s_te0, __local u32 *s_te1, __local u32 *s_te2, __local u32 *s_te3, __local u32 *s_te4)
{
for (u32 i = 0, j = 56; i < j; i += 4, j -= 4)
for (u32 i = 0, j = 56; i < 28; i += 4, j -= 4)
{
u32 temp;

Expand Down
4 changes: 2 additions & 2 deletions OpenCL/m09400.cl
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ static void AES128_ExpandKey (u32 *userkey, u32 *rek, __local u32 *s_te0, __loca

static void AES128_InvertKey (u32 *rdk, __local u32 *s_td0, __local u32 *s_td1, __local u32 *s_td2, __local u32 *s_td3, __local u32 *s_td4, __local u32 *s_te0, __local u32 *s_te1, __local u32 *s_te2, __local u32 *s_te3, __local u32 *s_te4)
{
for (u32 i = 0, j = 40; i < j; i += 4, j -= 4)
for (u32 i = 0, j = 40; i < 20; i += 4, j -= 4)
{
u32 temp;

Expand Down Expand Up @@ -967,7 +967,7 @@ static void AES256_ExpandKey (u32 *userkey, u32 *rek, __local u32 *s_te0, __loca

static void AES256_InvertKey (u32 *rdk, __local u32 *s_td0, __local u32 *s_td1, __local u32 *s_td2, __local u32 *s_td3, __local u32 *s_td4, __local u32 *s_te0, __local u32 *s_te1, __local u32 *s_te2, __local u32 *s_te3, __local u32 *s_te4)
{
for (u32 i = 0, j = 56; i < j; i += 4, j -= 4)
for (u32 i = 0, j = 56; i < 28; i += 4, j -= 4)
{
u32 temp;

Expand Down
2 changes: 1 addition & 1 deletion OpenCL/m09500.cl
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ static void AES128_ExpandKey (u32 *userkey, u32 *rek, __local u32 *s_te0, __loca

static void AES128_InvertKey (u32 *rdk, __local u32 *s_td0, __local u32 *s_td1, __local u32 *s_td2, __local u32 *s_td3, __local u32 *s_td4, __local u32 *s_te0, __local u32 *s_te1, __local u32 *s_te2, __local u32 *s_te3, __local u32 *s_te4)
{
for (u32 i = 0, j = 40; i < j; i += 4, j -= 4)
for (u32 i = 0, j = 40; i < 20; i += 4, j -= 4)
{
u32 temp;

Expand Down
2 changes: 1 addition & 1 deletion OpenCL/m09600.cl
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ static void AES256_ExpandKey (u32 *userkey, u32 *rek, __local u32 *s_te0, __loca

static void AES256_InvertKey (u32 *rdk, __local u32 *s_td0, __local u32 *s_td1, __local u32 *s_td2, __local u32 *s_td3, __local u32 *s_td4, __local u32 *s_te0, __local u32 *s_te1, __local u32 *s_te2, __local u32 *s_te3, __local u32 *s_te4)
{
for (u32 i = 0, j = 56; i < j; i += 4, j -= 4)
for (u32 i = 0, j = 56; i < 28; i += 4, j -= 4)
{
u32 temp;

Expand Down
2 changes: 1 addition & 1 deletion OpenCL/m11300.cl
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ static void AES256_ExpandKey (u32 *userkey, u32 *rek, __local u32 *s_te0, __loca

static void AES256_InvertKey (u32 *rdk, __local u32 *s_td0, __local u32 *s_td1, __local u32 *s_td2, __local u32 *s_td3, __local u32 *s_td4, __local u32 *s_te0, __local u32 *s_te1, __local u32 *s_te2, __local u32 *s_te3, __local u32 *s_te4)
{
for (u32 i = 0, j = 56; i < j; i += 4, j -= 4)
for (u32 i = 0, j = 56; i < 28; i += 4, j -= 4)
{
u32 temp;

Expand Down
2 changes: 1 addition & 1 deletion OpenCL/m11600.cl
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ static void AES256_ExpandKey (u32 *userkey, u32 *rek, __local u32 *s_te0, __loca

static void AES256_InvertKey (u32 *rdk, __local u32 *s_td0, __local u32 *s_td1, __local u32 *s_td2, __local u32 *s_td3, __local u32 *s_td4, __local u32 *s_te0, __local u32 *s_te1, __local u32 *s_te2, __local u32 *s_te3, __local u32 *s_te4)
{
for (u32 i = 0, j = 56; i < j; i += 4, j -= 4)
for (u32 i = 0, j = 56; i < 28; i += 4, j -= 4)
{
u32 temp;

Expand Down
2 changes: 1 addition & 1 deletion OpenCL/m12500.cl
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ static void AES128_ExpandKey (u32 *userkey, u32 *rek, __local u32 *s_te0, __loca

static void AES128_InvertKey (u32 *rdk, __local u32 *s_td0, __local u32 *s_td1, __local u32 *s_td2, __local u32 *s_td3, __local u32 *s_td4, __local u32 *s_te0, __local u32 *s_te1, __local u32 *s_te2, __local u32 *s_te3, __local u32 *s_te4)
{
for (u32 i = 0, j = 40; i < j; i += 4, j -= 4)
for (u32 i = 0, j = 40; i < 20; i += 4, j -= 4)
{
u32 temp;

Expand Down
2 changes: 1 addition & 1 deletion OpenCL/m12700.cl
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ static void AES256_ExpandKey (u32 *userkey, u32 *rek, __local u32 *s_te0, __loca

static void AES256_InvertKey (u32 *rdk, __local u32 *s_td0, __local u32 *s_td1, __local u32 *s_td2, __local u32 *s_td3, __local u32 *s_td4, __local u32 *s_te0, __local u32 *s_te1, __local u32 *s_te2, __local u32 *s_te3, __local u32 *s_te4)
{
for (u32 i = 0, j = 56; i < j; i += 4, j -= 4)
for (u32 i = 0, j = 56; i < 28; i += 4, j -= 4)
{
u32 temp;

Expand Down
2 changes: 1 addition & 1 deletion OpenCL/m13200.cl
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ static void AES128_ExpandKey (u32 *userkey, u32 *rek, __local u32 *s_te0, __loca

static void AES128_InvertKey (u32 *rdk, __local u32 *s_td0, __local u32 *s_td1, __local u32 *s_td2, __local u32 *s_td3, __local u32 *s_td4, __local u32 *s_te0, __local u32 *s_te1, __local u32 *s_te2, __local u32 *s_te3, __local u32 *s_te4)
{
for (u32 i = 0, j = 40; i < j; i += 4, j -= 4)
for (u32 i = 0, j = 40; i < 20; i += 4, j -= 4)
{
u32 temp;

Expand Down
2 changes: 1 addition & 1 deletion OpenCL/m13400.cl
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ static void AES256_InvertKey (u32 *rdk, __local u32 *s_td0, __local u32 *s_td1,
#ifdef _unroll
#pragma unroll
#endif
for (u32 i = 0, j = 56; i < j; i += 4, j -= 4)
for (u32 i = 0, j = 56; i < 28; i += 4, j -= 4)
{
u32 temp;

Expand Down
8 changes: 8 additions & 0 deletions docs/changes.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
* changes v3.30 -> v3.xx:

##
## Workarounds
##

- Workaround added for AMDGPU-Pro OpenCL runtime: AES encrypt and decrypt Invertkey function was calculated wrong in certain cases

* changes v3.20 -> v3.30:

##
Expand Down

0 comments on commit a1c1377

Please sign in to comment.