#include "k5-int.h"
#include "prng.h"
-#ifndef OPENSSL
#include "aes.h"
-#endif
#include "enc_provider.h"
#include "sha2.h"
#include "enc_provider.h"
static void
encrypt_counter(struct fortuna_state *st, unsigned char *dst)
{
- aes_enc_blk(st->counter, dst, &st->ciph);
+ krb5int_aes_enc_blk(st->counter, dst, &st->ciph);
inc_counter(st);
}
STLIBOBJS=\
hmac.o \
- pbkdf2.o
+ pbkdf2.o \
+ stubs.o
OBJS=\
$(OUTPRE)hmac.$(OBJEXT) \
- $(OUTPRE)pbkdf2.$(OBJEXT)
+ $(OUTPRE)pbkdf2.$(OBJEXT) \
+ $(OUTPRE)stubs.$(OBJEXT)
SRCS=\
$(srcdir)/hmac.c \
- $(srcdir)/pbkdf2.c
+ $(srcdir)/pbkdf2.c \
+ $(srcdir)/stubs.c
STOBJLISTS= des/OBJS.ST md4/OBJS.ST \
md5/OBJS.ST sha1/OBJS.ST sha2/OBJS.ST \
-mydir=lib$(S)crypto$(S)nss$(S)sha2
+# Nothing here! But we can't remove this directory as the build
+# system currently assumes that all modules have the same directory
+# structure.
+
+mydir=lib$(S)crypto$(S)nss$(S)aes
BUILDTOP=$(REL)..$(S)..$(S)..$(S)..
+LOCALINCLUDES = -I$(srcdir)/.. -I$(srcdir)/../../krb/dk -I$(srcdir)/../../../../include
DEFS=
-CRYPTO_IMPL_CFLAGS=@CRYPTO_IMPL_CFLAGS@
-LOCALINCLUDES = -I$(srcdir)/.. $(CRYPTO_IMPL_CFLAGS)
PROG_LIBPATH=-L$(TOPLIBD)
PROG_RPATH=$(KRB5_LIBDIR)
-STLIBOBJS= sha2.o
+STLIBOBJS=
+
+OBJS=
-OBJS= $(OUTPRE)sha2.$(OBJEXT)
+SRCS=
-SRCS= $(srcdir)/sha2.c
-all-unix:: all-libobjs
+all-unix:: all-libobjs
includes:: depend
clean-unix:: clean-libobjs
@libobj_frag@
-
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
-
-#include "k5-int.h"
-#include "sha2.h"
-
-void sha2Init(SHA2_INFO *shsInfo)
-{
- return;
-}
-
-void sha2Update(SHA2_INFO *shsInfo, const SHS_BYTE *buffer, unsigned int count)
-{
- return;
-}
-
-void sha2Final(SHA2_INFO *shsInfo)
-{
- return;
-}
+++ /dev/null
-/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
-#ifndef _SHA2_DEFINED
-
-#include "k5-int.h"
-
-#define _SHA2_DEFINED
-
-typedef krb5_octet SHS_BYTE;
-#define SHA2_DIGESTSIZE 32
-
-/* The structure for storing SHA2 info */
-
-typedef struct {
- void *nss_ctxt;
- unsigned char digestBuf[SHA2_DIGESTSIZE]; /* output */
- unsigned int digestLen; /* output */
-} SHA2_INFO;
-
-void sha2Init(SHA2_INFO *shsInfo);
-void sha2Update(SHA2_INFO *shsInfo, const SHS_BYTE *buffer, unsigned int count);
-void sha2Final(SHA2_INFO *shsInfo);
-
-#endif /* _SHA2_DEFINED */
STLIBOBJS=\
hmac.o \
init.o \
- pbkdf2.o
+ pbkdf2.o \
+ stubs.o
OBJS=\
$(OUTPRE)hmac.$(OBJEXT) \
$(OUTPRE)init.$(OBJEXT) \
- $(OUTPRE)pbkdf2.$(OBJEXT)
+ $(OUTPRE)pbkdf2.$(OBJEXT) \
+ $(OUTPRE)stubs.$(OBJEXT)
SRCS=\
$(srcdir)/hmac.c \
$(srcdir)/init.c \
- $(srcdir)/pbkdf2.c
+ $(srcdir)/pbkdf2.c \
+ $(srcdir)/stubs.c
STOBJLISTS= des/OBJS.ST md4/OBJS.ST \
md5/OBJS.ST sha1/OBJS.ST sha2/OBJS.ST \
mydir=lib$(S)crypto$(S)openssl$(S)aes
BUILDTOP=$(REL)..$(S)..$(S)..$(S)..
-LOCALINCLUDES = -I$(srcdir)/.. -I$(srcdir)/../../krb/dk -I$(srcdir)/../../../../include
+LOCALINCLUDES=
DEFS=
-PROG_LIBPATH=-L$(TOPLIBD)
-PROG_RPATH=$(KRB5_LIBDIR)
-
STLIBOBJS=
OBJS=
clean-unix:: clean-libobjs
@libobj_frag@
-
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
-/* lib/crypto/openssl/sha2/sha256.c
- *
- * Copyright (C) 2010 by the Massachusetts Institute of Technology.
- * All rights reserved.
+/* lib/crypto/openssl/aes/aes.h - AES translation macros */
+/*
+ * Copyright 2011 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.
* or implied warranty.
*/
-#include "sha2.h"
+#ifndef _AES_H
+#define _AES_H
+
+/* This header maps some of the names of the built-in AES types and functions
+ * (those used by the Fortuna PRNG) to the OpenSSL equivalents. */
+#include <openssl/aes.h>
+
+#define aes_ctx AES_KEY
+#define krb5int_aes_enc_key(k, len, ctx) AES_set_encrypt_key(k, 8*(len), ctx)
+#define krb5int_aes_enc_blk(in, out, ctx) AES_encrypt(in, out, ctx)
+#endif /* _AES_H */
-mydir=lib$(S)crypto$(S)openssl$(S)sha2
+# Nothing here! But we can't remove this directory as the build
+# system currently assumes that all modules have the same directory
+# structure.
+
+mydir=lib$(S)crypto$(S)openssl$(S)aes
BUILDTOP=$(REL)..$(S)..$(S)..$(S)..
+LOCALINCLUDES=
DEFS=
PROG_LIBPATH=-L$(TOPLIBD)
PROG_RPATH=$(KRB5_LIBDIR)
-STLIBOBJS= sha256.o
+STLIBOBJS=
-OBJS= $(OUTPRE)sha256.$(OBJEXT)
+OBJS=
-SRCS= $(srcdir)/sha256.c
+SRCS=
-all-unix:: all-libobjs
+all-unix:: all-libobjs
includes:: depend
clean-unix:: clean-libobjs
@libobj_frag@
-
#ifndef _SHA2_DEFINED
-#include "k5-int.h"
-#include <openssl/evp.h>
#include <openssl/sha.h>
#define _SHA2_DEFINED
-#define SHA2_DIGESTSIZE 32
-
#define sha2Init SHA256_Init
#define sha2Update SHA256_Update
#define sha2Final SHA256_Final
--- /dev/null
+/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
+/* lib/crypto/openssl/stubs.c - OpenSSL stub functions */
+/*
+ * Copyright (C) 2011 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. Furthermore if you modify this software you must label
+ * your software as modified software and not distribute it in such a
+ * fashion that it might be confused with the original M.I.T. software.
+ * 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.
+ */
+
+/*
+ * This file defines symbols which must be exported by libk5crypto because they
+ * are in the export list (for the sake of test programs), but which are not
+ * used when OpenSSL is the back end.
+ */
+
+#include "k5-int.h"
+
+/*
+ * These functions are used by the Fortuna PRNG and test program. They are
+ * defined to OpenSSL equivalents when the OpenSSL back end headers are
+ * used.
+ */
+void krb5int_aes_enc_blk(void);
+void krb5int_aes_enc_key(void);
+void sha2Final(void);
+void sha2Init(void);
+void sha2Update(void);
+
+void krb5int_aes_enc_blk(void)
+{
+ abort();
+}
+
+void krb5int_aes_enc_key(void)
+{
+ abort();
+}
+
+void sha2Final(void)
+{
+ abort();
+}
+
+void sha2Init(void)
+{
+ abort();
+}
+
+void sha2Update(void)
+{
+ abort();
+}