PicoWAN SDK Documentation
Data Structures | Macros | Typedefs | Functions
aes.h File Reference

AES implementation that uses only 8-bit byte operations on the cipher state. More...

#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  aes_context
 

Macros

#define AES_ENC_PREKEYED   /* AES encryption with a precomputed key schedule */
 
#define AES_DEC_PREKEYED   /* AES decryption with a precomputed key schedule */
 
#define N_ROW   4
 
#define N_COL   4
 
#define N_BLOCK   (N_ROW * N_COL)
 
#define N_MAX_ROUNDS   14
 

Typedefs

typedef uint8_t return_type
 
typedef uint8_t length_type
 

Functions

return_type aes_set_key (const uint8_t key[], length_type keylen, aes_context ctx[1])
 Sets the key for AES encryption/decryption. More...
 
return_type aes_encrypt (const uint8_t in[N_BLOCK], uint8_t out[N_BLOCK], const aes_context ctx[1])
 Encrypts a single block of 16 bytes. More...
 
return_type aes_encrypt_all (const uint8_t *in, uint8_t *out, uint32_t len, const aes_context ctx[1])
 Encrypts a buffer of n x 16 bytes. More...
 
return_type aes_cbc_encrypt (const uint8_t *in, uint8_t *out, int32_t n_block, uint8_t iv[N_BLOCK], const aes_context ctx[1])
 
return_type aes_decrypt (const uint8_t in[N_BLOCK], uint8_t out[N_BLOCK], const aes_context ctx[1])
 Decrypts a single block of 16 bytes. More...
 
return_type aes_decrypt_all (const uint8_t *in, uint8_t *out, uint32_t len, const aes_context ctx[1])
 Decrypts a buffer of n x 16 bytes. More...
 
return_type aes_cbc_decrypt (const uint8_t *in, uint8_t *out, int32_t n_block, uint8_t iv[N_BLOCK], const aes_context ctx[1])
 

Detailed Description

AES implementation that uses only 8-bit byte operations on the cipher state.


Copyright (c) 1998-2008, Brian Gladman, Worcester, UK. All rights reserved.

LICENSE TERMS

The redistribution and use of this software (with or without changes) is allowed without the payment of fees or royalties provided that:

  1. source code distributions include the above copyright notice, this list of conditions and the following disclaimer;
  2. binary distributions include the above copyright notice, this list of conditions and the following disclaimer in their documentation;
  3. the name of the copyright holder is not used to endorse products built using this software without specific written permission.

DISCLAIMER

This software is provided 'as is' with no explicit or implied warranties in respect of its properties, including, but not limited to, correctness and/or fitness for purpose.


Issue 09/09/2006

This is an AES implementation that uses only 8-bit byte operations on the cipher state.

Function Documentation

return_type aes_decrypt ( const uint8_t  in[N_BLOCK],
uint8_t  out[N_BLOCK],
const aes_context  ctx[1] 
)

Decrypts a single block of 16 bytes.

Parameters
inThe block to decrypt.
outThe buffer that will hold the decrypted block.
ctxThe current AES context.
Return values
uint32_t0 if everything is OK, -1 otherwise.
return_type aes_decrypt_all ( const uint8_t *  in,
uint8_t *  out,
uint32_t  len,
const aes_context  ctx[1] 
)

Decrypts a buffer of n x 16 bytes.

Parameters
inThe block to decrypt.
outThe buffer that will hold the decrypted block.
lenThe length of the buffer.
ctxThe current AES context.
Return values
uint32_t0 if everything is OK, -1 otherwise.
return_type aes_encrypt ( const uint8_t  in[N_BLOCK],
uint8_t  out[N_BLOCK],
const aes_context  ctx[1] 
)

Encrypts a single block of 16 bytes.

Parameters
inThe block to encrypt.
outThe buffer that will hold the encrypted block.
ctxThe current AES context.
Return values
uint32_t0 if everything is OK, -1 otherwise.
return_type aes_encrypt_all ( const uint8_t *  in,
uint8_t *  out,
uint32_t  len,
const aes_context  ctx[1] 
)

Encrypts a buffer of n x 16 bytes.

Parameters
inThe buffer to encrypt.
outThe buffer that will hold the encrypted data.
lenThe length of the buffer.
ctxThe current AES context.
Return values
uint32_t0 if everything is OK, -1 otherwise.
return_type aes_set_key ( const uint8_t  key[],
length_type  keylen,
aes_context  ctx[1] 
)

Sets the key for AES encryption/decryption.

Parameters
keyThe AES key to use.
keylenThe length of the key.
ctxThe current AES context.
Return values
uint32_t0 if everything went OK, -1 otherwise.