name
stringlengths 1
473k
| code
stringlengths 7
647k
| asm
stringlengths 4
3.39M
| file
stringlengths 8
196
|
---|---|---|---|
dlep_base_proto_radio_init | void
dlep_base_proto_radio_init(void) {
_base = dlep_base_proto_init();
dlep_extension_add_processing(_base, true, _radio_signals, ARRAYSIZE(_radio_signals));
oonf_class_extension_add(&_layer2_net_listener);
oonf_class_extension_add(&_layer2_neigh_listener);
oonf_class_extension_add(&_layer2_dst_listener);
_base->cb_session_init_radio = _cb_init_radio;
_base->cb_session_cleanup_radio = _cb_cleanup_radio;
} | pushq %rax
callq 0x21d40
movq %rax, 0x4781b(%rip) # 0x6d768
leaq 0x321dc(%rip), %rdx # 0x58130
movl $0xf, %ecx
movq %rax, %rdi
movl $0x1, %esi
callq 0x22415
leaq 0x3232b(%rip), %rdi # 0x58298
callq 0x11b12
leaq 0x32367(%rip), %rdi # 0x582e0
callq 0x11b12
leaq 0x323a3(%rip), %rdi # 0x58328
callq 0x11b12
movq 0x477d7(%rip), %rax # 0x6d768
leaq 0x14(%rip), %rcx # 0x25fac
movq %rcx, 0x50(%rax)
leaq 0x36(%rip), %rcx # 0x25fd9
movq %rcx, 0x80(%rax)
popq %rax
retq
| /OLSR[P]OONF/src/generic/dlep/ext_base_proto/proto_radio.c |
radio_write_peer_offer | static int
_radio_write_peer_offer(struct dlep_extension *ext __attribute__((unused)), struct dlep_session *session,
const struct oonf_layer2_neigh_key *addr __attribute__((unused))) {
struct dlep_radio_if *radio_if;
struct netaddr local_addr;
#ifdef OONF_LOG_DEBUG_INFO
struct netaddr_str nbuf;
#endif
radio_if = dlep_radio_get_by_layer2_if(session->l2_listener.data->name);
if (!radio_if || &radio_if->interf.session != session) {
/* unknown type of session, ignore */
return 0;
}
OONF_DEBUG(session->log_source, "Local IPv4 socket: %s",
netaddr_socket_to_string(&nbuf, &radio_if->tcp.socket_v4.local_socket));
netaddr_from_socket(&local_addr, &radio_if->tcp.socket_v4.local_socket);
if (netaddr_get_address_family(&local_addr) == AF_INET) {
/* no support for TLS at the moment */
dlep_writer_add_ipv4_conpoint_tlv(&session->writer, &local_addr, radio_if->tcp_config.port, false);
}
OONF_DEBUG(session->log_source, "Local IPv6 socket: %s",
netaddr_socket_to_string(&nbuf, &radio_if->tcp.socket_v6.local_socket));
netaddr_from_socket(&local_addr, &radio_if->tcp.socket_v6.local_socket);
if (netaddr_get_address_family(&local_addr) == AF_INET6) {
/* no support for TLS at the moment */
dlep_writer_add_ipv6_conpoint_tlv(&session->writer, &local_addr, radio_if->tcp_config.port, false);
}
return 0;
} | pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rsi, %rbx
movq 0x150(%rsi), %rdi
addq $0xc, %rdi
callq 0x26cca
movq %rax, %r14
testq %rax, %rax
sete %al
cmpq %rbx, %r14
setne %cl
orb %al, %cl
jne 0x26183
movl 0x130(%rbx), %r15d
leaq 0x4785c(%rip), %r12 # 0x6d8d0
testb $0x1, (%r12,%r15)
je 0x260bf
leaq 0xbc0(%r14), %rsi
leaq 0x1a(%rsp), %rdi
callq 0x2967a
movq %rax, %r10
leaq 0x16cf2(%rip), %r11 # 0x3cd88
leaq 0x16cbd(%rip), %rdx # 0x3cd5a
movl $0x1, %edi
movl %r15d, %esi
movl $0x1c5, %ecx # imm = 0x1C5
xorl %r8d, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
pushq %r10
pushq %r11
callq 0x2efff
addq $0x10, %rsp
leaq 0xbc0(%r14), %rsi
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x28a25
cmpb $0x2, 0x10(%r15)
jne 0x260f5
leaq 0xc8(%rbx), %rdi
movzwl 0x1050(%r14), %edx
leaq 0x8(%rsp), %rsi
xorl %ecx, %ecx
callq 0x25bac
movl 0x130(%rbx), %r15d
testb $0x1, (%r12,%r15)
je 0x26147
leaq 0xd60(%r14), %rsi
leaq 0x1a(%rsp), %rdi
callq 0x2967a
movq %rax, %r10
leaq 0x16c80(%rip), %r11 # 0x3cd9e
leaq 0x16c35(%rip), %rdx # 0x3cd5a
movl $0x1, %edi
movl %r15d, %esi
movl $0x1cd, %ecx # imm = 0x1CD
xorl %r8d, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
pushq %r10
pushq %r11
callq 0x2efff
addq $0x10, %rsp
movq %r14, %rsi
addq $0xd60, %rsi # imm = 0xD60
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x28a25
cmpb $0xa, 0x10(%r15)
jne 0x26183
addq $0xc8, %rbx
movzwl 0x1050(%r14), %edx
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x25bfe
xorl %eax, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
| /OLSR[P]OONF/src/generic/dlep/ext_base_proto/proto_radio.c |
radio_process_session_update_ack | static int
_radio_process_session_update_ack(struct dlep_extension *ext __attribute__((unused)), struct dlep_session *session) {
dlep_base_proto_print_status(session);
if (session->_peer_state == DLEP_PEER_SEND_UPDATE) {
if (dlep_session_generate_signal(session, DLEP_SESSION_UPDATE, NULL)) {
// TODO: do we need to terminate here?
return DLEP_NEW_PARSER_INTERNAL_ERROR;
}
session->_peer_state = DLEP_PEER_WAIT_FOR_UPDATE_ACK;
}
else {
session->_peer_state = DLEP_PEER_IDLE;
}
return DLEP_NEW_PARSER_OKAY;
} | pushq %rbx
movq %rsi, %rbx
movq %rsi, %rdi
callq 0x21e07
movl $0x4, %eax
cmpl $0x3, 0x318(%rbx)
jne 0x26554
movq %rbx, %rdi
movl $0x3, %esi
xorl %edx, %edx
callq 0x24bc9
movl %eax, %ecx
movl $0xfffffff7, %eax # imm = 0xFFFFFFF7
testl %ecx, %ecx
jne 0x2655c
movl $0x2, %eax
movl %eax, 0x318(%rbx)
xorl %eax, %eax
popq %rbx
retq
| /OLSR[P]OONF/src/generic/dlep/ext_base_proto/proto_radio.c |
l2_neigh_added | static void
_l2_neigh_added(struct oonf_layer2_neigh *l2neigh, struct oonf_layer2_destination *l2dest,
const struct oonf_layer2_neigh_key *mac) {
struct dlep_radio_if *radio_if;
struct dlep_radio_session *radio_session;
radio_if = dlep_radio_get_by_layer2_if(l2neigh->network->name);
if (!radio_if) {
return;
}
avl_for_each_element(&radio_if->interf.session_tree, radio_session, _node) {
if (l2dest && !radio_session->session.cfg.send_proxied) {
continue;
}
if (!l2dest && !radio_session->session.cfg.send_neighbors) {
continue;
}
_l2_neigh_added_to_session(&radio_session->session, l2neigh, mac);
}
} | pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq 0x28(%rdi), %rdi
callq 0x26cca
testq %rax, %rax
je 0x26803
movq %rax, %r15
movq 0xb88(%rax), %r12
movq 0x8(%r12), %rax
cmpq 0xb90(%r15), %rax
je 0x26803
cmpb $0x1, -0x360(%r12)
jne 0x267fd
leaq -0x378(%r12), %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x26654
movq (%r12), %r12
jmp 0x267d1
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
| /OLSR[P]OONF/src/generic/dlep/ext_base_proto/proto_radio.c |
l2_neigh_removed | static void
_l2_neigh_removed(
struct oonf_layer2_neigh *l2neigh, struct oonf_layer2_destination *l2dest, const struct oonf_layer2_neigh_key *mac) {
struct dlep_radio_if *radio_if;
struct dlep_radio_session *radio_session;
struct dlep_local_neighbor *local;
radio_if = dlep_radio_get_by_layer2_if(l2neigh->network->name);
if (!radio_if) {
return;
}
avl_for_each_element(&radio_if->interf.session_tree, radio_session, _node) {
if (l2dest && !radio_session->session.cfg.send_proxied) {
continue;
}
if (!l2dest && !radio_session->session.cfg.send_neighbors) {
continue;
}
local = dlep_session_get_local_neighbor(&radio_session->session, mac);
if (!local) {
continue;
}
/*
if ((l2dest && memcmp(&l2neigh->key, &local->neigh_key, sizeof(l2neigh->key)) == 0) ||
(!l2dest && netaddr_is_unspec(&local->neigh_key.addr))) {
*/
dlep_session_generate_signal(&radio_session->session, DLEP_DESTINATION_DOWN, mac);
local->state = DLEP_NEIGHBOR_DOWN_SENT;
oonf_timer_set(&local->_ack_timeout, radio_session->session.cfg.heartbeat_interval * 2);
// }
}
} | pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq 0x28(%rdi), %rdi
callq 0x26cca
testq %rax, %rax
je 0x269c8
movq %rax, %r14
movq 0xb88(%rax), %r12
movq 0x8(%r12), %rax
cmpq 0xb90(%r14), %rax
je 0x269c8
cmpb $0x1, -0x360(%r12)
jne 0x269c2
leaq -0x298(%r12), %rdi
movq %rbx, %rsi
callq 0x2780e
testq %rax, %rax
je 0x269c2
movq %rax, %r15
leaq -0x378(%r12), %rdi
movl $0xb, %esi
movq %rbx, %rdx
callq 0x24bc9
movl $0x3, -0xbc(%r15)
addq $-0x88, %r15
movq -0x368(%r12), %rdx
addq %rdx, %rdx
movq %r15, %rdi
movq %rdx, %rsi
callq 0x17806
movq (%r12), %r12
jmp 0x26954
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
| /OLSR[P]OONF/src/generic/dlep/ext_base_proto/proto_radio.c |
dlep_radio_interface_cleanup | void
dlep_radio_interface_cleanup(void) {
struct dlep_radio_if *interf, *it;
avl_for_each_element_safe(dlep_if_get_tree(true), interf, interf._node, it) {
dlep_radio_remove_interface(interf);
}
oonf_class_remove(&_interface_class);
dlep_radio_session_cleanup();
dlep_extension_cleanup();
} | pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl $0x1, %edi
callq 0x22d34
movq (%rax), %rbx
movq (%rbx), %r14
movq 0x8(%rbx), %r15
movl $0x1, %edi
callq 0x22d34
cmpq 0x8(%rax), %r15
je 0x26c27
movq %r14, %r15
addq $-0xb50, %rbx # imm = 0xF4B0
movq %rbx, %rdi
callq 0x26c48
movq (%r14), %r14
movq 0x8(%r15), %r12
movl $0x1, %edi
callq 0x22d34
movq %r15, %rbx
cmpq 0x8(%rax), %r12
jne 0x26bfb
leaq 0x3230a(%rip), %rdi # 0x58f38
callq 0x11820
callq 0x26efc
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x22345
| /OLSR[P]OONF/src/generic/dlep/radio/dlep_radio_interface.c |
dlep_radio_add_interface | struct dlep_radio_if *
dlep_radio_add_interface(const char *ifname) {
struct dlep_radio_if *interface;
interface = dlep_radio_get_by_layer2_if(ifname);
if (interface) {
return interface;
}
interface = oonf_class_malloc(&_interface_class);
if (!interface) {
return NULL;
}
if (dlep_if_add(&interface->interf, ifname, &_l2_origin, &_l2_default_origin, NULL, LOG_DLEP_RADIO, true)) {
oonf_class_free(&_interface_class, interface);
return NULL;
}
/* configure TCP server socket */
interface->tcp.config.session_timeout = 120000; /* 120 seconds */
interface->tcp.config.maximum_input_buffer = 4096;
interface->tcp.config.allowed_sessions = 3;
dlep_radio_session_initialize_tcp_callbacks(&interface->tcp.config);
oonf_stream_add_managed(&interface->tcp);
return interface;
} | pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movl $0x1, %edi
callq 0x22d34
movq %rax, %rdi
movq %r14, %rsi
callq 0x2780e
leaq -0xb50(%rax), %rbx
testq %rax, %rax
cmoveq %rax, %rbx
jne 0x26e17
leaq 0x321b0(%rip), %rdi # 0x58f38
callq 0x11933
testq %rax, %rax
je 0x26dd5
movq %rax, %rbx
leaq 0x469d4(%rip), %rax # 0x6d770
movl (%rax), %r9d
movl $0x1, (%rsp)
leaq 0x3221b(%rip), %rdx # 0x58fc8
leaq 0x32264(%rip), %rcx # 0x59018
movq %rbx, %rdi
movq %r14, %rsi
xorl %r8d, %r8d
callq 0x22d49
testl %eax, %eax
je 0x26dd9
leaq 0x3216b(%rip), %rdi # 0x58f38
movq %rbx, %rsi
callq 0x11a5f
xorl %ebx, %ebx
jmp 0x26e17
leaq 0xbb0(%rbx), %r14
movq %rbx, %rdi
addq $0xef0, %rdi # imm = 0xEF0
movq $0x1d4c0, 0xf00(%rbx) # imm = 0x1D4C0
movq $0x1000, 0xf08(%rbx) # imm = 0x1000
movl $0x3, 0xef8(%rbx)
callq 0x26f08
movq %r14, %rdi
callq 0x15c24
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
| /OLSR[P]OONF/src/generic/dlep/radio/dlep_radio_interface.c |
abuf_memcpy | int
abuf_memcpy(struct autobuf *autobuf, const void *p, const size_t len) {
if (autobuf == NULL || len == 0)
return 0;
if (_autobuf_enlarge(autobuf, autobuf->_len + len) < 0) {
return -1;
}
memcpy(autobuf->_buf + autobuf->_len, p, len);
autobuf->_len += len;
/* null-terminate autobuf */
autobuf->_buf[autobuf->_len] = 0;
return 0;
} | pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
sete %al
testq %rdx, %rdx
sete %cl
xorl %ebx, %ebx
orb %al, %cl
jne 0x27542
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %r15
movq 0x8(%rdi), %rsi
addq %rdx, %rsi
callq 0x273c7
testl %eax, %eax
js 0x2753d
movq 0x10(%r15), %rdi
addq 0x8(%r15), %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x11380
addq 0x8(%r15), %r14
movq %r14, 0x8(%r15)
movq 0x10(%r15), %rax
movb $0x0, (%rax,%r14)
jmp 0x27542
movl $0xffffffff, %ebx # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
| /OLSR[P]OONF/src/libcommon/autobuf.c |
abuf_pull | void
abuf_pull(struct autobuf *autobuf, size_t len) {
char *p;
size_t newsize;
if (autobuf == NULL || len == 0)
return;
if (len != autobuf->_len) {
memmove(autobuf->_buf, &autobuf->_buf[len], autobuf->_len - len);
}
autobuf->_len -= len;
if (autobuf->_len + getpagesize() > autobuf->_total) {
/* only reduce buffer size if difference is larger than a chunk */
return;
}
newsize = autobuf->_total -= getpagesize();
if (newsize < (size_t)getpagesize()) {
newsize = getpagesize();
}
/* generate smaller buffer */
p = realloc(autobuf->_buf, newsize);
if (p == NULL) {
/* keep the longer buffer if we cannot get a smaller one */
return;
}
autobuf->_buf = p;
autobuf->_total = newsize;
return;
} | testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x27641
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rdi), %rdx
subq %rsi, %rdx
je 0x275fa
movq 0x10(%rbx), %rdi
leaq (%rdi,%r14), %rsi
callq 0x114a0
movq 0x8(%rbx), %r15
subq %r14, %r15
movq %r15, 0x8(%rbx)
callq 0x11520
cltq
addq %rax, %r15
movq (%rbx), %r14
cmpq %r14, %r15
ja 0x2763c
subq %rax, %r14
movq %r14, (%rbx)
cmpq %rax, %r14
cmovbeq %rax, %r14
movq 0x10(%rbx), %rdi
movq %r14, %rsi
callq 0x11450
testq %rax, %rax
je 0x2763c
movq %rax, 0x10(%rbx)
movq %r14, (%rbx)
popq %rbx
popq %r14
popq %r15
retq
| /OLSR[P]OONF/src/libcommon/autobuf.c |
avl_comp_int32 | int
avl_comp_int32(const void *k1, const void *k2) {
const int32_t *i1 = k1;
const int32_t *i2 = k2;
if (*i1 > *i2) {
return 1;
}
if (*i2 > *i1) {
return -1;
}
return 0;
} | movl (%rdi), %eax
movl (%rsi), %ecx
xorl %edx, %edx
cmpl %eax, %ecx
setg %dl
negl %edx
cmpl %ecx, %eax
movl $0x1, %eax
cmovlel %edx, %eax
retq
| /OLSR[P]OONF/src/libcommon/avl_comp.c |
avl_find_greaterequal | struct avl_node *
avl_find_greaterequal(const struct avl_tree *tree, const void *key) {
struct avl_node *node, *next;
int diff;
if (tree->root == NULL)
return NULL;
node = _avl_find_rec(tree->root, key, tree->comp, &diff);
/* go right as long as key>node.key */
while (diff > 0) {
if (list_is_last(&tree->list_head, &node->list)) {
return NULL;
}
node = (struct avl_node *)node->list.next;
diff = (*tree->comp)(key, node->key);
}
/* go left as long as key<=next_node.key */
next = node;
while (diff <= 0) {
node = next;
if (list_is_first(&tree->list_head, &node->list)) {
break;
}
next = (struct avl_node *)node->list.prev;
diff = (*tree->comp)(key, next->key);
}
return node;
} | pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x10(%rdi), %rdi
testq %rdi, %rdi
je 0x2799d
movq %rsi, %rbx
movq 0x20(%r14), %rdx
leaq 0x4(%rsp), %r15
movq %r15, %rcx
callq 0x27845
movq %rax, %r12
cmpl $0x0, (%r15)
jle 0x2796f
xorl %r15d, %r15d
cmpq %r12, 0x8(%r14)
je 0x279a0
movq (%r12), %r12
movq 0x28(%r12), %rsi
movq %rbx, %rdi
callq *0x20(%r14)
movl %eax, 0x4(%rsp)
testl %eax, %eax
jg 0x27951
cmpl $0x0, 0x4(%rsp)
jle 0x27993
movq %r12, %r15
jmp 0x279a0
movq 0x8(%r15), %r12
movq 0x28(%r12), %rsi
movq %rbx, %rdi
callq *0x20(%r14)
movl %eax, 0x4(%rsp)
testl %eax, %eax
jg 0x279a0
movq %r12, %r15
cmpq %r12, (%r14)
jne 0x2797b
jmp 0x279a0
xorl %r15d, %r15d
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
| /OLSR[P]OONF/src/libcommon/avl.c |
avl_post_remove | static void
_avl_post_remove(struct avl_tree *tree, struct avl_node *node) {
struct avl_node *parent;
if ((parent = node->parent) == NULL)
return;
if (node == parent->left) {
parent->balance++;
if (parent->balance == 0) {
_avl_post_remove(tree, parent);
return;
}
if (parent->balance == 1)
return;
if (parent->right->balance == 0) {
_avl_rotate_left(tree, parent);
return;
}
if (parent->right->balance == 1) {
_avl_rotate_left(tree, parent);
_avl_post_remove(tree, parent->parent);
return;
}
_avl_rotate_right(tree, parent->right);
_avl_rotate_left(tree, parent);
_avl_post_remove(tree, parent->parent);
return;
}
parent->balance--;
if (parent->balance == 0) {
_avl_post_remove(tree, parent);
return;
}
if (parent->balance == -1)
return;
if (parent->left->balance == 0) {
_avl_rotate_right(tree, parent);
return;
}
if (parent->left->balance == -1) {
_avl_rotate_right(tree, parent);
_avl_post_remove(tree, parent->parent);
return;
}
_avl_rotate_left(tree, parent->left);
_avl_rotate_right(tree, parent);
_avl_post_remove(tree, parent->parent);
} | pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x10(%rsi), %r14
testq %r14, %r14
je 0x27fdd
movq 0x18(%r14), %rax
movb 0x30(%r14), %cl
cmpq %rsi, %rax
je 0x27f9f
movl %ecx, %edx
movq %r14, %rsi
decb %dl
movb %dl, 0x30(%r14)
je 0x27f48
testb %cl, %cl
je 0x27fdd
movzbl 0x30(%rax), %ecx
cmpl $0xff, %ecx
je 0x27f8e
testl %ecx, %ecx
je 0x27fe5
movq %rbx, %rdi
movq %rax, %rsi
callq 0x27ed0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x27e60
movq 0x10(%r14), %rsi
jmp 0x27f48
movl %ecx, %eax
movq %r14, %rsi
incb %al
movb %al, 0x30(%r14)
je 0x27f48
testb %cl, %cl
je 0x27fdd
movq 0x20(%r14), %rsi
movzbl 0x30(%rsi), %eax
cmpl $0x1, %eax
je 0x27fc9
testl %eax, %eax
je 0x27ff7
movq %rbx, %rdi
callq 0x27e60
movq %rbx, %rdi
movq %r14, %rsi
callq 0x27ed0
movq 0x10(%r14), %rsi
jmp 0x27f48
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x27e60
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x27ed0
nopl (%rax)
| /OLSR[P]OONF/src/libcommon/avl.c |
json_printvalue | static void
_json_printvalue(struct autobuf *out, const char *txt, bool delimiter) {
const char *ptr;
bool unprintable;
if (delimiter) {
abuf_puts(out, "\"");
}
else if (*txt == 0) {
abuf_puts(out, "0");
}
ptr = txt;
while (*ptr) {
unprintable = !str_char_is_printable(*ptr);
if (unprintable || *ptr == '\\' || *ptr == '\"') {
if (ptr != txt) {
abuf_memcpy(out, txt, ptr - txt);
}
if (unprintable) {
abuf_appendf(out, "\\u00%02x", (unsigned char)(*ptr++));
}
else {
abuf_appendf(out, "\\%c", *ptr++);
}
txt = ptr;
}
else {
ptr++;
}
}
abuf_puts(out, txt);
if (delimiter) {
abuf_puts(out, "\"");
}
} | pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl %edx, 0x4(%rsp)
testl %edx, %edx
je 0x28767
leaq 0x14fcd(%rip), %rsi # 0x3d732
jmp 0x28774
cmpb $0x0, (%r14)
jne 0x2877c
leaq 0x19701(%rip), %rsi # 0x41e75
movq %rbx, %rdi
callq 0x27362
movb (%r14), %al
testb %al, %al
je 0x28802
leaq 0x14ccf(%rip), %r15 # 0x3d459
leaq 0x14cbf(%rip), %r12 # 0x3d450
movq %r14, %r13
cmpb $0x7f, %al
setne %cl
leal -0x20(%rax), %edx
cmpb $-0x21, %dl
setb %bpl
andb %cl, %bpl
cmpb $0x1, %bpl
jne 0x287b8
cmpb $0x5c, %al
je 0x287b8
movzbl %al, %eax
cmpl $0x22, %eax
jne 0x287fd
movq %r13, %rdx
subq %r14, %rdx
je 0x287cb
movq %rbx, %rdi
movq %r14, %rsi
callq 0x274e4
movzbl (%r13), %edx
testb %bpl, %bpl
je 0x287e0
movsbl %dl, %edx
movq %rbx, %rdi
movq %r15, %rsi
jmp 0x287e6
movq %rbx, %rdi
movq %r12, %rsi
xorl %eax, %eax
callq 0x272d1
incq %r13
movq %r13, %r14
movb (%r13), %al
testb %al, %al
jne 0x28794
jmp 0x28802
incq %r13
jmp 0x287f3
movq %rbx, %rdi
movq %r14, %rsi
callq 0x27362
cmpb $0x0, 0x4(%rsp)
je 0x28831
leaq 0x14f17(%rip), %rsi # 0x3d732
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x27362
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
| /OLSR[P]OONF/src/libcommon/json.c |
netaddr_create_host_bin | int
netaddr_create_host_bin(struct netaddr *host, const struct netaddr *netmask, const void *number, size_t num_length) {
size_t host_index, number_index;
uint8_t host_part_length;
const uint8_t *number_byte;
uint8_t mask;
number_byte = number;
/* copy netmask with prefixlength max */
memcpy(host, netmask, sizeof(*netmask));
host->_prefix_len = netaddr_get_maxprefix(host);
/* unknown address type */
if (host->_prefix_len == 0) {
return -1;
}
/* netmask has no host part */
if (host->_prefix_len == netmask->_prefix_len || num_length == 0) {
return 0;
}
/* calculate starting byte in host and number */
host_part_length = (host->_prefix_len - netmask->_prefix_len + 7) / 8;
if (host_part_length > num_length) {
host_index = host->_prefix_len / 8 - num_length;
number_index = 0;
}
else {
host_index = netmask->_prefix_len / 8;
number_index = num_length - host_part_length;
/* copy bit masked part */
if ((netmask->_prefix_len & 7) != 0) {
mask = (255 >> (netmask->_prefix_len & 7));
host->_addr[host_index] &= (~mask);
host->_addr[host_index] |= (number_byte[number_index++]) & mask;
host_index++;
}
}
/* copy bytes */
memcpy(&host->_addr[host_index], &number_byte[number_index], num_length - number_index);
return 0;
} | movq %rcx, %rax
movups (%rsi), %xmm0
movups %xmm0, (%rdi)
movzwl 0x10(%rsi), %ecx
movw %cx, 0x10(%rdi)
movzbl %cl, %ecx
cmpl $0x2e, %ecx
jg 0x28b05
cmpl $0x2, %ecx
je 0x28b1b
cmpl $0xa, %ecx
jne 0x28b14
movb $-0x80, %r8b
jmp 0x28b23
cmpl $0x2f, %ecx
je 0x28b20
cmpl $0x30, %ecx
jne 0x28b14
movb $0x40, %r8b
jmp 0x28b23
movb $0x1, %cl
xorl %r8d, %r8d
jmp 0x28b25
movb $0x20, %r8b
jmp 0x28b23
movb $0x30, %r8b
xorl %ecx, %ecx
pushq %rbx
movb %r8b, 0x11(%rdi)
movl $0xffffffff, %ebx # imm = 0xFFFFFFFF
testb %cl, %cl
jne 0x28bcd
movzbl 0x11(%rsi), %ecx
cmpb %cl, %r8b
sete %sil
testq %rax, %rax
sete %r9b
xorl %ebx, %ebx
orb %sil, %r9b
jne 0x28bcd
movzbl %r8b, %esi
movl %esi, %r8d
orl $0x7, %r8d
subl %ecx, %r8d
leal 0x7(%r8), %r9d
testl %r8d, %r8d
cmovnsl %r8d, %r9d
shrl $0x3, %r9d
movzbl %r9b, %r9d
movq %rax, %r8
subq %r9, %r8
jae 0x28b84
shrl $0x3, %esi
subq %rax, %rsi
xorl %r8d, %r8d
jmp 0x28bb9
movl %ecx, %esi
shrl $0x3, %esi
andl $0x7, %ecx
je 0x28bb9
movl $0xff, %r9d
shrl %cl, %r9d
movl $0xffffff00, %r10d # imm = 0xFFFFFF00
sarl %cl, %r10d
andb (%rdi,%rsi), %r10b
movb %r10b, (%rdi,%rsi)
andb (%rdx,%r8), %r9b
incq %r8
orb %r10b, %r9b
movb %r9b, (%rdi,%rsi)
incq %rsi
addq %rsi, %rdi
addq %r8, %rdx
subq %r8, %rax
movq %rdx, %rsi
movq %rax, %rdx
callq 0x11380
movl %ebx, %eax
popq %rbx
retq
| /OLSR[P]OONF/src/libcommon/netaddr.c |
netaddr_to_prefixstring | const char *
netaddr_to_prefixstring(struct netaddr_str *dst, const struct netaddr *src, bool forceprefix) {
static const char *NONE = "-";
const char *result = NULL;
int maxprefix;
if (!src) {
return strscpy(dst->buf, NONE, sizeof(*dst));
}
maxprefix = netaddr_get_maxprefix(src);
switch (src->_type) {
case AF_INET:
result = inet_ntop(AF_INET, src->_addr, dst->buf, sizeof(*dst));
break;
case AF_INET6:
result = inet_ntop(AF_INET6, src->_addr, dst->buf, sizeof(*dst));
break;
case AF_MAC48:
result = _mac_to_string(dst->buf, sizeof(*dst), src->_addr, 6, ':');
break;
case AF_EUI64:
result = _mac_to_string(dst->buf, sizeof(*dst), src->_addr, 8, '-');
break;
case AF_UUID:
result = _uuid_to_string(dst->buf, sizeof(*dst), src->_addr, 16);
break;
case AF_UNSPEC:
/* fall through */
default:
return strscpy(dst->buf, NONE, sizeof(*dst));
}
if (forceprefix || src->_prefix_len < maxprefix) {
/* append prefix */
snprintf(dst->buf + strlen(result), 5, "/%d", src->_prefix_len);
}
return result;
} | pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
testq %rsi, %rsi
je 0x28f9b
movl %edx, %r8d
movq %rsi, %r14
movzbl 0x10(%rsi), %eax
cmpl $0x2e, %eax
jg 0x28e79
cmpl $0x2, %eax
je 0x28e8c
cmpl $0xa, %eax
jne 0x28e88
movb $-0x80, %dil
jmp 0x28e94
cmpl $0x2f, %eax
je 0x28e91
cmpl $0x30, %eax
jne 0x28e88
movb $0x40, %dil
jmp 0x28e94
xorl %edi, %edi
jmp 0x28e94
movb $0x20, %dil
jmp 0x28e94
movb $0x30, %dil
cmpl $0x2e, %eax
jle 0x28f80
cmpl $0x2f, %eax
je 0x28fbd
cmpl $0x30, %eax
je 0x28ffa
movl %edi, 0x4(%rsp)
cmpl $0x31, %eax
jne 0x28f9b
movl %r8d, (%rsp)
movl $0x3e, %eax
xorl %r15d, %r15d
leaq 0x14891(%rip), %rdx # 0x3d760
xorl %esi, %esi
movq %rbx, %rdi
movq %r14, %r8
testq %rax, %rax
je 0x28f73
leaq 0x147e9(%rip), %rcx # 0x3d6d0
movq (%rcx,%rsi,8), %r10
movq %r10, %r9
shrq %r9
movq %rdi, %r11
cmpq $0x3, %rax
jb 0x28f42
leaq -0x1(%r9), %r13
leaq -0x2(%rax), %r12
xorl %ecx, %ecx
movq %rdi, %r11
movzbl (%r8,%rcx), %ebp
shrl $0x4, %ebp
movb (%rbp,%rdx), %bpl
movb %bpl, (%r11)
movzbl (%r8,%rcx), %ebp
andl $0xf, %ebp
movb (%rbp,%rdx), %bpl
movb %bpl, 0x1(%r11)
addq $0x2, %r11
cmpq %rcx, %r13
je 0x28f42
incq %rcx
leaq -0x2(%r12), %rbp
cmpq $0x2, %r12
movq %rbp, %r12
ja 0x28f07
movb $0x0, (%r11)
testq %rdi, %rdi
je 0x28f73
addq %r10, %rdi
subq %r10, %rax
cmpq $0x4, %rsi
je 0x28f60
movb $0x2d, (%rdi)
incq %rdi
decq %rax
addq %r9, %r8
incq %rsi
cmpq $0x5, %rsi
jne 0x28ed7
movq %rbx, %r15
movl (%rsp), %r8d
movl 0x4(%rsp), %edi
jmp 0x29060
movl %edi, %r12d
cmpl $0x2, %eax
je 0x2903f
cmpl $0xa, %eax
jne 0x28f9b
movl $0xa, %edi
jmp 0x29044
leaq 0x1471e(%rip), %rsi # 0x3d6c0
movl $0x3e, %edx
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x29d98
xorl %eax, %eax
leaq 0x1479a(%rip), %rcx # 0x3d760
movq %r14, %rdx
movzbl (%rdx), %esi
shrl $0x4, %esi
movb (%rsi,%rcx), %sil
movb %sil, (%rbx,%rax)
movzbl (%rdx), %esi
andl $0xf, %esi
movb (%rsi,%rcx), %sil
movb %sil, 0x1(%rbx,%rax)
movb $0x3a, 0x2(%rbx,%rax)
incq %rdx
addq $0x3, %rax
cmpq $0x12, %rax
jne 0x28fc9
jmp 0x29035
xorl %eax, %eax
leaq 0x1475d(%rip), %rcx # 0x3d760
movq %r14, %rdx
movzbl (%rdx), %esi
shrl $0x4, %esi
movb (%rsi,%rcx), %sil
movb %sil, (%rbx,%rax)
movzbl (%rdx), %esi
andl $0xf, %esi
movb (%rsi,%rcx), %sil
movb %sil, 0x1(%rbx,%rax)
movb $0x2d, 0x2(%rbx,%rax)
incq %rdx
addq $0x3, %rax
cmpq $0x18, %rax
jne 0x29006
movb $0x0, -0x1(%rbx,%rax)
movq %rbx, %r15
jmp 0x29060
movl $0x2, %edi
movq %r14, %rsi
movq %rbx, %rdx
movl $0x3e, %ecx
movl %r8d, %ebp
callq 0x11030
movl %ebp, %r8d
movq %rax, %r15
movl %r12d, %edi
testb %r8b, %r8b
jne 0x2906b
cmpb %dil, 0x11(%r14)
jae 0x29091
movq %r15, %rdi
callq 0x111a0
addq %rax, %rbx
movzbl 0x11(%r14), %ecx
leaq 0xecfc(%rip), %rdx # 0x37d7e
movl $0x5, %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x111e0
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
| /OLSR[P]OONF/src/libcommon/netaddr.c |
uuid_from_string | static int
_uuid_from_string(void *bin, size_t bin_size, const char *src) {
static const size_t max_group_len[5] = { 8, 4, 4, 4, 12 };
char buffer[32 + 4 + 1];
char *current_group, *next_group, *_bin;
size_t i;
if (bin_size < 16) {
return -1;
}
if (strlen(src) > 32 + 4) {
return -1;
}
strscpy(buffer, src, sizeof(buffer));
_bin = bin;
current_group = buffer;
for (i = 0; i < ARRAYSIZE(max_group_len); i++) {
next_group = strchr(current_group, '-');
if (next_group) {
/* zero terminate current group */
*next_group++ = 0;
}
else if (i != ARRAYSIZE(max_group_len) - 1) {
/* not enough components */
return -1;
}
/* check length */
if (strlen(current_group) != max_group_len[i]) {
return -1;
}
/* parse data, we expect a precise number of hex-numbers */
if (_bin_from_hex(_bin, max_group_len[i] / 2, current_group, 0)) {
return -1;
}
current_group = next_group;
_bin = _bin + max_group_len[i] / 2;
}
return 0;
} | pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r12
movq %rdi, %r14
movq %rsi, %rdi
callq 0x111a0
movl $0xffffffff, %ecx # imm = 0xFFFFFFFF
cmpq $0x24, %rax
ja 0x29669
movq %rsp, %r15
movl $0x25, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x29d98
xorl %r13d, %r13d
leaq 0x140ce(%rip), %rbp # 0x3d6d0
movq %r15, %rdi
movl $0x2d, %esi
callq 0x111d0
testq %rax, %rax
je 0x2961f
movq %rax, %rbx
incq %rbx
movb $0x0, (%rax)
jmp 0x29627
cmpq $0x20, %r13
jne 0x29664
xorl %ebx, %ebx
movq %r15, %rdi
callq 0x111a0
movq (%r13,%rbp), %r12
cmpq %r12, %rax
jne 0x29664
shrq %r12
movq %r14, %rdi
movq %r12, %rsi
movq %r15, %rdx
xorl %ecx, %ecx
callq 0x29487
testl %eax, %eax
jne 0x29664
addq %r12, %r14
addq $0x8, %r13
movq %rbx, %r15
cmpq $0x28, %r13
jne 0x29602
xorl %ecx, %ecx
jmp 0x29669
movl $0xffffffff, %ecx # imm = 0xFFFFFFFF
movl %ecx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
| /OLSR[P]OONF/src/libcommon/netaddr.c |
netaddr_cmp_to_socket | int
netaddr_cmp_to_socket(const struct netaddr *a1, const union netaddr_socket *a2) {
int result = 0;
result = (int)a1->_type - (int)a2->std.sa_family;
if (result) {
return result;
}
if (a1->_type == AF_INET) {
result = memcmp(a1->_addr, &a2->v4.sin_addr, 4);
}
else if (a1->_type == AF_INET6) {
/* ipv6 */
result = memcmp(a1->_addr, &a2->v6.sin6_addr, 16);
}
if (result) {
return result;
}
return (int)a1->_prefix_len - (a1->_type == AF_INET ? 32 : 128);
} | movzbl 0x10(%rdi), %ecx
movzwl (%rsi), %edx
movl %ecx, %eax
subl %edx, %eax
je 0x297cf
retq
xorl %eax, %eax
cmpl $0xa, %ecx
je 0x297f0
cmpl $0x2, %ecx
jne 0x2981f
movl (%rdi), %edx
movl 0x4(%rsi), %esi
bswapl %edx
bswapl %esi
xorl %eax, %eax
cmpl %esi, %edx
seta %al
sbbl $0x0, %eax
jmp 0x2981f
movq (%rdi), %rdx
bswapq %rdx
movq 0x8(%rsi), %r8
bswapq %r8
cmpq %r8, %rdx
jne 0x29815
movq 0x8(%rdi), %rdx
bswapq %rdx
movq 0x10(%rsi), %r8
bswapq %r8
cmpq %r8, %rdx
je 0x2981f
xorl %eax, %eax
cmpq %r8, %rdx
sbbl %eax, %eax
orl $0x1, %eax
testl %eax, %eax
jne 0x297ce
movzbl 0x11(%rdi), %eax
leal -0x80(%rax), %edx
addl $-0x20, %eax
cmpl $0x2, %ecx
cmovnel %edx, %eax
retq
| /OLSR[P]OONF/src/libcommon/netaddr.c |
netaddr_acl_copy | int
netaddr_acl_copy(struct netaddr_acl *to, const struct netaddr_acl *from) {
netaddr_acl_remove(to);
memcpy(to, from, sizeof(*to));
if (to->accept_count) {
to->accept = calloc(to->accept_count, sizeof(struct netaddr));
if (to->accept == NULL) {
return -1;
}
memcpy(to->accept, from->accept, to->accept_count * sizeof(struct netaddr));
}
if (to->reject_count) {
to->reject = calloc(to->reject_count, sizeof(struct netaddr));
if (to->reject == NULL) {
return -1;
}
memcpy(to->reject, from->reject, to->reject_count * sizeof(struct netaddr));
}
return 0;
} | pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rdi
callq 0x11060
movq 0x10(%r14), %rdi
callq 0x11060
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%r14)
movups %xmm0, (%r14)
movq $0x0, 0x20(%r14)
movups (%rbx), %xmm0
movups 0x10(%rbx), %xmm1
movups %xmm0, (%r14)
movups %xmm1, 0x10(%r14)
movq 0x20(%rbx), %rax
movq %rax, 0x20(%r14)
movq 0x8(%r14), %r15
testq %r15, %r15
je 0x29c1b
movl $0x12, %esi
movq %r15, %rdi
callq 0x11330
movq %rax, (%r14)
testq %rax, %rax
je 0x29c51
movq (%rbx), %rsi
addq %r15, %r15
leaq (%r15,%r15,8), %rdx
movq %rax, %rdi
callq 0x11380
movq 0x18(%r14), %r15
xorl %ebp, %ebp
testq %r15, %r15
je 0x29c56
movl $0x12, %esi
movq %r15, %rdi
callq 0x11330
movq %rax, 0x10(%r14)
testq %rax, %rax
je 0x29c51
movq 0x10(%rbx), %rsi
addq %r15, %r15
leaq (%r15,%r15,8), %rdx
movq %rax, %rdi
callq 0x11380
jmp 0x29c56
movl $0xffffffff, %ebp # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
| /OLSR[P]OONF/src/libcommon/netaddr_acl.c |
cfg_cmd_handle_remove | int
cfg_cmd_handle_remove(
struct cfg_instance *instance __attribute__((unused)), struct cfg_db *db, const char *arg, struct autobuf *log) {
struct _parsed_argument pa;
char *ptr;
int result;
/* get temporary copy of argument string */
ptr = strdup(arg);
if (!ptr)
return -1;
/* prepare for cleanup */
result = -1;
if (_do_parse_arg(ptr, &pa, log)) {
goto handle_remove_cleanup;
}
if (pa.entry_value != NULL) {
cfg_append_printable_line(log, "Value is not allowed for remove command: %s", arg);
goto handle_remove_cleanup;
}
if (pa.entry_key != NULL) {
if (!cfg_db_remove_entry(db, pa.section_type, pa.section_name, pa.entry_key)) {
result = 0;
}
else {
cfg_append_printable_line(log, "Cannot remove entry: '%s'\n", arg);
}
goto handle_remove_cleanup;
}
if (pa.section_name) {
if (cfg_db_remove_namedsection(db, pa.section_type, pa.section_name)) {
cfg_append_printable_line(log, "Cannot remove section: '%s'\n", arg);
goto handle_remove_cleanup;
}
}
if (pa.section_type) {
if (cfg_db_remove_sectiontype(db, pa.section_type)) {
cfg_append_printable_line(log, "Cannot remove section: '%s'\n", arg);
goto handle_remove_cleanup;
}
}
result = 0;
handle_remove_cleanup:
free(ptr);
return result;
} | pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rcx, %r15
movq %rdx, %r14
movq %rsi, %r12
movq %rdx, %rdi
callq 0x11550
testq %rax, %rax
je 0x2aab0
movq %rax, %rbx
movq %rsp, %rsi
movq %rax, %rdi
movq %r15, %rdx
callq 0x2a937
movl $0xffffffff, %ebp # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x2aaa6
cmpq $0x0, 0x18(%rsp)
je 0x2aac4
leaq 0x12d75(%rip), %rsi # 0x3d809
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2dfe9
movl $0xffffffff, %ebp # imm = 0xFFFFFFFF
movq %rbx, %rdi
callq 0x11060
jmp 0x2aab5
movl $0xffffffff, %ebp # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%rsp), %rcx
testq %rcx, %rcx
je 0x2aaec
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq %r12, %rdi
callq 0x2bab2
testl %eax, %eax
je 0x2ab29
leaq 0x12d4b(%rip), %rsi # 0x3d835
jmp 0x2aa94
movq 0x8(%rsp), %rdx
testq %rdx, %rdx
je 0x2ab06
movq (%rsp), %rsi
movq %r12, %rdi
callq 0x2b9a9
testl %eax, %eax
jne 0x2ab1d
movq (%rsp), %rsi
xorl %ebp, %ebp
testq %rsi, %rsi
je 0x2aaa6
movq %r12, %rdi
callq 0x2b969
testl %eax, %eax
je 0x2aaa6
leaq 0x12d2c(%rip), %rsi # 0x3d850
jmp 0x2aa94
xorl %ebp, %ebp
jmp 0x2aaa6
| /OLSR[P]OONF/src/libconfig/cfg_cmd.c |
cfg_cmd_handle_get | int
cfg_cmd_handle_get(
struct cfg_instance *instance __attribute__((unused)), struct cfg_db *db, const char *arg, struct autobuf *log) {
struct cfg_section_type *type, *type_it;
struct cfg_named_section *named, *named_it;
struct cfg_entry *entry, *entry_it;
struct _parsed_argument pa;
char *arg_copy, *tmp;
int result;
if (arg == NULL || *arg == 0) {
cfg_append_printable_line(log, "Section types in database:");
CFG_FOR_ALL_SECTION_TYPES(db, type, type_it) {
cfg_append_printable_line(log, "%s", type->type);
}
return 0;
}
arg_copy = strdup(arg);
if (!arg_copy) {
return -1;
}
/* prepare for cleanup */
result = -1;
if (_do_parse_arg(arg_copy, &pa, log)) {
goto handle_get_cleanup;
}
if (pa.entry_value != NULL) {
cfg_append_printable_line(log, "Value is not allowed for view command: %s", arg);
goto handle_get_cleanup;
}
if (pa.entry_key != NULL) {
if (NULL == (entry = cfg_db_find_entry(db, pa.section_type, pa.section_name, pa.entry_key))) {
cfg_append_printable_line(log, "Cannot find data for entry: '%s'\n", arg);
goto handle_get_cleanup;
}
cfg_append_printable_line(log, "Key '%s' has value:", arg);
strarray_for_each_element(&entry->val, tmp) {
cfg_append_printable_line(log, "%s", tmp);
}
result = 0;
goto handle_get_cleanup;
}
if (pa.section_name == NULL) {
type = cfg_db_find_sectiontype(db, pa.section_type);
if (type == NULL || type->names.count == 0) {
cfg_append_printable_line(log, "Cannot find data for section type: %s", arg);
goto handle_get_cleanup;
}
named = avl_first_element(&type->names, named, node);
if (cfg_db_is_named_section(named)) {
cfg_append_printable_line(log, "Named sections in section type: %s", pa.section_type);
CFG_FOR_ALL_SECTION_NAMES(type, named, named_it) {
cfg_append_printable_line(log, "%s", named->name);
}
result = 0;
goto handle_get_cleanup;
}
}
named = cfg_db_find_namedsection(db, pa.section_type, pa.section_name);
if (named == NULL) {
cfg_append_printable_line(log, "Cannot find data for section: %s", arg);
goto handle_get_cleanup;
}
cfg_append_printable_line(log, "Entry keys for section '%s':", arg);
CFG_FOR_ALL_ENTRIES(named, entry, entry_it) {
cfg_append_printable_line(log, "%s", entry->name);
}
result = 0;
handle_get_cleanup:
free(arg_copy);
return result;
} | pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %rbx
movq %rsi, %r12
testq %rdx, %rdx
je 0x2aba8
movq %rdx, %r15
cmpb $0x0, (%rdx)
je 0x2aba8
movq %r15, %rdi
callq 0x11550
testq %rax, %rax
je 0x2abf7
movq %rax, %r14
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
movq %rbx, %rdx
callq 0x2a937
movl $0xffffffff, %ebp # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x2ab9e
cmpq $0x0, 0x20(%rsp)
je 0x2ac0d
leaq 0x12cf7(%rip), %rsi # 0x3d888
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x2dfe9
movq %r14, %rdi
callq 0x11060
jmp 0x2abfc
leaq 0x12cbe(%rip), %rsi # 0x3d86d
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2dfe9
movq (%r12), %rax
movq 0x8(%rax), %rcx
cmpq 0x8(%r12), %rcx
je 0x2abfc
leaq 0x14b59(%rip), %r14 # 0x3f72a
xorl %ebp, %ebp
movq (%rax), %r15
movq 0x38(%rax), %rdx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x2dfe9
movq 0x8(%r15), %rcx
movq %r15, %rax
cmpq 0x8(%r12), %rcx
jne 0x2abd3
jmp 0x2abfc
movl $0xffffffff, %ebp # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x18(%rsp), %rcx
testq %rcx, %rcx
je 0x2acab
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
movq %r12, %rdi
callq 0x2ba66
testq %rax, %rax
je 0x2ad2f
movq %rax, %r12
leaq 0x12c94(%rip), %rsi # 0x3d8d4
xorl %ebp, %ebp
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x2dfe9
movq 0x40(%r12), %r15
testq %r15, %r15
je 0x2ab9e
movq 0x48(%r12), %rax
addq 0x40(%r12), %rax
cmpq %r15, %rax
jbe 0x2ab9e
leaq 0x14ab3(%rip), %r13 # 0x3f72a
xorl %ebp, %ebp
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
xorl %eax, %eax
callq 0x2dfe9
movq %r15, %rdi
callq 0x111a0
addq %rax, %r15
incq %r15
movq 0x48(%r12), %rax
addq 0x40(%r12), %rax
cmpq %r15, %rax
ja 0x2ac79
jmp 0x2ab9e
movq 0x10(%rsp), %r13
testq %r13, %r13
je 0x2ad3b
movq 0x8(%rsp), %rsi
movq %r12, %rdi
movq %r13, %rdx
callq 0x2b987
testq %rax, %rax
je 0x2add4
movq %rax, %r12
leaq 0x12c76(%rip), %rsi # 0x3d952
xorl %ebp, %ebp
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x2dfe9
movq 0x48(%r12), %rax
movq 0x8(%rax), %rcx
cmpq 0x50(%r12), %rcx
je 0x2ab9e
leaq 0x14a24(%rip), %r15 # 0x3f72a
xorl %ebp, %ebp
movq (%rax), %r13
movq 0x38(%rax), %rdx
movq %rbx, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x2dfe9
movq 0x8(%r13), %rcx
movq %r13, %rax
cmpq 0x50(%r12), %rcx
jne 0x2ad08
jmp 0x2ab9e
leaq 0x12b7c(%rip), %rsi # 0x3d8b2
jmp 0x2ab91
movq 0x8(%rsp), %rsi
movq %r12, %rdi
movq %rsi, (%rsp)
callq 0x2780e
leaq 0x12b95(%rip), %rsi # 0x3d8e8
testq %rax, %rax
je 0x2ab91
movq %rax, %rcx
cmpl $0x0, 0x60(%rax)
je 0x2ab91
movq 0x48(%rcx), %rax
cmpq $0x0, 0x38(%rax)
je 0x2acb9
leaq 0x12b8f(%rip), %rsi # 0x3d90e
xorl %ebp, %ebp
movq %rbx, %rdi
movq (%rsp), %rdx
xorl %eax, %eax
movq %rcx, %r13
callq 0x2dfe9
movq 0x48(%r13), %rax
movq 0x8(%rax), %rcx
cmpq 0x50(%r13), %rcx
je 0x2ab9e
leaq 0x1497f(%rip), %r15 # 0x3f72a
xorl %ebp, %ebp
movq (%rax), %r12
movq 0x38(%rax), %rdx
movq %rbx, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x2dfe9
movq 0x8(%r12), %rcx
movq %r12, %rax
cmpq 0x50(%r13), %rcx
jne 0x2adad
jmp 0x2ab9e
leaq 0x12b56(%rip), %rsi # 0x3d931
jmp 0x2ab91
| /OLSR[P]OONF/src/libconfig/cfg_cmd.c |
free_sectiontype | static void
_free_sectiontype(struct cfg_section_type *section) {
struct cfg_named_section *named, *named_it;
/* remove all named sections */
CFG_FOR_ALL_SECTION_NAMES(section, named, named_it) {
_free_namedsection(named);
}
avl_remove(§ion->db->sectiontypes, §ion->node);
free((void *)section->type);
free(section);
} | pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x48(%rdi), %rdi
movq 0x8(%rdi), %rax
cmpq 0x50(%rbx), %rax
je 0x2b53c
movq (%rdi), %r14
callq 0x2b9e2
movq 0x8(%r14), %rax
movq %r14, %rdi
jmp 0x2b525
movq 0x40(%rbx), %rdi
movq %rbx, %rsi
callq 0x27bcf
movq 0x38(%rbx), %rdi
callq 0x11060
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x11060
| /OLSR[P]OONF/src/libconfig/cfg_db.c |
cfg_db_append | int
_cfg_db_append(
struct cfg_db *dst, struct cfg_db *src, const char *section_type, const char *section_name, const char *entry_name) {
struct cfg_section_type *section, *section_it;
struct cfg_named_section *named, *named_it;
struct cfg_entry *entry, *entry_it;
char *ptr;
bool dummy;
CFG_FOR_ALL_SECTION_TYPES(src, section, section_it) {
if (section_type != NULL && cfg_cmp_keys(section->type, section_type) != 0) {
continue;
}
CFG_FOR_ALL_SECTION_NAMES(section, named, named_it) {
if (section_name != NULL && cfg_cmp_keys(named->name, section_name) != 0) {
continue;
}
if (_cfg_db_add_section(dst, section->type, named->name, &dummy) == NULL) {
return -1;
}
CFG_FOR_ALL_ENTRIES(named, entry, entry_it) {
if (entry_name != NULL && cfg_cmp_keys(entry->name, entry_name) != 0) {
continue;
}
strarray_for_each_element(&entry->val, ptr) {
if (cfg_db_set_entry_ext(dst, section->type, named->name, entry->name, ptr, true, false) == NULL) {
return -1;
}
}
}
}
}
return 0;
} | pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, 0x20(%rsp)
movq %rcx, 0x18(%rsp)
movq (%rsi), %r12
movq 0x8(%r12), %rcx
xorl %eax, %eax
movq %rsi, 0x30(%rsp)
cmpq 0x8(%rsi), %rcx
je 0x2b6ce
movq %rdx, %rbx
movq %rdi, %rbp
movq %rdx, 0x28(%rsp)
movq (%r12), %rax
movq %rax, 0x38(%rsp)
testq %rbx, %rbx
je 0x2b5bf
movq 0x38(%r12), %rdi
movq %rbx, %rsi
callq 0x2e10d
testl %eax, %eax
jne 0x2b6ac
movq 0x48(%r12), %r15
movq 0x8(%r15), %rax
cmpq 0x50(%r12), %rax
je 0x2b6ac
movq (%r15), %rax
movq %rax, 0x40(%rsp)
cmpq $0x0, 0x18(%rsp)
je 0x2b60f
movq 0x38(%r15), %rdi
movq 0x18(%rsp), %rsi
callq 0x2e10d
testl %eax, %eax
je 0x2b60f
movq 0x40(%rsp), %r15
movq 0x8(%r15), %rax
cmpq 0x50(%r12), %rax
movq 0x28(%rsp), %rbx
jne 0x2b5d3
jmp 0x2b6ac
movq 0x38(%r12), %rsi
movq 0x38(%r15), %rdx
movq %rbp, %rdi
leaq 0x17(%rsp), %rcx
callq 0x2b6dd
testq %rax, %rax
je 0x2b6c9
movq 0x48(%r15), %r14
movq 0x8(%r14), %rax
cmpq 0x50(%r15), %rax
je 0x2b5f5
movq %r14, %r13
movq (%r14), %r14
cmpq $0x0, 0x20(%rsp)
je 0x2b65c
movq 0x38(%r13), %rdi
movq 0x20(%rsp), %rsi
callq 0x2e10d
testl %eax, %eax
jne 0x2b632
movq 0x40(%r13), %rbx
testq %rbx, %rbx
je 0x2b632
movq 0x48(%r13), %rax
addq 0x40(%r13), %rax
cmpq %rbx, %rax
jbe 0x2b632
movq 0x38(%r12), %rsi
movq 0x38(%r15), %rdx
movq 0x38(%r13), %rcx
movl $0x0, (%rsp)
movq %rbp, %rdi
movq %rbx, %r8
movl $0x1, %r9d
callq 0x2b835
testq %rax, %rax
je 0x2b6c9
movq %rbx, %rdi
callq 0x111a0
addq %rax, %rbx
incq %rbx
jmp 0x2b665
movq 0x38(%rsp), %r12
movq 0x8(%r12), %rax
movq 0x30(%rsp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x2b59c
xorl %eax, %eax
jmp 0x2b6ce
movl $0xffffffff, %eax # imm = 0xFFFFFFFF
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
| /OLSR[P]OONF/src/libconfig/cfg_db.c |
cfg_help_choice | void
cfg_help_choice(struct autobuf *out, bool preamble, const char *(*callback)(size_t idx, const void *ptr),
size_t choice_count, const void *ptr) {
size_t i;
if (preamble) {
cfg_append_printable_line(out, CFG_HELP_INDENT_PREFIX "Parameter must be on of the following list:");
}
abuf_puts(out, " ");
for (i = 0; i < choice_count; i++) {
abuf_appendf(out, "%s'%s'", i == 0 ? "" : ", ", callback(i, ptr));
}
abuf_puts(out, "\n");
} | pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r12
movq %rdi, %r15
testl %esi, %esi
je 0x2bc88
leaq 0x120ff(%rip), %rsi # 0x3dd7d
movq %r15, %rdi
xorl %eax, %eax
callq 0x2dfe9
leaq 0x15c4d(%rip), %rsi # 0x418dc
movq %r15, %rdi
callq 0x27362
testq %r14, %r14
je 0x2bcdb
xorl %ebp, %ebp
testq %rbp, %rbp
leaq 0x1210c(%rip), %r13 # 0x3ddb4
leaq 0x1279b(%rip), %rax # 0x3e44a
cmoveq %rax, %r13
movq %rbp, %rdi
movq %rbx, %rsi
callq *%r12
movq %r15, %rdi
leaq 0x120e7(%rip), %rsi # 0x3ddad
movq %r13, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x272d1
incq %rbp
cmpq %rbp, %r14
jne 0x2bc9e
leaq 0x12767(%rip), %rsi # 0x3e449
movq %r15, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x27362
| /OLSR[P]OONF/src/libconfig/cfg_help.c |
cfg_io_save | int
cfg_io_save(struct cfg_instance *instance, const char *url, struct cfg_db *src, struct autobuf *log) {
struct cfg_io *io;
const char *io_param = NULL;
io = _find_io(instance, url, &io_param, log);
if (io == NULL) {
cfg_append_printable_line(log, "Error, unknown config io '%s'.", url);
return -1;
}
if (io->save == NULL) {
cfg_append_printable_line(log, "Error, config io '%s' does not support saving.", io->name);
return -1;
}
return io->save(io_param, src, log);
} | pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
leaq 0x8(%rsp), %rdx
movq $0x0, (%rdx)
callq 0x2c1c1
testq %rax, %rax
je 0x2c296
movq 0x50(%rax), %rcx
testq %rcx, %rcx
je 0x2c2a5
movq 0x8(%rsp), %rdi
movq %r14, %rsi
movq %rbx, %rdx
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmpq *%rcx
leaq 0x122e5(%rip), %rsi # 0x3e582
movq %rbx, %rdi
movq %r15, %rdx
jmp 0x2c2b3
movq 0x38(%rax), %rdx
leaq 0x12321(%rip), %rsi # 0x3e5d1
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2dfe9
movl $0xffffffff, %eax # imm = 0xFFFFFFFF
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
nopl (%rax)
| /OLSR[P]OONF/src/libconfig/cfg_io.c |
handle_db_changes | static int
_handle_db_changes(struct cfg_db *pre_change, struct cfg_db *post_change, bool startup) {
struct cfg_section_type default_section_type[2];
struct cfg_named_section default_named_section[2];
struct cfg_schema_section *s_section;
struct cfg_section_type *pre_type, *post_type;
struct cfg_named_section *pre_named, *post_named, *named_it;
struct cfg_named_section *pre_defnamed, *post_defnamed;
if (pre_change->schema == NULL || pre_change->schema != post_change->schema) {
/* no valid schema found */
return -1;
}
/* initialize default named section mechanism */
memset(default_named_section, 0, sizeof(default_named_section));
memset(default_section_type, 0, sizeof(default_section_type));
avl_init(&default_named_section[0].entries, cfg_avlcmp_keys, false);
avl_init(&default_named_section[1].entries, cfg_avlcmp_keys, false);
default_named_section[0].section_type = &default_section_type[0];
default_named_section[1].section_type = &default_section_type[1];
default_section_type[0].db = pre_change;
default_section_type[1].db = post_change;
list_for_each_element(&pre_change->schema->handlers, s_section, _delta_node) {
/* get section types in both databases */
pre_type = cfg_db_find_sectiontype(pre_change, s_section->type);
post_type = cfg_db_find_sectiontype(post_change, s_section->type);
/* prepare for default named section */
pre_defnamed = NULL;
post_defnamed = NULL;
if (s_section->mode == CFG_SSMODE_NAMED_WITH_DEFAULT) {
/* check if we need a default section for pre_change db */
if (!startup && _section_needs_default_named_one(pre_type)) {
/* initialize dummy section type for pre-change db */
default_section_type[0].type = s_section->type;
/* initialize dummy named section for pre-change */
default_named_section[0].name = s_section->def_name;
/* remember decision */
pre_defnamed = &default_named_section[0];
}
/* check if we need a default section for post_change db */
if (_section_needs_default_named_one(post_type)) {
/* initialize dummy section type for post-change db */
default_section_type[1].type = s_section->type;
/* initialize dummy named section for post-change */
default_named_section[1].name = s_section->def_name;
/* remember decision */
post_defnamed = &default_named_section[1];
}
}
if (post_type) {
/* handle new named sections and changes */
pre_named = NULL;
CFG_FOR_ALL_SECTION_NAMES(post_type, post_named, named_it) {
_handle_named_section_change(
s_section, pre_change, post_change, post_named->name, startup, pre_defnamed, post_defnamed);
}
}
if (pre_type) {
/* handle removed named sections */
post_named = NULL;
CFG_FOR_ALL_SECTION_NAMES(pre_type, pre_named, named_it) {
if (post_type) {
post_named = cfg_db_get_named_section(post_type, pre_named->name);
}
if (!post_named) {
_handle_named_section_change(
s_section, pre_change, post_change, pre_named->name, startup, pre_defnamed, post_defnamed);
}
}
}
if (startup && s_section->mode == CFG_SSMODE_UNNAMED && pre_type == NULL && post_type == NULL) {
/* send change signal on startup for unnamed section */
_handle_named_section_change(s_section, pre_change, post_change, NULL, true, pre_defnamed, post_defnamed);
}
if ((pre_defnamed != NULL) != (post_defnamed != NULL)) {
/* status of default named section changed */
_handle_named_section_change(
s_section, pre_change, post_change, s_section->def_name, true, pre_defnamed, post_defnamed);
}
}
return 0;
} | pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp # imm = 0x208
movq %rdi, 0x8(%rsp)
movq 0x28(%rdi), %rax
movl $0xffffffff, %ebx # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x2ce62
movq %rsi, %r12
cmpq 0x28(%rsi), %rax
jne 0x2ce62
movl %edx, %ebp
leaq 0x40(%rsp), %rdi
xorl %ebx, %ebx
movl $0xe0, %edx
xorl %esi, %esi
callq 0x11250
leaq 0x120(%rsp), %r14
movl $0xe0, %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x11250
leaq 0x88(%rsp), %rdi
leaq 0x1561(%rip), %r15 # 0x2e10d
movq %r15, %rsi
xorl %edx, %edx
callq 0x277f0
movq %r12, %r13
leaq 0xf8(%rsp), %r12
movq %r12, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x277f0
movq %r14, -0x78(%r12)
leaq 0x190(%rsp), %rax
movq %rax, -0x8(%r12)
movq 0x8(%rsp), %rcx
movq %rcx, -0x30(%rax)
movq %r13, 0x40(%rax)
movq 0x28(%rcx), %rax
movq 0x50(%rax), %r14
movq 0x8(%r14), %rcx
cmpq 0x58(%rax), %rcx
je 0x2ce62
movq %r13, %r12
movq 0x8(%rsp), %rdi
movl %ebp, 0x10(%rsp)
movq %r13, 0x28(%rsp)
movq -0x28(%r14), %rsi
callq 0x2780e
movq %rax, 0x20(%rsp)
movq -0x28(%r14), %rsi
movq %r12, %rdi
callq 0x2780e
movq %rax, %r13
cmpl $0x3, -0x18(%r14)
jne 0x2cc41
testb %bpl, %bpl
je 0x2cc54
xorl %ecx, %ecx
jmp 0x2cc8f
movq %r12, %rbx
xorl %eax, %eax
movq $0x0, 0x18(%rsp)
jmp 0x2ccdb
movq 0x20(%rsp), %rcx
testq %rcx, %rcx
je 0x2cc75
movl 0x60(%rcx), %eax
testl %eax, %eax
je 0x2cc75
cmpl $0x1, %eax
jne 0x2cc3d
movq 0x48(%rcx), %rax
cmpq $0x0, 0x38(%rax)
jne 0x2cc3d
movq -0x28(%r14), %rax
movq %rax, 0x158(%rsp)
movq -0x20(%r14), %rax
movq %rax, 0x78(%rsp)
leaq 0x40(%rsp), %rcx
testq %r13, %r13
movq %rcx, 0x18(%rsp)
je 0x2ccb8
movl 0x60(%r13), %eax
testl %eax, %eax
je 0x2ccb8
cmpl $0x1, %eax
jne 0x2ccb1
movq 0x48(%r13), %rax
cmpq $0x0, 0x38(%rax)
je 0x2ccb8
movq %r12, %rbx
xorl %eax, %eax
jmp 0x2ccdb
movq %r12, %rbx
movq -0x28(%r14), %rax
movq %rax, 0x1c8(%rsp)
movq -0x20(%r14), %rax
movq %rax, 0xe8(%rsp)
leaq 0xb0(%rsp), %rax
movq %r14, 0x30(%rsp)
leaq -0x60(%r14), %rdi
movzbl %bpl, %ecx
movl %ecx, 0x14(%rsp)
testq %r13, %r13
movq 0x8(%rsp), %rsi
movq 0x18(%rsp), %r14
movq %rbx, %rdx
movq %rax, %rbx
je 0x2cd41
movq 0x48(%r13), %rax
movq 0x8(%rax), %rcx
cmpq 0x50(%r13), %rcx
je 0x2cd41
movq (%rax), %r15
movq 0x38(%rax), %rcx
movq %rbx, (%rsp)
movq %rdi, %rbp
movq %rdx, %r12
movl 0x14(%rsp), %r8d
movq %r14, %r9
callq 0x2d329
movq %r12, %rdx
movq 0x8(%rsp), %rsi
movq %rbp, %rdi
movq 0x8(%r15), %rcx
movq %r15, %rax
jmp 0x2cd09
movq 0x20(%rsp), %rcx
testq %rcx, %rcx
movq %r13, %r12
movq %rdi, %r14
je 0x2cdc5
movq 0x48(%rcx), %r15
movq 0x8(%r15), %rax
cmpq 0x50(%rcx), %rax
je 0x2cdc5
leaq 0x48(%r12), %rax
movq %rax, 0x38(%rsp)
xorl %r13d, %r13d
movq (%r15), %rbp
testq %r12, %r12
je 0x2cd8a
movq 0x38(%r15), %rsi
movq 0x38(%rsp), %rdi
callq 0x2780e
movq 0x20(%rsp), %rcx
movq %rax, %r13
testq %r13, %r13
jne 0x2cdb8
movq 0x38(%r15), %rcx
movq %rbx, (%rsp)
movq %r14, %rdi
movq 0x8(%rsp), %rsi
movq 0x28(%rsp), %rdx
movl 0x14(%rsp), %r8d
movq 0x18(%rsp), %r9
callq 0x2d329
movq 0x20(%rsp), %rcx
movq 0x8(%rbp), %rax
movq %rbp, %r15
cmpq 0x50(%rcx), %rax
jne 0x2cd6c
movq %r14, %r13
cmpb $0x0, 0x10(%rsp)
movq 0x28(%rsp), %rbp
movq 0x30(%rsp), %r14
movq 0x18(%rsp), %r15
je 0x2ce0e
testq %r12, %r12
jne 0x2ce0e
testq %rcx, %rcx
jne 0x2ce0e
cmpl $0x0, -0x18(%r14)
jne 0x2ce0e
movq %rbx, (%rsp)
movq %r13, %rdi
movq 0x8(%rsp), %rsi
movq %rbp, %rdx
xorl %ecx, %ecx
movl $0x1, %r8d
movq %r15, %r9
callq 0x2d329
testq %r15, %r15
setne %al
testq %rbx, %rbx
sete %cl
xorb %al, %cl
movq %rbp, %r12
jne 0x2ce42
movq -0x20(%r14), %rcx
movq %rbx, (%rsp)
movq %r13, %rdi
movq 0x8(%rsp), %rsi
movq %r12, %rdx
movl $0x1, %r8d
movq %r15, %r9
callq 0x2d329
movq (%r14), %r14
movq 0x8(%r14), %rax
movq 0x8(%rsp), %rdi
movq 0x28(%rdi), %rcx
cmpq 0x58(%rcx), %rax
movl 0x10(%rsp), %ebp
jne 0x2cc14
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x208, %rsp # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
| /OLSR[P]OONF/src/libconfig/cfg_schema.c |
cfg_tobin_int | int
cfg_tobin_int(void *reference, size_t bin_size, const struct const_strarray *value, uint16_t fraction, size_t int_size) {
int64_t i;
int result;
uint64_t j, scaling;
if (bin_size != int_size) {
return -1;
}
for (j = 0, scaling = 1; j < fraction; j++, scaling*=10);
result = isonumber_to_s64(&i, strarray_get_first_c(value), scaling);
if (result == 0) {
switch (int_size) {
case 4:
*((int32_t *)reference) = i;
break;
case 8:
*((int64_t *)reference) = i;
break;
default:
return -1;
}
}
return result;
} | pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl $0xffffffff, %ebx # imm = 0xFFFFFFFF
cmpq %r8, %rsi
jne 0x2d5ae
movq %r8, %r15
movq %rdi, %r14
testw %cx, %cx
je 0x2d593
movzwl %cx, %ecx
movl $0x1, %eax
addq %rax, %rax
leaq (%rax,%rax,4), %rax
decq %rcx
jne 0x2d585
jmp 0x2d598
movl $0x1, %eax
movq (%rdx), %rsi
leaq 0x8(%rsp), %rdi
movq %rax, %rdx
callq 0x28433
testl %eax, %eax
je 0x2d5ba
movl %eax, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
cmpq $0x8, %r15
je 0x2d5cf
cmpq $0x4, %r15
jne 0x2d5ae
movl 0x8(%rsp), %ecx
movl %ecx, (%r14)
jmp 0x2d5ac
movq 0x8(%rsp), %rcx
movq %rcx, (%r14)
jmp 0x2d5ac
| /OLSR[P]OONF/src/libconfig/cfg_tobin.c |
cfg_tobin_bitmap256 | int
cfg_tobin_bitmap256(void *reference, size_t bin_size, const struct const_strarray *value) {
struct bitmap256 *bitmap;
const char *ptr;
int idx;
if (bin_size != sizeof(*bitmap)) {
return -1;
}
bitmap = (struct bitmap256 *)reference;
memset(bitmap, 0, sizeof(*bitmap));
strarray_for_each_element(value, ptr) {
errno = 0;
if (strcasecmp(ptr, BITMAP256_ALL) == 0) {
memset(bitmap, 255, sizeof(*bitmap));
}
else if (strcasecmp(ptr, BITMAP256_NONE) == 0) {
memset(bitmap, 0, sizeof(*bitmap));
}
else if (*ptr == '-') {
idx = strtol(&ptr[1], NULL, 10);
if (!errno) {
bitmap256_reset(bitmap, idx);
}
}
else {
idx = strtol(ptr, NULL, 10);
if (!errno) {
bitmap256_set(bitmap, idx);
}
}
}
return 0;
} | movl $0xffffffff, %eax # imm = 0xFFFFFFFF
cmpq $0x20, %rsi
jne 0x2d747
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r14
pxor %xmm0, %xmm0
movdqu %xmm0, 0x10(%rdi)
movdqu %xmm0, (%rdi)
movq (%rdx), %r15
xorl %eax, %eax
testq %r15, %r15
je 0x2d739
movq 0x8(%rbx), %rcx
addq (%rbx), %rcx
cmpq %r15, %rcx
jbe 0x2d739
callq 0x110c0
movq %rax, %r12
leaq 0x12ea1(%rip), %r13 # 0x40515
leaq 0xfc8b(%rip), %rbp # 0x3d306
movl $0x0, (%r12)
movq %r15, %rdi
movq %r13, %rsi
callq 0x11080
testl %eax, %eax
je 0x2d6d6
movq %r15, %rdi
movq %rbp, %rsi
callq 0x11080
testl %eax, %eax
je 0x2d6dc
cmpb $0x2d, (%r15)
jne 0x2d70b
leaq 0x1(%r15), %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x11370
cmpl $0x0, (%r12)
jne 0x2d6eb
movq $-0x2, %rdx
movl %eax, %ecx
rolq %cl, %rdx
shrl $0x3, %eax
andl $0x18, %eax
andq %rdx, (%r14,%rax)
jmp 0x2d6eb
pcmpeqd %xmm0, %xmm0
jmp 0x2d6e0
pxor %xmm0, %xmm0
movdqu %xmm0, 0x10(%r14)
movdqu %xmm0, (%r14)
movq %r15, %rdi
callq 0x111a0
addq %rax, %r15
incq %r15
movq 0x8(%rbx), %rax
addq (%rbx), %rax
cmpq %r15, %rax
ja 0x2d67b
jmp 0x2d737
movq %r15, %rdi
xorl %esi, %esi
movl $0xa, %edx
callq 0x11370
cmpl $0x0, (%r12)
jne 0x2d6eb
movl $0x1, %edx
movl %eax, %ecx
shlq %cl, %rdx
shrl $0x3, %eax
andl $0x18, %eax
orq %rdx, (%r14,%rax)
jmp 0x2d6eb
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
| /OLSR[P]OONF/src/libconfig/cfg_tobin.c |
cfg_validate_choice | int
cfg_validate_choice(struct autobuf *out, const char *section_name, const char *entry_name, const char *value,
const char *(*callback)(size_t idx, const void *ptr), size_t choices_count, const void *ptr) {
int i;
i = cfg_get_choice_index(value, callback, choices_count, ptr);
if (i >= 0) {
return 0;
}
cfg_append_printable_line(out,
"Unknown value '%s'"
" for entry '%s' in section %s",
value, entry_name, section_name);
return -1;
} | pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r12
movq 0x30(%rsp), %rcx
movq %r15, %rdi
movq %r8, %rsi
movq %r9, %rdx
callq 0x2e12e
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
jns 0x2d9fb
leaq 0x10fbc(%rip), %rsi # 0x3e99f
movq %r12, %rdi
movq %r15, %rdx
movq %r14, %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x2dfe9
movl $0xffffffff, %eax # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
| /OLSR[P]OONF/src/libconfig/cfg_validate.c |
cfg_validate_netaddr | int
cfg_validate_netaddr(struct autobuf *out, const char *section_name, const char *entry_name, const char *value,
bool prefix, const int8_t *af_types, size_t af_types_count) {
struct netaddr addr;
uint8_t max_prefix;
size_t i;
if (netaddr_from_string(&addr, value)) {
cfg_append_printable_line(out,
"Value '%s' for entry '%s'"
" in section %s is no valid network address",
value, entry_name, section_name);
return -1;
}
max_prefix = netaddr_get_maxprefix(&addr);
/* check prefix length */
if (netaddr_get_prefix_length(&addr) > max_prefix) {
cfg_append_printable_line(out,
"Value '%s' for entry '%s'"
" in section %s has an illegal prefix length",
value, entry_name, section_name);
return -1;
}
if (!prefix && netaddr_get_prefix_length(&addr) != max_prefix) {
cfg_append_printable_line(out,
"Value '%s' for entry '%s'"
" in section %s must be a single address, not a prefix",
value, entry_name, section_name);
return -1;
}
for (i = 0; i < af_types_count; i++) {
if (af_types[i] == netaddr_get_address_family(&addr)) {
return 0;
}
}
/* at least one condition was set, but no one matched */
cfg_append_printable_line(out,
"Value '%s' for entry '%s'"
" in section '%s' is wrong address type",
value, entry_name, section_name);
return -1;
} | pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %r13
movl %r8d, %ebp
movq %rcx, %r15
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r12
leaq 0x6(%rsp), %rdi
movq %rcx, %rsi
callq 0x290a3
testl %eax, %eax
je 0x2dc07
leaq 0x10f56(%rip), %rsi # 0x3eb5b
jmp 0x2dc62
movzbl 0x16(%rsp), %edi
callq 0x28d15
cmpb %al, 0x17(%rsp)
jbe 0x2dc20
leaq 0x10f81(%rip), %rsi # 0x3eb9f
jmp 0x2dc62
setne %al
xorb $0x1, %bpl
testb %bpl, %al
jne 0x2dc5b
movq 0x50(%rsp), %rcx
leaq 0x10ffb(%rip), %rsi # 0x3ec33
testq %rcx, %rcx
je 0x2dc62
movzbl 0x16(%rsp), %edx
xorl %eax, %eax
xorl %edi, %edi
movsbl (%r13,%rdi), %r8d
cmpl %edx, %r8d
je 0x2dc7a
incq %rdi
cmpq %rdi, %rcx
jne 0x2dc46
jmp 0x2dc62
leaq 0x10f82(%rip), %rsi # 0x3ebe4
movq %r12, %rdi
movq %r15, %rdx
movq %r14, %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x2dfe9
movl $0xffffffff, %eax # imm = 0xFFFFFFFF
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
| /OLSR[P]OONF/src/libconfig/cfg_validate.c |
cfg_append_printable_line | int
cfg_append_printable_line(struct autobuf *autobuf, const char *fmt, ...) {
unsigned char *_value;
size_t len;
int rv;
va_list ap;
if (autobuf == NULL)
return 0;
_value = (unsigned char *)abuf_getptr(autobuf) + abuf_getlen(autobuf);
len = abuf_getlen(autobuf);
va_start(ap, fmt);
rv = abuf_vappendf(autobuf, fmt, ap);
va_end(ap);
if (rv < 0) {
return rv;
}
/* convert everything non-printable to '.' */
while (*_value && len++ < abuf_getlen(autobuf)) {
if (*_value < 32 || *_value == 127 || *_value == 255) {
*_value = '.';
}
_value++;
}
abuf_append_uint8(autobuf, '\n');
return 0;
} | pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %rdx, 0x40(%rsp)
movq %rcx, 0x48(%rsp)
movq %r8, 0x50(%rsp)
movq %r9, 0x58(%rsp)
testb %al, %al
je 0x2e049
movaps %xmm0, 0x60(%rsp)
movaps %xmm1, 0x70(%rsp)
movaps %xmm2, 0x80(%rsp)
movaps %xmm3, 0x90(%rsp)
movaps %xmm4, 0xa0(%rsp)
movaps %xmm5, 0xb0(%rsp)
movaps %xmm6, 0xc0(%rsp)
movaps %xmm7, 0xd0(%rsp)
xorl %ebx, %ebx
testq %rdi, %rdi
je 0x2e0d8
movq %rdi, %r14
movq 0x8(%rdi), %r15
movq 0x10(%rdi), %r12
leaq 0x30(%rsp), %rax
leaq 0x10(%rsp), %rdx
movq %rax, 0x10(%rdx)
leaq 0x110(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000010, %rax # imm = 0x3000000010
movq %rax, (%rdx)
callq 0x2722d
testl %eax, %eax
js 0x2e0d6
movb (%r12,%r15), %al
testb %al, %al
je 0x2e0bf
cmpq 0x8(%r14), %r15
jae 0x2e0bf
cmpb $0x20, %al
jb 0x2e0b0
movzbl %al, %eax
orl $0x80, %eax
cmpl $0xff, %eax
jne 0x2e0b5
movb $0x2e, (%r12,%r15)
movb 0x1(%r12,%r15), %al
incq %r15
jmp 0x2e093
leaq 0xf(%rsp), %rsi
movb $0xa, (%rsi)
movl $0x1, %edx
movq %r14, %rdi
callq 0x274e4
jmp 0x2e0d8
movl %eax, %ebx
movl %ebx, %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
| /OLSR[P]OONF/src/libconfig/cfg.c |
oonf_cfg_clear_rawdb | int
oonf_cfg_clear_rawdb(void) {
struct cfg_db *db;
/* remember old db */
db = _oonf_raw_db;
/* initialize database */
if ((_oonf_raw_db = cfg_db_add()) == NULL) {
OONF_WARN(LOG_CONFIG, "Cannot create raw configuration database.");
_oonf_raw_db = db;
return -1;
}
/* free old db */
cfg_db_remove(db);
cfg_db_link_schema(_oonf_raw_db, &_oonf_schema);
return 0;
} | pushq %rbx
subq $0x10, %rsp
movq 0x3ec96(%rip), %rbx # 0x6d810
callq 0x2b4b4
movq %rax, 0x3ec8a(%rip) # 0x6d810
testq %rax, %rax
je 0x2eba9
movq %rbx, %rdi
callq 0x2b4e2
movq 0x3ec76(%rip), %rax # 0x6d810
leaq 0x3ec0f(%rip), %rcx # 0x6d7b0
movq %rcx, 0x28(%rax)
xorl %eax, %eax
jmp 0x2ebf0
leaq 0x3ed20(%rip), %rax # 0x6d8d0
testb $0x4, 0x3(%rax)
je 0x2ebe4
leaq 0x1024d(%rip), %rax # 0x3ee0a
movq %rax, (%rsp)
leaq 0x1022b(%rip), %rdx # 0x3edf3
movl $0x4, %edi
movl $0x3, %esi
movl $0x1e7, %ecx # imm = 0x1E7
xorl %r8d, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x2efff
movq %rbx, 0x3ec25(%rip) # 0x6d810
movl $0xffffffff, %eax # imm = 0xFFFFFFFF
addq $0x10, %rsp
popq %rbx
retq
| /OLSR[P]OONF/src/libcore/oonf_cfg.c |
oonf_log_updatemask | static INLINE void
oonf_log_mask_clear(uint8_t *mask) {
memset(mask, LOG_SEVERITY_WARN | LOG_SEVERITY_ASSERT, LOG_MAXIMUM_SOURCES);
} | movaps 0x102f8(%rip), %xmm0 # 0x3f150
movaps %xmm0, 0x3eae1(%rip) # 0x6d940
movaps %xmm0, 0x3eaca(%rip) # 0x6d930
movaps %xmm0, 0x3eab3(%rip) # 0x6d920
movaps %xmm0, 0x3ea9c(%rip) # 0x6d910
movaps %xmm0, 0x3ea85(%rip) # 0x6d900
movaps %xmm0, 0x3ea6e(%rip) # 0x6d8f0
movaps %xmm0, 0x3ea57(%rip) # 0x6d8e0
movaps %xmm0, 0x3ea40(%rip) # 0x6d8d0
movq 0x3e9f1(%rip), %rax # 0x6d888
movq 0x8(%rax), %rcx
cmpq 0x3e9ee(%rip), %rcx # 0x6d890
je 0x2eef3
leaq 0x3ea25(%rip), %rcx # 0x6d8d0
movq %rax, %rdx
movq (%rax), %rax
xorl %esi, %esi
movb 0x18(%rdx), %dil
orb 0x18(%rdx,%rsi), %dil
leal (%rdi,%rdi), %r8d
orb %dil, %r8b
leal (,%r8,4), %edi
orb %r8b, %dil
movb %dil, 0x98(%rdx,%rsi)
orb %dil, (%rsi,%rcx)
incq %rsi
cmpq $0x80, %rsi
jne 0x2eeb3
movq 0x8(%rax), %rdx
cmpq 0x3e99f(%rip), %rdx # 0x6d890
jne 0x2eeab
retq
| /OLSR[P]OONF/include/oonf/libcore/oonf_logging.h |
apply_log_setting | static void
_apply_log_setting(struct cfg_named_section *named, const char *entry_name, enum oonf_log_severity severity) {
struct cfg_entry *entry;
char *ptr;
size_t i;
entry = cfg_db_get_entry(named, entry_name);
if (entry) {
strarray_for_each_element(&entry->val, ptr) {
for (i = 0; i < oonf_log_get_sourcecount(); i++) {
if (strcasecmp(ptr, LOG_SOURCE_NAMES[i]) == 0) {
oonf_log_mask_set(_logging_cfg, i, severity);
}
}
}
}
} | pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
addq $0x48, %rdi
callq 0x2780e
testq %rax, %rax
je 0x2f94d
movq %rax, %r14
movq 0x40(%rax), %r15
testq %r15, %r15
je 0x2f94d
movq 0x48(%r14), %rax
addq 0x40(%r14), %rax
cmpq %r15, %rax
jbe 0x2f94d
leaq 0x29e04(%rip), %r12 # 0x59700
leaq 0x3e24d(%rip), %r13 # 0x6db50
callq 0x2f258
testq %rax, %rax
je 0x2f932
xorl %ebp, %ebp
movq (%r12,%rbp,8), %rsi
movq %r15, %rdi
callq 0x11080
testl %eax, %eax
jne 0x2f925
movl %ebp, %eax
orb %bl, (%rax,%r13)
incq %rbp
callq 0x2f258
cmpq %rax, %rbp
jb 0x2f90f
movq %r15, %rdi
callq 0x111a0
addq %rax, %r15
incq %r15
movq 0x48(%r14), %rax
addq 0x40(%r14), %rax
cmpq %r15, %rax
ja 0x2f903
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
| /OLSR[P]OONF/src/libcore/oonf_logging_cfg.c |
oonf_main | int
oonf_main(int argc, char **argv, const struct oonf_appdata *appdata) {
int return_code;
int result;
/* early initialization */
return_code = 1;
_schema_name = NULL;
_display_schema = false;
_debug_early = false;
_ignore_unknown = false;
/* setup signal handler */
_end_oonf_signal = false;
setup_signalhandler();
/* parse "early" command line arguments */
parse_early_commandline(argc, argv);
/* initialize core */
os_core_init(appdata->app_name);
/* initialize logger */
if (oonf_log_init(appdata, _debug_early ? LOG_SEVERITY_DEBUG : LOG_SEVERITY_WARN)) {
goto oonf_cleanup;
}
/* prepare plugin initialization */
oonf_subsystem_init();
/* initialize configuration system */
if (oonf_cfg_init(argc, argv, appdata->default_cfg_handler)) {
goto oonf_cleanup;
}
/* add custom configuration definitions */
oonf_logcfg_init();
/* parse command line and read configuration files */
return_code = parse_commandline(argc, argv, appdata, false);
if (return_code != -1) {
/* end OONFd now */
goto oonf_cleanup;
}
/* prepare for an error during initialization */
return_code = 1;
/* read global section early */
if ((result = oonf_cfg_update_globalcfg(true))) {
OONF_WARN(LOG_MAIN, "Cannot read global configuration section (%d)", result);
goto oonf_cleanup;
}
/* configure logger */
if (oonf_logcfg_apply(oonf_cfg_get_rawdb())) {
goto oonf_cleanup;
}
/* load plugins */
if (oonf_cfg_load_subsystems()) {
goto oonf_cleanup;
}
/* show schema if necessary */
if (_display_schema) {
return_code = display_schema();
goto oonf_cleanup;
}
/* check if we are root, otherwise stop */
if (appdata->need_root) {
if (geteuid() != 0) {
OONF_WARN(LOG_MAIN, "You must be root(uid = 0) to run %s!\n", appdata->app_name);
goto oonf_cleanup;
}
}
if (appdata->need_lock && config_global.lockfile != NULL && *config_global.lockfile != 0 &&
strcmp(config_global.lockfile, "-") != 0) {
/* create application lock */
if (os_core_create_lockfile(config_global.lockfile)) {
OONF_WARN(LOG_MAIN, "Could not acquire application lock '%s'", config_global.lockfile);
goto oonf_cleanup;
}
}
/* call initialization callbacks of dynamic plugins */
oonf_cfg_initplugins();
/* apply configuration */
if (oonf_cfg_apply()) {
goto oonf_cleanup;
}
if (!oonf_cfg_is_running()) {
/*
* mayor error during late initialization
* or maybe the user decided otherwise and pressed CTRL-C
*/
return_code = _end_oonf_signal ? 0 : 1;
goto oonf_cleanup;
}
if (!_handle_scheduling) {
OONF_WARN(LOG_MAIN, "No event scheduler present");
return_code = 1;
goto oonf_cleanup;
}
/* see if we need to fork */
if (config_global.fork && !_display_schema) {
/* tell main process that we are finished with initialization */
if (daemon(0, 0) < 0) {
OONF_WARN(LOG_MAIN, "Could not fork into background: %s (%d)", strerror(errno), errno);
goto oonf_cleanup;
}
if (config_global.pidfile && *config_global.pidfile != 0) {
if (_write_pidfile(config_global.pidfile)) {
goto oonf_cleanup;
}
}
}
/* activate mainloop */
return_code = mainloop(argc, argv, appdata);
/* tell plugins shutdown is in progress */
oonf_subsystem_initiate_shutdown();
/* wait for 500 ms and process socket events */
while (!_handle_scheduling())
;
oonf_cleanup:
/* free plugins */
oonf_cfg_unconfigure_subsystems();
oonf_subsystem_cleanup();
/* free logging/config bridge resources */
oonf_logcfg_cleanup();
/* free configuration resources */
oonf_cfg_cleanup();
/* free logger resources */
oonf_log_cleanup();
/* free core resources */
os_core_cleanup();
return return_code;
} | pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, 0x10(%rsp)
movq %rsi, %r14
movl %edi, %ebp
movq $0x0, 0x3e0f5(%rip) # 0x6dbd8
xorl %ebx, %ebx
movb %bl, 0x3e0f5(%rip) # 0x6dbe0
movb %bl, 0x3e0f0(%rip) # 0x6dbe1
movb %bl, 0x3e0eb(%rip) # 0x6dbe2
leaq 0x3e0fa(%rip), %r12 # 0x6dbf8
movl $0x98, %edx
movq %r12, %rdi
xorl %esi, %esi
callq 0x11250
leaq 0x3e0ec(%rip), %rdi # 0x6dc00
callq 0x11360
movl %ebx, 0x3e161(%rip) # 0x6dc80
leaq 0xbe5(%rip), %rax # 0x3070b
movq %rax, 0x3e0cb(%rip) # 0x6dbf8
movl $0x2, %edi
movq %r12, %rsi
xorl %edx, %edx
callq 0x11110
movl $0x3, %edi
movq %r12, %rsi
xorl %edx, %edx
callq 0x11110
movl $0x4, %edi
movq %r12, %rsi
xorl %edx, %edx
callq 0x11110
movl $0x6, %edi
movq %r12, %rsi
xorl %edx, %edx
callq 0x11110
movl $0xf, %edi
movq %r12, %rsi
xorl %edx, %edx
callq 0x11110
movq $0x1, 0x3e075(%rip) # 0x6dbf8
movl $0xd, %edi
movq %r12, %rsi
xorl %edx, %edx
callq 0x11110
movl $0xa, %edi
movq %r12, %rsi
xorl %edx, %edx
callq 0x11110
movl $0xc, %edi
movq %r12, %rsi
xorl %edx, %edx
callq 0x11110
leaq 0xb59(%rip), %rax # 0x30710
movq %rax, 0x3e03a(%rip) # 0x6dbf8
movl $0x1, %edi
movq %r12, %rsi
xorl %edx, %edx
callq 0x11110
movq 0x20414(%rip), %rax # 0x4ffe8
movl %ebx, (%rax)
leaq 0x82d4(%rip), %rdx # 0x37eb1
leaq 0x2a82c(%rip), %rcx # 0x5a410
leaq 0xc(%rsp), %r8
movl %ebp, %edi
movq %r14, %r15
movq %r14, %rsi
callq 0x111b0
testl %eax, %eax
js 0x2fc46
leaq 0x3dfe0(%rip), %r14 # 0x6dbe1
leaq 0x82a9(%rip), %r12 # 0x37eb1
leaq 0x2a801(%rip), %r13 # 0x5a410
leaq 0xc(%rsp), %rbx
movq %r14, %rcx
cmpl $0x101, %eax # imm = 0x101
je 0x2fc2c
cmpl $0x102, %eax # imm = 0x102
jne 0x2fc2f
leaq 0x3dfb6(%rip), %rcx # 0x6dbe2
movb $0x1, (%rcx)
movl %ebp, %edi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
movq %rbx, %r8
callq 0x111b0
testl %eax, %eax
jns 0x2fc14
movq 0x10(%rsp), %r13
movq (%r13), %rdi
callq 0x312e4
movzbl 0x3df86(%rip), %eax # 0x6dbe1
xorl $0x1, %eax
leal (%rax,%rax,2), %esi
incl %esi
movq %r13, %rdi
callq 0x2ec28
testl %eax, %eax
je 0x2fc77
movl $0x1, %r14d
jmp 0x2fcb3
callq 0x30718
movq 0x28(%r13), %rdx
movl %ebp, %edi
movq %r15, %r12
movq %r15, %rsi
callq 0x2e1d8
testl %eax, %eax
movl $0x1, %r14d
jne 0x2fcb3
callq 0x2f478
movl %ebp, %edi
movq %r12, %rsi
movq %r13, %rdx
xorl %ecx, %ecx
callq 0x2ffbc
movl %eax, %r14d
cmpl $-0x1, %eax
je 0x2fce3
callq 0x2e66d
callq 0x30788
callq 0x2f4c9
callq 0x2e39b
callq 0x2eda2
callq 0x312ff
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %r14d
movl $0x1, %edi
callq 0x2ea34
testl %eax, %eax
je 0x2fd44
movl %eax, %r10d
leaq 0x3dbcf(%rip), %rax # 0x6d8d0
testb $0x4, 0x1(%rax)
je 0x2fcb3
leaq 0xf808(%rip), %r11 # 0x3f516
leaq 0xf7e9(%rip), %rdx # 0x3f4fe
movl $0x1, %r14d
movl $0x4, %edi
movl $0x1, %esi
movl $0xcb, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
pushq %r10
pushq %r11
callq 0x2efff
addq $0x10, %rsp
jmp 0x2fcb3
callq 0x2ec06
movq %rax, %rdi
callq 0x2f556
testl %eax, %eax
jne 0x2fcb3
callq 0x2e4ea
testl %eax, %eax
jne 0x2fcb3
cmpb $0x1, 0x3de73(%rip) # 0x6dbe0
jne 0x2fd7c
callq 0x30376
movl %eax, %r14d
jmp 0x2fcb3
cmpb $0x1, 0x30(%r13)
jne 0x2fdd1
callq 0x11260
testl %eax, %eax
je 0x2fdd1
leaq 0x3db3d(%rip), %rax # 0x6d8d0
testb $0x4, 0x1(%rax)
je 0x2fcb3
leaq 0xf7a0(%rip), %r10 # 0x3f544
leaq 0xf753(%rip), %rdx # 0x3f4fe
movl $0x1, %r14d
movl $0x4, %edi
movl $0x1, %esi
movl $0xe2, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
pushq (%r13)
jmp 0x2fefd
leaq 0x3da48(%rip), %rax # 0x6d820
movq 0x20(%rax), %rbx
testq %rbx, %rbx
setne %al
andb 0x31(%r13), %al
cmpb $0x1, %al
jne 0x2fe5a
cmpb $0x0, (%rbx)
je 0x2fe5a
leaq 0x80bb(%rip), %rsi # 0x37eb1
movq %rbx, %rdi
callq 0x11340
testl %eax, %eax
je 0x2fe5a
movq %rbx, %rdi
callq 0x31393
testl %eax, %eax
je 0x2fe5a
leaq 0x3dabb(%rip), %rax # 0x6d8d0
testb $0x4, 0x1(%rax)
je 0x2fcb3
leaq 0xf744(%rip), %r10 # 0x3f56a
leaq 0xf6d1(%rip), %rdx # 0x3f4fe
movl $0x1, %r14d
movl $0x4, %edi
movl $0x1, %esi
movl $0xeb, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
leaq 0x3d9cf(%rip), %r11 # 0x6d820
pushq 0x20(%r11)
jmp 0x2fefd
callq 0x2e6af
callq 0x2e6dd
testl %eax, %eax
jne 0x2fcb3
callq 0x2e4e1
testb %al, %al
je 0x2fcb3
cmpq $0x0, 0x3dd67(%rip) # 0x6dbe8
je 0x2febd
leaq 0x3d996(%rip), %rax # 0x6d820
cmpb $0x1, 0x28(%rax)
jne 0x2fe99
cmpb $0x0, 0x3dd49(%rip) # 0x6dbe0
je 0x2ff04
movl %ebp, %edi
movq %r12, %rsi
movq %r13, %rdx
callq 0x30527
movl %eax, %r14d
callq 0x30afe
callq *0x3dd34(%rip) # 0x6dbe8
testl %eax, %eax
je 0x2feae
jmp 0x2fcb3
leaq 0x3da0c(%rip), %rax # 0x6d8d0
testb $0x4, 0x1(%rax)
je 0x2fcb3
subq $0x8, %rsp
leaq 0xf6b9(%rip), %r10 # 0x3f592
leaq 0xf61e(%rip), %rdx # 0x3f4fe
movl $0x1, %r14d
movl $0x4, %edi
movl $0x1, %esi
movl $0x102, %ecx # imm = 0x102
xorl %r8d, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
pushq %r10
jmp 0x2fd36
xorl %edi, %edi
xorl %esi, %esi
callq 0x11420
testl %eax, %eax
js 0x2ff4e
leaq 0x3d908(%rip), %rax # 0x6d820
movq 0x18(%rax), %rdi
testq %rdi, %rdi
movl $0x1, %r14d
movq 0x10(%rsp), %r13
movq %r15, %r12
je 0x2fe99
cmpb $0x0, (%rdi)
je 0x2fe99
callq 0x303d6
testl %eax, %eax
jne 0x2fcb3
jmp 0x2fe99
leaq 0x3d97b(%rip), %rax # 0x6d8d0
testb $0x4, 0x1(%rax)
movl $0x1, %r14d
je 0x2fcb3
callq 0x110c0
movq %rax, %rbx
movl (%rax), %edi
callq 0x11560
movq %rax, %r10
movl (%rbx), %r11d
subq $0x8, %rsp
leaq 0xf628(%rip), %rbx # 0x3f5ad
leaq 0xf572(%rip), %rdx # 0x3f4fe
movl $0x1, %r14d
movl $0x4, %edi
movl $0x1, %esi
movl $0x10a, %ecx # imm = 0x10A
xorl %r8d, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
pushq %r11
pushq %r10
pushq %rbx
callq 0x2efff
addq $0x20, %rsp
jmp 0x2fcb3
| /OLSR[P]OONF/src/libcore/oonf_main.c |
display_schema | static int
display_schema(void) {
struct autobuf log;
int return_code;
return_code = 0;
abuf_init(&log);
if (cfg_cmd_handle_schema(oonf_cfg_get_rawdb(), _schema_name, &log)) {
return_code = -1;
}
if (abuf_getlen(&log) > 0) {
fputs(abuf_getptr(&log), stdout);
}
abuf_free(&log);
return return_code;
} | pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rsp, %r14
movq %r14, %rdi
callq 0x271cc
callq 0x2ec06
movq 0x3d843(%rip), %rsi # 0x6dbd8
movq %rax, %rdi
movq %r14, %rdx
callq 0x2af7c
movl %eax, %ebx
cmpq $0x0, 0x8(%r14)
je 0x303bd
movq 0x10(%rsp), %rdi
movq 0x1fc03(%rip), %rax # 0x4ffb8
movq (%rax), %rsi
callq 0x11240
xorl %ebp, %ebp
negl %ebx
sbbl %ebp, %ebp
movq %rsp, %rdi
callq 0x27214
movl %ebp, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
| /OLSR[P]OONF/src/libcore/oonf_main.c |
write_pidfile | static int
_write_pidfile(const char *filename) {
int pid_fd;
char buffer[16];
pid_fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
if (pid_fd < 0) {
OONF_WARN(LOG_MAIN, "Could not open pidfile '%s': %s (%d)", filename, strerror(errno), errno);
return -1;
}
snprintf(buffer, sizeof(buffer), "%d\n", getpid());
if (write(pid_fd, buffer, strlen(buffer) + 1) < 0) {
OONF_WARN(
LOG_MAIN, "Could not write pid %d into pidfile '%s': %s (%d)", getpid(), filename, strerror(errno), errno);
close(pid_fd);
return -1;
}
close(pid_fd);
return 0;
} | pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl $0x241, %esi # imm = 0x241
movl $0x1a4, %edx # imm = 0x1A4
xorl %eax, %eax
callq 0x114b0
testl %eax, %eax
js 0x30444
movl %eax, %ebp
callq 0x11170
leaq 0x8093(%rip), %rdx # 0x38499
xorl %r14d, %r14d
movq %rsp, %r15
movl $0x10, %esi
movq %r15, %rdi
movl %eax, %ecx
xorl %eax, %eax
callq 0x111e0
movq %r15, %rdi
callq 0x111a0
leaq 0x1(%rax), %rdx
movl %ebp, %edi
movq %r15, %rsi
callq 0x11160
testq %rax, %rax
js 0x304a7
movl %ebp, %edi
callq 0x11290
jmp 0x30519
leaq 0x3d485(%rip), %rax # 0x6d8d0
movl $0xffffffff, %r14d # imm = 0xFFFFFFFF
testb $0x4, 0x1(%rax)
je 0x30519
callq 0x110c0
movq %rax, %r15
movl (%rax), %edi
callq 0x11560
movq %rax, %r10
movl (%r15), %r11d
leaq 0xf15e(%rip), %r15 # 0x3f5d5
leaq 0xf080(%rip), %rdx # 0x3f4fe
movl $0x4, %edi
movl $0x1, %esi
movl $0x164, %ecx # imm = 0x164
xorl %r8d, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
pushq %r11
pushq %r10
pushq %rbx
pushq %r15
callq 0x2efff
addq $0x20, %rsp
jmp 0x30519
leaq 0x3d422(%rip), %rax # 0x6d8d0
testb $0x4, 0x1(%rax)
je 0x3050c
callq 0x11170
movl %eax, %r14d
callq 0x110c0
movq %rax, %r15
movl (%rax), %edi
callq 0x11560
movq %rax, %r10
movl (%r15), %r11d
subq $0x8, %rsp
leaq 0xf11e(%rip), %r15 # 0x3f5fa
leaq 0xf01b(%rip), %rdx # 0x3f4fe
movl $0x4, %edi
movl $0x1, %esi
movl $0x16c, %ecx # imm = 0x16C
xorl %r8d, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
pushq %r11
pushq %r10
pushq %rbx
pushq %r14
pushq %r15
callq 0x2efff
addq $0x30, %rsp
movl %ebp, %edi
callq 0x11290
movl $0xffffffff, %r14d # imm = 0xFFFFFFFF
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
| /OLSR[P]OONF/src/libcore/oonf_main.c |
mainloop | static int
mainloop(int argc, char **argv, const struct oonf_appdata *appdata) {
int exit_code = 0;
OONF_INFO(LOG_MAIN, "Starting %s", appdata->app_name);
/* enter main loop */
while (oonf_cfg_is_running()) {
/* call event scheduler */
if (_handle_scheduling()) {
exit_code = 1;
break;
}
/* reload configuration if triggered */
if (oonf_cfg_is_reload_set()) {
OONF_INFO(LOG_MAIN, "Reloading configuration");
if (oonf_cfg_clear_rawdb()) {
break;
}
if (parse_commandline(argc, argv, appdata, true) == -1) {
if (oonf_cfg_apply()) {
break;
}
}
}
/* commit config if triggered */
if (oonf_cfg_is_commit_set()) {
OONF_INFO(LOG_MAIN, "Commiting configuration");
if (oonf_cfg_apply()) {
break;
}
}
}
OONF_INFO(LOG_MAIN, "Ending %s", appdata->app_name);
return exit_code;
} | pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %ebp
leaq 0x3d38f(%rip), %r13 # 0x6d8d0
testb $0x2, 0x1(%r13)
je 0x3057a
leaq 0xf0dd(%rip), %r10 # 0x3f62c
leaq 0xefa8(%rip), %rdx # 0x3f4fe
movl $0x2, %edi
movl $0x1, %esi
movl $0x192, %ecx # imm = 0x192
xorl %r8d, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
pushq (%rbx)
pushq %r10
callq 0x2efff
addq $0x10, %rsp
callq 0x2e4e1
testb %al, %al
je 0x3065e
leaq 0xef70(%rip), %r15 # 0x3f4fe
xorl %r12d, %r12d
callq *0x3d651(%rip) # 0x6dbe8
testl %eax, %eax
jne 0x306ac
callq 0x2e443
testb %al, %al
je 0x30608
testb $0x2, 0x1(%r13)
je 0x305df
subq $0x8, %rsp
movl $0x2, %edi
movl $0x1, %esi
movq %r15, %rdx
movl $0x19e, %ecx # imm = 0x19E
xorl %r8d, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
leaq 0xf064(%rip), %r10 # 0x3f638
pushq %r10
callq 0x2efff
addq $0x10, %rsp
callq 0x2eb6e
testl %eax, %eax
jne 0x30661
movl %ebp, %edi
movq %r14, %rsi
movq %rbx, %rdx
movl $0x1, %ecx
callq 0x2ffbc
cmpl $-0x1, %eax
jne 0x30608
callq 0x2e6dd
testl %eax, %eax
jne 0x30661
callq 0x2e492
testb %al, %al
je 0x30651
testb $0x2, 0x1(%r13)
je 0x30648
subq $0x8, %rsp
movl $0x2, %edi
movl $0x1, %esi
movq %r15, %rdx
movl $0x1ab, %ecx # imm = 0x1AB
xorl %r8d, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
leaq 0xf013(%rip), %r10 # 0x3f650
pushq %r10
callq 0x2efff
addq $0x10, %rsp
callq 0x2e6dd
testl %eax, %eax
jne 0x3065e
callq 0x2e4e1
testb %al, %al
jne 0x30591
xorl %r12d, %r12d
testb $0x2, 0x1(%r13)
je 0x3069a
leaq 0xeff9(%rip), %r10 # 0x3f668
leaq 0xee88(%rip), %rdx # 0x3f4fe
movl $0x2, %edi
movl $0x1, %esi
movl $0x1b2, %ecx # imm = 0x1B2
xorl %r8d, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
pushq (%rbx)
pushq %r10
callq 0x2efff
addq $0x10, %rsp
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x1, %r12d
jmp 0x30661
| /OLSR[P]OONF/src/libcore/oonf_main.c |
init_plugin | static int
_init_plugin(struct oonf_subsystem *plugin) {
struct oonf_subsystem *dep;
size_t i;
int result;
if (plugin->_initialized) {
return 0;
}
/* mark plugin */
plugin->_dependency_missing = true;
for (i = 0; i < plugin->dependencies_count; i++) {
dep = oonf_subsystem_get(plugin->dependencies[i]);
if (!dep) {
OONF_WARN(LOG_PLUGINS, "Dependency '%s' missing for '%s'", plugin->dependencies[i], plugin->name);
return -1;
}
if (dep->_dependency_missing) {
OONF_WARN(LOG_PLUGINS, "Circular dependency, '%s' is dependency of '%s'", plugin->dependencies[i], plugin->name);
return 1;
}
result = _init_plugin(dep);
if (result == -1) {
/* forward missing dependency */
return -1;
}
if (result == 1) {
/* forward circular dependency */
OONF_WARN(LOG_PLUGINS, "Circular dependency, '%s' is dependency of '%s'", plugin->dependencies[i], plugin->name);
return 1;
}
}
plugin->_dependency_missing = false;
if (plugin->_dlhandle &&
!_open_plugin_template(plugin->name, plugin->_dlpath_index, RTLD_LAZY | RTLD_NOLOAD | RTLD_GLOBAL)) {
OONF_WARN(LOG_PLUGINS, "Could not reload plugin '%s' into global namespace", plugin->name);
return -1;
}
if (plugin->init) {
if (plugin->init()) {
OONF_WARN(LOG_PLUGINS, "Init callback failed for plugin %s\n", plugin->name);
return -1;
}
}
OONF_INFO(LOG_PLUGINS, "Initialized plugin %s successful\n", plugin->name);
if (!plugin->no_logging) {
OONF_INFO(plugin->logging, "Plugin %s started", plugin->name);
}
plugin->_initialized = true;
return 0;
} | pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
xorl %ebx, %ebx
cmpb $0x0, 0x58(%rdi)
je 0x30e36
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rdi, %r14
movb $0x1, 0x5a(%rdi)
cmpq $0x0, 0x10(%rdi)
je 0x30e99
xorl %r12d, %r12d
leaq 0x3ce62(%rip), %r15 # 0x6dcb0
movq 0x8(%r14), %rax
movq (%rax,%r12,8), %rsi
movq %r15, %rdi
callq 0x2780e
leaq -0x70(%rax), %rdi
testq %rax, %rax
cmoveq %rax, %rdi
je 0x30f91
cmpb $0x1, 0x5a(%rdi)
je 0x30fce
callq 0x30e18
cmpl $-0x1, %eax
je 0x3100b
cmpl $0x1, %eax
je 0x31012
incq %r12
cmpq 0x10(%r14), %r12
jb 0x30e4e
movb $0x0, 0x5a(%r14)
cmpq $0x0, 0x60(%r14)
je 0x30ebf
movq (%r14), %rdi
movl 0x68(%r14), %esi
movl $0x105, %edx # imm = 0x105
callq 0x310e9
testq %rax, %rax
je 0x3106c
movq 0x30(%r14), %rax
testq %rax, %rax
je 0x30f06
callq *%rax
testl %eax, %eax
je 0x30f06
leaq 0x3c9fb(%rip), %rax # 0x6d8d0
movl $0xffffffff, %ebx # imm = 0xFFFFFFFF
testb $0x4, 0x4(%rax)
je 0x30e28
leaq 0xf2c5(%rip), %r10 # 0x401b0
leaq 0xf0f4(%rip), %rdx # 0x3ffe6
movl $0x4, %edi
movl $0x4, %esi
movl $0x1ac, %ecx # imm = 0x1AC
jmp 0x3109f
leaq 0x3c9c3(%rip), %r15 # 0x6d8d0
testb $0x2, 0x4(%r15)
je 0x30f47
leaq 0xf2b9(%rip), %r10 # 0x401d4
leaq 0xf0c4(%rip), %rdx # 0x3ffe6
movl $0x2, %edi
movl $0x4, %esi
movl $0x1b1, %ecx # imm = 0x1B1
xorl %r8d, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
pushq (%r14)
pushq %r10
callq 0x2efff
addq $0x10, %rsp
cmpb $0x0, 0x51(%r14)
jne 0x30f87
movl 0x54(%r14), %esi
testb $0x2, (%r15,%rsi)
je 0x30f87
leaq 0xf296(%rip), %r10 # 0x401f6
leaq 0xf07f(%rip), %rdx # 0x3ffe6
movl $0x2, %edi
movl $0x1b4, %ecx # imm = 0x1B4
xorl %r8d, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
pushq (%r14)
pushq %r10
callq 0x2efff
addq $0x10, %rsp
movb $0x1, 0x58(%r14)
jmp 0x30e28
leaq 0x3c938(%rip), %rax # 0x6d8d0
movl $0xffffffff, %ebx # imm = 0xFFFFFFFF
testb $0x4, 0x4(%rax)
je 0x30e28
movq 0x8(%r14), %r10
subq $0x8, %rsp
leaq 0xf176(%rip), %r11 # 0x4012c
leaq 0xf029(%rip), %rdx # 0x3ffe6
movl $0x4, %edi
movl $0x4, %esi
movl $0x18d, %ecx # imm = 0x18D
jmp 0x3104d
leaq 0x3c8fb(%rip), %rax # 0x6d8d0
movl $0x1, %ebx
testb $0x4, 0x4(%rax)
je 0x30e28
movq 0x8(%r14), %r10
subq $0x8, %rsp
leaq 0xf15a(%rip), %r11 # 0x4014d
leaq 0xefec(%rip), %rdx # 0x3ffe6
movl $0x4, %edi
movl $0x4, %esi
movl $0x192, %ecx # imm = 0x192
jmp 0x3104d
movl %eax, %ebx
jmp 0x30e28
leaq 0x3c8b7(%rip), %rax # 0x6d8d0
movl $0x1, %ebx
testb $0x4, 0x4(%rax)
je 0x30e28
movq 0x8(%r14), %r10
subq $0x8, %rsp
leaq 0xf116(%rip), %r11 # 0x4014d
leaq 0xefa8(%rip), %rdx # 0x3ffe6
movl $0x4, %edi
movl $0x4, %esi
movl $0x19d, %ecx # imm = 0x19D
xorl %r8d, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
pushq (%r14)
pushq (%r10,%r12,8)
pushq %r11
callq 0x2efff
addq $0x20, %rsp
jmp 0x30e28
leaq 0x3c85d(%rip), %rax # 0x6d8d0
movl $0xffffffff, %ebx # imm = 0xFFFFFFFF
testb $0x4, 0x4(%rax)
je 0x30e28
leaq 0xf0f4(%rip), %r10 # 0x4017d
leaq 0xef56(%rip), %rdx # 0x3ffe6
movl $0x4, %edi
movl $0x4, %esi
movl $0x1a6, %ecx # imm = 0x1A6
xorl %r8d, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
pushq (%r14)
pushq %r10
callq 0x2efff
addq $0x10, %rsp
jmp 0x30e28
| /OLSR[P]OONF/src/libcore/oonf_subsystem.c |
cleanup_plugin | static void
_cleanup_plugin(struct oonf_subsystem *plugin) {
struct oonf_subsystem *rdep;
size_t i;
if (!plugin->_initialized) {
return;
}
/* handle reverse dependencies */
avl_for_each_element(&oonf_plugin_tree, rdep, _node) {
/* look for reverse dependency */
for (i = 0; i < rdep->dependencies_count; i++) {
if (strcmp(rdep->dependencies[i], plugin->name) == 0) {
/* found a reverse dependency */
_cleanup_plugin(rdep);
}
}
}
if (plugin->cleanup) {
OONF_INFO(LOG_PLUGINS, "Cleanup plugin %s\n", plugin->name);
plugin->cleanup();
}
plugin->_initialized = false;
} | cmpb $0x1, 0x58(%rdi)
jne 0x312da
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x3ca73(%rip), %r15 # 0x6dcb0
movq 0x8(%r15), %rax
cmpq 0x3ca70(%rip), %rax # 0x6dcb8
je 0x31282
cmpq $0x0, -0x60(%r15)
je 0x3127d
leaq -0x70(%r15), %r14
xorl %r12d, %r12d
movq -0x68(%r15), %rax
movq (%rax,%r12,8), %rdi
movq (%rbx), %rsi
callq 0x11340
testl %eax, %eax
jne 0x31274
movq %r14, %rdi
callq 0x31221
incq %r12
cmpq -0x60(%r15), %r12
jb 0x31258
movq (%r15), %r15
jmp 0x3123d
cmpq $0x0, 0x40(%rbx)
je 0x312cb
leaq 0x3c640(%rip), %rax # 0x6d8d0
testb $0x2, 0x4(%rax)
je 0x312c8
leaq 0xf013(%rip), %r10 # 0x402b0
leaq 0xed42(%rip), %rdx # 0x3ffe6
movl $0x2, %edi
movl $0x4, %esi
movl $0x1d0, %ecx # imm = 0x1D0
xorl %r8d, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
pushq (%rbx)
pushq %r10
callq 0x2efff
addq $0x10, %rsp
callq *0x40(%rbx)
movb $0x0, 0x58(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
| /OLSR[P]OONF/src/libcore/oonf_subsystem.c |
os_core_linux_create_lockfile | int
os_core_linux_create_lockfile(const char *path) {
int lock_fd;
/* create file for lock */
lock_fd = open(path, O_RDWR | O_CREAT, S_IRWXU);
if (lock_fd == -1) {
return -1;
}
if (flock(lock_fd, LOCK_EX | LOCK_NB)) {
close(lock_fd);
return -1;
}
/* lock will be released when process ends */
return 0;
} | pushq %rbp
pushq %rbx
pushq %rax
xorl %ebx, %ebx
movl $0x42, %esi
movl $0x1c0, %edx # imm = 0x1C0
xorl %eax, %eax
callq 0x114b0
cmpl $-0x1, %eax
je 0x313c7
movl %eax, %ebp
movl %eax, %edi
movl $0x6, %esi
callq 0x114f0
testl %eax, %eax
je 0x313cc
movl %ebp, %edi
callq 0x11290
movl $0xffffffff, %ebx # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nopl (%rax)
| /OLSR[P]OONF/src/libcore/os_linux/os_core_linux.c |
rfc5497_timetlv_encode | uint8_t
rfc5497_timetlv_encode(uint64_t decoded) {
uint32_t a, b;
/*
* t = (1 + a/8) * 2^b * 1000 / 1024
* = (1000 + 125 * a) * (2^b / 2^10)
* = (1000 + 125 * a) * 2 ^ (b-10)
*/
if (decoded < RFC5497_TIMETLV_MIN) {
return 0;
}
if (decoded > RFC5497_TIMETLV_MAX) {
return 255;
}
b = 10;
if (decoded >= 1000) {
/* this means b >= 10 */
while (decoded > 1875) {
b++;
/* divide by 2 and round up */
decoded++;
decoded >>= 1;
}
}
else { /* decoded < 1000 */
/* b < 10 */
while (decoded < 1000) {
b--;
decoded <<= 1;
}
}
a = (decoded - 1000 + 124) / 125;
return a + (b << 3);
} | testq %rdi, %rdi
je 0x31456
movb $-0x1, %al
movl $0xdac00000, %ecx # imm = 0xDAC00000
cmpq %rcx, %rdi
ja 0x31458
movl $0xa, %esi
cmpq $0x3e7, %rdi # imm = 0x3E7
jbe 0x31442
cmpq $0x754, %rdi # imm = 0x754
jb 0x31459
movl $0xa, %esi
incl %esi
leaq 0x1(%rdi), %rcx
shrq %rcx
cmpq $0xea6, %rdi # imm = 0xEA6
movq %rcx, %rdi
ja 0x3142b
jmp 0x3145c
decl %esi
leaq (%rdi,%rdi), %rcx
cmpq $0x1f4, %rdi # imm = 0x1F4
movq %rcx, %rdi
jb 0x31442
jmp 0x3145c
xorl %eax, %eax
retq
movq %rdi, %rcx
addq $-0x36c, %rcx # imm = 0xFC94
movabsq $0x624dd2f1a9fbe77, %rdx # imm = 0x624DD2F1A9FBE77
movq %rcx, %rax
mulq %rdx
subq %rdx, %rcx
shrq %rcx
addl %edx, %ecx
shrl $0x6, %ecx
leal (%rcx,%rsi,8), %eax
retq
| /OLSR[P]OONF/src/librfc5444/rfc5444.c |
rfc5444_writer_set_msg_header | void
rfc5444_writer_set_msg_header(struct rfc5444_writer *writer, struct rfc5444_writer_message *msg, bool has_originator,
bool has_hopcount, bool has_hoplimit, bool has_seqno) {
#if WRITER_STATE_MACHINE == true
assert(writer->_state == RFC5444_WRITER_ADD_HEADER);
#endif
msg->has_origaddr = has_originator;
msg->has_hoplimit = has_hoplimit;
msg->has_hopcount = has_hopcount;
msg->has_seqno = has_seqno;
/* fixed parts: _msg type, flags, length, tlvblock-length */
writer->_msg.header = 6;
if (has_originator) {
writer->_msg.header += writer->msg_addr_len;
}
if (has_hoplimit) {
writer->_msg.header++;
}
if (has_hopcount) {
writer->_msg.header++;
}
if (has_seqno) {
writer->_msg.header += 2;
}
} | cmpl $0x3, 0x138(%rdi)
jne 0x32053
movb %dl, 0x67(%rsi)
movb %r8b, 0x65(%rsi)
movb %cl, 0x63(%rsi)
movb %r9b, 0x78(%rsi)
movq $0x6, 0x108(%rdi)
testb %dl, %dl
je 0x3202e
movzbl 0x8(%rdi), %eax
addq $0x6, %rax
movq %rax, 0x108(%rdi)
testb %r8b, %r8b
je 0x3203a
incq 0x108(%rdi)
testb %cl, %cl
je 0x32045
incq 0x108(%rdi)
testb %r9b, %r9b
je 0x32052
addq $0x2, 0x108(%rdi)
retq
pushq %rax
leaq 0xe97d(%rip), %rdi # 0x409d8
leaq 0xe625(%rip), %rsi # 0x40687
leaq 0xe99b(%rip), %rcx # 0x40a04
movl $0x2bb, %edx # imm = 0x2BB
callq 0x11230
| /OLSR[P]OONF/src/librfc5444/rfc5444_msg_generator.c |
close_addrblock | static void
_close_addrblock(struct _rfc5444_internal_addr_compress_session *acs, struct rfc5444_writer *writer,
struct rfc5444_writer_address *last_addr, int common_head) {
int best;
int i, size;
if (common_head > writer->msg_addr_len) {
/* nothing to do */
return;
}
/* check for best compression at closed blocks */
best = common_head;
size = acs[common_head].total;
for (i = common_head + 1; i < writer->msg_addr_len; i++) {
if (acs[i].total < size) {
size = acs[i].total;
best = i;
}
}
if (!acs[best].closed || !last_addr->_block_start) {
/* store address block for later binary generation */
last_addr->_block_start = acs[best].ptr;
last_addr->_block_multiple_prefixlen = acs[best].multiplen;
last_addr->_block_headlen = best;
}
for (i = common_head + 1; i < writer->msg_addr_len; i++) {
/* remember best block compression */
acs[i].total = size;
}
return;
} | movzbl 0x8(%rsi), %r9d
cmpl %ecx, %r9d
jl 0x32a7c
pushq %rbx
movslq %ecx, %rax
leaq (%rax,%rax,2), %r10
movl 0x8(%rdi,%r10,8), %eax
leal 0x1(%rcx), %r8d
cmpl %r9d, %r8d
jge 0x32a19
leaq (%rdi,%r10,8), %r10
addq $0x20, %r10
movl %r8d, %r11d
movl (%r10), %ebx
cmpl %eax, %ebx
cmovll %r11d, %ecx
cmovll %ebx, %eax
addq $0x18, %r10
incl %r11d
cmpl %r11d, %r9d
jne 0x32a01
movslq %ecx, %r9
leaq (%r9,%r9,2), %r9
cmpb $0x1, 0x11(%rdi,%r9,8)
jne 0x32a32
cmpq $0x0, 0xa8(%rdx)
jne 0x32a51
leaq (%rdi,%r9,8), %r9
movq (%r9), %r10
movq %r10, 0xa8(%rdx)
movb 0x10(%r9), %r9b
movb %r9b, 0x99(%rdx)
movb %cl, 0x98(%rdx)
movzbl 0x8(%rsi), %ecx
cmpl %ecx, %r8d
jge 0x32a7b
movslq %r8d, %rcx
leaq (%rcx,%rcx,2), %rdx
leaq (%rdi,%rdx,8), %rdx
addq $0x8, %rdx
movl %eax, (%rdx)
incq %rcx
movzbl 0x8(%rsi), %edi
addq $0x18, %rdx
cmpq %rdi, %rcx
jl 0x32a69
popq %rbx
retq
| /OLSR[P]OONF/src/librfc5444/rfc5444_msg_generator.c |
rfc5444_writer_forward_msg | enum rfc5444_result
rfc5444_writer_forward_msg(
struct rfc5444_writer *writer, struct rfc5444_reader_tlvblock_context *context, const uint8_t *msg, size_t len)
{
struct rfc5444_writer_target *target;
struct rfc5444_writer_message *rfc5444_msg;
struct rfc5444_writer_forward_handler *handler;
int cnt, hopcount, hoplimit;
size_t max, transformer_overhead;
size_t generic_size, msg_size;
uint8_t flags, addr_len;
uint8_t *ptr;
bool shall_forward;
#if WRITER_STATE_MACHINE == true
assert(writer->_state == RFC5444_WRITER_NONE);
#endif
rfc5444_msg = avl_find_element(&writer->_msgcreators, &context->msg_type, rfc5444_msg, _msgcreator_node);
if (rfc5444_msg == NULL) {
/* error, no msgcreator found */
return RFC5444_NO_MSGCREATOR;
}
if (!rfc5444_msg->forward_target_selector) {
/* no forwarding handler, do not forward */
return RFC5444_OKAY;
}
/* 1.) first flush all interfaces that have (too) full buffers */
shall_forward = false;
list_for_each_element(&writer->_targets, target, _target_node) {
if (!rfc5444_msg->forward_target_selector(target, context)) {
continue;
}
shall_forward = true;
transformer_overhead = 0;
avl_for_each_element(&writer->_forwarding_processors, handler, _node) {
if (handler->is_matching_signature(handler, msg[0])) {
transformer_overhead += handler->allocate_space;
}
}
max = 0;
if (!target->_is_flushed) {
max =
target->_pkt.max - (target->_pkt.header + target->_pkt.added + target->_pkt.allocated + target->_bin_msgs_size);
if (len + transformer_overhead > max) {
/* flush the old packet */
rfc5444_writer_flush(writer, target, false);
}
}
if (target->_is_flushed) {
/* begin a new packet */
_rfc5444_writer_begin_packet(writer, target);
max =
target->_pkt.max - (target->_pkt.header + target->_pkt.added + target->_pkt.allocated + target->_bin_msgs_size);
}
if (len + transformer_overhead > max) {
/* message too long, too much data in it */
return RFC5444_FW_MESSAGE_TOO_LONG;
}
}
if (!shall_forward) {
/* no target to forward message, everything done */
return RFC5444_OKAY;
}
/* 2.) generate message and do non-target specific post processors */
ptr = _msg_buffer;
memcpy(ptr, writer->_msg.buffer, len);
/* remember length */
generic_size = len;
/* run processors (unpspecific) forwarding processors */
avl_for_each_element(&writer->_forwarding_processors, handler, _node) {
if (handler->is_matching_signature(handler, msg[0]) && !handler->target_specific) {
if (handler->process(handler, target, context, _msg_buffer, &generic_size)) {
/* error, we have not modified the _bin_msgs_size, so we can just return */
return RFC5444_FW_BAD_TRANSFORM;
}
if (generic_size == 0) {
return RFC5444_OKAY;
}
}
}
/* 3) grab index of header structures */
flags = msg[1];
addr_len = (flags & RFC5444_MSG_FLAG_ADDRLENMASK) + 1;
cnt = 4;
hopcount = -1;
hoplimit = -1;
if ((flags & RFC5444_MSG_FLAG_ORIGINATOR) != 0) {
cnt += addr_len;
}
if ((flags & RFC5444_MSG_FLAG_HOPLIMIT) != 0) {
hoplimit = cnt++;
}
if ((flags & RFC5444_MSG_FLAG_HOPCOUNT) != 0) {
hopcount = cnt++;
}
if ((flags & RFC5444_MSG_FLAG_SEQNO) != 0) {
cnt += 2;
}
if (hoplimit != -1 && msg[hoplimit] <= 1) {
/* do not forward a message with hopcount 1 or 0 */
return RFC5444_OKAY;
}
/* forward message */
list_for_each_element(&writer->_targets, target, _target_node) {
if (!rfc5444_msg->forward_target_selector(target, context)) {
continue;
}
ptr =
&target->_pkt.buffer[target->_pkt.header + target->_pkt.added + target->_pkt.allocated + target->_bin_msgs_size];
/* copy message into packet buffer */
assert(ptr + generic_size <= target->_pkt.buffer + target->_pkt.max);
memcpy(ptr, msg, generic_size);
/* remember position of first copy */
msg_size = generic_size;
/* run processors */
avl_for_each_element(&writer->_forwarding_processors, handler, _node) {
if (handler->is_matching_signature(handler, msg[0]) && handler->target_specific) {
if (handler->process(handler, target, context, ptr, &msg_size)) {
/* error, we have not modified the _bin_msgs_size, so we can just return */
return RFC5444_FW_BAD_TRANSFORM;
}
if (msg_size == 0) {
break;
}
}
}
if (msg_size > 0) {
target->_bin_msgs_size += msg_size;
/* correct message */
ptr[2] = msg_size >> 8;
ptr[3] = msg_size & 0xff;
/* correct hoplimit if necesssary */
if (hoplimit != -1) {
ptr[hoplimit]--;
}
/* correct hopcount if necessary */
if (hopcount != -1) {
ptr[hopcount]++;
}
if (writer->message_generation_notifier) {
writer->message_generation_notifier(target);
}
}
}
return RFC5444_OKAY;
} | pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rcx, 0x8(%rsp)
cmpl $0x0, 0x138(%rdi)
jne 0x32e56
movq %rdx, %rbx
movq %rsi, %rbp
movq %rdi, %r15
addq $0x58, %rdi
addq $0x30, %rsi
callq 0x2780e
testq %rax, %rax
je 0x32bf9
movq %rax, %r13
cmpq $0x0, 0xe8(%rax)
je 0x32e37
movq 0xe0(%r15), %r14
leaq -0x30(%r14), %rdi
movq 0x8(%r14), %rcx
xorl %eax, %eax
cmpq 0xe8(%r15), %rcx
movq %rbp, 0x30(%rsp)
movq %r13, 0x28(%rsp)
je 0x32c03
xorl %r12d, %r12d
movq %rdi, 0x10(%rsp)
movq %rbp, %rsi
callq *0xe8(%r13)
testb %al, %al
je 0x32bdd
movq 0xb8(%r15), %r12
movq 0x8(%r12), %rax
cmpq 0xc0(%r15), %rax
je 0x32b56
xorl %r13d, %r13d
movzbl (%rbx), %esi
movq %r12, %rdi
callq *0x40(%r12)
testb %al, %al
je 0x32b42
movzwl 0x3c(%r12), %eax
addq %rax, %r13
movq (%r12), %r12
movq 0x8(%r12), %rax
cmpq 0xc0(%r15), %rax
jne 0x32b2a
jmp 0x32b59
xorl %r13d, %r13d
cmpb $0x0, 0x10(%r14)
je 0x32b64
xorl %ebp, %ebp
jmp 0x32b97
movq 0x20(%r14), %rax
addq 0x28(%r14), %rax
addq 0x30(%r14), %rax
addq 0x48(%r14), %rax
movq 0x40(%r14), %rbp
subq %rax, %rbp
movq 0x8(%rsp), %rax
addq %r13, %rax
cmpq %rbp, %rax
jbe 0x32b97
movq %r15, %rdi
movq 0x10(%rsp), %rsi
xorl %edx, %edx
callq 0x33251
cmpb $0x1, 0x10(%r14)
jne 0x32bc2
movq %r15, %rdi
movq 0x10(%rsp), %rsi
callq 0x33150
movq 0x20(%r14), %rax
addq 0x28(%r14), %rax
addq 0x30(%r14), %rax
movq 0x40(%r14), %rbp
addq 0x48(%r14), %rax
subq %rax, %rbp
addq 0x8(%rsp), %r13
movb $0x1, %r12b
cmpq %rbp, %r13
movq 0x30(%rsp), %rbp
movq 0x28(%rsp), %r13
ja 0x32e3b
movq (%r14), %r14
leaq -0x30(%r14), %rdi
movq 0x8(%r14), %rax
cmpq 0xe8(%r15), %rax
jne 0x32afb
xorl %eax, %eax
jmp 0x32c06
movl $0xfffffff3, %eax # imm = 0xFFFFFFF3
jmp 0x32e47
xorl %r12d, %r12d
testb $0x1, %r12b
je 0x32e47
movq %rdi, %r12
movq 0x100(%r15), %rsi
leaq 0x3b0bf(%rip), %rdi # 0x6dce0
movq 0x8(%rsp), %r14
movq %r14, %rdx
callq 0x11380
movq %r14, 0x20(%rsp)
movq 0xb8(%r15), %r13
movq 0x8(%r13), %rax
cmpq 0xc0(%r15), %rax
je 0x32c9d
leaq 0x3b092(%rip), %r14 # 0x6dce0
movzbl (%rbx), %esi
movq %r13, %rdi
callq *0x40(%r13)
testb %al, %al
je 0x32c8c
cmpb $0x0, 0x3e(%r13)
jne 0x32c8c
movq %r13, %rdi
movq %r12, %rsi
movq %rbp, %rdx
movq %r14, %rcx
leaq 0x20(%rsp), %r8
callq *0x48(%r13)
testl %eax, %eax
jne 0x32e42
cmpq $0x0, 0x20(%rsp)
je 0x32e37
movq (%r13), %r13
movq 0x8(%r13), %rax
cmpq 0xc0(%r15), %rax
jne 0x32c4e
movzbl 0x1(%rbx), %edx
movl %edx, %eax
andb $0xf, %al
addb $0x5, %al
testb %dl, %dl
movzbl %al, %eax
movl $0x4, %ecx
cmovsl %eax, %ecx
movzbl %cl, %edi
movl %edx, %esi
andl $0x40, %esi
xorl %eax, %eax
cmpl $0x1, %esi
movl $0x0, %ecx
sbbl %ecx, %ecx
orl %edi, %ecx
movl %edx, 0x8(%rsp)
andl $0x20, %edx
cmpl $0x1, %edx
movl $0x0, %edx
sbbl %edx, %edx
movl %esi, 0x10(%rsp)
testl %esi, %esi
movq 0x28(%rsp), %r13
je 0x32cf4
movl %ecx, %esi
cmpb $0x2, (%rbx,%rsi)
jb 0x32e47
movq 0xe0(%r15), %r14
movq 0x8(%r14), %rsi
cmpq 0xe8(%r15), %rsi
je 0x32e47
movl 0x10(%rsp), %esi
shrl $0x6, %esi
addl %edi, %esi
orl %esi, %edx
movl %ecx, %eax
movq %rax, 0x40(%rsp)
movslq %edx, %rax
movq %rax, 0x38(%rsp)
leaq -0x30(%r14), %rdi
movq %rdi, %r12
movq %rbp, %rsi
callq *0xe8(%r13)
testb %al, %al
je 0x32e1e
movq 0x18(%r14), %rax
movq 0x20(%r14), %rbp
addq %rax, %rbp
addq 0x28(%r14), %rbp
addq 0x30(%r14), %rbp
addq 0x48(%r14), %rbp
movq 0x20(%rsp), %rdx
leaq (%rdx,%rbp), %rcx
addq 0x40(%r14), %rax
cmpq %rax, %rcx
ja 0x32e75
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x11380
movq 0x20(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0xb8(%r15), %r13
movq 0x8(%r13), %rax
cmpq 0xc0(%r15), %rax
je 0x32dd3
movzbl (%rbx), %esi
movq %r13, %rdi
callq *0x40(%r13)
testb %al, %al
je 0x32dcd
cmpb $0x1, 0x3e(%r13)
jne 0x32dcd
movq %r13, %rdi
movq %r12, %rsi
movq 0x30(%rsp), %rdx
movq %rbp, %rcx
leaq 0x18(%rsp), %r8
callq *0x48(%r13)
testl %eax, %eax
jne 0x32e42
cmpq $0x0, 0x18(%rsp)
je 0x32dd3
movq (%r13), %r13
jmp 0x32d88
movq 0x18(%rsp), %rax
testq %rax, %rax
movq 0x28(%rsp), %r13
je 0x32e1e
addq %rax, 0x48(%r14)
movb %ah, 0x2(%rbp)
movb 0x18(%rsp), %al
movb %al, 0x3(%rbp)
cmpl $0x0, 0x10(%rsp)
je 0x32e00
movq 0x40(%rsp), %rax
decb (%rbp,%rax)
testb $0x20, 0x8(%rsp)
je 0x32e10
movq 0x38(%rsp), %rax
incb (%rbp,%rax)
movq 0x28(%r15), %rax
testq %rax, %rax
je 0x32e1e
movq %r12, %rdi
callq *%rax
movq (%r14), %r14
movq 0x8(%r14), %rax
cmpq 0xe8(%r15), %rax
movq 0x30(%rsp), %rbp
jne 0x32d26
xorl %eax, %eax
jmp 0x32e47
movl $0xfffffff2, %eax # imm = 0xFFFFFFF2
jmp 0x32e47
movl $0xffffffef, %eax # imm = 0xFFFFFFEF
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xd804(%rip), %rdi # 0x40661
leaq 0xd823(%rip), %rsi # 0x40687
leaq 0xd905(%rip), %rcx # 0x40770
movl $0x1d1, %edx # imm = 0x1D1
callq 0x11230
leaq 0xd97f(%rip), %rdi # 0x407fb
leaq 0xd804(%rip), %rsi # 0x40687
leaq 0xd8e6(%rip), %rcx # 0x40770
movl $0x244, %edx # imm = 0x244
callq 0x11230
| /OLSR[P]OONF/src/librfc5444/rfc5444_msg_generator.c |
rfc5444_writer_begin_packet | void
_rfc5444_writer_begin_packet(struct rfc5444_writer *writer, struct rfc5444_writer_target *target) {
struct rfc5444_writer_postprocessor *processor;
struct rfc5444_writer_pkthandler *handler;
/* cleanup packet buffer data */
_rfc5444_tlv_writer_init(&target->_pkt, target->packet_size, target->packet_size);
/* loop over post-processors */
avl_for_each_element(&writer->_processors, processor, _node) {
if (processor->is_matching_signature(processor, RFC5444_WRITER_PKT_POSTPROCESSOR)) {
target->_pkt.allocated += processor->allocate_space;
}
}
#if WRITER_STATE_MACHINE == true
writer->_state = RFC5444_WRITER_ADD_PKTHEADER;
#endif
/* add packet header */
if (target->addPacketHeader) {
target->addPacketHeader(writer, target);
}
else {
rfc5444_writer_set_pkt_header(writer, target, false);
}
#if WRITER_STATE_MACHINE == true
writer->_state = RFC5444_WRITER_ADD_PKTTLV;
#endif
/* add packet tlvs */
list_for_each_element(&writer->_pkthandlers, handler, _pkthandle_node) {
if (handler->addPacketTLVs) {
handler->addPacketTLVs(writer, target);
}
}
target->_is_flushed = false;
#if WRITER_STATE_MACHINE == true
writer->_state = RFC5444_WRITER_NONE;
#endif
} | pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x48(%rsi), %rdi
movq 0x8(%rsi), %rdx
movq %rdx, %rsi
callq 0x36100
movq 0x90(%rbx), %r15
movq 0x8(%r15), %rax
cmpq 0x98(%rbx), %rax
je 0x3319d
movq %r15, %rdi
movl $0xffffffff, %esi # imm = 0xFFFFFFFF
callq *0x40(%r15)
testb %al, %al
je 0x33198
movzwl 0x3c(%r15), %eax
addq %rax, 0x60(%r14)
movq (%r15), %r15
jmp 0x33172
movl $0x1, 0x138(%rbx)
movq 0x10(%r14), %rax
testq %rax, %rax
je 0x331ba
movq %rbx, %rdi
movq %r14, %rsi
callq *%rax
jmp 0x331c7
movq $0x3, 0x50(%r14)
movb $0x0, 0x28(%r14)
movl $0x2, 0x138(%rbx)
movq 0x80(%rbx), %r15
movq 0x8(%r15), %rax
cmpq 0x88(%rbx), %rax
je 0x331fb
movq 0x10(%r15), %rax
testq %rax, %rax
je 0x331f6
movq %rbx, %rdi
movq %r14, %rsi
callq *%rax
movq (%r15), %r15
jmp 0x331d8
movb $0x0, 0x40(%r14)
movl $0x0, 0x138(%rbx)
popq %rbx
popq %r14
popq %r15
retq
| /OLSR[P]OONF/src/librfc5444/rfc5444_pkt_generator.c |
rfc5444_print_add | void
rfc5444_print_add(struct rfc5444_print_session *session, struct rfc5444_reader *reader) {
/* memorize reader */
session->_reader = reader;
session->_pkt.start_callback = _cb_print_pkt_start;
session->_pkt.tlv_callback = _cb_print_pkt_tlv;
session->_pkt.end_callback = _cb_print_pkt_end;
rfc5444_reader_add_packet_consumer(reader, &session->_pkt, NULL, 0);
session->_msg.default_msg_consumer = true;
session->_msg.start_callback = _cb_print_msg_start;
session->_msg.tlv_callback = _cb_print_msg_tlv;
session->_msg.end_callback = _cb_print_msg_end;
rfc5444_reader_add_message_consumer(reader, &session->_msg, NULL, 0);
session->_addr.default_msg_consumer = true;
session->_addr.addrblock_consumer = true;
session->_addr.start_callback = _cb_print_addr_start;
session->_addr.tlv_callback = _cb_print_addr_tlv;
session->_addr.end_callback = _cb_print_addr_end;
rfc5444_reader_add_message_consumer(reader, &session->_addr, NULL, 0);
} | pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, 0x178(%rdi)
leaq 0x10(%rdi), %rsi
leaq 0xbc(%rip), %rax # 0x3362c
movq %rax, 0x60(%rdi)
leaq 0x167(%rip), %rax # 0x336e2
movq %rax, 0x70(%rdi)
leaq 0x232(%rip), %rax # 0x337b8
movq %rax, 0x68(%rdi)
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x35f4b
leaq 0x88(%r14), %rsi
movb $0x1, %bpl
movb %bpl, 0xc4(%r14)
leaq 0x235(%rip), %rax # 0x337e3
movq %rax, 0xd8(%r14)
leaq 0x37e(%rip), %rax # 0x3393a
movq %rax, 0xe8(%r14)
leaq 0x45b(%rip), %rax # 0x33a25
movq %rax, 0xe0(%r14)
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3602d
leaq 0x100(%r14), %rsi
movb %bpl, 0x13c(%r14)
movb %bpl, 0x13e(%r14)
leaq 0x46d(%rip), %rax # 0x33a66
movq %rax, 0x150(%r14)
leaq 0x4dd(%rip), %rax # 0x33ae4
movq %rax, 0x160(%r14)
leaq 0x5ba(%rip), %rax # 0x33bcf
movq %rax, 0x158(%r14)
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
popq %rbx
popq %r14
popq %rbp
jmp 0x3602d
| /OLSR[P]OONF/src/librfc5444/rfc5444_print.c |
cb_print_pkt_end | enum rfc5444_result
_cb_print_pkt_end(struct rfc5444_reader_tlvblock_context *context, bool dropped __attribute__((unused)))
{
struct rfc5444_print_session *session;
session = container_of(context->consumer, struct rfc5444_print_session, _pkt);
abuf_puts(session->output, "\t`------------------\n");
if (session->print_packet) {
session->print_packet(session);
}
return RFC5444_OKAY;
} | pushq %rbx
movq 0x8(%rdi), %rbx
movq -0x10(%rbx), %rdi
leaq 0xe119(%rip), %rsi # 0x418e1
callq 0x27362
movq -0x8(%rbx), %rax
testq %rax, %rax
je 0x337df
addq $-0x10, %rbx
movq %rbx, %rdi
callq *%rax
xorl %eax, %eax
popq %rbx
retq
| /OLSR[P]OONF/src/librfc5444/rfc5444_print.c |
rfc5444_print_direct | enum rfc5444_result
rfc5444_print_direct(struct autobuf *out, void *buffer, size_t length)
{
struct rfc5444_reader reader;
struct rfc5444_print_session session;
enum rfc5444_result result;
memset(&reader, 0, sizeof(reader));
memset(&session, 0, sizeof(session));
session.output = out;
rfc5444_reader_init(&reader);
rfc5444_print_add(&session, &reader);
result = rfc5444_reader_handle_packet(&reader, buffer, length);
if (result) {
abuf_appendf(out, "Error while parsing rfc5444: %s\n", rfc5444_strerror(result));
}
rfc5444_print_remove(&session);
rfc5444_reader_cleanup(&reader);
return result;
} | pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f8, %rsp # imm = 0x1F8
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
xorps %xmm0, %xmm0
movq %rsp, %r12
movaps %xmm0, (%r12)
movaps %xmm0, 0x10(%r12)
movaps %xmm0, 0x20(%r12)
movaps %xmm0, 0x30(%r12)
movaps %xmm0, 0x40(%r12)
movaps %xmm0, 0x50(%r12)
movaps %xmm0, 0x60(%r12)
movq $0x0, 0x70(%r12)
leaq 0x78(%rsp), %r13
movl $0x180, %edx # imm = 0x180
movq %r13, %rdi
xorl %esi, %esi
callq 0x11250
movq %rbx, (%r13)
movq %r12, %rdi
callq 0x348e4
movq %r13, %rdi
movq %r12, %rsi
callq 0x33554
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x349d5
movl %eax, %ebp
testl %eax, %eax
je 0x33cfa
movl %ebp, %edi
callq 0x31550
leaq 0xd4f5(%rip), %rsi # 0x411e2
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x272d1
leaq 0x78(%rsp), %rdi
callq 0x33c10
movq %rsp, %rdi
callq 0x349be
movl %ebp, %eax
addq $0x1f8, %rsp # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
| /OLSR[P]OONF/src/librfc5444/rfc5444_print.c |
print_raw_tlvblock | static int
_print_raw_tlvblock(struct autobuf *out, const char *prefix, uint8_t *blockptr, size_t *idx, size_t length) {
char valueprefix[128];
uint16_t blocklength, tlv_len, tlv_singlelength;
uint8_t *tlvptr;
size_t idx2;
uint8_t tlv_flags, startidx, endidx;
if (2 > length) {
return -1;
}
abuf_appendf(out, "%s,-------------------\n", prefix);
abuf_appendf(out, "%s| TLV BLOCK\n", prefix);
abuf_appendf(out, "%s|-------------------\n", prefix);
blocklength = (blockptr[*idx] << 8) | blockptr[*idx + 1];
abuf_appendf(out, "%s| * TLV Block Size: %u\n", prefix, blocklength);
if (blocklength + 2u > length) {
return -1;
}
*idx += 2;
tlvptr = &blockptr[*idx];
for (idx2 = 0; idx2 < blocklength;) {
if (idx2 + 2 > blocklength) {
return -1;
}
abuf_appendf(out, "%s| ,-------------------\n", prefix);
abuf_appendf(out, "%s| | TLV\n", prefix);
abuf_appendf(out, "%s| |-------------------\n", prefix);
abuf_appendf(out, "%s| | type: %u\n", prefix, tlvptr[idx2]);
idx2++;
tlv_flags = tlvptr[idx2];
abuf_appendf(out, "%s| | flags: 0x%02x\n", prefix, tlv_flags);
idx2++;
if (tlv_flags & RFC5444_TLV_FLAG_TYPEEXT) {
if (idx2 + 1 > blocklength) {
return -1;
}
abuf_appendf(out, "%s| | ext-type: %u\n", prefix, tlvptr[idx2]);
idx2++;
}
startidx = 0;
endidx = 0;
if (tlv_flags & (RFC5444_TLV_FLAG_SINGLE_IDX | RFC5444_TLV_FLAG_MULTI_IDX)) {
if (idx2 + 1 > blocklength) {
return -1;
}
startidx = tlvptr[idx2];
endidx = startidx;
abuf_appendf(out, "%s| | index-start: %u\n", prefix, startidx);
idx2++;
}
if (tlv_flags & (RFC5444_TLV_FLAG_MULTI_IDX)) {
if (idx2 + 1 > blocklength) {
return -1;
}
endidx = tlvptr[idx2];
if (endidx < startidx) {
return -1;
}
abuf_appendf(out, "%s| | index-end: %u\n", prefix, endidx);
idx2++;
}
tlv_len = 0;
if (tlv_flags & (RFC5444_TLV_FLAG_EXTVALUE)) {
if (idx2 + 1 > blocklength) {
return -1;
}
tlv_len = tlvptr[idx2] << 8;
idx2++;
}
if (tlv_flags & (RFC5444_TLV_FLAG_VALUE)) {
if (idx2 + 1 > blocklength) {
return -1;
}
tlv_len |= tlvptr[idx2];
idx2++;
}
if (tlv_flags & (RFC5444_TLV_FLAG_EXTVALUE | RFC5444_TLV_FLAG_VALUE)) {
abuf_appendf(out, "%s| | length: %u\n", prefix, tlv_len);
}
if (idx2 + tlv_len > blocklength) {
return -1;
}
if (tlv_flags & RFC5444_TLV_FLAG_MULTIVALUE) {
if (tlv_len % (endidx - startidx + 1)) {
return -1;
}
tlv_singlelength = tlv_len / (endidx - startidx + 1);
}
else {
tlv_singlelength = tlv_len;
endidx = startidx;
}
snprintf(valueprefix, sizeof(valueprefix), "%s| | ", prefix);
for (; startidx <= endidx; startidx++) {
if (idx2 + tlv_singlelength > blocklength) {
return -1;
}
abuf_hexdump(out, valueprefix, &tlvptr[idx2], tlv_singlelength);
idx2 += tlv_singlelength;
abuf_puts(out, "\n");
}
}
if (blocklength != idx2) {
return -1;
}
*idx += blocklength;
return 0;
} | movl $0xffffffff, %eax # imm = 0xFFFFFFFF
cmpq $0x2, %r8
jb 0x34590
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %r8, %r14
movq %rcx, %rbp
movq %rdx, %rbx
movq %rsi, %r13
movq %rdi, %r12
leaq 0xd04f(%rip), %rsi # 0x41567
movq %r13, %rdx
xorl %eax, %eax
callq 0x272d1
leaq 0xd056(%rip), %rsi # 0x4157f
movq %r12, %rdi
movq %r13, %rdx
xorl %eax, %eax
callq 0x272d1
leaq 0xd052(%rip), %rsi # 0x4158f
movq %r12, %rdi
movq %r13, %rdx
xorl %eax, %eax
callq 0x272d1
movq (%rbp), %rax
movzwl (%rbx,%rax), %eax
rolw $0x8, %ax
movzwl %ax, %r15d
leaq 0xd046(%rip), %rsi # 0x415a7
movq %r12, %rdi
movq %r13, %rdx
movl %r15d, %ecx
xorl %eax, %eax
callq 0x272d1
leal 0x2(%r15), %eax
cmpq %r14, %rax
jbe 0x34591
movl $0xffffffff, %eax # imm = 0xFFFFFFFF
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdx
movq (%rbp), %rax
leaq 0x2(%rax), %rcx
movq %rcx, (%rbp)
testw %dx, %dx
je 0x3485d
addq %rbx, %rax
addq $0x2, %rax
movq %rax, 0x18(%rsp)
xorl %r14d, %r14d
movl $0xffffffff, %eax # imm = 0xFFFFFFFF
movq %rbp, 0x28(%rsp)
movq %r13, 0x20(%rsp)
movq %rdx, 0x10(%rsp)
leaq 0x2(%r14), %rbx
cmpq %rdx, %rbx
ja 0x3457f
movq %r12, %rdi
leaq 0xcfe2(%rip), %rsi # 0x415c1
movq %r13, %rdx
xorl %eax, %eax
callq 0x272d1
movq %r12, %rdi
leaq 0xcfeb(%rip), %rsi # 0x415de
movq %r13, %rdx
xorl %eax, %eax
callq 0x272d1
movq %r12, %rdi
leaq 0xcfe6(%rip), %rsi # 0x415ed
movq %r13, %rdx
xorl %eax, %eax
callq 0x272d1
movq 0x18(%rsp), %r15
movzbl (%r15,%r14), %ecx
movq %r12, %rdi
leaq 0xcfe5(%rip), %rsi # 0x4160a
movq %r13, %rdx
xorl %eax, %eax
callq 0x272d1
movzbl 0x1(%r15,%r14), %r15d
movq %r12, %rdi
leaq 0xcfe5(%rip), %rsi # 0x41624
movq %r13, %rdx
movl %r15d, %ecx
xorl %eax, %eax
callq 0x272d1
testb %r15b, %r15b
js 0x34656
movq %rbx, %r14
jmp 0x34682
addq $0x3, %r14
cmpq 0x10(%rsp), %r14
ja 0x3457a
movq 0x18(%rsp), %rax
movzbl (%rax,%rbx), %ecx
movq %r12, %rdi
leaq 0xcfca(%rip), %rsi # 0x41642
movq %r13, %rdx
xorl %eax, %eax
callq 0x272d1
movq 0x10(%rsp), %rcx
testb $0x60, %r15b
je 0x346c1
cmpq %rcx, %r14
jae 0x3457a
movq %r13, %rdx
movq 0x18(%rsp), %rax
movb (%rax,%r14), %r13b
incq %r14
movzbl %r13b, %ecx
movq %r12, %rdi
leaq 0xcfa9(%rip), %rsi # 0x4165c
xorl %eax, %eax
callq 0x272d1
movq 0x10(%rsp), %rcx
jmp 0x346c4
xorl %r13d, %r13d
testb $0x20, %r15b
jne 0x346d2
movq %r14, %rbx
movl %r13d, %esi
jmp 0x34715
leaq 0x1(%r14), %rbx
cmpq %rcx, %rbx
ja 0x3457a
movq 0x18(%rsp), %rax
movb (%rax,%r14), %al
cmpb %r13b, %al
jb 0x3457a
movzbl %al, %ecx
movq %r12, %rdi
movl %eax, %r14d
leaq 0xcf75(%rip), %rsi # 0x41676
movq 0x20(%rsp), %rdx
xorl %eax, %eax
callq 0x272d1
movl %r14d, %esi
movq 0x10(%rsp), %rcx
testb $0x8, %r15b
jne 0x34720
xorl %r14d, %r14d
jmp 0x3473e
leaq 0x1(%rbx), %rax
cmpq %rcx, %rax
ja 0x3457a
movq 0x18(%rsp), %rdx
movzbl (%rdx,%rbx), %r14d
shll $0x8, %r14d
movq %rax, %rbx
testb $0x10, %r15b
jne 0x34749
movq %rbx, %rbp
jmp 0x34762
leaq 0x1(%rbx), %rbp
cmpq %rcx, %rbp
ja 0x3457a
movq 0x18(%rsp), %rax
movzbl (%rax,%rbx), %eax
orl %eax, %r14d
movzwl %r14w, %ebx
testb $0x18, %r15b
je 0x34793
movq %r12, %rdi
movb %sil, 0xf(%rsp)
leaq 0xcf15(%rip), %rsi # 0x41690
movq 0x20(%rsp), %rdx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x272d1
movb 0xf(%rsp), %sil
movq 0x10(%rsp), %rcx
leaq (%rbx,%rbp), %rax
cmpq %rcx, %rax
ja 0x3457a
movl %r15d, %eax
movl %r13d, %r15d
testb $0x4, %al
je 0x347ca
movzbl %sil, %ecx
movzbl %r13b, %eax
subl %eax, %ecx
incl %ecx
movl %ebx, %eax
xorl %edx, %edx
idivl %ecx
testl %edx, %edx
jne 0x3457a
movl %eax, %r14d
movl %esi, %r15d
movl $0x80, %esi
leaq 0x30(%rsp), %rdi
leaq 0xcecf(%rip), %rdx # 0x416aa
movq 0x20(%rsp), %rcx
xorl %eax, %eax
callq 0x111e0
cmpb %r15b, %r13b
jbe 0x347f6
movq %rbp, %r14
movq 0x10(%rsp), %rdx
jmp 0x34843
movzwl %r14w, %ebx
movq 0x10(%rsp), %rdx
leaq (%rbx,%rbp), %r14
cmpq %rdx, %r14
ja 0x3457a
addq 0x18(%rsp), %rbp
movq %r12, %rdi
leaq 0x30(%rsp), %rsi
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x27642
movq %r12, %rdi
leaq 0x9c1b(%rip), %rsi # 0x3e449
callq 0x27362
movq 0x10(%rsp), %rdx
incb %r13b
movq %r14, %rbp
cmpb %r15b, %r13b
jbe 0x347ff
cmpq %rdx, %r14
movl $0xffffffff, %eax # imm = 0xFFFFFFFF
movq 0x28(%rsp), %rbp
movq 0x20(%rsp), %r13
jb 0x345cc
jmp 0x34865
xorl %r14d, %r14d
movl $0xffffffff, %eax # imm = 0xFFFFFFFF
cmpq %rdx, %r14
jne 0x3457f
addq %rdx, (%rbp)
xorl %eax, %eax
jmp 0x3457f
| /OLSR[P]OONF/src/librfc5444/rfc5444_print.c |
consumer_avl_comp | static int
_consumer_avl_comp(const void *k1, const void *k2) {
const struct rfc5444_reader_tlvblock_consumer *c1 = k1;
const struct rfc5444_reader_tlvblock_consumer *c2 = k2;
if (c1->order > c2->order) {
return 1;
}
if (c1->order < c2->order) {
return -1;
}
if (c1->addrblock_consumer && !c2->addrblock_consumer) {
return 1;
}
if (!c1->addrblock_consumer && c2->addrblock_consumer) {
return -1;
}
return 0;
} | movl 0x38(%rsi), %ecx
movl $0x1, %eax
cmpl %ecx, 0x38(%rdi)
jle 0x3496e
retq
jge 0x34976
movl $0xffffffff, %eax # imm = 0xFFFFFFFF
retq
movb 0x3e(%rdi), %cl
cmpb $0x1, %cl
jne 0x34988
cmpb $0x1, 0x3e(%rsi)
jne 0x3496d
testb %cl, %cl
jne 0x34993
cmpb $0x0, 0x3e(%rsi)
movl $0xffffffff, %eax # imm = 0xFFFFFFFF
jne 0x3496d
xorl %eax, %eax
retq
| /OLSR[P]OONF/src/librfc5444/rfc5444_reader.c |
rfc5444_reader_handle_packet | enum rfc5444_result
rfc5444_reader_handle_packet(struct rfc5444_reader *parser, const uint8_t *buffer, size_t length)
{
struct rfc5444_reader_tlvblock_context context;
struct avl_tree entries;
struct rfc5444_reader_tlvblock_consumer *consumer, *last_started;
const uint8_t *ptr, *eob;
bool has_tlv;
uint8_t first_byte;
enum rfc5444_result result = RFC5444_OKAY;
if (length > 65535) {
return RFC5444_TOO_LARGE;
}
/* copy pointer to prevent writing over parameter */
ptr = buffer;
eob = buffer + length;
/* initialize tlv context */
memset(&context, 0, sizeof(context));
context.type = RFC5444_CONTEXT_PACKET;
context.reader = parser;
/* read header of packet */
first_byte = _rfc5444_get_u8(&ptr, eob, &result);
context.pkt_version = rfc5444_get_pktversion(first_byte);
context.pkt_flags = first_byte & RFC5444_PKT_FLAGMASK;
if (context.pkt_version != 0) {
/*
* bad packet version, do not jump to cleanup_parse packet because
* we have not allocated any resources at this point
*/
return RFC5444_UNSUPPORTED_VERSION;
}
/* check for sequence number */
context.has_pktseqno = ((context.pkt_flags & RFC5444_PKT_FLAG_SEQNO) != 0);
if (context.has_pktseqno) {
context.pkt_seqno = _rfc5444_get_u16(&ptr, eob, &result);
}
if (result != RFC5444_OKAY) {
/*
* error during parsing, do not jump to cleanup_parse packet because
* we have not allocated any resources at this point
*/
return result;
}
/* initialize avl_tree */
avl_init(&entries, avl_comp_uint32, true);
last_started = NULL;
/* check for packet tlv */
has_tlv = (context.pkt_flags & RFC5444_PKT_FLAG_TLV) != 0;
if (has_tlv) {
result = _parse_tlvblock(parser, &entries, &ptr, eob, 0);
if (result != RFC5444_OKAY) {
/*
* error while parsing TLV block, do not jump to cleanup_parse packet because
* we have not allocated any resources at this point
*/
return result;
}
}
/* update packet buffer pointer */
context.pkt_buffer = buffer;
context.pkt_size = length;
/* handle packet consumers, call start callbacks */
avl_for_each_element(&parser->packet_consumer, consumer, _node) {
last_started = consumer;
/* this one can drop a packet */
if (consumer->start_callback != NULL) {
context.consumer = consumer;
#if DISALLOW_CONSUMER_CONTEXT_DROP == false
result =
#endif
consumer->start_callback(&context);
#if DISALLOW_CONSUMER_CONTEXT_DROP == false
if (result != RFC5444_OKAY) {
goto cleanup_parse_packet;
}
#endif
}
/* handle packet tlv consumers */
if (has_tlv && (consumer->tlv_callback != NULL || consumer->block_callback != NULL)) {
/* can drop packet */
#if DISALLOW_CONSUMER_CONTEXT_DROP == false
result =
#endif
_schedule_tlvblock(consumer, &context, &entries, 0);
#if DISALLOW_CONSUMER_CONTEXT_DROP == false
if (result != RFC5444_OKAY) {
goto cleanup_parse_packet;
}
#endif
}
}
/* parse messages */
while (result == RFC5444_OKAY && ptr < eob) {
/* can drop packet (need to be there for error handling too) */
result = _handle_message(parser, &context, &ptr, eob);
}
#if DISALLOW_CONSUMER_CONTEXT_DROP == false
cleanup_parse_packet:
#endif
/* call end-of-context callback */
if (!avl_is_empty(&parser->packet_consumer)) {
avl_for_first_to_element_reverse(&parser->packet_consumer, last_started, consumer, _node) {
if (consumer->end_callback) {
context.consumer = consumer;
consumer->end_callback(&context, result != RFC5444_OKAY);
}
}
}
_free_tlvblock(parser, &entries);
/* do not tell caller about packet drop */
#if DISALLOW_CONSUMER_CONTEXT_DROP == false
if (result == RFC5444_DROP_PACKET) {
return RFC5444_OKAY;
}
#endif
return result;
} | movl $0xfffffff0, %eax # imm = 0xFFFFFFF0
cmpq $0xffff, %rdx # imm = 0xFFFF
ja 0x356c3
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp # imm = 0x168
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %rbp
movq %rsi, (%rsp)
leaq 0x70(%rsp), %r13
xorl %r15d, %r15d
movl $0x98, %edx
movq %r13, %rdi
xorl %esi, %esi
callq 0x11250
movq %rbp, (%r13)
testq %r14, %r14
je 0x34a34
movb (%r12), %cl
leaq 0x1(%r12), %rax
movq %rax, (%rsp)
jmp 0x34a3c
movl $0xfffffffe, %r15d # imm = 0xFFFFFFFE
xorl %ecx, %ecx
movl %ecx, %eax
shrb $0x4, %al
movb %al, 0x84(%rsp)
movl %ecx, %eax
andb $0xf, %al
movb %al, 0x85(%rsp)
movl $0xffffffff, %eax # imm = 0xFFFFFFFF
cmpb $0xf, %cl
ja 0x356b2
leaq (%r12,%r14), %rsi
movl %ecx, %eax
shrb $0x3, %al
movb %al, 0x86(%rsp)
cmpb $0x8, %cl
jb 0x34aca
testq %r14, %r14
je 0x34a99
movq (%rsp), %rcx
cmpq %rsi, %rcx
jae 0x34a93
movzbl (%rcx), %eax
incq %rcx
movq %rcx, (%rsp)
shll $0x8, %eax
jmp 0x34a9b
movl $0xfffffffe, %r15d # imm = 0xFFFFFFFE
xorl %eax, %eax
testl %r15d, %r15d
jne 0x34abb
movq (%rsp), %rdx
cmpq %rsi, %rdx
jae 0x34ab5
movzbl (%rdx), %ecx
incq %rdx
movq %rdx, (%rsp)
jmp 0x34abd
movl $0xfffffffe, %r15d # imm = 0xFFFFFFFE
xorl %ecx, %ecx
movzwl %cx, %ecx
orl %eax, %ecx
movw %cx, 0x88(%rsp)
testl %r15d, %r15d
je 0x34ad7
movl %r15d, %eax
jmp 0x356b2
movq %rsi, 0x20(%rsp)
leaq -0xd367(%rip), %rsi # 0x2777c
leaq 0x118(%rsp), %rdi
movl $0x1, %edx
callq 0x277f0
movb 0x85(%rsp), %bl
testb $0x4, %bl
je 0x34b27
leaq 0x118(%rsp), %rsi
movq %rsp, %rdx
movq %rbp, %rdi
movq 0x20(%rsp), %rcx
xorl %r8d, %r8d
callq 0x356c4
movl %eax, %r15d
testl %eax, %eax
jne 0x356b2
movq %r12, 0x90(%rsp)
movq %r14, 0x98(%rsp)
movq (%rbp), %rax
movq 0x8(%rax), %rcx
cmpq 0x8(%rbp), %rcx
je 0x34bce
leaq 0x70(%rsp), %r14
leaq 0x118(%rsp), %r12
movq %rax, %rdi
movq 0x50(%rax), %rax
testq %rax, %rax
je 0x34b7d
movq %rdi, 0x78(%rsp)
movq %rdi, %r15
movq %r14, %rdi
callq *%rax
movq %r15, %rdi
movl %eax, %r15d
testl %eax, %eax
jne 0x3561a
testb $0x4, %bl
jne 0x34b89
movq 0x20(%rsp), %rdx
jmp 0x34bbf
cmpq $0x0, 0x60(%rdi)
movq 0x20(%rsp), %rdx
jne 0x34b9c
cmpq $0x0, 0x68(%rdi)
je 0x34bbf
movq %rdi, %r15
movq %r14, %rsi
movq %r12, %rdx
xorl %ecx, %ecx
callq 0x35b2f
movq %r15, %rdi
movq 0x20(%rsp), %rdx
movl %eax, %r15d
testl %eax, %eax
jne 0x3561a
movq (%rdi), %rax
movq 0x8(%rax), %rcx
cmpq 0x8(%rbp), %rcx
jne 0x34b56
jmp 0x34bd5
xorl %edi, %edi
movq 0x20(%rsp), %rdx
testl %r15d, %r15d
sete %al
movq (%rsp), %rcx
movq %rcx, %r14
cmpq %rdx, %rcx
setb %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x3561a
movq %rdi, 0x68(%rsp)
movq %rbp, 0x48(%rsp)
leaq 0x140(%rsp), %rdi
leaq -0xd463(%rip), %rsi # 0x277a9
movl $0x1, %edx
callq 0x277f0
movq 0x20(%rsp), %rsi
leaq 0x38(%rsp), %rax
movq %rax, 0x40(%rsp)
movq %rax, 0x38(%rsp)
movb $0x0, 0xd0(%rsp)
movb (%r14), %cl
leaq 0x1(%r14), %rax
movq %rax, (%rsp)
movb %cl, 0xa0(%rsp)
xorl %r8d, %r8d
cmpq %rsi, %rax
movq %r14, 0x50(%rsp)
jae 0x34c5f
movb 0x1(%r14), %bl
leaq 0x2(%r14), %rcx
movq %rcx, (%rsp)
jmp 0x34c67
movl $0xfffffffe, %r8d # imm = 0xFFFFFFFE
xorl %ebx, %ebx
cmpq %rsi, %rax
jae 0x34c8c
movq (%rsp), %rax
cmpq %rsi, %rax
jae 0x34c86
movzbl (%rax), %r12d
incq %rax
movq %rax, (%rsp)
shll $0x8, %r12d
jmp 0x34c8f
movl $0xfffffffe, %r8d # imm = 0xFFFFFFFE
xorl %r12d, %r12d
testl %r8d, %r8d
jne 0x34cb0
movq (%rsp), %rax
cmpq %rsi, %rax
jae 0x34caa
movzbl (%rax), %r13d
incq %rax
movq %rax, (%rsp)
jmp 0x34cb3
movl $0xfffffffe, %r8d # imm = 0xFFFFFFFE
xorl %r13d, %r13d
movl %ebx, %eax
andb $0xf, %al
incb %al
movb %al, 0xa2(%rsp)
movl %ebx, %ecx
andb $-0x10, %cl
movb %cl, 0xa1(%rsp)
movl %ebx, %ecx
shrb $0x7, %cl
movb %cl, 0xa7(%rsp)
testb %bl, %bl
jns 0x34d32
movq (%rsp), %r15
movzbl %al, %edx
leaq (%r15,%rdx), %rax
cmpq %rsi, %rax
jbe 0x34d00
movl $0xfffffffe, %r8d # imm = 0xFFFFFFFE
movq $0x0, 0x10(%rsp)
jmp 0x34e5f
leaq 0xa8(%rsp), %rdi
movq %r15, %rsi
xorl %ecx, %ecx
movl %r8d, %r14d
movl $0xff, %r8d
callq 0x28944
movl %r14d, %r8d
movq 0x20(%rsp), %rsi
movzbl 0xa2(%rsp), %eax
addq %r15, %rax
movq %rax, (%rsp)
movzbl %bl, %eax
movl %eax, %ecx
andl $0x40, %ecx
movl %ecx, %edx
shrl $0x6, %edx
movb %dl, 0xa5(%rsp)
testl %ecx, %ecx
je 0x34d72
testl %r8d, %r8d
jne 0x34d69
movq (%rsp), %rdx
cmpq %rsi, %rdx
jae 0x34d63
movb (%rdx), %cl
incq %rdx
movq %rdx, (%rsp)
jmp 0x34d6b
movl $0xfffffffe, %r8d # imm = 0xFFFFFFFE
xorl %ecx, %ecx
movb %cl, 0xa6(%rsp)
movl %eax, %ecx
andl $0x20, %ecx
movl %ecx, %edx
shrl $0x5, %edx
movb %dl, 0xa3(%rsp)
testl %ecx, %ecx
je 0x34daf
testl %r8d, %r8d
jne 0x34da6
movq (%rsp), %rdx
cmpq %rsi, %rdx
jae 0x34da0
movb (%rdx), %cl
incq %rdx
movq %rdx, (%rsp)
jmp 0x34da8
movl $0xfffffffe, %r8d # imm = 0xFFFFFFFE
xorl %ecx, %ecx
movb %cl, 0xa4(%rsp)
andl $0x10, %eax
movl %eax, %ecx
shrl $0x4, %ecx
movb %cl, 0xba(%rsp)
testl %eax, %eax
je 0x34e16
testl %r8d, %r8d
jne 0x34de5
movq (%rsp), %rcx
cmpq %rsi, %rcx
jae 0x34ddf
movzbl (%rcx), %eax
incq %rcx
movq %rcx, (%rsp)
shll $0x8, %eax
jmp 0x34de7
movl $0xfffffffe, %r8d # imm = 0xFFFFFFFE
xorl %eax, %eax
testl %r8d, %r8d
jne 0x34e07
movq (%rsp), %rdx
cmpq %rsi, %rdx
jae 0x34e01
movzbl (%rdx), %ecx
incq %rdx
movq %rdx, (%rsp)
jmp 0x34e09
movl $0xfffffffe, %r8d # imm = 0xFFFFFFFE
xorl %ecx, %ecx
movzwl %cx, %ecx
orl %eax, %ecx
movw %cx, 0xbc(%rsp)
movq 0x50(%rsp), %rax
orq %r12, %r13
leaq (%rax,%r13), %rcx
cmpq %rsi, %rcx
jbe 0x34e31
movq %rsi, (%rsp)
movl $0xfffffffe, %r8d # imm = 0xFFFFFFFE
testl %r8d, %r8d
movq %rcx, 0x10(%rsp)
jne 0x34e5f
movq %rbp, %rdi
leaq 0x140(%rsp), %rsi
movq %rsp, %rdx
xorl %r8d, %r8d
movq %rcx, %rbx
callq 0x356c4
movl %eax, %r8d
testl %eax, %eax
je 0x34f94
movq $0x0, 0xc0(%rsp)
cmpl $0x3, %r8d
movl %r8d, %r12d
je 0x34e79
testl %r8d, %r8d
jne 0x34ebf
cmpb $0x0, 0xd0(%rsp)
jne 0x34ebf
movq 0x50(%rbp), %rax
testq %rax, %rax
je 0x34ebf
cmpb $0x1, 0xa5(%rsp)
jne 0x34ebf
cmpb $0x2, 0xa6(%rsp)
jb 0x34ebf
movl $0x1, 0x80(%rsp)
movq 0x10(%rsp), %rdx
movq 0x50(%rsp), %rsi
subq %rsi, %rdx
leaq 0x70(%rsp), %rdi
callq *%rax
movq 0x38(%rsp), %r15
movq 0x8(%r15), %rax
cmpq 0x40(%rsp), %rax
je 0x34f12
movq (%r15), %rbx
movq 0x10(%r15), %rdi
leaq 0x10(%r15), %rax
movq (%rdi), %r14
movq %rax, 0x18(%r15)
movq %rax, 0x10(%r15)
movq $0x0, 0x20(%r15)
cmpl $0x0, 0x28(%r15)
je 0x34f03
callq *0x68(%rbp)
movq %r14, %rdi
movq (%r14), %r14
decl 0x28(%r15)
jne 0x34ef4
movq %r15, %rdi
callq *0x70(%rbp)
movq 0x8(%rbx), %rax
movq %rbx, %r15
jmp 0x34ec8
movq 0x140(%rsp), %rdi
movq (%rdi), %rbx
leaq 0x140(%rsp), %rax
movq %rax, 0x148(%rsp)
movq %rax, 0x140(%rsp)
movq $0x0, 0x150(%rsp)
cmpl $0x0, 0x158(%rsp)
je 0x34f5d
callq *0x68(%rbp)
movq %rbx, %rdi
movq (%rbx), %rbx
decl 0x158(%rsp)
jne 0x34f4b
movq 0x10(%rsp), %rax
movq %rax, (%rsp)
movl %r12d, %r15d
sarl $0x1f, %r15d
andl %r12d, %r15d
cmpl $0x5, %r12d
cmovel %r12d, %r15d
testl %r15d, %r15d
jne 0x35615
movq %rax, %r14
cmpq 0x20(%rsp), %rax
jb 0x34bfd
jmp 0x35615
cmpq %rbx, (%rsp)
jae 0x3529e
callq *0x60(%rbp)
testq %rax, %rax
je 0x355ef
movq %rax, %r12
movq %rax, %r15
leaq 0x10(%rax), %rbx
movq %rbx, %rdi
leaq -0xd815(%rip), %rsi # 0x277a9
movl $0x1, %edx
callq 0x277f0
movq (%rsp), %rax
movq %rax, 0x68(%r12)
xorl %edi, %edi
cmpq 0x10(%rsp), %rax
jae 0x34fe6
movb (%rax), %cl
leaq 0x1(%rax), %rdx
movq %rdx, (%rsp)
jmp 0x34fed
movl $0xfffffffe, %edi # imm = 0xFFFFFFFE
xorl %ecx, %ecx
movb %cl, 0x38(%r15)
testb %cl, %cl
movq %rbx, 0x8(%rsp)
je 0x35019
movq 0x10(%rsp), %rcx
cmpq %rcx, %rax
jae 0x35029
movq (%rsp), %rax
cmpq %rcx, %rax
jae 0x35024
movb (%rax), %bpl
incq %rax
movq %rax, (%rsp)
jmp 0x3502b
movl $0xfffffff9, %r8d # imm = 0xFFFFFFF9
jmp 0x35233
movl $0xfffffffe, %edi # imm = 0xFFFFFFFE
xorl %ebp, %ebp
addq $0x50, %r12
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%r15)
movzbl 0xa2(%rsp), %r14d
movb %r14b, 0x3a(%r15)
testb %bpl, %bpl
js 0x35088
movl %ebp, %eax
shrb $0x5, %al
andb $0x3, %al
movzbl %al, %eax
leaq 0xcda6(%rip), %rcx # 0x41e00
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
testl %edi, %edi
jne 0x3519f
movq (%rsp), %rcx
cmpq 0x10(%rsp), %rcx
jae 0x3519a
movb (%rcx), %al
incq %rcx
movq %rcx, (%rsp)
jmp 0x351a1
testl %edi, %edi
jne 0x350d4
movq (%rsp), %rax
cmpq 0x10(%rsp), %rax
jae 0x350cf
movb (%rax), %bl
incq %rax
movq %rax, (%rsp)
jmp 0x350d6
testl %edi, %edi
jne 0x35141
movq (%rsp), %rax
cmpq 0x10(%rsp), %rax
jae 0x3513c
movb (%rax), %bl
incq %rax
movq %rax, (%rsp)
jmp 0x35143
movl $0xfffffff8, %r8d # imm = 0xFFFFFFF8
jmp 0x35233
movl $0xfffffffe, %edi # imm = 0xFFFFFFFE
xorl %ebx, %ebx
movb %bl, 0x39(%r15)
leal -0x1(%rbx), %eax
movl $0xffffffee, %r8d # imm = 0xFFFFFFEE
cmpb $0xe, %al
ja 0x35233
cmpb %bl, %r14b
jbe 0x35233
movq (%rsp), %rsi
movzbl %bl, %edx
leaq (%rsi,%rdx), %rax
movl $0xfffffffe, %r8d # imm = 0xFFFFFFFE
cmpq 0x10(%rsp), %rax
ja 0x35233
movl %edi, 0x2c(%rsp)
movq %r12, %rdi
movq %rax, 0x58(%rsp)
callq 0x11380
movl 0x2c(%rsp), %edi
movl %r14d, %eax
subb %bl, %al
movb %al, 0x3a(%r15)
movq 0x58(%rsp), %rax
movq %rax, (%rsp)
jmp 0x35049
movl $0xfffffffe, %edi # imm = 0xFFFFFFFE
xorl %ebx, %ebx
leal -0x1(%rbx), %eax
movl $0xffffffed, %r8d # imm = 0xFFFFFFED
cmpb $0xe, %al
ja 0x35233
cmpb %r14b, %bl
jae 0x35233
movq (%rsp), %rsi
movzbl %bl, %edx
leaq (%rsi,%rdx), %rax
movl $0xfffffffe, %r8d # imm = 0xFFFFFFFE
cmpq 0x10(%rsp), %rax
ja 0x35233
addq %r14, %r12
subq %rdx, %r12
movl %edi, %r14d
movq %r12, %rdi
movq %rax, %r12
callq 0x11380
movl %r14d, %edi
subb %bl, 0x3a(%r15)
movq %r12, (%rsp)
jmp 0x351a5
movl $0xfffffffe, %edi # imm = 0xFFFFFFFE
xorl %eax, %eax
subb %al, 0x3a(%r15)
movq (%rsp), %rdx
movq %rdx, 0x48(%r15)
movzbl 0x3a(%r15), %eax
movzbl 0x38(%r15), %ecx
imulq %rcx, %rax
addq %rdx, %rax
movq %rax, (%rsp)
movl $0xfffffffe, %r8d # imm = 0xFFFFFFFE
cmpq 0x10(%rsp), %rax
ja 0x35233
shrb $0x3, %bpl
andb $0x3, %bpl
movzbl %bpl, %edx
leaq 0xcc2e(%rip), %rsi # 0x41e10
movslq (%rsi,%rdx,4), %rdx
addq %rsi, %rdx
jmpq *%rdx
movb 0xa2(%rsp), %al
shlb $0x3, %al
movb %al, 0x60(%r15)
jmp 0x3521d
movb (%rax), %cl
movb %cl, 0x60(%r15)
incq %rax
movq %rax, (%rsp)
jmp 0x3521d
movl $0xfffffff7, %r8d # imm = 0xFFFFFFF7
jmp 0x35233
movq %rax, 0x40(%r15)
addq %rax, %rcx
movq %rcx, (%rsp)
movq (%rsp), %rax
cmpq 0x10(%rsp), %rax
ja 0x35233
subq 0x68(%r15), %rax
movq %rax, 0x70(%r15)
movl %edi, %r8d
testl %r8d, %r8d
jne 0x355fa
movzbl 0x38(%r15), %r8d
movq 0x48(%rsp), %rbp
movq %rbp, %rdi
movq 0x8(%rsp), %rsi
movq %rsp, %rdx
movq 0x10(%rsp), %rbx
movq %rbx, %rcx
callq 0x356c4
movl %eax, %r8d
testl %eax, %eax
jne 0x35604
movq (%rsp), %rax
movq %rax, %rcx
subq 0x70(%r15), %rcx
subq 0x68(%r15), %rcx
movq %rcx, 0x78(%r15)
movq 0x40(%rsp), %rcx
leaq 0x38(%rsp), %rdx
movq %rdx, (%r15)
movq %rcx, 0x8(%r15)
movq %r15, 0x40(%rsp)
movq %r15, (%rcx)
cmpq %rbx, %rax
jb 0x34f9e
movq 0x50(%rsp), %rax
movq %rax, 0xc0(%rsp)
movq %r13, 0xc8(%rsp)
movq 0x28(%rbp), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rax), %rax
cmpq 0x30(%rbp), %rax
je 0x355c1
xorl %edx, %edx
movq $0x0, 0x18(%rsp)
movq %rdx, 0x30(%rsp)
movq 0x8(%rsp), %rax
cmpb $0x0, 0x3c(%rax)
jne 0x352ff
movq 0x8(%rsp), %rax
movb 0x3d(%rax), %al
cmpb 0xa0(%rsp), %al
movq 0x30(%rsp), %rdx
jne 0x355a4
cmpq $0x0, 0x18(%rsp)
je 0x35338
movq 0x8(%rsp), %rax
movl 0x38(%rax), %eax
movq 0x30(%rsp), %rcx
cmpl 0x38(%rcx), %eax
movq 0x30(%rsp), %rdx
jle 0x35341
leaq 0x70(%rsp), %rdi
movq 0x18(%rsp), %rsi
movl %r8d, %ecx
callq 0x36091
testl %eax, %eax
jne 0x355e7
movq $0x0, 0x18(%rsp)
movq 0x8(%rsp), %rax
cmpb $0x1, 0x3e(%rax)
jne 0x3551e
movl $0x2, 0x80(%rsp)
xorl %r8d, %r8d
leaq 0x38(%rsp), %rbp
movl %eax, %ecx
movq (%rbp), %rbp
movq 0x8(%rbp), %rax
cmpq 0x40(%rsp), %rax
je 0x3554d
movq 0x68(%rbp), %rax
movq %rax, 0xe8(%rsp)
movq 0x70(%rbp), %rax
movq %rax, 0xf0(%rsp)
movq 0x78(%rbp), %rax
movq %rax, 0xf8(%rsp)
cmpb $0x0, 0x38(%rbp)
setne %r14b
je 0x3550d
movl %ecx, 0x64(%rsp)
leaq 0x50(%rbp), %rax
movq %rax, 0x58(%rsp)
leaq 0x60(%rbp), %rax
movq %rax, 0x110(%rsp)
leaq 0x10(%rbp), %rax
movq %rax, 0x108(%rsp)
movb $0x1, %r14b
xorl %r13d, %r13d
movl %r13d, %ebx
shrl $0x6, %ebx
andl $0x3, %ebx
movq 0x80(%rbp,%rbx,8), %rax
movl $0x1, %r15d
movl %r13d, %ecx
shlq %cl, %r15
btq %r13, %rax
jb 0x354f3
movzbl 0x39(%rbp), %edi
movq 0x58(%rsp), %r12
addq %r12, %rdi
movzbl 0x3a(%rbp), %edx
movq %r13, %rsi
imulq %rdx, %rsi
addq 0x48(%rbp), %rsi
movl %r8d, 0x2c(%rsp)
callq 0x11380
movq 0x40(%rbp), %rax
leaq (%rax,%r13), %rcx
testq %rax, %rax
cmoveq 0x110(%rsp), %rcx
movzbl (%rcx), %r8d
movzbl 0xa2(%rsp), %edx
leaq 0xd1(%rsp), %rdi
movq %r12, %rsi
xorl %ecx, %ecx
callq 0x28944
movl 0x2c(%rsp), %r8d
movb %r13b, 0x100(%rsp)
movq 0x8(%rsp), %rax
movq 0x50(%rax), %rax
testq %rax, %rax
je 0x35482
movq 0x8(%rsp), %rcx
movq %rcx, 0x78(%rsp)
leaq 0x70(%rsp), %rdi
callq *%rax
movl %eax, %r8d
testl %r8d, %r8d
jne 0x354a5
movzbl %r13b, %ecx
movq 0x8(%rsp), %rdi
leaq 0x70(%rsp), %rsi
movq 0x108(%rsp), %rdx
callq 0x35b2f
movl %eax, %r8d
movq 0x8(%rsp), %rax
movq 0x58(%rax), %rax
testq %rax, %rax
je 0x354da
movq 0x8(%rsp), %rcx
movq %rcx, 0x78(%rsp)
xorl %esi, %esi
testl %r8d, %r8d
setne %sil
leaq 0x70(%rsp), %rdi
movl %r8d, %r12d
callq *%rax
movl %r12d, %r8d
cmpl %r12d, %eax
cmovgl %eax, %r8d
testl %r8d, %r8d
je 0x354f3
movl %r8d, %eax
cmpl $0x2, %r8d
jne 0x3550f
orq %r15, 0x80(%rbp,%rbx,8)
xorl %r8d, %r8d
incq %r13
movzbl 0x38(%rbp), %eax
cmpq %rax, %r13
setb %r14b
jb 0x353d5
movl 0x64(%rsp), %eax
jmp 0x3550f
movl %ecx, %eax
testb $0x1, %r14b
je 0x35363
movl %eax, %r8d
jmp 0x35559
movl $0x1, 0x80(%rsp)
movq 0x8(%rsp), %rax
movq 0x50(%rax), %rax
testq %rax, %rax
je 0x35565
movq 0x8(%rsp), %rcx
movq %rcx, 0x78(%rsp)
leaq 0x70(%rsp), %rdi
callq *%rax
movl %eax, %r8d
jmp 0x35568
movq $0x0, 0xe8(%rsp)
movq 0x48(%rsp), %rbp
movq 0x30(%rsp), %rdx
jmp 0x3559f
xorl %r8d, %r8d
testl %r8d, %r8d
jne 0x35589
movq 0x8(%rsp), %rdi
leaq 0x70(%rsp), %rsi
leaq 0x140(%rsp), %rdx
xorl %ecx, %ecx
callq 0x35b2f
movl %eax, %r8d
movq 0x18(%rsp), %rax
testq %rax, %rax
movq 0x8(%rsp), %rdx
cmoveq %rdx, %rax
movq %rax, 0x18(%rsp)
testl %r8d, %r8d
jne 0x355cc
movq 0x8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rax), %rax
cmpq 0x30(%rbp), %rax
jne 0x352d5
jmp 0x355cc
movq $0x0, 0x18(%rsp)
xorl %edx, %edx
movq 0x18(%rsp), %rsi
testq %rsi, %rsi
je 0x34e5f
leaq 0x70(%rsp), %rdi
movl %r8d, %ecx
callq 0x36091
movl %eax, %r8d
jmp 0x34e5f
movl $0xfffffffa, %r8d # imm = 0xFFFFFFFA
jmp 0x34e5f
movq %r15, %rdi
movq 0x48(%rsp), %rbp
jmp 0x35607
movq %r15, %rdi
movl %r8d, %ebx
callq *0x70(%rbp)
movl %ebx, %r8d
jmp 0x34e5f
movq 0x68(%rsp), %rdi
cmpl $0x0, 0x18(%rbp)
je 0x3565d
movq (%rdi), %rax
cmpq (%rbp), %rax
je 0x3565d
leaq 0x70(%rsp), %r14
movq 0x58(%rdi), %rax
testq %rax, %rax
je 0x35650
xorl %esi, %esi
testl %r15d, %r15d
setne %sil
movq %rdi, 0x78(%rsp)
movq %rdi, %rbx
movq %r14, %rdi
callq *%rax
movq %rbx, %rdi
movq 0x8(%rdi), %rdi
movq (%rdi), %rax
cmpq (%rbp), %rax
jne 0x3562e
movq 0x118(%rsp), %rdi
movq (%rdi), %rbx
leaq 0x118(%rsp), %rax
movq %rax, 0x120(%rsp)
movq %rax, 0x118(%rsp)
movq $0x0, 0x128(%rsp)
cmpl $0x0, 0x130(%rsp)
je 0x356a8
callq *0x68(%rbp)
movq %rbx, %rdi
movq (%rbx), %rbx
decl 0x130(%rsp)
jne 0x35696
xorl %eax, %eax
cmpl $0x5, %r15d
cmovnel %r15d, %eax
addq $0x168, %rsp # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
| /OLSR[P]OONF/src/librfc5444/rfc5444_reader.c |
schedule_tlvblock | static enum rfc5444_result
_schedule_tlvblock(struct rfc5444_reader_tlvblock_consumer *consumer, struct rfc5444_reader_tlvblock_context *context,
struct avl_tree *entries, uint8_t idx) {
struct rfc5444_reader_tlvblock_entry *tlv = NULL, *nexttlv = NULL;
struct rfc5444_reader_tlvblock_consumer_entry *cons_entry;
bool constraints_failed;
enum rfc5444_result result = RFC5444_OKAY;
constraints_failed = false;
/* initialize tlv pointers, there must be TLVs */
if (avl_is_empty(entries)) {
tlv = NULL;
}
else {
tlv = avl_first_element(entries, tlv, node);
}
/* initialize consumer pointer */
if (list_is_empty(&consumer->_consumer_list)) {
cons_entry = NULL;
}
else {
cons_entry = list_first_element(&consumer->_consumer_list, cons_entry, _node);
cons_entry->tlv = NULL;
}
/* we are running in parallel through two sorted lists */
while (cons_entry != NULL || tlv != NULL) {
bool match = false;
bool index_match = false;
if (tlv) {
index_match = RFC5444_CONSUMER_DROP_ONLY(!bitmap256_get(&tlv->int_drop_tlv, idx), true) && idx >= tlv->index1 &&
idx <= tlv->index2;
}
/* check index for address blocks */
if (tlv != NULL && cons_entry != NULL && index_match) {
/* calculate match between tlv and consumer */
match = _compare_tlvtypes(tlv, cons_entry) == 0;
}
if (index_match && tlv->_multivalue_tlv) {
size_t offset;
/* calculate value pointer for multivalue tlv */
offset = (size_t)(idx - tlv->index1) * tlv->length;
tlv->single_value = &tlv->_value[offset];
}
/* handle tlv_callback first */
if (index_match && consumer->tlv_callback != NULL) {
/* call consumer for TLV, can skip tlv, address, message and packet */
context->consumer = consumer;
#if DISALLOW_CONSUMER_CONTEXT_DROP == false
result =
#endif
consumer->tlv_callback(tlv, context);
#if DISALLOW_CONSUMER_CONTEXT_DROP == false
if (result == RFC5444_DROP_TLV) {
/* mark dropped tlv */
bitmap256_set(&tlv->int_drop_tlv, idx);
match = false;
/* do not propagate result */
result = RFC5444_OKAY;
}
else if (result != RFC5444_OKAY) {
/* stop processing this TLV block/address/message/packet */
goto cleanup_handle_tlvblock;
}
#endif
}
/* run through both sorted lists until finding a match */
if (_compare_tlvtypes(tlv, cons_entry) >= 0) {
constraints_failed |= cons_entry->mandatory && !match;
if (match) {
if (cons_entry->match_length &&
(tlv->length < cons_entry->min_length || tlv->length > cons_entry->max_length)) {
constraints_failed = true;
}
/* this is the last TLV that fits the description... for now */
tlv->next_entry = NULL;
if (cons_entry->tlv == NULL) {
/* it is also the first one we find */
cons_entry->tlv = tlv;
if (cons_entry->copy_value != NULL && tlv->length > 0) {
/* copy value into private buffer */
uint16_t len = cons_entry->max_length;
if (tlv->length < len) {
len = tlv->length;
}
memcpy(cons_entry->copy_value, tlv->single_value, len);
}
}
else {
/* its one of many, put it at the end of the list */
nexttlv = cons_entry->tlv;
while (nexttlv->next_entry) {
nexttlv = nexttlv->next_entry;
}
nexttlv->next_entry = tlv;
}
}
}
if (tlv != NULL && _compare_tlvtypes(tlv, cons_entry) <= 0) {
/* advance tlv pointer */
if (avl_is_last(entries, &tlv->node)) {
tlv = NULL;
}
else {
tlv = avl_next_element(tlv, node);
}
}
if (_compare_tlvtypes(tlv, cons_entry) > 0) {
constraints_failed |= cons_entry->mandatory && !match;
/* advance consumer pointer */
if (list_is_last(&consumer->_consumer_list, &cons_entry->_node)) {
cons_entry = NULL;
}
else {
cons_entry = list_next_element(cons_entry, _node);
cons_entry->tlv = NULL;
}
}
}
/* call consumer for tlvblock */
if (consumer->block_callback != NULL && !constraints_failed) {
context->consumer = consumer;
#if DISALLOW_CONSUMER_CONTEXT_DROP == false
result =
#endif
consumer->block_callback(context);
}
else if (consumer->block_callback_failed_constraints != NULL && constraints_failed) {
context->consumer = consumer;
#if DISALLOW_CONSUMER_CONTEXT_DROP == false
result =
#endif
consumer->block_callback_failed_constraints(context);
}
#if DISALLOW_CONSUMER_CONTEXT_DROP == false
if (result == RFC5444_DROP_TLV) {
list_for_each_element(&consumer->_consumer_list, cons_entry, _node) {
if (cons_entry->tlv != NULL && cons_entry->drop) {
bitmap256_set(&cons_entry->tlv->int_drop_tlv, idx);
cons_entry->drop = false;
}
}
/* do not propagate tlv drops */
result = RFC5444_OKAY;
}
#endif
#if DISALLOW_CONSUMER_CONTEXT_DROP == false
cleanup_handle_tlvblock:
#endif
#if DEBUG_CLEANUP == true
list_for_each_element(&consumer->_consumer_list, cons_entry, _node) {
cons_entry->tlv = NULL;
cons_entry->drop = false;
}
#endif
return result;
} | pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, 0x20(%rsp)
movq %rdi, 0x8(%rsp)
cmpl $0x0, 0x18(%rdx)
je 0x35b52
movq (%rdx), %r13
jmp 0x35b55
xorl %r13d, %r13d
movq 0x8(%rsp), %rsi
leaq 0x40(%rsi), %rax
movq 0x40(%rsi), %r14
cmpq %rax, %r14
jne 0x35b76
movq 0x8(%rsp), %rsi
cmpq %rax, 0x48(%rsi)
je 0x35f43
movq $0x0, 0x28(%r14)
movl %ecx, %eax
shrb $0x6, %al
movzbl %al, %r8d
movl $0x1, %r11d
shlq %cl, %r11
movzbl %cl, %eax
movq %rax, 0x30(%rsp)
xorl %ebx, %ebx
xorl %r9d, %r9d
xorl %r12d, %r12d
movl %ecx, 0x14(%rsp)
movq %rdx, 0x18(%rsp)
movq %r14, %rax
orq %r13, %rax
je 0x35e8b
testq %r13, %r13
je 0x35bcb
testq %r11, 0x70(%r13,%r8,8)
jne 0x35bcb
cmpb %cl, 0x48(%r13)
jbe 0x35c91
xorl %eax, %eax
xorl %r15d, %r15d
testq %r14, %r14
je 0x35c0d
testq %r13, %r13
je 0x35c0d
testb %al, %al
je 0x35c0d
movzbl 0x11(%r14), %r10d
cmpb $0x1, 0x13(%r14)
jne 0x35bff
movzwl 0x58(%r13), %edi
shll $0x8, %r10d
movzbl 0x12(%r14), %esi
orl %r10d, %esi
subl %esi, %edi
jmp 0x35c07
movzbl 0x38(%r13), %edi
subl %r10d, %edi
testl %edi, %edi
sete %r15b
testb %al, %al
je 0x35cae
cmpb $0x1, 0x68(%r13)
jne 0x35c3a
movzbl 0x48(%r13), %esi
movq 0x30(%rsp), %rdi
subq %rsi, %rdi
movzwl 0x3c(%r13), %esi
imulq %rdi, %rsi
addq 0x60(%r13), %rsi
movq %rsi, 0x40(%r13)
testb %al, %al
je 0x35cae
movq 0x8(%rsp), %rax
cmpq $0x0, 0x60(%rax)
je 0x35cae
movq %r11, %rbx
movq %r8, %rbp
movq 0x20(%rsp), %rsi
movq 0x8(%rsp), %rax
movq %rax, 0x8(%rsi)
movq %r13, %rdi
callq *0x60(%rax)
movl %eax, %r9d
testl %eax, %eax
je 0x35c9d
cmpl $0x1, %r9d
movl 0x14(%rsp), %ecx
movq %rbp, %r8
movq 0x18(%rsp), %rdx
movq %rbx, %r11
jne 0x35e85
orq %r11, 0x70(%r13,%r8,8)
xorl %r15d, %r15d
xorl %r9d, %r9d
jmp 0x35cac
cmpb %cl, 0x49(%r13)
setae %al
jmp 0x35bcd
movl 0x14(%rsp), %ecx
movq %rbp, %r8
movq 0x18(%rsp), %rdx
movq %rbx, %r11
xorl %ebx, %ebx
testq %r14, %r14
je 0x35cd7
testq %r13, %r13
je 0x35ce6
movzbl 0x11(%r14), %esi
cmpb $0x1, 0x13(%r14)
jne 0x35ced
movzwl 0x58(%r13), %eax
shll $0x8, %esi
movzbl 0x12(%r14), %edi
orl %esi, %edi
subl %edi, %eax
jmp 0x35cf4
movq %r13, %rax
negq %rax
movl $0x0, %eax
sbbl %eax, %eax
jmp 0x35cf4
movl $0x1, %eax
jmp 0x35cf4
movzbl 0x38(%r13), %eax
subl %esi, %eax
testl %eax, %eax
js 0x35d4f
movl %r15d, %ebp
xorb $0x1, %bpl
andb 0x10(%r14), %bpl
orb %r12b, %bpl
testb %r15b, %r15b
je 0x35d52
cmpb $0x1, 0x18(%r14)
jne 0x35d28
movzwl 0x3c(%r13), %eax
cmpw 0x14(%r14), %ax
jb 0x35d25
cmpw 0x16(%r14), %ax
jbe 0x35d28
movb $0x1, %bpl
movq $0x0, 0x50(%r13)
movq 0x28(%r14), %rax
testq %rax, %rax
je 0x35e29
movq %rax, %rsi
movq 0x50(%rax), %rax
testq %rax, %rax
jne 0x35d3d
movq %r13, 0x50(%rsi)
jmp 0x35d52
movl %r12d, %ebp
testq %r13, %r13
je 0x35d99
testq %r14, %r14
je 0x35d7b
movzbl 0x11(%r14), %esi
cmpb $0x1, 0x13(%r14)
jne 0x35d82
movzwl 0x58(%r13), %eax
shll $0x8, %esi
movzbl 0x12(%r14), %edi
orl %esi, %edi
subl %edi, %eax
jmp 0x35d89
movl $0xffffffff, %eax # imm = 0xFFFFFFFF
jmp 0x35d89
movzbl 0x38(%r13), %eax
subl %esi, %eax
testl %eax, %eax
jg 0x35d9c
cmpq %r13, 0x8(%rdx)
je 0x35d99
movq (%r13), %r13
jmp 0x35d9c
xorl %r13d, %r13d
testq %r14, %r14
je 0x35dc5
testq %r13, %r13
je 0x35dd4
movzbl 0x11(%r14), %eax
cmpb $0x1, 0x13(%r14)
jne 0x35ddb
movzwl 0x58(%r13), %esi
shll $0x8, %eax
movzbl 0x12(%r14), %edi
orl %eax, %edi
subl %edi, %esi
jmp 0x35de2
movq %r13, %rax
negq %rax
movl $0x0, %esi
sbbl %esi, %esi
jmp 0x35de2
movl $0x1, %esi
jmp 0x35de2
movzbl 0x38(%r13), %esi
subl %eax, %esi
movb $0x1, %al
testl %esi, %esi
jle 0x35e14
xorb $0x1, %r15b
movzbl %r15b, %r12d
cmpb $0x0, 0x10(%r14)
cmovel %ebx, %r12d
orb %bpl, %r12b
movq 0x8(%rsp), %rsi
cmpq %r14, 0x48(%rsi)
je 0x35e19
movq (%r14), %r14
movq $0x0, 0x28(%r14)
jmp 0x35e1c
movl %ebp, %r12d
jmp 0x35e1c
xorl %r14d, %r14d
testb %al, %al
jne 0x35ba9
jmp 0x35f31
movq %r13, 0x28(%r14)
movq 0x20(%r14), %rdi
testq %rdi, %rdi
je 0x35d52
movzwl 0x3c(%r13), %eax
testw %ax, %ax
je 0x35d52
movzwl 0x16(%r14), %ecx
cmpw %cx, %ax
cmovael %ecx, %eax
movq 0x40(%r13), %rsi
movzwl %ax, %edx
movq %r8, %r12
movl %r9d, %ebx
movq %r11, 0x28(%rsp)
callq 0x11380
movq 0x28(%rsp), %r11
movq 0x18(%rsp), %rdx
movl %ebx, %r9d
xorl %ebx, %ebx
movq %r12, %r8
movl 0x14(%rsp), %ecx
jmp 0x35d52
xorl %eax, %eax
xorl %ebx, %ebx
jmp 0x35e1c
movq 0x8(%rsp), %rax
cmpq $0x0, 0x68(%rax)
je 0x35e9d
testb $0x1, %r12b
je 0x35ebd
movq 0x8(%rsp), %rax
cmpq $0x0, 0x70(%rax)
je 0x35ee3
testb $0x1, %r12b
je 0x35ee3
movq %r8, %r14
movq 0x8(%rsp), %rax
addq $0x70, %rax
jmp 0x35ec9
movq %r8, %r14
movq 0x8(%rsp), %rax
addq $0x68, %rax
movq 0x20(%rsp), %rdi
movq 0x8(%rsp), %rcx
movq %rcx, 0x8(%rdi)
callq *(%rax)
movl %eax, %r9d
movl 0x14(%rsp), %ecx
movq %r14, %r8
cmpl $0x1, %r9d
jne 0x35f31
movq 0x8(%rsp), %rsi
movq 0x40(%rsi), %rax
movq 0x8(%rax), %rdx
xorl %r9d, %r9d
cmpq 0x48(%rsi), %rdx
je 0x35f31
movl $0x1, %edx
shlq %cl, %rdx
movq 0x8(%rsp), %rsi
movq 0x28(%rax), %rcx
testq %rcx, %rcx
je 0x35f24
cmpb $0x1, 0x30(%rax)
jne 0x35f24
orq %rdx, 0x70(%rcx,%r8,8)
movb $0x0, 0x30(%rax)
movq (%rax), %rax
movq 0x8(%rax), %rcx
cmpq 0x48(%rsi), %rcx
jne 0x35f0c
movl %r9d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r14d, %r14d
jmp 0x35b7e
| /OLSR[P]OONF/src/librfc5444/rfc5444_reader.c |
schedule_end_message_cbs | static enum rfc5444_result
schedule_end_message_cbs(struct rfc5444_reader_tlvblock_context *tlv_context,
struct rfc5444_reader_tlvblock_consumer *first, struct rfc5444_reader_tlvblock_consumer *last,
enum rfc5444_result result) {
struct rfc5444_reader_tlvblock_consumer *consumer;
enum rfc5444_result r;
tlv_context->type = RFC5444_CONTEXT_MESSAGE;
avl_for_element_range_reverse(first, last, consumer, _node) {
if (consumer->end_callback && !consumer->addrblock_consumer &&
(consumer->default_msg_consumer || consumer->msg_id == tlv_context->msg_type)) {
tlv_context->consumer = consumer;
r = consumer->end_callback(tlv_context, result != RFC5444_OKAY);
if (r > result) {
result = r;
}
}
}
return result;
} | pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebx
movl $0x1, 0x10(%rdi)
cmpq %rsi, (%rdx)
je 0x360f2
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
cmpq $0x0, 0x58(%r14)
je 0x360e9
cmpb $0x0, 0x3e(%r14)
jne 0x360e9
cmpb $0x0, 0x3c(%r14)
jne 0x360d0
movb 0x3d(%r14), %al
cmpb 0x30(%r12), %al
jne 0x360e9
movq %r14, 0x8(%r12)
xorl %esi, %esi
testl %ebx, %ebx
setne %sil
movq %r12, %rdi
callq *0x58(%r14)
cmpl %ebx, %eax
cmovgl %eax, %ebx
movq 0x8(%r14), %r14
cmpq %r15, (%r14)
jne 0x360b0
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
| /OLSR[P]OONF/src/librfc5444/rfc5444_reader.c |
rfc5444_tlv_writer_init | void
_rfc5444_tlv_writer_init(struct rfc5444_tlv_writer_data *data, size_t max, size_t mtu __attribute__((unused))) {
data->header = 0;
data->added = 0;
data->allocated = 0;
data->set = 0;
data->max = max;
#if DEBUG_CLEANUP == true
memset(data->buffer, 0, mtu);
#endif
} | xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rdi)
movups %xmm0, 0x8(%rdi)
movq %rsi, 0x28(%rdi)
retq
| /OLSR[P]OONF/src/librfc5444/rfc5444_tlv_writer.c |
rfc5444_writer_cleanup | void
rfc5444_writer_cleanup(struct rfc5444_writer *writer) {
struct rfc5444_writer_message *msg, *safe_msg;
struct rfc5444_writer_pkthandler *pkt, *safe_pkt;
struct rfc5444_writer_content_provider *provider, *safe_prv;
struct rfc5444_writer_tlvtype *tlvtype, *safe_tt;
struct rfc5444_writer_target *interf, *safe_interf;
struct rfc5444_writer_postprocessor *processor, *safe_proc;
assert(writer);
#if WRITER_STATE_MACHINE == true
assert(writer->_state == RFC5444_WRITER_NONE);
#endif
/* remove all packet handlers */
list_for_each_element_safe(&writer->_pkthandlers, pkt, _pkthandle_node, safe_pkt) {
rfc5444_writer_unregister_pkthandler(writer, pkt);
}
/* remove all _targets */
list_for_each_element_safe(&writer->_targets, interf, _target_node, safe_interf) {
rfc5444_writer_unregister_target(writer, interf);
}
/* remove all generic address tlvtypes */
list_for_each_element_safe(&writer->_addr_tlvtype_head, tlvtype, _tlvtype_node, safe_tt) {
rfc5444_writer_unregister_addrtlvtype(writer, tlvtype);
}
/* remove all packet postprocessors */
avl_for_each_element_safe(&writer->_processors, processor, _node, safe_proc) {
rfc5444_writer_unregister_postprocessor(writer, processor);
}
/* remove all message creators */
avl_for_each_element_safe(&writer->_msgcreators, msg, _msgcreator_node, safe_msg) {
/* prevent message from being freed in the middle of the processing */
msg->_registered = true;
/* remove all message content providers */
avl_for_each_element_safe(&msg->_provider_tree, provider, _provider_node, safe_prv) {
rfc5444_writer_unregister_content_provider(writer, provider, NULL, 0);
}
/* remove all registered address tlvs */
list_for_each_element_safe(&msg->_msgspecific_tlvtype_head, tlvtype, _tlvtype_node, safe_tt) {
rfc5444_writer_unregister_addrtlvtype(writer, tlvtype);
}
/* remove message and addresses */
rfc5444_writer_unregister_message(writer, msg);
}
} | pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x3660e
movq %rdi, %rbx
cmpl $0x0, 0x138(%rdi)
jne 0x3662d
movq 0x80(%rbx), %rsi
movq 0x8(%rsi), %rax
cmpq 0x88(%rbx), %rax
je 0x364e2
movq (%rsi), %r14
movq %rbx, %rdi
callq 0x3664c
movq 0x8(%r14), %rax
movq %r14, %rsi
jmp 0x364c5
movq 0xe0(%rbx), %rsi
movq 0x8(%rsi), %rax
cmpq 0xe8(%rbx), %rax
je 0x3650e
movq (%rsi), %r14
addq $-0x30, %rsi
movq %rbx, %rdi
callq 0x36696
movq 0x8(%r14), %rax
movq %r14, %rsi
jmp 0x364ed
movq 0xf0(%rbx), %rsi
movq 0x8(%rsi), %rax
cmpq 0xf8(%rbx), %rax
je 0x3653a
movq (%rsi), %r14
addq $-0x8, %rsi
movq %rbx, %rdi
callq 0x366e5
movq 0x8(%r14), %rax
movq %r14, %rsi
jmp 0x36519
movq 0x90(%rbx), %rsi
movq 0x8(%rsi), %rax
cmpq 0x98(%rbx), %rax
je 0x36580
leaq 0x90(%rbx), %r14
movq (%rsi), %r15
testq %r15, %r15
sete %cl
testq %rax, %rax
sete %al
orb %cl, %al
jne 0x36570
movq %r14, %rdi
callq 0x27bcf
movq 0x8(%r15), %rax
movq %r15, %rsi
cmpq 0x98(%rbx), %rax
jne 0x36555
movq 0x58(%rbx), %r14
movq 0x8(%r14), %rax
cmpq 0x60(%rbx), %rax
je 0x36602
movq (%r14), %r15
movq 0x38(%r14), %rsi
movb $0x1, 0x60(%r14)
movq 0x8(%rsi), %rax
cmpq 0x40(%r14), %rax
je 0x365c1
movq (%rsi), %r12
addq $-0x20, %rsi
movq %rbx, %rdi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3675b
movq 0x8(%r12), %rax
movq %r12, %rsi
jmp 0x3659e
movq 0xc8(%r14), %rsi
movq 0x8(%rsi), %rax
cmpq 0xd0(%r14), %rax
je 0x365ee
movq (%rsi), %r12
addq $-0x8, %rsi
movq %rbx, %rdi
callq 0x366e5
movq 0x8(%r12), %rax
movq %r12, %rsi
jmp 0x365cc
movq %rbx, %rdi
movq %r14, %rsi
callq 0x367f5
movq 0x8(%r15), %rax
movq %r15, %r14
jmp 0x36588
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0xba2d(%rip), %rdi # 0x42042
leaq 0xb95b(%rip), %rsi # 0x41f77
leaq 0xba26(%rip), %rcx # 0x42049
movl $0x83, %edx
callq 0x11230
leaq 0xa02d(%rip), %rdi # 0x40661
leaq 0xb93c(%rip), %rsi # 0x41f77
leaq 0xba07(%rip), %rcx # 0x42049
movl $0x85, %edx
callq 0x11230
| /OLSR[P]OONF/src/librfc5444/rfc5444_writer.c |
rfc5444_writer_unregister_target | void
rfc5444_writer_unregister_target(
struct rfc5444_writer *writer __attribute__((unused)), struct rfc5444_writer_target *interf) {
#if WRITER_STATE_MACHINE == true
assert(writer->_state == RFC5444_WRITER_NONE);
#endif
/* remove interface from writer */
if (list_is_node_added(&interf->_target_node)) {
list_remove(&interf->_target_node);
}
} | cmpl $0x0, 0x138(%rdi)
jne 0x366c5
movq 0x30(%rsi), %rax
testq %rax, %rax
je 0x366c4
cmpq $0x0, 0x38(%rsi)
je 0x366c4
movq 0x38(%rsi), %rcx
addq $0x30, %rsi
movq %rax, (%rcx)
movq %rcx, 0x8(%rax)
xorps %xmm0, %xmm0
movups %xmm0, (%rsi)
retq
pushq %rax
leaq 0x9f94(%rip), %rdi # 0x40661
leaq 0xb8a3(%rip), %rsi # 0x41f77
leaq 0xbf3a(%rip), %rcx # 0x42615
movl $0x231, %edx # imm = 0x231
callq 0x11230
| /OLSR[P]OONF/src/librfc5444/rfc5444_writer.c |
rfc5444_writer_unregister_content_provider | void
rfc5444_writer_unregister_content_provider(struct rfc5444_writer *writer, struct rfc5444_writer_content_provider *cpr,
struct rfc5444_writer_tlvtype *addrtlvs, size_t addrtlvs_count) {
size_t i;
#if WRITER_STATE_MACHINE == true
assert(writer->_state == RFC5444_WRITER_NONE);
#endif
if (!avl_is_node_added(&cpr->_provider_node)) {
return;
}
for (i = 0; i < addrtlvs_count; i++) {
rfc5444_writer_unregister_addrtlvtype(writer, &addrtlvs[i]);
}
avl_remove(&cpr->creator->_provider_tree, &cpr->_provider_node);
_lazy_free_message(writer, cpr->creator);
} | pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
cmpl $0x0, 0x138(%rdi)
jne 0x367d6
movq %rsi, %r14
cmpq $0x0, 0x20(%rsi)
je 0x367cc
cmpq $0x0, 0x28(%r14)
je 0x367cc
movq %rcx, %r15
movq %rdi, %rbx
leaq 0x20(%r14), %r13
testq %rcx, %rcx
je 0x367a7
movq %rdx, %r12
movq %rbx, %rdi
movq %r12, %rsi
callq 0x366e5
addq $0x98, %r12
decq %r15
jne 0x36790
movq 0x58(%r14), %rdi
addq $0x38, %rdi
movq %r13, %rsi
callq 0x27bcf
movq 0x58(%r14), %rsi
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x36c2d
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x9e84(%rip), %rdi # 0x40661
leaq 0xb793(%rip), %rsi # 0x41f77
leaq 0xbb63(%rip), %rcx # 0x4234e
movl $0x175, %edx # imm = 0x175
callq 0x11230
| /OLSR[P]OONF/src/librfc5444/rfc5444_writer.c |
rfc5444_writer_register_message | struct rfc5444_writer_message *
rfc5444_writer_register_message(struct rfc5444_writer *writer, uint8_t msgid, bool if_specific) {
struct rfc5444_writer_message *msg;
#if WRITER_STATE_MACHINE == true
assert(writer->_state == RFC5444_WRITER_NONE);
#endif
msg = _get_message(writer, msgid);
if (msg == NULL) {
/* out of memory error */
return NULL;
}
if (msg->_registered) {
/* message was already _registered */
return NULL;
}
/* mark message as _registered */
msg->_registered = true;
/* set target_specific flag */
msg->target_specific = if_specific;
return msg;
} | pushq %rbx
cmpl $0x0, 0x138(%rdi)
jne 0x36d4e
movl %edx, %ebx
movzbl %sil, %esi
callq 0x36abd
testq %rax, %rax
je 0x36d41
cmpb $0x0, 0x60(%rax)
je 0x36d45
xorl %eax, %eax
jmp 0x36d4c
movb $0x1, 0x60(%rax)
movb %bl, 0x61(%rax)
popq %rbx
retq
leaq 0x990c(%rip), %rdi # 0x40661
leaq 0xb21b(%rip), %rsi # 0x41f77
leaq 0xb687(%rip), %rcx # 0x423ea
movl $0x192, %edx # imm = 0x192
callq 0x11230
| /OLSR[P]OONF/src/librfc5444/rfc5444_writer.c |
rfc5444_writer_register_target | void
rfc5444_writer_register_target(struct rfc5444_writer *writer, struct rfc5444_writer_target *interf) {
#if WRITER_STATE_MACHINE == true
assert(writer->_state == RFC5444_WRITER_NONE);
#endif
assert(interf->packet_buffer != NULL && interf->packet_size > 0);
interf->_pkt.buffer = interf->packet_buffer;
_rfc5444_tlv_writer_init(&interf->_pkt, interf->packet_size, interf->packet_size);
interf->_is_flushed = true;
list_add_tail(&writer->_targets, &interf->_target_node);
} | pushq %r14
pushq %rbx
pushq %rax
cmpl $0x0, 0x138(%rdi)
jne 0x36f3a
movq %rsi, %r14
movq (%rsi), %rax
testq %rax, %rax
je 0x36f1b
movq 0x8(%r14), %rdx
testq %rdx, %rdx
je 0x36f1b
movq %rdi, %rbx
leaq 0x48(%r14), %rdi
movq %rax, 0x48(%r14)
movq %rdx, %rsi
callq 0x36100
movb $0x1, 0x40(%r14)
leaq 0xe0(%rbx), %rax
leaq 0x30(%r14), %rcx
movq 0xe8(%rbx), %rdx
movq %rax, 0x30(%r14)
movq %rdx, 0x38(%r14)
movq %rcx, 0xe8(%rbx)
movq %rcx, (%rdx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0xb6ba(%rip), %rdi # 0x425dc
leaq 0xb04e(%rip), %rsi # 0x41f77
leaq 0xb64f(%rip), %rcx # 0x4257f
movl $0x21d, %edx # imm = 0x21D
callq 0x11230
leaq 0x9720(%rip), %rdi # 0x40661
leaq 0xb02f(%rip), %rsi # 0x41f77
leaq 0xb630(%rip), %rcx # 0x4257f
movl $0x21a, %edx # imm = 0x21A
callq 0x11230
| /OLSR[P]OONF/src/librfc5444/rfc5444_writer.c |
mbedtls_ecp_curve_info_from_grp_id | const mbedtls_ecp_curve_info *mbedtls_ecp_curve_info_from_grp_id( mbedtls_ecp_group_id grp_id )
{
const mbedtls_ecp_curve_info *curve_info;
for( curve_info = mbedtls_ecp_curve_list();
curve_info->grp_id != MBEDTLS_ECP_DP_NONE;
curve_info++ )
{
if( curve_info->grp_id == grp_id )
return( curve_info );
}
return( NULL );
} | leaq 0x35c3d(%rip), %rax # 0x43a00
movl $0x5, %ecx
cmpl %edi, %ecx
je 0xddd9
movl 0x10(%rax), %ecx
addq $0x10, %rax
testl %ecx, %ecx
jne 0xddc8
xorl %eax, %eax
retq
| /ARMmbed[P]mbed-crypto/library/ecp.c |
mbedtls_ecp_curve_info_from_name | const mbedtls_ecp_curve_info *mbedtls_ecp_curve_info_from_name( const char *name )
{
const mbedtls_ecp_curve_info *curve_info;
if( name == NULL )
return( NULL );
for( curve_info = mbedtls_ecp_curve_list();
curve_info->grp_id != MBEDTLS_ECP_DP_NONE;
curve_info++ )
{
if( strcmp( curve_info->name, name ) == 0 )
return( curve_info );
}
return( NULL );
} | pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0xde21
movq %rdi, %r14
leaq 0x35bf9(%rip), %rbx # 0x43a00
movq 0x8(%rbx), %rdi
movq %r14, %rsi
callq 0xc160
testl %eax, %eax
je 0xde23
cmpl $0x0, 0x10(%rbx)
leaq 0x10(%rbx), %rbx
jne 0xde07
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
| /ARMmbed[P]mbed-crypto/library/ecp.c |
mbedtls_ecp_point_write_binary | int mbedtls_ecp_point_write_binary( const mbedtls_ecp_group *grp,
const mbedtls_ecp_point *P,
int format, size_t *olen,
unsigned char *buf, size_t buflen )
{
int ret = MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE;
size_t plen;
ECP_VALIDATE_RET( grp != NULL );
ECP_VALIDATE_RET( P != NULL );
ECP_VALIDATE_RET( olen != NULL );
ECP_VALIDATE_RET( buf != NULL );
ECP_VALIDATE_RET( format == MBEDTLS_ECP_PF_UNCOMPRESSED ||
format == MBEDTLS_ECP_PF_COMPRESSED );
plen = mbedtls_mpi_size( &grp->P );
#if defined(ECP_MONTGOMERY)
if( mbedtls_ecp_get_type( grp ) == MBEDTLS_ECP_TYPE_MONTGOMERY )
{
*olen = plen;
if( buflen < *olen )
return( MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL );
MBEDTLS_MPI_CHK( mbedtls_mpi_write_binary_le( &P->X, buf, plen ) );
}
#endif
#if defined(ECP_SHORTWEIERSTRASS)
if( mbedtls_ecp_get_type( grp ) == MBEDTLS_ECP_TYPE_SHORT_WEIERSTRASS )
{
/*
* Common case: P == 0
*/
if( mbedtls_mpi_cmp_int( &P->Z, 0 ) == 0 )
{
if( buflen < 1 )
return( MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL );
buf[0] = 0x00;
*olen = 1;
return( 0 );
}
if( format == MBEDTLS_ECP_PF_UNCOMPRESSED )
{
*olen = 2 * plen + 1;
if( buflen < *olen )
return( MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL );
buf[0] = 0x04;
MBEDTLS_MPI_CHK( mbedtls_mpi_write_binary( &P->X, buf + 1, plen ) );
MBEDTLS_MPI_CHK( mbedtls_mpi_write_binary( &P->Y, buf + 1 + plen, plen ) );
}
else if( format == MBEDTLS_ECP_PF_COMPRESSED )
{
*olen = plen + 1;
if( buflen < *olen )
return( MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL );
buf[0] = 0x02 + mbedtls_mpi_get_bit( &P->Y, 0 );
MBEDTLS_MPI_CHK( mbedtls_mpi_write_binary( &P->X, buf + 1, plen ) );
}
}
#endif
cleanup:
return( ret );
} | pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %r12
movq %r8, %rbp
movq %rcx, %r13
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r14
addq $0x8, %rdi
callq 0x1a9a7
cmpq $0x0, 0x60(%r14)
je 0xe216
movq %rbp, 0x8(%rsp)
movl $0xffffb180, %ebp # imm = 0xFFFFB180
cmpq $0x0, 0x78(%r14)
je 0xe220
movq %rax, %r14
leaq 0x30(%r15), %rdi
xorl %esi, %esi
callq 0x1b8ef
testl %eax, %eax
je 0xe24b
cmpl $0x1, %ebx
je 0xe264
testl %ebx, %ebx
jne 0xe2ad
leaq (%r14,%r14), %rax
leaq 0x1(,%r14,2), %rcx
movq %rcx, (%r13)
movl $0xffffb100, %ebp # imm = 0xFFFFB100
cmpq %r12, %rax
jae 0xe2ad
movq 0x8(%rsp), %rbx
movb $0x4, (%rbx)
incq %rbx
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1b46f
testl %eax, %eax
jne 0xe247
addq $0x18, %r15
addq %r14, %rbx
movq %r15, %rdi
movq %rbx, %rsi
jmp 0xe292
movl $0xffffb180, %ebp # imm = 0xFFFFB180
jmp 0xe2ad
movq %rax, (%r13)
movl $0xffffb100, %ebp # imm = 0xFFFFB100
cmpq %r12, %rax
ja 0xe2ad
movq %r15, %rdi
movq 0x8(%rsp), %rsi
movq %rax, %rdx
movq %rax, 0x10(%rsp)
callq 0x1b3ce
testl %eax, %eax
je 0xe2be
movl %eax, %ebp
jmp 0xe2ad
testq %r12, %r12
je 0xe2a8
movq 0x8(%rsp), %rax
movb $0x0, (%rax)
movq $0x1, (%r13)
xorl %ebp, %ebp
jmp 0xe2ad
movq %r14, %rax
incq %rax
movq %rax, (%r13)
movl $0xffffb100, %ebp # imm = 0xFFFFB100
cmpq %r12, %rax
ja 0xe2ad
leaq 0x18(%r15), %rdi
xorl %esi, %esi
callq 0x1a857
addb $0x2, %al
movq 0x8(%rsp), %rsi
movb %al, (%rsi)
incq %rsi
movq %r15, %rdi
movq %r14, %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1b46f
movl $0xffffb100, %ebp # imm = 0xFFFFB100
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%rsp), %rax
cmpq $0x0, 0x60(%r14)
je 0xe260
xorl %ebp, %ebp
cmpq $0x0, 0x78(%r14)
jne 0xe1a5
jmp 0xe2ad
| /ARMmbed[P]mbed-crypto/library/ecp.c |
ecp_select_comb | static int ecp_select_comb( const mbedtls_ecp_group *grp, mbedtls_ecp_point *R,
const mbedtls_ecp_point T[], unsigned char T_size,
unsigned char i )
{
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
unsigned char ii, j;
/* Ignore the "sign" bit and scale down */
ii = ( i & 0x7Fu ) >> 1;
/* Read the whole table to thwart cache-based timing attacks */
for( j = 0; j < T_size; j++ )
{
MBEDTLS_MPI_CHK( mbedtls_mpi_safe_cond_assign( &R->X, &T[j].X, j == ii ) );
MBEDTLS_MPI_CHK( mbedtls_mpi_safe_cond_assign( &R->Y, &T[j].Y, j == ii ) );
}
/* Safely invert result if i is "negative" */
MBEDTLS_MPI_CHK( ecp_safe_invert_jac( grp, R, i >> 7 ) );
cleanup:
return( ret );
} | pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r8d, 0x4(%rsp)
movq %rsi, %r14
movq %rdi, 0x8(%rsp)
testl %ecx, %ecx
je 0x11463
movq %rdx, %r12
movl 0x4(%rsp), %eax
shrb %al
andb $0x3f, %al
leaq 0x18(%r14), %rdx
movq %rdx, 0x10(%rsp)
movzbl %al, %r15d
movzbl %cl, %ebx
xorl %r13d, %r13d
xorl %ebp, %ebp
cmpq %r13, %r15
sete %bpl
movq %r14, %rdi
movq %r12, %rsi
movl %ebp, %edx
callq 0x1a6f3
testl %eax, %eax
jne 0x11488
leaq 0x18(%r12), %rsi
movq 0x10(%rsp), %rdi
movl %ebp, %edx
callq 0x1a6f3
testl %eax, %eax
jne 0x11488
incq %r13
addq $0x48, %r12
cmpq %r13, %rbx
jne 0x11428
movl 0x4(%rsp), %eax
shrb $0x7, %al
movzbl %al, %edx
movq 0x8(%rsp), %rdi
movq %r14, %rsi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x111ed
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
| /ARMmbed[P]mbed-crypto/library/ecp.c |
ecp_mod_p521 | static int ecp_mod_p521( mbedtls_mpi *N )
{
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
size_t i;
mbedtls_mpi M;
mbedtls_mpi_uint Mp[P521_WIDTH + 1];
/* Worst case for the size of M is when mbedtls_mpi_uint is 16 bits:
* we need to hold bits 513 to 1056, which is 34 limbs, that is
* P521_WIDTH + 1. Otherwise P521_WIDTH is enough. */
if( N->n < P521_WIDTH )
return( 0 );
/* M = A1 */
M.s = 1;
M.n = N->n - ( P521_WIDTH - 1 );
if( M.n > P521_WIDTH + 1 )
M.n = P521_WIDTH + 1;
M.p = Mp;
memcpy( Mp, N->p + P521_WIDTH - 1, M.n * sizeof( mbedtls_mpi_uint ) );
MBEDTLS_MPI_CHK( mbedtls_mpi_shift_r( &M, 521 % ( 8 * sizeof( mbedtls_mpi_uint ) ) ) );
/* N = A0 */
N->p[P521_WIDTH - 1] &= P521_MASK;
for( i = P521_WIDTH; i < N->n; i++ )
N->p[i] = 0;
/* N = A0 + A1 */
MBEDTLS_MPI_CHK( mbedtls_mpi_add_abs( N, N, &M ) );
cleanup:
return( ret );
} | movq 0x8(%rdi), %rcx
xorl %eax, %eax
cmpq $0x9, %rcx
jb 0x12856
pushq %r14
pushq %rbx
subq $0x78, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %r14
movl $0x1, (%r14)
addq $-0x8, %rcx
cmpq $0xa, %rcx
movl $0xa, %edx
cmovbq %rcx, %rdx
movq %rdx, 0x8(%r14)
leaq 0x20(%rsp), %rdi
movq %rdi, 0x10(%r14)
movq 0x10(%rbx), %rsi
addq $0x40, %rsi
shll $0x3, %edx
callq 0xc1b0
movl $0x9, %esi
movq %r14, %rdi
callq 0x1b5fe
testl %eax, %eax
jne 0x1284f
movq 0x10(%rbx), %rax
andq $0x1ff, 0x40(%rax) # imm = 0x1FF
cmpq $0xa, 0x8(%rbx)
jb 0x1283f
movl $0x9, %ecx
movq $0x0, (%rax,%rcx,8)
incq %rcx
cmpq 0x8(%rbx), %rcx
jb 0x1282e
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
movq %rbx, %rsi
callq 0x1b92c
addq $0x78, %rsp
popq %rbx
popq %r14
retq
| /ARMmbed[P]mbed-crypto/library/ecp_curves.c |
ecp_mod_koblitz | static inline int ecp_mod_koblitz( mbedtls_mpi *N, mbedtls_mpi_uint *Rp, size_t p_limbs,
size_t adjust, size_t shift, mbedtls_mpi_uint mask )
{
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
size_t i;
mbedtls_mpi M, R;
mbedtls_mpi_uint Mp[P_KOBLITZ_MAX + P_KOBLITZ_R + 1];
if( N->n < p_limbs )
return( 0 );
/* Init R */
R.s = 1;
R.p = Rp;
R.n = P_KOBLITZ_R;
/* Common setup for M */
M.s = 1;
M.p = Mp;
/* M = A1 */
M.n = N->n - ( p_limbs - adjust );
if( M.n > p_limbs + adjust )
M.n = p_limbs + adjust;
memset( Mp, 0, sizeof Mp );
memcpy( Mp, N->p + p_limbs - adjust, M.n * sizeof( mbedtls_mpi_uint ) );
if( shift != 0 )
MBEDTLS_MPI_CHK( mbedtls_mpi_shift_r( &M, shift ) );
M.n += R.n; /* Make room for multiplication by R */
/* N = A0 */
if( mask != 0 )
N->p[p_limbs - 1] &= mask;
for( i = p_limbs; i < N->n; i++ )
N->p[i] = 0;
/* N = A0 + R * A1 */
MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mpi( &M, &M, &R ) );
MBEDTLS_MPI_CHK( mbedtls_mpi_add_abs( N, N, &M ) );
/* Second pass */
/* M = A1 */
M.n = N->n - ( p_limbs - adjust );
if( M.n > p_limbs + adjust )
M.n = p_limbs + adjust;
memset( Mp, 0, sizeof Mp );
memcpy( Mp, N->p + p_limbs - adjust, M.n * sizeof( mbedtls_mpi_uint ) );
if( shift != 0 )
MBEDTLS_MPI_CHK( mbedtls_mpi_shift_r( &M, shift ) );
M.n += R.n; /* Make room for multiplication by R */
/* N = A0 */
if( mask != 0 )
N->p[p_limbs - 1] &= mask;
for( i = p_limbs; i < N->n; i++ )
N->p[i] = 0;
/* N = A0 + R * A1 */
MBEDTLS_MPI_CHK( mbedtls_mpi_mul_mpi( &M, &M, &R ) );
MBEDTLS_MPI_CHK( mbedtls_mpi_add_abs( N, N, &M ) );
cleanup:
return( ret );
} | pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq 0x8(%rdi), %r12
xorl %eax, %eax
cmpq %rdx, %r12
jb 0x12c1e
movq %rcx, %r13
movq %rdx, %r14
movq %rdi, %rbx
movq %r9, 0x20(%rsp)
movl $0x1, %eax
movl %eax, 0x38(%rsp)
movq %rsi, 0x48(%rsp)
movq $0x1, 0x40(%rsp)
movl %eax, 0x8(%rsp)
leaq 0x50(%rsp), %rdi
movq %rdx, %rbp
subq %rcx, %rbp
subq %rbp, %r12
leaq (%rcx,%rdx), %r15
cmpq %r15, %r12
cmovaeq %r15, %r12
movq %rdi, 0x18(%rsp)
movq %r12, 0x10(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, (%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, 0x20(%rdi)
leaq (,%rdx,8), %rax
movq 0x10(%rbx), %rsi
movq %rax, 0x30(%rsp)
addq %rax, %rsi
leaq (,%rcx,8), %rax
subq %rax, %rsi
leaq (,%r12,8), %rdx
movq %r8, 0x28(%rsp)
callq 0xc1b0
movq 0x28(%rsp), %rsi
testq %rsi, %rsi
je 0x12bbb
leaq 0x8(%rsp), %rdi
callq 0x1b5fe
testl %eax, %eax
jne 0x12c1e
movq 0x10(%rsp), %r12
incq %r12
movq %r12, 0x10(%rsp)
movq 0x20(%rsp), %rcx
testq %rcx, %rcx
je 0x12bd6
movq 0x10(%rbx), %rax
andq %rcx, -0x8(%rax,%r14,8)
cmpq %r14, 0x8(%rbx)
jbe 0x12bf4
movq 0x10(%rbx), %rax
movq %r14, %rcx
movq $0x0, (%rax,%rcx,8)
incq %rcx
cmpq 0x8(%rbx), %rcx
jb 0x12be3
leaq 0x8(%rsp), %rdi
leaq 0x38(%rsp), %rdx
movq %rdi, %rsi
callq 0x1bc47
testl %eax, %eax
jne 0x12c1e
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
movq %rbx, %rsi
callq 0x1b92c
testl %eax, %eax
je 0x12c30
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
negq %r13
movq 0x8(%rbx), %r12
subq %rbp, %r12
cmpq %r15, %r12
cmovaeq %r15, %r12
movq %r12, 0x10(%rsp)
xorps %xmm0, %xmm0
leaq 0x50(%rsp), %rdi
movaps %xmm0, (%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, 0x20(%rdi)
movq 0x30(%rsp), %rax
addq 0x10(%rbx), %rax
leaq (%rax,%r13,8), %rsi
leaq (,%r12,8), %rdx
callq 0xc1b0
movq 0x28(%rsp), %rsi
testq %rsi, %rsi
je 0x12c90
leaq 0x8(%rsp), %rdi
callq 0x1b5fe
testl %eax, %eax
jne 0x12c1e
movq 0x10(%rsp), %r12
addq 0x40(%rsp), %r12
movq %r12, 0x10(%rsp)
movq 0x20(%rsp), %rcx
testq %rcx, %rcx
je 0x12cad
movq 0x10(%rbx), %rax
andq %rcx, -0x8(%rax,%r14,8)
cmpq %r14, 0x8(%rbx)
jbe 0x12cc8
movq 0x10(%rbx), %rax
movq $0x0, (%rax,%r14,8)
incq %r14
cmpq 0x8(%rbx), %r14
jb 0x12cb7
leaq 0x8(%rsp), %rdi
leaq 0x38(%rsp), %rdx
movq %rdi, %rsi
callq 0x1bc47
testl %eax, %eax
jne 0x12c1e
leaq 0x8(%rsp), %rdx
movq %rbx, %rdi
movq %rbx, %rsi
callq 0x1b92c
jmp 0x12c1e
nop
| /ARMmbed[P]mbed-crypto/library/ecp_curves.c |
mbedtls_pk_check_pair | int mbedtls_pk_check_pair( const mbedtls_pk_context *pub, const mbedtls_pk_context *prv )
{
PK_VALIDATE_RET( pub != NULL );
PK_VALIDATE_RET( prv != NULL );
if( pub->pk_info == NULL ||
prv->pk_info == NULL )
{
return( MBEDTLS_ERR_PK_BAD_INPUT_DATA );
}
if( prv->pk_info->check_pair_func == NULL )
return( MBEDTLS_ERR_PK_FEATURE_UNAVAILABLE );
if( prv->pk_info->type == MBEDTLS_PK_RSA_ALT )
{
if( pub->pk_info->type != MBEDTLS_PK_RSA )
return( MBEDTLS_ERR_PK_TYPE_MISMATCH );
}
else
{
if( pub->pk_info != prv->pk_info )
return( MBEDTLS_ERR_PK_TYPE_MISMATCH );
}
return( prv->pk_info->check_pair_func( pub->pk_ctx, prv->pk_ctx ) );
} | movq (%rdi), %rdx
movl $0xffffc180, %eax # imm = 0xFFFFC180
testq %rdx, %rdx
je 0x130ec
movq (%rsi), %r8
testq %r8, %r8
je 0x130ec
movq 0x40(%r8), %rcx
testq %rcx, %rcx
je 0x130dc
cmpl $0x5, (%r8)
jne 0x130e2
movl $0xffffc100, %eax # imm = 0xFFFFC100
cmpl $0x1, (%rdx)
jne 0x130ec
movq 0x8(%rdi), %rdi
movq 0x8(%rsi), %rsi
jmpq *%rcx
movl $0xffffc680, %eax # imm = 0xFFFFC680
retq
movl $0xffffc100, %eax # imm = 0xFFFFC100
cmpq %r8, %rdx
je 0x130d2
retq
| /ARMmbed[P]mbed-crypto/library/pk.c |
rsa_encrypt_wrap | static int rsa_encrypt_wrap( void *ctx,
const unsigned char *input, size_t ilen,
unsigned char *output, size_t *olen, size_t osize,
int (*f_rng)(void *, unsigned char *, size_t), void *p_rng )
{
mbedtls_rsa_context * rsa = (mbedtls_rsa_context *) ctx;
*olen = mbedtls_rsa_get_len( rsa );
if( *olen > osize )
return( MBEDTLS_ERR_RSA_OUTPUT_TOO_LARGE );
return( mbedtls_rsa_pkcs1_encrypt( rsa, f_rng, p_rng, MBEDTLS_RSA_PUBLIC,
ilen, input, output ) );
} | pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %r13
movq %r8, %rbp
movq %rcx, %r15
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r12
callq 0x15736
movq %rax, (%rbp)
cmpq %r13, %rax
jbe 0x13306
movl $0xffffbc00, %eax # imm = 0xFFFFBC00
jmp 0x13324
movq 0x48(%rsp), %rdx
movq 0x40(%rsp), %rsi
movq %r15, (%rsp)
movq %r12, %rdi
xorl %ecx, %ecx
movq %r14, %r8
movq %rbx, %r9
callq 0x1682b
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
| /ARMmbed[P]mbed-crypto/library/pk_wrap.c |
eckey_sign_wrap | static int eckey_sign_wrap( void *ctx, mbedtls_md_type_t md_alg,
const unsigned char *hash, size_t hash_len,
unsigned char *sig, size_t *sig_len,
int (*f_rng)(void *, unsigned char *, size_t), void *p_rng )
{
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
mbedtls_ecdsa_context ecdsa;
mbedtls_ecdsa_init( &ecdsa );
if( ( ret = mbedtls_ecdsa_from_keypair( &ecdsa, ctx ) ) == 0 )
ret = ecdsa_sign_wrap( &ecdsa, md_alg, hash, hash_len, sig, sig_len,
f_rng, p_rng );
mbedtls_ecdsa_free( &ecdsa );
return( ret );
} | pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp # imm = 0x168
movq %r9, 0x8(%rsp)
movq %r8, %r14
movq %rcx, %r15
movq %rdx, %r12
movl %esi, %ebp
movq %rdi, %r13
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x1f24e
movq %rbx, %rdi
movq %r13, %rsi
callq 0x1f1ea
movl %eax, %r13d
testl %eax, %eax
jne 0x134ae
leaq 0x10(%rsp), %rdi
movl %ebp, %esi
movq %r12, %rdx
movq %r15, %rcx
movq %r14, %r8
movq 0x8(%rsp), %r9
pushq 0x1a8(%rsp)
pushq 0x1a8(%rsp)
callq 0x1f06d
addq $0x10, %rsp
movl %eax, %r13d
leaq 0x10(%rsp), %rdi
callq 0x1f244
movl %r13d, %eax
addq $0x168, %rsp # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
| /ARMmbed[P]mbed-crypto/library/pk_wrap.c |
pk_get_rsapubkey | static int pk_get_rsapubkey( unsigned char **p,
const unsigned char *end,
mbedtls_rsa_context *rsa )
{
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
size_t len;
if( ( ret = mbedtls_asn1_get_tag( p, end, &len,
MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE ) ) != 0 )
return( MBEDTLS_ERR_PK_INVALID_PUBKEY + ret );
if( *p + len != end )
return( MBEDTLS_ERR_PK_INVALID_PUBKEY +
MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );
/* Import N */
if( ( ret = mbedtls_asn1_get_tag( p, end, &len, MBEDTLS_ASN1_INTEGER ) ) != 0 )
return( MBEDTLS_ERR_PK_INVALID_PUBKEY + ret );
if( ( ret = mbedtls_rsa_import_raw( rsa, *p, len, NULL, 0, NULL, 0,
NULL, 0, NULL, 0 ) ) != 0 )
return( MBEDTLS_ERR_PK_INVALID_PUBKEY );
*p += len;
/* Import E */
if( ( ret = mbedtls_asn1_get_tag( p, end, &len, MBEDTLS_ASN1_INTEGER ) ) != 0 )
return( MBEDTLS_ERR_PK_INVALID_PUBKEY + ret );
if( ( ret = mbedtls_rsa_import_raw( rsa, NULL, 0, NULL, 0, NULL, 0,
NULL, 0, *p, len ) ) != 0 )
return( MBEDTLS_ERR_PK_INVALID_PUBKEY );
*p += len;
if( mbedtls_rsa_complete( rsa ) != 0 ||
mbedtls_rsa_check_pubkey( rsa ) != 0 )
{
return( MBEDTLS_ERR_PK_INVALID_PUBKEY );
}
if( *p != end )
return( MBEDTLS_ERR_PK_INVALID_PUBKEY +
MBEDTLS_ERR_ASN1_LENGTH_MISMATCH );
return( 0 );
} | pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x38, %rsp
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x30(%rsp), %rdx
movl $0x30, %ecx
callq 0x19e01
testl %eax, %eax
je 0x14061
movl %eax, %ebp
addl $0xffffc500, %ebp # imm = 0xFFFFC500
jmp 0x14073
movq (%r14), %rax
addq 0x30(%rsp), %rax
movl $0xffffc49a, %ebp # imm = 0xFFFFC49A
cmpq %rbx, %rax
je 0x14080
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x30(%rsp), %rdx
movq %r14, %rdi
movq %rbx, %rsi
movl $0x2, %ecx
callq 0x19e01
testl %eax, %eax
jne 0x14057
movq (%r14), %rsi
movq 0x30(%rsp), %rdx
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rsp)
movups %xmm0, (%rsp)
movq $0x0, 0x20(%rsp)
movq %r15, %rdi
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x14faf
movl $0xffffc500, %ebp # imm = 0xFFFFC500
testl %eax, %eax
jne 0x14073
leaq 0x30(%rsp), %rdx
movq (%rdx), %rax
addq %rax, (%r14)
movq %r14, %rdi
movq %rbx, %rsi
movl $0x2, %ecx
callq 0x19e01
testl %eax, %eax
je 0x140fa
addl $0xffffc500, %eax # imm = 0xFFFFC500
movl %eax, %ebp
jmp 0x14073
movq (%r14), %rax
movq 0x30(%rsp), %rcx
movq %rcx, 0x20(%rsp)
movq %rax, 0x18(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, (%rsp)
movq $0x0, 0x10(%rsp)
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x14faf
testl %eax, %eax
jne 0x14073
movq 0x30(%rsp), %rax
addq %rax, (%r14)
movq %r15, %rdi
callq 0x15079
testl %eax, %eax
jne 0x14073
movq %r15, %rdi
callq 0x15bf0
testl %eax, %eax
jne 0x14073
xorl %eax, %eax
cmpq %rbx, (%r14)
movl $0xffffc49a, %ebp # imm = 0xFFFFC49A
cmovel %eax, %ebp
jmp 0x14073
| /ARMmbed[P]mbed-crypto/library/pkparse.c |
pk_get_ecpubkey | static int pk_get_ecpubkey( unsigned char **p, const unsigned char *end,
mbedtls_ecp_keypair *key )
{
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
if( ( ret = mbedtls_ecp_point_read_binary( &key->grp, &key->Q,
(const unsigned char *) *p, end - *p ) ) == 0 )
{
ret = mbedtls_ecp_check_pubkey( &key->grp, &key->Q );
}
/*
* We know mbedtls_ecp_point_read_binary consumed all bytes or failed
*/
*p = (unsigned char *) end;
return( ret );
} | pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x110(%rdx), %r12
movq (%rdi), %rdx
movq %rsi, %rcx
subq %rdx, %rcx
movq %r15, %rdi
movq %r12, %rsi
callq 0xe2d9
testl %eax, %eax
jne 0x146a5
movq %r15, %rdi
movq %r12, %rsi
callq 0xf3d4
movq %rbx, (%r14)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
| /ARMmbed[P]mbed-crypto/library/pkparse.c |
mbedtls_rsa_export_crt | int mbedtls_rsa_export_crt( const mbedtls_rsa_context *ctx,
mbedtls_mpi *DP, mbedtls_mpi *DQ, mbedtls_mpi *QP )
{
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
int is_priv;
RSA_VALIDATE_RET( ctx != NULL );
/* Check if key is private or public */
is_priv =
mbedtls_mpi_cmp_int( &ctx->N, 0 ) != 0 &&
mbedtls_mpi_cmp_int( &ctx->P, 0 ) != 0 &&
mbedtls_mpi_cmp_int( &ctx->Q, 0 ) != 0 &&
mbedtls_mpi_cmp_int( &ctx->D, 0 ) != 0 &&
mbedtls_mpi_cmp_int( &ctx->E, 0 ) != 0;
if( !is_priv )
return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA );
#if !defined(MBEDTLS_RSA_NO_CRT)
/* Export all requested blinding parameters. */
if( ( DP != NULL && ( ret = mbedtls_mpi_copy( DP, &ctx->DP ) ) != 0 ) ||
( DQ != NULL && ( ret = mbedtls_mpi_copy( DQ, &ctx->DQ ) ) != 0 ) ||
( QP != NULL && ( ret = mbedtls_mpi_copy( QP, &ctx->QP ) ) != 0 ) )
{
return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA + ret );
}
#else
if( ( ret = mbedtls_rsa_deduce_crt( &ctx->P, &ctx->Q, &ctx->D,
DP, DQ, QP ) ) != 0 )
{
return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA + ret );
}
#endif
return( 0 );
} | pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %r15
addq $0x10, %rdi
xorl %esi, %esi
callq 0x1b8ef
movl $0xffffbf80, %ebx # imm = 0xFFFFBF80
testl %eax, %eax
je 0x156f3
leaq 0x58(%r15), %rdi
xorl %esi, %esi
callq 0x1b8ef
testl %eax, %eax
je 0x156f3
leaq 0x70(%r15), %rdi
xorl %esi, %esi
callq 0x1b8ef
testl %eax, %eax
je 0x156f3
leaq 0x40(%r15), %rdi
xorl %esi, %esi
callq 0x1b8ef
testl %eax, %eax
je 0x156f3
leaq 0x28(%r15), %rdi
xorl %esi, %esi
callq 0x1b8ef
testl %eax, %eax
je 0x156f3
testq %r13, %r13
je 0x156b6
leaq 0x88(%r15), %rsi
movq %r13, %rdi
callq 0x1a61c
testl %eax, %eax
jne 0x156eb
testq %r12, %r12
je 0x156ce
leaq 0xa0(%r15), %rsi
movq %r12, %rdi
callq 0x1a61c
testl %eax, %eax
jne 0x156eb
xorl %ebx, %ebx
testq %r14, %r14
je 0x156f3
addq $0xb8, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x1a61c
testl %eax, %eax
je 0x156f3
movl %eax, %ebx
addl $0xffffbf80, %ebx # imm = 0xFFFFBF80
movl %ebx, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
| /ARMmbed[P]mbed-crypto/library/rsa.c |
mbedtls_rsa_free | void mbedtls_rsa_free( mbedtls_rsa_context *ctx )
{
if( ctx == NULL )
return;
mbedtls_mpi_free( &ctx->Vi );
mbedtls_mpi_free( &ctx->Vf );
mbedtls_mpi_free( &ctx->RN );
mbedtls_mpi_free( &ctx->D );
mbedtls_mpi_free( &ctx->Q );
mbedtls_mpi_free( &ctx->P );
mbedtls_mpi_free( &ctx->E );
mbedtls_mpi_free( &ctx->N );
#if !defined(MBEDTLS_RSA_NO_CRT)
mbedtls_mpi_free( &ctx->RQ );
mbedtls_mpi_free( &ctx->RP );
mbedtls_mpi_free( &ctx->QP );
mbedtls_mpi_free( &ctx->DQ );
mbedtls_mpi_free( &ctx->DP );
#endif /* MBEDTLS_RSA_NO_CRT */
#if defined(MBEDTLS_THREADING_C)
mbedtls_mutex_free( &ctx->mutex );
#endif
} | testq %rdi, %rdi
je 0x15bef
pushq %rbx
movq %rdi, %rbx
addq $0x118, %rdi # imm = 0x118
callq 0x1a48e
leaq 0x130(%rbx), %rdi
callq 0x1a48e
leaq 0xd0(%rbx), %rdi
callq 0x1a48e
leaq 0x40(%rbx), %rdi
callq 0x1a48e
leaq 0x70(%rbx), %rdi
callq 0x1a48e
leaq 0x58(%rbx), %rdi
callq 0x1a48e
leaq 0x28(%rbx), %rdi
callq 0x1a48e
leaq 0x10(%rbx), %rdi
callq 0x1a48e
leaq 0x100(%rbx), %rdi
callq 0x1a48e
leaq 0xe8(%rbx), %rdi
callq 0x1a48e
leaq 0xb8(%rbx), %rdi
callq 0x1a48e
leaq 0xa0(%rbx), %rdi
callq 0x1a48e
addq $0x88, %rbx
movq %rbx, %rdi
popq %rbx
jmp 0x1a48e
retq
| /ARMmbed[P]mbed-crypto/library/rsa.c |
mbedtls_rsa_rsaes_oaep_decrypt | int mbedtls_rsa_rsaes_oaep_decrypt( mbedtls_rsa_context *ctx,
int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng,
int mode,
const unsigned char *label, size_t label_len,
size_t *olen,
const unsigned char *input,
unsigned char *output,
size_t output_max_len )
{
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
size_t ilen, i, pad_len;
unsigned char *p, bad, pad_done;
unsigned char buf[MBEDTLS_MPI_MAX_SIZE];
unsigned char lhash[MBEDTLS_MD_MAX_SIZE];
unsigned int hlen;
const mbedtls_md_info_t *md_info;
mbedtls_md_context_t md_ctx;
RSA_VALIDATE_RET( ctx != NULL );
RSA_VALIDATE_RET( mode == MBEDTLS_RSA_PRIVATE ||
mode == MBEDTLS_RSA_PUBLIC );
RSA_VALIDATE_RET( output_max_len == 0 || output != NULL );
RSA_VALIDATE_RET( label_len == 0 || label != NULL );
RSA_VALIDATE_RET( input != NULL );
RSA_VALIDATE_RET( olen != NULL );
/*
* Parameters sanity checks
*/
if( mode == MBEDTLS_RSA_PRIVATE && ctx->padding != MBEDTLS_RSA_PKCS_V21 )
return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA );
ilen = ctx->len;
if( ilen < 16 || ilen > sizeof( buf ) )
return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA );
md_info = mbedtls_md_info_from_type( (mbedtls_md_type_t) ctx->hash_id );
if( md_info == NULL )
return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA );
hlen = mbedtls_md_get_size( md_info );
// checking for integer underflow
if( 2 * hlen + 2 > ilen )
return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA );
/*
* RSA operation
*/
ret = ( mode == MBEDTLS_RSA_PUBLIC )
? mbedtls_rsa_public( ctx, input, buf )
: mbedtls_rsa_private( ctx, f_rng, p_rng, input, buf );
if( ret != 0 )
goto cleanup;
/*
* Unmask data and generate lHash
*/
mbedtls_md_init( &md_ctx );
if( ( ret = mbedtls_md_setup( &md_ctx, md_info, 0 ) ) != 0 )
{
mbedtls_md_free( &md_ctx );
goto cleanup;
}
/* seed: Apply seedMask to maskedSeed */
if( ( ret = mgf_mask( buf + 1, hlen, buf + hlen + 1, ilen - hlen - 1,
&md_ctx ) ) != 0 ||
/* DB: Apply dbMask to maskedDB */
( ret = mgf_mask( buf + hlen + 1, ilen - hlen - 1, buf + 1, hlen,
&md_ctx ) ) != 0 )
{
mbedtls_md_free( &md_ctx );
goto cleanup;
}
mbedtls_md_free( &md_ctx );
/* Generate lHash */
if( ( ret = mbedtls_md( md_info, label, label_len, lhash ) ) != 0 )
goto cleanup;
/*
* Check contents, in "constant-time"
*/
p = buf;
bad = 0;
bad |= *p++; /* First byte must be 0 */
p += hlen; /* Skip seed */
/* Check lHash */
for( i = 0; i < hlen; i++ )
bad |= lhash[i] ^ *p++;
/* Get zero-padding len, but always read till end of buffer
* (minus one, for the 01 byte) */
pad_len = 0;
pad_done = 0;
for( i = 0; i < ilen - 2 * hlen - 2; i++ )
{
pad_done |= p[i];
pad_len += ((pad_done | (unsigned char)-pad_done) >> 7) ^ 1;
}
p += pad_len;
bad |= *p++ ^ 0x01;
/*
* The only information "leaked" is whether the padding was correct or not
* (eg, no data is copied if it was not correct). This meets the
* recommendations in PKCS#1 v2.2: an opponent cannot distinguish between
* the different error conditions.
*/
if( bad != 0 )
{
ret = MBEDTLS_ERR_RSA_INVALID_PADDING;
goto cleanup;
}
if( ilen - ( p - buf ) > output_max_len )
{
ret = MBEDTLS_ERR_RSA_OUTPUT_TOO_LARGE;
goto cleanup;
}
*olen = ilen - (p - buf);
if( *olen != 0 )
memcpy( output, p, *olen );
ret = 0;
cleanup:
mbedtls_platform_zeroize( buf, sizeof( buf ) );
mbedtls_platform_zeroize( lhash, sizeof( lhash ) );
return( ret );
} | pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x488, %rsp # imm = 0x488
movl %ecx, %r12d
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
cmpl $0x1, %ecx
jne 0x168a6
movl $0xffffbf80, %ebp # imm = 0xFFFFBF80
cmpl $0x1, 0x148(%r14)
jne 0x169ef
movq 0x8(%r14), %rcx
leaq -0x401(%rcx), %rax
movl $0xffffbf80, %ebp # imm = 0xFFFFBF80
cmpq $-0x3f1, %rax # imm = 0xFC0F
jb 0x169ef
movq %r8, 0x18(%rsp)
movq %r9, 0x20(%rsp)
movq %rcx, 0x8(%rsp)
movl 0x14c(%r14), %edi
callq 0x1fdac
testq %rax, %rax
je 0x169ef
movq %rax, %r13
movq %rax, %rdi
callq 0x20601
movzbl %al, %ecx
leal 0x2(,%rcx,2), %eax
cmpq %rax, 0x8(%rsp)
jb 0x169ef
movq %rcx, 0x10(%rsp)
movq 0x4c8(%rsp), %rcx
testl %r12d, %r12d
je 0x16930
leaq 0x80(%rsp), %r8
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x15d86
jmp 0x16943
leaq 0x80(%rsp), %rdx
movq %r14, %rdi
movq %rcx, %rsi
callq 0x15cb4
movl %eax, %ebp
testl %eax, %eax
jne 0x169ce
leaq 0x28(%rsp), %rbx
movq %rbx, %rdi
callq 0x1fdc5
movq %rbx, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x1ff01
testl %eax, %eax
jne 0x169c2
leaq 0x81(%rsp), %rbx
movq 0x10(%rsp), %r12
leaq (%rsp,%r12), %r14
addq $0x81, %r14
movq %r12, %r15
notq %r15
addq 0x8(%rsp), %r15
leaq 0x28(%rsp), %r8
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
movq %r15, %rcx
callq 0x16593
testl %eax, %eax
jne 0x169c2
leaq 0x28(%rsp), %r8
movq %r14, %rdi
movq %r15, %rsi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x16593
testl %eax, %eax
je 0x16a03
movl %eax, %ebp
leaq 0x28(%rsp), %rdi
callq 0x1fdd4
leaq 0x80(%rsp), %rdi
movl $0x400, %esi # imm = 0x400
callq 0x14edc
leaq 0x40(%rsp), %rdi
movl $0x40, %esi
callq 0x14edc
movl %ebp, %eax
addq $0x488, %rsp # imm = 0x488
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x28(%rsp), %rdi
callq 0x1fdd4
leaq 0x40(%rsp), %rcx
movq %r13, %rdi
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rdx
callq 0x2015e
movl %eax, %ebp
testl %eax, %eax
jne 0x169ce
movq 0x10(%rsp), %r8
leal (%r8,%r8), %ecx
movb 0x80(%rsp), %al
addq %r8, %rbx
testb %r8b, %r8b
je 0x16a6b
leaq 0x1(,%r8,2), %rdx
xorl %esi, %esi
movb (%rbx,%rsi), %dil
xorb 0x40(%rsp,%rsi), %dil
orb %dil, %al
incq %rsi
cmpq %rsi, %r8
jne 0x16a4c
leaq (%rsp,%rdx), %rbx
addq $0x80, %rbx
movq 0x8(%rsp), %rdx
addq $-0x2, %rdx
xorl %esi, %esi
subq %rcx, %rdx
jne 0x16a7f
xorl %ecx, %ecx
jmp 0x16ac2
cmpq $0x1, %rdx
adcq $0x0, %rdx
leaq 0x80(%rsp), %rdi
addq %rcx, %rdi
incq %rdi
xorl %ecx, %ecx
xorl %r8d, %r8d
movzbl (%rdi,%r8), %r9d
orl %r9d, %esi
movl %esi, %r9d
negl %r9d
movzbl %r9b, %r9d
orl %esi, %r9d
shrl $0x7, %r9d
xorl $0x1, %r9d
addq %r9, %rcx
incq %r8
cmpq %r8, %rdx
jne 0x16a9a
movb (%rbx,%rcx), %dl
xorb $0x1, %dl
movl $0xffffbf00, %ebp # imm = 0xFFFFBF00
orb %al, %dl
jne 0x169ce
leaq (%rbx,%rcx), %rsi
incq %rsi
leaq 0x80(%rsp), %rdx
subq %rsi, %rdx
addq 0x8(%rsp), %rdx
movl $0xffffbc00, %ebp # imm = 0xFFFFBC00
cmpq 0x4d8(%rsp), %rdx
ja 0x169ce
movq 0x4c0(%rsp), %rax
movq %rdx, (%rax)
xorl %ebp, %ebp
testq %rdx, %rdx
je 0x169ce
movq 0x4d0(%rsp), %rdi
callq 0xc1b0
jmp 0x169ce
| /ARMmbed[P]mbed-crypto/library/rsa.c |
mbedtls_rsa_pkcs1_decrypt | int mbedtls_rsa_pkcs1_decrypt( mbedtls_rsa_context *ctx,
int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng,
int mode, size_t *olen,
const unsigned char *input,
unsigned char *output,
size_t output_max_len)
{
RSA_VALIDATE_RET( ctx != NULL );
RSA_VALIDATE_RET( mode == MBEDTLS_RSA_PRIVATE ||
mode == MBEDTLS_RSA_PUBLIC );
RSA_VALIDATE_RET( output_max_len == 0 || output != NULL );
RSA_VALIDATE_RET( input != NULL );
RSA_VALIDATE_RET( olen != NULL );
switch( ctx->padding )
{
#if defined(MBEDTLS_PKCS1_V15)
case MBEDTLS_RSA_PKCS_V15:
return mbedtls_rsa_rsaes_pkcs1_v15_decrypt( ctx, f_rng, p_rng, mode, olen,
input, output, output_max_len );
#endif
#if defined(MBEDTLS_PKCS1_V21)
case MBEDTLS_RSA_PKCS_V21:
return mbedtls_rsa_rsaes_oaep_decrypt( ctx, f_rng, p_rng, mode, NULL, 0,
olen, input, output,
output_max_len );
#endif
default:
return( MBEDTLS_ERR_RSA_INVALID_PADDING );
}
} | movq %r9, %r10
movq %r8, %rax
movl 0x148(%rdi), %r8d
cmpl $0x1, %r8d
je 0x16d88
testl %r8d, %r8d
jne 0x16da5
movq %rax, %r8
movq %r10, %r9
jmp 0x16b27
pushq %rax
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq 0x18(%rsp)
pushq 0x18(%rsp)
pushq %r10
pushq %rax
callq 0x16871
addq $0x20, %rsp
popq %rcx
retq
movl $0xffffbf00, %eax # imm = 0xFFFFBF00
retq
| /ARMmbed[P]mbed-crypto/library/rsa.c |
mbedtls_rsa_rsassa_pss_verify | int mbedtls_rsa_rsassa_pss_verify( mbedtls_rsa_context *ctx,
int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng,
int mode,
mbedtls_md_type_t md_alg,
unsigned int hashlen,
const unsigned char *hash,
const unsigned char *sig )
{
mbedtls_md_type_t mgf1_hash_id;
RSA_VALIDATE_RET( ctx != NULL );
RSA_VALIDATE_RET( mode == MBEDTLS_RSA_PRIVATE ||
mode == MBEDTLS_RSA_PUBLIC );
RSA_VALIDATE_RET( sig != NULL );
RSA_VALIDATE_RET( ( md_alg == MBEDTLS_MD_NONE &&
hashlen == 0 ) ||
hash != NULL );
mgf1_hash_id = ( ctx->hash_id != MBEDTLS_MD_NONE )
? (mbedtls_md_type_t) ctx->hash_id
: md_alg;
return( mbedtls_rsa_rsassa_pss_verify_ext( ctx, f_rng, p_rng, mode,
md_alg, hashlen, hash,
mgf1_hash_id, MBEDTLS_RSA_SALT_LEN_ANY,
sig ) );
} | pushq %rax
movl 0x14c(%rdi), %eax
testl %eax, %eax
cmovel %r8d, %eax
pushq 0x18(%rsp)
pushq $-0x1
pushq %rax
pushq 0x28(%rsp)
callq 0x1739a
addq $0x20, %rsp
popq %rcx
retq
| /ARMmbed[P]mbed-crypto/library/rsa.c |
mbedtls_rsa_pkcs1_verify | int mbedtls_rsa_pkcs1_verify( mbedtls_rsa_context *ctx,
int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng,
int mode,
mbedtls_md_type_t md_alg,
unsigned int hashlen,
const unsigned char *hash,
const unsigned char *sig )
{
RSA_VALIDATE_RET( ctx != NULL );
RSA_VALIDATE_RET( mode == MBEDTLS_RSA_PRIVATE ||
mode == MBEDTLS_RSA_PUBLIC );
RSA_VALIDATE_RET( sig != NULL );
RSA_VALIDATE_RET( ( md_alg == MBEDTLS_MD_NONE &&
hashlen == 0 ) ||
hash != NULL );
switch( ctx->padding )
{
#if defined(MBEDTLS_PKCS1_V15)
case MBEDTLS_RSA_PKCS_V15:
return mbedtls_rsa_rsassa_pkcs1_v15_verify( ctx, f_rng, p_rng, mode, md_alg,
hashlen, hash, sig );
#endif
#if defined(MBEDTLS_PKCS1_V21)
case MBEDTLS_RSA_PKCS_V21:
return mbedtls_rsa_rsassa_pss_verify( ctx, f_rng, p_rng, mode, md_alg,
hashlen, hash, sig );
#endif
default:
return( MBEDTLS_ERR_RSA_INVALID_PADDING );
}
} | movl 0x148(%rdi), %eax
cmpl $0x1, %eax
je 0x177df
testl %eax, %eax
jne 0x17802
jmp 0x1769e
pushq %rax
movl 0x14c(%rdi), %eax
testl %eax, %eax
cmovel %r8d, %eax
pushq 0x18(%rsp)
pushq $-0x1
pushq %rax
pushq 0x28(%rsp)
callq 0x1739a
addq $0x20, %rsp
popq %rcx
retq
movl $0xffffbf00, %eax # imm = 0xFFFFBF00
retq
| /ARMmbed[P]mbed-crypto/library/rsa.c |
mbedtls_mpi_gen_prime | int mbedtls_mpi_gen_prime( mbedtls_mpi *X, size_t nbits, int flags,
int (*f_rng)(void *, unsigned char *, size_t),
void *p_rng )
{
#ifdef MBEDTLS_HAVE_INT64
// ceil(2^63.5)
#define CEIL_MAXUINT_DIV_SQRT2 0xb504f333f9de6485ULL
#else
// ceil(2^31.5)
#define CEIL_MAXUINT_DIV_SQRT2 0xb504f334U
#endif
int ret = MBEDTLS_ERR_MPI_NOT_ACCEPTABLE;
size_t k, n;
int rounds;
mbedtls_mpi_uint r;
mbedtls_mpi Y;
MPI_VALIDATE_RET( X != NULL );
MPI_VALIDATE_RET( f_rng != NULL );
if( nbits < 3 || nbits > MBEDTLS_MPI_MAX_BITS )
return( MBEDTLS_ERR_MPI_BAD_INPUT_DATA );
mbedtls_mpi_init( &Y );
n = BITS_TO_LIMBS( nbits );
if( ( flags & MBEDTLS_MPI_GEN_PRIME_FLAG_LOW_ERR ) == 0 )
{
/*
* 2^-80 error probability, number of rounds chosen per HAC, table 4.4
*/
rounds = ( ( nbits >= 1300 ) ? 2 : ( nbits >= 850 ) ? 3 :
( nbits >= 650 ) ? 4 : ( nbits >= 350 ) ? 8 :
( nbits >= 250 ) ? 12 : ( nbits >= 150 ) ? 18 : 27 );
}
else
{
/*
* 2^-100 error probability, number of rounds computed based on HAC,
* fact 4.48
*/
rounds = ( ( nbits >= 1450 ) ? 4 : ( nbits >= 1150 ) ? 5 :
( nbits >= 1000 ) ? 6 : ( nbits >= 850 ) ? 7 :
( nbits >= 750 ) ? 8 : ( nbits >= 500 ) ? 13 :
( nbits >= 250 ) ? 28 : ( nbits >= 150 ) ? 40 : 51 );
}
while( 1 )
{
MBEDTLS_MPI_CHK( mbedtls_mpi_fill_random( X, n * ciL, f_rng, p_rng ) );
/* make sure generated number is at least (nbits-1)+0.5 bits (FIPS 186-4 §B.3.3 steps 4.4, 5.5) */
if( X->p[n-1] < CEIL_MAXUINT_DIV_SQRT2 ) continue;
k = n * biL;
if( k > nbits ) MBEDTLS_MPI_CHK( mbedtls_mpi_shift_r( X, k - nbits ) );
X->p[0] |= 1;
if( ( flags & MBEDTLS_MPI_GEN_PRIME_FLAG_DH ) == 0 )
{
ret = mbedtls_mpi_is_prime_ext( X, rounds, f_rng, p_rng );
if( ret != MBEDTLS_ERR_MPI_NOT_ACCEPTABLE )
goto cleanup;
}
else
{
/*
* An necessary condition for Y and X = 2Y + 1 to be prime
* is X = 2 mod 3 (which is equivalent to Y = 2 mod 3).
* Make sure it is satisfied, while keeping X = 3 mod 4
*/
X->p[0] |= 2;
MBEDTLS_MPI_CHK( mbedtls_mpi_mod_int( &r, X, 3 ) );
if( r == 0 )
MBEDTLS_MPI_CHK( mbedtls_mpi_add_int( X, X, 8 ) );
else if( r == 1 )
MBEDTLS_MPI_CHK( mbedtls_mpi_add_int( X, X, 4 ) );
/* Set Y = (X-1) / 2, which is X / 2 because X is odd */
MBEDTLS_MPI_CHK( mbedtls_mpi_copy( &Y, X ) );
MBEDTLS_MPI_CHK( mbedtls_mpi_shift_r( &Y, 1 ) );
while( 1 )
{
/*
* First, check small factors for X and Y
* before doing Miller-Rabin on any of them
*/
if( ( ret = mpi_check_small_factors( X ) ) == 0 &&
( ret = mpi_check_small_factors( &Y ) ) == 0 &&
( ret = mpi_miller_rabin( X, rounds, f_rng, p_rng ) )
== 0 &&
( ret = mpi_miller_rabin( &Y, rounds, f_rng, p_rng ) )
== 0 )
goto cleanup;
if( ret != MBEDTLS_ERR_MPI_NOT_ACCEPTABLE )
goto cleanup;
/*
* Next candidates. We want to preserve Y = (X-1) / 2 and
* Y = 1 mod 2 and Y = 2 mod 3 (eq X = 3 mod 4 and X = 2 mod 3)
* so up Y by 6 and X by 12.
*/
MBEDTLS_MPI_CHK( mbedtls_mpi_add_int( X, X, 12 ) );
MBEDTLS_MPI_CHK( mbedtls_mpi_add_int( &Y, &Y, 6 ) );
}
}
}
cleanup:
mbedtls_mpi_free( &Y );
return( ret );
} | pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
leaq -0x2001(%rsi), %rax
movl $0xfffffffc, %ebp # imm = 0xFFFFFFFC
cmpq $-0x1ffe, %rax # imm = 0xE002
jb 0x1e20c
movq %rsi, %r14
movq %rdi, %r15
movl $0x1, 0x48(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%rsp)
movq %rsi, %r13
shrq $0x6, %r13
movl %r14d, %eax
andl $0x3f, %eax
cmpq $0x1, %rax
sbbq $-0x1, %r13
testb $0x2, %dl
movl %edx, 0x24(%rsp)
jne 0x1e0a4
movl $0x2, (%rsp)
cmpq $0x513, %r14 # imm = 0x513
ja 0x1e12b
movl $0x3, (%rsp)
cmpq $0x351, %r14 # imm = 0x351
ja 0x1e12b
movl $0x4, (%rsp)
cmpq $0x289, %r14 # imm = 0x289
ja 0x1e12b
movl $0x8, (%rsp)
cmpq $0x15d, %r14 # imm = 0x15D
ja 0x1e12b
movl $0xc, (%rsp)
cmpq $0xf9, %r14
ja 0x1e12b
xorl %eax, %eax
cmpq $0x96, %r14
setb %al
leal (%rax,%rax,8), %eax
addl $0x12, %eax
movl %eax, (%rsp)
jmp 0x1e12b
movl $0x4, (%rsp)
cmpq $0x5a9, %r14 # imm = 0x5A9
ja 0x1e12b
movl $0x5, (%rsp)
cmpq $0x47d, %r14 # imm = 0x47D
ja 0x1e12b
movl $0x6, (%rsp)
cmpq $0x3e7, %r14 # imm = 0x3E7
ja 0x1e12b
movl $0x7, (%rsp)
cmpq $0x351, %r14 # imm = 0x351
ja 0x1e12b
movl $0x8, (%rsp)
cmpq $0x2ed, %r14 # imm = 0x2ED
ja 0x1e12b
movl $0xd, (%rsp)
cmpq $0x1f3, %r14 # imm = 0x1F3
ja 0x1e12b
movl $0x1c, (%rsp)
cmpq $0xf9, %r14
ja 0x1e12b
cmpq $0x96, %r14
movl $0x28, %eax
movl $0x33, %edx
cmovael %eax, %edx
movl %edx, (%rsp)
leaq (,%r13,8), %r12
movq %r15, %rdi
movq %r12, %rsi
movq %rcx, %rdx
movq %rcx, 0x18(%rsp)
movq %r8, %rcx
movq %r8, %rbx
callq 0x1d42a
testl %eax, %eax
jne 0x1e200
movq %rbx, 0x10(%rsp)
movq %r13, %rbx
shlq $0x6, %rbx
movq %rbx, %rax
subq %r14, %rax
movq %rax, 0x40(%rsp)
movq 0x10(%r15), %rax
movabsq $-0x4afb0ccc06219b7c, %rcx # imm = 0xB504F333F9DE6484
cmpq %rcx, -0x8(%rax,%r13,8)
jbe 0x1e1c8
cmpq %r14, %rbx
jbe 0x1e19a
movq %r15, %rdi
movq 0x40(%rsp), %rsi
callq 0x1b5fe
testl %eax, %eax
jne 0x1e200
movq 0x10(%r15), %rax
movq (%rax), %rcx
movq %rcx, %rdx
orq $0x1, %rdx
movq %rdx, (%rax)
testb $0x1, 0x24(%rsp)
jne 0x1e1e3
movq %r15, %rdi
movl (%rsp), %esi
movq 0x18(%rsp), %rdx
movq 0x10(%rsp), %rcx
callq 0x1da38
cmpl $-0xe, %eax
jne 0x1e200
movq %r15, %rdi
movq %r12, %rsi
movq 0x18(%rsp), %rdx
movq 0x10(%rsp), %rcx
callq 0x1d42a
testl %eax, %eax
je 0x1e16b
jmp 0x1e200
orq $0x3, %rcx
movq %rcx, (%rax)
leaq 0x60(%rsp), %rdi
movl $0x3, %edx
movq %r15, %rsi
callq 0x1c899
testl %eax, %eax
je 0x1e21d
movl %eax, %ebp
leaq 0x48(%rsp), %rdi
callq 0x1a48e
movl %ebp, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x60(%rsp), %rax
cmpq $0x1, %rax
je 0x1e23b
testq %rax, %rax
jne 0x1e26d
leaq 0x8(%rsp), %rax
movq $0x8, (%rax)
jmp 0x1e247
leaq 0x8(%rsp), %rax
movq $0x4, (%rax)
leaq 0x28(%rsp), %rdx
movl $0x1, (%rdx)
movq $0x1, 0x8(%rdx)
movq %rax, 0x10(%rdx)
movq %r15, %rdi
movq %r15, %rsi
callq 0x1bb6b
testl %eax, %eax
jne 0x1e200
leaq 0x48(%rsp), %rdi
movq %r15, %rsi
callq 0x1a61c
testl %eax, %eax
jne 0x1e200
leaq 0x48(%rsp), %rdi
movl $0x1, %esi
callq 0x1b5fe
testl %eax, %eax
jne 0x1e200
movl (%rsp), %ebx
leaq 0x48(%rsp), %r13
leaq 0x8(%rsp), %r14
leaq 0x28(%rsp), %r12
movq %rbx, (%rsp)
movq %r15, %rdi
callq 0x1db35
testl %eax, %eax
jne 0x1e2c3
movq %r13, %rdi
callq 0x1db35
testl %eax, %eax
je 0x1e33f
movl %eax, %ebp
cmpl $-0xe, %ebp
jne 0x1e202
movq $0xc, 0x8(%rsp)
movl $0x1, 0x28(%rsp)
movq $0x1, 0x30(%rsp)
movq %r14, 0x38(%rsp)
movq %r15, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x1bb6b
testl %eax, %eax
jne 0x1e200
movq $0x6, 0x8(%rsp)
movl $0x1, 0x28(%rsp)
movq $0x1, 0x30(%rsp)
movq %r14, 0x38(%rsp)
movq %r13, %rdi
movq %r13, %rsi
movq %r12, %rdx
callq 0x1bb6b
movl %eax, %ebp
testl %eax, %eax
je 0x1e2ab
jmp 0x1e202
movq %r15, %rdi
movq %rbx, %rsi
movq 0x18(%rsp), %rbx
movq %rbx, %rdx
movq 0x10(%rsp), %r14
movq %r14, %rcx
callq 0x1dbdf
testl %eax, %eax
je 0x1e36e
movl %eax, %ebp
movq (%rsp), %rbx
leaq 0x8(%rsp), %r14
jmp 0x1e2c5
movq %r13, %rdi
movq (%rsp), %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x1dbdf
cmpl $-0xe, %eax
movq (%rsp), %rbx
leaq 0x8(%rsp), %r14
je 0x1e2ce
jmp 0x1e200
| /ARMmbed[P]mbed-crypto/library/bignum.c |
mbedtls_ecdsa_genkey | int mbedtls_ecdsa_genkey( mbedtls_ecdsa_context *ctx, mbedtls_ecp_group_id gid,
int (*f_rng)(void *, unsigned char *, size_t), void *p_rng )
{
int ret = 0;
ECDSA_VALIDATE_RET( ctx != NULL );
ECDSA_VALIDATE_RET( f_rng != NULL );
ret = mbedtls_ecp_group_load( &ctx->grp, gid );
if( ret != 0 )
return( ret );
return( mbedtls_ecp_gen_keypair( &ctx->grp, &ctx->d,
&ctx->Q, f_rng, p_rng ) );
} | pushq %r15
pushq %r14
pushq %rbx
movq %rcx, %rbx
movq %rdx, %r14
movq %rdi, %r15
callq 0x11498
testl %eax, %eax
je 0x1f1c9
popq %rbx
popq %r14
popq %r15
retq
leaq 0xf8(%r15), %rsi
leaq 0x110(%r15), %rdx
movq %r15, %rdi
movq %r14, %rcx
movq %rbx, %r8
popq %rbx
popq %r14
popq %r15
jmp 0xff03
| /ARMmbed[P]mbed-crypto/library/ecdsa.c |
mbedtls_md_info_from_type | const mbedtls_md_info_t *mbedtls_md_info_from_type( mbedtls_md_type_t md_type )
{
switch( md_type )
{
#if defined(MBEDTLS_MD2_C)
case MBEDTLS_MD_MD2:
return( &mbedtls_md2_info );
#endif
#if defined(MBEDTLS_MD4_C)
case MBEDTLS_MD_MD4:
return( &mbedtls_md4_info );
#endif
#if defined(MBEDTLS_MD5_C)
case MBEDTLS_MD_MD5:
return( &mbedtls_md5_info );
#endif
#if defined(MBEDTLS_RIPEMD160_C)
case MBEDTLS_MD_RIPEMD160:
return( &mbedtls_ripemd160_info );
#endif
#if defined(MBEDTLS_SHA1_C)
case MBEDTLS_MD_SHA1:
return( &mbedtls_sha1_info );
#endif
#if defined(MBEDTLS_SHA256_C)
case MBEDTLS_MD_SHA224:
return( &mbedtls_sha224_info );
case MBEDTLS_MD_SHA256:
return( &mbedtls_sha256_info );
#endif
#if defined(MBEDTLS_SHA512_C)
#if !defined(MBEDTLS_SHA512_NO_SHA384)
case MBEDTLS_MD_SHA384:
return( &mbedtls_sha384_info );
#endif
case MBEDTLS_MD_SHA512:
return( &mbedtls_sha512_info );
#endif
default:
return( NULL );
}
} | addl $-0x3, %edi
cmpl $0x6, %edi
ja 0x1fdc2
movl %edi, %eax
leaq 0x23fab(%rip), %rcx # 0x43d68
movq (%rcx,%rax,8), %rax
retq
xorl %eax, %eax
retq
| /ARMmbed[P]mbed-crypto/library/md.c |
mbedtls_md_finish | int mbedtls_md_finish( mbedtls_md_context_t *ctx, unsigned char *output )
{
if( ctx == NULL || ctx->md_info == NULL )
return( MBEDTLS_ERR_MD_BAD_INPUT_DATA );
switch( ctx->md_info->type )
{
#if defined(MBEDTLS_MD2_C)
case MBEDTLS_MD_MD2:
return( mbedtls_md2_finish_ret( ctx->md_ctx, output ) );
#endif
#if defined(MBEDTLS_MD4_C)
case MBEDTLS_MD_MD4:
return( mbedtls_md4_finish_ret( ctx->md_ctx, output ) );
#endif
#if defined(MBEDTLS_MD5_C)
case MBEDTLS_MD_MD5:
return( mbedtls_md5_finish_ret( ctx->md_ctx, output ) );
#endif
#if defined(MBEDTLS_RIPEMD160_C)
case MBEDTLS_MD_RIPEMD160:
return( mbedtls_ripemd160_finish_ret( ctx->md_ctx, output ) );
#endif
#if defined(MBEDTLS_SHA1_C)
case MBEDTLS_MD_SHA1:
return( mbedtls_sha1_finish_ret( ctx->md_ctx, output ) );
#endif
#if defined(MBEDTLS_SHA256_C)
case MBEDTLS_MD_SHA224:
return( mbedtls_sha256_finish_ret( ctx->md_ctx, output ) );
case MBEDTLS_MD_SHA256:
return( mbedtls_sha256_finish_ret( ctx->md_ctx, output ) );
#endif
#if defined(MBEDTLS_SHA512_C)
#if !defined(MBEDTLS_SHA512_NO_SHA384)
case MBEDTLS_MD_SHA384:
return( mbedtls_sha512_finish_ret( ctx->md_ctx, output ) );
#endif
case MBEDTLS_MD_SHA512:
return( mbedtls_sha512_finish_ret( ctx->md_ctx, output ) );
#endif
default:
return( MBEDTLS_ERR_MD_BAD_INPUT_DATA );
}
} | testq %rdi, %rdi
je 0x20134
movq (%rdi), %rax
testq %rax, %rax
je 0x20134
movl 0x8(%rax), %eax
addl $-0x3, %eax
cmpl $0x6, %eax
ja 0x20134
leaq 0x1332a(%rip), %rcx # 0x3344c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x8(%rdi), %rdi
jmp 0x2555c
movl $0xffffaf00, %eax # imm = 0xFFFFAF00
retq
movq 0x8(%rdi), %rdi
jmp 0x26013
movq 0x8(%rdi), %rdi
jmp 0x20f08
movq 0x8(%rdi), %rdi
jmp 0x199ea
movq 0x8(%rdi), %rdi
jmp 0x2473c
| /ARMmbed[P]mbed-crypto/library/md.c |
pem_get_iv | static int pem_get_iv( const unsigned char *s, unsigned char *iv,
size_t iv_len )
{
size_t i, j, k;
memset( iv, 0, iv_len );
for( i = 0; i < iv_len * 2; i++, s++ )
{
if( *s >= '0' && *s <= '9' ) j = *s - '0'; else
if( *s >= 'A' && *s <= 'F' ) j = *s - '7'; else
if( *s >= 'a' && *s <= 'f' ) j = *s - 'W'; else
return( MBEDTLS_ERR_PEM_INVALID_ENC_IV );
k = ( ( i & 1 ) != 0 ) ? j : j << 4;
iv[i >> 1] = (unsigned char)( iv[i >> 1] | k );
}
return( 0 );
} | pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
xorl %ebp, %ebp
movq %rsi, %rdi
xorl %esi, %esi
callq 0xc110
testq %rbx, %rbx
je 0x21dde
movl $0xffffffa9, %ecx # imm = 0xFFFFFFA9
addq %rbx, %rbx
cmpq $0x1, %rbx
adcq $0x0, %rbx
xorl %eax, %eax
leaq 0x27(%rcx), %rdx
leaq 0x20(%rcx), %rsi
xorl %edi, %edi
movzbl (%r15,%rdi), %ecx
leal -0x30(%rcx), %r9d
movq %rdx, %r8
cmpb $0xa, %r9b
jb 0x21db2
leal -0x41(%rcx), %r9d
movq %rsi, %r8
cmpb $0x6, %r9b
jb 0x21db2
leal -0x61(%rcx), %r9d
movl $0xffffffa9, %r8d # imm = 0xFFFFFFA9
cmpb $0x5, %r9b
ja 0x21dd9
addl %ecx, %r8d
movl %eax, %ecx
notb %cl
andb $0x4, %cl
shlq %cl, %r8
movq %rdi, %rcx
shrq %rcx
orb %r8b, (%r14,%rcx)
incq %rdi
addq $0x4, %rax
cmpq %rdi, %rbx
jne 0x21d83
xorl %ebp, %ebp
jmp 0x21dde
movl $0xffffee00, %ebp # imm = 0xFFFFEE00
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
| /ARMmbed[P]mbed-crypto/library/pem.c |
mbedtls_pkcs5_self_test | int mbedtls_pkcs5_self_test( int verbose )
{
mbedtls_md_context_t sha1_ctx;
const mbedtls_md_info_t *info_sha1;
int ret, i;
unsigned char key[64];
mbedtls_md_init( &sha1_ctx );
info_sha1 = mbedtls_md_info_from_type( MBEDTLS_MD_SHA1 );
if( info_sha1 == NULL )
{
ret = 1;
goto exit;
}
if( ( ret = mbedtls_md_setup( &sha1_ctx, info_sha1, 1 ) ) != 0 )
{
ret = 1;
goto exit;
}
for( i = 0; i < MAX_TESTS; i++ )
{
if( verbose != 0 )
mbedtls_printf( " PBKDF2 (SHA1) #%d: ", i );
ret = mbedtls_pkcs5_pbkdf2_hmac( &sha1_ctx, password_test_data[i],
plen_test_data[i], salt_test_data[i],
slen_test_data[i], it_cnt_test_data[i],
key_len_test_data[i], key );
if( ret != 0 ||
memcmp( result_key_test_data[i], key, key_len_test_data[i] ) != 0 )
{
if( verbose != 0 )
mbedtls_printf( "failed\n" );
ret = 1;
goto exit;
}
if( verbose != 0 )
mbedtls_printf( "passed\n" );
}
if( verbose != 0 )
mbedtls_printf( "\n" );
exit:
mbedtls_md_free( &sha1_ctx );
return( ret );
} | pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %edi, %ebp
leaq 0x8(%rsp), %rdi
callq 0x1fdc5
movl $0x4, %edi
callq 0x1fdac
testq %rax, %rax
je 0x2308f
leaq 0x8(%rsp), %rdi
movl $0x1, %ebx
movq %rax, %rsi
movl $0x1, %edx
callq 0x1ff01
testl %eax, %eax
jne 0x230b4
leaq 0x20(%rsp), %r14
xorl %r13d, %r13d
testl %ebp, %ebp
je 0x22fe1
leaq 0x11379(%rip), %rdi # 0x34350
movl %r13d, %esi
xorl %eax, %eax
callq 0xc0c0
movq %r13, %r12
shlq $0x5, %r12
leaq 0x11381(%rip), %rax # 0x34370
leaq (%rax,%r12), %rsi
leaq 0x11436(%rip), %rax # 0x34430
movq (%rax,%r13,8), %rdx
leaq (%r13,%r13,4), %rax
leaq 0x11456(%rip), %rcx # 0x34460
leaq (%rcx,%rax,8), %rcx
leaq 0x1153b(%rip), %rax # 0x34550
movq (%rax,%r13,8), %r8
leaq 0x11620(%rip), %rax # 0x34640
movl (%rax,%r13,4), %r9d
leaq 0x11635(%rip), %rax # 0x34660
movl (%rax,%r13,4), %r15d
leaq 0x8(%rsp), %rdi
pushq %r14
pushq %r15
callq 0x22dac
addq $0x10, %rsp
testl %eax, %eax
jne 0x23096
leaq 0x11534(%rip), %rax # 0x34580
addq %rax, %r12
movq %r12, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xc1e0
testl %eax, %eax
jne 0x23096
testl %ebp, %ebp
je 0x23080
leaq 0xe991(%rip), %rdi # 0x319fd
callq 0xc070
incq %r13
cmpq $0x6, %r13
jne 0x22fcc
jmp 0x230a8
incq %r13
cmpq $0x6, %r13
jne 0x22fcc
jmp 0x230b2
movl $0x1, %ebx
jmp 0x230b4
testl %ebp, %ebp
je 0x230b4
leaq 0x11c95(%rip), %rdi # 0x34d36
callq 0xc070
jmp 0x230b4
movl $0xa, %edi
callq 0xc050
xorl %ebx, %ebx
leaq 0x8(%rsp), %rdi
callq 0x1fdd4
movl %ebx, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
| /ARMmbed[P]mbed-crypto/library/pkcs5.c |
arc4_ctx_alloc | static void * arc4_ctx_alloc( void )
{
mbedtls_arc4_context *ctx;
ctx = mbedtls_calloc( 1, sizeof( mbedtls_arc4_context ) );
if( ctx == NULL )
return( NULL );
mbedtls_arc4_init( ctx );
return( ctx );
} | pushq %rbx
movl $0x1, %edi
movl $0x108, %esi # imm = 0x108
callq 0xc150
movq %rax, %rbx
testq %rax, %rax
je 0x2ad84
movq %rbx, %rdi
callq 0x28f94
movq %rbx, %rax
popq %rbx
retq
| /ARMmbed[P]mbed-crypto/library/cipher_wrap.c |
mbedtls_des3_crypt_ecb | int mbedtls_des3_crypt_ecb( mbedtls_des3_context *ctx,
const unsigned char input[8],
unsigned char output[8] )
{
int i;
uint32_t X, Y, T, *SK;
SK = ctx->sk;
GET_UINT32_BE( X, input, 0 );
GET_UINT32_BE( Y, input, 4 );
DES_IP( X, Y );
for( i = 0; i < 8; i++ )
{
DES_ROUND( Y, X );
DES_ROUND( X, Y );
}
for( i = 0; i < 8; i++ )
{
DES_ROUND( X, Y );
DES_ROUND( Y, X );
}
for( i = 0; i < 8; i++ )
{
DES_ROUND( Y, X );
DES_ROUND( X, Y );
}
DES_FP( Y, X );
PUT_UINT32_BE( Y, output, 0 );
PUT_UINT32_BE( X, output, 4 );
return( 0 );
} | pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, -0x8(%rsp)
movl (%rsi), %eax
movl 0x4(%rsi), %ecx
bswapl %eax
bswapl %ecx
movl %eax, %edx
shrl $0x4, %edx
xorl %ecx, %edx
andl $0xf0f0f0f, %edx # imm = 0xF0F0F0F
xorl %edx, %ecx
shll $0x4, %edx
xorl %eax, %edx
movl %edx, %esi
shrl $0x10, %esi
movzwl %cx, %eax
xorl %esi, %eax
xorl %eax, %ecx
shll $0x10, %eax
xorl %edx, %eax
movl %ecx, %edx
shrl $0x2, %edx
xorl %eax, %edx
andl $0x33333333, %edx # imm = 0x33333333
xorl %edx, %eax
shll $0x2, %edx
xorl %ecx, %edx
movl %edx, %r14d
shrl $0x8, %r14d
xorl %eax, %r14d
andl $0xff00ff, %r14d # imm = 0xFF00FF
xorl %r14d, %eax
shll $0x8, %r14d
xorl %edx, %r14d
roll %r14d
movl %r14d, %ebp
xorl %eax, %ebp
andl $0xaaaaaaaa, %ebp # imm = 0xAAAAAAAA
xorl %ebp, %r14d
xorl %eax, %ebp
roll %ebp
xorl %r15d, %r15d
movl $0xfc, %r12d
leaq 0xa91d(%rip), %r8 # 0x363f0
leaq 0xab16(%rip), %r10 # 0x365f0
leaq 0xac0f(%rip), %rax # 0x366f0
leaq 0xad08(%rip), %rcx # 0x367f0
movl %r14d, %r13d
movl (%rdi,%r15), %r14d
xorl %r13d, %r14d
movq %rcx, %rsi
movl %r14d, %edx
andl $0x3f, %edx
movq %rax, %rbx
movl %r14d, %eax
shrl $0x6, %eax
andl %r12d, %eax
leaq 0xa5e2(%rip), %rcx # 0x360f0
xorl (%rcx,%rdx,4), %ebp
movl %r14d, %edx
shrl $0xe, %edx
andl %r12d, %edx
shrl $0x16, %r14d
andl %r12d, %r14d
leaq 0xa6c8(%rip), %r9 # 0x361f0
xorl (%rax,%r9), %ebp
movl %r13d, %eax
roll $0x1c, %eax
xorl 0x4(%rdi,%r15), %eax
movq %r8, %r9
leaq 0xa7af(%rip), %r8 # 0x362f0
xorl (%rdx,%r8), %ebp
movl %eax, %edx
andl $0x3f, %edx
xorl (%r14,%r9), %ebp
movl %eax, %r14d
shrl $0x6, %r14d
andl %r12d, %r14d
movq %r10, %r11
leaq 0xa98e(%rip), %r10 # 0x364f0
xorl (%r10,%rdx,4), %ebp
movl %eax, %edx
shrl $0xe, %edx
andl %r12d, %edx
shrl $0x16, %eax
andl %r12d, %eax
xorl (%r14,%r11), %ebp
xorl (%rdx,%rbx), %ebp
xorl (%rax,%rsi), %ebp
movl 0x8(%rdi,%r15), %eax
xorl %ebp, %eax
movl %eax, %edx
andl $0x3f, %edx
movl (%rcx,%rdx,4), %r14d
leaq 0xa65b(%rip), %rcx # 0x361f0
movl %eax, %edx
shrl $0x6, %edx
andl %r12d, %edx
xorl (%rdx,%rcx), %r14d
movl %eax, %edx
shrl $0xe, %edx
andl %r12d, %edx
shrl $0x16, %eax
andl %r12d, %eax
xorl (%rdx,%r8), %r14d
movq %r9, %r8
movl %ebp, %edx
roll $0x1c, %edx
xorl 0xc(%rdi,%r15), %edx
xorl (%rax,%r9), %r14d
movl %edx, %eax
andl $0x3f, %eax
xorl (%r10,%rax,4), %r14d
movq %r11, %r10
movl %edx, %eax
shrl $0x6, %eax
andl %r12d, %eax
xorl (%rax,%r11), %r14d
movl %edx, %eax
shrl $0xe, %eax
andl %r12d, %eax
xorl (%rax,%rbx), %r14d
movq %rbx, %rax
shrl $0x16, %edx
andl %r12d, %edx
xorl (%rdx,%rsi), %r14d
movq %rsi, %rcx
xorl %r13d, %r14d
addq $0x10, %r15
cmpl $0x80, %r15d
jne 0x2bae8
xorl %r15d, %r15d
movl $0xfc, %r12d
leaq 0xa8d4(%rip), %r10 # 0x364f0
movl %ebp, %r13d
movl 0x80(%rdi,%r15), %ebp
xorl %r13d, %ebp
movl %ebp, %edx
andl $0x3f, %edx
movl %ebp, %eax
shrl $0x6, %eax
andl %r12d, %eax
leaq 0xa4b2(%rip), %rcx # 0x360f0
xorl (%rcx,%rdx,4), %r14d
movl %ebp, %edx
shrl $0xe, %edx
andl %r12d, %edx
shrl $0x16, %ebp
andl %r12d, %ebp
leaq 0xa599(%rip), %r8 # 0x361f0
xorl (%rax,%r8), %r14d
movl %r13d, %eax
roll $0x1c, %eax
xorl 0x84(%rdi,%r15), %eax
leaq 0xa680(%rip), %r8 # 0x362f0
xorl (%rdx,%r8), %r14d
movl %eax, %edx
andl $0x3f, %edx
xorl (%rbp,%r9), %r14d
movl %eax, %ebp
shrl $0x6, %ebp
andl %r12d, %ebp
xorl (%r10,%rdx,4), %r14d
movl %eax, %edx
shrl $0xe, %edx
andl %r12d, %edx
shrl $0x16, %eax
andl %r12d, %eax
xorl (%rbp,%r11), %r14d
xorl (%rdx,%rbx), %r14d
xorl (%rax,%rsi), %r14d
movl 0x88(%rdi,%r15), %eax
xorl %r14d, %eax
movl %eax, %edx
andl $0x3f, %edx
movl (%rcx,%rdx,4), %ebp
movl %eax, %edx
shrl $0x6, %edx
andl %r12d, %edx
leaq 0xa529(%rip), %rcx # 0x361f0
xorl (%rdx,%rcx), %ebp
movl %eax, %edx
shrl $0xe, %edx
andl %r12d, %edx
shrl $0x16, %eax
andl %r12d, %eax
xorl (%rdx,%r8), %ebp
movl %r14d, %edx
roll $0x1c, %edx
xorl 0x8c(%rdi,%r15), %edx
xorl (%rax,%r9), %ebp
movl %edx, %eax
andl $0x3f, %eax
xorl (%r10,%rax,4), %ebp
movl %edx, %eax
shrl $0x6, %eax
andl %r12d, %eax
xorl (%rax,%r11), %ebp
movl %edx, %eax
shrl $0xe, %eax
andl %r12d, %eax
xorl (%rax,%rbx), %ebp
shrl $0x16, %edx
andl %r12d, %edx
xorl (%rdx,%rsi), %ebp
xorl %r13d, %ebp
addq $0x10, %r15
cmpl $0x80, %r15d
jne 0x2bc1c
xorl %r15d, %r15d
movl $0xfc, %r12d
leaq 0xa7b5(%rip), %r10 # 0x364f0
movl %r14d, %r13d
movl 0x100(%rdi,%r15), %r14d
xorl %r13d, %r14d
movl %r14d, %edx
andl $0x3f, %edx
movl %r14d, %eax
shrl $0x6, %eax
andl %r12d, %eax
leaq 0xa391(%rip), %rcx # 0x360f0
xorl (%rcx,%rdx,4), %ebp
movl %r14d, %edx
shrl $0xe, %edx
andl %r12d, %edx
shrl $0x16, %r14d
andl %r12d, %r14d
leaq 0xa477(%rip), %r8 # 0x361f0
xorl (%rax,%r8), %ebp
movl %r13d, %eax
roll $0x1c, %eax
xorl 0x104(%rdi,%r15), %eax
leaq 0xa55e(%rip), %r8 # 0x362f0
xorl (%rdx,%r8), %ebp
movl %eax, %edx
andl $0x3f, %edx
xorl (%r14,%r9), %ebp
movl %eax, %r14d
shrl $0x6, %r14d
andl %r12d, %r14d
xorl (%r10,%rdx,4), %ebp
movl %eax, %edx
shrl $0xe, %edx
andl %r12d, %edx
shrl $0x16, %eax
andl %r12d, %eax
xorl (%r14,%r11), %ebp
xorl (%rdx,%rbx), %ebp
xorl (%rax,%rsi), %ebp
movl 0x108(%rdi,%r15), %eax
xorl %ebp, %eax
movl %eax, %edx
andl $0x3f, %edx
movl (%rcx,%rdx,4), %r14d
movl %eax, %edx
shrl $0x6, %edx
andl %r12d, %edx
leaq 0xa409(%rip), %rcx # 0x361f0
xorl (%rdx,%rcx), %r14d
movl %eax, %edx
shrl $0xe, %edx
andl %r12d, %edx
shrl $0x16, %eax
andl %r12d, %eax
xorl (%rdx,%r8), %r14d
movl %ebp, %edx
roll $0x1c, %edx
xorl 0x10c(%rdi,%r15), %edx
xorl (%rax,%r9), %r14d
movl %edx, %eax
andl $0x3f, %eax
xorl (%r10,%rax,4), %r14d
movl %edx, %eax
shrl $0x6, %eax
andl %r12d, %eax
xorl (%rax,%r11), %r14d
movl %edx, %eax
shrl $0xe, %eax
andl %r12d, %eax
xorl (%rax,%rbx), %r14d
shrl $0x16, %edx
andl %r12d, %edx
xorl (%rdx,%rsi), %r14d
xorl %r13d, %r14d
addq $0x10, %r15
cmpl $0x80, %r15d
jne 0x2bd3b
rorl %r14d
movl %r14d, %eax
xorl %ebp, %eax
andl $0xaaaaaaaa, %eax # imm = 0xAAAAAAAA
xorl %eax, %r14d
xorl %ebp, %eax
rorl %eax
movl %eax, %ecx
shrl $0x8, %ecx
xorl %r14d, %ecx
andl $0xff00ff, %ecx # imm = 0xFF00FF
xorl %ecx, %r14d
shll $0x8, %ecx
xorl %eax, %ecx
movl %ecx, %eax
shrl $0x2, %eax
xorl %r14d, %eax
andl $0x33333333, %eax # imm = 0x33333333
xorl %eax, %r14d
shll $0x2, %eax
xorl %ecx, %eax
movl %r14d, %ecx
shrl $0x10, %ecx
movzwl %ax, %edx
xorl %ecx, %edx
xorl %edx, %eax
shll $0x10, %edx
xorl %r14d, %edx
movl %edx, %ecx
shrl $0x4, %ecx
xorl %eax, %ecx
andl $0xf0f0f0f, %ecx # imm = 0xF0F0F0F
xorl %ecx, %eax
shll $0x4, %ecx
xorl %edx, %ecx
movl %ecx, %edx
shrl $0x18, %edx
movq -0x8(%rsp), %rsi
movb %dl, (%rsi)
movl %ecx, %edx
shrl $0x10, %edx
movb %dl, 0x1(%rsi)
movb %ch, 0x2(%rsi)
movb %cl, 0x3(%rsi)
movl %eax, %ecx
shrl $0x18, %ecx
movb %cl, 0x4(%rsi)
movl %eax, %ecx
shrl $0x10, %ecx
movb %cl, 0x5(%rsi)
movb %ah, 0x6(%rsi)
movb %al, 0x7(%rsi)
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
| /ARMmbed[P]mbed-crypto/library/des.c |
mbedtls_blowfish_crypt_ctr | int mbedtls_blowfish_crypt_ctr( mbedtls_blowfish_context *ctx,
size_t length,
size_t *nc_off,
unsigned char nonce_counter[MBEDTLS_BLOWFISH_BLOCKSIZE],
unsigned char stream_block[MBEDTLS_BLOWFISH_BLOCKSIZE],
const unsigned char *input,
unsigned char *output )
{
int c, i;
size_t n;
BLOWFISH_VALIDATE_RET( ctx != NULL );
BLOWFISH_VALIDATE_RET( nonce_counter != NULL );
BLOWFISH_VALIDATE_RET( stream_block != NULL );
BLOWFISH_VALIDATE_RET( nc_off != NULL );
BLOWFISH_VALIDATE_RET( length == 0 || input != NULL );
BLOWFISH_VALIDATE_RET( length == 0 || output != NULL );
n = *nc_off;
if( n >= 8 )
return( MBEDTLS_ERR_BLOWFISH_BAD_INPUT_DATA );
while( length-- )
{
if( n == 0 ) {
mbedtls_blowfish_crypt_ecb( ctx, MBEDTLS_BLOWFISH_ENCRYPT, nonce_counter,
stream_block );
for( i = MBEDTLS_BLOWFISH_BLOCKSIZE; i > 0; i-- )
if( ++nonce_counter[i - 1] != 0 )
break;
}
c = *input++;
*output++ = (unsigned char)( c ^ stream_block[n] );
n = ( n + 1 ) % MBEDTLS_BLOWFISH_BLOCKSIZE;
}
*nc_off = n;
return( 0 );
} | pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq (%rdx), %rbx
movl $0xffffffea, %eax # imm = 0xFFFFFFEA
cmpq $0x7, %rbx
ja 0x2d8d0
movq %rsi, %r13
movq %rdx, 0x8(%rsp)
testq %rsi, %rsi
je 0x2d8c6
movq %r9, %r14
movq %r8, %r15
movq %rcx, %r12
movq 0x50(%rsp), %rbp
testq %rbx, %rbx
jne 0x2d8a9
movq 0x10(%rsp), %rdi
movl $0x1, %esi
movq %r12, %rdx
movq %r15, %rcx
callq 0x2d5d2
movl $0x8, %eax
movl %eax, %ecx
incb -0x1(%r12,%rcx)
jne 0x2d8a9
leal -0x1(%rax), %ecx
cmpl $0x1, %eax
movl %ecx, %eax
ja 0x2d896
decq %r13
movb (%r15,%rbx), %al
xorb (%r14), %al
incq %r14
movb %al, (%rbp)
incq %rbp
incl %ebx
andl $0x7, %ebx
testq %r13, %r13
jne 0x2d877
movq 0x8(%rsp), %rax
movq %rbx, (%rax)
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
| /ARMmbed[P]mbed-crypto/library/blowfish.c |
mbedtls_camellia_self_test | int mbedtls_camellia_self_test( int verbose )
{
int i, j, u, v;
unsigned char key[32];
unsigned char buf[64];
unsigned char src[16];
unsigned char dst[16];
#if defined(MBEDTLS_CIPHER_MODE_CBC)
unsigned char iv[16];
#endif
#if defined(MBEDTLS_CIPHER_MODE_CTR)
size_t offset, len;
unsigned char nonce_counter[16];
unsigned char stream_block[16];
#endif
mbedtls_camellia_context ctx;
memset( key, 0, 32 );
for( j = 0; j < 6; j++ ) {
u = j >> 1;
v = j & 1;
if( verbose != 0 )
mbedtls_printf( " CAMELLIA-ECB-%3d (%s): ", 128 + u * 64,
(v == MBEDTLS_CAMELLIA_DECRYPT) ? "dec" : "enc");
for( i = 0; i < CAMELLIA_TESTS_ECB; i++ ) {
memcpy( key, camellia_test_ecb_key[u][i], 16 + 8 * u );
if( v == MBEDTLS_CAMELLIA_DECRYPT ) {
mbedtls_camellia_setkey_dec( &ctx, key, 128 + u * 64 );
memcpy( src, camellia_test_ecb_cipher[u][i], 16 );
memcpy( dst, camellia_test_ecb_plain[i], 16 );
} else { /* MBEDTLS_CAMELLIA_ENCRYPT */
mbedtls_camellia_setkey_enc( &ctx, key, 128 + u * 64 );
memcpy( src, camellia_test_ecb_plain[i], 16 );
memcpy( dst, camellia_test_ecb_cipher[u][i], 16 );
}
mbedtls_camellia_crypt_ecb( &ctx, v, src, buf );
if( memcmp( buf, dst, 16 ) != 0 )
{
if( verbose != 0 )
mbedtls_printf( "failed\n" );
return( 1 );
}
}
if( verbose != 0 )
mbedtls_printf( "passed\n" );
}
if( verbose != 0 )
mbedtls_printf( "\n" );
#if defined(MBEDTLS_CIPHER_MODE_CBC)
/*
* CBC mode
*/
for( j = 0; j < 6; j++ )
{
u = j >> 1;
v = j & 1;
if( verbose != 0 )
mbedtls_printf( " CAMELLIA-CBC-%3d (%s): ", 128 + u * 64,
( v == MBEDTLS_CAMELLIA_DECRYPT ) ? "dec" : "enc" );
memcpy( src, camellia_test_cbc_iv, 16 );
memcpy( dst, camellia_test_cbc_iv, 16 );
memcpy( key, camellia_test_cbc_key[u], 16 + 8 * u );
if( v == MBEDTLS_CAMELLIA_DECRYPT ) {
mbedtls_camellia_setkey_dec( &ctx, key, 128 + u * 64 );
} else {
mbedtls_camellia_setkey_enc( &ctx, key, 128 + u * 64 );
}
for( i = 0; i < CAMELLIA_TESTS_CBC; i++ ) {
if( v == MBEDTLS_CAMELLIA_DECRYPT ) {
memcpy( iv , src, 16 );
memcpy( src, camellia_test_cbc_cipher[u][i], 16 );
memcpy( dst, camellia_test_cbc_plain[i], 16 );
} else { /* MBEDTLS_CAMELLIA_ENCRYPT */
memcpy( iv , dst, 16 );
memcpy( src, camellia_test_cbc_plain[i], 16 );
memcpy( dst, camellia_test_cbc_cipher[u][i], 16 );
}
mbedtls_camellia_crypt_cbc( &ctx, v, 16, iv, src, buf );
if( memcmp( buf, dst, 16 ) != 0 )
{
if( verbose != 0 )
mbedtls_printf( "failed\n" );
return( 1 );
}
}
if( verbose != 0 )
mbedtls_printf( "passed\n" );
}
#endif /* MBEDTLS_CIPHER_MODE_CBC */
if( verbose != 0 )
mbedtls_printf( "\n" );
#if defined(MBEDTLS_CIPHER_MODE_CTR)
/*
* CTR mode
*/
for( i = 0; i < 6; i++ )
{
u = i >> 1;
v = i & 1;
if( verbose != 0 )
mbedtls_printf( " CAMELLIA-CTR-128 (%s): ",
( v == MBEDTLS_CAMELLIA_DECRYPT ) ? "dec" : "enc" );
memcpy( nonce_counter, camellia_test_ctr_nonce_counter[u], 16 );
memcpy( key, camellia_test_ctr_key[u], 16 );
offset = 0;
mbedtls_camellia_setkey_enc( &ctx, key, 128 );
if( v == MBEDTLS_CAMELLIA_DECRYPT )
{
len = camellia_test_ctr_len[u];
memcpy( buf, camellia_test_ctr_ct[u], len );
mbedtls_camellia_crypt_ctr( &ctx, len, &offset, nonce_counter, stream_block,
buf, buf );
if( memcmp( buf, camellia_test_ctr_pt[u], len ) != 0 )
{
if( verbose != 0 )
mbedtls_printf( "failed\n" );
return( 1 );
}
}
else
{
len = camellia_test_ctr_len[u];
memcpy( buf, camellia_test_ctr_pt[u], len );
mbedtls_camellia_crypt_ctr( &ctx, len, &offset, nonce_counter, stream_block,
buf, buf );
if( memcmp( buf, camellia_test_ctr_ct[u], len ) != 0 )
{
if( verbose != 0 )
mbedtls_printf( "failed\n" );
return( 1 );
}
}
if( verbose != 0 )
mbedtls_printf( "passed\n" );
}
if( verbose != 0 )
mbedtls_printf( "\n" );
#endif /* MBEDTLS_CIPHER_MODE_CTR */
return( 0 );
} | pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f8, %rsp # imm = 0x1F8
movl %edi, %r13d
pxor %xmm0, %xmm0
leaq 0x50(%rsp), %rax
movdqa %xmm0, (%rax)
movdqa %xmm0, 0x10(%rax)
leaq 0xa513(%rip), %r12 # 0x38d20
leaq 0x9f7c(%rip), %rbp # 0x38790
xorl %r14d, %r14d
movl %edi, 0x14(%rsp)
movl %r14d, %ebx
shrl %ebx
movl %ebx, %r15d
shll $0x6, %r15d
subl $-0x80, %r15d
testl %r13d, %r13d
je 0x2e85c
testb $0x1, %r14b
leaq 0x6b3e(%rip), %rdx # 0x35379
leaq 0x6b33(%rip), %rax # 0x35375
cmoveq %rax, %rdx
leaq 0xa753(%rip), %rdi # 0x38fa0
movl %r15d, %esi
xorl %eax, %eax
callq 0xc0c0
leaq 0x50(%rsp), %rax
movl %r15d, 0x1c(%rsp)
movl %r14d, 0x18(%rsp)
movl %ebx, %r14d
leal 0x10(,%rbx,8), %ecx
movq %rcx, 0x48(%rsp)
movb $0x1, %r15b
movq %r14, %r13
shlq $0x6, %r13
addq %r12, %r13
shlq $0x5, %r14
addq %rbp, %r14
xorl %r12d, %r12d
movq %r12, %rsi
shlq $0x5, %rsi
addq %r13, %rsi
movq %rax, %rbx
movq %rax, %rdi
movq 0x48(%rsp), %rdx
callq 0xc1b0
testb $0x1, 0x18(%rsp)
jne 0x2e8de
leaq 0xe4(%rsp), %rbp
movq %rbp, %rdi
movq %rbx, %rsi
movl 0x1c(%rsp), %edx
callq 0x2e33a
shlq $0x4, %r12
movaps (%r12,%r14), %xmm0
movaps %xmm0, 0x20(%rsp)
leaq 0xa6a7(%rip), %rax # 0x38f80
addq %rax, %r12
jmp 0x2e90d
leaq 0xe4(%rsp), %rbp
movq %rbp, %rdi
movq %rbx, %rsi
movl 0x1c(%rsp), %edx
callq 0x2d8fc
shlq $0x4, %r12
leaq 0xa680(%rip), %rax # 0x38f80
movaps (%r12,%rax), %xmm0
movaps %xmm0, 0x20(%rsp)
addq %r14, %r12
movaps (%r12), %xmm0
movaps %xmm0, 0x30(%rsp)
movq %rbp, %rdi
leaq 0x20(%rsp), %rdx
leaq 0x90(%rsp), %rcx
callq 0x2e3e0
movdqa 0x90(%rsp), %xmm0
pcmpeqb 0x30(%rsp), %xmm0
pmovmskb %xmm0, %eax
cmpl $0xffff, %eax # imm = 0xFFFF
jne 0x2ece3
movl $0x1, %r12d
testb $0x1, %r15b
movl $0x0, %r15d
leaq 0x50(%rsp), %rax
jne 0x2e88c
movl 0x14(%rsp), %r13d
testl %r13d, %r13d
je 0x2e9a2
leaq 0x3087(%rip), %rdi # 0x319fd
callq 0xc070
leaq 0x50(%rsp), %rax
movl 0x18(%rsp), %r14d
incl %r14d
cmpl $0x6, %r14d
leaq 0xa38d(%rip), %r12 # 0x38d20
leaq 0x9df6(%rip), %rbp # 0x38790
jne 0x2e81b
jmp 0x2e9c4
movl 0x18(%rsp), %r14d
incl %r14d
cmpl $0x6, %r14d
leaq 0xa36b(%rip), %r12 # 0x38d20
leaq 0x9dd4(%rip), %rbp # 0x38790
jne 0x2e81b
jmp 0x2e9ce
movl $0xa, %edi
callq 0xc050
leaq 0xe4(%rsp), %r12
leaq 0x20(%rsp), %rbp
xorl %r14d, %r14d
movl %r14d, %ebx
shrl %ebx
testl %r13d, %r13d
je 0x2ea14
movl %ebx, %esi
shll $0x6, %esi
subl $-0x80, %esi
testb $0x1, %r14b
leaq 0x697e(%rip), %rdx # 0x35379
leaq 0x6973(%rip), %rax # 0x35375
cmoveq %rax, %rdx
leaq 0xa5ad(%rip), %rdi # 0x38fba
xorl %eax, %eax
callq 0xc0c0
movaps 0x6935(%rip), %xmm0 # 0x35350
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x30(%rsp)
movl %ebx, %r15d
movq %r15, %rsi
shlq $0x5, %rsi
leaq 0xa3aa(%rip), %rax # 0x38de0
addq %rax, %rsi
leal 0x10(,%rbx,8), %edx
leaq 0x50(%rsp), %r13
movq %r13, %rdi
callq 0xc1b0
shll $0x6, %ebx
subl $-0x80, %ebx
movq %r12, %rdi
movq %r13, %rsi
movl %ebx, %edx
testb $0x1, %r14b
jne 0x2ea68
callq 0x2e33a
jmp 0x2ea6d
callq 0x2d8fc
leaq (%r15,%r15,2), %rbx
shlq $0x4, %rbx
leaq 0x9d74(%rip), %rax # 0x387f0
addq %rax, %rbx
xorl %r15d, %r15d
xorl %r13d, %r13d
testb $0x1, %r14b
jne 0x2eab7
movaps 0x20(%rsp), %xmm0
movaps %xmm0, 0x80(%rsp)
movaps (%rbx,%r15), %xmm0
movaps %xmm0, 0x20(%rsp)
movq %r13, %rax
shlq $0x4, %rax
leaq 0x9dd0(%rip), %rcx # 0x38880
addq %rcx, %rax
xorl %esi, %esi
jmp 0x2eade
movaps 0x30(%rsp), %xmm0
movaps %xmm0, 0x80(%rsp)
leaq 0x9db5(%rip), %rax # 0x38880
movaps (%r15,%rax), %xmm0
movaps %xmm0, 0x20(%rsp)
leaq (%rbx,%r15), %rax
movl $0x1, %esi
movaps (%rax), %xmm0
movaps %xmm0, 0x30(%rsp)
movl $0x10, %edx
movq %r12, %rdi
leaq 0x80(%rsp), %rcx
movq %rbp, %r8
leaq 0x90(%rsp), %r9
callq 0x2e5b2
movdqa 0x90(%rsp), %xmm0
pcmpeqb 0x30(%rsp), %xmm0
pmovmskb %xmm0, %eax
cmpl $0xffff, %eax # imm = 0xFFFF
jne 0x2ece3
incq %r13
addq $0x10, %r15
cmpq $0x30, %r15
jne 0x2ea85
movl 0x14(%rsp), %r13d
testl %r13d, %r13d
je 0x2eb5a
leaq 0x2eb7(%rip), %rdi # 0x319fd
callq 0xc070
incl %r14d
cmpl $0x6, %r14d
jne 0x2e9de
jmp 0x2eb69
incl %r14d
cmpl $0x6, %r14d
jne 0x2e9de
jmp 0x2eb73
movl $0xa, %edi
callq 0xc050
leaq 0xe4(%rsp), %r15
leaq 0xd0(%rsp), %r12
xorl %ebp, %ebp
testl %r13d, %r13d
je 0x2ebae
testb $0x1, %bpl
leaq 0x67e4(%rip), %rsi # 0x35379
leaq 0x67d9(%rip), %rax # 0x35375
cmoveq %rax, %rsi
leaq 0xa42d(%rip), %rdi # 0x38fd4
xorl %eax, %eax
callq 0xc0c0
movl %ebp, %eax
shrl %eax
movl %eax, %ebx
movq %rbx, %r13
shlq $0x4, %r13
leaq 0x9cee(%rip), %rax # 0x388b0
movaps (%r13,%rax), %xmm0
movaps %xmm0, 0x70(%rsp)
leaq 0x9d0c(%rip), %rax # 0x388e0
movdqa (%r13,%rax), %xmm0
movdqa %xmm0, 0x50(%rsp)
movq $0x0, 0x40(%rsp)
movq %r15, %rdi
leaq 0x50(%rsp), %rsi
movl $0x80, %edx
callq 0x2d8fc
leaq 0x9d0d(%rip), %rax # 0x38910
movslq (%rax,%rbx,4), %rbx
leaq (%r13,%r13,2), %r13
testb $0x1, %bpl
jne 0x2ec58
leaq 0xa227(%rip), %rax # 0x38e40
leaq (%rax,%r13), %rsi
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rdx
callq 0xc1b0
movq %r14, (%rsp)
movq %r15, %rdi
movq %rbx, %rsi
leaq 0x40(%rsp), %rdx
leaq 0x70(%rsp), %rcx
movq %r12, %r8
movq %r14, %r9
callq 0x2e741
leaq 0xa27a(%rip), %rax # 0x38ed0
jmp 0x2ec9c
leaq 0xa271(%rip), %rax # 0x38ed0
leaq (%rax,%r13), %rsi
leaq 0x90(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rdx
callq 0xc1b0
movq %r14, (%rsp)
movq %r15, %rdi
movq %rbx, %rsi
leaq 0x40(%rsp), %rdx
leaq 0x70(%rsp), %rcx
movq %r12, %r8
movq %r14, %r9
callq 0x2e741
leaq 0xa1a4(%rip), %rax # 0x38e40
addq %rax, %r13
movq %r14, %rdi
movq %r13, %rsi
movq %rbx, %rdx
callq 0xc1e0
testl %eax, %eax
jne 0x2ece3
movl 0x14(%rsp), %r13d
testl %r13d, %r13d
je 0x2ecd4
leaq 0x2d3b(%rip), %rdi # 0x319fd
callq 0xc070
incl %ebp
cmpl $0x6, %ebp
jne 0x2eb85
jmp 0x2ed0f
incl %ebp
xorl %ebx, %ebx
cmpl $0x6, %ebp
jne 0x2eb85
jmp 0x2ecfb
movl $0x1, %ebx
cmpl $0x0, 0x14(%rsp)
je 0x2ecfb
leaq 0x6040(%rip), %rdi # 0x34d36
callq 0xc070
movl %ebx, %eax
addq $0x1f8, %rsp # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xa, %edi
callq 0xc050
xorl %ebx, %ebx
jmp 0x2ecfb
nopl (%rax)
| /ARMmbed[P]mbed-crypto/library/camellia.c |
chacha20_block | static void chacha20_block( const uint32_t initial_state[16],
unsigned char keystream[64] )
{
uint32_t working_state[16];
size_t i;
memcpy( working_state,
initial_state,
CHACHA20_BLOCK_SIZE_BYTES );
for( i = 0U; i < 10U; i++ )
chacha20_inner_block( working_state );
working_state[ 0] += initial_state[ 0];
working_state[ 1] += initial_state[ 1];
working_state[ 2] += initial_state[ 2];
working_state[ 3] += initial_state[ 3];
working_state[ 4] += initial_state[ 4];
working_state[ 5] += initial_state[ 5];
working_state[ 6] += initial_state[ 6];
working_state[ 7] += initial_state[ 7];
working_state[ 8] += initial_state[ 8];
working_state[ 9] += initial_state[ 9];
working_state[10] += initial_state[10];
working_state[11] += initial_state[11];
working_state[12] += initial_state[12];
working_state[13] += initial_state[13];
working_state[14] += initial_state[14];
working_state[15] += initial_state[15];
for( i = 0U; i < 16; i++ )
{
size_t offset = i * 4U;
keystream[offset ] = (unsigned char)( working_state[i] );
keystream[offset + 1U] = (unsigned char)( working_state[i] >> 8 );
keystream[offset + 2U] = (unsigned char)( working_state[i] >> 16 );
keystream[offset + 3U] = (unsigned char)( working_state[i] >> 24 );
}
mbedtls_platform_zeroize( working_state, sizeof( working_state ) );
} | pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, 0x60(%rsp)
movups (%rdi), %xmm0
movups 0x10(%rdi), %xmm1
movups 0x20(%rdi), %xmm2
movq %rdi, 0x58(%rsp)
movups 0x30(%rdi), %xmm3
movaps %xmm1, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movaps %xmm3, 0x40(%rsp)
movaps %xmm2, 0x30(%rsp)
movl 0x20(%rsp), %r13d
movl 0x24(%rsp), %r11d
movl 0x10(%rsp), %r8d
movl 0x14(%rsp), %r12d
movl 0x40(%rsp), %r9d
movl 0x44(%rsp), %eax
movl 0x30(%rsp), %r14d
movl 0x34(%rsp), %ecx
movl %ecx, (%rsp)
movl 0x28(%rsp), %ebp
movl 0x18(%rsp), %edi
movl 0x48(%rsp), %ecx
movl 0x38(%rsp), %r10d
movl 0x2c(%rsp), %r15d
movl 0x1c(%rsp), %esi
movl 0x4c(%rsp), %edx
movl $0xa, %ebx
movq %rbx, 0x8(%rsp)
movl 0x3c(%rsp), %ebx
movl %ebx, 0x4(%rsp)
addl %r13d, %r8d
xorl %r8d, %r9d
roll $0x10, %r9d
addl %r9d, %r14d
xorl %r14d, %r13d
roll $0xc, %r13d
addl %r13d, %r8d
xorl %r8d, %r9d
roll $0x8, %r9d
addl %r9d, %r14d
xorl %r14d, %r13d
roll $0x7, %r13d
addl %r11d, %r12d
xorl %r12d, %eax
roll $0x10, %eax
movl (%rsp), %ebx
addl %eax, %ebx
xorl %ebx, %r11d
roll $0xc, %r11d
addl %r11d, %r12d
xorl %r12d, %eax
roll $0x8, %eax
addl %eax, %ebx
movl %ebx, (%rsp)
xorl %ebx, %r11d
movl 0x4(%rsp), %ebx
roll $0x7, %r11d
addl %ebp, %edi
xorl %edi, %ecx
roll $0x10, %ecx
addl %ecx, %r10d
xorl %r10d, %ebp
roll $0xc, %ebp
addl %ebp, %edi
xorl %edi, %ecx
roll $0x8, %ecx
addl %ecx, %r10d
xorl %r10d, %ebp
roll $0x7, %ebp
addl %r15d, %esi
xorl %esi, %edx
roll $0x10, %edx
addl %edx, %ebx
xorl %ebx, %r15d
roll $0xc, %r15d
addl %r15d, %esi
xorl %esi, %edx
roll $0x8, %edx
addl %edx, %ebx
xorl %ebx, %r15d
roll $0x7, %r15d
addl %r11d, %r8d
xorl %r8d, %edx
roll $0x10, %edx
addl %edx, %r10d
xorl %r10d, %r11d
roll $0xc, %r11d
addl %r11d, %r8d
xorl %r8d, %edx
roll $0x8, %edx
addl %edx, %r10d
movl %r10d, 0x4(%rsp)
xorl %r10d, %r11d
roll $0x7, %r11d
addl %ebp, %r12d
xorl %r12d, %r9d
roll $0x10, %r9d
addl %r9d, %ebx
xorl %ebx, %ebp
roll $0xc, %ebp
addl %ebp, %r12d
xorl %r12d, %r9d
roll $0x8, %r9d
addl %r9d, %ebx
xorl %ebx, %ebp
roll $0x7, %ebp
addl %r15d, %edi
xorl %edi, %eax
roll $0x10, %eax
addl %eax, %r14d
xorl %r14d, %r15d
roll $0xc, %r15d
addl %r15d, %edi
xorl %edi, %eax
roll $0x8, %eax
addl %eax, %r14d
xorl %r14d, %r15d
roll $0x7, %r15d
addl %r13d, %esi
xorl %esi, %ecx
roll $0x10, %ecx
movl (%rsp), %r10d
addl %ecx, %r10d
xorl %r10d, %r13d
roll $0xc, %r13d
addl %r13d, %esi
xorl %esi, %ecx
roll $0x8, %ecx
addl %ecx, %r10d
movl %r10d, (%rsp)
xorl %r10d, %r13d
movl 0x4(%rsp), %r10d
roll $0x7, %r13d
decq 0x8(%rsp)
jne 0x2f876
movl %r14d, 0x8(%rsp)
movq 0x58(%rsp), %r14
addl (%r14), %r8d
movl %r8d, 0x10(%rsp)
movd %r13d, %xmm1
movd %esi, %xmm0
movd %edi, %xmm3
movd %r12d, %xmm2
movd 0x8(%rsp), %xmm4
movd %r15d, %xmm5
movd %ebp, %xmm6
movd %r11d, %xmm7
movd %r9d, %xmm8
movd %ebx, %xmm9
movd %r10d, %xmm10
movd (%rsp), %xmm11
punpckldq %xmm1, %xmm0 # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
punpckldq %xmm3, %xmm2 # xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1]
punpcklqdq %xmm0, %xmm2 # xmm2 = xmm2[0],xmm0[0]
movq 0x58(%rsp), %rsi
movdqu 0x4(%rsi), %xmm0
paddd %xmm0, %xmm2
movdqu %xmm2, 0x14(%rsp)
punpckldq %xmm4, %xmm5 # xmm5 = xmm5[0],xmm4[0],xmm5[1],xmm4[1]
punpckldq %xmm6, %xmm7 # xmm7 = xmm7[0],xmm6[0],xmm7[1],xmm6[1]
punpcklqdq %xmm5, %xmm7 # xmm7 = xmm7[0],xmm5[0]
movdqu 0x14(%rsi), %xmm0
paddd %xmm0, %xmm7
movdqu %xmm7, 0x24(%rsp)
punpckldq %xmm8, %xmm9 # xmm9 = xmm9[0],xmm8[0],xmm9[1],xmm8[1]
movdqu 0x24(%rsi), %xmm0
punpckldq %xmm10, %xmm11 # xmm11 = xmm11[0],xmm10[0],xmm11[1],xmm10[1]
punpcklqdq %xmm9, %xmm11 # xmm11 = xmm11[0],xmm9[0]
paddd %xmm0, %xmm11
movdqu %xmm11, 0x34(%rsp)
addl 0x34(%rsi), %eax
movl %eax, 0x44(%rsp)
addl 0x38(%rsi), %ecx
movl %ecx, 0x48(%rsp)
addl 0x3c(%rsi), %edx
movl %edx, 0x4c(%rsp)
xorl %eax, %eax
movq 0x60(%rsp), %rdx
movl 0x10(%rsp,%rax,4), %ecx
movl %ecx, (%rdx,%rax,4)
incq %rax
cmpq $0x10, %rax
jne 0x2fa85
leaq 0x10(%rsp), %rdi
movl $0x40, %esi
callq 0x14edc
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
| /ARMmbed[P]mbed-crypto/library/chacha20.c |
mbedtls_chachapoly_encrypt_and_tag | int mbedtls_chachapoly_encrypt_and_tag( mbedtls_chachapoly_context *ctx,
size_t length,
const unsigned char nonce[12],
const unsigned char *aad,
size_t aad_len,
const unsigned char *input,
unsigned char *output,
unsigned char tag[16] )
{
CHACHAPOLY_VALIDATE_RET( ctx != NULL );
CHACHAPOLY_VALIDATE_RET( nonce != NULL );
CHACHAPOLY_VALIDATE_RET( tag != NULL );
CHACHAPOLY_VALIDATE_RET( aad_len == 0 || aad != NULL );
CHACHAPOLY_VALIDATE_RET( length == 0 || input != NULL );
CHACHAPOLY_VALIDATE_RET( length == 0 || output != NULL );
return( chachapoly_crypt_and_tag( ctx, MBEDTLS_CHACHAPOLY_ENCRYPT,
length, nonce, aad, aad_len,
input, output, tag ) );
} | subq $0x18, %rsp
movq %r8, %rax
movq %rcx, %r8
movq %rdx, %rcx
movq %rsi, %rdx
movaps 0x20(%rsp), %xmm0
movups %xmm0, 0x8(%rsp)
movq %r9, (%rsp)
xorl %esi, %esi
movq %rax, %r9
callq 0x2ff7e
addq $0x18, %rsp
retq
| /ARMmbed[P]mbed-crypto/library/chachapoly.c |
mbedtls_chachapoly_auth_decrypt | int mbedtls_chachapoly_auth_decrypt( mbedtls_chachapoly_context *ctx,
size_t length,
const unsigned char nonce[12],
const unsigned char *aad,
size_t aad_len,
const unsigned char tag[16],
const unsigned char *input,
unsigned char *output )
{
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
unsigned char check_tag[16];
size_t i;
int diff;
CHACHAPOLY_VALIDATE_RET( ctx != NULL );
CHACHAPOLY_VALIDATE_RET( nonce != NULL );
CHACHAPOLY_VALIDATE_RET( tag != NULL );
CHACHAPOLY_VALIDATE_RET( aad_len == 0 || aad != NULL );
CHACHAPOLY_VALIDATE_RET( length == 0 || input != NULL );
CHACHAPOLY_VALIDATE_RET( length == 0 || output != NULL );
if( ( ret = chachapoly_crypt_and_tag( ctx,
MBEDTLS_CHACHAPOLY_DECRYPT, length, nonce,
aad, aad_len, input, output, check_tag ) ) != 0 )
{
return( ret );
}
/* Check tag in "constant-time" */
for( diff = 0, i = 0; i < sizeof( check_tag ); i++ )
diff |= tag[i] ^ check_tag[i];
if( diff != 0 )
{
mbedtls_platform_zeroize( output, length );
return( MBEDTLS_ERR_CHACHAPOLY_AUTH_FAILED );
}
return( 0 );
} | pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %r9, %r15
movq %r8, %r9
movq %rcx, %r8
movq %rdx, %rcx
movq %rsi, %rbx
movq 0x38(%rsp), %r14
subq $0x8, %rsp
leaq 0x8(%rsp), %rax
movl $0x1, %esi
movq %rbx, %rdx
pushq %rax
pushq %r14
pushq 0x48(%rsp)
callq 0x2ff7e
addq $0x20, %rsp
testl %eax, %eax
jne 0x300cc
pxor %xmm1, %xmm1
xorl %eax, %eax
pxor %xmm0, %xmm0
movl (%rsp,%rax), %ecx
xorl (%r15,%rax), %ecx
movd %ecx, %xmm2
punpcklbw %xmm1, %xmm2 # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1],xmm2[2],xmm1[2],xmm2[3],xmm1[3],xmm2[4],xmm1[4],xmm2[5],xmm1[5],xmm2[6],xmm1[6],xmm2[7],xmm1[7]
punpcklwd %xmm1, %xmm2 # xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1],xmm2[2],xmm1[2],xmm2[3],xmm1[3]
por %xmm2, %xmm0
addq $0x4, %rax
cmpq $0x10, %rax
jne 0x30087
pxor %xmm1, %xmm1
pcmpeqd %xmm1, %xmm0
movmskps %xmm0, %eax
xorl $0xf, %eax
je 0x300ca
movq %r14, %rdi
movq %rbx, %rsi
callq 0x14edc
movl $0xffffffaa, %eax # imm = 0xFFFFFFAA
jmp 0x300cc
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
| /ARMmbed[P]mbed-crypto/library/chachapoly.c |
mbedtls_poly1305_self_test | int mbedtls_poly1305_self_test( int verbose )
{
unsigned char mac[16];
unsigned i;
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
for( i = 0U; i < 2U; i++ )
{
if( verbose != 0 )
mbedtls_printf( " Poly1305 test %u ", i );
ret = mbedtls_poly1305_mac( test_keys[i],
test_data[i],
test_data_len[i],
mac );
ASSERT( 0 == ret, ( "error code: %i\n", ret ) );
ASSERT( 0 == memcmp( mac, test_mac[i], 16U ), ( "failed (mac)\n" ) );
if( verbose != 0 )
mbedtls_printf( "passed\n" );
}
if( verbose != 0 )
mbedtls_printf( "\n" );
return( 0 );
} | pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edi, %ebx
movb $0x1, %r15b
movq %rsp, %r14
leaq 0x9267(%rip), %r12 # 0x39a60
xorl %r13d, %r13d
testl %ebx, %ebx
je 0x30811
leaq 0x91e9(%rip), %rdi # 0x399f0
movl %r13d, %esi
xorl %eax, %eax
callq 0xc0c0
movq %r13, %rdi
shlq $0x5, %rdi
leaq 0x9201(%rip), %rax # 0x39a20
addq %rax, %rdi
movq %r13, %rsi
shlq $0x7, %rsi
subq %r13, %rsi
leaq 0x924d(%rip), %rax # 0x39a80
addq %rax, %rsi
leaq 0x9343(%rip), %rax # 0x39b80
movq (%rax,%r13,8), %rdx
movq %r14, %rcx
callq 0x30772
shlq $0x4, %r13
movdqu (%r13,%r12), %xmm0
pcmpeqb (%rsp), %xmm0
pmovmskb %xmm0, %eax
cmpl $0xffff, %eax # imm = 0xFFFF
jne 0x308a8
testl %ebx, %ebx
je 0x3088e
leaq 0x118e(%rip), %rdi # 0x319fd
callq 0xc070
movl $0x1, %r13d
xorl %ebp, %ebp
testb $0x1, %r15b
movl $0x0, %r15d
jne 0x307fc
jmp 0x308bf
xorl %ebp, %ebp
movl $0x1, %r13d
testb $0x1, %r15b
movl $0x0, %r15d
jne 0x307fc
jmp 0x308c9
movl $0xffffffff, %ebp # imm = 0xFFFFFFFF
testl %ebx, %ebx
je 0x308c9
leaq 0x914c(%rip), %rdi # 0x39a04
callq 0xc070
jmp 0x308c9
movl $0xa, %edi
callq 0xc050
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopw (%rax,%rax)
| /ARMmbed[P]mbed-crypto/library/poly1305.c |
test | int test(char *URL)
{
CURLcode res;
CURL *curl;
if(!strcmp(URL, "check")) {
/* used by the test script to ask if we can run this test or not */
if(rlimit(FALSE)) {
fprintf(stdout, "rlimit problem: %s\n", msgbuff);
return 1;
}
return 0; /* sure, run this! */
}
if(rlimit(TRUE)) {
/* failure */
return TEST_ERR_MAJOR_BAD;
}
/* run the test with the bunch of open file descriptors
and close them all once the test is over */
if(curl_global_init(CURL_GLOBAL_ALL) != CURLE_OK) {
fprintf(stderr, "curl_global_init() failed\n");
close_file_descriptors();
return TEST_ERR_MAJOR_BAD;
}
curl = curl_easy_init();
if(!curl) {
fprintf(stderr, "curl_easy_init() failed\n");
close_file_descriptors();
curl_global_cleanup();
return TEST_ERR_MAJOR_BAD;
}
test_setopt(curl, CURLOPT_URL, URL);
test_setopt(curl, CURLOPT_HEADER, 1L);
res = curl_easy_perform(curl);
test_cleanup:
close_file_descriptors();
curl_easy_cleanup(curl);
curl_global_cleanup();
return (int)res;
} | pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r15
leaq 0xd49(%rip), %rsi # 0x3004
callq 0x2130
testl %eax, %eax
je 0x230b
movl $0x1, %edi
callq 0x23c0
movl $0x7e, %ebx
testl %eax, %eax
jne 0x23b8
movl $0x3, %edi
callq 0x2150
testl %eax, %eax
je 0x2342
movq 0x2cf0(%rip), %rax # 0x4fe0
movq (%rax), %rdi
leaq 0xd24(%rip), %rsi # 0x301e
xorl %eax, %eax
callq 0x20f0
callq 0x2ca5
jmp 0x23b8
xorl %ebx, %ebx
xorl %edi, %edi
callq 0x23c0
testl %eax, %eax
je 0x23b8
movq 0x2ca5(%rip), %rax # 0x4fc8
movq (%rax), %rdi
leaq 0xcdd(%rip), %rsi # 0x300a
leaq 0x2dcc(%rip), %rdx # 0x5100
xorl %eax, %eax
callq 0x20f0
movl $0x1, %ebx
jmp 0x23b8
callq 0x2050
testq %rax, %rax
je 0x2396
movq %rax, %r14
movq %rax, %rdi
movl $0x2712, %esi # imm = 0x2712
movq %r15, %rdx
xorl %eax, %eax
callq 0x2140
testl %eax, %eax
jne 0x2385
movl $0x1, %edx
movq %r14, %rdi
movl $0x2a, %esi
xorl %eax, %eax
callq 0x2140
testl %eax, %eax
jne 0x2385
movq %r14, %rdi
callq 0x2040
movl %eax, %ebx
callq 0x2ca5
movq %r14, %rdi
callq 0x20c0
jmp 0x23b3
movq 0x2c43(%rip), %rax # 0x4fe0
movq (%rax), %rdi
leaq 0xc92(%rip), %rsi # 0x3039
xorl %eax, %eax
callq 0x20f0
callq 0x2ca5
callq 0x2190
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
| /nomaster[P]curl/tests/libtest/lib537.c |
close_file_descriptors | static void close_file_descriptors(void)
{
for(num_open.rlim_cur = 0;
num_open.rlim_cur < num_open.rlim_max;
num_open.rlim_cur++)
if(fd[num_open.rlim_cur] > 0)
close(fd[num_open.rlim_cur]);
free(fd);
fd = NULL;
} | pushq %rax
movq $0x0, 0x254f(%rip) # 0x5200
cmpq $0x0, 0x254f(%rip) # 0x5208
je 0x2cea
xorl %eax, %eax
movq 0x254c(%rip), %rcx # 0x5210
movl (%rcx,%rax,4), %edi
testl %edi, %edi
jle 0x2cd0
callq 0x21a0
movq 0x2529(%rip), %rax # 0x5200
incq %rax
movq %rax, 0x251f(%rip) # 0x5200
cmpq 0x2520(%rip), %rax # 0x5208
jb 0x2cbd
movq 0x251f(%rip), %rdi # 0x5210
callq 0x2100
movq $0x0, 0x250f(%rip) # 0x5210
popq %rax
retq
| /nomaster[P]curl/tests/libtest/lib537.c |
select_wrapper | int select_wrapper(int nfds, fd_set *rd, fd_set *wr, fd_set *exc,
struct timeval *tv)
{
if(nfds < 0) {
SET_SOCKERRNO(EINVAL);
return -1;
}
#ifdef USE_WINSOCK
/*
* Winsock select() requires that at least one of the three fd_set
* pointers is not NULL and points to a non-empty fdset. IOW Winsock
* select() can not be used to sleep without a single fd_set.
*/
if(!nfds) {
Sleep((1000*tv->tv_sec) + (DWORD)(((double)tv->tv_usec)/1000.0));
return 0;
}
#endif
return select(nfds, rd, wr, exc, tv);
} | testl %edi, %edi
jns 0x20b0
pushq %rax
callq 0x2030
movl $0x16, (%rax)
movl $0xffffffff, %eax # imm = 0xFFFFFFFF
popq %rcx
retq
| /nomaster[P]curl/tests/libtest/first.c |
hexdump | char *hexdump(const unsigned char *buffer, size_t len)
{
static char dump[200 * 3 + 1];
char *p = dump;
size_t i;
if(len > 200)
return NULL;
for(i = 0; i<len; i++, p += 3)
msnprintf(p, 4, "%02x ", buffer[i]);
return dump;
} | pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpq $0xc8, %rsi
jbe 0x2de3
xorl %ebx, %ebx
jmp 0x2e2d
movq %rsi, %r14
testq %rsi, %rsi
je 0x2e26
movq %rdi, %r15
leaq 0x243b(%rip), %rbx # 0x5230
leaq 0x53b(%rip), %r12 # 0x3337
xorl %ebp, %ebp
movq %rbx, %r13
movzbl (%r15,%rbp), %ecx
movl $0x4, %esi
movq %r13, %rdi
movq %r12, %rdx
xorl %eax, %eax
callq 0x2070
incq %rbp
addq $0x3, %r13
cmpq %rbp, %r14
jne 0x2e01
jmp 0x2e2d
leaq 0x2403(%rip), %rbx # 0x5230
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
| /nomaster[P]curl/tests/libtest/first.c |
main | int main(int argc, char **argv)
{
char *URL;
int result;
#ifdef O_BINARY
# ifdef __HIGHC__
_setmode(stdout, O_BINARY);
# else
setmode(fileno(stdout), O_BINARY);
# endif
#endif
memory_tracking_init();
/*
* Setup proper locale from environment. This is needed to enable locale-
* specific behaviour by the C library in order to test for undesired side
* effects that could cause in libcurl.
*/
#ifdef HAVE_SETLOCALE
setlocale(LC_ALL, "");
#endif
if(argc< 2) {
fprintf(stderr, "Pass URL as argument please\n");
return 1;
}
test_argc = argc;
test_argv = argv;
if(argc>2)
libtest_arg2 = argv[2];
if(argc>3)
libtest_arg3 = argv[3];
URL = argv[1]; /* provide this to the rest */
fprintf(stderr, "URL: %s\n", URL);
result = test(URL);
#ifdef USE_NSS
if(PR_Initialized())
/* prevent valgrind from reporting possibly lost memory (fd cache, ...) */
PR_Cleanup();
#endif
return result;
} | pushq %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x381(%rip), %rsi # 0x31cf
movl $0x6, %edi
callq 0x20a0
cmpl $0x1, %ebp
jg 0x2e81
movq 0x217c(%rip), %rax # 0x4fe0
movq (%rax), %rdi
leaq 0x4cf(%rip), %rsi # 0x333d
xorl %eax, %eax
callq 0x20f0
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movl %ebp, 0x2605(%rip) # 0x548c
movq %rbx, 0x2602(%rip) # 0x5490
cmpl $0x2, %ebp
je 0x2e9e
movq 0x10(%rbx), %rax
movq %rax, 0x2382(%rip) # 0x5220
cmpl $0x4, %ebp
jl 0x2eae
movq 0x18(%rbx), %rax
movq %rax, 0x237a(%rip) # 0x5228
movq 0x8(%rbx), %rbx
movq 0x2127(%rip), %rax # 0x4fe0
movq (%rax), %rdi
leaq 0x497(%rip), %rsi # 0x335a
movq %rbx, %rdx
xorl %eax, %eax
callq 0x20f0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x22ac
nop
| /nomaster[P]curl/tests/libtest/first.c |
curlx_ultouc | unsigned char curlx_ultouc(unsigned long ulnum)
{
#ifdef __INTEL_COMPILER
# pragma warning(push)
# pragma warning(disable:810) /* conversion may lose significant bits */
#endif
DEBUGASSERT(ulnum <= (unsigned long) CURL_MASK_UCHAR);
return (unsigned char)(ulnum & (unsigned long) CURL_MASK_UCHAR);
#ifdef __INTEL_COMPILER
# pragma warning(pop)
#endif
} | movq %rdi, %rax
retq
| /nomaster[P]curl/lib/warnless.c |
curlx_uztoui | unsigned int curlx_uztoui(size_t uznum)
{
#ifdef __INTEL_COMPILER
# pragma warning(push)
# pragma warning(disable:810) /* conversion may lose significant bits */
#endif
#if (SIZEOF_INT < SIZEOF_SIZE_T)
DEBUGASSERT(uznum <= (size_t) CURL_MASK_UINT);
#endif
return (unsigned int)(uznum & (size_t) CURL_MASK_UINT);
#ifdef __INTEL_COMPILER
# pragma warning(pop)
#endif
} | movq %rdi, %rax
retq
| /nomaster[P]curl/lib/warnless.c |
curlx_sltosi | int curlx_sltosi(long slnum)
{
#ifdef __INTEL_COMPILER
# pragma warning(push)
# pragma warning(disable:810) /* conversion may lose significant bits */
#endif
DEBUGASSERT(slnum >= 0);
#if (SIZEOF_INT < SIZEOF_LONG)
DEBUGASSERT((unsigned long) slnum <= (unsigned long) CURL_MASK_SINT);
#endif
return (int)(slnum & (long) CURL_MASK_SINT);
#ifdef __INTEL_COMPILER
# pragma warning(pop)
#endif
} | movq %rdi, %rax
andl $0x7fffffff, %eax # imm = 0x7FFFFFFF
retq
| /nomaster[P]curl/lib/warnless.c |
curlx_sltous | unsigned short curlx_sltous(long slnum)
{
#ifdef __INTEL_COMPILER
# pragma warning(push)
# pragma warning(disable:810) /* conversion may lose significant bits */
#endif
DEBUGASSERT(slnum >= 0);
DEBUGASSERT((unsigned long) slnum <= (unsigned long) CURL_MASK_USHORT);
return (unsigned short)(slnum & (long) CURL_MASK_USHORT);
#ifdef __INTEL_COMPILER
# pragma warning(pop)
#endif
} | movq %rdi, %rax
retq
| /nomaster[P]curl/lib/warnless.c |
curlx_sztosi | int curlx_sztosi(ssize_t sznum)
{
#ifdef __INTEL_COMPILER
# pragma warning(push)
# pragma warning(disable:810) /* conversion may lose significant bits */
#endif
DEBUGASSERT(sznum >= 0);
#if (SIZEOF_INT < SIZEOF_SIZE_T)
DEBUGASSERT((size_t) sznum <= (size_t) CURL_MASK_SINT);
#endif
return (int)(sznum & (ssize_t) CURL_MASK_SINT);
#ifdef __INTEL_COMPILER
# pragma warning(pop)
#endif
} | movq %rdi, %rax
andl $0x7fffffff, %eax # imm = 0x7FFFFFFF
retq
| /nomaster[P]curl/lib/warnless.c |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.