/* flaneth - flash and ethernet
   Copyright (C) 2007-2012 Stefan Schuermans <stefan@schuermans.info>
   Copyleft: GNU public license V2 - http://www.gnu.org/copyleft/gpl.html
   a BlinkenArea project - http://www.blinkenarea.org/ */

#ifndef INC_xtea
#define INC_xtea

#include <stdint.h>

// XTEA encryption
// rounds should be at least 32
// p_in == p_out is allowed
// p_prev must be initialized to zero before first call to this function
extern void xtea_enc(uint32_t key[4], uint8_t rounds, uint64_t * p_in,
                     uint64_t * p_out, unsigned int block_cnt,
                     uint64_t * p_prev);

// XTEA decryption
// rounds should be at least 32
// p_in == p_out is allowed
// p_prev must be initialized to zero before first call to this function
extern void xtea_dec(uint32_t key[4], uint8_t rounds, uint64_t * p_in,
                     uint64_t * p_out, unsigned int block_cnt,
                     uint64_t * p_prev);

#endif // #ifndef INC_xtea
