cudaMemcpyToSymbolAsync(DEV_message, H_Message, 1024, 0, cudaMemcpyHostToDevice);
cudaMemcpyToSymbolAsync(DEV_message, H_Message, 1024, 0, cudaMemcpyHostToDevice);
thenThen, the global kernel will run.:
AESROUND<<< 8, 16, 16 >>>(1024);
AESROUND<<< 8, 16, 16 >>>(1024);
AESROUND()
performs one round of AES algorithm on a 1024bit State1024-bit state, then 32 bytes of Thethe array will XOR with 32Bs32 bits of The Statethe state.
__global__ void AESROUND_AD(const int SIZE)
{
__shared__ unsigned char dev_rkey[16];
__shared__ unsigned char dev_sh_state[16];
int tid = blockIdx.x * 16 + threadIdx.x;
if (tid < 128)
{
for (long long i = 0; i <SIZE/32; i++)
{
dev_sh_state[threadIdx.x] = dev_state[(tid + 112) % 128];
dev_rkey[threadIdx.x] = dev_state[tid];
__syncthreads();
if (threadIdx.x < 4)
{
U32 v1 = ((U32*)dev_TE0)[*(dev_sh_state + threadIdx.x * 4)];
U32 v2 = ((U32*)dev_TE1)[*(dev_sh_state + ((threadIdx.x * 4 + 5) % 16))];
U32 v3 = ((U32*)dev_TE2)[*(dev_sh_state + ((threadIdx.x * 4 + 10) % 16))];
U32 v4 = ((U32*)dev_TE3)[*(dev_sh_state + ((threadIdx.x * 4 + 15) % 16))];
((U32*)dev_sh_state)[threadIdx.x] = v1 ^ v2 ^ v3 ^ v4 ^ ((U32*)dev_rkey)[threadIdx.x];
}
__syncthreads();
dev_state[tid] = dev_sh_state[threadIdx.x];
__syncthreads();
}
}
}
__global__ void AESROUND_AD(const int SIZE)
{
__shared__ unsigned char dev_rkey[16];
__shared__ unsigned char dev_sh_state[16];
int tid = blockIdx.x * 16 + threadIdx.x;
if (tid < 128)
{
for (long long i = 0; i <SIZE/32; i++)
{
dev_sh_state[threadIdx.x] = dev_state[(tid + 112) % 128];
dev_rkey[threadIdx.x] = dev_state[tid];
__syncthreads();
if (threadIdx.x < 4)
{
U32 v1 = ((U32*)dev_TE0)[*(dev_sh_state + threadIdx.x * 4)];
U32 v2 = ((U32*)dev_TE1)[*(dev_sh_state + ((threadIdx.x * 4 + 5) % 16))];
U32 v3 = ((U32*)dev_TE2)[*(dev_sh_state + ((threadIdx.x * 4 + 10) % 16))];
U32 v4 = ((U32*)dev_TE3)[*(dev_sh_state + ((threadIdx.x * 4 + 15) % 16))];
((U32*)dev_sh_state)[threadIdx.x] = v1 ^ v2 ^ v3 ^ v4 ^ ((U32*)dev_rkey)[threadIdx.x];
}
__syncthreads();
dev_state[tid] = dev_sh_state[threadIdx.x];
__syncthreads();
}
}
}
I use Microsoft visual C++ in Windows 8.1 with CUDA Toolkit 7.
My GPU is a GeForce GT 720M with Compute Capability:2.1 , Number of SMs:2 , Graphic clock (MHz) 625, Processor clock (MHz) 1250 Memory Clock (MHz) 800.
My processor is Core(TM) i5-3337U CPU @ 1.80GHz (4 CPUs) microprocessor,
- I use Microsoft Visual C++ in Windows 8.1 with CUDA Toolkit 7.
- My GPU is a GeForce GT 720M
- Compute capability: 2.1
- Number of SMs: 2
- Graphic clock (MHz): 625
- Processor clock (MHz): 1250
- Memory clock (MHz): 800
- My processor is Intel Core(TM) i5-3337U CPU @ 1.80GHz (4 CPUs) microprocessor.