+Fri Jan 21 22:47:00 2000 Miro Jurisic <meeroh@mit.edu>
+
+ * Makefile.in: added crypto_libinit.[co]
+ * crypto_libinit.[ch]: new files, contain library initialization
+ and cleanup code
+
2000-01-21 Ken Raeburn <raeburn@mit.edu>
* cksumtypes.c (krb5_cksumtypes_list, krb5_cksumtypes_length): Now
cksumtype_to_string.o \
cksumtypes.o \
coll_proof_cksum.o \
+ crypto_libinit.o \
decrypt.o \
encrypt.o \
encrypt_length.o \
$(OUTPRE)cksumtype_to_string.$(OBJEXT) \
$(OUTPRE)cksumtypes.$(OBJEXT) \
$(OUTPRE)coll_proof_cksum.$(OBJEXT) \
+ $(OUTPRE)crypto_libinit.$(OBJEXT) \
$(OUTPRE)decrypt.$(OBJEXT) \
$(OUTPRE)encrypt.$(OBJEXT) \
$(OUTPRE)encrypt_length.$(OBJEXT) \
$(subdir)/cksumtype_to_string.c \
$(subdir)/cksumtypes.c \
$(subdir)/coll_proof_cksum.c \
+ $(subdir)/crypto_libinit.c \
$(subdir)/decrypt.c \
$(subdir)/encrypt.c \
$(subdir)/encrypt_length.c \
--- /dev/null
+#include <assert.h>
+
+static int initialized = false;
+
+/*
+ * Initialize the crypto library.
+ */
+
+int cryptoint_initialize_library (void)
+{
+
+ if (!initialized) {
+ initialized = true;
+ }
+
+ return 0;
+}
+
+/*
+ * Clean up the crypto library state
+ */
+
+void cryptoint_cleanup_library (void)
+{
+ assert (initialized);
+
+ prng_cleanup ();
+
+ initialized = false;
+}
\ No newline at end of file
--- /dev/null
+#ifndef KRB5_LIBINIT_H
+#define KRB5_LIBINIT_H
+
+int cryptoint_initialize_library (void);
+void cryptoint_cleanup_library (void);
+
+#endif /* KRB5_LIBINIT_H */
return(0);
}
+
+void prng_cleanup (void)
+{
+ free (random_state);
+ inited = 0;
+}
\ No newline at end of file
+Fri Jan 21 22:47:00 2000 Miro Jurisic <meeroh@mit.edu>
+
+ * Makefile.in: added gss_libinit.[co]
+ * gss_libinit.[ch]: new files, contain library initialization
+ and cleanup code
+
Tue May 18 19:52:56 1999 Danilo Almeida <dalmeida@mit.edu>
* Makefile.in: Remove - from recursive Win32 make invocation.
MAC_SUBDIRS = generic krb5
+OBJS=\
+ $(OUTPRE)gss_libinit.$(OBJEXT)
+
+SRCS=\
+ $(subdir)/gss_libinit.c
+
LIB=gssapi_krb5
LIBMAJOR=2
LIBMINOR=1
--- /dev/null
+#include <assert.h>
+
+#include "gssapi_err_generic.h"
+#include "gssapi_err_krb5.h"
+
+#include "gss_libinit.h"
+
+static int initialized = false;
+
+/*
+ * Initialize the GSSAPI library.
+ */
+
+OM_uint32 gssint_initialize_library (void)
+{
+
+ if (!initialized) {
+ add_error_table(&et_k5g_error_table);
+ add_error_table(&et_ggss_error_table);
+
+ initialized = true;
+ }
+
+ return 0;
+}
+
+/*
+ * Clean up the Kerberos v5 lirbary state
+ */
+
+void gssint_cleanup_library (void)
+{
+ OM_uint32 maj_stat, min_stat;
+
+ assert (initialized);
+
+ maj_stat = kg_release_defcred (&min_stat);
+
+ remove_error_table(&et_k5g_error_table);
+ remove_error_table(&et_ggss_error_table);
+
+ initialized = false;
+}
\ No newline at end of file
--- /dev/null
+#ifndef KRB5_LIBINIT_H
+#define KRB5_LIBINIT_H
+
+#include "gssapi.h"
+
+OM_uint32 gssint_initialize_library (void);
+void gssint_cleanup_library (void);
+
+#endif /* KRB5_LIBINIT_H */
+Fri Jan 21 22:47:00 2000 Miro Jurisic <meeroh@mit.edu>
+
+ * Makefile.in: added krb5_libinit.[co]
+ * krb5_libinit.[ch]: new files, contain library initialization
+ and cleanup code
+
1999-12-01 Ken Raeburn <raeburn@mit.edu>
* Makefile.in (LIBMINOR): Update to 2.
posix/OBJS.ST \
$(BUILDTOP)/util/profile/OBJS.ST
+OBJS=\
+ $(OUTPRE)krb5_libinit.$(OBJEXT)
+
+SRCS=\
+ $(subdir)/krb5_libinit.c
+
RELDIR=krb5
SHLIB_EXPDEPS = \
$(TOPLIBD)/libk5crypto$(SHLIBEXT) \
--- /dev/null
+#include <assert.h>
+
+#include "krb5.h"
+#include "krb5_err.h"
+#include "kv5m_err.h"
+#include "asn1_err.h"
+#include "kdb5_err.h"
+
+static int initialized = false;
+
+/*
+ * Initialize the Kerberos v5 library.
+ */
+
+krb5_error_code krb5int_initialize_library (void)
+{
+
+ if (!initialized) {
+ add_error_table(&et_krb5_error_table);
+ add_error_table(&et_kv5m_error_table);
+ add_error_table(&et_kdb5_error_table);
+ add_error_table(&et_asn1_error_table);
+
+ initialized = true;
+ }
+
+ return 0;
+}
+
+/*
+ * Clean up the Kerberos v5 lirbary state
+ */
+
+void krb5int_cleanup_library (void)
+{
+ assert (initialized);
+
+ krb5_stdcc_shutdown();
+
+ remove_error_table(&et_krb5_error_table);
+ remove_error_table(&et_kv5m_error_table);
+ remove_error_table(&et_kdb5_error_table);
+ remove_error_table(&et_asn1_error_table);
+
+ initialized = false;
+}
\ No newline at end of file
--- /dev/null
+#ifndef KRB5_LIBINIT_H
+#define KRB5_LIBINIT_H
+
+#include "krb5.h"
+
+krb5_error_code krb5int_initialize_library (void);
+void krb5int_cleanup_library (void);
+
+#endif /* KRB5_LIBINIT_H */
#include <CodeFragments.h>
-#include "gssapi_err_generic.h"
-#include "gssapi_err_krb5.h"
-
-#include "gssapi.h"
+#include "gss_libinit.h"
OSErr __initializeGSS(CFragInitBlockPtr ibp);
void __terminateGSS(void);
/* Initialize the error tables */
if (err == noErr) {
- add_error_table(&et_k5g_error_table);
- add_error_table(&et_ggss_error_table);
+ err = gssint_initialize_library ();
}
return err;
void __terminateGSS(void)
{
-
- OM_uint32 maj_stat, min_stat;
-
- maj_stat = kg_release_defcred (&min_stat);
-
- remove_error_table(&et_k5g_error_table);
- remove_error_table(&et_ggss_error_table);
+ gssint_cleanup_library ();
__terminate();
}
#include <CodeFragments.h>
-#include "krb5_err.h"
-#include "kv5m_err.h"
-#include "asn1_err.h"
-#include "kdb5_err.h"
-#include "profile.h"
-#include "adm_err.h"
+#include "krb5_libinit.h"
+#include "crypto_libinit.h"
OSErr __initializeK5(CFragInitBlockPtr ibp);
{
OSErr err = noErr;
- /* Do normal init of the shared library */
err = __initialize();
- /* Initialize the error tables */
if (err == noErr) {
- add_error_table(&et_krb5_error_table);
- add_error_table(&et_kv5m_error_table);
- add_error_table(&et_kdb5_error_table);
- add_error_table(&et_asn1_error_table);
-// add_error_table(&et_prof_error_table);
- add_error_table(&et_kadm_error_table);
+ err = krb5int_initialize_library ();
+ }
+
+ if (err == noErr) {
+ err = cryptoint_initialize_library ();
}
return err;
void __terminateK5(void)
{
- krb5_stdcc_shutdown();
-
- remove_error_table(&et_krb5_error_table);
- remove_error_table(&et_kv5m_error_table);
- remove_error_table(&et_kdb5_error_table);
- remove_error_table(&et_asn1_error_table);
-// remove_error_table(&et_prof_error_table);
- remove_error_table(&et_kadm_error_table);
+ cryptoint_cleanup_library ();
+ krb5int_cleanup_library ();
__terminate();
}