My Project
Loading...
Searching...
No Matches
Algorithms - IDEA

Functions

WOLFSSL_API int wc_IdeaSetKey (Idea *idea, const byte *key, word16 keySz, const byte *iv, int dir)
 Generate the 52, 16-bit key sub-blocks from the 128 key.
 
WOLFSSL_API int wc_IdeaSetIV (Idea *idea, const byte *iv)
 Sets the IV in an Idea key structure.
 
WOLFSSL_API int wc_IdeaCipher (Idea *idea, byte *out, const byte *in)
 Encryption or decryption for a block (64 bits).
 
WOLFSSL_API int wc_IdeaCbcEncrypt (Idea *idea, byte *out, const byte *in, word32 len)
 Encrypt data using IDEA CBC mode.
 
WOLFSSL_API int wc_IdeaCbcDecrypt (Idea *idea, byte *out, const byte *in, word32 len)
 Decrypt data using IDEA CBC mode.
 

Detailed Description

Function Documentation

◆ wc_IdeaCbcDecrypt()

WOLFSSL_API int wc_IdeaCbcDecrypt ( Idea * idea,
byte * out,
const byte * in,
word32 len )

Decrypt data using IDEA CBC mode.

Returns
0 Success
BAD_FUNC_ARG Returns if any arguments are null.
Parameters
ideaPointer to Idea key structure.
outPointer to destination for encryption.
inPointer to input for encryption.
lenlength of input.

Example

Idea idea;
// Initialize idea structure for decryption
const char *message = "International Data Encryption Algorithm";
byte msg_enc[40], msg_dec[40];
memset(msg_dec, 0, sizeof(msg_dec));
ret = wc_IdeaCbcDecrypt(&idea, msg_dec, msg_enc,
(word32)strlen(message)+1);
if(ret != 0)
{
// Some error occurred
}
WOLFSSL_API int wc_IdeaCbcDecrypt(Idea *idea, byte *out, const byte *in, word32 len)
Decrypt data using IDEA CBC mode.
Definition idea.c:277
Definition idea.h:51
See also
wc_IdeaCbcEncrypt
wc_IdeaCipher
wc_IdeaSetKey

◆ wc_IdeaCbcEncrypt()

WOLFSSL_API int wc_IdeaCbcEncrypt ( Idea * idea,
byte * out,
const byte * in,
word32 len )

Encrypt data using IDEA CBC mode.

Returns
0 Success
BAD_FUNC_ARG Returns if any arguments are null.
Parameters
ideaPointer to Idea key structure.
outPointer to destination for encryption.
inPointer to input for encryption.
lenlength of input.

Example

Idea idea;
// Initialize idea structure for encryption
const char *message = "International Data Encryption Algorithm";
byte msg_enc[40], msg_dec[40];
memset(msg_enc, 0, sizeof(msg_enc));
ret = wc_IdeaCbcEncrypt(&idea, msg_enc, (byte *)message,
(word32)strlen(message)+1);
if(ret != 0)
{
// Some error occurred
}
WOLFSSL_API int wc_IdeaCbcEncrypt(Idea *idea, byte *out, const byte *in, word32 len)
Encrypt data using IDEA CBC mode.
Definition idea.c:252
See also
wc_IdeaCbcDecrypt
wc_IdeaCipher
wc_IdeaSetKey

◆ wc_IdeaCipher()

WOLFSSL_API int wc_IdeaCipher ( Idea * idea,
byte * out,
const byte * in )

Encryption or decryption for a block (64 bits).

Returns
0 upon success.
<0 an error occurred
Parameters
ideaPointer to idea key structure.
outPointer to destination.
inPointer to input data to encrypt or decrypt.

Example

byte v_key[IDEA_KEY_SIZE] = { }; // Some Key
byte data[IDEA_BLOCK_SIZE] = { }; // Some encrypted data
Idea idea;
wc_IdeaSetKey(&idea, v_key, IDEA_KEY_SIZE, NULL, IDEA_DECRYPTION);
int ret = wc_IdeaCipher(&idea, data, data);
if (ret != 0)
{
// There was an error
}
WOLFSSL_API int wc_IdeaSetKey(Idea *idea, const byte *key, word16 keySz, const byte *iv, int dir)
Generate the 52, 16-bit key sub-blocks from the 128 key.
Definition idea.c:118
WOLFSSL_API int wc_IdeaCipher(Idea *idea, byte *out, const byte *in)
Encryption or decryption for a block (64 bits).
Definition idea.c:197
See also
wc_IdeaSetKey
wc_IdeaSetIV
wc_IdeaCbcEncrypt
wc_IdeaCbcDecrypt

◆ wc_IdeaSetIV()

WOLFSSL_API int wc_IdeaSetIV ( Idea * idea,
const byte * iv )

Sets the IV in an Idea key structure.

Returns
0 Success
BAD_FUNC_ARG Returns if idea is null.
Parameters
ideaPointer to idea key structure.
ivThe IV value to set, can be null.

Example

Idea idea;
// Initialize idea
byte iv[] = { }; // Some IV
int ret = wc_IdeaSetIV(&idea, iv);
if(ret != 0)
{
// Some error occurred
}
WOLFSSL_API int wc_IdeaSetIV(Idea *idea, const byte *iv)
Sets the IV in an Idea key structure.
Definition idea.c:182
See also
wc_IdeaSetKey

◆ wc_IdeaSetKey()

WOLFSSL_API int wc_IdeaSetKey ( Idea * idea,
const byte * key,
word16 keySz,
const byte * iv,
int dir )

Generate the 52, 16-bit key sub-blocks from the 128 key.

Returns
0 Success
BAD_FUNC_ARG Returns if idea or key is null, keySz is not equal to IDEA_KEY_SIZE, or dir is not IDEA_ENCRYPTION or IDEA_DECRYPTION.
Parameters
ideaPointer to Idea structure.
keyPointer to key in memory.
keySzSize of key.
ivValue for IV in Idea structure. Can be null.
dirDirection, either IDEA_ENCRYPTION or IDEA_DECRYPTION

Example

byte v_key[IDEA_KEY_SIZE] = { }; // Some Key
Idea idea;
int ret = wc_IdeaSetKey(&idea v_key, IDEA_KEY_SIZE, NULL, IDEA_ENCRYPTION);
if (ret != 0)
{
// There was an error
}
See also
wc_IdeaSetIV