diff options
author | Jack Lloyd <[email protected]> | 2019-04-19 05:59:30 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2019-04-19 06:35:29 -0400 |
commit | b1a06fed41f137331045c96f50020c0c4feca42e (patch) | |
tree | 1a13e30423959e15565f0a900a6589126010a189 /src | |
parent | 7fdfb8100b4bc10f652c6fcf08eb986ad84012ec (diff) |
Avoid C++ style comments in headers that may be parsed as C
Also remove the TLS declarations from ffi.h for now since that
isn't supported at all.
Diffstat (limited to 'src')
-rw-r--r-- | src/build-data/buildh.in | 9 | ||||
-rw-r--r-- | src/lib/ffi/ffi.h | 70 | ||||
-rw-r--r-- | src/lib/utils/compiler.h | 4 |
3 files changed, 14 insertions, 69 deletions
diff --git a/src/build-data/buildh.in b/src/build-data/buildh.in index eb10abe5a..d969c7f5b 100644 --- a/src/build-data/buildh.in +++ b/src/build-data/buildh.in @@ -215,7 +215,10 @@ Each read generates 32 bits of output */ #define BOTAN_ENTROPY_INTEL_RNG_POLLS 32 -// According to Intel, RDRAND is guaranteed to generate a random number within 10 retries on a working CPU +/* +According to Intel, RDRAND is guaranteed to generate a random +number within 10 retries on a working CPU +*/ #define BOTAN_ENTROPY_RDRAND_RETRIES 10 /* @@ -255,11 +258,11 @@ Each read generates 32 bits of output #elif defined(BOTAN_HAS_SHA1) #define BOTAN_AUTO_RNG_HMAC "HMAC(SHA-1)" #endif - // Otherwise, no hash found: leave BOTAN_AUTO_RNG_HMAC undefined + /* Otherwise, no hash found: leave BOTAN_AUTO_RNG_HMAC undefined */ #endif -// Check for a common build problem: +/* Check for a common build problem */ #if defined(BOTAN_TARGET_ARCH_IS_X86_64) && ((defined(_MSC_VER) && !defined(_WIN64)) || \ (defined(__clang__) && !defined(__x86_64__)) || \ diff --git a/src/lib/ffi/ffi.h b/src/lib/ffi/ffi.h index c3712bd97..10b10c0f3 100644 --- a/src/lib/ffi/ffi.h +++ b/src/lib/ffi/ffi.h @@ -806,7 +806,9 @@ BOTAN_PUBLIC_API(2,1) int botan_mp_is_positive(const botan_mp_t mp); BOTAN_PUBLIC_API(2,1) int botan_mp_is_negative(const botan_mp_t mp); BOTAN_PUBLIC_API(2,1) int botan_mp_flip_sign(botan_mp_t mp); -//BOTAN_PUBLIC_API(2,1) int botan_mp_set_negative(botan_mp_t mp); +/* +BOTAN_PUBLIC_API(2,1) int botan_mp_set_negative(botan_mp_t mp); +*/ BOTAN_PUBLIC_API(2,1) int botan_mp_is_zero(const botan_mp_t mp); BOTAN_PUBLIC_API(2,1) int botan_mp_is_odd(const botan_mp_t mp); @@ -845,7 +847,7 @@ BOTAN_PUBLIC_API(2,1) int botan_mp_cmp(int* result, const botan_mp_t x, const bo */ BOTAN_PUBLIC_API(2,1) int botan_mp_swap(botan_mp_t x, botan_mp_t y); -// Return (base^exponent) % modulus +/* Return (base^exponent) % modulus */ BOTAN_PUBLIC_API(2,1) int botan_mp_powmod(botan_mp_t out, const botan_mp_t base, const botan_mp_t exponent, const botan_mp_t modulus); BOTAN_PUBLIC_API(2,1) int botan_mp_lshift(botan_mp_t out, const botan_mp_t in, size_t shift); @@ -1447,7 +1449,7 @@ int botan_x509_cert_gen_selfsigned(botan_x509_cert_t* cert, const char* common_name, const char* org_name); -// Prefer botan_x509_cert_not_before and botan_x509_cert_not_after +/* Prefer botan_x509_cert_not_before and botan_x509_cert_not_after */ BOTAN_PUBLIC_API(2,0) int botan_x509_cert_get_time_starts(botan_x509_cert_t cert, char out[], size_t* out_len); BOTAN_PUBLIC_API(2,0) int botan_x509_cert_get_time_expires(botan_x509_cert_t cert, char out[], size_t* out_len); @@ -1477,7 +1479,7 @@ int botan_x509_cert_get_subject_dn(botan_x509_cert_t cert, BOTAN_PUBLIC_API(2,0) int botan_x509_cert_to_string(botan_x509_cert_t cert, char out[], size_t* out_len); -// Must match values of Key_Constraints in key_constraints.h +/* Must match values of Key_Constraints in key_constraints.h */ enum botan_x509_cert_key_constraints { NO_CONSTRAINTS = 0, DIGITAL_SIGNATURE = 32768, @@ -1648,66 +1650,6 @@ int botan_fpe_encrypt(botan_fpe_t fpe, botan_mp_t x, const uint8_t tweak[], size BOTAN_PUBLIC_API(2,8) int botan_fpe_decrypt(botan_fpe_t fpe, botan_mp_t x, const uint8_t tweak[], size_t tweak_len); -/* -* TLS (WIP) -*/ -#if defined(BOTAN_HAS_TLS) && 0 - -typedef struct botan_tls_session_struct* botan_tls_session_t; - -BOTAN_TEST_API int botan_tls_session_decrypt(botan_tls_session_t* session, - const uint8_t key[], size_t key_len, - const uint8_t blob[], size_t blob_len); - -BOTAN_TEST_API int botan_tls_session_get_version(botan_tls_session_t session, uint16_t* tls_version); -BOTAN_TEST_API int botan_tls_session_get_ciphersuite(botan_tls_session_t session, uint16_t* ciphersuite); -BOTAN_TEST_API int botan_tls_session_encrypt(botan_tls_session_t session, botan_rng_t rng, uint8_t key[], size_t* key_len); - -BOTAN_TEST_API int botan_tls_session_get_peer_certs(botan_tls_session_t session, botan_x509_cert_t certs[], size_t* cert_len); - -// TODO: peer certs, validation, ... - -typedef struct botan_tls_channel_struct* botan_tls_channel_t; - -typedef void (*botan_tls_channel_output_fn)(void* application_data, const uint8_t* data, size_t data_len); - -typedef void (*botan_tls_channel_data_cb)(void* application_data, const uint8_t* data, size_t data_len); - -typedef void (*botan_tls_channel_alert_cb)(void* application_data, uint16_t alert_code); - -typedef void (*botan_tls_channel_session_established)(void* application_data, - botan_tls_channel_t channel, - botan_tls_session_t session); - -BOTAN_TEST_API int botan_tls_channel_init_client(botan_tls_channel_t* channel, - botan_tls_channel_output_fn output_fn, - botan_tls_channel_data_cb data_cb, - botan_tls_channel_alert_cb alert_cb, - botan_tls_channel_session_established session_cb, - const char* server_name); - -BOTAN_TEST_API int botan_tls_channel_init_server(botan_tls_channel_t* channel, - botan_tls_channel_output_fn output_fn, - botan_tls_channel_data_cb data_cb, - botan_tls_channel_alert_cb alert_cb, - botan_tls_channel_session_established session_cb); - -BOTAN_TEST_API int botan_tls_channel_received_data(botan_tls_channel_t chan, - const uint8_t input[], size_t len); - -/** -* Returns 0 for client, 1 for server, negative for error -*/ -BOTAN_TEST_API int botan_tls_channel_type(botan_tls_channel_t chan); - -BOTAN_TEST_API int botan_tls_channel_send(botan_tls_channel_t chan, - const uint8_t input[], size_t len); - -BOTAN_TEST_API int botan_tls_channel_close(botan_tls_channel_t chan); - -BOTAN_TEST_API int botan_tls_channel_destroy(botan_tls_channel_t chan); - -#endif #ifdef __cplusplus } #endif diff --git a/src/lib/utils/compiler.h b/src/lib/utils/compiler.h index 9348909e8..c515e0507 100644 --- a/src/lib/utils/compiler.h +++ b/src/lib/utils/compiler.h @@ -6,7 +6,7 @@ */ /* This header is included in both C++ and C (via ffi.h) and should only - contain macro definitions. + contain macro definitions. Avoid C++ style // comments in this file. */ #ifndef BOTAN_UTIL_COMPILER_FLAGS_H_ @@ -105,7 +105,7 @@ #define BOTAN_DEPRECATED(msg) __declspec(deprecated(msg)) #elif defined(__GNUG__) - // msg supported since GCC 4.5, earliest we support is 4.8 + /* msg supported since GCC 4.5, earliest we support is 4.8 */ #define BOTAN_DEPRECATED(msg) __attribute__ ((deprecated(msg))) #endif |