Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encryption not correct #3

Open
GoogleCodeExporter opened this issue Apr 9, 2015 · 3 comments
Open

Encryption not correct #3

GoogleCodeExporter opened this issue Apr 9, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link

Hello,

Running teststate, it seems that the GPU is producing wrong results.

I have tested both version 0.1.1 and the tip (revision 36) on both Mac OS X 
10.6 (GeForce 9600M) and Ubuntu (GeForce GTX 480) and I get the same wrong 
results on both, listed below.

Best regards,
Thomas




AES test vector:
input: 4ec137a426dabf8aa0beb8bcc2b89d6
key (128bit): 95a8ee8e89979b9efdcbc6eb9797528d
key (192bit): 95a8ee8e89979b9efdcbc6eb9797528d432dc26061553818
key (256bit): 95a8ee8e89979b9efdcbc6eb9797528d432dc26061553818ea635ec5d5a7727e
Encrypted output for a 128bit key: d9b65d1232ba199cdbd487b2a1fd646
Encrypted output for a 192bit key: b18bb3e7e1732be1358443a504dbb49
Encrypted output for a 256bit key: 2f9cfddbffcde6b9f37ef8e4d512cf4
Decrypted output for a 128bit key: 9570c34363565b39353a01c0e23b65
Decrypted output for a 192bit key: 29dfd75b85cee4de6e26a88cdc2c9c3
Decrypted output for a 256bit key: 11a3545ce49b84bbb7b3523618fa6e

AES CBC test vector:
CBC - IV:         0123456789abcdef
CBC - key 128bit: 2b7e151628aed2a6abf715889cf4f3c
CBC - key 192bit: 8e73b0f7dae6452c810f32b809079e562f8ead2522c6b7b
CBC - key 256bit: 603deb1015ca71be2b73aef0857d77811f352c73b618d72d9810a3914dff4
CBC - Plaintext:  6bc1bee22e409f96e93d7e117393172a
CBC - Ciphertext for a 128bit key: 7649abac8119b246cee98e9b12e9197d
CBC - Ciphertext for a 192bit key: 4f21db243bc633d7178183a9fa071e8
CBC - Ciphertext for a 256bit key: f58c4c4d6e5f1ba779eabfb5f7bfbd6

Successfully found a device supporting CUDA (CUDART_VERSION 4020).
Using pinned memory: cudaHostAllocDefault.
The current buffer size is 8388608.

Press any key to start encrypting with a 128bit key...
output GPU: afbd3c7625e859eecb507afa9cb9a976
output CPU: d9b65d1232ba199cdbd487b2a1fd646

Press any key to start encrypting with a 192bit key...
output GPU: afbd3c7625e859eecb507afa9cb9a976
output CPU: b18bb3e7e1732be1358443a504dbb49

Press any key to start encrypting with a 256bit key...
output GPU: afbd3c7625e859eecb507afa9cb9a976
output CPU: 2f9cfddbffcde6b9f37ef8e4d512cf4

Press any key to start decrypting with a 128bit key...
output GPU: df1d599934c96eb842bf74c8f5b82dd4
output CPU: 9570c34363565b39353a01c0e23b65

Press any key to start decrypting with a 192bit key...
output GPU: df1d599934c96eb842bf74c8f5b82dd4
output CPU: 29dfd75b85cee4de6e26a88cdc2c9c3

Press any key to start decrypting with a 256bit key...
output GPU: df1d599934c96eb842bf74c8f5b82dd4
output CPU: 11a3545ce49b84bbb7b3523618fa6e

Press any key to start decrypting with a 128bit key CBC...
output GPU: f83299d91ffeaa825fe87f5f136b915f
output CPU: 6bc1bee22e409f96e93d7e117393172a

Press any key to start decrypting with a 192bit key CBC...
output GPU: f88e297836421ea18ad3f7afda7fad
output CPU: 6bc1bee22e409f96e93d7e117393172a

Press any key to start decrypting with a 256bit key CBC...
output GPU: 8a5f14e72afcec7f5fffdf961c397ee
output CPU: 6bc1bee22e409f96e93d7e117393172a

Total time: 2.157472 milliseconds

Original issue reported on code.google.com by [email protected] on 8 Oct 2012 at 9:42

@GoogleCodeExporter
Copy link
Author

Hello Thomas, 

What version of openssl are you using?
What version of the Cuda Toolkit are you using?
I ask this because some other users has reported the same issue using version 4 
and above. If you are using version 4, could you try with version 3?

Greetings,
    MRG

Original comment by [email protected] on 8 Oct 2012 at 5:58

@GoogleCodeExporter
Copy link
Author

I use CUDA Toolkit version 4.2 on both Ubuntu and OS X.

On Ubuntu, OpenSSL is:

OpenSSL 1.0.1 14 Mar 2012
built on: Tue Aug 21 05:18:48 UTC 2012
platform: debian-amd64
options:  bn(64,64) rc4(16x,int) des(idx,cisc,16,int) blowfish(idx) 
compiler: cc -fPIC -DOPENSSL_PIC -DZLIB -DOPENSSL_THREADS -D_REENTRANT 
-DDSO_DLFCN -DHAVE_DLFCN_H -m64 -DL_ENDIAN -DTERMIO -g -O2 -fstack-protector 
--param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security 
-D_FORTIFY_SOURCE=2 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wa,--noexecstack 
-Wall -DOPENSSL_NO_TLS1_2_CLIENT -DOPENSSL_MAX_TLS1_2_CIPHER_LENGTH=50 
-DMD32_REG_T=int -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT 
-DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM 
-DSHA512_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DWHIRLPOOL_ASM 
-DGHASH_ASM
OPENSSLDIR: "/usr/lib/ssl"


And on OS X:

OpenSSL 1.0.1c 10 May 2012
built on: Thu Aug 30 14:45:24 CEST 2012
platform: darwin64-x86_64-cc
options:  bn(64,64) rc4(ptr,char) des(idx,cisc,16,int) idea(int) blowfish(idx) 
compiler: /usr/bin/gcc-4.2 -fPIC -fno-common -DOPENSSL_PIC -DZLIB 
-DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -arch x86_64 -O3 
-DL_ENDIAN -Wall
OPENSSLDIR: "/opt/local/etc/openssl"

I'm quite busy now, but I'd like to try toolkit 3 when I get the time..

- Thomas

Original comment by [email protected] on 8 Oct 2012 at 7:09

@GoogleCodeExporter
Copy link
Author

Hello Paolo

I've encountered the same problem .I am using CUDA toolkit 6. Have you solved 
the problem with using newer toolkits ?

Best regards

Original comment by [email protected] on 3 Jan 2015 at 6:26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant