From 597cb213484b9567fcbe089bc937757fe99e8a19 Mon Sep 17 00:00:00 2001 From: Richard Basch Date: Wed, 15 May 1996 00:59:30 +0000 Subject: [PATCH] * des_int.h: the cs_entry routines in cbc_cksum.c are now static * Makefile.in: removed cs_entry.c * cbc_cksum.c: caller is responsible for allocating cksum->contents and indicate the allocated amount in cksum->length. the cs_entry routines are now static and the cs_entry structure is now in this file to enforce proper use. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@8023 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/crypto/des/ChangeLog | 12 +++++++++++ src/lib/crypto/des/Makefile.in | 2 -- src/lib/crypto/des/cbc_cksum.c | 36 ++++++++++++++++++++++----------- src/lib/crypto/des/cs_entry.c | 37 ---------------------------------- src/lib/crypto/des/des_int.h | 9 --------- 5 files changed, 36 insertions(+), 60 deletions(-) delete mode 100644 src/lib/crypto/des/cs_entry.c diff --git a/src/lib/crypto/des/ChangeLog b/src/lib/crypto/des/ChangeLog index 50c2d0115..5768c55a1 100644 --- a/src/lib/crypto/des/ChangeLog +++ b/src/lib/crypto/des/ChangeLog @@ -1,3 +1,15 @@ +Tue May 14 18:59:38 1996 Richard Basch + + * des_int.h: the cs_entry routines in cbc_cksum.c are now static. + + * Makefile.in: removed cs_entry.c + + * cbc_cksum.c: + caller is responsible for allocating cksum->contents + and indicate the allocated amount in cksum->length. + the cs_entry routines are now static and the cs_entry + structure is now in this file to enforce proper use. + Fri May 10 01:46:25 1996 Richard Basch * d3_str2ky.c d3_procky.c des_int.h init_rkey.c: diff --git a/src/lib/crypto/des/Makefile.in b/src/lib/crypto/des/Makefile.in index 6875c762d..62aceb2c8 100644 --- a/src/lib/crypto/des/Makefile.in +++ b/src/lib/crypto/des/Makefile.in @@ -14,7 +14,6 @@ DEPKLIB = $(TOPLIBD)/libkrb5.$(LIBEXT) $(TOPLIBD)/libcrypto.$(LIBEXT) $(COMERRLI OBJS= afsstring2key.$(OBJEXT) \ cbc_cksum.$(OBJEXT) \ - cs_entry.$(OBJEXT) \ finish_key.$(OBJEXT) \ fin_rndkey.$(OBJEXT) \ init_rkey.$(OBJEXT) \ @@ -38,7 +37,6 @@ OBJS= afsstring2key.$(OBJEXT) \ u_rn_key.$(OBJEXT) SRCS= $(srcdir)/afsstring2key.c \ - $(srcdir)/cs_entry.c \ $(srcdir)/cbc_cksum.c \ $(srcdir)/finish_key.c \ $(srcdir)/fin_rndkey.c \ diff --git a/src/lib/crypto/des/cbc_cksum.c b/src/lib/crypto/des/cbc_cksum.c index 6004aa382..9c98263a2 100644 --- a/src/lib/crypto/des/cbc_cksum.c +++ b/src/lib/crypto/des/cbc_cksum.c @@ -37,12 +37,20 @@ with the help of key "key" of size "key_size" (which should be 8); fills out krb5_checksum structure. - caller is responsible for freeing "contents" element in + caller is responsible for allocating & freeing "contents" element in krb5_checksum structure. returns: errors */ -krb5_error_code + +static krb5_error_code mit_des_cbc_checksum + PROTOTYPE((krb5_pointer, size_t,krb5_pointer,size_t, krb5_checksum FAR * )); + +static krb5_error_code mit_des_cbc_verf_cksum + PROTOTYPE ((krb5_checksum FAR *, krb5_pointer, size_t, krb5_pointer, + size_t )); + +static krb5_error_code mit_des_cbc_checksum(in, in_length, key, key_size, cksum) krb5_pointer in; size_t in_length; @@ -51,8 +59,9 @@ mit_des_cbc_checksum(in, in_length, key, key_size, cksum) krb5_checksum FAR * cksum; { struct mit_des_ks_struct *schedule; /* pointer to key schedules */ - krb5_octet *contents; + if (cksum->length < sizeof(mit_des_cblock)) + return KRB5_BAD_MSIZE; if (key_size != sizeof(mit_des_cblock)) return KRB5_BAD_KEYSIZE; @@ -75,22 +84,17 @@ mit_des_cbc_checksum(in, in_length, key, key_size, cksum) ; } - if (!(contents = (krb5_octet *) malloc(sizeof(mit_des_cblock)))) { - cleanup(); - return ENOMEM; - } - - mit_des_cbc_cksum(in, contents, in_length, schedule, key); - cksum->checksum_type = CKSUMTYPE_DESCBC; cksum->length = sizeof(mit_des_cblock); - cksum->contents = contents; + + mit_des_cbc_cksum(in, cksum->contents, in_length, schedule, key); + cleanup(); return 0; } -krb5_error_code +static krb5_error_code mit_des_cbc_verf_cksum(cksum, in, in_length, key, key_size) krb5_checksum FAR * cksum; krb5_pointer in; @@ -144,3 +148,11 @@ mit_des_cbc_verf_cksum(cksum, in, in_length, key, key_size) return retval; } +krb5_checksum_entry krb5_des_cbc_cksumtable_entry = { + 0, + mit_des_cbc_checksum, + mit_des_cbc_verf_cksum, + sizeof(mit_des_cblock), + 1, /* is collision proof */ + 1, /* is keyed */ +}; diff --git a/src/lib/crypto/des/cs_entry.c b/src/lib/crypto/des/cs_entry.c deleted file mode 100644 index c32acf195..000000000 --- a/src/lib/crypto/des/cs_entry.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * lib/crypto/des/cs_entry.c - * - * Copyright 1990, 1991, 1995 by the Massachusetts Institute of Technology. - * All Rights Reserved. - * - * Export of this software from the United States of America may - * require a specific license from the United States Government. - * It is the responsibility of any person or organization contemplating - * export to obtain such a license before exporting. - * - * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and - * distribute this software and its documentation for any purpose and - * without fee is hereby granted, provided that the above copyright - * notice appear in all copies and that both that copyright notice and - * this permission notice appear in supporting documentation, and that - * the name of M.I.T. not be used in advertising or publicity pertaining - * to distribution of the software without specific, written prior - * permission. M.I.T. makes no representations about the suitability of - * this software for any purpose. It is provided "as is" without express - * or implied warranty. - * - * - * DES encryption interface file - */ - -#include "k5-int.h" -#include "des_int.h" - -krb5_checksum_entry krb5_des_cbc_cksumtable_entry = { - 0, - mit_des_cbc_checksum, - mit_des_cbc_verf_cksum, - sizeof(mit_des_cblock), - 1, /* is collision proof */ - 1, /* is keyed */ -}; diff --git a/src/lib/crypto/des/des_int.h b/src/lib/crypto/des/des_int.h index 6f97449f5..a04621103 100644 --- a/src/lib/crypto/des/des_int.h +++ b/src/lib/crypto/des/des_int.h @@ -92,15 +92,6 @@ error(MIT_DES_KEYSIZE does not equal KRB5_MIT_DES_KEYSIZE) * End "mit-des.h" */ -/* cbc_cksum.c */ -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 )); - - /* f_cksum.c */ extern unsigned long mit_des_cbc_cksum PROTOTYPE((krb5_octet FAR *, krb5_octet FAR *, long , mit_des_key_schedule , -- 2.26.2