#include <inttypes.h>
#include "des.h"
Go to the source code of this file.
Defines | |
#define | T(a, b, c, d, e, f, g, h) 64-a,64-b,64-c,64-d,64-e,64-f,64-g,64-h |
#define | T(a, b, c, d) 32-a,32-b,32-c,32-d |
#define | T(a, b, c, d, e, f, g) 64-a,64-b,64-c,64-d,64-e,64-f,64-g |
#define | T(a, b, c, d, e, f) 56-a,56-b,56-c,56-d,56-e,56-f |
Functions | |
static uint64_t | shuffle (uint64_t in, const uint8_t *shuffle, int shuffle_len) |
static uint64_t | shuffle_inv (uint64_t in, const uint8_t *shuffle, int shuffle_len) |
static uint32_t | f_func (uint32_t r, uint64_t k) |
static uint64_t | key_shift_left (uint64_t CDn) |
rotate the two halves of the expanded 56 bit key each 1 bit left | |
uint64_t | ff_des_encdec (uint64_t in, uint64_t key, int decrypt) |
en- or decrypt an 64-bit block of data with DES | |
Variables | |
static const uint8_t | IP_shuffle [] |
static const uint8_t | P_shuffle [] |
static const uint8_t | PC1_shuffle [] |
static const uint8_t | PC2_shuffle [] |
static const uint32_t | S_boxes_P_shuffle [8][64] |
This table contains the results of applying both the S-box and P-shuffle. |
static uint32_t f_func | ( | uint32_t | r, | |
uint64_t | k | |||
) | [static] |
uint64_t ff_des_encdec | ( | uint64_t | in, | |
uint64_t | key, | |||
int | decrypt | |||
) |
en- or decrypt an 64-bit block of data with DES
in | data to process. | |
key | key to use for en-/decryption. | |
decrypt | if 0 encrypt, else decrypt. |
Definition at line 251 of file des.c.
Referenced by ff_asfcrypt_dec().
static uint64_t key_shift_left | ( | uint64_t | CDn | ) | [static] |
rotate the two halves of the expanded 56 bit key each 1 bit left
Note: the specification calls this "shift", so I kept it although it is confusing.
Definition at line 243 of file des.c.
Referenced by ff_des_encdec().
static uint64_t shuffle | ( | uint64_t | in, | |
const uint8_t * | shuffle, | |||
int | shuffle_len | |||
) | [static] |
static uint64_t shuffle_inv | ( | uint64_t | in, | |
const uint8_t * | shuffle, | |||
int | shuffle_len | |||
) | [static] |
const uint8_t IP_shuffle[] [static] |
Initial value:
{ T(58, 50, 42, 34, 26, 18, 10, 2), T(60, 52, 44, 36, 28, 20, 12, 4), T(62, 54, 46, 38, 30, 22, 14, 6), T(64, 56, 48, 40, 32, 24, 16, 8), T(57, 49, 41, 33, 25, 17, 9, 1), T(59, 51, 43, 35, 27, 19, 11, 3), T(61, 53, 45, 37, 29, 21, 13, 5), }
Definition at line 25 of file des.c.
Referenced by ff_des_encdec().
const uint8_t PC1_shuffle[] [static] |
const uint8_t PC2_shuffle[] [static] |
const uint32_t S_boxes_P_shuffle[8][64] [static] |