Make include guards consistent, and avoid reserved identifiers.

This commit is contained in:
Frank Denis
2014-10-06 14:14:49 -07:00
parent cb07df046f
commit 5c3c132e47
16 changed files with 57 additions and 57 deletions
@@ -11,8 +11,8 @@
this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
*/
#ifndef __BLAKE2_IMPL_H__
#define __BLAKE2_IMPL_H__
#ifndef blake2_impl_H
#define blake2_impl_H
#include <stdint.h>
#include <string.h>
@@ -11,8 +11,8 @@
this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
*/
#ifndef __BLAKE2_H__
#define __BLAKE2_H__
#ifndef blake2_H
#define blake2_H
#include <stddef.h>
#include <stdint.h>
@@ -58,7 +58,7 @@ extern "C" {
};
#pragma pack(push, 1)
typedef struct __blake2s_param
typedef struct blake2s_param_
{
uint8_t digest_length; // 1
uint8_t key_length; // 2
@@ -73,7 +73,7 @@ extern "C" {
uint8_t personal[BLAKE2S_PERSONALBYTES]; // 32
} blake2s_param;
ALIGN( 64 ) typedef struct __blake2s_state
ALIGN( 64 ) typedef struct blake2s_state_
{
uint32_t h[8];
uint32_t t[2];
@@ -83,7 +83,7 @@ extern "C" {
uint8_t last_node;
} blake2s_state ;
typedef struct __blake2b_param
typedef struct blake2b_param_
{
uint8_t digest_length; // 1
uint8_t key_length; // 2
@@ -101,7 +101,7 @@ extern "C" {
#ifndef DEFINE_BLAKE2B_STATE
typedef crypto_generichash_blake2b_state blake2b_state;
#else
ALIGN( 64 ) typedef struct __blake2b_state
ALIGN( 64 ) typedef struct blake2b_state_
{
uint64_t h[8];
uint64_t t[2];
@@ -112,7 +112,7 @@ typedef crypto_generichash_blake2b_state blake2b_state;
} blake2b_state;
#endif
typedef struct __blake2sp_state
typedef struct blake2sp_state_
{
blake2s_state S[8][1];
blake2s_state R[1];
@@ -120,7 +120,7 @@ typedef crypto_generichash_blake2b_state blake2b_state;
size_t buflen;
} blake2sp_state;
typedef struct __blake2bp_state
typedef struct blake2bp_state_
{
blake2b_state S[4][1];
blake2b_state R[1];
@@ -96,10 +96,10 @@ crypto_onetimeauth_poly1305_donna_implementation_name(void)
struct crypto_onetimeauth_poly1305_implementation
crypto_onetimeauth_poly1305_donna_implementation = {
_SODIUM_C99(.implementation_name =) crypto_onetimeauth_poly1305_donna_implementation_name,
_SODIUM_C99(.onetimeauth =) crypto_onetimeauth_poly1305_donna,
_SODIUM_C99(.onetimeauth_verify =) crypto_onetimeauth_poly1305_donna_verify,
_SODIUM_C99(.onetimeauth_init =) crypto_onetimeauth_poly1305_donna_init,
_SODIUM_C99(.onetimeauth_update =) crypto_onetimeauth_poly1305_donna_update,
_SODIUM_C99(.onetimeauth_final =) crypto_onetimeauth_poly1305_donna_final
SODIUM_C99(.implementation_name =) crypto_onetimeauth_poly1305_donna_implementation_name,
SODIUM_C99(.onetimeauth =) crypto_onetimeauth_poly1305_donna,
SODIUM_C99(.onetimeauth_verify =) crypto_onetimeauth_poly1305_donna_verify,
SODIUM_C99(.onetimeauth_init =) crypto_onetimeauth_poly1305_donna_init,
SODIUM_C99(.onetimeauth_update =) crypto_onetimeauth_poly1305_donna_update,
SODIUM_C99(.onetimeauth_final =) crypto_onetimeauth_poly1305_donna_final
};
@@ -1,5 +1,5 @@
#ifndef __POLY1305_DONNA_H__
#define __POLY1305_DONNA_H__
#ifndef poly1305_donna_H
#define poly1305_donna_H
#include <stddef.h>
@@ -27,8 +27,8 @@
* This file was originally written by Colin Percival as part of the Tarsnap
* online backup system.
*/
#ifndef _CRYPTO_SCRYPT_H_
#define _CRYPTO_SCRYPT_H_
#ifndef crypto_scrypt_H
#define crypto_scrypt_H
#include <stdint.h>
@@ -25,8 +25,8 @@
*
*/
#ifndef _SHA256_H_
#define _SHA256_H_
#ifndef pbkdf2_sha256_H
#define pbkdf2_sha256_H
#include <sys/types.h>
@@ -1,5 +1,5 @@
#ifndef _SYSENDIAN_H_
#define _SYSENDIAN_H_
#ifndef sysendian_H
#define sysendian_H
#include <stdint.h>
+2 -2
View File
@@ -1,6 +1,6 @@
#ifndef __SODIUM_H__
#define __SODIUM_H__
#ifndef sodium_H
#define sodium_H
#include <sodium/core.h>
#include <sodium/crypto_aead_chacha20poly1305.h>
+2 -2
View File
@@ -1,6 +1,6 @@
#ifndef __SODIUM_CORE_H__
#define __SODIUM_CORE_H__
#ifndef sodium_core_H
#define sodium_core_H
#include "export.h"
+2 -2
View File
@@ -1,6 +1,6 @@
#ifndef __SODIUM_EXPORT_H__
#define __SODIUM_EXPORT_H__
#ifndef sodium_export_H
#define sodium_export_H
#ifndef __GNUC__
# ifdef __attribute__
+2 -2
View File
@@ -1,6 +1,6 @@
#ifndef __SODIUM_RUNTIME_H__
#define __SODIUM_RUNTIME_H__ 1
#ifndef sodium_runtime_H
#define sodium_runtime_H
#include "export.h"
+4 -4
View File
@@ -1,6 +1,6 @@
#ifndef __SODIUM_UTILS_H__
#define __SODIUM_UTILS_H__
#ifndef sodium_utils_H
#define sodium_utils_H
#include <stddef.h>
@@ -11,9 +11,9 @@ extern "C" {
#endif
#if defined(__cplusplus) || !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L
# define _SODIUM_C99(X)
# define SODIUM_C99(X)
#else
# define _SODIUM_C99(X) X
# define SODIUM_C99(X) X
#endif
SODIUM_EXPORT
+2 -2
View File
@@ -1,6 +1,6 @@
#ifndef __SODIUM_VERSION_H__
#define __SODIUM_VERSION_H__
#ifndef sodium_version_H
#define sodium_version_H
#include "export.h"
@@ -52,9 +52,9 @@ typedef struct Salsa20Random_ {
} Salsa20Random;
static Salsa20Random stream = {
_SODIUM_C99(.random_data_source_fd =) -1,
_SODIUM_C99(.rnd32_outleft =) (size_t) 0U,
_SODIUM_C99(.initialized =) 0
SODIUM_C99(.random_data_source_fd =) -1,
SODIUM_C99(.rnd32_outleft =) (size_t) 0U,
SODIUM_C99(.initialized =) 0
};
static uint64_t
@@ -335,10 +335,10 @@ randombytes_salsa20_implementation_name(void)
}
struct randombytes_implementation randombytes_salsa20_implementation = {
_SODIUM_C99(.implementation_name =) randombytes_salsa20_implementation_name,
_SODIUM_C99(.random =) randombytes_salsa20_random,
_SODIUM_C99(.stir =) randombytes_salsa20_random_stir,
_SODIUM_C99(.uniform =) randombytes_salsa20_random_uniform,
_SODIUM_C99(.buf =) randombytes_salsa20_random_buf,
_SODIUM_C99(.close =) randombytes_salsa20_random_close
SODIUM_C99(.implementation_name =) randombytes_salsa20_implementation_name,
SODIUM_C99(.random =) randombytes_salsa20_random,
SODIUM_C99(.stir =) randombytes_salsa20_random_stir,
SODIUM_C99(.uniform =) randombytes_salsa20_random_uniform,
SODIUM_C99(.buf =) randombytes_salsa20_random_buf,
SODIUM_C99(.close =) randombytes_salsa20_random_close
};
@@ -69,8 +69,8 @@ typedef struct SysRandom_ {
} SysRandom;
static SysRandom stream = {
_SODIUM_C99(.random_data_source_fd =) -1,
_SODIUM_C99(.initialized =) 0
SODIUM_C99(.random_data_source_fd =) -1,
SODIUM_C99(.initialized =) 0
};
#ifndef _WIN32
@@ -250,10 +250,10 @@ randombytes_sysrandom_implementation_name(void)
}
struct randombytes_implementation randombytes_sysrandom_implementation = {
_SODIUM_C99(.implementation_name =) randombytes_sysrandom_implementation_name,
_SODIUM_C99(.random =) randombytes_sysrandom,
_SODIUM_C99(.stir =) randombytes_sysrandom_stir,
_SODIUM_C99(.uniform =) randombytes_sysrandom_uniform,
_SODIUM_C99(.buf =) randombytes_sysrandom_buf,
_SODIUM_C99(.close =) randombytes_sysrandom_close
SODIUM_C99(.implementation_name =) randombytes_sysrandom_implementation_name,
SODIUM_C99(.random =) randombytes_sysrandom,
SODIUM_C99(.stir =) randombytes_sysrandom_stir,
SODIUM_C99(.uniform =) randombytes_sysrandom_uniform,
SODIUM_C99(.buf =) randombytes_sysrandom_buf,
SODIUM_C99(.close =) randombytes_sysrandom_close
};
+2 -2
View File
@@ -47,7 +47,7 @@ static unsigned char canary[CANARY_SIZE];
#ifdef HAVE_WEAK_SYMBOLS
__attribute__((weak)) void
__sodium_dummy_symbol_to_prevent_lto(void * const pnt, const size_t len)
_sodium_dummy_symbol_to_prevent_lto(void * const pnt, const size_t len)
{
(void) pnt;
(void) len;
@@ -67,7 +67,7 @@ sodium_memzero(void * const pnt, const size_t len)
explicit_bzero(pnt, len);
#elif HAVE_WEAK_SYMBOLS
memset(pnt, 0, len);
__sodium_dummy_symbol_to_prevent_lto(pnt, len);
_sodium_dummy_symbol_to_prevent_lto(pnt, len);
#else
volatile unsigned char *pnt_ = (volatile unsigned char *) pnt;
size_t i = (size_t) 0U;