Tidy up the headers a bit and make them C++-safe.

This commit is contained in:
Dag-Erling Smørgrav 2016-10-03 12:31:16 +02:00 committed by Dag-Erling Smørgrav
parent be954631db
commit b77cb1aeb4
47 changed files with 184 additions and 34 deletions

View file

@ -13,10 +13,10 @@ endif CRYB_CIPHER
if CRYB_CORE if CRYB_CORE
cryb_HEADERS += \ cryb_HEADERS += \
algorithm.h \ algorithm.h \
attributes.h \
bitwise.h \ bitwise.h \
core.h \ core.h \
ctype.h \ ctype.h \
defs.h \
endian.h \ endian.h \
memset_s.h \ memset_s.h \
string.h \ string.h \

View file

@ -36,6 +36,8 @@
#include <cryb/cipher.h> #include <cryb/cipher.h>
CRYB_BEGIN
#define AES_BLOCK_LEN 16 #define AES_BLOCK_LEN 16
#define aes_digest cryb_aes_digest #define aes_digest cryb_aes_digest
@ -59,4 +61,6 @@ void aes_init(aes_ctx *, cipher_mode, const uint8_t *, size_t);
void aes_update(aes_ctx *, const void *, size_t, void *); void aes_update(aes_ctx *, const void *, size_t, void *);
void aes_finish(aes_ctx *); void aes_finish(aes_ctx *);
CRYB_END
#endif #endif

View file

@ -35,6 +35,8 @@
#include <cryb/to.h> #include <cryb/to.h>
#endif #endif
CRYB_BEGIN
typedef enum algorithm_type { typedef enum algorithm_type {
digest_algorithm, digest_algorithm,
mac_algorithm, mac_algorithm,
@ -45,4 +47,6 @@ typedef struct algorithm {
const char *name; const char *name;
} algorithm; } algorithm;
CRYB_END
#endif #endif

View file

@ -35,6 +35,8 @@
#include <cryb/to.h> #include <cryb/to.h>
#endif #endif
CRYB_BEGIN
#define CRYB_ROL_ROR(N) \ #define CRYB_ROL_ROR(N) \
static inline uint##N##_t rol##N(uint##N##_t i, int n) \ static inline uint##N##_t rol##N(uint##N##_t i, int n) \
{ \ { \
@ -52,4 +54,6 @@ CRYB_ROL_ROR(64);
#undef CRYB_ROL_ROR #undef CRYB_ROL_ROR
CRYB_END
#endif #endif

View file

@ -34,6 +34,8 @@
#include <cryb/to.h> #include <cryb/to.h>
#endif #endif
CRYB_BEGIN
const char *cryb_cipher_version(void); const char *cryb_cipher_version(void);
#define cipher_ctx cryb_cipher_ctx #define cipher_ctx cryb_cipher_ctx
@ -73,4 +75,6 @@ const cipher_algorithm *get_cipher_algorithm(const char *);
#define cipher_finish(alg, ctx) \ #define cipher_finish(alg, ctx) \
(alg)->finish((ctx)) (alg)->finish((ctx))
CRYB_END
#endif #endif

View file

@ -34,6 +34,10 @@
#include <cryb/to.h> #include <cryb/to.h>
#endif #endif
CRYB_BEGIN
const char *cryb_core_version(void); const char *cryb_core_version(void);
CRYB_END
#endif #endif

View file

@ -34,6 +34,8 @@
#include <cryb/to.h> #include <cryb/to.h>
#endif #endif
CRYB_BEGIN
const char *cryb_cpe_version(void); const char *cryb_cpe_version(void);
#define cpe_name cryb_cpe_name #define cpe_name cryb_cpe_name
@ -109,4 +111,6 @@ wchar_t *cpe_to_wfn(const cpe_name *);
int cpe_copy_attr(cpe_name *, const cpe_name *, int, int); int cpe_copy_attr(cpe_name *, const cpe_name *, int, int);
cpe_name *cpe_upgrade22(const cpe_name *); cpe_name *cpe_upgrade22(const cpe_name *);
CRYB_END
#endif #endif

View file

@ -1,5 +1,5 @@
/*- /*-
* Copyright (c) 2014 Dag-Erling Smørgrav * Copyright (c) 2014-2016 Dag-Erling Smørgrav
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -27,12 +27,8 @@
* SUCH DAMAGE. * SUCH DAMAGE.
*/ */
#ifndef CRYB_ATTRIBUTES_H_INCLUDED #ifndef CRYB_DEFS_H_INCLUDED
#define CRYB_ATTRIBUTES_H_INCLUDED #define CRYB_DEFS_H_INCLUDED
#ifndef CRYB_TO
#include <cryb/to.h>
#endif
#if defined(__GNUC__) || defined(__clang__) #if defined(__GNUC__) || defined(__clang__)
# define CRYB_PRINTF(fmt, arg) __attribute__((format(printf, fmt, arg))) # define CRYB_PRINTF(fmt, arg) __attribute__((format(printf, fmt, arg)))
@ -46,4 +42,12 @@
# define CRYB_USED # define CRYB_USED
#endif #endif
#ifdef __cplusplus
#define CRYB_BEGIN extern "C" {
#define CRYB_END }
#else
#define CRYB_BEGIN
#define CRYB_END
#endif
#endif #endif

View file

@ -37,6 +37,10 @@
#include <cryb/rfc3986.h> #include <cryb/rfc3986.h>
#include <cryb/rfc4648.h> #include <cryb/rfc4648.h>
CRYB_BEGIN
const char *cryb_enc_version(void); const char *cryb_enc_version(void);
CRYB_END
#endif #endif

View file

@ -43,6 +43,8 @@
#include <endian.h> #include <endian.h>
#endif #endif
CRYB_BEGIN
#if !HAVE_DECL_BSWAP16 #if !HAVE_DECL_BSWAP16
#define bswap16 cryb_bswap16 #define bswap16 cryb_bswap16
#endif #endif
@ -390,4 +392,6 @@ cryb_le64toh(uint64_t u64)
return (u64); return (u64);
} }
CRYB_END
#endif #endif

View file

@ -34,6 +34,8 @@
#include <cryb/to.h> #include <cryb/to.h>
#endif #endif
CRYB_BEGIN
const char *cryb_hash_version(void); const char *cryb_hash_version(void);
#define adler32_hash cryb_adler32_hash #define adler32_hash cryb_adler32_hash
@ -52,4 +54,6 @@ uint32_t murmur3_32_hash(const void *, size_t, uint32_t);
uint8_t pearson_hash(const void *, size_t); uint8_t pearson_hash(const void *, size_t);
uint8_t pearson_hash_str(const char *); uint8_t pearson_hash_str(const char *);
CRYB_END
#endif #endif

View file

@ -36,6 +36,8 @@
#include <cryb/sha1.h> #include <cryb/sha1.h>
CRYB_BEGIN
#define HMAC_SHA1_MAC_LEN 20 #define HMAC_SHA1_MAC_LEN 20
#define hmac_sha1_ctx cryb_hmac_sha1_ctx #define hmac_sha1_ctx cryb_hmac_sha1_ctx
@ -54,4 +56,6 @@ void hmac_sha1_update(hmac_sha1_ctx *, const void *, size_t);
void hmac_sha1_final(hmac_sha1_ctx *, uint8_t *); void hmac_sha1_final(hmac_sha1_ctx *, uint8_t *);
void hmac_sha1_complete(const void *, size_t, const void *, size_t, uint8_t *); void hmac_sha1_complete(const void *, size_t, const void *, size_t, uint8_t *);
CRYB_END
#endif #endif

View file

@ -36,6 +36,8 @@
#include <cryb/sha224.h> #include <cryb/sha224.h>
CRYB_BEGIN
#define HMAC_SHA224_MAC_LEN 28 #define HMAC_SHA224_MAC_LEN 28
#define hmac_sha224_ctx cryb_hmac_sha224_ctx #define hmac_sha224_ctx cryb_hmac_sha224_ctx
@ -54,4 +56,6 @@ void hmac_sha224_update(hmac_sha224_ctx *, const void *, size_t);
void hmac_sha224_final(hmac_sha224_ctx *, uint8_t *); void hmac_sha224_final(hmac_sha224_ctx *, uint8_t *);
void hmac_sha224_complete(const void *, size_t, const void *, size_t, uint8_t *); void hmac_sha224_complete(const void *, size_t, const void *, size_t, uint8_t *);
CRYB_END
#endif #endif

View file

@ -36,6 +36,8 @@
#include <cryb/sha256.h> #include <cryb/sha256.h>
CRYB_BEGIN
#define HMAC_SHA256_MAC_LEN 32 #define HMAC_SHA256_MAC_LEN 32
#define hmac_sha256_ctx cryb_hmac_sha256_ctx #define hmac_sha256_ctx cryb_hmac_sha256_ctx
@ -54,4 +56,6 @@ void hmac_sha256_update(hmac_sha256_ctx *, const void *, size_t);
void hmac_sha256_final(hmac_sha256_ctx *, uint8_t *); void hmac_sha256_final(hmac_sha256_ctx *, uint8_t *);
void hmac_sha256_complete(const void *, size_t, const void *, size_t, uint8_t *); void hmac_sha256_complete(const void *, size_t, const void *, size_t, uint8_t *);
CRYB_END
#endif #endif

View file

@ -36,6 +36,8 @@
#include <cryb/sha384.h> #include <cryb/sha384.h>
CRYB_BEGIN
#define HMAC_SHA384_MAC_LEN 48 #define HMAC_SHA384_MAC_LEN 48
#define hmac_sha384_ctx cryb_hmac_sha384_ctx #define hmac_sha384_ctx cryb_hmac_sha384_ctx
@ -54,4 +56,6 @@ void hmac_sha384_update(hmac_sha384_ctx *, const void *, size_t);
void hmac_sha384_final(hmac_sha384_ctx *, uint8_t *); void hmac_sha384_final(hmac_sha384_ctx *, uint8_t *);
void hmac_sha384_complete(const void *, size_t, const void *, size_t, uint8_t *); void hmac_sha384_complete(const void *, size_t, const void *, size_t, uint8_t *);
CRYB_END
#endif #endif

View file

@ -36,6 +36,8 @@
#include <cryb/sha512.h> #include <cryb/sha512.h>
CRYB_BEGIN
#define HMAC_SHA512_MAC_LEN 64 #define HMAC_SHA512_MAC_LEN 64
#define hmac_sha512_ctx cryb_hmac_sha512_ctx #define hmac_sha512_ctx cryb_hmac_sha512_ctx
@ -54,4 +56,6 @@ void hmac_sha512_update(hmac_sha512_ctx *, const void *, size_t);
void hmac_sha512_final(hmac_sha512_ctx *, uint8_t *); void hmac_sha512_final(hmac_sha512_ctx *, uint8_t *);
void hmac_sha512_complete(const void *, size_t, const void *, size_t, uint8_t *); void hmac_sha512_complete(const void *, size_t, const void *, size_t, uint8_t *);
CRYB_END
#endif #endif

View file

@ -31,14 +31,13 @@
#define CRYB_IMPL_H_INCLUDED #define CRYB_IMPL_H_INCLUDED
#if HAVE_CONFIG_H #if HAVE_CONFIG_H
# include "config.h" #include "config.h"
#endif #endif
#ifndef CRYB_TO #ifndef CRYB_TO
#include <cryb/to.h> #include <cryb/to.h>
#endif #endif
#include <cryb/attributes.h>
#include <cryb/coverage.h> #include <cryb/coverage.h>
#endif #endif

View file

@ -36,6 +36,10 @@
#include <cryb/hmac.h> #include <cryb/hmac.h>
CRYB_BEGIN
const char *cryb_mac_version(void); const char *cryb_mac_version(void);
CRYB_END
#endif #endif

View file

@ -36,6 +36,8 @@
#include <cryb/digest.h> #include <cryb/digest.h>
CRYB_BEGIN
#define MD2_BLOCK_LEN 16 #define MD2_BLOCK_LEN 16
#define MD2_DIGEST_LEN 16 #define MD2_DIGEST_LEN 16
@ -59,10 +61,6 @@ typedef struct
int left; /*!< amount of data in buffer */ int left; /*!< amount of data in buffer */
} md2_ctx; } md2_ctx;
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* \brief MD2 context setup * \brief MD2 context setup
* *
@ -96,8 +94,6 @@ void md2_final( md2_ctx *ctx, uint8_t *output );
*/ */
void md2_complete( const void *input, int ilen, uint8_t *output ); void md2_complete( const void *input, int ilen, uint8_t *output );
#ifdef __cplusplus CRYB_END
}
#endif
#endif /* md2.h */ #endif

View file

@ -36,6 +36,8 @@
#include <cryb/digest.h> #include <cryb/digest.h>
CRYB_BEGIN
#define MD4_BLOCK_LEN 64 #define MD4_BLOCK_LEN 64
#define MD4_DIGEST_LEN 16 #define MD4_DIGEST_LEN 16
@ -100,4 +102,6 @@ void md4_complete( const void *input, int ilen, uint8_t *output );
} }
#endif #endif
CRYB_END
#endif #endif

View file

@ -37,6 +37,8 @@
#include <cryb/digest.h> #include <cryb/digest.h>
CRYB_BEGIN
#define MD5_BLOCK_LEN 64 #define MD5_BLOCK_LEN 64
#define MD5_DIGEST_LEN 16 #define MD5_DIGEST_LEN 16
@ -61,4 +63,6 @@ void md5_update(md5_ctx *, const void *, size_t);
void md5_final(md5_ctx *, uint8_t *); void md5_final(md5_ctx *, uint8_t *);
void md5_complete(const void *, size_t, uint8_t *); void md5_complete(const void *, size_t, uint8_t *);
CRYB_END
#endif #endif

View file

@ -30,10 +30,12 @@
#ifndef CRYB_MEMSET_S_H_INCLUDED #ifndef CRYB_MEMSET_S_H_INCLUDED
#define CRYB_MEMSET_S_H_INCLUDED #define CRYB_MEMSET_S_H_INCLUDED
#ifndef CRYB_TO #ifndef CRYB_TO_H_INCLUDED
#include <cryb/to.h> #include <cryb/to.h>
#endif #endif
CRYB_BEGIN
int cryb_memset_s(void *, size_t, int, size_t); int cryb_memset_s(void *, size_t, int, size_t);
#if !HAVE_MEMSET_S #if !HAVE_MEMSET_S

View file

@ -34,6 +34,8 @@
#include <cryb/to.h> #include <cryb/to.h>
#endif #endif
CRYB_BEGIN
const char *cryb_mpi_version(void); const char *cryb_mpi_version(void);
#define mpi_add cryb_mpi_add #define mpi_add cryb_mpi_add
@ -89,4 +91,6 @@ int mpi_cmp(cryb_mpi *, cryb_mpi *);
int mpi_eq_abs(cryb_mpi *, cryb_mpi *); int mpi_eq_abs(cryb_mpi *, cryb_mpi *);
int mpi_eq(cryb_mpi *, cryb_mpi *); int mpi_eq(cryb_mpi *, cryb_mpi *);
CRYB_END
#endif #endif

View file

@ -40,6 +40,8 @@
#include <cryb/oath_hotp.h> #include <cryb/oath_hotp.h>
#include <cryb/oath_totp.h> #include <cryb/oath_totp.h>
CRYB_BEGIN
const char *cryb_oath_version(void); const char *cryb_oath_version(void);
#define oath_key_alloc cryb_oath_key_alloc #define oath_key_alloc cryb_oath_key_alloc
@ -64,4 +66,6 @@ struct oath_key *oath_key_dummy(enum oath_mode, enum oath_hash, unsigned int);
const char *oath_mode_name(enum oath_mode); const char *oath_mode_name(enum oath_mode);
enum oath_mode oath_mode_value(const char *); enum oath_mode oath_mode_value(const char *);
CRYB_END
#endif #endif

View file

@ -34,6 +34,8 @@
#include <cryb/to.h> #include <cryb/to.h>
#endif #endif
CRYB_BEGIN
/* /*
* OATH modes * OATH modes
*/ */
@ -84,4 +86,6 @@ enum oath_hash {
*/ */
#define OATH_DUMMY_LABEL "oath-dummy@openpam.org" #define OATH_DUMMY_LABEL "oath-dummy@openpam.org"
CRYB_END
#endif #endif

View file

@ -38,6 +38,8 @@
#include <cryb/oath_constants.h> #include <cryb/oath_constants.h>
#include <cryb/oath_types.h> #include <cryb/oath_types.h>
CRYB_BEGIN
#define oath_hotp cryb_oath_hotp #define oath_hotp cryb_oath_hotp
#define oath_hotp_current cryb_oath_hotp_current #define oath_hotp_current cryb_oath_hotp_current
#define oath_hotp_match cryb_oath_hotp_match #define oath_hotp_match cryb_oath_hotp_match
@ -46,4 +48,6 @@ unsigned int oath_hotp(const uint8_t *, size_t, uint64_t, unsigned int);
unsigned int oath_hotp_current(struct oath_key *); unsigned int oath_hotp_current(struct oath_key *);
int oath_hotp_match(struct oath_key *, unsigned int, int); int oath_hotp_match(struct oath_key *, unsigned int, int);
CRYB_END
#endif #endif

View file

@ -38,6 +38,8 @@
#include <cryb/oath_constants.h> #include <cryb/oath_constants.h>
#include <cryb/oath_types.h> #include <cryb/oath_types.h>
CRYB_BEGIN
#define oath_totp cryb_oath_totp #define oath_totp cryb_oath_totp
#define oath_totp_current cryb_oath_totp_current #define oath_totp_current cryb_oath_totp_current
#define oath_totp_match cryb_oath_totp_match #define oath_totp_match cryb_oath_totp_match
@ -46,4 +48,6 @@ unsigned int oath_totp(const uint8_t *, size_t, unsigned int);
unsigned int oath_totp_current(const struct oath_key *); unsigned int oath_totp_current(const struct oath_key *);
int oath_totp_match(struct oath_key *, unsigned int, int); int oath_totp_match(struct oath_key *, unsigned int, int);
CRYB_END
#endif #endif

View file

@ -34,6 +34,8 @@
#include <cryb/to.h> #include <cryb/to.h>
#endif #endif
CRYB_BEGIN
/* /*
* OATH key and associated parameters * OATH key and associated parameters
*/ */
@ -62,4 +64,6 @@ struct oath_key {
uint8_t key[OATH_MAX_KEYLEN]; uint8_t key[OATH_MAX_KEYLEN];
}; };
CRYB_END
#endif #endif

View file

@ -34,9 +34,13 @@
#include <cryb/to.h> #include <cryb/to.h>
#endif #endif
CRYB_BEGIN
const char *cryb_rand_version(void); const char *cryb_rand_version(void);
#define rand_bytes cryb_rand_bytes #define rand_bytes cryb_rand_bytes
int rand_bytes(uint8_t *, size_t); int rand_bytes(uint8_t *, size_t);
CRYB_END
#endif #endif

View file

@ -36,6 +36,8 @@
#include <cryb/cipher.h> #include <cryb/cipher.h>
CRYB_BEGIN
#define rc4_digest cryb_rc4_digest #define rc4_digest cryb_rc4_digest
#define rc4_ctx cryb_rc4_ctx #define rc4_ctx cryb_rc4_ctx
#define rc4_init cryb_rc4_init #define rc4_init cryb_rc4_init
@ -52,4 +54,6 @@ void rc4_init(rc4_ctx *, cipher_mode, const uint8_t *, size_t);
void rc4_update(rc4_ctx *, const void *, size_t, void *); void rc4_update(rc4_ctx *, const void *, size_t, void *);
void rc4_finish(rc4_ctx *); void rc4_finish(rc4_ctx *);
CRYB_END
#endif #endif

View file

@ -34,6 +34,8 @@
#include <cryb/to.h> #include <cryb/to.h>
#endif #endif
CRYB_BEGIN
/* estimate of output length for percent encoding / decoding */ /* estimate of output length for percent encoding / decoding */
#define percent_enclen(l) (size_t)((l) * 3) #define percent_enclen(l) (size_t)((l) * 3)
#define percent_declen(l) (size_t)(l) #define percent_declen(l) (size_t)(l)
@ -43,4 +45,6 @@
int percent_encode(const char *, size_t, char *, size_t *); int percent_encode(const char *, size_t, char *, size_t *);
int percent_decode(const char *, size_t, char *, size_t *); int percent_decode(const char *, size_t, char *, size_t *);
CRYB_END
#endif #endif

View file

@ -34,6 +34,8 @@
#include <cryb/to.h> #include <cryb/to.h>
#endif #endif
CRYB_BEGIN
/* estimate of output length for base32 encoding / decoding */ /* estimate of output length for base32 encoding / decoding */
#define base32_enclen(l) (size_t)(((l + 4) / 5) * 8) #define base32_enclen(l) (size_t)(((l + 4) / 5) * 8)
#define base32_declen(l) (size_t)(((l + 7) / 8) * 5) #define base32_declen(l) (size_t)(((l + 7) / 8) * 5)
@ -54,4 +56,6 @@ int base32_decode(const char *, size_t, uint8_t *, size_t *);
int base64_encode(const uint8_t *, size_t, char *, size_t *); int base64_encode(const uint8_t *, size_t, char *, size_t *);
int base64_decode(const char *, size_t, uint8_t *, size_t *); int base64_decode(const char *, size_t, uint8_t *, size_t *);
CRYB_END
#endif #endif

View file

@ -37,6 +37,8 @@
#include <cryb/digest.h> #include <cryb/digest.h>
CRYB_BEGIN
#define SHA1_BLOCK_LEN 64 #define SHA1_BLOCK_LEN 64
#define SHA1_DIGEST_LEN 20 #define SHA1_DIGEST_LEN 20
@ -61,4 +63,6 @@ void sha1_update(sha1_ctx *, const void *, size_t);
void sha1_final(sha1_ctx *, uint8_t *); void sha1_final(sha1_ctx *, uint8_t *);
void sha1_complete(const void *, size_t, uint8_t *); void sha1_complete(const void *, size_t, uint8_t *);
CRYB_END
#endif #endif

View file

@ -33,6 +33,8 @@
#include <cryb/digest.h> #include <cryb/digest.h>
CRYB_BEGIN
#define SHA224_BLOCK_LEN 64 #define SHA224_BLOCK_LEN 64
#define SHA224_DIGEST_LEN 28 #define SHA224_DIGEST_LEN 28
@ -89,4 +91,6 @@ void sha224_complete(const void *, size_t, uint8_t *);
void pbkdf2_sha224(const uint8_t *, size_t, const uint8_t *, size_t, void pbkdf2_sha224(const uint8_t *, size_t, const uint8_t *, size_t,
uint64_t, uint8_t *, size_t); uint64_t, uint8_t *, size_t);
CRYB_END
#endif #endif

View file

@ -33,6 +33,8 @@
#include <cryb/digest.h> #include <cryb/digest.h>
CRYB_BEGIN
#define SHA256_BLOCK_LEN 64 #define SHA256_BLOCK_LEN 64
#define SHA256_DIGEST_LEN 32 #define SHA256_DIGEST_LEN 32
@ -89,4 +91,6 @@ void sha256_complete(const void *, size_t, uint8_t *);
void pbkdf2_sha256(const uint8_t *, size_t, const uint8_t *, size_t, void pbkdf2_sha256(const uint8_t *, size_t, const uint8_t *, size_t,
uint64_t, uint8_t *, size_t); uint64_t, uint8_t *, size_t);
CRYB_END
#endif #endif

View file

@ -36,6 +36,8 @@
#include <cryb/digest.h> #include <cryb/digest.h>
CRYB_BEGIN
#define SHA384_BLOCK_LEN 128 #define SHA384_BLOCK_LEN 128
#define SHA384_DIGEST_LEN 48 #define SHA384_DIGEST_LEN 48
@ -59,10 +61,6 @@ typedef struct
} }
sha384_ctx; sha384_ctx;
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* \brief SHA-384 context setup * \brief SHA-384 context setup
* *
@ -96,8 +94,6 @@ void sha384_final( sha384_ctx *ctx, uint8_t *output );
*/ */
void sha384_complete( const void *input, int ilen, uint8_t *output ); void sha384_complete( const void *input, int ilen, uint8_t *output );
#ifdef __cplusplus CRYB_END
}
#endif
#endif #endif

View file

@ -36,6 +36,8 @@
#include <cryb/digest.h> #include <cryb/digest.h>
CRYB_BEGIN
#define SHA512_BLOCK_LEN 128 #define SHA512_BLOCK_LEN 128
#define SHA512_DIGEST_LEN 64 #define SHA512_DIGEST_LEN 64
@ -59,10 +61,6 @@ typedef struct
} }
sha512_ctx; sha512_ctx;
#ifdef __cplusplus
extern "C" {
#endif
/** /**
* \brief SHA-512 context setup * \brief SHA-512 context setup
* *
@ -96,8 +94,6 @@ void sha512_final( sha512_ctx *ctx, uint8_t *output );
*/ */
void sha512_complete( const void *input, int ilen, uint8_t *output ); void sha512_complete( const void *input, int ilen, uint8_t *output );
#ifdef __cplusplus CRYB_END
}
#endif
#endif #endif

View file

@ -34,6 +34,8 @@
#include <cryb/to.h> #include <cryb/to.h>
#endif #endif
CRYB_BEGIN
#define string_new cryb_string_new #define string_new cryb_string_new
#define string_len cryb_string_len #define string_len cryb_string_len
#define string_buf cryb_string_buf #define string_buf cryb_string_buf
@ -76,4 +78,6 @@ int string_compare_cs(const string *, const char *, size_t);
int string_equal(const string *, const string *); int string_equal(const string *, const string *);
int string_equal_cs(const string *, const char *, size_t); int string_equal_cs(const string *, const char *, size_t);
CRYB_END
#endif #endif

View file

@ -34,6 +34,8 @@
#include <cryb/to.h> #include <cryb/to.h>
#endif #endif
CRYB_BEGIN
size_t cryb_strlcat(char *, const char *, size_t); size_t cryb_strlcat(char *, const char *, size_t);
#if !HAVE_STRLCAT #if !HAVE_STRLCAT
@ -41,4 +43,6 @@ size_t cryb_strlcat(char *, const char *, size_t);
#define strlcat(arg, ...) cryb_strlcat(arg, __VA_ARGS__) #define strlcat(arg, ...) cryb_strlcat(arg, __VA_ARGS__)
#endif #endif
CRYB_END
#endif #endif

View file

@ -34,6 +34,8 @@
#include <cryb/to.h> #include <cryb/to.h>
#endif #endif
CRYB_BEGIN
int cryb_strlcmp(const char *, const char *, size_t); int cryb_strlcmp(const char *, const char *, size_t);
#if !HAVE_STRLCMP #if !HAVE_STRLCMP
@ -41,4 +43,6 @@ int cryb_strlcmp(const char *, const char *, size_t);
#define strlcmp(...) cryb_strlcmp(__VA_ARGS__) #define strlcmp(...) cryb_strlcmp(__VA_ARGS__)
#endif #endif
CRYB_END
#endif #endif

View file

@ -34,6 +34,8 @@
#include <cryb/to.h> #include <cryb/to.h>
#endif #endif
CRYB_BEGIN
size_t cryb_strlcpy(char *, const char *, size_t); size_t cryb_strlcpy(char *, const char *, size_t);
#if !HAVE_STRLCPY #if !HAVE_STRLCPY
@ -41,4 +43,6 @@ size_t cryb_strlcpy(char *, const char *, size_t);
#define strlcpy(arg, ...) cryb_strlcpy(arg, __VA_ARGS__) #define strlcpy(arg, ...) cryb_strlcpy(arg, __VA_ARGS__)
#endif #endif
CRYB_END
#endif #endif

View file

@ -34,11 +34,12 @@
#include <cryb/to.h> #include <cryb/to.h>
#endif #endif
#include <cryb/attributes.h>
#include <cryb/coverage.h> #include <cryb/coverage.h>
CRYB_DISABLE_COVERAGE CRYB_DISABLE_COVERAGE
CRYB_BEGIN
const char *cryb_test_version(void); const char *cryb_test_version(void);
/* /*
@ -141,4 +142,6 @@ void t_malloc_printstats(FILE *);
#endif #endif
extern struct t_test t_memory_leak; extern struct t_test t_memory_leak;
CRYB_END
#endif #endif

View file

@ -32,4 +32,6 @@
#define CRYB_TO 20160918 #define CRYB_TO 20160918
#include <cryb/defs.h>
#endif #endif

View file

@ -34,6 +34,8 @@
#include <cryb/to.h> #include <cryb/to.h>
#endif #endif
CRYB_BEGIN
size_t cryb_wcslcat(wchar_t *, const wchar_t *, size_t); size_t cryb_wcslcat(wchar_t *, const wchar_t *, size_t);
#if !HAVE_WCSLCAT #if !HAVE_WCSLCAT
@ -41,4 +43,6 @@ size_t cryb_wcslcat(wchar_t *, const wchar_t *, size_t);
#define wcslcat(arg, ...) cryb_wcslcat(arg, __VA_ARGS__) #define wcslcat(arg, ...) cryb_wcslcat(arg, __VA_ARGS__)
#endif #endif
CRYB_END
#endif #endif

View file

@ -34,6 +34,8 @@
#include <cryb/to.h> #include <cryb/to.h>
#endif #endif
CRYB_BEGIN
int cryb_wcslcmp(const wchar_t *, const wchar_t *, size_t); int cryb_wcslcmp(const wchar_t *, const wchar_t *, size_t);
#if !HAVE_WCSLCMP #if !HAVE_WCSLCMP
@ -41,4 +43,6 @@ int cryb_wcslcmp(const wchar_t *, const wchar_t *, size_t);
#define wcslcmp(...) cryb_wcslcmp(__VA_ARGS__) #define wcslcmp(...) cryb_wcslcmp(__VA_ARGS__)
#endif #endif
CRYB_END
#endif #endif

View file

@ -34,6 +34,8 @@
#include <cryb/to.h> #include <cryb/to.h>
#endif #endif
CRYB_BEGIN
size_t cryb_wcslcpy(wchar_t *, const wchar_t *, size_t); size_t cryb_wcslcpy(wchar_t *, const wchar_t *, size_t);
#if !HAVE_WCSLCPY #if !HAVE_WCSLCPY
@ -41,4 +43,6 @@ size_t cryb_wcslcpy(wchar_t *, const wchar_t *, size_t);
#define wcslcpy(arg, ...) cryb_wcslcpy(arg, __VA_ARGS__) #define wcslcpy(arg, ...) cryb_wcslcpy(arg, __VA_ARGS__)
#endif #endif
CRYB_END
#endif #endif

View file

@ -34,6 +34,8 @@
#include <cryb/to.h> #include <cryb/to.h>
#endif #endif
CRYB_BEGIN
#define wstring_new cryb_wstring_new #define wstring_new cryb_wstring_new
#define wstring_len cryb_wstring_len #define wstring_len cryb_wstring_len
#define wstring_buf cryb_wstring_buf #define wstring_buf cryb_wstring_buf
@ -76,4 +78,6 @@ int wstring_compare_wcs(const wstring *, const wchar_t *, size_t);
int wstring_equal(const wstring *, const wstring *); int wstring_equal(const wstring *, const wstring *);
int wstring_equal_wcs(const wstring *, const wchar_t *, size_t); int wstring_equal_wcs(const wstring *, const wchar_t *, size_t);
CRYB_END
#endif #endif