aboutsummaryrefslogtreecommitdiff
path: root/src/lib/crypto/krb/crypto_libinit.c
blob: b94a01cc0ba4f9327c8c562af6fbbcf9e52a0c32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
#include <assert.h>
#include "k5-int.h"

MAKE_INIT_FUNCTION(cryptoint_initialize_library);
MAKE_FINI_FUNCTION(cryptoint_cleanup_library);

extern int krb5int_prng_init(void);
extern void krb5int_prng_cleanup (void);

/*
 * Initialize the crypto library.
 */

int cryptoint_initialize_library (void)
{
    int err;
    err = krb5int_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;
    krb5int_prng_cleanup();
    krb5int_crypto_impl_cleanup();
}