xts.h File Reference

XEX-based tweaked-codebook mode with ciphertext stealing (XTS) More...

#include "core/crypto.h"
#include "cipher/rc2.h"
#include "cipher/rc6.h"
#include "cipher/idea.h"
#include "cipher/des.h"
#include "cipher/des3.h"
#include "cipher/aes.h"
#include "cipher/camellia.h"
#include "cipher/seed.h"
#include "cipher/aria.h"
#include "cipher/present.h"

Go to the source code of this file.

Data Structures

struct  XtsContext
 XTS context. More...
 

Functions

error_t xtsInit (XtsContext *context, const CipherAlgo *cipherAlgo, const void *key, size_t keyLen)
 Initialize XTS context. More...
 
error_t xtsEncrypt (XtsContext *context, const uint8_t *i, const uint8_t *p, uint8_t *c, size_t length)
 Encrypt a data unit using XTS. More...
 
error_t xtsDecrypt (XtsContext *context, const uint8_t *i, const uint8_t *c, uint8_t *p, size_t length)
 Decrypt a data unit using XTS. More...
 
void xtsMul (uint8_t *x, const uint8_t *a)
 Multiplication by x in GF(2^128) More...
 
void xtsXorBlock (uint8_t *x, const uint8_t *a, const uint8_t *b)
 XOR operation. More...
 

Detailed Description

XEX-based tweaked-codebook mode with ciphertext stealing (XTS)

License

Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneCrypto Open.

This program 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 2 of the License, or (at your option) any later version.

This program 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 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
1.9.0

Definition in file xts.h.

Function Documentation

◆ xtsDecrypt()

error_t xtsDecrypt ( XtsContext context,
const uint8_t *  i,
const uint8_t *  c,
uint8_t *  p,
size_t  length 
)

Decrypt a data unit using XTS.

Parameters
[in]contextPointer to the XTS context
[in]iValue of the 128-bit tweak
[in]cPointer to the data unit to be decrypted (ciphertext)
[out]pPointer to the resulting data unit (plaintext)
[in]lengthLength of the data unit, in bytes
Returns
Error code

Definition at line 169 of file xts.c.

◆ xtsEncrypt()

error_t xtsEncrypt ( XtsContext context,
const uint8_t *  i,
const uint8_t *  p,
uint8_t *  c,
size_t  length 
)

Encrypt a data unit using XTS.

Parameters
[in]contextPointer to the XTS context
[in]iValue of the 128-bit tweak
[in]pPointer to the data unit to be encrypted (plaintext)
[out]cPointer to the resulting data unit (ciphertext)
[in]lengthLength of the data unit, in bytes
Returns
Error code

Definition at line 104 of file xts.c.

◆ xtsInit()

error_t xtsInit ( XtsContext context,
const CipherAlgo cipherAlgo,
const void *  key,
size_t  keyLen 
)

Initialize XTS context.

Parameters
[in]contextPointer to the XTS context
[in]cipherAlgoCipher algorithm
[in]keyPointer to the key
[in]keyLenLength of the key
Returns
Error code

Definition at line 55 of file xts.c.

◆ xtsMul()

void xtsMul ( uint8_t *  x,
const uint8_t *  a 
)

Multiplication by x in GF(2^128)

Parameters
[out]xPointer to the output block
[out]aPointer to the input block

Definition at line 250 of file xts.c.

◆ xtsXorBlock()

void xtsXorBlock ( uint8_t *  x,
const uint8_t *  a,
const uint8_t *  b 
)

XOR operation.

Parameters
[out]xBlock resulting from the XOR operation
[in]aFirst input block
[in]bSecond input block

Definition at line 280 of file xts.c.