-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaes_cuda.h
58 lines (50 loc) · 1.85 KB
/
aes_cuda.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
* @version 0.1.1 - Copyright (c) 2010.
*
* @author Paolo Margara <[email protected]>
*
* Copyright 2010 Paolo Margara
*
* This file is part of Engine_cudamrg.
*
* Engine_cudamrg is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License or
* any later version.
*
* Engine_cudamrg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Engine_cudamrg. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <assert.h>
#include <memory.h>
#include <openssl/aes.h>
#include <openssl/engine.h>
#include <cuda_runtime_api.h>
#define MAX_THREAD 256
#define STATE_THREAD 4
#define AES_KEY_SIZE_128 16
#define AES_KEY_SIZE_192 24
#define AES_KEY_SIZE_256 32
#define OUTPUT_QUIET 0
#define OUTPUT_NORMAL 1
#define OUTPUT_VERBOSE 2
int AES_cuda_set_encrypt_key(const unsigned char *userKey, int bits, AES_KEY *key);
int AES_cuda_set_decrypt_key(const unsigned char *userKey, int bits, AES_KEY *key);
void AES_cuda_encrypt(const unsigned char *in, unsigned char *out,size_t nbytes);
void AES_cuda_decrypt(const unsigned char *in, unsigned char *out,size_t nbytes);
void AES_cuda_transfer_iv(const unsigned char *iv);
#ifndef CBC_ENC_CPU
void AES_cuda_encrypt_cbc(const unsigned char *in, unsigned char *out,size_t nbytes);
#endif
void AES_cuda_decrypt_cbc(const unsigned char *in, unsigned char *out,size_t nbytes);
void AES_cuda_init(int* nm,int buffer_size_engine,int verbosity);
void AES_cuda_finish();