Remove unnecessary parens in return statements

This commit is contained in:
William Robinet 2023-08-16 15:40:29 +02:00
parent f395a3a3ce
commit ba9410dac5
No known key found for this signature in database
GPG key ID: 003FA3DF74C7A949
25 changed files with 263 additions and 263 deletions

View file

@ -84,20 +84,20 @@ abort:
if(_status) {
network_handler_destroy(mod, &handler);
}
return (_status);
return _status;
}
int network_handler_destroy(proto_mod *mod, n_handler **handlerp) {
n_handler *handler = 0;
if(!handlerp || !*handlerp)
return (0);
return 0;
handler = *handlerp;
mod->vtbl->destroy_ctx(mod->handle, &handler->ctx);
free(*handlerp);
*handlerp = 0;
return (0);
return 0;
}
int network_process_packet(n_handler *handler,
@ -124,7 +124,7 @@ int network_process_packet(n_handler *handler,
printf(
"Malformed packet, packet too small to contain IP header, skipping "
"...\n");
return (0);
return 0;
}
memset(&p.i_addr.so_st, 0x0, sizeof(struct sockaddr_storage));
@ -145,7 +145,7 @@ int network_process_packet(n_handler *handler,
if((off & 0x1fff) || /*Later fragment*/
(off & 0x2000)) { /*More fragments*/
/* fprintf(stderr,"Fragmented packet! rejecting\n"); */
return (0);
return 0;
}
hlen = p.l3_hdr.ip->ip_hl * 4;
@ -157,7 +157,7 @@ int network_process_packet(n_handler *handler,
printf(
"Malformed packet, size from IP header is larger than size "
"reported by libpcap, skipping ...\n");
return (0);
return 0;
}
if(p.len == 0) {
@ -190,7 +190,7 @@ int network_process_packet(n_handler *handler,
printf(
"Malformed packet, size from IP header is larger than size "
"reported by libpcap, skipping ...\n");
return (0);
return 0;
}
if(p.len == 0) {
@ -210,7 +210,7 @@ int network_process_packet(n_handler *handler,
break;
}
return (0);
return 0;
}
int packet_copy(packet *in, packet **out) {
@ -239,16 +239,16 @@ abort:
if(_status) {
packet_destroy(p);
}
return (_status);
return _status;
}
int packet_destroy(packet *p) {
if(!p)
return (0);
return 0;
FREE(p->base);
FREE(p);
return (0);
return 0;
}
int timestamp_diff(struct timeval *t1,
@ -263,7 +263,7 @@ int timestamp_diff(struct timeval *t1,
if(t0->tv_usec <= t1->tv_usec) {
diff->tv_sec = t1->tv_sec - t0->tv_sec;
diff->tv_usec = t1->tv_usec - t0->tv_usec;
return (0);
return 0;
}
/*Hard case*/
@ -273,7 +273,7 @@ int timestamp_diff(struct timeval *t1,
diff->tv_sec = t1->tv_sec - (t0->tv_sec + 1);
diff->tv_usec = 1000000 - d;
return (0);
return 0;
}
int lookuphostname(struct sockaddr_storage *so_st, char **namep) {
@ -295,7 +295,7 @@ int lookuphostname(struct sockaddr_storage *so_st, char **namep) {
inet_ntop(so_st->ss_family, addr, *namep, INET6_ADDRSTRLEN);
}
return (0);
return 0;
}
int addrtotext(struct sockaddr_storage *so_st, char **namep) {
@ -309,5 +309,5 @@ int addrtotext(struct sockaddr_storage *so_st, char **namep) {
}
inet_ntop(so_st->ss_family, addr, *namep, INET6_ADDRSTRLEN);
return (0);
return 0;
}

View file

@ -546,7 +546,7 @@ char *collapse_args(int argc, char **argv) {
char *ret;
if(!argc)
return (0);
return 0;
for(i = 0; i < argc; i++) {
len += strlen(argv[i]) + 1;
@ -564,5 +564,5 @@ char *collapse_args(int argc, char **argv) {
ret[len++] = ' ';
}
return (ret);
return ret;
}

View file

@ -53,7 +53,7 @@ int explain(char *format, ...) {
vprintf(format, ap);
va_end(ap);
return (0);
return 0;
}
int exdump(name, data) char *name;
@ -82,5 +82,5 @@ Data *data;
INDENT_POP;
if(data->len > 8 && i % 12)
LF;
return (0);
return 0;
}

View file

@ -69,15 +69,15 @@ abort:
if(_status) {
destroy_proto_handler(&handler);
}
return (_status);
return _status;
}
int destroy_proto_handler(proto_handler **handlerp) {
if(!handlerp || !*handlerp)
return (0);
return 0;
(*handlerp)->vtbl->destroy(&(*handlerp)->obj);
free(*handlerp);
*handlerp = 0;
return (0);
return 0;
}

View file

@ -64,7 +64,7 @@ static int zero_conn PROTO_LIST((tcp_conn * conn));
static int zero_conn(tcp_conn *conn) {
memset(conn, 0, sizeof(tcp_conn));
return (0);
return 0;
}
int tcp_find_conn(tcp_conn **connp,
@ -81,7 +81,7 @@ int tcp_find_conn(tcp_conn **connp,
!memcmp(daddr, &conn->conn.r_addr, sizeof(struct sockaddr_storage))) {
*directionp = DIR_I2R;
*connp = &(conn->conn);
return (0);
return 0;
}
}
@ -90,12 +90,12 @@ int tcp_find_conn(tcp_conn **connp,
!memcmp(daddr, &conn->conn.i_addr, sizeof(struct sockaddr_storage))) {
*directionp = DIR_R2I;
*connp = &(conn->conn);
return (0);
return 0;
}
}
}
return (R_NOT_FOUND);
return R_NOT_FOUND;
}
int tcp_create_conn(tcp_conn **connp,
@ -106,7 +106,7 @@ int tcp_create_conn(tcp_conn **connp,
conn_struct *conn = 0;
if(!(conn = (conn_struct *)malloc(sizeof(conn_struct))))
return (R_NO_MEMORY);
return R_NO_MEMORY;
conn->prev = 0;
@ -126,7 +126,7 @@ int tcp_create_conn(tcp_conn **connp,
first_conn->prev = conn;
first_conn = conn;
return (0);
return 0;
}
int tcp_destroy_conn(tcp_conn *conn) {
@ -153,7 +153,7 @@ int tcp_destroy_conn(tcp_conn *conn) {
free(conn->backptr);
free(conn);
return (0);
return 0;
}
int clean_old_conn(void) {
@ -198,7 +198,7 @@ int free_tcp_segment_queue(segment *seg) {
seg = tmp;
}
return (0);
return 0;
}
int copy_tcp_segment_queue(segment **out, segment *in) {
@ -221,5 +221,5 @@ abort:
if(_status) {
free_tcp_segment_queue(base);
}
return (_status);
return _status;
}

View file

@ -94,12 +94,12 @@ int process_tcp_packet(proto_mod *handler, proto_ctx *ctx, packet *p) {
if((p->tcp->th_flags & TH_SYN) != TH_SYN) {
DBG((0, "TCP: rejecting packet from unknown connection, seq: %u\n",
ntohl(p->tcp->th_seq)));
return (0);
return 0;
}
if((r = new_connection(handler, ctx, p, &conn)))
ABORT(r);
return (0);
return 0;
}
stream = direction == DIR_R2I ? &conn->r2i : &conn->i2r;
@ -155,7 +155,7 @@ int process_tcp_packet(proto_mod *handler, proto_ctx *ctx, packet *p) {
_status = 0;
abort:
return (_status);
return _status;
}
static int new_connection(proto_mod *handler,
@ -194,7 +194,7 @@ static int new_connection(proto_mod *handler,
*connp = conn;
_status = 0;
abort:
return (_status);
return _status;
}
/*#define STRIM(_seq,s) { \
@ -235,13 +235,13 @@ static int process_data_segment(tcp_conn *conn,
fprintf(stderr,
"Malformed packet, computed TCP segment size is negative, skipping "
"...\n");
return (0);
return 0;
}
if(stream->close) {
DBG((0, "Rejecting packet received after FIN: %u:%u(%u)",
ntohl(p->tcp->th_seq), ntohl(p->tcp->th_seq + l), l));
return (0);
return 0;
}
/*The idea here is to pass all available segments
@ -278,7 +278,7 @@ static int process_data_segment(tcp_conn *conn,
/* Check to see if this packet has been processed already */
right_edge = seq + (p->len - (p->tcp->th_off) * 4);
if(!(p->tcp->th_flags & (TH_RST)) && SEQ_LT(right_edge, stream->seq))
return (0);
return 0;
if(SEQ_LT(stream->seq, seq)) {
/* Out of order segment */
@ -380,7 +380,7 @@ static int process_data_segment(tcp_conn *conn,
_status = 0;
abort:
return (_status);
return _status;
}
static int print_tcp_packet(packet *p) {
@ -389,7 +389,7 @@ static int print_tcp_packet(packet *p) {
struct timeval *ts = &p->ts;
if(!(NET_print_flags & NET_PRINT_TCP_HDR))
return (0);
return 0;
lookuphostname(&p->i_addr.so_st, &src);
lookuphostname(&p->r_addr.so_st, &dst);
@ -422,7 +422,7 @@ static int print_tcp_packet(packet *p) {
}
free(src);
free(dst);
return (0);
return 0;
}
int STRIM(UINT4 _seq, segment *s) {
@ -457,5 +457,5 @@ int STRIM(UINT4 _seq, segment *s) {
}
}
return (0);
return 0;
}

View file

@ -72,7 +72,7 @@
if(!_r) \
_r = -1; \
REPORT_ERROR_("ERETURN", _r); \
return (_r); \
return _r; \
} while(0)
#endif

View file

@ -56,7 +56,7 @@ int debug(int class, char *format, ...) {
vfprintf(stderr, format, ap);
fprintf(stderr, "\n");
va_end(ap);
return (0);
return 0;
}
int xdump(char *name, UCHAR *data, int len) {
@ -73,5 +73,5 @@ int xdump(char *name, UCHAR *data, int len) {
}
if(i % 12)
printf("\n");
return (0);
return 0;
}

View file

@ -102,7 +102,7 @@ abort:
if(_status) {
r_assoc_destroy(&assoc);
}
return (_status);
return _status;
}
int r_assoc_destroy(r_assoc **assocp) {
@ -110,7 +110,7 @@ int r_assoc_destroy(r_assoc **assocp) {
int i;
if(!assocp || !*assocp)
return (0);
return 0;
assoc = *assocp;
for(i = 0; i < assoc->size; i++)
@ -119,7 +119,7 @@ int r_assoc_destroy(r_assoc **assocp) {
free(assoc->chains);
free(assoc);
return (0);
return 0;
}
static int destroy_assoc_chain(r_assoc_el *chain) {
@ -137,7 +137,7 @@ static int destroy_assoc_chain(r_assoc_el *chain) {
chain = nxt;
}
return (0);
return 0;
}
static int copy_assoc_chain(r_assoc_el **newp, r_assoc_el *old) {
@ -146,7 +146,7 @@ static int copy_assoc_chain(r_assoc_el **newp, r_assoc_el *old) {
if(!old) {
*newp = 0;
return (0);
return 0;
}
for(; old; old = old->next) {
if(!(tmp = (r_assoc_el *)calloc(sizeof(r_assoc_el), 1)))
@ -182,7 +182,7 @@ abort:
if(_status) {
destroy_assoc_chain(new);
}
return (_status);
return _status;
}
static int r_assoc_fetch_bucket(r_assoc *assoc,
@ -197,11 +197,11 @@ static int r_assoc_fetch_bucket(r_assoc *assoc,
for(bucket = assoc->chains[hash_value]; bucket; bucket = bucket->next) {
if(bucket->key_len == len && !memcmp(bucket->key, key, len)) {
*bucketp = bucket;
return (0);
return 0;
}
}
return (R_NOT_FOUND);
return R_NOT_FOUND;
}
int r_assoc_fetch(r_assoc *assoc, char *key, int len, void **datap) {
@ -211,11 +211,11 @@ int r_assoc_fetch(r_assoc *assoc, char *key, int len, void **datap) {
if((r = r_assoc_fetch_bucket(assoc, key, len, &bucket))) {
if(r != R_NOT_FOUND)
ERETURN(r);
return (r);
return r;
}
*datap = bucket->data;
return (0);
return 0;
}
int r_assoc_insert(r_assoc *assoc,
@ -267,7 +267,7 @@ abort:
free(new_bucket->key);
free(new_bucket);
}
return (_status);
return _status;
}
int r_assoc_copy(r_assoc **newp, r_assoc *old) {
@ -292,7 +292,7 @@ abort:
if(_status) {
r_assoc_destroy(&new);
}
return (_status);
return _status;
}
int r_assoc_init_iter(r_assoc *assoc, r_assoc_iterator *iter) {
@ -313,7 +313,7 @@ int r_assoc_init_iter(r_assoc *assoc, r_assoc_iterator *iter) {
}
}
return (0);
return 0;
}
int r_assoc_iter(r_assoc_iterator *iter, void **key, int *keyl, void **val) {
@ -321,7 +321,7 @@ int r_assoc_iter(r_assoc_iterator *iter, void **key, int *keyl, void **val) {
r_assoc_el *ret;
if(!iter->next)
return (R_EOD);
return R_EOD;
ret = iter->next;
*key = ret->key;
@ -348,7 +348,7 @@ int r_assoc_iter(r_assoc_iterator *iter, void **key, int *keyl, void **val) {
}
}
return (0);
return 0;
}
/* Delete the last returned value*/
@ -368,7 +368,7 @@ int r_assoc_iter_delete(r_assoc_iterator *iter) {
iter->prev->destroy(iter->prev->data);
free(iter->prev->data);
free(iter->prev);
return (0);
return 0;
}
/*This is a hack from AMS. Supposedly, it's pretty good for strings, even
@ -381,5 +381,5 @@ hash_compute(char *key, int len, int bits) {
h &= (1 << bits) - 1;
return (h);
return h;
}

View file

@ -124,5 +124,5 @@ int fetch_test(r_assoc *assoc) {
exit(1);
}
}
return (0);
return 0;
}

View file

@ -32,14 +32,14 @@ abort:
if(_status) {
r_bitfield_destroy(&set);
}
return (_status);
return _status;
}
int r_bitfield_destroy(r_bitfield **setp) {
r_bitfield *set;
if(!setp || !*setp)
return (0);
return 0;
set = *setp;
@ -47,7 +47,7 @@ int r_bitfield_destroy(r_bitfield **setp) {
RFREE(set);
*setp = 0;
return (0);
return 0;
}
int r_bitfield_set(r_bitfield *set, int bit) {
@ -77,7 +77,7 @@ int r_bitfield_set(r_bitfield *set, int bit) {
_status = 0;
abort:
return (_status);
return _status;
}
int r_bitfield_isset(r_bitfield *set, int bit) {
@ -86,11 +86,11 @@ int r_bitfield_isset(r_bitfield *set, int bit) {
int _status;
if(bit < set->base)
return (0);
return 0;
/* Resize? */
if(word > set->len)
return (0);
return 0;
return (set->data[word] & (1 << bbit));
return set->data[word] & (1 << bbit);
}

View file

@ -66,7 +66,7 @@ abort:
if(_status)
r_data_destroy(&d_);
return (_status);
return _status;
}
int r_data_alloc(Data **dp, int l) {
@ -86,7 +86,7 @@ abort:
if(_status)
r_data_destroy(&d_);
return (_status);
return _status;
}
int r_data_make(Data *dp, UCHAR *d, int l) {
@ -96,12 +96,12 @@ int r_data_make(Data *dp, UCHAR *d, int l) {
memcpy(dp->data, d, l);
dp->len = l;
return (0);
return 0;
}
int r_data_destroy(Data **dp) {
if(!dp || !*dp)
return (0);
return 0;
if((*dp)->data)
free((*dp)->data);
@ -109,30 +109,30 @@ int r_data_destroy(Data **dp) {
free(*dp);
*dp = 0;
return (0);
return 0;
}
int r_data_copy(Data *dst, Data *src) {
if(!(dst->data = (UCHAR *)malloc(src->len)))
ERETURN(R_NO_MEMORY);
memcpy(dst->data, src->data, dst->len = src->len);
return (0);
return 0;
}
int r_data_zfree(Data *d) {
if(!d)
return (0);
return 0;
if(!d->data)
return (0);
return 0;
memset(d->data, 0, d->len);
free(d->data);
return (0);
return 0;
}
int r_data_compare(Data *d1, Data *d2) {
if(d1->len < d2->len)
return (-1);
return -1;
if(d2->len < d1->len)
return (-1);
return (memcmp(d1->data, d2->data, d1->len));
return -1;
return memcmp(d1->data, d2->data, d1->len);
}

View file

@ -73,7 +73,7 @@ int r_list_create(r_list **listp) {
_status = 0;
abort:
return (_status);
return _status;
}
int r_list_destroy(r_list **listp) {
@ -81,7 +81,7 @@ int r_list_destroy(r_list **listp) {
r_list_el *el;
if(!listp || !*listp)
return (0);
return 0;
list = *listp;
el = list->first;
@ -99,7 +99,7 @@ int r_list_destroy(r_list **listp) {
free(list);
*listp = 0;
return (0);
return 0;
}
int r_list_copy(r_list **outp, r_list *in) {
@ -138,7 +138,7 @@ int r_list_copy(r_list **outp, r_list *in) {
abort:
if(_status)
r_list_destroy(&out);
return (_status);
return _status;
}
int r_list_insert(list, value, copy, destroy) r_list *list;
@ -164,7 +164,7 @@ int(*destroy) PROTO_LIST((void **val));
_status = 0;
abort:
return (_status);
return _status;
}
int r_list_append(list, value, copy, destroy) r_list *list;
@ -193,22 +193,22 @@ int(*destroy) PROTO_LIST((void **val));
_status = 0;
abort:
return (_status);
return _status;
}
int r_list_init_iter(r_list *list, r_list_iterator *iter) {
iter->list = list;
iter->ptr = list->first;
return (0);
return 0;
}
int r_list_iter(r_list_iterator *iter, void **val) {
if(!iter->ptr)
return (R_EOD);
return R_EOD;
*val = iter->ptr->data;
iter->ptr = iter->ptr->next;
return (0);
return 0;
}

View file

@ -53,10 +53,10 @@ char *strdup(char *str) {
char *n;
if(!(n = (char *)malloc(len + 1)))
return (0);
return 0;
memcpy(n, str, len + 1);
return (n);
return n;
}
#endif

View file

@ -94,7 +94,7 @@ int r_timeval_diff(struct timeval *t1,
if(t0->tv_usec <= t1->tv_usec) {
diff->tv_sec = t1->tv_sec - t0->tv_sec;
diff->tv_usec = t1->tv_usec - t0->tv_usec;
return (0);
return 0;
}
/*Hard case*/
@ -104,7 +104,7 @@ int r_timeval_diff(struct timeval *t1,
diff->tv_sec = t1->tv_sec - (t0->tv_sec + 1);
diff->tv_usec = 1000000 - d;
return (0);
return 0;
}
int r_timeval_add(struct timeval *t1, struct timeval *t2, struct timeval *sum) {
@ -123,7 +123,7 @@ int r_timeval_add(struct timeval *t1, struct timeval *t2, struct timeval *sum) {
sum->tv_sec = tv_sec;
sum->tv_usec = tv_usec;
return (0);
return 0;
}
UINT8

View file

@ -31,7 +31,7 @@ static void *r_thread_real_create(void *arg) {
thread_count--;
free(h);
return (0);
return 0;
}
int r_thread_fork(func, arg, id) void(*func) PROTO_LIST((void *));
@ -52,7 +52,7 @@ r_thread *id;
_status = 0;
abort:
return (_status);
return _status;
}
int r_thread_yield(void) {
@ -62,7 +62,7 @@ int r_thread_yield(void) {
int r_thread_exit(void) {
thread_count--;
pthread_exit(0);
return (0);
return 0;
}
int r_thread_wait_last(void) {
@ -72,7 +72,7 @@ int r_thread_wait_last(void) {
DBG((0, "%d threads left", thread_count));
} while(thread_count);
return (0);
return 0;
}
int r_rwlock_create(r_rwlock **lockp) {
@ -86,20 +86,20 @@ int r_rwlock_create(r_rwlock **lockp) {
ERETURN(R_INTERNAL);
*lockp = (void *)lock;
return (0);
return 0;
}
int r_rwlock_destroy(r_rwlock **lock) {
pthread_rwlock_t *plock;
if(!lock || !*lock)
return (0);
return 0;
plock = (pthread_rwlock_t *)(*lock);
pthread_rwlock_destroy(plock);
return (0);
return 0;
}
int r_rwlock_lock(r_rwlock *lock, int action) {
@ -127,5 +127,5 @@ int r_rwlock_lock(r_rwlock *lock, int action) {
_status = 0;
abort:
return (_status);
return _status;
}

View file

@ -83,7 +83,7 @@ static int create_null_analyzer(void *handle,
DBG((0, "Creating analyzer for connection %d\n", obj->num));
*objp = (proto_obj *)obj;
return (0);
return 0;
}
int destroy_null_analyzer(proto_obj **objp) {
@ -92,7 +92,7 @@ int destroy_null_analyzer(proto_obj **objp) {
#endif
if(!objp || !*objp)
return (0);
return 0;
#ifdef DEBUG
obj = (null_analyzer *)*objp;
@ -102,7 +102,7 @@ int destroy_null_analyzer(proto_obj **objp) {
free(*objp);
*objp = 0;
return (0);
return 0;
}
int data_null_analyzer(proto_obj *_obj, segment *seg, int direction) {
@ -127,7 +127,7 @@ int data_null_analyzer(proto_obj *_obj, segment *seg, int direction) {
printf("====\n");
}
return (0);
return 0;
}
int fin_null_analyzer(proto_obj *_obj, packet *p, int direction) {
@ -135,7 +135,7 @@ int fin_null_analyzer(proto_obj *_obj, packet *p, int direction) {
null_analyzer *obj = (null_analyzer *)_obj;
#endif
DBG((0, "Received FIN on connection %d\n", obj->num));
return (0);
return 0;
}
static struct proto_mod_vtbl_ null_vtbl = {

View file

@ -92,21 +92,21 @@ abort:
if(_status) {
destroy_pcap_logger((proto_obj **)&pcap_obj);
}
return (_status);
return _status;
}
static int destroy_pcap_logger(proto_obj **objp) {
logpkt_ctx_t *pcap_obj;
if(!objp || !*objp)
return (0);
return 0;
pcap_obj = (logpkt_ctx_t *)*objp;
free(pcap_obj);
*objp = 0;
return (0);
return 0;
}
static int data_pcap_logger(proto_obj *_obj,

View file

@ -238,7 +238,7 @@ int ssl_find_cipher(int num, SSL_CipherSuite **cs) {
for(c = CipherSuites; c->number != -1; c++) {
if(c->number == num) {
*cs = c;
return (0);
return 0;
}
}

View file

@ -29,7 +29,7 @@ static int decode_ContentType_ChangeCipherSpec(ssl_obj *ssl,
}
LF;
return (0);
return 0;
}
static int decode_ContentType_Alert(ssl_obj *ssl,
int dir,
@ -40,7 +40,7 @@ static int decode_ContentType_Alert(ssl_obj *ssl,
if(ssl->record_encryption == REC_CIPHERTEXT) {
LF;
return (0);
return 0;
}
if(data->len != 2) {
@ -64,7 +64,7 @@ static int decode_ContentType_Alert(ssl_obj *ssl,
0);
LF;
}
return (0);
return 0;
}
static int decode_ContentType_Handshake(ssl_obj *ssl,
int dir,
@ -79,7 +79,7 @@ static int decode_ContentType_Handshake(ssl_obj *ssl,
if(ssl->record_encryption == REC_CIPHERTEXT) {
LF;
return (0);
return 0;
}
while(data->len > 0) {
@ -108,7 +108,7 @@ static int decode_ContentType_Handshake(ssl_obj *ssl,
}
ssl_decode_switch(ssl, HandshakeType_decoder, t, dir, seg, &d);
}
return (0);
return 0;
}
static int decode_ContentType_application_data(ssl_obj *ssl,
int dir,
@ -131,7 +131,7 @@ static int decode_ContentType_application_data(ssl_obj *ssl,
else {
LF;
}
return (0);
return 0;
}
decoder ContentType_decoder[] = {
{20, "ChangeCipherSpec", decode_ContentType_ChangeCipherSpec},
@ -150,7 +150,7 @@ static int decode_HandshakeType_HelloRequest(ssl_obj *ssl,
json_object_new_string("HelloRequest"));
LF;
return (0);
return 0;
}
static int decode_HandshakeType_ClientHello(ssl_obj *ssl,
int dir,
@ -218,7 +218,7 @@ static int decode_HandshakeType_ClientHello(ssl_obj *ssl,
for(; cslen; cslen -= 2) {
if(ssl_decode_enum(ssl, 0, 2, cipher_suite_decoder, 0, data, &cs))
return (1);
return 1;
ssl_print_cipher_suite(ssl, (vj << 8) | vn, P_HL, cs);
if(!ja3_cs_str)
ja3_cs_str = calloc(7, 1);
@ -335,7 +335,7 @@ static int decode_HandshakeType_ClientHello(ssl_obj *ssl,
free(ja3_ec_str);
free(ja3_ecp_str);
return (0);
return 0;
}
static int decode_HandshakeType_ServerHello(ssl_obj *ssl,
int dir,
@ -477,7 +477,7 @@ static int decode_HandshakeType_ServerHello(ssl_obj *ssl,
free(ja3s_c_str);
free(ja3s_ex_str);
return (0);
return 0;
}
static int decode_HandshakeType_Certificate(ssl_obj *ssl,
int dir,
@ -528,7 +528,7 @@ static int decode_HandshakeType_Certificate(ssl_obj *ssl,
}
}
return (0);
return 0;
}
static int decode_HandshakeType_SessionTicket(ssl_obj *ssl,
@ -630,7 +630,7 @@ static int decode_HandshakeType_ServerKeyExchange(ssl_obj *ssl,
SSL_DECODE_OPAQUE_ARRAY(ssl, "signature", -((1 << 15) - 1), P_ND, data, 0);
}
return (0);
return 0;
}
static int decode_HandshakeType_CertificateRequest(ssl_obj *ssl,
int dir,
@ -664,7 +664,7 @@ static int decode_HandshakeType_CertificateRequest(ssl_obj *ssl,
INDENT_POP;
len -= (ca.len + 2);
}
return (0);
return 0;
}
static int decode_HandshakeType_ServerHelloDone(ssl_obj *ssl,
int dir,
@ -677,7 +677,7 @@ static int decode_HandshakeType_ServerHelloDone(ssl_obj *ssl,
LF;
ssl_update_handshake_messages(ssl, data);
return (0);
return 0;
}
static int decode_HandshakeType_CertificateVerify(ssl_obj *ssl,
int dir,
@ -697,7 +697,7 @@ static int decode_HandshakeType_CertificateVerify(ssl_obj *ssl,
SSL_DECODE_UINT16(ssl, "signature_type", P_HL, data, &signature_type);
}
SSL_DECODE_OPAQUE_ARRAY(ssl, "Signature", -((1 << 15) - 1), P_HL, data, 0);
return (0);
return 0;
}
static int decode_HandshakeType_ClientKeyExchange(ssl_obj *ssl,
int dir,
@ -733,7 +733,7 @@ static int decode_HandshakeType_ClientKeyExchange(ssl_obj *ssl,
ssl_process_client_key_exchange(ssl, ssl->decoder, NULL, 0);
}
}
return (0);
return 0;
}
static int decode_HandshakeType_Finished(ssl_obj *ssl,
int dir,
@ -761,7 +761,7 @@ static int decode_HandshakeType_Finished(ssl_obj *ssl,
}
ssl_process_handshake_finished(ssl, ssl->decoder, data);
return (0);
return 0;
}
static int decode_HandshakeType_KeyUpdate(ssl_obj *ssl,
@ -1193,7 +1193,7 @@ static int decode_AlertLevel_warning(ssl_obj *ssl,
jobj = ssl->cur_json_st;
json_object_object_add(jobj, "alert_level",
json_object_new_string("warning"));
return (0);
return 0;
}
static int decode_AlertLevel_fatal(ssl_obj *ssl,
int dir,
@ -1202,7 +1202,7 @@ static int decode_AlertLevel_fatal(ssl_obj *ssl,
struct json_object *jobj;
jobj = ssl->cur_json_st;
json_object_object_add(jobj, "alert_level", json_object_new_string("fatal"));
return (0);
return 0;
}
decoder AlertLevel_decoder[] = {{1, "warning", decode_AlertLevel_warning},
{2, "fatal", decode_AlertLevel_fatal},
@ -1212,139 +1212,139 @@ static int decode_AlertDescription_close_notify(ssl_obj *ssl,
int dir,
segment *seg,
Data *data) {
return (0);
return 0;
}
static int decode_AlertDescription_unexpected_message(ssl_obj *ssl,
int dir,
segment *seg,
Data *data) {
return (0);
return 0;
}
static int decode_AlertDescription_bad_record_mac(ssl_obj *ssl,
int dir,
segment *seg,
Data *data) {
return (0);
return 0;
}
static int decode_AlertDescription_decryption_failed(ssl_obj *ssl,
int dir,
segment *seg,
Data *data) {
return (0);
return 0;
}
static int decode_AlertDescription_record_overflow(ssl_obj *ssl,
int dir,
segment *seg,
Data *data) {
return (0);
return 0;
}
static int decode_AlertDescription_decompression_failure(ssl_obj *ssl,
int dir,
segment *seg,
Data *data) {
return (0);
return 0;
}
static int decode_AlertDescription_handshake_failure(ssl_obj *ssl,
int dir,
segment *seg,
Data *data) {
return (0);
return 0;
}
static int decode_AlertDescription_bad_certificate(ssl_obj *ssl,
int dir,
segment *seg,
Data *data) {
return (0);
return 0;
}
static int decode_AlertDescription_unsupported_certificate(ssl_obj *ssl,
int dir,
segment *seg,
Data *data) {
return (0);
return 0;
}
static int decode_AlertDescription_certificate_revoked(ssl_obj *ssl,
int dir,
segment *seg,
Data *data) {
return (0);
return 0;
}
static int decode_AlertDescription_certificate_expired(ssl_obj *ssl,
int dir,
segment *seg,
Data *data) {
return (0);
return 0;
}
static int decode_AlertDescription_certificate_unknown(ssl_obj *ssl,
int dir,
segment *seg,
Data *data) {
return (0);
return 0;
}
static int decode_AlertDescription_illegal_parameter(ssl_obj *ssl,
int dir,
segment *seg,
Data *data) {
return (0);
return 0;
}
static int decode_AlertDescription_unknown_ca(ssl_obj *ssl,
int dir,
segment *seg,
Data *data) {
return (0);
return 0;
}
static int decode_AlertDescription_access_denied(ssl_obj *ssl,
int dir,
segment *seg,
Data *data) {
return (0);
return 0;
}
static int decode_AlertDescription_decode_error(ssl_obj *ssl,
int dir,
segment *seg,
Data *data) {
return (0);
return 0;
}
static int decode_AlertDescription_decrypt_error(ssl_obj *ssl,
int dir,
segment *seg,
Data *data) {
return (0);
return 0;
}
static int decode_AlertDescription_export_restriction(ssl_obj *ssl,
int dir,
segment *seg,
Data *data) {
return (0);
return 0;
}
static int decode_AlertDescription_protocol_version(ssl_obj *ssl,
int dir,
segment *seg,
Data *data) {
return (0);
return 0;
}
static int decode_AlertDescription_insufficient_security(ssl_obj *ssl,
int dir,
segment *seg,
Data *data) {
return (0);
return 0;
}
static int decode_AlertDescription_internal_error(ssl_obj *ssl,
int dir,
segment *seg,
Data *data