2001-11-09 Sam Hartman <hartmans@mit.edu>
+ * Makefile.in: New file
+
* yhash.h : Use krb5 shaa1
* yarrow.c (Yarrow_Reseed): For all calls to cipher_init, use TRY
--- /dev/null
+thisconfigdir=./..
+myfulldir=lib/crypto/yarrow
+mydir=yarrow
+BUILDTOP=$(REL)$(U)$(S)$(U)$(S)$(U)
+LOCALINCLUDES = -I$(srcdir)/.. -I$(srcdir)/../sha1 -I$(srcdir)/../enc_provider
+
+##DOS##BUILDTOP = ..\..\..
+##DOS##PREFIXDIR=yarrow
+##DOS##OBJFILE=..\$(OUTPRE)yarrow.lst
+##WIN16##LIBNAME=..\crypto.lib
+
+PROG_LIBPATH=-L$(TOPLIBD)
+PROG_RPATH=$(KRB5_LIBDIR)
+
+RUN_SETUP = @KRB5_RUN_ENV@ KRB5_CONFIG=$(SRCTOP)/config-files/krb5.conf
+
+STLIBOBJS=\
+ yarrow.o \
+ ycipher.o
+OBJS=\
+ $(OUTPRE)yarrow.$(OBJEXT) \
+ $(OUTP)ycipher.$(OBJEXT)
+
+SRCS=\
+ $(srcdir)/yarrow.c \
+ $(srcdir)/ycipher.c
+
+##DOS##LIBOBJS = $(OBJS)
+
+all-unix:: all-libobjs
+
+includes:: depend
+
+depend:: $(SRCS)
+
+clean-unix:: clean-libobjs
* See the accompanying LICENSE file for more information.
*/
+#include "k5-int.h"
+
#include <string.h>
#include <limits.h>
#if !defined(WIN32)
mem_zero(y->K, sizeof(y->K));
- TRY (Krb5int_Yarrow_Cipher_Init(&y->cipher, y->K));
+ TRY (krb5int_yarrow_cipher_init(&y->cipher, y->K));
y->out_left = 0;
y->out_count = 0;
y->gate_count = 0;
/* R <- E_k(C) */
- TRY ( krb5int_yarrow_cipher_encrypt_block ( &y->cipher, y->C, out ))
+ TRY ( krb5int_yarrow_cipher_encrypt_block ( &y->cipher, y->C, out ));
#if defined(YARROW_DEBUG)
printf("===\n");
/* need to resetup the key schedule as the key has changed */
- TRY (Krb5int_Yarrow_Cipher_Init(&y->cipher, y->K));
+ TRY (krb5int_yarrow_cipher_init(&y->cipher, y->K));
CATCH:
TRACE( printf( "]," ); );
/* feed hash of slow pool into the fast pool */
+
HASH_Final(slow_pool, digest);
/* Each pool contains the running hash of all inputs fed into it
/* step 1. v_0 <- hash of all inputs into fast pool */
- HASH_Final(fast_pool, v_0);
+ HASH_Final(fast_pool, &v_0);
HASH_Init(fast_pool); /* reinitialize fast pool */
/* v_i <- v_0 */
HASH_Update(&hash, &big_endian_int32, sizeof(krb5_ui_4));
big_endian_int32 = make_big_endian32(i & 0xFFFFFFFF); /* LS word */
HASH_Update(&hash, &big_endian_int32, sizeof(krb5_ui_4));
- HASH_Final(&hash, v_i);
+ HASH_Final(&hash, &v_i);
}
/* step3. K = h'(h(v_Pt|K)) */
/* need to resetup the key schedule as the key has changed */
- TRY(Krb5int_Yarrow_Cipher_Init(&y->cipher, y->K));
+ TRY(krb5int_yarrow_cipher_init(&y->cipher, y->K));
#if defined(YARROW_DEBUG)
hex_print(stdout, "new K", y->K, sizeof(y->K));
#if defined(YARROW_DEBUG)
hex_print(stdout, "old C", y->C, sizeof(y->C));
#endif
- TRY (krb5int_yarrow_cipher_encrypt_block (&y->cipher, zero_block, y->C))
+ TRY (krb5int_yarrow_cipher_encrypt_block (&y->cipher, zero_block, y->C));
#if defined(YARROW_DEBUG)
hex_print(stdout, "new C", y->C, sizeof(y->C));
#endif
#define YARROW_DETECT_FORK
#include <unistd.h>
#endif
+#define YARROW_NO_MATHLIB
#include "ytypes.h"
#include "yhash.h"
int krb5int_yarrow_cipher_init
(CIPHER_CTX *ctx,
- const char * key)
+ unsigned const char * key)
{
size_t keybytes, keylength;
const struct krb5_enc_provider *enc = &yarrow_enc_provider;
}
int krb5int_yarrow_cipher_encrypt_block
-(CIPHER_CTX *ctx, const char *in,
- char *out)
+(CIPHER_CTX *ctx, const unsigned char *in,
+ unsigned char *out)
{
krb5_error_code ret;
- krb5_data ind;
- krb5_enc_data outd;
+ krb5_data ind, outd;
const struct krb5_enc_provider *enc = &yarrow_enc_provider;
ind.data = (char *) in;
ind.length = CIPHER_BLOCK_SIZE;
outd.data = out;
outd.length = CIPHER_BLOCK_SIZE;
- ret = enc->encrypt (ctx->key, 0, ind, outd);
+ ret = enc->encrypt (&ctx->key, 0, &ind, &outd);
if (ret)
return YARROW_FAIL;
return YARROW_OK;
#endif
-int krb5int_yarrow_cipher_init (CIPHER_CTX *ctx, const char *key);
+int krb5int_yarrow_cipher_init (CIPHER_CTX *ctx, unsigned const char *key);
int krb5int_yarrow_cipher_encrypt_block
-(CIPHER_CTX *ctx, const char *in, char *out);
+(CIPHER_CTX *ctx, const unsigned char *in, unsigned char *out);
#if !defined( YARROW_NO_MATHLIB )
#define POW_CIPHER_KEY_SIZE pow(2.0, CIPHER_KEY_SIZE * 8 / 3.0)
#define HASH_CTX SHS_INFO
-#define HASH_Init(x) shsinit(x)
-#define HASH_Update(x, buf, sz) shsupdate(x, (void*)buf, sz)
-#define HASH_Final(x, digest) do { \
- shsfinal(x); \
- memcpy(digest, (void *) x.digest, SHS_DIGESTSIZE); \
- } while(0;)
+#define HASH_Init(x) shsInit(x)
+#define HASH_Update(x, buf, sz) shsUpdate(x, (const void*)buf, sz)
+#define HASH_Final(x, tdigest) do { \
+ shsFinal(x); \
+ memcpy((tdigest), (void *) (x)->digest, SHS_DIGESTSIZE); \
+ } while(0)
#define HASH_DIGEST_SIZE SHS_DIGESTSIZE
*/
-int LOCK( void ) { return (YARROW_OK); }
-int UNLOCK( void ) { return (YARROW_OK); }
+static int LOCK( void ) { return (YARROW_OK); }
+static int UNLOCK( void ) { return (YARROW_OK); }
#endif /* YLOCK_H */