[COMPR_LZO] = "LZO",
};
-const char *openconnect_get_cstp_compression(struct openconnect_info * vpninfo)
+const char *openconnect_get_cstp_compression(struct openconnect_info *vpninfo)
{
if (vpninfo->cstp_compr <= 0 || vpninfo->cstp_compr > COMPR_MAX)
return NULL;
return compr_name_map[vpninfo->cstp_compr];
}
-const char *openconnect_get_dtls_compression(struct openconnect_info * vpninfo)
+const char *openconnect_get_dtls_compression(struct openconnect_info *vpninfo)
{
if (vpninfo->dtls_compr <= 0 || vpninfo->dtls_compr > COMPR_MAX)
return NULL;
int lzs_compress(unsigned char *dst, int dstlen, const unsigned char *src, int srclen);
/* ssl.c */
-unsigned string_is_hostname(const char* str);
+unsigned string_is_hostname(const char *str);
int connect_https_socket(struct openconnect_info *vpninfo);
int __attribute__ ((format(printf, 4, 5)))
request_passphrase(struct openconnect_info *vpninfo, const char *label,
static EVP_MD_CTX *handshake_sha1;
#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
-static inline HMAC_CTX *HMAC_CTX_new(void) {
+static inline HMAC_CTX *HMAC_CTX_new(void)
+{
HMAC_CTX *ret = malloc(sizeof(*ret));
HMAC_CTX_init(ret);
return ret;
}
-static inline void HMAC_CTX_free(HMAC_CTX *ctx) {
+static inline void HMAC_CTX_free(HMAC_CTX *ctx)
+{
HMAC_CTX_cleanup(ctx);
free(ctx);
}
/* I always coded as if it worked like this. Now it does. */
#define realloc_inplace(p, size) do { \
- void *__realloc_old = p; \
- p = realloc(p, size); \
- if (size && !p) \
- free(__realloc_old); \
- } while (0)
+ void *__realloc_old = p; \
+ p = realloc(p, size); \
+ if (size && !p) \
+ free(__realloc_old); \
+ } while (0)
struct oc_packed_uint32_t {
uint32_t d;
#define BUFTEST
#include "../textbuf.c"
-#define assert(x) if (!(x)) { \
- fprintf(stderr, "assert(%s) failed at line %d\n", #x, __LINE__); \
- exit(1); }
+#define assert(x) do { \
+ if (!(x)) { \
+ fprintf(stderr, \
+ "assert(%s) failed at line %d\n", \
+ #x, __LINE__); \
+ exit(1); \
+ } \
+ } while (0)
static char testbytes[OC_BUF_MAX];
unsigned short d;
} __attribute__((packed));
-int lzs_decompress(unsigned char *dst, int dstlen, const unsigned char *src, int srclen);
-int lzs_compress(unsigned char *dst, int dstlen, const unsigned char *src, int srclen);
-
-#include "../lzs.c"
+#include "../lzs.c" /* lzs_decompress() / lzs_compress() */
#include <stdio.h>
#include <stdlib.h>
do {
sc.sc_unit = unit_nr + 1;
- if (!connect(tun_fd, (struct sockaddr * )&sc, sizeof(sc))) {
+ if (!connect(tun_fd, (struct sockaddr *)&sc, sizeof(sc))) {
if (!vpninfo->ifname &&
asprintf(&vpninfo->ifname, "utun%d", unit_nr) == -1) {
vpn_progress(vpninfo, PRG_ERR,