Salmon
Loading...
Searching...
No Matches
salmon.h File Reference

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.

Macros

#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
 

Functions

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)
 

Detailed Description

Encrypt and decrypt data with AES-256 in CTR mode using different implementations.

Function Documentation

◆ 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
keyThe AES-256 (32-byte) key to expand.
expandedKeyThe expanded key (240-bytes).

◆ salmon_init()

EXPORT_DLL void salmon_init ( int aesImplType)
extern

Initialize the transformer.

Parameters
aesImplTypeThe 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
expandedKeyThe expanded AES-256 key (240 bytes), see aes_key_expand
counterThe counter to use.
srcBufferThe source byte array.
srcOffsetThe source byte offset.
destBufferThe destination byte array.
destOffsetThe destination byte offset.
countThe number of bytes to transform.
Returns
The number of bytes transformed.