continue;
}
- switch(buf[0] >> 4) {
+ switch (buf[0] >> 4) {
case 4:
iplen = load_be16(buf + 2);
break;
/* Nothing to do here for Cisco DTLS as it is preauthenticated */
if (vpninfo->dtls_state == DTLS_CONNECTED) {
/* First, see if there's a response for us. */
- while(readable) {
+ while (readable) {
int receive_mtu = MAX(16384, vpninfo->ip_info.mtu);
int len;
int tos;
/* Extract TOS field from IP header (IPv4 and IPv6 differ) */
- switch(pkt->data[0] >> 4) {
+ switch (pkt->data[0] >> 4) {
case 4:
tos = pkt->data[1];
break;
const char *enctype, *mactype;
char enckey[256], mackey[256];
- switch(vpninfo->esp_enc) {
+ switch (vpninfo->esp_enc) {
case ENC_AES_128_CBC:
enctype = "AES-128-CBC (RFC3602)";
break;
default:
return -EINVAL;
}
- switch(vpninfo->esp_hmac) {
+ switch (vpninfo->esp_hmac) {
case HMAC_MD5:
mactype = "HMAC-MD5-96 (RFC2403)";
break;
unsigned char hash[64]; /* Enough for a SHA256 */
gnutls_mac_algorithm_t alg;
- switch(vpninfo->oath_hmac_alg) {
+ switch (vpninfo->oath_hmac_alg) {
case OATH_ALG_HMAC_SHA1:
alg = GNUTLS_MAC_SHA1;
hpos = 19;
gnutls_privkey_init(pkey);
- switch(ret) {
+ switch (ret) {
case GNUTLS_PK_RSA:
#if GNUTLS_VERSION_NUMBER >= 0x030600
gnutls_privkey_import_ext4(*pkey, certinfo, NULL, tpm2_rsa_sign_hash_fn, NULL, NULL, rsa_key_info, 0);
int oc_pad_rsasig(struct openconnect_info *vpninfo, gnutls_sign_algorithm_t algo,
unsigned char *buf, int size, const gnutls_datum_t *data, int keybits)
{
- switch(algo) {
+ switch (algo) {
case GNUTLS_SIGN_UNKNOWN:
case GNUTLS_SIGN_RSA_SHA1:
case GNUTLS_SIGN_RSA_SHA256:
const char *hierarchy_name;
ESYS_TR hierarchy;
- switch(certinfo->tpm2->parent) {
+ switch (certinfo->tpm2->parent) {
case TPM2_RH_OWNER: hierarchy = ESYS_TR_RH_OWNER; hierarchy_name = _("owner"); break;
case TPM2_RH_NULL: hierarchy = ESYS_TR_RH_NULL; hierarchy_name = _("null"); break;
case TPM2_RH_ENDORSEMENT:hierarchy = ESYS_TR_RH_ENDORSEMENT; hierarchy_name = _("endorsement"); break;
certinfo->tpm2->need_userauth = !emptyauth;
certinfo->tpm2->legacy_srk = legacy;
- switch(certinfo->tpm2->pub.publicArea.type) {
+ switch (certinfo->tpm2->pub.publicArea.type) {
case TPM2_ALG_RSA: return GNUTLS_PK_RSA;
case TPM2_ALG_ECC: return GNUTLS_PK_ECC;
}
goto err_out;
}
- switch(certinfo->tpm2->pub.publicArea.type) {
+ switch (certinfo->tpm2->pub.publicArea.type) {
case TPM_ALG_RSA: return GNUTLS_PK_RSA;
case TPM_ALG_ECC: return GNUTLS_PK_ECC;
}
int openconnect_set_compression_mode(struct openconnect_info *vpninfo,
oc_compression_mode_t mode)
{
- switch(mode) {
+ switch (mode) {
case OC_COMPRESSION_MODE_NONE:
vpninfo->req_compr = 0;
return 0;
printf("%sRSA software token", sep);
sep = comma;
}
- switch(openconnect_has_oath_support()) {
+ switch (openconnect_has_oath_support()) {
case 2:
printf("%sHOTP software token", sep);
sep = comma;
if (token_str && (token_mode == OC_TOKEN_MODE_TOTP ||
token_mode == OC_TOKEN_MODE_HOTP)) {
- switch(token_str[0]) {
+ switch (token_str[0]) {
case '@':
token_str++;
/* fall through... */
break;
case OC_TOKEN_MODE_YUBIOATH:
- switch(ret) {
+ switch (ret) {
case 0:
return;
case -ENOENT:
store_be32(out + 1, d);
- switch(len) {
+ switch (len) {
case 8:
return 5;
case 7:
if (!token_str)
return -ENOENT;
- switch(token_str[0]) {
+ switch (token_str[0]) {
case '@':
token_str++;
/* fall through */
char buf[80];
int i;
- switch(GRP_ATTR(group, attr)) {
+ switch (GRP_ATTR(group, attr)) {
case GRP_ATTR(6, 2):
if (attrlen != 4) {
badlen:
/* Need at least 6 bytes of payload to check the IP packet length */
if (vpninfo->cstp_pkt->len < 26)
continue;
- switch(vpninfo->cstp_pkt->data[0] >> 4) {
+ switch (vpninfo->cstp_pkt->data[0] >> 4) {
case 4:
iplen = load_be16(vpninfo->cstp_pkt->data + 2);
break;
#define vpn_progress(_v, lvl, ...) do { \
if ((_v)->verbose >= (lvl)) \
(_v)->progress((_v)->cbdata, lvl, __VA_ARGS__); \
- } while(0)
+ } while (0)
#define vpn_perror(vpninfo, msg) vpn_progress((vpninfo), PRG_ERR, "%s: %s\n", (msg), strerror(errno))
#ifdef _WIN32
#define __unmonitor_fd(_v, _n) do { CloseHandle(_v->_n##_event); \
_v->_n##_event = (HANDLE)0; \
- } while(0)
+ } while (0)
#else
#define __unmonitor_fd(_v, _n) do { \
__remove_epoll_fd(_v, _v->_n##_fd); \
- _v->_n##_epoll = 0; } while(0)
+ _v->_n##_epoll = 0; } while (0)
#else /* !HAVE_POLL */
-#define __unmonitor_fd(_v, _n) do { } while(0)
+#define __unmonitor_fd(_v, _n) do { } while (0)
#endif
static inline void __monitor_fd_event(struct openconnect_info *vpninfo,
unmonitor_write_fd(_v, _n); \
unmonitor_except_fd(_v, _n); \
__unmonitor_fd(_v, _n); \
- } while(0)
+ } while (0)
/* Key material for DTLS-PSK */
#define PSK_LABEL "EXPORTER-openconnect-psk"
if ((vpninfo)->verbose >= PRG_DEBUG) { \
do_dump_buf(vpninfo, prefix, buf); \
} \
- } while(0)
+ } while (0)
#define dump_buf_hex(vpninfo, loglevel, prefix, buf, len) do { \
if ((vpninfo)->verbose >= (loglevel)) { \
do_dump_buf_hex(vpninfo, loglevel, prefix, buf, len); \
} \
- } while(0)
+ } while (0)
/* http-auth.c */
void *openconnect_base64_decode(int *len, const char *in);
if (res == NULL) return -ENOMEM; \
} else res = NULL; \
} \
- } while(0)
+ } while (0)
#define UTF8CHECK(arg) \
do { \
__func__, #arg); \
return -EILSEQ; \
} \
- } while(0)
+ } while (0)
#define UTF8CHECK_VOID(arg) \
do { \
__func__, #arg); \
return; \
} \
- } while(0)
+ } while (0)
/* Let's stop open-coding big-endian and little-endian loads/stores.
*
unsigned int hashlen = sizeof(hash);
const EVP_MD *alg;
- switch(vpninfo->oath_hmac_alg) {
+ switch (vpninfo->oath_hmac_alg) {
case OATH_ALG_HMAC_SHA1:
alg = EVP_sha1();
break;
static long ttls_ctrl_func(BIO *b, int cmd, long larg, void *iarg)
{
- switch(cmd) {
+ switch (cmd) {
case BIO_CTRL_FLUSH:
return 1;
default:
int work_done = 0;
time_t now = time(NULL);
- switch(vpninfo->dtls_state) {
+ switch (vpninfo->dtls_state) {
case DTLS_CONNECTING:
if (vpninfo->ppp->ppp_state == PPPS_DEAD)
vpninfo->delay_tunnel_reason = "DTLS connecting";
case DTLS_CONNECTED:
/* First, see if there's a response for us. */
- while(readable) {
+ while (readable) {
int receive_mtu = MAX(16384, vpninfo->ip_info.mtu);
int len;
goto bad_pkt;
}
- switch(load_be32(bytes + 0x20)) {
+ switch (load_be32(bytes + 0x20)) {
case 0x2c20f000:
case 0x2e20f000: /* Variant seen on Pulse 9.1R14 */
ret = handle_main_config_packet(vpninfo, bytes, config_len);
vpninfo->ssl_times.last_rx = time(NULL);
len = payload_len + 0x10;
- switch(load_be32(&pkt->pulse.type)) {
+ switch (load_be32(&pkt->pulse.type)) {
case 4:
vpn_progress(vpninfo, PRG_TRACE,
_("Received data packet of %d bytes\n"),
}
if (token_str) {
- switch(token_str[0]) {
+ switch (token_str[0]) {
case '@':
token_str++;
/* fall through */