xref: /freebsd/crypto/heimdal/doc/doxyout/hcrypto/man/man3/hcrypto_des.3 (revision 0b3105a37d7adcadcb720112fed4dc4e8040be99)
"DES crypto functions" 3 "11 Jan 2012" "Version 1.5.2" "Heimdal crypto library" \" -*- nroff -*-
NAME
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:

in data to checksum

output the checksum

length length of data

ks key schedule to use

iv initial 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:

in data to encrypt

out data to encrypt

length length of data

ks key schedule to use

iv initial vector to use

encp if 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:

in data to encrypt

out data to encrypt

length length of data

ks key schedule to use

iv initial vector to use

num offset into in cipher block encryption/decryption stop last time.

encp if non zero, encrypt. if zero, decrypt.

"int HC_DEPRECATED DES_check_key_parity (DES_cblock * key)"

Check if the key have correct parity.

Parameters:

key key 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:

input data to encrypt

output data to encrypt

ks1 key schedule to use

ks2 key schedule to use

ks3 key schedule to use

encp if 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:

input data to encrypt

output data to encrypt

ks key schedule to use

encp if 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:

in data to encrypt

out data to encrypt

length length of data

ks1 key schedule to use

ks2 key schedule to use

ks3 key schedule to use

iv initial vector to use

encp if 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:

u data to encrypt

ks key schedule to use

encp if 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:

seed a 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:

key key 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:

key a key to initialize the key schedule with.

ks a 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:

key is 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:

in data to encrypt

out data to encrypt

length length of data

ks key schedule to use

iv initial vector to use

encp if 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:

key is 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:

key a key to initialize the key schedule with.

ks a 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:

key a key to initialize the key schedule with.

ks a 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:

key a key to initialize the key schedule with.

ks a 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:

key key 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:

str The string to convert to a key

key the resulting key