Asterisk - The Open Source Telephony Project GIT-master-f36a736
|
Unit Tests for crypto API. More...
#include "asterisk.h"
#include "asterisk/utils.h"
#include "asterisk/test.h"
#include "asterisk/crypto.h"
#include "asterisk/paths.h"
#include "asterisk/module.h"
#include "asterisk/file.h"
#include <assert.h>
#include <sys/stat.h>
#include <limits.h>
#include <openssl/evp.h>
Go to the source code of this file.
Functions | |
static void | __reg_module (void) |
static void | __unreg_module (void) |
struct ast_module * | AST_MODULE_SELF_SYM (void) |
AST_TEST_DEFINE (crypto_aes_decrypt) | |
AST_TEST_DEFINE (crypto_aes_encrypt) | |
AST_TEST_DEFINE (crypto_rsa_decrypt) | |
AST_TEST_DEFINE (crypto_rsa_encrypt) | |
AST_TEST_DEFINE (crypto_sign) | |
AST_TEST_DEFINE (crypto_verify) | |
static char * | hexstring (const unsigned char *data, unsigned datalen) |
static int | load_module (void) |
static void | pop_key_dir (void) |
static void | push_key_dir (const char *dir) |
static int | unload_module (void) |
Variables | |
static struct ast_module_info | __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_DEFAULT , .description = "Crypto test module" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = AST_BUILDOPT_SUM, .support_level = AST_MODULE_SUPPORT_CORE, .load = load_module, .unload = unload_module, .requires = "res_crypto", } |
static const struct ast_module_info * | ast_module_info = &__mod_info |
static const char * | keypair1 = "rsa_key1" |
static const char * | old_key_dir = NULL |
Unit Tests for crypto API.
Definition in file test_crypto.c.
|
static |
Definition at line 689 of file test_crypto.c.
|
static |
Definition at line 689 of file test_crypto.c.
struct ast_module * AST_MODULE_SELF_SYM | ( | void | ) |
Definition at line 689 of file test_crypto.c.
AST_TEST_DEFINE | ( | crypto_aes_decrypt | ) |
Definition at line 581 of file test_crypto.c.
References args, ast_aes_decrypt(), ast_aes_set_decrypt_key(), ast_check_command_in_path(), ast_free, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, buf, cleanup(), ast_test_capture::errbuf, ast_test_capture::errlen, ast_test_capture::exitcode, hexstring(), sip_to_pjsip::info(), KEY, NULL, ast_test_capture::outbuf, ast_test_capture::outlen, ast_test_capture::pid, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | crypto_aes_encrypt | ) |
Definition at line 505 of file test_crypto.c.
References args, ast_aes_encrypt(), ast_aes_set_encrypt_key(), ast_check_command_in_path(), ast_free, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, buf, cleanup(), ast_test_capture::errbuf, ast_test_capture::errlen, ast_test_capture::exitcode, hexstring(), sip_to_pjsip::info(), KEY, NULL, ast_test_capture::outbuf, ast_test_capture::outlen, ast_test_capture::pid, TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | crypto_rsa_decrypt | ) |
Definition at line 179 of file test_crypto.c.
References args, ast_check_command_in_path(), ast_crypto_reload(), AST_CRYPTO_RSA_KEY_BITS, ast_decrypt_bin(), ast_key_get(), AST_KEY_PRIVATE, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, buf, cleanup(), ast_test_capture::errbuf, ast_test_capture::errlen, ast_test_capture::exitcode, sip_to_pjsip::info(), keypair1, len(), NULL, ast_test_capture::outbuf, ast_test_capture::outlen, PATH_MAX, ast_test_capture::pid, pop_key_dir(), push_key_dir(), TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | crypto_rsa_encrypt | ) |
Definition at line 84 of file test_crypto.c.
References args, ast_check_command_in_path(), ast_crypto_reload(), AST_CRYPTO_RSA_KEY_BITS, ast_encrypt_bin(), ast_key_get(), AST_KEY_PUBLIC, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, buf, cleanup(), ast_test_capture::errbuf, ast_test_capture::errlen, ast_test_capture::exitcode, sip_to_pjsip::info(), keypair1, NULL, ast_test_capture::outbuf, ast_test_capture::outlen, PATH_MAX, ast_test_capture::pid, pop_key_dir(), push_key_dir(), TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | crypto_sign | ) |
Definition at line 277 of file test_crypto.c.
References args, ast_check_command_in_path(), ast_crypto_reload(), AST_CRYPTO_RSA_KEY_BITS, ast_file_mkftemp(), ast_key_get(), AST_KEY_PRIVATE, ast_sign_bin(), AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, buf, cleanup(), ast_test_capture::errbuf, ast_test_capture::errlen, ast_test_capture::exitcode, sip_to_pjsip::info(), keypair1, NULL, ast_test_capture::outbuf, ast_test_capture::outlen, PATH_MAX, ast_test_capture::pid, pop_key_dir(), push_key_dir(), TEST_EXECUTE, and TEST_INIT.
AST_TEST_DEFINE | ( | crypto_verify | ) |
Definition at line 400 of file test_crypto.c.
References args, ast_check_command_in_path(), ast_check_signature_bin(), ast_crypto_reload(), AST_CRYPTO_RSA_KEY_BITS, ast_key_get(), AST_KEY_PUBLIC, AST_TEST_FAIL, AST_TEST_NOT_RUN, AST_TEST_PASS, ast_test_status_update, cleanup(), ast_test_capture::errbuf, ast_test_capture::errlen, ast_test_capture::exitcode, sip_to_pjsip::info(), keypair1, NULL, ast_test_capture::outbuf, ast_test_capture::outlen, PATH_MAX, ast_test_capture::pid, pop_key_dir(), push_key_dir(), TEST_EXECUTE, and TEST_INIT.
|
static |
Definition at line 51 of file test_crypto.c.
References ast_malloc, and buf.
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 673 of file test_crypto.c.
References AST_MODULE_LOAD_SUCCESS, and AST_TEST_REGISTER.
|
static |
Definition at line 73 of file test_crypto.c.
References ast_config_AST_KEY_DIR, ast_free, NULL, and old_key_dir.
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 64 of file test_crypto.c.
References ast_config_AST_KEY_DIR, ast_strdup, NULL, and old_key_dir.
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 662 of file test_crypto.c.
References AST_TEST_UNREGISTER.
|
static |
Definition at line 689 of file test_crypto.c.
|
static |
Definition at line 689 of file test_crypto.c.
|
static |
Definition at line 47 of file test_crypto.c.
Referenced by AST_TEST_DEFINE().
|
static |
Definition at line 49 of file test_crypto.c.
Referenced by pop_key_dir(), and push_key_dir().