summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPeter Mitsis <peter.mitsis@windriver.com>2016-01-22 12:38:49 -0500
committerAnas Nashif <anas.nashif@intel.com>2016-02-05 20:25:22 -0500
commita0e45687606d6e9252a8067fd1db39896c3cd3e0 (patch)
treeec34a5ae08fb1dfd2df1cc3c23801de72bd1d550 /lib
parent6504b7e72a678a7d767a97bfc67b3906957da2c4 (diff)
c++: Add extern "C" { } block to header files
Adds extern "C" { } blocks to header files so that they can be safely used by C++ source files. Change-Id: Ia4db0c36a5dac5d3de351184a297d2af0df64532 Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/crypto/tinycrypt/include/tinycrypt/aes.h8
-rw-r--r--lib/crypto/tinycrypt/include/tinycrypt/cbc_mode.h8
-rw-r--r--lib/crypto/tinycrypt/include/tinycrypt/ctr_mode.h8
-rw-r--r--lib/crypto/tinycrypt/include/tinycrypt/hmac.h8
-rw-r--r--lib/crypto/tinycrypt/include/tinycrypt/hmac_prng.h8
-rw-r--r--lib/crypto/tinycrypt/include/tinycrypt/sha256.h8
-rw-r--r--lib/crypto/tinycrypt/include/tinycrypt/utils.h8
-rw-r--r--lib/libc/minimal/include/ctype.h8
-rw-r--r--lib/libc/minimal/include/limits.h8
-rw-r--r--lib/libc/minimal/include/stdint.h8
-rw-r--r--lib/libc/minimal/include/stdio.h8
-rw-r--r--lib/libc/minimal/include/stdlib.h7
-rw-r--r--lib/libc/minimal/include/string.h8
-rw-r--r--lib/libc/minimal/include/strings.h8
14 files changed, 111 insertions, 0 deletions
diff --git a/lib/crypto/tinycrypt/include/tinycrypt/aes.h b/lib/crypto/tinycrypt/include/tinycrypt/aes.h
index 41daed972..fbfa9c934 100644
--- a/lib/crypto/tinycrypt/include/tinycrypt/aes.h
+++ b/lib/crypto/tinycrypt/include/tinycrypt/aes.h
@@ -51,6 +51,10 @@
#include<stdint.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define Nb (4) /* number of columns (32-bit words) comprising the state */
#define Nk (4) /* number of 32-bit words comprising the key */
#define Nr (10) /* number of rounds */
@@ -122,4 +126,8 @@ int32_t tc_aes_decrypt(uint8_t *out,
const uint8_t *in,
const TCAesKeySched_t s);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/lib/crypto/tinycrypt/include/tinycrypt/cbc_mode.h b/lib/crypto/tinycrypt/include/tinycrypt/cbc_mode.h
index 589e9dcbe..1c0c1887e 100644
--- a/lib/crypto/tinycrypt/include/tinycrypt/cbc_mode.h
+++ b/lib/crypto/tinycrypt/include/tinycrypt/cbc_mode.h
@@ -76,6 +76,10 @@
#include <tinycrypt/aes.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* @brief CBC encryption procedure
* CBC encrypts inlen bytes of the in buffer into the out buffer
@@ -140,4 +144,8 @@ int32_t tc_cbc_mode_decrypt(uint8_t *out, uint32_t outlen, const uint8_t *in,
uint32_t inlen, const uint8_t *iv,
const TCAesKeySched_t sched);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/lib/crypto/tinycrypt/include/tinycrypt/ctr_mode.h b/lib/crypto/tinycrypt/include/tinycrypt/ctr_mode.h
index e572a573a..312a42ba2 100644
--- a/lib/crypto/tinycrypt/include/tinycrypt/ctr_mode.h
+++ b/lib/crypto/tinycrypt/include/tinycrypt/ctr_mode.h
@@ -69,6 +69,10 @@
#include <tinycrypt/aes.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* @brief CTR mode encryption/decryption procedure.
* CTR mode encrypts (or decrypts) inlen bytes from in buffer into out buffer
@@ -96,4 +100,8 @@
int32_t tc_ctr_mode(uint8_t *out, uint32_t outlen, const uint8_t *in,
uint32_t inlen, uint8_t *ctr, const TCAesKeySched_t sched);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/lib/crypto/tinycrypt/include/tinycrypt/hmac.h b/lib/crypto/tinycrypt/include/tinycrypt/hmac.h
index fa7f2797f..23541edde 100644
--- a/lib/crypto/tinycrypt/include/tinycrypt/hmac.h
+++ b/lib/crypto/tinycrypt/include/tinycrypt/hmac.h
@@ -65,6 +65,10 @@
#include <tinycrypt/sha256.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct tc_hmac_state_struct {
/* the internal state required by h */
struct tc_sha256_state_struct hash_state;
@@ -129,4 +133,8 @@ int32_t tc_hmac_update(TCHmacState_t ctx,
*/
int32_t tc_hmac_final(uint8_t *tag, uint32_t taglen, TCHmacState_t ctx);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/lib/crypto/tinycrypt/include/tinycrypt/hmac_prng.h b/lib/crypto/tinycrypt/include/tinycrypt/hmac_prng.h
index e06cfeb23..b1af68740 100644
--- a/lib/crypto/tinycrypt/include/tinycrypt/hmac_prng.h
+++ b/lib/crypto/tinycrypt/include/tinycrypt/hmac_prng.h
@@ -71,6 +71,10 @@
#include <tinycrypt/sha256.h>
#include <tinycrypt/hmac.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct tc_hmac_prng_struct {
/* the HMAC instance for this PRNG */
struct tc_hmac_state_struct h;
@@ -151,4 +155,8 @@ int32_t tc_hmac_prng_reseed(TCHmacPrng_t prng, const uint8_t *seed,
*/
int32_t tc_hmac_prng_generate(uint8_t *out, uint32_t outlen, TCHmacPrng_t prng);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/lib/crypto/tinycrypt/include/tinycrypt/sha256.h b/lib/crypto/tinycrypt/include/tinycrypt/sha256.h
index f98074400..92f0f61d0 100644
--- a/lib/crypto/tinycrypt/include/tinycrypt/sha256.h
+++ b/lib/crypto/tinycrypt/include/tinycrypt/sha256.h
@@ -60,6 +60,10 @@
#include <stddef.h>
#include <stdint.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define TC_SHA256_BLOCK_SIZE (64)
#define TC_SHA256_DIGEST_SIZE (32)
#define TC_SHA256_STATE_BLOCKS (TC_SHA256_DIGEST_SIZE/4)
@@ -120,4 +124,8 @@ int32_t tc_sha256_update(TCSha256State_t s,
*/
int32_t tc_sha256_final(uint8_t *digest, TCSha256State_t s);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/lib/crypto/tinycrypt/include/tinycrypt/utils.h b/lib/crypto/tinycrypt/include/tinycrypt/utils.h
index dbeeb3e1c..3ed29d7c8 100644
--- a/lib/crypto/tinycrypt/include/tinycrypt/utils.h
+++ b/lib/crypto/tinycrypt/include/tinycrypt/utils.h
@@ -41,6 +41,10 @@
#include <stdint.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define TC_SUCCESS 1
#define TC_FAIL 0
#define TC_RESEED_REQ -1
@@ -65,4 +69,8 @@ void _set(uint8_t *to, uint8_t val, uint32_t len);
*/
uint8_t _double_byte(uint8_t a);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/lib/libc/minimal/include/ctype.h b/lib/libc/minimal/include/ctype.h
index db468714f..5c0d47158 100644
--- a/lib/libc/minimal/include/ctype.h
+++ b/lib/libc/minimal/include/ctype.h
@@ -19,6 +19,10 @@
#ifndef __INC_ctype_h__
#define __INC_ctype_h__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
static inline int isupper(int a)
{
return ((unsigned)(a)-'A') < 26;
@@ -66,4 +70,8 @@ static inline int toupper(int chr)
return (chr >= 'a' && chr <= 'z') ? (chr - 32) : (chr);
}
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __INC_ctype_h__ */
diff --git a/lib/libc/minimal/include/limits.h b/lib/libc/minimal/include/limits.h
index 79d777efc..6c7837610 100644
--- a/lib/libc/minimal/include/limits.h
+++ b/lib/libc/minimal/include/limits.h
@@ -19,6 +19,10 @@
#ifndef __INC_limits_h__
#define __INC_limits_h__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define UCHAR_MAX 0xFF
#define SCHAR_MAX 0x7F
#define SCHAR_MIN (-SCHAR_MAX - 1)
@@ -54,4 +58,8 @@
#define ULONG_MAX 0xFFFFFFFFul
#define ULLONG_MAX 0xFFFFFFFFFFFFFFFFull
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __INC_limits_h__ */
diff --git a/lib/libc/minimal/include/stdint.h b/lib/libc/minimal/include/stdint.h
index c0059b96b..2e4deb5da 100644
--- a/lib/libc/minimal/include/stdint.h
+++ b/lib/libc/minimal/include/stdint.h
@@ -19,6 +19,10 @@
#ifndef __INC_stdint_h__
#define __INC_stdint_h__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define INT8_MAX 0x7F
#define INT16_MAX 0x7FFF
#define INT32_MAX 0x7FFFFFFF
@@ -56,4 +60,8 @@ typedef unsigned long long uint64_t;
typedef int intptr_t;
typedef unsigned int uintptr_t;
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __INC_stdint_h__ */
diff --git a/lib/libc/minimal/include/stdio.h b/lib/libc/minimal/include/stdio.h
index e7c4ad2b6..711692d14 100644
--- a/lib/libc/minimal/include/stdio.h
+++ b/lib/libc/minimal/include/stdio.h
@@ -21,6 +21,10 @@
#include <stdarg.h> /* Needed to get definition of va_list */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#if !defined(__size_t_defined)
#define __size_t_defined
typedef unsigned int size_t;
@@ -65,4 +69,8 @@ int fputc(int c, FILE *stream);
int fputs(const char *restrict s, FILE *restrict stream);
size_t fwrite(const void *restrict ptr, size_t size, size_t nitems, FILE *restrict stream);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __INC_stdio_h__ */
diff --git a/lib/libc/minimal/include/stdlib.h b/lib/libc/minimal/include/stdlib.h
index 652e2f8f9..dcddb9563 100644
--- a/lib/libc/minimal/include/stdlib.h
+++ b/lib/libc/minimal/include/stdlib.h
@@ -25,6 +25,10 @@
#define NULL (void *) 0
#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#if !defined(__size_t_defined)
#define __size_t_defined
typedef unsigned int size_t;
@@ -34,5 +38,8 @@ unsigned long int strtoul(const char *str, char **endptr, int base);
long int strtol(const char *str, char **endptr, int base);
int atoi(const char *s);
+#ifdef __cplusplus
+}
+#endif
#endif /* __INC_stdlib_h__ */
diff --git a/lib/libc/minimal/include/string.h b/lib/libc/minimal/include/string.h
index 3960e5a3f..e4d34a7e1 100644
--- a/lib/libc/minimal/include/string.h
+++ b/lib/libc/minimal/include/string.h
@@ -23,6 +23,10 @@
#define NULL (void *) 0
#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#if !defined(__size_t_defined)
#define __size_t_defined
typedef unsigned int size_t;
@@ -42,4 +46,8 @@ extern void *memcpy(void *restrict d, const void *restrict s, size_t n);
extern void *memset(void *buf, int c, size_t n);
extern void *memchr(const void *s, unsigned char c, size_t n);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __INC_string_h__ */
diff --git a/lib/libc/minimal/include/strings.h b/lib/libc/minimal/include/strings.h
index e14624cca..78b0e9f0e 100644
--- a/lib/libc/minimal/include/strings.h
+++ b/lib/libc/minimal/include/strings.h
@@ -19,6 +19,14 @@
#ifndef __INC_strings_h__
#define __INC_strings_h__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern int strncasecmp(const char *s1, const char *s2, size_t n);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __INC_strings_h__ */