* f_cbc.c, f_ecb, f_parity, f_pcbc: Change des_cblock to
mit_des_cblock and des_key_schedule to
mit_des_key_schedule. Also include des_int.h.
* destest.c: Change des_cblock to mit_des_cblock and add local
prototypes.
* cs_entry.c: Remove prototypes for mit_des_cbc_cksum and
mit_des_cbc_cksum. Now in des_int.h.
* cbc_cksum.c, string2key.c: Remove casts in call to
mit_des_cbc_cksum
* des_int.h: Add prototype for mit_des_cbc_verf_cksum. Change
return code for mit_des_cbc_cksum to match source.
* des.h: Remove unused structures and defines.
Short end - fix des_int.h to reflect reality (i.e. source code) and then
fix rest of code to agree. Also removed the use of old structures such
as des_cblock and des_key_schedule. Instead the the newer
mit_des_cblock and mit_des_schedule are used.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6598
dc483132-0cff-0310-8789-
dd5450dbe970
+Thu Aug 24 18:08:42 1995 Ezra Peisach <epeisach@kangaroo.mit.edu>
+
+ * f_cksum.c: Change code to match prototypes.
+
+ * f_cbc.c, f_ecb, f_parity, f_pcbc: Change des_cblock to
+ mit_des_cblock and des_key_schedule to
+ mit_des_key_schedule. Also include des_int.h.
+
+ * destest.c: Change des_cblock to mit_des_cblock and add local
+ prototypes.
+
+ * cs_entry.c: Remove prototypes for mit_des_cbc_cksum and
+ mit_des_cbc_cksum. Now in des_int.h.
+
+ * cbc_cksum.c, string2key.c: Remove casts in call to
+ mit_des_cbc_cksum
+
+ * des_int.h: Add prototype for mit_des_cbc_verf_cksum. Change
+ return code for mit_des_cbc_cksum to match source.
+
+ * des.h: Remove unused structures and defines.
Thu Jul 27 15:18:37 EDT 1995 Paul Park (pjpark@mit.edu)
* des_int.h - Inline the old contents of include/krb5/mit-des.h. This
return ENOMEM;
}
- mit_des_cbc_cksum((krb5_octet *)in, contents, in_length,
- schedule, (krb5_octet *)key);
+ mit_des_cbc_cksum(in, contents, in_length, schedule, key);
cksum->checksum_type = CKSUMTYPE_DESCBC;
cksum->length = sizeof(mit_des_cblock);
;
}
- mit_des_cbc_cksum((krb5_octet *)in, contents, in_length,
- schedule, (krb5_octet *)key);
+ mit_des_cbc_cksum(in, contents, in_length, schedule, key);
retval = 0;
if (cksum->checksum_type == CKSUMTYPE_DESCBC) {
#include "k5-int.h"
#include "des_int.h"
-extern krb5_error_code mit_des_cbc_checksum PROTOTYPE ((
- krb5_pointer ,
- size_t ,
- krb5_pointer ,
- size_t ,
- krb5_checksum FAR * ));
-
-extern krb5_error_code mit_des_cbc_verf_cksum PROTOTYPE ((
- krb5_checksum FAR *,
- krb5_pointer ,
- size_t ,
- krb5_pointer ,
- size_t ));
-
krb5_checksum_entry krb5_des_cbc_cksumtable_entry = {
0,
mit_des_cbc_checksum,
#define KRB_UINT32 unsigned KRB_INT32
#endif
-typedef unsigned char des_cblock[8]; /* crypto-block size */
-/* Key schedule */
-typedef struct des_ks_struct { union { KRB_INT32 pad; des_cblock _;} __; } des_key_schedule[16];
-
-#define DES_KEY_SZ (sizeof(des_cblock))
-#define DES_ENCRYPT 1
-#define DES_DECRYPT 0
-
#ifndef NCOMPAT
#define C_Block des_cblock
#define Key_schedule des_key_schedule
extern krb5_error_code mit_des_cbc_checksum
PROTOTYPE((krb5_pointer, size_t,krb5_pointer,size_t, krb5_checksum FAR * ));
-/* cksum.c */
-extern long mit_des_cbc_cksum
+extern krb5_error_code mit_des_cbc_verf_cksum
+ PROTOTYPE ((krb5_checksum FAR *, krb5_pointer, size_t, krb5_pointer,
+ size_t ));
+
+
+/* f_cksum.c */
+extern unsigned long mit_des_cbc_cksum
PROTOTYPE((krb5_octet FAR *, krb5_octet FAR *, long , mit_des_key_schedule ,
krb5_octet FAR *));
-/* des.c */
+
+/* f_ecb.c */
extern int mit_des_ecb_encrypt
PROTOTYPE((mit_des_cblock FAR *, mit_des_cblock FAR *, mit_des_key_schedule , int ));
#include <stdio.h>
-void convert();
+void convert PROTOTYPE((char *, unsigned char []));
+
+void des_cblock_print_file PROTOTYPE((mit_des_cblock, FILE *));
void
main(argc, argv)
*/
#include "des.h"
+#include "des_int.h"
int
mit_des_is_weak_key(key)
*/
int
mit_des_check_key_parity(key)
- register des_cblock key;
+ register mit_des_cblock key;
{
int i;
- for (i=0; i<sizeof(des_cblock); i++) {
+ for (i=0; i<sizeof(mit_des_cblock); i++) {
if ((key[i] & 1) == parity_char(0xfe&key[i])) {
printf("warning: bad parity key:");
des_cblock_print_file(key, stdout);
void
mit_des_fixup_key_parity(key)
- register des_cblock key;
+ register mit_des_cblock key;
{
int i;
- for (i=0; i<sizeof(des_cblock); i++)
+ for (i=0; i<sizeof(mit_des_cblock); i++)
{
key[i] &= 0xfe;
key[i] |= 1^parity_char(key[i]);
* des_cbc_encrypt.c - an implementation of the DES cipher function in cbc mode
*/
#include "des.h"
+#include "des_int.h"
#include "f_tables.h"
/*
int
mit_des_cbc_encrypt(in, out, length, schedule, ivec, encrypt)
- const des_cblock *in;
- des_cblock *out;
+ const mit_des_cblock FAR *in;
+ mit_des_cblock FAR *out;
long length;
- des_key_schedule schedule;
- des_cblock ivec;
+ mit_des_key_schedule schedule;
+ mit_des_cblock ivec;
int encrypt;
{
register unsigned KRB_INT32 left, right;
* des_cbc_cksum.c - compute an 8 byte checksum using DES in CBC mode
*/
#include "des.h"
+#include "des_int.h"
#include "f_tables.h"
/*
unsigned long
mit_des_cbc_cksum(in, out, length, schedule, ivec)
- des_cblock *in;
- des_cblock *out;
+ krb5_octet FAR *in;
+ krb5_octet FAR *out;
long length;
- des_key_schedule schedule;
- des_cblock ivec;
+ mit_des_key_schedule schedule;
+ krb5_octet FAR *ivec;
{
register unsigned KRB_INT32 left, right;
register unsigned KRB_INT32 temp;
* des_ecb_encrypt.c - do an encryption in ECB mode
*/
#include "des.h"
+#include "des_int.h"
#include "f_tables.h"
/*
*/
int
mit_des_ecb_encrypt(in, out, schedule, encrypt)
- des_cblock *in;
- des_cblock *out;
- des_key_schedule schedule;
+ mit_des_cblock *in;
+ mit_des_cblock *out;
+ mit_des_key_schedule schedule;
int encrypt;
{
register unsigned KRB_INT32 left, right;
#include "des.h"
+#include "des_int.h"
/*
* des_fixup_key_parity: Forces odd parity per byte; parity is bits
void
mit_des_fixup_key_parity(key)
- register des_cblock key;
+ register mit_des_cblock key;
{
int i;
- for (i=0; i<sizeof(des_cblock); i++)
+ for (i=0; i<sizeof(mit_des_cblock); i++)
{
key[i] &= 0xfe;
key[i] |= 1^parity_char(key[i]);
*/
int
mit_des_check_key_parity(key)
- register des_cblock key;
+ register mit_des_cblock key;
{
int i;
- for (i=0; i<sizeof(des_cblock); i++)
+ for (i=0; i<sizeof(mit_des_cblock); i++)
{
if((key[i] & 1) == parity_char(0xfe&key[i]))
{
*/
int
mit_des_pcbc_encrypt(in, out, length, schedule, ivec, encrypt)
- des_cblock *in;
- des_cblock *out;
+ mit_des_cblock *in;
+ mit_des_cblock *out;
long length;
- des_key_schedule schedule;
- des_cblock ivec;
+ mit_des_key_schedule schedule;
+ mit_des_cblock ivec;
int encrypt;
{
register unsigned KRB_INT32 left, right;
/* Now one-way encrypt it with the folded key */
(void) mit_des_key_sched(key, key_sked);
- (void) mit_des_cbc_cksum((krb5_octet *)copystr, key, length, key_sked, key);
+ (void) mit_des_cbc_cksum(copystr, key, length, key_sked, key);
/* erase key_sked */
memset((char *)key_sked, 0, sizeof(key_sked));