version 1.1, 2004/07/11 00:32:17 |
version 1.4, 2005/06/19 15:45:38 |
|
|
/* $OpenXM$ */ |
/* $OpenXM: OpenXM/src/ox_ntl/crypt/des/des.c,v 1.3 2005/06/19 15:29:00 iwane Exp $ */ |
/* |
/* |
* FIPS PUB 46-3 |
* FIPS PUB 46-3 |
* DATA ENCRYPTION STANDARD |
* DATA ENCRYPTION STANDARD |
|
|
#include "des.h" |
#include "des.h" |
#include "block.h" |
#include "block.h" |
|
|
|
#ifdef HAVE_CONFIG_H |
|
#include "config.h" |
|
#endif |
|
|
#define BLOCK 8 |
#define BLOCK 8 |
|
|
#define inline inline |
|
|
|
/*===========================================================* |
/*===========================================================* |
* KEY STRUCT |
* KEY STRUCT |
Line 391 f_(uint32_t r, uint32_t kl, uint32_t kr) |
|
Line 394 f_(uint32_t r, uint32_t kl, uint32_t kr) |
|
} |
} |
|
|
/*===========================================================* |
/*===========================================================* |
* BASE CRIPTO |
* BASE CRYPTO |
*===========================================================*/ |
*===========================================================*/ |
void |
void |
des_dec_i( |
des_dec_i( |
Line 517 des_dec_c(const des_key *key, const unsigned char *enc |
|
Line 520 des_dec_c(const des_key *key, const unsigned char *enc |
|
} |
} |
|
|
/*===========================================================* |
/*===========================================================* |
* CRIPTO: length of input data is "64 * n" byte |
* CRYPTO: length of input data is "64 * n" byte |
*===========================================================*/ |
*===========================================================*/ |
static int |
static int |
des_prm_chk(int datalen, int buflen) |
des_prm_chk(int datalen, int buflen) |
Line 554 des_dec_ecb(const des_key *key, int len, const unsigne |
|
Line 557 des_dec_ecb(const des_key *key, int len, const unsigne |
|
|
|
|
|
int |
int |
des_enc_cbc(const des_key *key, const unsigned char *iv, int len, |
des_enc_cbc(const des_key *key, unsigned char *iv, int len, |
const unsigned char *data, unsigned char *buf) |
const unsigned char *data, unsigned char *buf) |
{ |
{ |
int ret; |
int ret; |
Line 566 des_enc_cbc(const des_key *key, const unsigned char *i |
|
Line 569 des_enc_cbc(const des_key *key, const unsigned char *i |
|
|
|
|
|
int |
int |
des_dec_cbc(const des_key *key, const unsigned char *iv, int len, |
des_dec_cbc(const des_key *key, unsigned char *iv, int len, |
const unsigned char *data, unsigned char *buf) |
const unsigned char *data, unsigned char *buf) |
{ |
{ |
int ret; |
int ret; |