5 Author: Pekka Riikonen <priikone@silcnet.org>
7 Copyright (C) 2007 - 2008 Pekka Riikonen
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; version 2 of the License.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
20 #include "silccrypto.h"
23 SilcStack crypto_stack = NULL; /* Crypto Toolkit's global stack */
24 #endif /* SILC_SYMBIAN */
28 SilcBool silc_crypto_init(SilcStack stack)
30 SILC_LOG_DEBUG(("Initializing crypto"));
33 /* Stack allocation is allowed to fail */
34 crypto_stack = silc_stack_alloc(0, stack);
35 #endif /* SILC_SYMBIAN */
37 /* Init crypto library */
38 if (!silc_cipher_register_default()) {
39 SILC_LOG_ERROR(("Error registering ciphers"));
42 if (!silc_hash_register_default()) {
43 SILC_LOG_ERROR(("Error registering hash functions"));
46 if (!silc_mac_register_default()) {
47 SILC_LOG_ERROR(("Error registering hash HMACs"));
50 if (!silc_pkcs_register_default()) {
51 SILC_LOG_ERROR(("Error registering hash PKCSs"));
56 /* Initialize accelerator library */
57 #endif /* SILC_DIST_ACC */
68 void silc_crypto_uninit(void)
70 SILC_LOG_DEBUG(("Uninitializing crypto"));
73 /* Uninit accelerator library */
74 #endif /* SILC_DIST_ACC */
76 /* Uninit crypto library */
77 silc_pkcs_unregister_all();
78 silc_mac_unregister_all();
79 silc_hash_unregister_all();
80 silc_cipher_unregister_all();
83 silc_stack_free(crypto_stack);
84 #endif /* SILC_SYMBIAN */
89 SilcStack silc_crypto_stack(void)
95 #endif /* SILC_SYMBIAN */