Encrypt and decrypt data with AES-256 in CTR mode using different implementations.
More...
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <time.h>
#include <math.h>
Go to the source code of this file.
|
#define | AES_IMPL_AES_INTR 1 |
| AES-256 using NI-Intrinsics.
|
|
#define | AES_IMPL_AES 2 |
| AES-256 using pure C.
|
|
#define | AES_IMPL_AES_GPU 3 |
| AES-256 using GPU (OpenCL).
|
|
#define | GetJavaArray GetByteArrayElements |
|
#define | ReleaseJavaArray ReleaseByteArrayElements |
|
#define | EXPORT_DLL |
|
|
EXPORT_DLL void | salmon_init (int aesImplType) |
|
EXPORT_DLL void | salmon_expandKey (const unsigned char *key, unsigned char *expandedKey) |
|
EXPORT_DLL int | salmon_transform (const unsigned char *expandedKey, unsigned char *counter, const unsigned char *srcBuffer, int srcOffset, unsigned char *destBuffer, int destOffset, int count) |
|
Encrypt and decrypt data with AES-256 in CTR mode using different implementations.
◆ salmon_expandKey()
EXPORT_DLL void salmon_expandKey |
( |
const unsigned char * | key, |
|
|
unsigned char * | expandedKey ) |
|
extern |
Expand an AES-256 32-byte key to a 240-byte set of round keys.
- Parameters
-
key | The AES-256 (32-byte) key to expand. |
expandedKey | The expanded key (240-bytes). |
◆ salmon_init()
EXPORT_DLL void salmon_init |
( |
int | aesImplType | ) |
|
|
extern |
Initialize the transformer.
- Parameters
-
aesImplType | The AES implementation: see: AES_IMPL_AES_INTR, AES_IMPL_TINY_AES, AES_IMPL_AES_GPU |
◆ salmon_transform()
EXPORT_DLL int salmon_transform |
( |
const unsigned char * | expandedKey, |
|
|
unsigned char * | counter, |
|
|
const unsigned char * | srcBuffer, |
|
|
int | srcOffset, |
|
|
unsigned char * | destBuffer, |
|
|
int | destOffset, |
|
|
int | count ) |
|
extern |
Transform the data using AES-256 CTR mode.
- Parameters
-
expandedKey | The expanded AES-256 key (240 bytes), see aes_key_expand |
counter | The counter to use. |
srcBuffer | The source byte array. |
srcOffset | The source byte offset. |
destBuffer | The destination byte array. |
destOffset | The destination byte offset. |
count | The number of bytes to transform. |
- Returns
- The number of bytes transformed.