Commit 02d6f032 authored by jfigus's avatar jfigus

Rename error functions to comply with library name.

parent 92736bcd
......@@ -1368,7 +1368,7 @@ static uint32_t U4[256] = {
/* aes internals */
extern debug_module_t srtp_mod_aes_icm;
extern srtp_debug_module_t srtp_mod_aes_icm;
static void
aes_128_expand_encryption_key (const uint8_t *key,
......
......@@ -55,7 +55,7 @@
#include "crypto_types.h"
debug_module_t srtp_mod_aes_gcm = {
srtp_debug_module_t srtp_mod_aes_gcm = {
0, /* debugging is off by default */
"aes gcm" /* printable module name */
};
......@@ -525,7 +525,7 @@ srtp_cipher_type_t srtp_aes_gcm_128_openssl = {
(cipher_get_tag_func_t)srtp_aes_gcm_openssl_get_tag,
(char*)srtp_aes_gcm_128_openssl_description,
(srtp_cipher_test_case_t*)&srtp_aes_gcm_test_case_0,
(debug_module_t*)&srtp_mod_aes_gcm,
(srtp_debug_module_t*)&srtp_mod_aes_gcm,
(srtp_cipher_type_id_t)SRTP_AES_128_GCM
};
......@@ -543,7 +543,7 @@ srtp_cipher_type_t srtp_aes_gcm_256_openssl = {
(cipher_get_tag_func_t)srtp_aes_gcm_openssl_get_tag,
(char*)srtp_aes_gcm_256_openssl_description,
(srtp_cipher_test_case_t*)&srtp_aes_gcm_test_case_1,
(debug_module_t*)&srtp_mod_aes_gcm,
(srtp_debug_module_t*)&srtp_mod_aes_gcm,
(srtp_cipher_type_id_t)SRTP_AES_256_GCM
};
......@@ -53,7 +53,7 @@
#include "alloc.h"
debug_module_t srtp_mod_aes_icm = {
srtp_debug_module_t srtp_mod_aes_icm = {
0, /* debugging is off by default */
"aes icm" /* printable module name */
};
......@@ -509,7 +509,7 @@ srtp_cipher_type_t srtp_aes_icm = {
(cipher_get_tag_func_t)0,
(char*)srtp_aes_icm_description,
(srtp_cipher_test_case_t*)&srtp_aes_icm_test_case_1,
(debug_module_t*)&srtp_mod_aes_icm,
(srtp_debug_module_t*)&srtp_mod_aes_icm,
(srtp_cipher_type_id_t)SRTP_AES_ICM
};
......@@ -59,7 +59,7 @@
#include "crypto_types.h"
debug_module_t srtp_mod_aes_icm = {
srtp_debug_module_t srtp_mod_aes_icm = {
0, /* debugging is off by default */
"aes icm ossl" /* printable module name */
};
......@@ -472,7 +472,7 @@ srtp_cipher_type_t srtp_aes_icm = {
(cipher_get_tag_func_t) 0,
(char*) srtp_aes_icm_openssl_description,
(srtp_cipher_test_case_t*) &srtp_aes_icm_test_case_0,
(debug_module_t*) &srtp_mod_aes_icm,
(srtp_debug_module_t*) &srtp_mod_aes_icm,
(srtp_cipher_type_id_t) SRTP_AES_ICM
};
......@@ -491,7 +491,7 @@ srtp_cipher_type_t srtp_aes_icm_192 = {
(cipher_get_tag_func_t) 0,
(char*) srtp_aes_icm_192_openssl_description,
(srtp_cipher_test_case_t*) &srtp_aes_icm_192_test_case_1,
(debug_module_t*) &srtp_mod_aes_icm,
(srtp_debug_module_t*) &srtp_mod_aes_icm,
(srtp_cipher_type_id_t) SRTP_AES_192_ICM
};
......@@ -510,7 +510,7 @@ srtp_cipher_type_t srtp_aes_icm_256 = {
(cipher_get_tag_func_t) 0,
(char*) srtp_aes_icm_256_openssl_description,
(srtp_cipher_test_case_t*) &srtp_aes_icm_256_test_case_2,
(debug_module_t*) &srtp_mod_aes_icm,
(srtp_debug_module_t*) &srtp_mod_aes_icm,
(srtp_cipher_type_id_t) SRTP_AES_256_ICM
};
......@@ -53,7 +53,7 @@
#include "rand_source.h" /* used in invertibiltiy tests */
#include "alloc.h" /* for crypto_alloc(), crypto_free() */
debug_module_t srtp_mod_cipher = {
srtp_debug_module_t srtp_mod_cipher = {
0, /* debugging is off by default */
"cipher" /* printable module name */
};
......
......@@ -54,7 +54,7 @@
/* the null_cipher uses the cipher debug module */
extern debug_module_t srtp_mod_cipher;
extern srtp_debug_module_t srtp_mod_cipher;
static srtp_err_status_t srtp_null_cipher_alloc (srtp_cipher_t **c, int key_len, int tlen)
{
......@@ -149,7 +149,7 @@ srtp_cipher_type_t srtp_null_cipher = {
(cipher_get_tag_func_t)0,
(char*)srtp_null_cipher_description,
(srtp_cipher_test_case_t*)&srtp_null_cipher_test_0,
(debug_module_t*)NULL,
(srtp_debug_module_t*)NULL,
(srtp_cipher_type_id_t)SRTP_NULL_CIPHER
};
......@@ -51,7 +51,7 @@
/* the debug module for authentiation */
debug_module_t srtp_mod_auth = {
srtp_debug_module_t srtp_mod_auth = {
0, /* debugging is off by default */
"auth func" /* printable name for module */
};
......
......@@ -51,7 +51,7 @@
/* the debug module for authentiation */
debug_module_t srtp_mod_hmac = {
srtp_debug_module_t srtp_mod_hmac = {
0, /* debugging is off by default */
"hmac sha-1" /* printable name for module */
};
......@@ -258,7 +258,7 @@ srtp_auth_type_t srtp_hmac = {
(auth_start_func)srtp_hmac_start,
(char*)srtp_hmac_description,
(srtp_auth_test_case_t*)&srtp_hmac_test_case_0,
(debug_module_t*)&srtp_mod_hmac,
(srtp_debug_module_t*)&srtp_mod_hmac,
(srtp_auth_type_id_t)SRTP_HMAC_SHA1
};
......@@ -54,7 +54,7 @@
/* the debug module for authentiation */
debug_module_t srtp_mod_hmac = {
srtp_debug_module_t srtp_mod_hmac = {
0, /* debugging is off by default */
"hmac sha-1 openssl" /* printable name for module */
};
......@@ -277,7 +277,7 @@ srtp_auth_type_t srtp_hmac = {
(auth_start_func) srtp_hmac_start,
(char*) srtp_hmac_description,
(srtp_auth_test_case_t*) &srtp_hmac_test_case_0,
(debug_module_t*) &srtp_mod_hmac,
(srtp_debug_module_t*) &srtp_mod_hmac,
(srtp_auth_type_id_t) SRTP_HMAC_SHA1
};
......@@ -53,7 +53,7 @@
/* null_auth uses the auth debug module */
extern debug_module_t srtp_mod_auth;
extern srtp_debug_module_t srtp_mod_auth;
static srtp_err_status_t srtp_null_auth_alloc (srtp_auth_t **a, int key_len, int out_len)
{
......@@ -151,7 +151,7 @@ srtp_auth_type_t srtp_null_auth = {
(auth_start_func)srtp_null_auth_start,
(char*)srtp_null_auth_description,
(srtp_auth_test_case_t*)&srtp_null_auth_test_case_0,
(debug_module_t*)NULL,
(srtp_debug_module_t*)NULL,
(srtp_auth_type_id_t)SRTP_NULL_AUTH
};
......@@ -50,7 +50,7 @@
#include "sha1.h"
debug_module_t srtp_mod_sha1 = {
srtp_debug_module_t srtp_mod_sha1 = {
0, /* debugging is off by default */
"sha-1" /* printable module name */
};
......
......@@ -122,7 +122,7 @@ typedef struct srtp_auth_type_t {
auth_start_func start;
char *description;
srtp_auth_test_case_t *test_data;
debug_module_t *debug;
srtp_debug_module_t *debug;
srtp_auth_type_id_t id;
} srtp_auth_type_t;
......
......@@ -153,7 +153,7 @@ typedef struct srtp_cipher_type_t {
cipher_get_tag_func_t get_tag;
char *description;
srtp_cipher_test_case_t *test_data;
debug_module_t *debug;
srtp_debug_module_t *debug;
srtp_cipher_type_id_t id;
} srtp_cipher_type_t;
......
......@@ -87,7 +87,7 @@ typedef struct srtp_kernel_auth_type {
* linked list of debug modules
*/
typedef struct srtp_kernel_debug_module {
debug_module_t *mod;
srtp_debug_module_t *mod;
struct srtp_kernel_debug_module *next;
} srtp_kernel_debug_module_t;
......@@ -183,7 +183,7 @@ srtp_err_status_t srtp_crypto_kernel_replace_cipher_type(srtp_cipher_type_t *ct,
srtp_err_status_t srtp_crypto_kernel_replace_auth_type(srtp_auth_type_t *ct, srtp_auth_type_id_t id);
srtp_err_status_t srtp_crypto_kernel_load_debug_module(debug_module_t *new_dm);
srtp_err_status_t srtp_crypto_kernel_load_debug_module(srtp_debug_module_t *new_dm);
/*
* srtp_crypto_kernel_alloc_cipher(id, cp, key_len);
......
/*
* err.h
*
*
* error status codes
*
* David A. McGrew
* Cisco Systems, Inc.
*/
/*
*
*
* Copyright (c) 2001-2006, Cisco Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
*
* Neither the name of the Cisco Systems, Inc. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
......@@ -52,9 +52,9 @@
/**
* @defgroup Error Error Codes
*
*
* Error status codes are represented by the enumeration srtp_err_status_t.
*
*
* @{
*/
......@@ -64,16 +64,16 @@
*/
typedef enum {
err_level_emergency = 0,
err_level_alert,
err_level_critical,
err_level_error,
err_level_warning,
err_level_notice,
err_level_info,
err_level_debug,
err_level_none
} err_reporting_level_t;
srtp_err_level_emergency = 0,
srtp_err_level_alert,
srtp_err_level_critical,
srtp_err_level_error,
srtp_err_level_warning,
srtp_err_level_notice,
srtp_err_level_info,
srtp_err_level_debug,
srtp_err_level_none
} srtp_err_reporting_level_t;
/*
* err_reporting_init prepares the error system. If
......@@ -83,7 +83,7 @@ typedef enum {
* all syslog messages. It is conventionally argv[0].
*/
srtp_err_status_t err_reporting_init(const char *ident);
srtp_err_status_t srtp_err_reporting_init(const char *ident);
/*
* keydaemon_report_error reports a 'printf' formatted error
......@@ -96,7 +96,7 @@ srtp_err_status_t err_reporting_init(const char *ident);
*/
void
err_report(int priority, const char *format, ...);
srtp_err_report(int priority, const char *format, ...);
/*
......@@ -104,9 +104,9 @@ err_report(int priority, const char *format, ...);
*/
typedef struct {
int on; /* 1 if debugging is on, 0 if it is off */
const char *name; /* printable name for debug module */
} debug_module_t;
int on; /* 1 if debugging is on, 0 if it is off */
const char *name; /* printable name for debug module */
} srtp_debug_module_t;
#ifdef ENABLE_DEBUGGING
......@@ -116,9 +116,9 @@ typedef struct {
/* use err_report() to report debug message */
#define debug_print(mod, format, arg) \
if (mod.on) err_report(err_level_debug, ("%s: " format "\n"), mod.name, arg)
#define debug_print2(mod, format, arg1,arg2) \
if (mod.on) err_report(err_level_debug, ("%s: " format "\n"), mod.name, arg1,arg2)
if (mod.on) srtp_err_report(srtp_err_level_debug, ("%s: " format "\n"), mod.name, arg)
#define debug_print2(mod, format, arg1, arg2) \
if (mod.on) srtp_err_report(srtp_err_level_debug, ("%s: " format "\n"), mod.name, arg1, arg2)
#else
......
......@@ -51,7 +51,7 @@
/* the debug module for memory allocation */
debug_module_t mod_alloc = {
srtp_debug_module_t mod_alloc = {
0, /* debugging is off by default */
"alloc" /* printable name for module */
};
......
......@@ -53,7 +53,7 @@
/* the debug module for the crypto_kernel */
debug_module_t srtp_mod_crypto_kernel = {
srtp_debug_module_t srtp_mod_crypto_kernel = {
0, /* debugging is off by default */
"crypto kernel" /* printable name for module */
};
......@@ -62,10 +62,10 @@ debug_module_t srtp_mod_crypto_kernel = {
* other debug modules that can be included in the kernel
*/
extern debug_module_t srtp_mod_auth;
extern debug_module_t srtp_mod_cipher;
extern debug_module_t mod_stat;
extern debug_module_t mod_alloc;
extern srtp_debug_module_t srtp_mod_auth;
extern srtp_debug_module_t srtp_mod_cipher;
extern srtp_debug_module_t mod_stat;
extern srtp_debug_module_t mod_alloc;
/*
* cipher types that can be included in the kernel
......@@ -112,7 +112,7 @@ srtp_err_status_t srtp_crypto_kernel_init ()
}
/* initialize error reporting system */
status = err_reporting_init("crypto");
status = srtp_err_reporting_init("crypto");
if (status) {
return status;
}
......@@ -542,7 +542,7 @@ srtp_err_status_t srtp_crypto_kernel_alloc_auth (srtp_auth_type_id_t id, auth_po
return ((at)->alloc(ap, key_len, tag_len));
}
srtp_err_status_t srtp_crypto_kernel_load_debug_module (debug_module_t *new_dm)
srtp_err_status_t srtp_crypto_kernel_load_debug_module (srtp_debug_module_t *new_dm)
{
srtp_kernel_debug_module_t *kdm, *new;
......
......@@ -7,26 +7,26 @@
* Cisco Systems, Inc.
*/
/*
*
*
* Copyright(c) 2001-2006 Cisco Systems, Inc.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
*
* Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
*
*
* Neither the name of the Cisco Systems, Inc. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
......@@ -49,50 +49,51 @@
#include "err.h"
/* err_level reflects the level of errors that are reported */
/* srtp_err_level reflects the level of errors that are reported */
err_reporting_level_t err_level = err_level_none;
srtp_err_reporting_level_t srtp_err_level = srtp_err_level_none;
/* err_file is the FILE to which errors are reported */
/* srtp_err_file is the FILE to which errors are reported */
static FILE *err_file = NULL;
static FILE *srtp_err_file = NULL;
srtp_err_status_t
err_reporting_init(const char *ident) {
/*
* Believe it or not, openlog doesn't return an error on failure.
* But then, neither does the syslog() call...
*/
srtp_err_status_t srtp_err_reporting_init (const char *ident)
{
/*
* Believe it or not, openlog doesn't return an error on failure.
* But then, neither does the syslog() call...
*/
#ifdef ERR_REPORTING_STDOUT
err_file = stdout;
srtp_err_file = stdout;
#elif defined(USE_ERR_REPORTING_FILE)
/* open file for error reporting */
err_file = fopen(ERR_REPORTING_FILE, "w");
if (err_file == NULL)
return srtp_err_status_init_fail;
/* open file for error reporting */
srtp_err_file = fopen(ERR_REPORTING_FILE, "w");
if (srtp_err_file == NULL) {
return srtp_err_status_init_fail;
}
#endif
return srtp_err_status_ok;
return srtp_err_status_ok;
}
void
err_report(int priority, const char *format, ...) {
va_list args;
void srtp_err_report (int priority, const char *format, ...)
{
va_list args;
if (priority <= err_level) {
if (priority <= srtp_err_level) {
va_start(args, format);
if (err_file != NULL) {
vfprintf(err_file, format, args);
/* fprintf(err_file, "\n"); */
va_start(args, format);
if (srtp_err_file != NULL) {
vfprintf(srtp_err_file, format, args);
/* fprintf(srtp_err_file, "\n"); */
}
va_end(args);
}
va_end(args);
}
}
void
err_reporting_set_level(err_reporting_level_t lvl) {
err_level = lvl;
void srtp_err_reporting_set_level (srtp_err_reporting_level_t lvl)
{
srtp_err_level = lvl;
}
......@@ -13,7 +13,7 @@
#include "stat.h"
debug_module_t mod_stat = {
srtp_debug_module_t mod_stat = {
0, /* debugging is off by default */
(char *)"stat test" /* printable module name */
};
......
......@@ -47,7 +47,7 @@
#include "err.h"
#include "ekt.h"
extern debug_module_t mod_srtp;
extern srtp_debug_module_t mod_srtp;
/*
* The EKT Authentication Tag format.
......
......@@ -62,7 +62,7 @@
/* the debug module for srtp */
debug_module_t mod_srtp = {
srtp_debug_module_t mod_srtp = {
0, /* debugging is off by default */
"srtp" /* printable name for module */
};
......@@ -756,24 +756,24 @@ srtp_stream_init(srtp_stream_ctx_t *srtp,
void
srtp_event_reporter(srtp_event_data_t *data) {
err_report(err_level_warning, "srtp: in stream 0x%x: ",
srtp_err_report(srtp_err_level_warning, "srtp: in stream 0x%x: ",
data->stream->ssrc);
switch(data->event) {
case event_ssrc_collision:
err_report(err_level_warning, "\tSSRC collision\n");
srtp_err_report(srtp_err_level_warning, "\tSSRC collision\n");
break;
case event_key_soft_limit:
err_report(err_level_warning, "\tkey usage soft limit reached\n");
srtp_err_report(srtp_err_level_warning, "\tkey usage soft limit reached\n");
break;
case event_key_hard_limit:
err_report(err_level_warning, "\tkey usage hard limit reached\n");
srtp_err_report(srtp_err_level_warning, "\tkey usage hard limit reached\n");
break;
case event_packet_index_limit:
err_report(err_level_warning, "\tpacket index limit reached\n");
srtp_err_report(srtp_err_level_warning, "\tpacket index limit reached\n");
break;
default:
err_report(err_level_warning, "\tunknown event reported to handler\n");
srtp_err_report(srtp_err_level_warning, "\tunknown event reported to handler\n");
}
}
......
......@@ -139,7 +139,7 @@ extern const srtp_policy_t wildcard_policy;
* makes the interface uniform and increases portability
*/
debug_module_t mod_driver = {
srtp_debug_module_t mod_driver = {
0, /* debugging is off by default */
"driver" /* printable name for module */
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment