Unverified Commit be8409d9 authored by Pascal Bühler's avatar Pascal Bühler Committed by GitHub

Merge pull request #388 from nils-ohlmeier/move_out_cipher_type_declarations

moved externs from crypto_kernel into its own header
parents 8d8bc3df 63847f50
......@@ -1401,8 +1401,6 @@ static const uint32_t U4[256] = {
/* aes internals */
extern srtp_debug_module_t srtp_mod_aes_icm;
static void aes_128_expand_encryption_key(const uint8_t *key,
srtp_aes_expanded_key_t *expanded_key)
{
......
......@@ -54,19 +54,13 @@
#include "alloc.h"
#include "err.h" /* for srtp_debug */
#include "crypto_types.h"
#include "cipher_types.h"
srtp_debug_module_t srtp_mod_aes_gcm = {
0, /* debugging is off by default */
"aes gcm" /* printable module name */
};
/*
* The following are the global singleton instances for the
* 128-bit and 256-bit GCM ciphers.
*/
extern const srtp_cipher_type_t srtp_aes_gcm_128_openssl;
extern const srtp_cipher_type_t srtp_aes_gcm_256_openssl;
/*
* For now we only support 8 and 16 octet tags. The spec allows for
* optional 12 byte tag, which may be supported in the future.
......
......@@ -51,13 +51,12 @@
#include "aes_icm.h"
#include "alloc.h"
#include "cipher_types.h"
srtp_debug_module_t srtp_mod_aes_icm = {
0, /* debugging is off by default */
"aes icm" /* printable module name */
};
extern const srtp_cipher_type_t srtp_aes_icm_128;
extern const srtp_cipher_type_t srtp_aes_icm_256;
/*
* integer counter mode works as follows:
......
......@@ -57,14 +57,12 @@
#include "crypto_types.h"
#include "err.h" /* for srtp_debug */
#include "alloc.h"
#include "cipher_types.h"
srtp_debug_module_t srtp_mod_aes_icm = {
0, /* debugging is off by default */
"aes icm ossl" /* printable module name */
};
extern const srtp_cipher_type_t srtp_aes_icm_128;
extern const srtp_cipher_type_t srtp_aes_icm_192;
extern const srtp_cipher_type_t srtp_aes_icm_256;
/*
* integer counter mode works as follows:
......
......@@ -52,10 +52,7 @@
#include "null_cipher.h"
#include "err.h" /* for srtp_debug */
#include "alloc.h"
/* the null_cipher uses the cipher debug module */
extern srtp_debug_module_t srtp_mod_cipher;
#include "cipher_types.h"
static srtp_err_status_t srtp_null_cipher_alloc(srtp_cipher_t **c,
int key_len,
......
......@@ -48,6 +48,7 @@
#include "hmac.h"
#include "alloc.h"
#include "cipher_types.h"
/* the debug module for authentiation */
......
......@@ -51,10 +51,7 @@
#include "null_auth.h"
#include "err.h" /* for srtp_debug */
#include "alloc.h"
/* null_auth uses the auth debug module */
extern srtp_debug_module_t srtp_mod_auth;
#include "cipher_types.h"
static srtp_err_status_t srtp_null_auth_alloc(srtp_auth_t **a,
int key_len,
......
/*
*
* Copyright(c) 2001-2017 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
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef CIHPER_TYPES_H
#define CIHPER_TYPES_H
#include "cipher.h"
#include "auth.h"
/*
* cipher types that can be included in the kernel
*/
const srtp_cipher_type_t srtp_null_cipher;
const srtp_cipher_type_t srtp_aes_icm_128;
const srtp_cipher_type_t srtp_aes_icm_256;
#ifdef OPENSSL
const srtp_cipher_type_t srtp_aes_icm_192;
const srtp_cipher_type_t srtp_aes_gcm_128_openssl;
const srtp_cipher_type_t srtp_aes_gcm_256_openssl;
#endif
/*
* auth func types that can be included in the kernel
*/
const srtp_auth_type_t srtp_null_auth;
const srtp_auth_type_t srtp_hmac;
/*
* other generic debug modules that can be included in the kernel
*/
srtp_debug_module_t srtp_mod_auth;
srtp_debug_module_t srtp_mod_cipher;
srtp_debug_module_t mod_stat;
srtp_debug_module_t mod_alloc;
/* debug modules for cipher types */
srtp_debug_module_t srtp_mod_aes_icm;
#ifdef OPENSSL
srtp_debug_module_t srtp_mod_aes_gcm;
#endif
/* debug modules for auth types */
srtp_debug_module_t srtp_mod_hmac;
#endif
......@@ -49,6 +49,7 @@
#include "alloc.h"
#include "crypto_kernel.h"
#include "cipher_types.h"
/* the debug module for the crypto_kernel */
......@@ -57,44 +58,6 @@ srtp_debug_module_t srtp_mod_crypto_kernel = {
"crypto kernel" /* printable name for module */
};
/*
* other generic debug modules that can be included in the kernel
*/
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
*/
extern srtp_cipher_type_t srtp_null_cipher;
extern srtp_cipher_type_t srtp_aes_icm_128;
extern srtp_cipher_type_t srtp_aes_icm_256;
#ifdef OPENSSL
extern srtp_cipher_type_t srtp_aes_icm_192;
extern srtp_cipher_type_t srtp_aes_gcm_128_openssl;
extern srtp_cipher_type_t srtp_aes_gcm_256_openssl;
#endif
/* debug modules for cipher types */
extern srtp_debug_module_t srtp_mod_aes_icm;
#ifdef OPENSSL
extern srtp_debug_module_t srtp_mod_aes_gcm;
#endif
/*
* auth func types that can be included in the kernel
*/
extern srtp_auth_type_t srtp_null_auth;
extern srtp_auth_type_t srtp_hmac;
/* debug modules for auth types */
extern srtp_debug_module_t srtp_mod_hmac;
/* crypto_kernel is a global variable, the only one of its datatype */
srtp_crypto_kernel_t crypto_kernel = {
......
......@@ -370,6 +370,7 @@
<ClInclude Include="crypto\include\alloc.h" />
<ClInclude Include="crypto\include\auth.h" />
<ClInclude Include="crypto\include\cipher.h" />
<ClInclude Include="crypto\include\cipher_types.h" />
<ClInclude Include="crypto\include\config.h" />
<ClInclude Include="crypto\include\crypto.h" />
<ClInclude Include="crypto\include\cryptoalg.h" />
......@@ -401,4 +402,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
</Project>
......@@ -107,6 +107,9 @@
<ClInclude Include="crypto\include\cipher.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="crypto\include\cipher_types.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="crypto\include\config.h">
<Filter>Header Files</Filter>
</ClInclude>
......@@ -183,4 +186,4 @@
<Filter>Source Files</Filter>
</None>
</ItemGroup>
</Project>
\ No newline at end of file
</Project>
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