keyhole logo

Functions

DES crypto functions

Functions

void DES_set_odd_parity (DES_cblock *key)
int HC_DEPRECATED DES_check_key_parity (DES_cblock *key)
int DES_is_weak_key (DES_cblock *key)
int HC_DEPRECATED DES_set_key (DES_cblock *key, DES_key_schedule *ks)
int DES_set_key_unchecked (DES_cblock *key, DES_key_schedule *ks)
int DES_set_key_checked (DES_cblock *key, DES_key_schedule *ks)
int DES_key_sched (DES_cblock *key, DES_key_schedule *ks)
void DES_encrypt (uint32_t u[2], DES_key_schedule *ks, int encp)
void DES_ecb_encrypt (DES_cblock *input, DES_cblock *output, DES_key_schedule *ks, int encp)
void DES_cbc_encrypt (const void *in, void *out, long length, DES_key_schedule *ks, DES_cblock *iv, int encp)
void DES_pcbc_encrypt (const void *in, void *out, long length, DES_key_schedule *ks, DES_cblock *iv, int encp)
void DES_ecb3_encrypt (DES_cblock *input, DES_cblock *output, DES_key_schedule *ks1, DES_key_schedule *ks2, DES_key_schedule *ks3, int encp)
void DES_ede3_cbc_encrypt (const void *in, void *out, long length, DES_key_schedule *ks1, DES_key_schedule *ks2, DES_key_schedule *ks3, DES_cblock *iv, int encp)
void DES_cfb64_encrypt (const void *in, void *out, long length, DES_key_schedule *ks, DES_cblock *iv, int *num, int encp)
uint32_t DES_cbc_cksum (const void *in, DES_cblock *output, long length, DES_key_schedule *ks, DES_cblock *iv)
void DES_string_to_key (const char *str, DES_cblock *key)
int HC_DEPRECATED DES_new_random_key (DES_cblock *key)
void HC_DEPRECATED DES_init_random_number_generator (DES_cblock *seed)
void HC_DEPRECATED DES_random_key (DES_cblock *key)

Detailed Description

See the DES - Data Encryption Standard crypto interface for description and examples.


Function Documentation

uint32_t DES_cbc_cksum ( const void *  in,
DES_cblock *  output,
long  length,
DES_key_schedule *  ks,
DES_cblock *  iv 
)

Crete a checksum using DES in CBC encryption mode. This mode is only used for Kerberos 4, and it should stay that way.

The IV must always be diffrent for diffrent input data blocks.

Parameters:
indata to checksum
outputthe checksum
lengthlength of data
kskey schedule to use
ivinitial vector to use
void DES_cbc_encrypt ( const void *  in,
void *  out,
long  length,
DES_key_schedule *  ks,
DES_cblock *  iv,
int  encp 
)

Encrypt/decrypt a block using DES in Chain Block Cipher mode (cbc).

The IV must always be diffrent for diffrent input data blocks.

Parameters:
indata to encrypt
outdata to encrypt
lengthlength of data
kskey schedule to use
ivinitial vector to use
encpif non zero, encrypt. if zero, decrypt.
void DES_cfb64_encrypt ( const void *  in,
void *  out,
long  length,
DES_key_schedule *  ks,
DES_cblock *  iv,
int *  num,
int  encp 
)

Encrypt/decrypt using DES in cipher feedback mode with 64 bit feedback.

The IV must always be diffrent for diffrent input data blocks.

Parameters:
indata to encrypt
outdata to encrypt
lengthlength of data
kskey schedule to use
ivinitial vector to use
numoffset into in cipher block encryption/decryption stop last time.
encpif non zero, encrypt. if zero, decrypt.
int HC_DEPRECATED DES_check_key_parity ( DES_cblock *  key )

Check if the key have correct parity.

Parameters:
keykey to check the parity.
Returns:
1 on success, 0 on failure.
void DES_ecb3_encrypt ( DES_cblock *  input,
DES_cblock *  output,
DES_key_schedule *  ks1,
DES_key_schedule *  ks2,
DES_key_schedule *  ks3,
int  encp 
)

Encrypt/decrypt a block using triple DES using EDE mode, encrypt/decrypt/encrypt.

Parameters:
inputdata to encrypt
outputdata to encrypt
ks1key schedule to use
ks2key schedule to use
ks3key schedule to use
encpif non zero, encrypt. if zero, decrypt.
void DES_ecb_encrypt ( DES_cblock *  input,
DES_cblock *  output,
DES_key_schedule *  ks,
int  encp 
)

Encrypt/decrypt a block using DES.

Parameters:
inputdata to encrypt
outputdata to encrypt
kskey schedule to use
encpif non zero, encrypt. if zero, decrypt.
void DES_ede3_cbc_encrypt ( const void *  in,
void *  out,
long  length,
DES_key_schedule *  ks1,
DES_key_schedule *  ks2,
DES_key_schedule *  ks3,
DES_cblock *  iv,
int  encp 
)

Encrypt/decrypt using Triple DES in Chain Block Cipher mode (cbc).

The IV must always be diffrent for diffrent input data blocks.

Parameters:
indata to encrypt
outdata to encrypt
lengthlength of data
ks1key schedule to use
ks2key schedule to use
ks3key schedule to use
ivinitial vector to use
encpif non zero, encrypt. if zero, decrypt.
void DES_encrypt ( uint32_t  u[2],
DES_key_schedule *  ks,
int  encp 
)

Encrypt/decrypt a block using DES. Also called ECB mode

Parameters:
udata to encrypt
kskey schedule to use
encpif non zero, encrypt. if zero, decrypt.
void HC_DEPRECATED DES_init_random_number_generator ( DES_cblock *  seed )

Seed the random number generator. Deprecated, use RAND - random number

Parameters:
seeda seed to seed that random number generate with.
int DES_is_weak_key ( DES_cblock *  key )

Checks if the key is any of the weaks keys that makes DES attacks trival.

Parameters:
keykey to check.
Returns:
1 if the key is weak, 0 otherwise.
int DES_key_sched ( DES_cblock *  key,
DES_key_schedule *  ks 
)

Compatibility function for eay libdes, works just like DES_set_key_checked().

Parameters:
keya key to initialize the key schedule with.
ksa key schedule to initialize.
Returns:
0 on success, -1 on invalid parity, -2 on weak key.
int HC_DEPRECATED DES_new_random_key ( DES_cblock *  key )

Generate a random des key using a random block, fixup parity and skip weak keys.

Parameters:
keyis set to a random key.
Returns:
0 on success, non zero on random number generator failure.
void DES_pcbc_encrypt ( const void *  in,
void *  out,
long  length,
DES_key_schedule *  ks,
DES_cblock *  iv,
int  encp 
)

Encrypt/decrypt a block using DES in Propagating Cipher Block Chaining mode. This mode is only used for Kerberos 4, and it should stay that way.

The IV must always be diffrent for diffrent input data blocks.

Parameters:
indata to encrypt
outdata to encrypt
lengthlength of data
kskey schedule to use
ivinitial vector to use
encpif non zero, encrypt. if zero, decrypt.
void HC_DEPRECATED DES_random_key ( DES_cblock *  key )

Generate a random key, deprecated since it doesn't return an error code, use DES_new_random_key().

Parameters:
keyis set to a random key.
int HC_DEPRECATED DES_set_key ( DES_cblock *  key,
DES_key_schedule *  ks 
)

Setup a des key schedule from a key. Deprecated function, use DES_set_key_unchecked() or DES_set_key_checked() instead.

Parameters:
keya key to initialize the key schedule with.
ksa key schedule to initialize.
Returns:
0 on success
int DES_set_key_checked ( DES_cblock *  key,
DES_key_schedule *  ks 
)

Just like DES_set_key_unchecked() except checking that the key is not weak for or have correct parity.

Parameters:
keya key to initialize the key schedule with.
ksa key schedule to initialize.
Returns:
0 on success, -1 on invalid parity, -2 on weak key.
int DES_set_key_unchecked ( DES_cblock *  key,
DES_key_schedule *  ks 
)

Setup a des key schedule from a key. The key is no longer needed after this transaction and can cleared.

Does NOT check that the key is weak for or have wrong parity.

Parameters:
keya key to initialize the key schedule with.
ksa key schedule to initialize.
Returns:
0 on success
void DES_set_odd_parity ( DES_cblock *  key )

Set the parity of the key block, used to generate a des key from a random key. See DES key generation.

Parameters:
keykey to fixup the parity for.
void DES_string_to_key ( const char *  str,
DES_cblock *  key 
)

Convert a string to a DES key. Use something like PKCS5_PBKDF2_HMAC_SHA1() to create key from passwords.

Parameters:
strThe string to convert to a key
keythe resulting key

Generated on Wed Nov 9 2011 16:14:48 for Heimdal crypto library by doxygen 1.7.2