diff options
| author | Cy Schubert <cy@FreeBSD.org> | 2017-07-07 17:03:42 +0000 | 
|---|---|---|
| committer | Cy Schubert <cy@FreeBSD.org> | 2017-07-07 17:03:42 +0000 | 
| commit | 33a9b234e7087f573ef08cd7318c6497ba08b439 (patch) | |
| tree | d0ea40ad3bf5463a3c55795977c71bcb7d781b4b /src/lib/crypto/krb/crypto_libinit.c | |
Diffstat (limited to 'src/lib/crypto/krb/crypto_libinit.c')
| -rw-r--r-- | src/lib/crypto/krb/crypto_libinit.c | 35 | 
1 files changed, 35 insertions, 0 deletions
| diff --git a/src/lib/crypto/krb/crypto_libinit.c b/src/lib/crypto/krb/crypto_libinit.c new file mode 100644 index 000000000000..3b62ff5de0eb --- /dev/null +++ b/src/lib/crypto/krb/crypto_libinit.c @@ -0,0 +1,35 @@ +/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ +#include "crypto_int.h" + +MAKE_INIT_FUNCTION(cryptoint_initialize_library); +MAKE_FINI_FUNCTION(cryptoint_cleanup_library); + +/* + * Initialize the crypto library. + */ + +int cryptoint_initialize_library (void) +{ +    int err; +    err = k5_prng_init(); +    if (err) +        return err; +    return krb5int_crypto_impl_init(); +} + +int krb5int_crypto_init(void) +{ +    return CALL_INIT_FUNCTION(cryptoint_initialize_library); +} + +/* + * Clean up the crypto library state + */ + +void cryptoint_cleanup_library (void) +{ +    if (!INITIALIZER_RAN(cryptoint_initialize_library)) +        return; +    k5_prng_cleanup(); +    krb5int_crypto_impl_cleanup(); +} | 
