name
string
code
string
asm
string
file
string
Curl_HMAC_final
int Curl_HMAC_final(HMAC_context *ctxt, unsigned char *result) { const HMAC_params * hashparams = ctxt->hmac_hash; /* Do not get result if called with a null parameter: only release storage. */ if(!result) result = (unsigned char *) ctxt->hmac_hashctxt2 + ctxt->hmac_hash->hmac_ctxtsize; (*hashparams->hmac_hfinal)(result, ctxt->hmac_hashctxt1); (*hashparams->hmac_hupdate)(ctxt->hmac_hashctxt2, result, hashparams->hmac_resultlen); (*hashparams->hmac_hfinal)(result, ctxt->hmac_hashctxt2); free((char *) ctxt); return 0; }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movq -0x8(%rbp), %rax movq (%rax), %rax movq %rax, -0x18(%rbp) cmpq $0x0, -0x10(%rbp) jne 0x576ab movq -0x8(%rbp), %rax movq 0x10(%rax), %rax movq -0x8(%rbp), %rcx movq (%rcx), %rcx movl 0x18(%rcx), %ecx addq %rcx, %rax movq %rax, -0x10(%rbp) movq -0x18(%rbp), %rax movq 0x10(%rax), %rax movq -0x10(%rbp), %rdi movq -0x8(%rbp), %rcx movq 0x8(%rcx), %rsi callq *%rax movq -0x18(%rbp), %rax movq 0x8(%rax), %rax movq -0x8(%rbp), %rcx movq 0x10(%rcx), %rdi movq -0x10(%rbp), %rsi movq -0x18(%rbp), %rcx movl 0x20(%rcx), %edx callq *%rax movq -0x18(%rbp), %rax movq 0x10(%rax), %rax movq -0x10(%rbp), %rdi movq -0x8(%rbp), %rcx movq 0x10(%rcx), %rsi callq *%rax leaq 0x3c355(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x8(%rbp), %rdi callq *%rax xorl %eax, %eax addq $0x20, %rsp popq %rbp retq nopl (%rax)
/macressler[P]curl/lib/hmac.c
gopher_do
static CURLcode gopher_do(struct connectdata *conn, bool *done) { CURLcode result = CURLE_OK; struct Curl_easy *data = conn->data; curl_socket_t sockfd = conn->sock[FIRSTSOCKET]; curl_off_t *bytecount = &data->req.bytecount; char *path = data->state.path; char *sel = NULL; char *sel_org = NULL; ssize_t amount, k; size_t len; *done = TRUE; /* unconditionally */ /* Create selector. Degenerate cases: / and /1 => convert to "" */ if(strlen(path) <= 2) { sel = (char *)""; len = (int)strlen(sel); } else { char *newp; size_t j, i; /* Otherwise, drop / and the first character (i.e., item type) ... */ newp = path; newp += 2; /* ... then turn ? into TAB for search servers, Veronica, etc. ... */ j = strlen(newp); for(i = 0; i<j; i++) if(newp[i] == '?') newp[i] = '\x09'; /* ... and finally unescape */ result = Curl_urldecode(data, newp, 0, &sel, &len, FALSE); if(result) return result; sel_org = sel; } /* We use Curl_write instead of Curl_sendf to make sure the entire buffer is sent, which could be sizeable with long selectors. */ k = curlx_uztosz(len); for(;;) { result = Curl_write(conn, sockfd, sel, k, &amount); if(!result) { /* Which may not have written it all! */ result = Curl_client_write(conn, CLIENTWRITE_HEADER, sel, amount); if(result) break; k -= amount; sel += amount; if(k < 1) break; /* but it did write it all */ } else break; /* Don't busyloop. The entire loop thing is a work-around as it causes a BLOCKING behavior which is a NO-NO. This function should rather be split up in a do and a doing piece where the pieces that aren't possible to send now will be sent in the doing function repeatedly until the entire request is sent. Wait a while for the socket to be writable. Note that this doesn't acknowledge the timeout. */ if(SOCKET_WRITABLE(sockfd, 100) < 0) { result = CURLE_SEND_ERROR; break; } } free(sel_org); if(!result) /* We can use Curl_sendf to send the terminal \r\n relatively safely and save allocing another string/doing another _write loop. */ result = Curl_sendf(sockfd, conn, "\r\n"); if(result) { failf(data, "Failed sending Gopher request"); return result; } result = Curl_client_write(conn, CLIENTWRITE_HEADER, (char *)"\r\n", 2); if(result) return result; Curl_setup_transfer(conn, FIRSTSOCKET, -1, FALSE, bytecount, -1, NULL); /* no upload */ return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0x90, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movl $0x0, -0x1c(%rbp) movq -0x10(%rbp), %rax movq (%rax), %rax movq %rax, -0x28(%rbp) movq -0x10(%rbp), %rax movl 0x258(%rax), %eax movl %eax, -0x2c(%rbp) movq -0x28(%rbp), %rax addq $0xc0, %rax addq $0x20, %rax movq %rax, -0x38(%rbp) movq -0x28(%rbp), %rax movq 0x5098(%rax), %rax movq %rax, -0x40(%rbp) movq $0x0, -0x48(%rbp) movq $0x0, -0x50(%rbp) movq -0x18(%rbp), %rax movb $0x1, (%rax) movq -0x40(%rbp), %rdi callq 0x93b0 cmpq $0x2, %rax ja 0x57828 leaq 0x2bc9c(%rip), %rax # 0x834ac movq %rax, -0x48(%rbp) movq -0x48(%rbp), %rdi callq 0x93b0 cltq movq %rax, -0x68(%rbp) jmp 0x578c0 movq -0x40(%rbp), %rax movq %rax, -0x70(%rbp) movq -0x70(%rbp), %rax addq $0x2, %rax movq %rax, -0x70(%rbp) movq -0x70(%rbp), %rdi callq 0x93b0 movq %rax, -0x78(%rbp) movq $0x0, -0x80(%rbp) movq -0x80(%rbp), %rax cmpq -0x78(%rbp), %rax jae 0x57888 movq -0x70(%rbp), %rax movq -0x80(%rbp), %rcx movsbl (%rax,%rcx), %eax cmpl $0x3f, %eax jne 0x57878 movq -0x70(%rbp), %rax movq -0x80(%rbp), %rcx movb $0x9, (%rax,%rcx) jmp 0x5787a movq -0x80(%rbp), %rax addq $0x1, %rax movq %rax, -0x80(%rbp) jmp 0x57851 movq -0x28(%rbp), %rdi movq -0x70(%rbp), %rsi xorl %eax, %eax movl %eax, %edx leaq -0x48(%rbp), %rcx leaq -0x68(%rbp), %r8 xorl %r9d, %r9d callq 0x2c660 movl %eax, -0x1c(%rbp) cmpl $0x0, -0x1c(%rbp) je 0x578b8 movl -0x1c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x57a06 movq -0x48(%rbp), %rax movq %rax, -0x50(%rbp) movq -0x68(%rbp), %rdi callq 0x57350 movq %rax, -0x60(%rbp) movq -0x10(%rbp), %rdi movl -0x2c(%rbp), %esi movq -0x48(%rbp), %rdx movq -0x60(%rbp), %rcx leaq -0x58(%rbp), %r8 callq 0x1a280 movl %eax, -0x1c(%rbp) cmpl $0x0, -0x1c(%rbp) jne 0x57935 movq -0x10(%rbp), %rdi movq -0x48(%rbp), %rdx movq -0x58(%rbp), %rcx movl $0x2, %esi callq 0x1a610 movl %eax, -0x1c(%rbp) cmpl $0x0, -0x1c(%rbp) je 0x5790f jmp 0x5795e movq -0x58(%rbp), %rcx movq -0x60(%rbp), %rax subq %rcx, %rax movq %rax, -0x60(%rbp) movq -0x58(%rbp), %rax addq -0x48(%rbp), %rax movq %rax, -0x48(%rbp) cmpq $0x1, -0x60(%rbp) jge 0x57933 jmp 0x5795e jmp 0x57937 jmp 0x5795e movl -0x2c(%rbp), %edx movl $0xffffffff, %esi # imm = 0xFFFFFFFF movl $0x64, %ecx movl %esi, %edi callq 0x47260 cmpl $0x0, %eax jge 0x57959 movl $0x37, -0x1c(%rbp) jmp 0x5795e jmp 0x578cd leaq 0x3c0eb(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x50(%rbp), %rdi callq *%rax cmpl $0x0, -0x1c(%rbp) jne 0x5798c movl -0x2c(%rbp), %edi movq -0x10(%rbp), %rsi leaq 0x2421c(%rip), %rdx # 0x7bb9e movb $0x0, %al callq 0x1a100 movl %eax, -0x1c(%rbp) cmpl $0x0, -0x1c(%rbp) je 0x579ac movq -0x28(%rbp), %rdi leaq 0x2ac5d(%rip), %rsi # 0x825fa movb $0x0, %al callq 0x19f90 movl -0x1c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x57a06 movq -0x10(%rbp), %rdi movl $0x2, %esi leaq 0x241e2(%rip), %rdx # 0x7bb9e movl $0x2, %ecx callq 0x1a610 movl %eax, -0x1c(%rbp) cmpl $0x0, -0x1c(%rbp) je 0x579d7 movl -0x1c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x57a06 movq -0x10(%rbp), %rdi movq -0x38(%rbp), %r8 xorl %ecx, %ecx movq $-0x1, %rdx movl $0xffffffff, %r9d # imm = 0xFFFFFFFF xorl %eax, %eax movl %ecx, %esi movq $0x0, (%rsp) callq 0x36260 movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x90, %rsp popq %rbp retq nop nopw %cs:(%rax,%rax) nop
/macressler[P]curl/lib/gopher.c
Curl_proxy_connect
CURLcode Curl_proxy_connect(struct connectdata *conn, int sockindex) { if(conn->http_proxy.proxytype == CURLPROXY_HTTPS) { const CURLcode result = https_proxy_connect(conn, sockindex); if(result) return result; if(!conn->bits.proxy_ssl_connected[sockindex]) return result; /* wait for HTTPS proxy SSL initialization to complete */ } if(conn->bits.tunnel_proxy && conn->bits.httpproxy) { #ifndef CURL_DISABLE_PROXY /* for [protocol] tunneled through HTTP proxy */ struct HTTP http_proxy; void *prot_save; const char *hostname; int remote_port; CURLcode result; /* BLOCKING */ /* We want "seamless" operations through HTTP proxy tunnel */ /* Curl_proxyCONNECT is based on a pointer to a struct HTTP at the * member conn->proto.http; we want [protocol] through HTTP and we have * to change the member temporarily for connecting to the HTTP * proxy. After Curl_proxyCONNECT we have to set back the member to the * original pointer * * This function might be called several times in the multi interface case * if the proxy's CONNECT response is not instant. */ prot_save = conn->data->req.protop; memset(&http_proxy, 0, sizeof(http_proxy)); conn->data->req.protop = &http_proxy; connkeep(conn, "HTTP proxy CONNECT"); /* for the secondary socket (FTP), use the "connect to host" * but ignore the "connect to port" (use the secondary port) */ if(conn->bits.conn_to_host) hostname = conn->conn_to_host.name; else if(sockindex == SECONDARYSOCKET) hostname = conn->secondaryhostname; else hostname = conn->host.name; if(sockindex == SECONDARYSOCKET) remote_port = conn->secondary_port; else if(conn->bits.conn_to_port) remote_port = conn->conn_to_port; else remote_port = conn->remote_port; result = Curl_proxyCONNECT(conn, sockindex, hostname, remote_port); conn->data->req.protop = prot_save; if(CURLE_OK != result) return result; Curl_safefree(conn->allocptr.proxyuserpwd); #else return CURLE_NOT_BUILT_IN; #endif } /* no HTTP tunnel proxy, just return */ return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0x260, %rsp # imm = 0x260 movq %rdi, -0x10(%rbp) movl %esi, -0x14(%rbp) movq -0x10(%rbp), %rax cmpl $0x2, 0x178(%rax) jne 0x57a7e movq -0x10(%rbp), %rdi movl -0x14(%rbp), %esi callq 0x57c10 movl %eax, -0x18(%rbp) cmpl $0x0, -0x18(%rbp) je 0x57a5f movl -0x18(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x57bfb movq -0x10(%rbp), %rax movslq -0x14(%rbp), %rcx testb $0x1, 0x3a9(%rax,%rcx) jne 0x57a7c movl -0x18(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x57bfb jmp 0x57a7e movq -0x10(%rbp), %rax testb $0x1, 0x399(%rax) je 0x57bf4 movq -0x10(%rbp), %rax testb $0x1, 0x38e(%rax) je 0x57bf4 movq -0x10(%rbp), %rax movq (%rax), %rax movq 0x1e8(%rax), %rax movq %rax, -0x248(%rbp) leaq -0x240(%rbp), %rdi xorl %esi, %esi movl $0x228, %edx # imm = 0x228 callq 0x9520 movq -0x10(%rbp), %rax movq (%rax), %rax leaq -0x240(%rbp), %rcx movq %rcx, 0x1e8(%rax) movq -0x10(%rbp), %rdi xorl %esi, %esi callq 0x3c850 movq -0x10(%rbp), %rax testb $0x1, 0x38b(%rax) je 0x57b09 movq -0x10(%rbp), %rax movq 0x100(%rax), %rax movq %rax, -0x250(%rbp) jmp 0x57b37 cmpl $0x1, -0x14(%rbp) jne 0x57b23 movq -0x10(%rbp), %rax movq 0xe8(%rax), %rax movq %rax, -0x250(%rbp) jmp 0x57b35 movq -0x10(%rbp), %rax movq 0xd8(%rax), %rax movq %rax, -0x250(%rbp) jmp 0x57b37 cmpl $0x1, -0x14(%rbp) jne 0x57b50 movq -0x10(%rbp), %rax movzwl 0x1a0(%rax), %eax movl %eax, -0x254(%rbp) jmp 0x57b81 movq -0x10(%rbp), %rax testb $0x1, 0x38c(%rax) je 0x57b6f movq -0x10(%rbp), %rax movl 0x19c(%rax), %eax movl %eax, -0x254(%rbp) jmp 0x57b7f movq -0x10(%rbp), %rax movl 0x198(%rax), %eax movl %eax, -0x254(%rbp) jmp 0x57b81 movq -0x10(%rbp), %rdi movl -0x14(%rbp), %esi movq -0x250(%rbp), %rdx movl -0x254(%rbp), %ecx callq 0x57c80 movl %eax, -0x258(%rbp) movq -0x248(%rbp), %rcx movq -0x10(%rbp), %rax movq (%rax), %rax movq %rcx, 0x1e8(%rax) xorl %eax, %eax cmpl -0x258(%rbp), %eax je 0x57bca movl -0x258(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x57bfb jmp 0x57bcc leaq 0x3be7d(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x10(%rbp), %rcx movq 0x3f0(%rcx), %rdi callq *%rax movq -0x10(%rbp), %rax movq $0x0, 0x3f0(%rax) jmp 0x57bf4 movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x260, %rsp # imm = 0x260 popq %rbp retq nopw (%rax,%rax)
/macressler[P]curl/lib/http_proxy.c
destroy_async_data
static void destroy_async_data(struct Curl_async *async) { if(async->os_specific) { struct thread_data *td = (struct thread_data*) async->os_specific; int done; /* * if the thread is still blocking in the resolve syscall, detach it and * let the thread do the cleanup... */ Curl_mutex_acquire(td->tsd.mtx); done = td->tsd.done; td->tsd.done = 1; Curl_mutex_release(td->tsd.mtx); if(!done) { Curl_thread_destroy(td->thread_hnd); } else { if(td->thread_hnd != curl_thread_t_null) Curl_thread_join(&td->thread_hnd); destroy_thread_sync_data(&td->tsd); free(async->os_specific); } } async->os_specific = NULL; free(async->hostname); async->hostname = NULL; }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x8(%rbp) movq -0x8(%rbp), %rax cmpq $0x0, 0x20(%rax) je 0x590c0 movq -0x8(%rbp), %rax movq 0x20(%rax), %rax movq %rax, -0x10(%rbp) movq -0x10(%rbp), %rax movq 0x18(%rax), %rdi callq 0x9ec0 movq -0x10(%rbp), %rax movl 0x20(%rax), %eax movl %eax, -0x14(%rbp) movq -0x10(%rbp), %rax movl $0x1, 0x20(%rax) movq -0x10(%rbp), %rax movq 0x18(%rax), %rdi callq 0x9740 cmpl $0x0, -0x14(%rbp) jne 0x5908a movq -0x10(%rbp), %rax movq (%rax), %rdi callq 0x57170 jmp 0x590be movq -0x10(%rbp), %rax cmpq $0x0, (%rax) je 0x5909d movq -0x10(%rbp), %rdi callq 0x571b0 movq -0x10(%rbp), %rdi addq $0x18, %rdi callq 0x598e0 leaq 0x3a99f(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x8(%rbp), %rcx movq 0x20(%rcx), %rdi callq *%rax jmp 0x590c0 movq -0x8(%rbp), %rax movq $0x0, 0x20(%rax) leaq 0x3a97d(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x8(%rbp), %rcx movq (%rcx), %rdi callq *%rax movq -0x8(%rbp), %rax movq $0x0, (%rax) addq $0x20, %rsp popq %rbp retq
/macressler[P]curl/lib/asyn-thread.c
Curl_resolver_wait_resolv
CURLcode Curl_resolver_wait_resolv(struct connectdata *conn, struct Curl_dns_entry **entry) { struct thread_data *td = (struct thread_data*) conn->async.os_specific; CURLcode result = CURLE_OK; DEBUGASSERT(conn && td); /* wait for the thread to resolve the name */ if(Curl_thread_join(&td->thread_hnd)) result = getaddrinfo_complete(conn); else DEBUGASSERT(0); conn->async.done = TRUE; if(entry) *entry = conn->async.dns; if(!conn->async.dns) /* a name was not resolved, report error */ result = resolver_error(conn); destroy_async_data(&conn->async); if(!conn->async.dns) connclose(conn, "asynch resolve failed"); return result; }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movq -0x8(%rbp), %rax movq 0x610(%rax), %rax movq %rax, -0x18(%rbp) movl $0x0, -0x1c(%rbp) jmp 0x59118 movq -0x18(%rbp), %rdi callq 0x571b0 cmpl $0x0, %eax je 0x59134 movq -0x8(%rbp), %rdi callq 0x591b0 movl %eax, -0x1c(%rbp) jmp 0x5913a jmp 0x59136 jmp 0x59138 jmp 0x5913a movq -0x8(%rbp), %rax movb $0x1, 0x608(%rax) cmpq $0x0, -0x10(%rbp) je 0x5915e movq -0x8(%rbp), %rax movq 0x600(%rax), %rcx movq -0x10(%rbp), %rax movq %rcx, (%rax) movq -0x8(%rbp), %rax cmpq $0x0, 0x600(%rax) jne 0x59178 movq -0x8(%rbp), %rdi callq 0x59200 movl %eax, -0x1c(%rbp) movq -0x8(%rbp), %rdi addq $0x5f0, %rdi # imm = 0x5F0 callq 0x59020 movq -0x8(%rbp), %rax cmpq $0x0, 0x600(%rax) jne 0x591a4 movq -0x8(%rbp), %rdi movl $0x1, %esi callq 0x3c850 movl -0x1c(%rbp), %eax addq $0x20, %rsp popq %rbp retq nopl (%rax)
/macressler[P]curl/lib/asyn-thread.c
destroy_thread_sync_data
static void destroy_thread_sync_data(struct thread_sync_data * tsd) { if(tsd->mtx) { Curl_mutex_destroy(tsd->mtx); free(tsd->mtx); } free(tsd->hostname); if(tsd->res) Curl_freeaddrinfo(tsd->res); memset(tsd, 0, sizeof(*tsd)); }
pushq %rbp movq %rsp, %rbp subq $0x10, %rsp movq %rdi, -0x8(%rbp) movq -0x8(%rbp), %rax cmpq $0x0, (%rax) je 0x59915 movq -0x8(%rbp), %rax movq (%rax), %rdi callq 0x9bd0 leaq 0x3a147(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x8(%rbp), %rcx movq (%rcx), %rdi callq *%rax leaq 0x3a134(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x8(%rbp), %rcx movq 0x10(%rcx), %rdi callq *%rax movq -0x8(%rbp), %rax cmpq $0x0, 0x20(%rax) je 0x59941 movq -0x8(%rbp), %rax movq 0x20(%rax), %rdi callq 0x4bfe0 movq -0x8(%rbp), %rdi xorl %esi, %esi movl $0x60, %edx callq 0x9520 addq $0x10, %rsp popq %rbp retq nopw (%rax,%rax)
/macressler[P]curl/lib/asyn-thread.c
init_thread_sync_data
static int init_thread_sync_data(struct thread_data * td, const char *hostname, int port, const struct addrinfo *hints) { struct thread_sync_data *tsd = &td->tsd; memset(tsd, 0, sizeof(*tsd)); tsd->td = td; tsd->port = port; /* Treat the request as done until the thread actually starts so any early * cleanup gets done properly. */ tsd->done = 1; #ifdef HAVE_GETADDRINFO DEBUGASSERT(hints); tsd->hints = *hints; #else (void) hints; #endif tsd->mtx = malloc(sizeof(curl_mutex_t)); if(tsd->mtx == NULL) goto err_exit; Curl_mutex_init(tsd->mtx); tsd->sock_error = CURL_ASYNC_SUCCESS; /* Copying hostname string because original can be destroyed by parent * thread during gethostbyname execution. */ tsd->hostname = strdup(hostname); if(!tsd->hostname) goto err_exit; return 1; err_exit: /* Memory allocation failed */ destroy_thread_sync_data(tsd); return 0; }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movl %edx, -0x1c(%rbp) movq %rcx, -0x28(%rbp) movq -0x10(%rbp), %rax addq $0x18, %rax movq %rax, -0x30(%rbp) movq -0x30(%rbp), %rdi xorl %esi, %esi movl $0x60, %edx callq 0x9520 movq -0x10(%rbp), %rcx movq -0x30(%rbp), %rax movq %rcx, 0x58(%rax) movl -0x1c(%rbp), %ecx movq -0x30(%rbp), %rax movl %ecx, 0x18(%rax) movq -0x30(%rbp), %rax movl $0x1, 0x8(%rax) jmp 0x599d6 movq -0x30(%rbp), %rdi addq $0x28, %rdi movq -0x28(%rbp), %rsi movl $0x30, %edx callq 0x97b0 movl $0x28, %edi leaq 0x3a050(%rip), %rax # 0x93a48 callq *(%rax) movq %rax, %rcx movq -0x30(%rbp), %rax movq %rcx, (%rax) movq -0x30(%rbp), %rax cmpq $0x0, (%rax) jne 0x59a10 jmp 0x59a5c movq -0x30(%rbp), %rax movq (%rax), %rdi xorl %eax, %eax movl %eax, %esi callq 0x9ef0 movq -0x30(%rbp), %rax movl $0x0, 0x1c(%rax) leaq 0x3a02e(%rip), %rax # 0x93a60 movq (%rax), %rax movq -0x18(%rbp), %rdi callq *%rax movq %rax, %rcx movq -0x30(%rbp), %rax movq %rcx, 0x10(%rax) movq -0x30(%rbp), %rax cmpq $0x0, 0x10(%rax) jne 0x59a53 jmp 0x59a5c movl $0x1, -0x4(%rbp) jmp 0x59a6c movq -0x30(%rbp), %rdi callq 0x598e0 movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x30, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/macressler[P]curl/lib/asyn-thread.c
Curl_input_ntlm
CURLcode Curl_input_ntlm(struct connectdata *conn, bool proxy, /* if proxy or not */ const char *header) /* rest of the www-authenticate: header */ { /* point to the correct struct with this */ struct ntlmdata *ntlm; CURLcode result = CURLE_OK; ntlm = proxy ? &conn->proxyntlm : &conn->ntlm; if(checkprefix("NTLM", header)) { header += strlen("NTLM"); while(*header && ISSPACE(*header)) header++; if(*header) { result = Curl_auth_decode_ntlm_type2_message(conn->data, header, ntlm); if(result) return result; ntlm->state = NTLMSTATE_TYPE2; /* We got a type-2 message */ } else { if(ntlm->state == NTLMSTATE_LAST) { infof(conn->data, "NTLM auth restarted\n"); Curl_http_ntlm_cleanup(conn); } else if(ntlm->state == NTLMSTATE_TYPE3) { infof(conn->data, "NTLM handshake rejected\n"); Curl_http_ntlm_cleanup(conn); ntlm->state = NTLMSTATE_NONE; return CURLE_REMOTE_ACCESS_DENIED; } else if(ntlm->state >= NTLMSTATE_TYPE1) { infof(conn->data, "NTLM handshake failure (internal error)\n"); return CURLE_REMOTE_ACCESS_DENIED; } ntlm->state = NTLMSTATE_TYPE1; /* We should send away a type-1 */ } } return result; }
pushq %rbp movq %rsp, %rbp subq $0x40, %rsp movb %sil, %al movq %rdi, -0x10(%rbp) andb $0x1, %al movb %al, -0x11(%rbp) movq %rdx, -0x20(%rbp) movl $0x0, -0x2c(%rbp) testb $0x1, -0x11(%rbp) je 0x59bc5 movq -0x10(%rbp), %rax addq $0x4d0, %rax # imm = 0x4D0 movq %rax, -0x38(%rbp) jmp 0x59bd3 movq -0x10(%rbp), %rax addq $0x4b0, %rax # imm = 0x4B0 movq %rax, -0x38(%rbp) movq -0x38(%rbp), %rax movq %rax, -0x28(%rbp) movq -0x20(%rbp), %rsi leaq 0x21bba(%rip), %rdi # 0x7b7a0 movl $0x4, %edx callq 0x9420 cmpl $0x0, %eax je 0x59d1c movq -0x20(%rbp), %rax addq $0x4, %rax movq %rax, -0x20(%rbp) movq -0x20(%rbp), %rax movsbl (%rax), %ecx xorl %eax, %eax cmpl $0x0, %ecx movb %al, -0x39(%rbp) je 0x59c2b movq -0x20(%rbp), %rax movzbl (%rax), %edi callq 0x6d380 cmpl $0x0, %eax setne %al movb %al, -0x39(%rbp) movb -0x39(%rbp), %al testb $0x1, %al jne 0x59c34 jmp 0x59c42 movq -0x20(%rbp), %rax addq $0x1, %rax movq %rax, -0x20(%rbp) jmp 0x59c05 movq -0x20(%rbp), %rax cmpb $0x0, (%rax) je 0x59c82 movq -0x10(%rbp), %rax movq (%rax), %rdi movq -0x20(%rbp), %rsi movq -0x28(%rbp), %rdx callq 0x6fd40 movl %eax, -0x2c(%rbp) cmpl $0x0, -0x2c(%rbp) je 0x59c73 movl -0x2c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x59d22 movq -0x28(%rbp), %rax movl $0x2, (%rax) jmp 0x59d1a movq -0x28(%rbp), %rax cmpl $0x4, (%rax) jne 0x59cab movq -0x10(%rbp), %rax movq (%rax), %rdi leaq 0x28c47(%rip), %rsi # 0x828e0 movb $0x0, %al callq 0x19d00 movq -0x10(%rbp), %rdi callq 0x59d30 jmp 0x59d10 movq -0x28(%rbp), %rax cmpl $0x3, (%rax) jne 0x59ce5 movq -0x10(%rbp), %rax movq (%rax), %rdi leaq 0x28c33(%rip), %rsi # 0x828f5 movb $0x0, %al callq 0x19d00 movq -0x10(%rbp), %rdi callq 0x59d30 movq -0x28(%rbp), %rax movl $0x0, (%rax) movl $0x9, -0x4(%rbp) jmp 0x59d22 movq -0x28(%rbp), %rax cmpl $0x1, (%rax) jb 0x59d0c movq -0x10(%rbp), %rax movq (%rax), %rdi leaq 0x28c12(%rip), %rsi # 0x8290e movb $0x0, %al callq 0x19d00 movl $0x9, -0x4(%rbp) jmp 0x59d22 jmp 0x59d0e jmp 0x59d10 movq -0x28(%rbp), %rax movl $0x1, (%rax) jmp 0x59d1c movl -0x2c(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x40, %rsp popq %rbp retq nopl (%rax,%rax)
/macressler[P]curl/lib/http_ntlm.c
Curl_output_ntlm
CURLcode Curl_output_ntlm(struct connectdata *conn, bool proxy) { char *base64 = NULL; size_t len = 0; CURLcode result; /* point to the address of the pointer that holds the string to send to the server, which is for a plain host or for a HTTP proxy */ char **allocuserpwd; /* point to the name and password for this */ const char *userp; const char *passwdp; /* point to the correct struct with this */ struct ntlmdata *ntlm; struct auth *authp; DEBUGASSERT(conn); DEBUGASSERT(conn->data); #if defined(NTLM_NEEDS_NSS_INIT) if(CURLE_OK != Curl_nss_force_init(conn->data)) return CURLE_OUT_OF_MEMORY; #endif if(proxy) { allocuserpwd = &conn->allocptr.proxyuserpwd; userp = conn->http_proxy.user; passwdp = conn->http_proxy.passwd; ntlm = &conn->proxyntlm; authp = &conn->data->state.authproxy; } else { allocuserpwd = &conn->allocptr.userpwd; userp = conn->user; passwdp = conn->passwd; ntlm = &conn->ntlm; authp = &conn->data->state.authhost; } authp->done = FALSE; /* not set means empty */ if(!userp) userp = ""; if(!passwdp) passwdp = ""; #ifdef USE_WINDOWS_SSPI if(s_hSecDll == NULL) { /* not thread safe and leaks - use curl_global_init() to avoid */ CURLcode err = Curl_sspi_global_init(); if(s_hSecDll == NULL) return err; } #endif switch(ntlm->state) { case NTLMSTATE_TYPE1: default: /* for the weird cases we (re)start here */ /* Create a type-1 message */ result = Curl_auth_create_ntlm_type1_message(conn->data, userp, passwdp, ntlm, &base64, &len); if(result) return result; if(base64) { free(*allocuserpwd); *allocuserpwd = aprintf("%sAuthorization: NTLM %s\r\n", proxy ? "Proxy-" : "", base64); free(base64); if(!*allocuserpwd) return CURLE_OUT_OF_MEMORY; DEBUG_OUT(fprintf(stderr, "**** Header %s\n ", *allocuserpwd)); } break; case NTLMSTATE_TYPE2: /* We already received the type-2 message, create a type-3 message */ result = Curl_auth_create_ntlm_type3_message(conn->data, userp, passwdp, ntlm, &base64, &len); if(result) return result; if(base64) { free(*allocuserpwd); *allocuserpwd = aprintf("%sAuthorization: NTLM %s\r\n", proxy ? "Proxy-" : "", base64); free(base64); if(!*allocuserpwd) return CURLE_OUT_OF_MEMORY; DEBUG_OUT(fprintf(stderr, "**** %s\n ", *allocuserpwd)); ntlm->state = NTLMSTATE_TYPE3; /* we send a type-3 */ authp->done = TRUE; } break; case NTLMSTATE_TYPE3: /* connection is already authenticated, * don't send a header in future requests */ ntlm->state = NTLMSTATE_LAST; /* fall-through */ case NTLMSTATE_LAST: Curl_safefree(*allocuserpwd); authp->done = TRUE; break; } return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0x60, %rsp movb %sil, %al movq %rdi, -0x10(%rbp) andb $0x1, %al movb %al, -0x11(%rbp) movq $0x0, -0x20(%rbp) movq $0x0, -0x28(%rbp) jmp 0x59d96 jmp 0x59d98 jmp 0x59d9a testb $0x1, -0x11(%rbp) je 0x59df3 movq -0x10(%rbp), %rax addq $0x3f0, %rax # imm = 0x3F0 movq %rax, -0x38(%rbp) movq -0x10(%rbp), %rax movq 0x180(%rax), %rax movq %rax, -0x40(%rbp) movq -0x10(%rbp), %rax movq 0x188(%rax), %rax movq %rax, -0x48(%rbp) movq -0x10(%rbp), %rax addq $0x4d0, %rax # imm = 0x4D0 movq %rax, -0x50(%rbp) movq -0x10(%rbp), %rax movq (%rax), %rax addq $0xc68, %rax # imm = 0xC68 addq $0x4188, %rax # imm = 0x4188 movq %rax, -0x58(%rbp) jmp 0x59e48 movq -0x10(%rbp), %rax addq $0x3f0, %rax # imm = 0x3F0 addq $0x18, %rax movq %rax, -0x38(%rbp) movq -0x10(%rbp), %rax movq 0x210(%rax), %rax movq %rax, -0x40(%rbp) movq -0x10(%rbp), %rax movq 0x218(%rax), %rax movq %rax, -0x48(%rbp) movq -0x10(%rbp), %rax addq $0x4b0, %rax # imm = 0x4B0 movq %rax, -0x50(%rbp) movq -0x10(%rbp), %rax movq (%rax), %rax addq $0xc68, %rax # imm = 0xC68 addq $0x4168, %rax # imm = 0x4168 movq %rax, -0x58(%rbp) movq -0x58(%rbp), %rax movb $0x0, 0x18(%rax) cmpq $0x0, -0x40(%rbp) jne 0x59e62 leaq 0x2964e(%rip), %rax # 0x834ac movq %rax, -0x40(%rbp) cmpq $0x0, -0x48(%rbp) jne 0x59e74 leaq 0x2963c(%rip), %rax # 0x834ac movq %rax, -0x48(%rbp) movq -0x50(%rbp), %rax movl (%rax), %eax decl %eax movl %eax, %ecx movq %rcx, -0x60(%rbp) subl $0x3, %eax ja 0x59e9d movq -0x60(%rbp), %rax leaq 0x28a3e(%rip), %rcx # 0x828d0 movslq (%rcx,%rax,4), %rax addq %rcx, %rax jmpq *%rax jmp 0x59e9d movq -0x10(%rbp), %rax movq (%rax), %rdi movq -0x40(%rbp), %rsi movq -0x48(%rbp), %rdx movq -0x50(%rbp), %rcx leaq -0x20(%rbp), %r8 leaq -0x28(%rbp), %r9 callq 0x6fff0 movl %eax, -0x2c(%rbp) cmpl $0x0, -0x2c(%rbp) je 0x59ed1 movl -0x2c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x5a04a cmpq $0x0, -0x20(%rbp) je 0x59f4b leaq 0x39b71(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x38(%rbp), %rcx movq (%rcx), %rdi callq *%rax movb -0x11(%rbp), %cl leaq 0x295b7(%rip), %rsi # 0x834ac leaq 0x2213e(%rip), %rax # 0x7c03a testb $0x1, %cl cmovneq %rax, %rsi movq -0x20(%rbp), %rdx leaq 0x28a29(%rip), %rdi # 0x82937 movb $0x0, %al callq 0x9810 movq %rax, %rcx movq -0x38(%rbp), %rax movq %rcx, (%rax) leaq 0x39b2a(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x20(%rbp), %rdi callq *%rax movq -0x38(%rbp), %rax cmpq $0x0, (%rax) jne 0x59f45 movl $0x1b, -0x4(%rbp) jmp 0x5a04a jmp 0x59f47 jmp 0x59f49 jmp 0x59f4b jmp 0x5a043 movq -0x10(%rbp), %rax movq (%rax), %rdi movq -0x40(%rbp), %rsi movq -0x48(%rbp), %rdx movq -0x50(%rbp), %rcx leaq -0x20(%rbp), %r8 leaq -0x28(%rbp), %r9 callq 0x702f0 movl %eax, -0x2c(%rbp) cmpl $0x0, -0x2c(%rbp) je 0x59f84 movl -0x2c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x5a04a cmpq $0x0, -0x20(%rbp) je 0x5a00f leaq 0x39aba(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x38(%rbp), %rcx movq (%rcx), %rdi callq *%rax movb -0x11(%rbp), %cl leaq 0x29500(%rip), %rsi # 0x834ac leaq 0x22087(%rip), %rax # 0x7c03a testb $0x1, %cl cmovneq %rax, %rsi movq -0x20(%rbp), %rdx leaq 0x28972(%rip), %rdi # 0x82937 movb $0x0, %al callq 0x9810 movq %rax, %rcx movq -0x38(%rbp), %rax movq %rcx, (%rax) leaq 0x39a73(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x20(%rbp), %rdi callq *%rax movq -0x38(%rbp), %rax cmpq $0x0, (%rax) jne 0x59ff9 movl $0x1b, -0x4(%rbp) jmp 0x5a04a jmp 0x59ffb jmp 0x59ffd movq -0x50(%rbp), %rax movl $0x3, (%rax) movq -0x58(%rbp), %rax movb $0x1, 0x18(%rax) jmp 0x5a043 movq -0x50(%rbp), %rax movl $0x4, (%rax) jmp 0x5a01d leaq 0x39a2c(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x38(%rbp), %rcx movq (%rcx), %rdi callq *%rax movq -0x38(%rbp), %rax movq $0x0, (%rax) movq -0x58(%rbp), %rax movb $0x1, 0x18(%rax) movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x60, %rsp popq %rbp retq nop nopw %cs:(%rax,%rax) nop
/macressler[P]curl/lib/http_ntlm.c
Curl_ntlm_core_lm_resp
void Curl_ntlm_core_lm_resp(const unsigned char *keys, const unsigned char *plaintext, unsigned char *results) { #ifdef USE_OPENSSL DES_key_schedule ks; setup_des_key(keys, DESKEY(ks)); DES_ecb_encrypt((DES_cblock*) plaintext, (DES_cblock*) results, DESKEY(ks), DES_ENCRYPT); setup_des_key(keys + 7, DESKEY(ks)); DES_ecb_encrypt((DES_cblock*) plaintext, (DES_cblock*) (results + 8), DESKEY(ks), DES_ENCRYPT); setup_des_key(keys + 14, DESKEY(ks)); DES_ecb_encrypt((DES_cblock*) plaintext, (DES_cblock*) (results + 16), DESKEY(ks), DES_ENCRYPT); #elif defined(USE_GNUTLS_NETTLE) struct des_ctx des; setup_des_key(keys, &des); des_encrypt(&des, 8, results, plaintext); setup_des_key(keys + 7, &des); des_encrypt(&des, 8, results + 8, plaintext); setup_des_key(keys + 14, &des); des_encrypt(&des, 8, results + 16, plaintext); #elif defined(USE_GNUTLS) gcry_cipher_hd_t des; gcry_cipher_open(&des, GCRY_CIPHER_DES, GCRY_CIPHER_MODE_ECB, 0); setup_des_key(keys, &des); gcry_cipher_encrypt(des, results, 8, plaintext, 8); gcry_cipher_close(des); gcry_cipher_open(&des, GCRY_CIPHER_DES, GCRY_CIPHER_MODE_ECB, 0); setup_des_key(keys + 7, &des); gcry_cipher_encrypt(des, results + 8, 8, plaintext, 8); gcry_cipher_close(des); gcry_cipher_open(&des, GCRY_CIPHER_DES, GCRY_CIPHER_MODE_ECB, 0); setup_des_key(keys + 14, &des); gcry_cipher_encrypt(des, results + 16, 8, plaintext, 8); gcry_cipher_close(des); #elif defined(USE_NSS) || defined(USE_MBEDTLS) || defined(USE_DARWINSSL) \ || defined(USE_OS400CRYPTO) || defined(USE_WIN32_CRYPTO) encrypt_des(plaintext, results, keys); encrypt_des(plaintext, results + 8, keys + 7); encrypt_des(plaintext, results + 16, keys + 14); #endif }
pushq %rbp movq %rsp, %rbp subq $0xa0, %rsp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movq %rdx, -0x18(%rbp) movq -0x8(%rbp), %rdi leaq -0x98(%rbp), %rsi callq 0x5a110 movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi leaq -0x98(%rbp), %rdx movl $0x1, %ecx callq 0x9450 movq -0x8(%rbp), %rdi addq $0x7, %rdi leaq -0x98(%rbp), %rsi callq 0x5a110 movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi addq $0x8, %rsi leaq -0x98(%rbp), %rdx movl $0x1, %ecx callq 0x9450 movq -0x8(%rbp), %rdi addq $0xe, %rdi leaq -0x98(%rbp), %rsi callq 0x5a110 movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi addq $0x10, %rsi leaq -0x98(%rbp), %rdx movl $0x1, %ecx callq 0x9450 addq $0xa0, %rsp popq %rbp retq nopl (%rax,%rax)
/macressler[P]curl/lib/curl_ntlm_core.c
Curl_ntlm_core_mk_lm_hash
CURLcode Curl_ntlm_core_mk_lm_hash(struct Curl_easy *data, const char *password, unsigned char *lmbuffer /* 21 bytes */) { CURLcode result; unsigned char pw[14]; static const unsigned char magic[] = { 0x4B, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25 /* i.e. KGS!@#$% */ }; size_t len = CURLMIN(strlen(password), 14); Curl_strntoupper((char *)pw, password, len); memset(&pw[len], 0, 14 - len); /* * The LanManager hashed password needs to be created using the * password in the network encoding not the host encoding. */ result = Curl_convert_to_network(data, (char *)pw, 14); if(result) return result; { /* Create LanManager hashed password. */ #ifdef USE_OPENSSL DES_key_schedule ks; setup_des_key(pw, DESKEY(ks)); DES_ecb_encrypt((DES_cblock *)magic, (DES_cblock *)lmbuffer, DESKEY(ks), DES_ENCRYPT); setup_des_key(pw + 7, DESKEY(ks)); DES_ecb_encrypt((DES_cblock *)magic, (DES_cblock *)(lmbuffer + 8), DESKEY(ks), DES_ENCRYPT); #elif defined(USE_GNUTLS_NETTLE) struct des_ctx des; setup_des_key(pw, &des); des_encrypt(&des, 8, lmbuffer, magic); setup_des_key(pw + 7, &des); des_encrypt(&des, 8, lmbuffer + 8, magic); #elif defined(USE_GNUTLS) gcry_cipher_hd_t des; gcry_cipher_open(&des, GCRY_CIPHER_DES, GCRY_CIPHER_MODE_ECB, 0); setup_des_key(pw, &des); gcry_cipher_encrypt(des, lmbuffer, 8, magic, 8); gcry_cipher_close(des); gcry_cipher_open(&des, GCRY_CIPHER_DES, GCRY_CIPHER_MODE_ECB, 0); setup_des_key(pw + 7, &des); gcry_cipher_encrypt(des, lmbuffer + 8, 8, magic, 8); gcry_cipher_close(des); #elif defined(USE_NSS) || defined(USE_MBEDTLS) || defined(USE_DARWINSSL) \ || defined(USE_OS400CRYPTO) || defined(USE_WIN32_CRYPTO) encrypt_des(magic, lmbuffer, pw); encrypt_des(magic, lmbuffer + 8, pw + 7); #endif memset(lmbuffer + 16, 0, 21 - 16); } return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0xd0, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq %rdx, -0x20(%rbp) movq -0x18(%rbp), %rdi callq 0x93b0 cmpq $0xe, %rax jae 0x5a188 movq -0x18(%rbp), %rdi callq 0x93b0 movq %rax, -0xc8(%rbp) jmp 0x5a196 movl $0xe, %eax movq %rax, -0xc8(%rbp) jmp 0x5a196 movq -0xc8(%rbp), %rax movq %rax, -0x40(%rbp) leaq -0x32(%rbp), %rdi movq -0x18(%rbp), %rsi movq -0x40(%rbp), %rdx callq 0x368a0 leaq -0x32(%rbp), %rdi addq -0x40(%rbp), %rdi movl $0xe, %edx subq -0x40(%rbp), %rdx xorl %esi, %esi callq 0x9520 movl $0x0, -0x24(%rbp) cmpl $0x0, -0x24(%rbp) je 0x5a1df movl -0x24(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x5a25a leaq -0x32(%rbp), %rdi leaq -0xc0(%rbp), %rsi callq 0x5a110 movq -0x20(%rbp), %rsi leaq 0x28758(%rip), %rdi # 0x82952 leaq -0xc0(%rbp), %rdx movl $0x1, %ecx callq 0x9450 leaq -0x32(%rbp), %rdi addq $0x7, %rdi leaq -0xc0(%rbp), %rsi callq 0x5a110 movq -0x20(%rbp), %rsi addq $0x8, %rsi leaq 0x28724(%rip), %rdi # 0x82952 leaq -0xc0(%rbp), %rdx movl $0x1, %ecx callq 0x9450 movq -0x20(%rbp), %rdi addq $0x10, %rdi xorl %esi, %esi movl $0x5, %edx callq 0x9520 movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0xd0, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/macressler[P]curl/lib/curl_ntlm_core.c
Curl_ntlm_core_mk_nt_hash
CURLcode Curl_ntlm_core_mk_nt_hash(struct Curl_easy *data, const char *password, unsigned char *ntbuffer /* 21 bytes */) { size_t len = strlen(password); unsigned char *pw = len ? malloc(len * 2) : strdup(""); CURLcode result; if(!pw) return CURLE_OUT_OF_MEMORY; ascii_to_unicode_le(pw, password, len); /* * The NT hashed password needs to be created using the password in the * network encoding not the host encoding. */ result = Curl_convert_to_network(data, (char *)pw, len * 2); if(result) return result; { /* Create NT hashed password. */ #ifdef USE_OPENSSL MD4_CTX MD4pw; MD4_Init(&MD4pw); MD4_Update(&MD4pw, pw, 2 * len); MD4_Final(ntbuffer, &MD4pw); #elif defined(USE_GNUTLS_NETTLE) struct md4_ctx MD4pw; md4_init(&MD4pw); md4_update(&MD4pw, (unsigned int)(2 * len), pw); md4_digest(&MD4pw, MD4_DIGEST_SIZE, ntbuffer); #elif defined(USE_GNUTLS) gcry_md_hd_t MD4pw; gcry_md_open(&MD4pw, GCRY_MD_MD4, 0); gcry_md_write(MD4pw, pw, 2 * len); memcpy(ntbuffer, gcry_md_read(MD4pw, 0), MD4_DIGEST_LENGTH); gcry_md_close(MD4pw); #elif defined(USE_NSS) Curl_md4it(ntbuffer, pw, 2 * len); #elif defined(USE_MBEDTLS) #if defined(MBEDTLS_MD4_C) mbedtls_md4(pw, 2 * len, ntbuffer); #else Curl_md4it(ntbuffer, pw, 2 * len); #endif #elif defined(USE_DARWINSSL) (void)CC_MD4(pw, (CC_LONG)(2 * len), ntbuffer); #elif defined(USE_OS400CRYPTO) Curl_md4it(ntbuffer, pw, 2 * len); #elif defined(USE_WIN32_CRYPTO) HCRYPTPROV hprov; if(CryptAcquireContext(&hprov, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) { HCRYPTHASH hhash; if(CryptCreateHash(hprov, CALG_MD4, 0, 0, &hhash)) { DWORD length = 16; CryptHashData(hhash, pw, (unsigned int)len * 2, 0); CryptGetHashParam(hhash, HP_HASHVAL, ntbuffer, &length, 0); CryptDestroyHash(hhash); } CryptReleaseContext(hprov, 0); } #endif memset(ntbuffer + 16, 0, 21 - 16); } free(pw); return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0xa0, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq %rdx, -0x20(%rbp) movq -0x18(%rbp), %rdi callq 0x93b0 movq %rax, -0x28(%rbp) cmpq $0x0, -0x28(%rbp) je 0x5a2b7 leaq 0x397a6(%rip), %rax # 0x93a48 movq (%rax), %rax movq -0x28(%rbp), %rdi shlq %rdi callq *%rax movq %rax, -0x98(%rbp) jmp 0x5a2ce leaq 0x291ee(%rip), %rdi # 0x834ac leaq 0x3979b(%rip), %rax # 0x93a60 callq *(%rax) movq %rax, -0x98(%rbp) movq -0x98(%rbp), %rax movq %rax, -0x30(%rbp) cmpq $0x0, -0x30(%rbp) jne 0x5a2ec movl $0x1b, -0x4(%rbp) jmp 0x5a370 movq -0x30(%rbp), %rdi movq -0x18(%rbp), %rsi movq -0x28(%rbp), %rdx callq 0x5a380 movl $0x0, -0x34(%rbp) cmpl $0x0, -0x34(%rbp) je 0x5a312 movl -0x34(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x5a370 leaq -0x90(%rbp), %rdi callq 0x9050 movq -0x30(%rbp), %rsi movq -0x28(%rbp), %rdx shlq %rdx leaq -0x90(%rbp), %rdi callq 0x9d80 movq -0x20(%rbp), %rdi leaq -0x90(%rbp), %rsi callq 0x97e0 movq -0x20(%rbp), %rdi addq $0x10, %rdi xorl %esi, %esi movl $0x5, %edx callq 0x9520 leaq 0x396f0(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x30(%rbp), %rdi callq *%rax movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0xa0, %rsp popq %rbp retq nopl (%rax)
/macressler[P]curl/lib/curl_ntlm_core.c
Curl_sasl_cleanup
void Curl_sasl_cleanup(struct connectdata *conn, unsigned int authused) { #if defined(USE_KERBEROS5) /* Cleanup the gssapi structure */ if(authused == SASL_MECH_GSSAPI) { Curl_auth_gssapi_cleanup(&conn->krb5); } #endif #if defined(USE_NTLM) /* Cleanup the NTLM structure */ if(authused == SASL_MECH_NTLM) { Curl_auth_ntlm_cleanup(&conn->ntlm); } #endif #if !defined(USE_KERBEROS5) && !defined(USE_NTLM) /* Reserved for future use */ (void)conn; (void)authused; #endif }
pushq %rbp movq %rsp, %rbp subq $0x10, %rsp movq %rdi, -0x8(%rbp) movl %esi, -0xc(%rbp) cmpl $0x40, -0xc(%rbp) jne 0x5a995 movq -0x8(%rbp), %rdi addq $0x4b0, %rdi # imm = 0x4B0 callq 0x702b0 addq $0x10, %rsp popq %rbp retq nopl (%rax,%rax)
/macressler[P]curl/lib/curl_sasl.c
Curl_sasl_decode_mech
unsigned int Curl_sasl_decode_mech(const char *ptr, size_t maxlen, size_t *len) { unsigned int i; char c; for(i = 0; mechtable[i].name; i++) { if(maxlen >= mechtable[i].len && !memcmp(ptr, mechtable[i].name, mechtable[i].len)) { if(len) *len = mechtable[i].len; if(maxlen == mechtable[i].len) return mechtable[i].bit; c = ptr[mechtable[i].len]; if(!ISUPPER(c) && !ISDIGIT(c) && c != '-' && c != '_') return mechtable[i].bit; } } return 0; }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq %rdx, -0x20(%rbp) movl $0x0, -0x24(%rbp) movl -0x24(%rbp), %eax movl %eax, %ecx leaq 0x37ef9(%rip), %rax # 0x928c0 imulq $0x18, %rcx, %rcx addq %rcx, %rax cmpq $0x0, (%rax) je 0x5ab14 movq -0x18(%rbp), %rax movl -0x24(%rbp), %ecx movl %ecx, %edx leaq 0x37ed8(%rip), %rcx # 0x928c0 imulq $0x18, %rdx, %rdx addq %rdx, %rcx cmpq 0x8(%rcx), %rax jb 0x5ab04 movq -0x10(%rbp), %rdi movl -0x24(%rbp), %eax movl %eax, %ecx leaq 0x37eb7(%rip), %rax # 0x928c0 imulq $0x18, %rcx, %rcx addq %rcx, %rax movq (%rax), %rsi movl -0x24(%rbp), %eax movl %eax, %ecx leaq 0x37ea1(%rip), %rax # 0x928c0 imulq $0x18, %rcx, %rcx addq %rcx, %rax movq 0x8(%rax), %rdx callq 0x93d0 cmpl $0x0, %eax jne 0x5ab04 cmpq $0x0, -0x20(%rbp) je 0x5aa5d movl -0x24(%rbp), %eax movl %eax, %ecx leaq 0x37e75(%rip), %rax # 0x928c0 imulq $0x18, %rcx, %rcx addq %rcx, %rax movq 0x8(%rax), %rcx movq -0x20(%rbp), %rax movq %rcx, (%rax) movq -0x18(%rbp), %rax movl -0x24(%rbp), %ecx movl %ecx, %edx leaq 0x37e53(%rip), %rcx # 0x928c0 imulq $0x18, %rdx, %rdx addq %rdx, %rcx cmpq 0x8(%rcx), %rax jne 0x5aa98 movl -0x24(%rbp), %eax movl %eax, %ecx leaq 0x37e3a(%rip), %rax # 0x928c0 imulq $0x18, %rcx, %rcx addq %rcx, %rax movl 0x10(%rax), %eax movl %eax, -0x4(%rbp) jmp 0x5ab1b movq -0x10(%rbp), %rax movl -0x24(%rbp), %ecx movl %ecx, %edx leaq 0x37e18(%rip), %rcx # 0x928c0 imulq $0x18, %rdx, %rdx addq %rdx, %rcx movq 0x8(%rcx), %rcx movb (%rax,%rcx), %al movb %al, -0x25(%rbp) movzbl -0x25(%rbp), %edi callq 0x6d540 cmpl $0x0, %eax jne 0x5ab02 movzbl -0x25(%rbp), %edi callq 0x6d3c0 cmpl $0x0, %eax jne 0x5ab02 movsbl -0x25(%rbp), %eax cmpl $0x2d, %eax je 0x5ab02 movsbl -0x25(%rbp), %eax cmpl $0x5f, %eax je 0x5ab02 movl -0x24(%rbp), %eax movl %eax, %ecx leaq 0x37dcd(%rip), %rax # 0x928c0 imulq $0x18, %rcx, %rcx addq %rcx, %rax movl 0x10(%rax), %eax movl %eax, -0x4(%rbp) jmp 0x5ab1b jmp 0x5ab04 jmp 0x5ab06 movl -0x24(%rbp), %eax addl $0x1, %eax movl %eax, -0x24(%rbp) jmp 0x5a9bb movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x30, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/macressler[P]curl/lib/curl_sasl.c
Curl_sasl_init
void Curl_sasl_init(struct SASL *sasl, const struct SASLproto *params) { sasl->params = params; /* Set protocol dependent parameters */ sasl->state = SASL_STOP; /* Not yet running */ sasl->authmechs = SASL_AUTH_NONE; /* No known authentication mechanism yet */ sasl->prefmech = SASL_AUTH_DEFAULT; /* Prefer all mechanisms */ sasl->authused = SASL_AUTH_NONE; /* No the authentication mechanism used */ sasl->resetprefs = TRUE; /* Reset prefmech upon AUTH parsing. */ sasl->mutual_auth = FALSE; /* No mutual authentication (GSSAPI only) */ sasl->force_ir = FALSE; /* Respect external option */ }
pushq %rbp movq %rsp, %rbp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movq -0x10(%rbp), %rcx movq -0x8(%rbp), %rax movq %rcx, (%rax) movq -0x8(%rbp), %rax movl $0x0, 0x8(%rax) movq -0x8(%rbp), %rax movl $0x0, 0xc(%rax) movq -0x8(%rbp), %rax movl $0xffffffdf, 0x10(%rax) # imm = 0xFFFFFFDF movq -0x8(%rbp), %rax movl $0x0, 0x14(%rax) movq -0x8(%rbp), %rax movb $0x1, 0x18(%rax) movq -0x8(%rbp), %rax movb $0x0, 0x19(%rax) movq -0x8(%rbp), %rax movb $0x0, 0x1a(%rax) popq %rbp retq nopl (%rax)
/macressler[P]curl/lib/curl_sasl.c
Curl_rand
CURLcode Curl_rand(struct Curl_easy *data, unsigned char *rnd, size_t num) { CURLcode result = CURLE_BAD_FUNCTION_ARGUMENT; DEBUGASSERT(num > 0); while(num) { unsigned int r; size_t left = num < sizeof(unsigned int) ? num : sizeof(unsigned int); result = randit(data, &r); if(result) return result; while(left) { *rnd++ = (unsigned char)(r & 0xFF); r >>= 8; --num; --left; } } return result; }
pushq %rbp movq %rsp, %rbp subq $0x40, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq %rdx, -0x20(%rbp) movl $0x2b, -0x24(%rbp) jmp 0x5b94d jmp 0x5b94f cmpq $0x0, -0x20(%rbp) je 0x5b9e8 cmpq $0x4, -0x20(%rbp) jae 0x5b96b movq -0x20(%rbp), %rax movq %rax, -0x38(%rbp) jmp 0x5b976 movl $0x4, %eax movq %rax, -0x38(%rbp) jmp 0x5b976 movq -0x38(%rbp), %rax movq %rax, -0x30(%rbp) movq -0x10(%rbp), %rdi leaq -0x28(%rbp), %rsi callq 0x5ba00 movl %eax, -0x24(%rbp) cmpl $0x0, -0x24(%rbp) je 0x5b99c movl -0x24(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x5b9ee jmp 0x5b99e cmpq $0x0, -0x30(%rbp) je 0x5b9e3 movl -0x28(%rbp), %eax andl $0xff, %eax movb %al, %cl movq -0x18(%rbp), %rax movq %rax, %rdx addq $0x1, %rdx movq %rdx, -0x18(%rbp) movb %cl, (%rax) movl -0x28(%rbp), %eax shrl $0x8, %eax movl %eax, -0x28(%rbp) movq -0x20(%rbp), %rax addq $-0x1, %rax movq %rax, -0x20(%rbp) movq -0x30(%rbp), %rax addq $-0x1, %rax movq %rax, -0x30(%rbp) jmp 0x5b99e jmp 0x5b94f movl -0x24(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x40, %rsp popq %rbp retq nopw (%rax,%rax)
/macressler[P]curl/lib/rand.c
randit
static CURLcode randit(struct Curl_easy *data, unsigned int *rnd) { unsigned int r; CURLcode result = CURLE_OK; static unsigned int randseed; static bool seeded = FALSE; #ifdef CURLDEBUG char *force_entropy = getenv("CURL_ENTROPY"); if(force_entropy) { if(!seeded) { unsigned int seed = 0; size_t elen = strlen(force_entropy); size_t clen = sizeof(seed); size_t min = elen < clen ? elen : clen; memcpy((char *)&seed, force_entropy, min); randseed = ntohl(seed); seeded = TRUE; } else randseed++; *rnd = randseed; return CURLE_OK; } #endif /* data may be NULL! */ result = Curl_ssl_random(data, (unsigned char *)rnd, sizeof(*rnd)); if(result != CURLE_NOT_BUILT_IN) /* only if there is no random function in the TLS backend do the non crypto version, otherwise return result */ return result; /* ---- non-cryptographic version following ---- */ #ifdef RANDOM_FILE if(!seeded) { /* if there's a random file to read a seed from, use it */ int fd = open(RANDOM_FILE, O_RDONLY); if(fd > -1) { /* read random data into the randseed variable */ ssize_t nread = read(fd, &randseed, sizeof(randseed)); if(nread == sizeof(randseed)) seeded = TRUE; close(fd); } } #endif if(!seeded) { struct curltime now = Curl_now(); infof(data, "WARNING: Using weak random seed\n"); randseed += (unsigned int)now.tv_usec + (unsigned int)now.tv_sec; randseed = randseed * 1103515245 + 12345; randseed = randseed * 1103515245 + 12345; randseed = randseed * 1103515245 + 12345; seeded = TRUE; } /* Return an unsigned 32-bit pseudo-random number. */ r = randseed = randseed * 1103515245 + 12345; *rnd = (r << 16) | ((r >> 16) & 0xFFFF); return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0x40, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movl $0x0, -0x20(%rbp) movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi movl $0x4, %edx callq 0x79850 movl %eax, -0x20(%rbp) cmpl $0x4, -0x20(%rbp) je 0x5ba3d movl -0x20(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x5bb49 testb $0x1, 0x382f8(%rip) # 0x93d3c jne 0x5ba8f leaq 0x26fd7(%rip), %rdi # 0x82a24 xorl %esi, %esi movb $0x0, %al callq 0xa0c0 movl %eax, -0x24(%rbp) cmpl $-0x1, -0x24(%rbp) jle 0x5ba8d movl -0x24(%rbp), %edi leaq 0x382cf(%rip), %rsi # 0x93d38 movl $0x4, %edx callq 0x9e70 movq %rax, -0x30(%rbp) cmpq $0x4, -0x30(%rbp) jne 0x5ba85 movb $0x1, 0x382b7(%rip) # 0x93d3c movl -0x24(%rbp), %edi callq 0xa300 jmp 0x5ba8f testb $0x1, 0x382a6(%rip) # 0x93d3c jne 0x5bb11 callq 0xb150 movq %rax, -0x40(%rbp) movl %edx, -0x38(%rbp) movq -0x10(%rbp), %rdi leaq 0x26f82(%rip), %rsi # 0x82a31 movb $0x0, %al callq 0x19d00 movl -0x38(%rbp), %eax movq -0x40(%rbp), %rcx addl %ecx, %eax addl 0x38273(%rip), %eax # 0x93d38 movl %eax, 0x3826d(%rip) # 0x93d38 imull $0x41c64e6d, 0x38263(%rip), %eax # imm = 0x41C64E6D addl $0x3039, %eax # imm = 0x3039 movl %eax, 0x38258(%rip) # 0x93d38 imull $0x41c64e6d, 0x3824e(%rip), %eax # imm = 0x41C64E6D addl $0x3039, %eax # imm = 0x3039 movl %eax, 0x38243(%rip) # 0x93d38 imull $0x41c64e6d, 0x38239(%rip), %eax # imm = 0x41C64E6D addl $0x3039, %eax # imm = 0x3039 movl %eax, 0x3822e(%rip) # 0x93d38 movb $0x1, 0x3822b(%rip) # 0x93d3c imull $0x41c64e6d, 0x3821d(%rip), %eax # imm = 0x41C64E6D addl $0x3039, %eax # imm = 0x3039 movl %eax, 0x38212(%rip) # 0x93d38 movl %eax, -0x1c(%rbp) movl -0x1c(%rbp), %ecx shll $0x10, %ecx movl -0x1c(%rbp), %eax shrl $0x10, %eax andl $0xffff, %eax # imm = 0xFFFF orl %eax, %ecx movq -0x18(%rbp), %rax movl %ecx, (%rax) movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x40, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/macressler[P]curl/lib/rand.c
Curl_rand_hex
CURLcode Curl_rand_hex(struct Curl_easy *data, unsigned char *rnd, size_t num) { CURLcode result = CURLE_BAD_FUNCTION_ARGUMENT; const char *hex = "0123456789abcdef"; unsigned char buffer[128]; unsigned char *bufp = buffer; DEBUGASSERT(num > 1); #ifdef __clang_analyzer__ /* This silences a scan-build warning about accesssing this buffer with uninitialized memory. */ memset(buffer, 0, sizeof(buffer)); #endif if((num/2 >= sizeof(buffer)) || !(num&1)) /* make sure it fits in the local buffer and that it is an odd number! */ return CURLE_BAD_FUNCTION_ARGUMENT; num--; /* save one for zero termination */ result = Curl_rand(data, buffer, num/2); if(result) return result; while(num) { *rnd++ = hex[(*bufp & 0xF0)>>4]; *rnd++ = hex[*bufp & 0x0F]; bufp++; num -= 2; } *rnd = 0; return result; }
pushq %rbp movq %rsp, %rbp subq $0xc0, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq %rdx, -0x20(%rbp) movl $0x2b, -0x24(%rbp) leaq 0x26e8e(%rip), %rax # 0x82a13 movq %rax, -0x30(%rbp) leaq -0xb0(%rbp), %rax movq %rax, -0xb8(%rbp) jmp 0x5bb99 movq -0x20(%rbp), %rax shrq %rax cmpq $0x80, %rax jae 0x5bbb6 movq -0x20(%rbp), %rax andq $0x1, %rax cmpq $0x0, %rax jne 0x5bbc2 movl $0x2b, -0x4(%rbp) jmp 0x5bc85 movq -0x20(%rbp), %rax addq $-0x1, %rax movq %rax, -0x20(%rbp) movq -0x10(%rbp), %rdi leaq -0xb0(%rbp), %rsi movq -0x20(%rbp), %rdx shrq %rdx callq 0x5b930 movl %eax, -0x24(%rbp) cmpl $0x0, -0x24(%rbp) je 0x5bbf9 movl -0x24(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x5bc85 jmp 0x5bbfb cmpq $0x0, -0x20(%rbp) je 0x5bc78 movq -0x30(%rbp), %rax movq -0xb8(%rbp), %rcx movzbl (%rcx), %ecx andl $0xf0, %ecx sarl $0x4, %ecx movslq %ecx, %rcx movb (%rax,%rcx), %cl movq -0x18(%rbp), %rax movq %rax, %rdx addq $0x1, %rdx movq %rdx, -0x18(%rbp) movb %cl, (%rax) movq -0x30(%rbp), %rax movq -0xb8(%rbp), %rcx movzbl (%rcx), %ecx andl $0xf, %ecx movslq %ecx, %rcx movb (%rax,%rcx), %cl movq -0x18(%rbp), %rax movq %rax, %rdx addq $0x1, %rdx movq %rdx, -0x18(%rbp) movb %cl, (%rax) movq -0xb8(%rbp), %rax addq $0x1, %rax movq %rax, -0xb8(%rbp) movq -0x20(%rbp), %rax subq $0x2, %rax movq %rax, -0x20(%rbp) jmp 0x5bbfb movq -0x18(%rbp), %rax movb $0x0, (%rax) movl -0x24(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0xc0, %rsp popq %rbp retq nopl (%rax) nopw %cs:(%rax,%rax) nop
/macressler[P]curl/lib/rand.c
Curl_cert_hostcheck
int Curl_cert_hostcheck(const char *match_pattern, const char *hostname) { char *matchp; char *hostp; int res = 0; if(!match_pattern || !*match_pattern || !hostname || !*hostname) /* sanity check */ ; else { matchp = strdup(match_pattern); if(matchp) { hostp = strdup(hostname); if(hostp) { if(hostmatch(hostp, matchp) == CURL_HOST_MATCH) res = 1; free(hostp); } free(matchp); } } return res; }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movl $0x0, -0x24(%rbp) cmpq $0x0, -0x8(%rbp) je 0x5bcd7 movq -0x8(%rbp), %rax cmpb $0x0, (%rax) je 0x5bcd7 cmpq $0x0, -0x10(%rbp) je 0x5bcd7 movq -0x10(%rbp), %rax cmpb $0x0, (%rax) jne 0x5bcd9 jmp 0x5bd4a leaq 0x37d80(%rip), %rax # 0x93a60 movq (%rax), %rax movq -0x8(%rbp), %rdi callq *%rax movq %rax, -0x18(%rbp) cmpq $0x0, -0x18(%rbp) je 0x5bd48 leaq 0x37d65(%rip), %rax # 0x93a60 movq (%rax), %rax movq -0x10(%rbp), %rdi callq *%rax movq %rax, -0x20(%rbp) cmpq $0x0, -0x20(%rbp) je 0x5bd38 movq -0x20(%rbp), %rdi movq -0x18(%rbp), %rsi callq 0x5bd60 cmpl $0x1, %eax jne 0x5bd28 movl $0x1, -0x24(%rbp) leaq 0x37d21(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x20(%rbp), %rdi callq *%rax leaq 0x37d11(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x18(%rbp), %rdi callq *%rax jmp 0x5bd4a movl -0x24(%rbp), %eax addq $0x30, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/macressler[P]curl/lib/hostcheck.c
Curl_conncache_init
int Curl_conncache_init(struct conncache *connc, int size) { int rc; /* allocate a new easy handle to use when closing cached connections */ connc->closure_handle = curl_easy_init(); if(!connc->closure_handle) return 1; /* bad */ rc = Curl_hash_init(&connc->hash, size, Curl_hash_str, Curl_str_key_compare, free_bundle_hash_entry); if(rc) { Curl_close(connc->closure_handle); connc->closure_handle = NULL; } else connc->closure_handle->state.conn_cache = connc; return rc; }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x10(%rbp) movl %esi, -0x14(%rbp) callq 0x9250 movq %rax, %rcx movq -0x10(%rbp), %rax movq %rcx, 0x50(%rax) movq -0x10(%rbp), %rax cmpq $0x0, 0x50(%rax) jne 0x5c003 movl $0x1, -0x4(%rbp) jmp 0x5c061 movq -0x10(%rbp), %rdi movl -0x14(%rbp), %esi leaq -0x1e2c1(%rip), %rdx # 0x3dd50 leaq -0x1e248(%rip), %rcx # 0x3ddd0 leaq 0x51(%rip), %r8 # 0x5c070 callq 0x3d6f0 movl %eax, -0x18(%rbp) cmpl $0x0, -0x18(%rbp) je 0x5c048 movq -0x10(%rbp), %rax movq 0x50(%rax), %rdi callq 0x22d30 movq -0x10(%rbp), %rax movq $0x0, 0x50(%rax) jmp 0x5c05b movq -0x10(%rbp), %rcx movq -0x10(%rbp), %rax movq 0x50(%rax), %rax movq %rcx, 0xc68(%rax) movl -0x18(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x20, %rsp popq %rbp retq nopw (%rax,%rax)
/macressler[P]curl/lib/conncache.c
hashkey
static void hashkey(struct connectdata *conn, char *buf, size_t len) /* something like 128 is fine */ { const char *hostname; if(conn->bits.socksproxy) hostname = conn->socks_proxy.host.name; else if(conn->bits.httpproxy) hostname = conn->http_proxy.host.name; else if(conn->bits.conn_to_host) hostname = conn->conn_to_host.name; else hostname = conn->host.name; DEBUGASSERT(len > 32); /* put the number first so that the hostname gets cut off if too long */ snprintf(buf, len, "%ld%s", conn->port, hostname); }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movq %rdx, -0x18(%rbp) movq -0x8(%rbp), %rax testb $0x1, 0x38f(%rax) je 0x5c2e2 movq -0x8(%rbp), %rax movq 0x120(%rax), %rax movq %rax, -0x20(%rbp) jmp 0x5c331 movq -0x8(%rbp), %rax testb $0x1, 0x38e(%rax) je 0x5c300 movq -0x8(%rbp), %rax movq 0x160(%rax), %rax movq %rax, -0x20(%rbp) jmp 0x5c32f movq -0x8(%rbp), %rax testb $0x1, 0x38b(%rax) je 0x5c31e movq -0x8(%rbp), %rax movq 0x100(%rax), %rax movq %rax, -0x20(%rbp) jmp 0x5c32d movq -0x8(%rbp), %rax movq 0xd8(%rax), %rax movq %rax, -0x20(%rbp) jmp 0x5c32f jmp 0x5c331 jmp 0x5c333 jmp 0x5c335 movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi movq -0x8(%rbp), %rax movq 0x190(%rax), %rcx movq -0x20(%rbp), %r8 leaq 0x26737(%rip), %rdx # 0x82a8a movb $0x0, %al callq 0x9510 addq $0x20, %rsp popq %rbp retq
/macressler[P]curl/lib/conncache.c
Curl_conncache_add_conn
CURLcode Curl_conncache_add_conn(struct conncache *connc, struct connectdata *conn) { CURLcode result; struct connectbundle *bundle; struct connectbundle *new_bundle = NULL; struct Curl_easy *data = conn->data; /* *find_bundle() locks the connection cache */ bundle = Curl_conncache_find_bundle(conn, data->state.conn_cache); if(!bundle) { int rc; char key[128]; result = bundle_create(data, &new_bundle); if(result) { goto unlock; } hashkey(conn, key, sizeof(key)); rc = conncache_add_bundle(data->state.conn_cache, key, new_bundle); if(!rc) { bundle_destroy(new_bundle); result = CURLE_OUT_OF_MEMORY; goto unlock; } bundle = new_bundle; } result = bundle_add_conn(bundle, conn); if(result) { if(new_bundle) conncache_remove_bundle(data->state.conn_cache, new_bundle); goto unlock; } conn->connection_id = connc->next_connection_id++; connc->num_conn++; DEBUGF(infof(conn->data, "Added connection %ld. " "The cache now contains %" CURL_FORMAT_CURL_OFF_TU " members\n", conn->connection_id, (curl_off_t) connc->num_conn)); unlock: CONN_UNLOCK(data); return result; }
pushq %rbp movq %rsp, %rbp subq $0xc0, %rsp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movq $0x0, -0x28(%rbp) movq -0x10(%rbp), %rax movq (%rax), %rax movq %rax, -0x30(%rbp) movq -0x10(%rbp), %rdi movq -0x30(%rbp), %rax movq 0xc68(%rax), %rsi callq 0x5c200 movq %rax, -0x20(%rbp) cmpq $0x0, -0x20(%rbp) jne 0x5c418 movq -0x30(%rbp), %rdi leaq -0x28(%rbp), %rsi callq 0x5c4b0 movl %eax, -0x14(%rbp) cmpl $0x0, -0x14(%rbp) je 0x5c3c0 jmp 0x5c47a movq -0x10(%rbp), %rdi leaq -0xc0(%rbp), %rsi movl $0x80, %edx callq 0x5c2b0 movq -0x30(%rbp), %rax movq 0xc68(%rax), %rdi leaq -0xc0(%rbp), %rsi movq -0x28(%rbp), %rdx callq 0x5c530 andb $0x1, %al movzbl %al, %eax movl %eax, -0x34(%rbp) cmpl $0x0, -0x34(%rbp) jne 0x5c410 movq -0x28(%rbp), %rdi callq 0x5c5a0 movl $0x1b, -0x14(%rbp) jmp 0x5c47a movq -0x28(%rbp), %rax movq %rax, -0x20(%rbp) movq -0x20(%rbp), %rdi movq -0x10(%rbp), %rsi callq 0x5c5e0 movl %eax, -0x14(%rbp) cmpl $0x0, -0x14(%rbp) je 0x5c44b cmpq $0x0, -0x28(%rbp) je 0x5c449 movq -0x30(%rbp), %rax movq 0xc68(%rax), %rdi movq -0x28(%rbp), %rsi callq 0x5c640 jmp 0x5c47a movq -0x8(%rbp), %rax movq 0x38(%rax), %rcx movq %rcx, %rdx addq $0x1, %rdx movq %rdx, 0x38(%rax) movq -0x10(%rbp), %rax movq %rcx, 0x68(%rax) movq -0x8(%rbp), %rax movq 0x30(%rax), %rcx addq $0x1, %rcx movq %rcx, 0x30(%rax) jmp 0x5c478 jmp 0x5c47a movq -0x30(%rbp), %rax cmpq $0x0, 0xb8(%rax) je 0x5c496 movq -0x30(%rbp), %rdi movl $0x5, %esi callq 0x450f0 movl -0x14(%rbp), %eax addq $0xc0, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/macressler[P]curl/lib/conncache.c
bundle_add_conn
static CURLcode bundle_add_conn(struct connectbundle *cb_ptr, struct connectdata *conn) { Curl_llist_insert_next(&cb_ptr->conn_list, cb_ptr->conn_list.tail, conn, &conn->bundle_node); conn->bundle = cb_ptr; cb_ptr->num_connections++; return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0x10, %rsp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movq -0x8(%rbp), %rdi addq $0x10, %rdi movq -0x8(%rbp), %rax movq 0x18(%rax), %rsi movq -0x10(%rbp), %rdx movq -0x10(%rbp), %rcx addq $0x8, %rcx callq 0x3d2b0 movq -0x8(%rbp), %rcx movq -0x10(%rbp), %rax movq %rcx, 0x738(%rax) movq -0x8(%rbp), %rax movq 0x8(%rax), %rcx addq $0x1, %rcx movq %rcx, 0x8(%rax) xorl %eax, %eax addq $0x10, %rsp popq %rbp retq nopl (%rax,%rax)
/macressler[P]curl/lib/conncache.c
Curl_conncache_remove_conn
void Curl_conncache_remove_conn(struct connectdata *conn, bool lock) { struct Curl_easy *data = conn->data; struct connectbundle *bundle = conn->bundle; struct conncache *connc = data->state.conn_cache; /* The bundle pointer can be NULL, since this function can be called due to a failed connection attempt, before being added to a bundle */ if(bundle) { if(lock) { CONN_LOCK(conn->data); } bundle_remove_conn(bundle, conn); if(bundle->num_connections == 0) conncache_remove_bundle(connc, bundle); conn->bundle = NULL; /* removed from it */ if(connc) { connc->num_conn--; DEBUGF(infof(conn->data, "The cache now contains %" CURL_FORMAT_CURL_OFF_TU " members\n", (curl_off_t) connc->num_conn)); } if(lock) { CONN_UNLOCK(conn->data); } } }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movb %sil, %al movq %rdi, -0x8(%rbp) andb $0x1, %al movb %al, -0x9(%rbp) movq -0x8(%rbp), %rax movq (%rax), %rax movq %rax, -0x18(%rbp) movq -0x8(%rbp), %rax movq 0x738(%rax), %rax movq %rax, -0x20(%rbp) movq -0x18(%rbp), %rax movq 0xc68(%rax), %rax movq %rax, -0x28(%rbp) cmpq $0x0, -0x20(%rbp) je 0x5c7b2 testb $0x1, -0x9(%rbp) je 0x5c737 movq -0x8(%rbp), %rax movq (%rax), %rax cmpq $0x0, 0xb8(%rax) je 0x5c735 movq -0x8(%rbp), %rax movq (%rax), %rdi movl $0x5, %esi movl $0x2, %edx callq 0x45060 jmp 0x5c737 movq -0x20(%rbp), %rdi movq -0x8(%rbp), %rsi callq 0x5c7c0 movq -0x20(%rbp), %rax cmpq $0x0, 0x8(%rax) jne 0x5c75c movq -0x28(%rbp), %rdi movq -0x20(%rbp), %rsi callq 0x5c640 movq -0x8(%rbp), %rax movq $0x0, 0x738(%rax) cmpq $0x0, -0x28(%rbp) je 0x5c786 movq -0x28(%rbp), %rax movq 0x30(%rax), %rcx addq $-0x1, %rcx movq %rcx, 0x30(%rax) jmp 0x5c784 jmp 0x5c786 testb $0x1, -0x9(%rbp) je 0x5c7b0 movq -0x8(%rbp), %rax movq (%rax), %rax cmpq $0x0, 0xb8(%rax) je 0x5c7ae movq -0x8(%rbp), %rax movq (%rax), %rdi movl $0x5, %esi callq 0x450f0 jmp 0x5c7b0 jmp 0x5c7b2 addq $0x30, %rsp popq %rbp retq nopl (%rax,%rax)
/macressler[P]curl/lib/conncache.c
Curl_conncache_foreach
bool Curl_conncache_foreach(struct Curl_easy *data, struct conncache *connc, void *param, int (*func)(struct connectdata *conn, void *param)) { struct curl_hash_iterator iter; struct curl_llist_element *curr; struct curl_hash_element *he; if(!connc) return FALSE; CONN_LOCK(data); Curl_hash_start_iterate(&connc->hash, &iter); he = Curl_hash_next_element(&iter); while(he) { struct connectbundle *bundle; bundle = he->ptr; he = Curl_hash_next_element(&iter); curr = bundle->conn_list.head; while(curr) { /* Yes, we need to update curr before calling func(), because func() might decide to remove the connection */ struct connectdata *conn = curr->ptr; curr = curr->next; if(1 == func(conn, param)) { CONN_UNLOCK(data); return TRUE; } } } CONN_UNLOCK(data); return FALSE; }
pushq %rbp movq %rsp, %rbp subq $0x60, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq %rdx, -0x20(%rbp) movq %rcx, -0x28(%rbp) cmpq $0x0, -0x18(%rbp) jne 0x5c878 movb $0x0, -0x1(%rbp) jmp 0x5c963 movq -0x10(%rbp), %rax cmpq $0x0, 0xb8(%rax) je 0x5c899 movq -0x10(%rbp), %rdi movl $0x5, %esi movl $0x2, %edx callq 0x45060 movq -0x18(%rbp), %rdi leaq -0x40(%rbp), %rsi callq 0x3de30 leaq -0x40(%rbp), %rdi callq 0x3de60 movq %rax, -0x50(%rbp) cmpq $0x0, -0x50(%rbp) je 0x5c943 movq -0x50(%rbp), %rax movq 0x18(%rax), %rax movq %rax, -0x58(%rbp) leaq -0x40(%rbp), %rdi callq 0x3de60 movq %rax, -0x50(%rbp) movq -0x58(%rbp), %rax movq 0x10(%rax), %rax movq %rax, -0x48(%rbp) cmpq $0x0, -0x48(%rbp) je 0x5c93e movq -0x48(%rbp), %rax movq (%rax), %rax movq %rax, -0x60(%rbp) movq -0x48(%rbp), %rax movq 0x10(%rax), %rax movq %rax, -0x48(%rbp) movq -0x28(%rbp), %rax movq -0x60(%rbp), %rdi movq -0x20(%rbp), %rsi callq *%rax movl %eax, %ecx movl $0x1, %eax cmpl %ecx, %eax jne 0x5c93c movq -0x10(%rbp), %rax cmpq $0x0, 0xb8(%rax) je 0x5c936 movq -0x10(%rbp), %rdi movl $0x5, %esi callq 0x450f0 movb $0x1, -0x1(%rbp) jmp 0x5c963 jmp 0x5c8e3 jmp 0x5c8b3 movq -0x10(%rbp), %rax cmpq $0x0, 0xb8(%rax) je 0x5c95f movq -0x10(%rbp), %rdi movl $0x5, %esi callq 0x450f0 movb $0x0, -0x1(%rbp) movb -0x1(%rbp), %al andb $0x1, %al addq $0x60, %rsp popq %rbp retq nop
/macressler[P]curl/lib/conncache.c
Curl_conncache_return_conn
bool Curl_conncache_return_conn(struct connectdata *conn) { struct Curl_easy *data = conn->data; /* data->multi->maxconnects can be negative, deal with it. */ size_t maxconnects = (data->multi->maxconnects < 0) ? data->multi->num_easy * 4: data->multi->maxconnects; struct connectdata *conn_candidate = NULL; if(maxconnects > 0 && Curl_conncache_size(data) > maxconnects) { infof(data, "Connection cache is full, closing the oldest one.\n"); conn_candidate = Curl_conncache_extract_oldest(data); if(conn_candidate) { /* Set the connection's owner correctly */ conn_candidate->data = data; /* the winner gets the honour of being disconnected */ (void)Curl_disconnect(conn_candidate, /* dead_connection */ FALSE); } } CONN_LOCK(data); conn->inuse = FALSE; /* Mark the connection unused */ CONN_UNLOCK(data); return (conn_candidate == conn) ? FALSE : TRUE; }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x8(%rbp) movq -0x8(%rbp), %rax movq (%rax), %rax movq %rax, -0x10(%rbp) movq -0x10(%rbp), %rax movq 0xa8(%rax), %rax cmpq $0x0, 0x150(%rax) jge 0x5ca35 movq -0x10(%rbp), %rax movq 0xa8(%rax), %rax movl 0x18(%rax), %eax shll $0x2, %eax cltq movq %rax, -0x28(%rbp) jmp 0x5ca4b movq -0x10(%rbp), %rax movq 0xa8(%rax), %rax movq 0x150(%rax), %rax movq %rax, -0x28(%rbp) movq -0x28(%rbp), %rax movq %rax, -0x18(%rbp) movq $0x0, -0x20(%rbp) cmpq $0x0, -0x18(%rbp) jbe 0x5caaf movq -0x10(%rbp), %rdi callq 0x5c110 cmpq -0x18(%rbp), %rax jbe 0x5caaf movq -0x10(%rbp), %rdi leaq 0x25fdb(%rip), %rsi # 0x82a57 movb $0x0, %al callq 0x19d00 movq -0x10(%rbp), %rdi callq 0x5cb20 movq %rax, -0x20(%rbp) cmpq $0x0, -0x20(%rbp) je 0x5caad movq -0x10(%rbp), %rcx movq -0x20(%rbp), %rax movq %rcx, (%rax) movq -0x20(%rbp), %rdi xorl %esi, %esi callq 0x236e0 jmp 0x5caaf movq -0x10(%rbp), %rax cmpq $0x0, 0xb8(%rax) je 0x5cad0 movq -0x10(%rbp), %rdi movl $0x5, %esi movl $0x2, %edx callq 0x45060 movq -0x8(%rbp), %rax movb $0x0, 0x60(%rax) movq -0x10(%rbp), %rax cmpq $0x0, 0xb8(%rax) je 0x5caf4 movq -0x10(%rbp), %rdi movl $0x5, %esi callq 0x450f0 movq -0x20(%rbp), %rdx movq -0x8(%rbp), %rsi movl $0x1, %eax xorl %ecx, %ecx cmpq %rsi, %rdx cmovel %ecx, %eax cmpl $0x0, %eax setne %al andb $0x1, %al addq $0x30, %rsp popq %rbp retq nopw (%rax,%rax)
/macressler[P]curl/lib/conncache.c
Curl_conncache_extract_oldest
struct connectdata * Curl_conncache_extract_oldest(struct Curl_easy *data) { struct conncache *connc = data->state.conn_cache; struct curl_hash_iterator iter; struct curl_llist_element *curr; struct curl_hash_element *he; timediff_t highscore =- 1; timediff_t score; struct curltime now; struct connectdata *conn_candidate = NULL; struct connectbundle *bundle; struct connectbundle *bundle_candidate = NULL; now = Curl_now(); CONN_LOCK(data); Curl_hash_start_iterate(&connc->hash, &iter); he = Curl_hash_next_element(&iter); while(he) { struct connectdata *conn; bundle = he->ptr; curr = bundle->conn_list.head; while(curr) { conn = curr->ptr; if(!conn->inuse) { /* Set higher score for the age passed since the connection was used */ score = Curl_timediff(now, conn->now); if(score > highscore) { highscore = score; conn_candidate = conn; bundle_candidate = bundle; } } curr = curr->next; } he = Curl_hash_next_element(&iter); } if(conn_candidate) { /* remove it to prevent another thread from nicking it */ bundle_remove_conn(bundle_candidate, conn_candidate); connc->num_conn--; DEBUGF(infof(data, "The cache now contains %" CURL_FORMAT_CURL_OFF_TU " members\n", (curl_off_t) connc->num_conn)); } CONN_UNLOCK(data); return conn_candidate; }
pushq %rbp movq %rsp, %rbp subq $0x90, %rsp movq %rdi, -0x8(%rbp) movq -0x8(%rbp), %rax movq 0xc68(%rax), %rax movq %rax, -0x10(%rbp) movq $-0x1, -0x40(%rbp) movq $0x0, -0x60(%rbp) movq $0x0, -0x70(%rbp) callq 0xb150 movq %rax, -0x80(%rbp) movl %edx, -0x78(%rbp) movq -0x80(%rbp), %rax movq %rax, -0x58(%rbp) movq -0x78(%rbp), %rax movq %rax, -0x50(%rbp) movq -0x8(%rbp), %rax cmpq $0x0, 0xb8(%rax) je 0x5cb93 movq -0x8(%rbp), %rdi movl $0x5, %esi movl $0x2, %edx callq 0x45060 movq -0x10(%rbp), %rdi leaq -0x28(%rbp), %rsi callq 0x3de30 leaq -0x28(%rbp), %rdi callq 0x3de60 movq %rax, -0x38(%rbp) cmpq $0x0, -0x38(%rbp) je 0x5cc5d movq -0x38(%rbp), %rax movq 0x18(%rax), %rax movq %rax, -0x68(%rbp) movq -0x68(%rbp), %rax movq 0x10(%rax), %rax movq %rax, -0x30(%rbp) cmpq $0x0, -0x30(%rbp) je 0x5cc4b movq -0x30(%rbp), %rax movq (%rax), %rax movq %rax, -0x88(%rbp) movq -0x88(%rbp), %rax testb $0x1, 0x60(%rax) jne 0x5cc3d movq -0x88(%rbp), %rax movq -0x58(%rbp), %rdi movl -0x50(%rbp), %esi movq 0x238(%rax), %rdx movl 0x240(%rax), %ecx callq 0xb180 movq %rax, -0x48(%rbp) movq -0x48(%rbp), %rax cmpq -0x40(%rbp), %rax jle 0x5cc3b movq -0x48(%rbp), %rax movq %rax, -0x40(%rbp) movq -0x88(%rbp), %rax movq %rax, -0x60(%rbp) movq -0x68(%rbp), %rax movq %rax, -0x70(%rbp) jmp 0x5cc3d movq -0x30(%rbp), %rax movq 0x10(%rax), %rax movq %rax, -0x30(%rbp) jmp 0x5cbd0 leaq -0x28(%rbp), %rdi callq 0x3de60 movq %rax, -0x38(%rbp) jmp 0x5cbad cmpq $0x0, -0x60(%rbp) je 0x5cc85 movq -0x70(%rbp), %rdi movq -0x60(%rbp), %rsi callq 0x5c7c0 movq -0x10(%rbp), %rax movq 0x30(%rax), %rcx addq $-0x1, %rcx movq %rcx, 0x30(%rax) jmp 0x5cc83 jmp 0x5cc85 movq -0x8(%rbp), %rax cmpq $0x0, 0xb8(%rax) je 0x5cca1 movq -0x8(%rbp), %rdi movl $0x5, %esi callq 0x450f0 movq -0x60(%rbp), %rax addq $0x90, %rsp popq %rbp retq nop
/macressler[P]curl/lib/conncache.c
Curl_pipeline_penalized
bool Curl_pipeline_penalized(struct Curl_easy *data, struct connectdata *conn) { if(data) { bool penalized = FALSE; curl_off_t penalty_size = Curl_multi_content_length_penalty_size(data->multi); curl_off_t chunk_penalty_size = Curl_multi_chunk_length_penalty_size(data->multi); curl_off_t recv_size = -2; /* Make it easy to spot in the log */ /* Find the head of the recv pipe, if any */ if(conn->recv_pipe.head) { struct Curl_easy *recv_handle = conn->recv_pipe.head->ptr; recv_size = recv_handle->req.size; if(penalty_size > 0 && recv_size > penalty_size) penalized = TRUE; } if(chunk_penalty_size > 0 && (curl_off_t)conn->chunk.datasize > chunk_penalty_size) penalized = TRUE; infof(data, "Conn: %ld (%p) Receive pipe weight: (%" CURL_FORMAT_CURL_OFF_T "/%zu), penalized: %s\n", conn->connection_id, (void *)conn, recv_size, conn->chunk.datasize, penalized?"TRUE":"FALSE"); return penalized; } return FALSE; }
pushq %rbp movq %rsp, %rbp subq $0x50, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) cmpq $0x0, -0x10(%rbp) je 0x5d0a0 movb $0x0, -0x19(%rbp) movq -0x10(%rbp), %rax movq 0xa8(%rax), %rdi callq 0x42c40 movq %rax, -0x28(%rbp) movq -0x10(%rbp), %rax movq 0xa8(%rax), %rdi callq 0x42c70 movq %rax, -0x30(%rbp) movq $-0x2, -0x38(%rbp) movq -0x18(%rbp), %rax cmpq $0x0, 0x468(%rax) je 0x5d035 movq -0x18(%rbp), %rax movq 0x468(%rax), %rax movq (%rax), %rax movq %rax, -0x40(%rbp) movq -0x40(%rbp), %rax movq 0xc0(%rax), %rax movq %rax, -0x38(%rbp) cmpq $0x0, -0x28(%rbp) jle 0x5d033 movq -0x38(%rbp), %rax cmpq -0x28(%rbp), %rax jle 0x5d033 movb $0x1, -0x19(%rbp) jmp 0x5d035 cmpq $0x0, -0x30(%rbp) jle 0x5d04e movq -0x18(%rbp), %rax movq 0x40(%rax), %rax cmpq -0x30(%rbp), %rax jle 0x5d04e movb $0x1, -0x19(%rbp) movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rax movq 0x68(%rax), %rdx movq -0x18(%rbp), %rcx movq -0x38(%rbp), %r8 movq -0x18(%rbp), %rax movq 0x40(%rax), %r9 movb -0x19(%rbp), %r10b leaq 0x1e5a1(%rip), %rax # 0x7b616 leaq 0x1e595(%rip), %rsi # 0x7b611 testb $0x1, %r10b cmovneq %rsi, %rax leaq 0x25a05(%rip), %rsi # 0x82a90 movq %rax, (%rsp) movb $0x0, %al callq 0x19d00 movb -0x19(%rbp), %al andb $0x1, %al movb %al, -0x1(%rbp) jmp 0x5d0a4 movb $0x0, -0x1(%rbp) movb -0x1(%rbp), %al andb $0x1, %al addq $0x50, %rsp popq %rbp retq nop
/macressler[P]curl/lib/pipeline.c
Curl_add_handle_to_pipeline
CURLcode Curl_add_handle_to_pipeline(struct Curl_easy *handle, struct connectdata *conn) { struct curl_llist_element *sendhead = conn->send_pipe.head; struct curl_llist *pipeline; CURLcode result; pipeline = &conn->send_pipe; result = addHandleToPipeline(handle, pipeline); if(pipeline == &conn->send_pipe && sendhead != conn->send_pipe.head) { /* this is a new one as head, expire it */ Curl_pipeline_leave_write(conn); /* not in use yet */ Curl_expire(conn->send_pipe.head->ptr, 0, EXPIRE_RUN_NOW); } #if 0 /* enable for pipeline debugging */ print_pipeline(conn); #endif return result; }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movq -0x10(%rbp), %rax movq 0x448(%rax), %rax movq %rax, -0x18(%rbp) movq -0x10(%rbp), %rax addq $0x448, %rax # imm = 0x448 movq %rax, -0x20(%rbp) movq -0x8(%rbp), %rdi movq -0x20(%rbp), %rsi callq 0x5d140 movl %eax, -0x24(%rbp) movq -0x20(%rbp), %rax movq -0x10(%rbp), %rcx addq $0x448, %rcx # imm = 0x448 cmpq %rcx, %rax jne 0x5d137 movq -0x18(%rbp), %rax movq -0x10(%rbp), %rcx cmpq 0x448(%rcx), %rax je 0x5d137 movq -0x10(%rbp), %rdi callq 0x5d180 movq -0x10(%rbp), %rax movq 0x448(%rax), %rax movq (%rax), %rdi xorl %eax, %eax movl %eax, %esi movl $0x6, %edx callq 0x3e460 movl -0x24(%rbp), %eax addq $0x30, %rsp popq %rbp retq
/macressler[P]curl/lib/pipeline.c
smb_setup_connection
static CURLcode smb_setup_connection(struct connectdata *conn) { struct smb_request *req; /* Initialize the request state */ conn->data->req.protop = req = calloc(1, sizeof(struct smb_request)); if(!req) return CURLE_OUT_OF_MEMORY; /* Parse the URL path */ return smb_parse_url_path(conn); }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x10(%rbp) movl $0x1, %edi movl $0x20, %esi leaq 0x35e2b(%rip), %rax # 0x93a68 callq *(%rax) movq %rax, %rcx movq %rcx, -0x18(%rbp) movq -0x10(%rbp), %rax movq (%rax), %rax movq %rcx, 0x1e8(%rax) cmpq $0x0, -0x18(%rbp) jne 0x5dc64 movl $0x1b, -0x4(%rbp) jmp 0x5dc70 movq -0x10(%rbp), %rdi callq 0x5e750 movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x20, %rsp popq %rbp retq nopl (%rax)
/macressler[P]curl/lib/smb.c
curl_mime_init
curl_mime *curl_mime_init(struct Curl_easy *easy) { curl_mime *mime; mime = (curl_mime *) malloc(sizeof *mime); if(mime) { mime->easy = easy; mime->parent = NULL; mime->firstpart = NULL; mime->lastpart = NULL; /* Get a part boundary. */ mime->boundary = malloc(24 + MIME_RAND_BOUNDARY_CHARS + 1); if(!mime->boundary) { free(mime); return NULL; } memset(mime->boundary, '-', 24); Curl_rand_hex(easy, (unsigned char *) mime->boundary + 24, MIME_RAND_BOUNDARY_CHARS + 1); mimesetstate(&mime->state, MIMESTATE_BEGIN, NULL); } return mime; }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x10(%rbp) movl $0x40, %edi leaq 0x338e0(%rip), %rax # 0x93a48 callq *(%rax) movq %rax, -0x18(%rbp) cmpq $0x0, -0x18(%rbp) je 0x6022a movq -0x10(%rbp), %rcx movq -0x18(%rbp), %rax movq %rcx, (%rax) movq -0x18(%rbp), %rax movq $0x0, 0x8(%rax) movq -0x18(%rbp), %rax movq $0x0, 0x10(%rax) movq -0x18(%rbp), %rax movq $0x0, 0x18(%rax) movl $0x29, %edi leaq 0x33894(%rip), %rax # 0x93a48 callq *(%rax) movq %rax, %rcx movq -0x18(%rbp), %rax movq %rcx, 0x20(%rax) movq -0x18(%rbp), %rax cmpq $0x0, 0x20(%rax) jne 0x601e6 leaq 0x3387d(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x18(%rbp), %rdi callq *%rax movq $0x0, -0x8(%rbp) jmp 0x60232 movq -0x18(%rbp), %rax movq 0x20(%rax), %rdi movl $0x2d, %esi movl $0x18, %edx callq 0x9520 movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rax movq 0x20(%rax), %rsi addq $0x18, %rsi movl $0x11, %edx callq 0x5bb60 movq -0x18(%rbp), %rdi addq $0x28, %rdi xorl %esi, %esi xorl %eax, %eax movl %eax, %edx callq 0x60590 movq -0x18(%rbp), %rax movq %rax, -0x8(%rbp) movq -0x8(%rbp), %rax addq $0x20, %rsp popq %rbp retq nopl (%rax)
/macressler[P]curl/lib/mime.c
mime_file_free
static void mime_file_free(void *ptr) { curl_mimepart *part = (curl_mimepart *) ptr; if(part->fp) { fclose(part->fp); part->fp = NULL; } Curl_safefree(part->data); part->data = NULL; }
pushq %rbp movq %rsp, %rbp subq $0x10, %rsp movq %rdi, -0x8(%rbp) movq -0x8(%rbp), %rax movq %rax, -0x10(%rbp) movq -0x10(%rbp), %rax cmpq $0x0, 0x48(%rax) je 0x60858 movq -0x10(%rbp), %rax movq 0x48(%rax), %rdi callq 0x9980 movq -0x10(%rbp), %rax movq $0x0, 0x48(%rax) jmp 0x6085a leaq 0x331ef(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x10(%rbp), %rcx movq 0x20(%rcx), %rdi callq *%rax movq -0x10(%rbp), %rax movq $0x0, 0x20(%rax) movq -0x10(%rbp), %rax movq $0x0, 0x20(%rax) addq $0x10, %rsp popq %rbp retq nopl (%rax)
/macressler[P]curl/lib/mime.c
slist_size
static size_t slist_size(struct curl_slist *s, size_t overhead, const char *skip) { size_t size = 0; size_t skiplen = skip? strlen(skip): 0; for(; s; s = s->next) if(!skip || !match_header(s, skip, skiplen)) size += strlen(s->data) + overhead; return size; }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movq %rdx, -0x18(%rbp) movq $0x0, -0x20(%rbp) cmpq $0x0, -0x18(%rbp) je 0x61542 movq -0x18(%rbp), %rdi callq 0x93b0 movq %rax, -0x30(%rbp) jmp 0x6154a xorl %eax, %eax movq %rax, -0x30(%rbp) jmp 0x6154a movq -0x30(%rbp), %rax movq %rax, -0x28(%rbp) cmpq $0x0, -0x8(%rbp) je 0x6159f cmpq $0x0, -0x18(%rbp) je 0x61577 movq -0x8(%rbp), %rdi movq -0x18(%rbp), %rsi movq -0x28(%rbp), %rdx callq 0x62a70 cmpq $0x0, %rax jne 0x6158f movq -0x8(%rbp), %rax movq (%rax), %rdi callq 0x93b0 addq -0x10(%rbp), %rax addq -0x20(%rbp), %rax movq %rax, -0x20(%rbp) jmp 0x61591 movq -0x8(%rbp), %rax movq 0x8(%rax), %rax movq %rax, -0x8(%rbp) jmp 0x61552 movq -0x20(%rbp), %rax addq $0x30, %rsp popq %rbp retq nopl (%rax)
/macressler[P]curl/lib/mime.c
search_header
static char *search_header(struct curl_slist *hdrlist, const char *hdr) { size_t len = strlen(hdr); char *value = NULL; for(; !value && hdrlist; hdrlist = hdrlist->next) value = match_header(hdrlist, hdr, len); return value; }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movq -0x10(%rbp), %rdi callq 0x93b0 movq %rax, -0x18(%rbp) movq $0x0, -0x20(%rbp) xorl %eax, %eax cmpq $0x0, -0x20(%rbp) movb %al, -0x21(%rbp) jne 0x61dbc cmpq $0x0, -0x8(%rbp) setne %al movb %al, -0x21(%rbp) movb -0x21(%rbp), %al testb $0x1, %al jne 0x61dc5 jmp 0x61de8 movq -0x8(%rbp), %rdi movq -0x10(%rbp), %rsi movq -0x18(%rbp), %rdx callq 0x62a70 movq %rax, -0x20(%rbp) movq -0x8(%rbp), %rax movq 0x8(%rax), %rax movq %rax, -0x8(%rbp) jmp 0x61da5 movq -0x20(%rbp), %rax addq $0x30, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/macressler[P]curl/lib/mime.c
setstropt_userpwd
static CURLcode setstropt_userpwd(char *option, char **userp, char **passwdp) { CURLcode result = CURLE_OK; char *user = NULL; char *passwd = NULL; /* Parse the login details if specified. It not then we treat NULL as a hint to clear the existing data */ if(option) { result = Curl_parse_login_details(option, strlen(option), (userp ? &user : NULL), (passwdp ? &passwd : NULL), NULL); } if(!result) { /* Store the username part of option if required */ if(userp) { if(!user && option && option[0] == ':') { /* Allocate an empty string instead of returning NULL as user name */ user = strdup(""); if(!user) result = CURLE_OUT_OF_MEMORY; } Curl_safefree(*userp); *userp = user; } /* Store the password part of option if required */ if(passwdp) { Curl_safefree(*passwdp); *passwdp = passwd; } } return result; }
pushq %rbp movq %rsp, %rbp subq $0x60, %rsp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movq %rdx, -0x18(%rbp) movl $0x0, -0x1c(%rbp) movq $0x0, -0x28(%rbp) movq $0x0, -0x30(%rbp) cmpq $0x0, -0x8(%rbp) je 0x6cbee movq -0x8(%rbp), %rax movq %rax, -0x40(%rbp) movq -0x8(%rbp), %rdi callq 0x93b0 movq %rax, -0x38(%rbp) cmpq $0x0, -0x10(%rbp) je 0x6cba8 leaq -0x28(%rbp), %rax movq %rax, -0x48(%rbp) jmp 0x6cbb0 xorl %eax, %eax movq %rax, -0x48(%rbp) jmp 0x6cbb0 movq -0x48(%rbp), %rax movq %rax, -0x50(%rbp) cmpq $0x0, -0x18(%rbp) je 0x6cbc9 leaq -0x30(%rbp), %rax movq %rax, -0x58(%rbp) jmp 0x6cbd1 xorl %eax, %eax movq %rax, -0x58(%rbp) jmp 0x6cbd1 movq -0x50(%rbp), %rdx movq -0x38(%rbp), %rsi movq -0x40(%rbp), %rdi movq -0x58(%rbp), %rcx xorl %eax, %eax movl %eax, %r8d callq 0x245b0 movl %eax, -0x1c(%rbp) cmpl $0x0, -0x1c(%rbp) jne 0x6cc9c cmpq $0x0, -0x10(%rbp) je 0x6cc68 cmpq $0x0, -0x28(%rbp) jne 0x6cc3d cmpq $0x0, -0x8(%rbp) je 0x6cc3d movq -0x8(%rbp), %rax movsbl (%rax), %eax cmpl $0x3a, %eax jne 0x6cc3d leaq 0x1688c(%rip), %rdi # 0x834ac leaq 0x26e39(%rip), %rax # 0x93a60 callq *(%rax) movq %rax, -0x28(%rbp) cmpq $0x0, -0x28(%rbp) jne 0x6cc3b movl $0x1b, -0x1c(%rbp) jmp 0x6cc3d jmp 0x6cc3f leaq 0x26e0a(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x10(%rbp), %rcx movq (%rcx), %rdi callq *%rax movq -0x10(%rbp), %rax movq $0x0, (%rax) movq -0x28(%rbp), %rcx movq -0x10(%rbp), %rax movq %rcx, (%rax) cmpq $0x0, -0x18(%rbp) je 0x6cc9a jmp 0x6cc71 leaq 0x26dd8(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x18(%rbp), %rcx movq (%rcx), %rdi callq *%rax movq -0x18(%rbp), %rax movq $0x0, (%rax) movq -0x30(%rbp), %rcx movq -0x18(%rbp), %rax movq %rcx, (%rax) jmp 0x6cc9c movl -0x1c(%rbp), %eax addq $0x60, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/macressler[P]curl/lib/setopt.c
curl_easy_setopt
CURLcode curl_easy_setopt(struct Curl_easy *data, CURLoption tag, ...) { va_list arg; CURLcode result; if(!data) return CURLE_BAD_FUNCTION_ARGUMENT; va_start(arg, tag); result = Curl_vsetopt(data, tag, arg); va_end(arg); return result; }
pushq %rbp movq %rsp, %rbp subq $0xf0, %rsp testb %al, %al je 0x6cceb movaps %xmm0, -0xc0(%rbp) movaps %xmm1, -0xb0(%rbp) movaps %xmm2, -0xa0(%rbp) movaps %xmm3, -0x90(%rbp) movaps %xmm4, -0x80(%rbp) movaps %xmm5, -0x70(%rbp) movaps %xmm6, -0x60(%rbp) movaps %xmm7, -0x50(%rbp) movq %r9, -0xc8(%rbp) movq %r8, -0xd0(%rbp) movq %rcx, -0xd8(%rbp) movq %rdx, -0xe0(%rbp) movq %rdi, -0x10(%rbp) movl %esi, -0x14(%rbp) cmpq $0x0, -0x10(%rbp) jne 0x6cd1e movl $0x2b, -0x4(%rbp) jmp 0x6cd5f leaq -0x30(%rbp), %rax leaq -0xf0(%rbp), %rcx movq %rcx, 0x10(%rax) leaq 0x10(%rbp), %rcx movq %rcx, 0x8(%rax) movl $0x30, 0x4(%rax) movl $0x10, (%rax) movq -0x10(%rbp), %rdi movl -0x14(%rbp), %esi leaq -0x30(%rbp), %rdx callq 0x62ea0 movl %eax, -0x34(%rbp) leaq -0x30(%rbp), %rax movl -0x34(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0xf0, %rsp popq %rbp retq nopl (%rax,%rax)
/macressler[P]curl/lib/setopt.c
Curl_auth_create_plain_message
CURLcode Curl_auth_create_plain_message(struct Curl_easy *data, const char *userp, const char *passwdp, char **outptr, size_t *outlen) { CURLcode result; char *plainauth; size_t ulen; size_t plen; size_t plainlen; *outlen = 0; *outptr = NULL; ulen = strlen(userp); plen = strlen(passwdp); /* Compute binary message length. Check for overflows. */ if((ulen > SIZE_T_MAX/2) || (plen > (SIZE_T_MAX/2 - 2))) return CURLE_OUT_OF_MEMORY; plainlen = 2 * ulen + plen + 2; plainauth = malloc(plainlen); if(!plainauth) return CURLE_OUT_OF_MEMORY; /* Calculate the reply */ memcpy(plainauth, userp, ulen); plainauth[ulen] = '\0'; memcpy(plainauth + ulen + 1, userp, ulen); plainauth[2 * ulen + 1] = '\0'; memcpy(plainauth + 2 * ulen + 2, passwdp, plen); /* Base64 encode the reply */ result = Curl_base64_encode(data, plainauth, plainlen, outptr, outlen); free(plainauth); return result; }
pushq %rbp movq %rsp, %rbp subq $0x60, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq %rdx, -0x20(%rbp) movq %rcx, -0x28(%rbp) movq %r8, -0x30(%rbp) movq -0x30(%rbp), %rax movq $0x0, (%rax) movq -0x28(%rbp), %rax movq $0x0, (%rax) movq -0x18(%rbp), %rdi callq 0x93b0 movq %rax, -0x48(%rbp) movq -0x20(%rbp), %rdi callq 0x93b0 movq %rax, -0x50(%rbp) movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF cmpq %rax, -0x48(%rbp) ja 0x6d94c movabsq $0x7ffffffffffffffd, %rax # imm = 0x7FFFFFFFFFFFFFFD cmpq %rax, -0x50(%rbp) jbe 0x6d958 movl $0x1b, -0x4(%rbp) jmp 0x6da29 movq -0x48(%rbp), %rax shlq %rax addq -0x50(%rbp), %rax addq $0x2, %rax movq %rax, -0x58(%rbp) leaq 0x260d6(%rip), %rax # 0x93a48 movq (%rax), %rax movq -0x58(%rbp), %rdi callq *%rax movq %rax, -0x40(%rbp) cmpq $0x0, -0x40(%rbp) jne 0x6d992 movl $0x1b, -0x4(%rbp) jmp 0x6da29 movq -0x40(%rbp), %rdi movq -0x18(%rbp), %rsi movq -0x48(%rbp), %rdx callq 0x97b0 movq -0x40(%rbp), %rax movq -0x48(%rbp), %rcx movb $0x0, (%rax,%rcx) movq -0x40(%rbp), %rdi addq -0x48(%rbp), %rdi addq $0x1, %rdi movq -0x18(%rbp), %rsi movq -0x48(%rbp), %rdx callq 0x97b0 movq -0x40(%rbp), %rax movq -0x48(%rbp), %rcx shlq %rcx movb $0x0, 0x1(%rax,%rcx) movq -0x40(%rbp), %rdi movq -0x48(%rbp), %rax shlq %rax addq %rax, %rdi addq $0x2, %rdi movq -0x20(%rbp), %rsi movq -0x50(%rbp), %rdx callq 0x97b0 movq -0x10(%rbp), %rdi movq -0x40(%rbp), %rsi movq -0x58(%rbp), %rdx movq -0x28(%rbp), %rcx movq -0x30(%rbp), %r8 callq 0xb630 movl %eax, -0x34(%rbp) leaq 0x26036(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x40(%rbp), %rdi callq *%rax movl -0x34(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x60, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/macressler[P]curl/lib/vauth/cleartext.c
Curl_auth_create_login_message
CURLcode Curl_auth_create_login_message(struct Curl_easy *data, const char *valuep, char **outptr, size_t *outlen) { size_t vlen = strlen(valuep); if(!vlen) { /* Calculate an empty reply */ *outptr = strdup("="); if(*outptr) { *outlen = (size_t) 1; return CURLE_OK; } *outlen = 0; return CURLE_OUT_OF_MEMORY; } /* Base64 encode the value */ return Curl_base64_encode(data, valuep, vlen, outptr, outlen); }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq %rdx, -0x20(%rbp) movq %rcx, -0x28(%rbp) movq -0x18(%rbp), %rdi callq 0x93b0 movq %rax, -0x30(%rbp) cmpq $0x0, -0x30(%rbp) jne 0x6dab8 leaq 0x14f6d(%rip), %rdi # 0x829e0 leaq 0x25fe6(%rip), %rax # 0x93a60 callq *(%rax) movq %rax, %rcx movq -0x20(%rbp), %rax movq %rcx, (%rax) movq -0x20(%rbp), %rax cmpq $0x0, (%rax) je 0x6daa4 movq -0x28(%rbp), %rax movq $0x1, (%rax) movl $0x0, -0x4(%rbp) jmp 0x6dad4 movq -0x28(%rbp), %rax movq $0x0, (%rax) movl $0x1b, -0x4(%rbp) jmp 0x6dad4 movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi movq -0x30(%rbp), %rdx movq -0x20(%rbp), %rcx movq -0x28(%rbp), %r8 callq 0xb630 movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x30, %rsp popq %rbp retq nopl (%rax)
/macressler[P]curl/lib/vauth/cleartext.c
Curl_auth_decode_cram_md5_message
CURLcode Curl_auth_decode_cram_md5_message(const char *chlg64, char **outptr, size_t *outlen) { CURLcode result = CURLE_OK; size_t chlg64len = strlen(chlg64); *outptr = NULL; *outlen = 0; /* Decode the challenge if necessary */ if(chlg64len && *chlg64 != '=') result = Curl_base64_decode(chlg64, (unsigned char **) outptr, outlen); return result; }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movq %rdx, -0x18(%rbp) movl $0x0, -0x1c(%rbp) movq -0x8(%rbp), %rdi callq 0x93b0 movq %rax, -0x28(%rbp) movq -0x10(%rbp), %rax movq $0x0, (%rax) movq -0x18(%rbp), %rax movq $0x0, (%rax) cmpq $0x0, -0x28(%rbp) je 0x6db85 movq -0x8(%rbp), %rax movsbl (%rax), %eax cmpl $0x3d, %eax je 0x6db85 movq -0x8(%rbp), %rdi movq -0x10(%rbp), %rsi movq -0x18(%rbp), %rdx callq 0xb290 movl %eax, -0x1c(%rbp) movl -0x1c(%rbp), %eax addq $0x30, %rsp popq %rbp retq nop
/macressler[P]curl/lib/vauth/cram.c
Curl_auth_create_cram_md5_message
CURLcode Curl_auth_create_cram_md5_message(struct Curl_easy *data, const char *chlg, const char *userp, const char *passwdp, char **outptr, size_t *outlen) { CURLcode result = CURLE_OK; size_t chlglen = 0; HMAC_context *ctxt; unsigned char digest[MD5_DIGEST_LEN]; char *response; if(chlg) chlglen = strlen(chlg); /* Compute the digest using the password as the key */ ctxt = Curl_HMAC_init(Curl_HMAC_MD5, (const unsigned char *) passwdp, curlx_uztoui(strlen(passwdp))); if(!ctxt) return CURLE_OUT_OF_MEMORY; /* Update the digest with the given challenge */ if(chlglen > 0) Curl_HMAC_update(ctxt, (const unsigned char *) chlg, curlx_uztoui(chlglen)); /* Finalise the digest */ Curl_HMAC_final(ctxt, digest); /* Generate the response */ response = aprintf( "%s %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", userp, digest[0], digest[1], digest[2], digest[3], digest[4], digest[5], digest[6], digest[7], digest[8], digest[9], digest[10], digest[11], digest[12], digest[13], digest[14], digest[15]); if(!response) return CURLE_OUT_OF_MEMORY; /* Base64 encode the response */ result = Curl_base64_encode(data, response, 0, outptr, outlen); free(response); return result; }
pushq %rbp movq %rsp, %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0xf8, %rsp movq %rdi, -0x38(%rbp) movq %rsi, -0x40(%rbp) movq %rdx, -0x48(%rbp) movq %rcx, -0x50(%rbp) movq %r8, -0x58(%rbp) movq %r9, -0x60(%rbp) movl $0x0, -0x64(%rbp) movq $0x0, -0x70(%rbp) cmpq $0x0, -0x40(%rbp) je 0x6dbdf movq -0x40(%rbp), %rdi callq 0x93b0 movq %rax, -0x70(%rbp) movq -0x50(%rbp), %rax movq %rax, -0xa0(%rbp) movq -0x50(%rbp), %rdi callq 0x93b0 movq %rax, %rdi callq 0x572d0 movq -0xa0(%rbp), %rsi movl %eax, %edx leaq 0x24635(%rip), %rdi # 0x92240 callq 0x57420 movq %rax, -0x78(%rbp) cmpq $0x0, -0x78(%rbp) jne 0x6dc27 movl $0x1b, -0x2c(%rbp) jmp 0x6ddb3 cmpq $0x0, -0x70(%rbp) jbe 0x6dc62 movq -0x78(%rbp), %rax movq %rax, -0xb0(%rbp) movq -0x40(%rbp), %rax movq %rax, -0xa8(%rbp) movq -0x70(%rbp), %rdi callq 0x572d0 movq -0xb0(%rbp), %rdi movq -0xa8(%rbp), %rsi movl %eax, %edx callq 0x57630 movq -0x78(%rbp), %rdi leaq -0x90(%rbp), %rsi callq 0x57670 movq -0x48(%rbp), %rsi movzbl -0x90(%rbp), %edx movzbl -0x8f(%rbp), %ecx movzbl -0x8e(%rbp), %r8d movzbl -0x8d(%rbp), %r9d movzbl -0x8c(%rbp), %eax movzbl -0x8b(%rbp), %edi movl %edi, -0xc0(%rbp) movzbl -0x8a(%rbp), %edi movl %edi, -0xbc(%rbp) movzbl -0x89(%rbp), %edi movl %edi, -0xb8(%rbp) movzbl -0x88(%rbp), %r13d movzbl -0x87(%rbp), %r12d movzbl -0x86(%rbp), %r15d movzbl -0x85(%rbp), %r14d movzbl -0x84(%rbp), %ebx movzbl -0x83(%rbp), %r11d movzbl -0x82(%rbp), %r10d movzbl -0x81(%rbp), %edi movl %edi, -0xb4(%rbp) leaq 0x15326(%rip), %rdi # 0x83033 movl %eax, (%rsp) movl -0xc0(%rbp), %eax movl %eax, 0x8(%rsp) movl -0xbc(%rbp), %eax movl %eax, 0x10(%rsp) movl -0xb8(%rbp), %eax movl %eax, 0x18(%rsp) movl -0xb4(%rbp), %eax movl %r13d, 0x20(%rsp) movl %r12d, 0x28(%rsp) movl %r15d, 0x30(%rsp) movl %r14d, 0x38(%rsp) movl %ebx, 0x40(%rsp) movl %r11d, 0x48(%rsp) movl %r10d, 0x50(%rsp) movl %eax, 0x58(%rsp) movb $0x0, %al callq 0x9810 movq %rax, -0x98(%rbp) cmpq $0x0, -0x98(%rbp) jne 0x6dd7b movl $0x1b, -0x2c(%rbp) jmp 0x6ddb3 movq -0x38(%rbp), %rdi movq -0x98(%rbp), %rsi movq -0x58(%rbp), %rcx movq -0x60(%rbp), %r8 xorl %eax, %eax movl %eax, %edx callq 0xb630 movl %eax, -0x64(%rbp) leaq 0x25caf(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x98(%rbp), %rdi callq *%rax movl -0x64(%rbp), %eax movl %eax, -0x2c(%rbp) movl -0x2c(%rbp), %eax addq $0xf8, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq nopl (%rax,%rax)
/macressler[P]curl/lib/vauth/cram.c
Curl_auth_create_digest_http_message
CURLcode Curl_auth_create_digest_http_message(struct Curl_easy *data, const char *userp, const char *passwdp, const unsigned char *request, const unsigned char *uripath, struct digestdata *digest, char **outptr, size_t *outlen) { switch(digest->algo) { case CURLDIGESTALGO_MD5: case CURLDIGESTALGO_MD5SESS: return _Curl_auth_create_digest_http_message(data, userp, passwdp, request, uripath, digest, outptr, outlen, auth_digest_md5_to_ascii, Curl_md5it); case CURLDIGESTALGO_SHA256: case CURLDIGESTALGO_SHA256SESS: case CURLDIGESTALGO_SHA512_256: case CURLDIGESTALGO_SHA512_256SESS: return _Curl_auth_create_digest_http_message(data, userp, passwdp, request, uripath, digest, outptr, outlen, auth_digest_sha256_to_ascii, Curl_sha256it); default: return CURLE_UNSUPPORTED_PROTOCOL; } }
pushq %rbp movq %rsp, %rbp pushq %rbx subq $0x68, %rsp movq 0x18(%rbp), %rax movq 0x10(%rbp), %rax movq %rdi, -0x18(%rbp) movq %rsi, -0x20(%rbp) movq %rdx, -0x28(%rbp) movq %rcx, -0x30(%rbp) movq %r8, -0x38(%rbp) movq %r9, -0x40(%rbp) movq -0x40(%rbp), %rax movl 0x18(%rax), %eax movl %eax, -0x44(%rbp) subl $0x2, %eax jb 0x6f1ea jmp 0x6f1da movl -0x44(%rbp), %eax addl $-0x2, %eax subl $0x4, %eax jb 0x6f235 jmp 0x6f280 movq -0x18(%rbp), %rdi movq -0x20(%rbp), %rsi movq -0x28(%rbp), %rdx movq -0x30(%rbp), %rcx movq -0x38(%rbp), %r8 movq -0x40(%rbp), %r9 movq 0x10(%rbp), %rbx movq 0x18(%rbp), %r11 leaq 0x87f(%rip), %r10 # 0x6fa90 leaq -0x29cc8(%rip), %rax # 0x45550 movq %rbx, (%rsp) movq %r11, 0x8(%rsp) movq %r10, 0x10(%rsp) movq %rax, 0x18(%rsp) callq 0x6f2a0 movl %eax, -0xc(%rbp) jmp 0x6f287 movq -0x18(%rbp), %rdi movq -0x20(%rbp), %rsi movq -0x28(%rbp), %rdx movq -0x30(%rbp), %rcx movq -0x38(%rbp), %r8 movq -0x40(%rbp), %r9 movq 0x10(%rbp), %rbx movq 0x18(%rbp), %r11 leaq 0x894(%rip), %r10 # 0x6faf0 leaq -0xc4b3(%rip), %rax # 0x62db0 movq %rbx, (%rsp) movq %r11, 0x8(%rsp) movq %r10, 0x10(%rsp) movq %rax, 0x18(%rsp) callq 0x6f2a0 movl %eax, -0xc(%rbp) jmp 0x6f287 movl $0x1, -0xc(%rbp) movl -0xc(%rbp), %eax addq $0x68, %rsp popq %rbx popq %rbp retq nopw %cs:(%rax,%rax)
/macressler[P]curl/lib/vauth/digest.c
Curl_auth_create_digest_http_message
static CURLcode _Curl_auth_create_digest_http_message( struct Curl_easy *data, const char *userp, const char *passwdp, const unsigned char *request, const unsigned char *uripath, struct digestdata *digest, char **outptr, size_t *outlen, void (*convert_to_ascii)(unsigned char *, unsigned char *), void (*hash)(unsigned char *, const unsigned char *)) { CURLcode result; unsigned char hashbuf[32]; /* 32 bytes/256 bits */ unsigned char request_digest[65]; unsigned char *hashthis; unsigned char ha1[65]; /* 64 digits and 1 zero byte */ unsigned char ha2[65]; /* 64 digits and 1 zero byte */ char userh[65]; char cnoncebuf[33]; char *cnonce = NULL; size_t cnonce_sz = 0; char *userp_quoted; char *response = NULL; char *tmp = NULL; if(!digest->nc) digest->nc = 1; if(!digest->cnonce) { result = Curl_rand_hex(data, (unsigned char *)cnoncebuf, sizeof(cnoncebuf)); if(result) return result; result = Curl_base64_encode(data, cnoncebuf, strlen(cnoncebuf), &cnonce, &cnonce_sz); if(result) return result; digest->cnonce = cnonce; } if(digest->userhash) { hashthis = (unsigned char *) aprintf("%s:%s", userp, digest->realm); if(!hashthis) return CURLE_OUT_OF_MEMORY; CURL_OUTPUT_DIGEST_CONV(data, hashthis); hash(hashbuf, hashthis); free(hashthis); convert_to_ascii(hashbuf, (unsigned char *)userh); } /* If the algorithm is "MD5" or unspecified (which then defaults to MD5): A1 = unq(username-value) ":" unq(realm-value) ":" passwd If the algorithm is "MD5-sess" then: A1 = H(unq(username-value) ":" unq(realm-value) ":" passwd) ":" unq(nonce-value) ":" unq(cnonce-value) */ hashthis = (unsigned char *) aprintf("%s:%s:%s", digest->userhash ? userh : userp, digest->realm, passwdp); if(!hashthis) return CURLE_OUT_OF_MEMORY; CURL_OUTPUT_DIGEST_CONV(data, hashthis); /* convert on non-ASCII machines */ hash(hashbuf, hashthis); free(hashthis); convert_to_ascii(hashbuf, ha1); if(digest->algo == CURLDIGESTALGO_MD5SESS || digest->algo == CURLDIGESTALGO_SHA256SESS || digest->algo == CURLDIGESTALGO_SHA512_256SESS) { /* nonce and cnonce are OUTSIDE the hash */ tmp = aprintf("%s:%s:%s", ha1, digest->nonce, digest->cnonce); if(!tmp) return CURLE_OUT_OF_MEMORY; CURL_OUTPUT_DIGEST_CONV(data, tmp); /* Convert on non-ASCII machines */ hash(hashbuf, (unsigned char *) tmp); free(tmp); convert_to_ascii(hashbuf, ha1); } /* If the "qop" directive's value is "auth" or is unspecified, then A2 is: A2 = Method ":" digest-uri-value If the "qop" value is "auth-int", then A2 is: A2 = Method ":" digest-uri-value ":" H(entity-body) (The "Method" value is the HTTP request method as specified in section 5.1.1 of RFC 2616) */ hashthis = (unsigned char *) aprintf("%s:%s", request, uripath); if(digest->qop && strcasecompare(digest->qop, "auth-int")) { /* We don't support auth-int for PUT or POST at the moment. TODO: replace hash of empty string with entity-body for PUT/POST */ char hashed[65]; unsigned char *hashthis2; hash(hashbuf, (const unsigned char *)""); convert_to_ascii(hashbuf, (unsigned char *)hashed); hashthis2 = (unsigned char *)aprintf("%s:%s", hashthis, hashed); free(hashthis); hashthis = hashthis2; } if(!hashthis) return CURLE_OUT_OF_MEMORY; CURL_OUTPUT_DIGEST_CONV(data, hashthis); /* convert on non-ASCII machines */ hash(hashbuf, hashthis); free(hashthis); convert_to_ascii(hashbuf, ha2); if(digest->qop) { hashthis = (unsigned char *) aprintf("%s:%s:%08x:%s:%s:%s", ha1, digest->nonce, digest->nc, digest->cnonce, digest->qop, ha2); } else { hashthis = (unsigned char *) aprintf("%s:%s:%s", ha1, digest->nonce, ha2); } if(!hashthis) return CURLE_OUT_OF_MEMORY; CURL_OUTPUT_DIGEST_CONV(data, hashthis); /* convert on non-ASCII machines */ hash(hashbuf, hashthis); free(hashthis); convert_to_ascii(hashbuf, request_digest); /* For test case 64 (snooped from a Mozilla 1.3a request) Authorization: Digest username="testuser", realm="testrealm", \ nonce="1053604145", uri="/64", response="c55f7f30d83d774a3d2dcacf725abaca" Digest parameters are all quoted strings. Username which is provided by the user will need double quotes and backslashes within it escaped. For the other fields, this shouldn't be an issue. realm, nonce, and opaque are copied as is from the server, escapes and all. cnonce is generated with web-safe characters. uri is already percent encoded. nc is 8 hex characters. algorithm and qop with standard values only contain web-safe characters. */ userp_quoted = auth_digest_string_quoted(digest->userhash ? userh : userp); if(!userp_quoted) return CURLE_OUT_OF_MEMORY; if(digest->qop) { response = aprintf("username=\"%s\", " "realm=\"%s\", " "nonce=\"%s\", " "uri=\"%s\", " "cnonce=\"%s\", " "nc=%08x, " "qop=%s, " "response=\"%s\"", userp_quoted, digest->realm, digest->nonce, uripath, digest->cnonce, digest->nc, digest->qop, request_digest); if(strcasecompare(digest->qop, "auth")) digest->nc++; /* The nc (from RFC) has to be a 8 hex digit number 0 padded which tells to the server how many times you are using the same nonce in the qop=auth mode */ } else { response = aprintf("username=\"%s\", " "realm=\"%s\", " "nonce=\"%s\", " "uri=\"%s\", " "response=\"%s\"", userp_quoted, digest->realm, digest->nonce, uripath, request_digest); } free(userp_quoted); if(!response) return CURLE_OUT_OF_MEMORY; /* Add the optional fields */ if(digest->opaque) { /* Append the opaque */ tmp = aprintf("%s, opaque=\"%s\"", response, digest->opaque); free(response); if(!tmp) return CURLE_OUT_OF_MEMORY; response = tmp; } if(digest->algorithm) { /* Append the algorithm */ tmp = aprintf("%s, algorithm=\"%s\"", response, digest->algorithm); free(response); if(!tmp) return CURLE_OUT_OF_MEMORY; response = tmp; } if(digest->userhash) { /* Append the userhash */ tmp = aprintf("%s, userhash=true", response); free(response); if(!tmp) return CURLE_OUT_OF_MEMORY; response = tmp; } /* Return the output */ *outptr = response; *outlen = strlen(response); return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0x280, %rsp # imm = 0x280 movq 0x28(%rbp), %rax movq 0x20(%rbp), %rax movq 0x18(%rbp), %rax movq 0x10(%rbp), %rax movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq %rdx, -0x20(%rbp) movq %rcx, -0x28(%rbp) movq %r8, -0x30(%rbp) movq %r9, -0x38(%rbp) movq $0x0, -0x1d8(%rbp) movq $0x0, -0x1e0(%rbp) movq $0x0, -0x1f0(%rbp) movq $0x0, -0x1f8(%rbp) movq -0x38(%rbp), %rax cmpl $0x0, 0x38(%rax) jne 0x6f314 movq -0x38(%rbp), %rax movl $0x1, 0x38(%rax) movq -0x38(%rbp), %rax cmpq $0x0, 0x8(%rax) jne 0x6f3b8 movq -0x10(%rbp), %rdi leaq -0x1d0(%rbp), %rsi movl $0x21, %edx callq 0x5bb60 movl %eax, -0x3c(%rbp) cmpl $0x0, -0x3c(%rbp) je 0x6f34c movl -0x3c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x6fa83 movq -0x10(%rbp), %rax movq %rax, -0x258(%rbp) leaq -0x1d0(%rbp), %rax movq %rax, -0x250(%rbp) leaq -0x1d0(%rbp), %rdi callq 0x93b0 movq -0x258(%rbp), %rdi movq -0x250(%rbp), %rsi movq %rax, %rdx leaq -0x1d8(%rbp), %rcx leaq -0x1e0(%rbp), %r8 callq 0xb630 movl %eax, -0x3c(%rbp) cmpl $0x0, -0x3c(%rbp) je 0x6f3a9 movl -0x3c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x6fa83 movq -0x1d8(%rbp), %rcx movq -0x38(%rbp), %rax movq %rcx, 0x8(%rax) movq -0x38(%rbp), %rax testb $0x1, 0x3c(%rax) je 0x6f45d movq -0x18(%rbp), %rsi movq -0x38(%rbp), %rax movq 0x10(%rax), %rdx leaq 0x13dcc(%rip), %rdi # 0x831a5 movb $0x0, %al callq 0x9810 movq %rax, -0xb8(%rbp) cmpq $0x0, -0xb8(%rbp) jne 0x6f3fd movl $0x1b, -0x4(%rbp) jmp 0x6fa83 movl $0x0, -0x3c(%rbp) cmpl $0x0, -0x3c(%rbp) je 0x6f428 leaq 0x2463f(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0xb8(%rbp), %rdi callq *%rax movl -0x3c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x6fa83 movq 0x28(%rbp), %rax leaq -0x60(%rbp), %rdi movq -0xb8(%rbp), %rsi callq *%rax leaq 0x24610(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0xb8(%rbp), %rdi callq *%rax movq 0x20(%rbp), %rax leaq -0x60(%rbp), %rdi leaq -0x1a0(%rbp), %rsi callq *%rax movq -0x38(%rbp), %rax testb $0x1, 0x3c(%rax) je 0x6f477 leaq -0x1a0(%rbp), %rax movq %rax, -0x260(%rbp) jmp 0x6f482 movq -0x18(%rbp), %rax movq %rax, -0x260(%rbp) movq -0x260(%rbp), %rsi movq -0x38(%rbp), %rax movq 0x10(%rax), %rdx movq -0x20(%rbp), %rcx leaq 0x13d06(%rip), %rdi # 0x831a2 movb $0x0, %al callq 0x9810 movq %rax, -0xb8(%rbp) cmpq $0x0, -0xb8(%rbp) jne 0x6f4c0 movl $0x1b, -0x4(%rbp) jmp 0x6fa83 movl $0x0, -0x3c(%rbp) cmpl $0x0, -0x3c(%rbp) je 0x6f4eb leaq 0x2457c(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0xb8(%rbp), %rdi callq *%rax movl -0x3c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x6fa83 movq 0x28(%rbp), %rax leaq -0x60(%rbp), %rdi movq -0xb8(%rbp), %rsi callq *%rax leaq 0x2454d(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0xb8(%rbp), %rdi callq *%rax movq 0x20(%rbp), %rax leaq -0x60(%rbp), %rdi leaq -0x100(%rbp), %rsi callq *%rax movq -0x38(%rbp), %rax cmpl $0x1, 0x18(%rax) je 0x6f542 movq -0x38(%rbp), %rax cmpl $0x3, 0x18(%rax) je 0x6f542 movq -0x38(%rbp), %rax cmpl $0x5, 0x18(%rax) jne 0x6f5e3 leaq -0x100(%rbp), %rsi movq -0x38(%rbp), %rax movq (%rax), %rdx movq -0x38(%rbp), %rax movq 0x8(%rax), %rcx leaq 0x13c43(%rip), %rdi # 0x831a2 movb $0x0, %al callq 0x9810 movq %rax, -0x1f8(%rbp) cmpq $0x0, -0x1f8(%rbp) jne 0x6f583 movl $0x1b, -0x4(%rbp) jmp 0x6fa83 movl $0x0, -0x3c(%rbp) cmpl $0x0, -0x3c(%rbp) je 0x6f5ae leaq 0x244b9(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x1f8(%rbp), %rdi callq *%rax movl -0x3c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x6fa83 movq 0x28(%rbp), %rax leaq -0x60(%rbp), %rdi movq -0x1f8(%rbp), %rsi callq *%rax leaq 0x2448a(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x1f8(%rbp), %rdi callq *%rax movq 0x20(%rbp), %rax leaq -0x60(%rbp), %rdi leaq -0x100(%rbp), %rsi callq *%rax movq -0x28(%rbp), %rsi movq -0x30(%rbp), %rdx leaq 0x13bb3(%rip), %rdi # 0x831a5 movb $0x0, %al callq 0x9810 movq %rax, -0xb8(%rbp) movq -0x38(%rbp), %rax cmpq $0x0, 0x28(%rax) je 0x6f68a movq -0x38(%rbp), %rax movq 0x28(%rax), %rdi leaq 0x13afb(%rip), %rsi # 0x83115 callq 0x36690 cmpl $0x0, %eax je 0x6f68a movq 0x28(%rbp), %rax leaq -0x60(%rbp), %rdi leaq 0x13e79(%rip), %rsi # 0x834ac callq *%rax movq 0x20(%rbp), %rax leaq -0x60(%rbp), %rdi leaq -0x240(%rbp), %rsi callq *%rax movq -0xb8(%rbp), %rsi leaq -0x240(%rbp), %rdx leaq 0x13b4a(%rip), %rdi # 0x831a5 movb $0x0, %al callq 0x9810 movq %rax, -0x248(%rbp) leaq 0x243e0(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0xb8(%rbp), %rdi callq *%rax movq -0x248(%rbp), %rax movq %rax, -0xb8(%rbp) cmpq $0x0, -0xb8(%rbp) jne 0x6f6a0 movl $0x1b, -0x4(%rbp) jmp 0x6fa83 movl $0x0, -0x3c(%rbp) cmpl $0x0, -0x3c(%rbp) je 0x6f6cb leaq 0x2439c(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0xb8(%rbp), %rdi callq *%rax movl -0x3c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x6fa83 movq 0x28(%rbp), %rax leaq -0x60(%rbp), %rdi movq -0xb8(%rbp), %rsi callq *%rax leaq 0x2436d(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0xb8(%rbp), %rdi callq *%rax movq 0x20(%rbp), %rax leaq -0x60(%rbp), %rdi leaq -0x150(%rbp), %rsi callq *%rax movq -0x38(%rbp), %rax cmpq $0x0, 0x28(%rax) je 0x6f752 leaq -0x100(%rbp), %rsi movq -0x38(%rbp), %rax movq (%rax), %rdx movq -0x38(%rbp), %rax movl 0x38(%rax), %ecx movq -0x38(%rbp), %rax movq 0x8(%rax), %r8 movq -0x38(%rbp), %rax movq 0x28(%rax), %r9 leaq -0x150(%rbp), %rax leaq 0x13a59(%rip), %rdi # 0x83197 movq %rax, (%rsp) movb $0x0, %al callq 0x9810 movq %rax, -0xb8(%rbp) jmp 0x6f77c leaq -0x100(%rbp), %rsi movq -0x38(%rbp), %rax movq (%rax), %rdx leaq -0x150(%rbp), %rcx leaq 0x13a34(%rip), %rdi # 0x831a2 movb $0x0, %al callq 0x9810 movq %rax, -0xb8(%rbp) cmpq $0x0, -0xb8(%rbp) jne 0x6f792 movl $0x1b, -0x4(%rbp) jmp 0x6fa83 movl $0x0, -0x3c(%rbp) cmpl $0x0, -0x3c(%rbp) je 0x6f7bd leaq 0x242aa(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0xb8(%rbp), %rdi callq *%rax movl -0x3c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x6fa83 movq 0x28(%rbp), %rax leaq -0x60(%rbp), %rdi movq -0xb8(%rbp), %rsi callq *%rax leaq 0x2427b(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0xb8(%rbp), %rdi callq *%rax movq 0x20(%rbp), %rax leaq -0x60(%rbp), %rdi leaq -0xb0(%rbp), %rsi callq *%rax movq -0x38(%rbp), %rax testb $0x1, 0x3c(%rax) je 0x6f80c leaq -0x1a0(%rbp), %rax movq %rax, -0x268(%rbp) jmp 0x6f817 movq -0x18(%rbp), %rax movq %rax, -0x268(%rbp) movq -0x268(%rbp), %rdi callq 0x6fc30 movq %rax, -0x1e8(%rbp) cmpq $0x0, -0x1e8(%rbp) jne 0x6f840 movl $0x1b, -0x4(%rbp) jmp 0x6fa83 movq -0x38(%rbp), %rax cmpq $0x0, 0x28(%rax) je 0x6f8d3 movq -0x1e8(%rbp), %rsi movq -0x38(%rbp), %rax movq 0x10(%rax), %rdx movq -0x38(%rbp), %rax movq (%rax), %rcx movq -0x30(%rbp), %r8 movq -0x38(%rbp), %rax movq 0x8(%rax), %r9 movq -0x38(%rbp), %rax movl 0x38(%rax), %r11d movq -0x38(%rbp), %rax movq 0x28(%rax), %r10 leaq -0xb0(%rbp), %rax leaq 0x1391c(%rip), %rdi # 0x831ab movl %r11d, (%rsp) movq %r10, 0x8(%rsp) movq %rax, 0x10(%rsp) movb $0x0, %al callq 0x9810 movq %rax, -0x1f0(%rbp) movq -0x38(%rbp), %rax movq 0x28(%rax), %rdi leaq 0x137d3(%rip), %rsi # 0x8308d callq 0x36690 cmpl $0x0, %eax je 0x6f8d1 movq -0x38(%rbp), %rax movl 0x38(%rax), %ecx addl $0x1, %ecx movl %ecx, 0x38(%rax) jmp 0x6f909 movq -0x1e8(%rbp), %rsi movq -0x38(%rbp), %rax movq 0x10(%rax), %rdx movq -0x38(%rbp), %rax movq (%rax), %rcx movq -0x30(%rbp), %r8 leaq -0xb0(%rbp), %r9 leaq 0x1390d(%rip), %rdi # 0x83208 movb $0x0, %al callq 0x9810 movq %rax, -0x1f0(%rbp) leaq 0x24140(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x1e8(%rbp), %rdi callq *%rax cmpq $0x0, -0x1f0(%rbp) jne 0x6f932 movl $0x1b, -0x4(%rbp) jmp 0x6fa83 movq -0x38(%rbp), %rax cmpq $0x0, 0x20(%rax) je 0x6f998 movq -0x1f0(%rbp), %rsi movq -0x38(%rbp), %rax movq 0x20(%rax), %rdx leaq 0x138f4(%rip), %rdi # 0x83247 movb $0x0, %al callq 0x9810 movq %rax, -0x1f8(%rbp) leaq 0x240e8(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x1f0(%rbp), %rdi callq *%rax cmpq $0x0, -0x1f8(%rbp) jne 0x6f98a movl $0x1b, -0x4(%rbp) jmp 0x6fa83 movq -0x1f8(%rbp), %rax movq %rax, -0x1f0(%rbp) movq -0x38(%rbp), %rax cmpq $0x0, 0x30(%rax) je 0x6f9fe movq -0x1f0(%rbp), %rsi movq -0x38(%rbp), %rax movq 0x30(%rax), %rdx leaq 0x1389e(%rip), %rdi # 0x83257 movb $0x0, %al callq 0x9810 movq %rax, -0x1f8(%rbp) leaq 0x24082(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x1f0(%rbp), %rdi callq *%rax cmpq $0x0, -0x1f8(%rbp) jne 0x6f9f0 movl $0x1b, -0x4(%rbp) jmp 0x6fa83 movq -0x1f8(%rbp), %rax movq %rax, -0x1f0(%rbp) movq -0x38(%rbp), %rax testb $0x1, 0x3c(%rax) je 0x6fa58 movq -0x1f0(%rbp), %rsi leaq 0x13854(%rip), %rdi # 0x8326a movb $0x0, %al callq 0x9810 movq %rax, -0x1f8(%rbp) leaq 0x24025(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x1f0(%rbp), %rdi callq *%rax cmpq $0x0, -0x1f8(%rbp) jne 0x6fa4a movl $0x1b, -0x4(%rbp) jmp 0x6fa83 movq -0x1f8(%rbp), %rax movq %rax, -0x1f0(%rbp) movq -0x1f0(%rbp), %rcx movq 0x10(%rbp), %rax movq %rcx, (%rax) movq -0x1f0(%rbp), %rdi callq 0x93b0 movq %rax, %rcx movq 0x18(%rbp), %rax movq %rcx, (%rax) movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x280, %rsp # imm = 0x280 popq %rbp retq nop
/macressler[P]curl/lib/vauth/digest.c
auth_digest_get_key_value
static bool auth_digest_get_key_value(const char *chlg, const char *key, char *value, size_t max_val_len, char end_char) { char *find_pos; size_t i; find_pos = strstr(chlg, key); if(!find_pos) return FALSE; find_pos += strlen(key); for(i = 0; *find_pos && *find_pos != end_char && i < max_val_len - 1; ++i) value[i] = *find_pos++; value[i] = '\0'; return TRUE; }
pushq %rbp movq %rsp, %rbp subq $0x50, %rsp movb %r8b, %al movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq %rdx, -0x20(%rbp) movq %rcx, -0x28(%rbp) movb %al, -0x29(%rbp) movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi callq 0x91d0 movq %rax, -0x38(%rbp) cmpq $0x0, -0x38(%rbp) jne 0x6fb8f movb $0x0, -0x1(%rbp) jmp 0x6fc25 movq -0x18(%rbp), %rdi callq 0x93b0 addq -0x38(%rbp), %rax movq %rax, -0x38(%rbp) movq $0x0, -0x40(%rbp) movq -0x38(%rbp), %rax movsbl (%rax), %ecx xorl %eax, %eax cmpl $0x0, %ecx movb %al, -0x41(%rbp) je 0x6fbe2 movq -0x38(%rbp), %rax movsbl (%rax), %ecx movsbl -0x29(%rbp), %edx xorl %eax, %eax cmpl %edx, %ecx movb %al, -0x41(%rbp) je 0x6fbe2 movq -0x40(%rbp), %rax movq -0x28(%rbp), %rcx subq $0x1, %rcx cmpq %rcx, %rax setb %al movb %al, -0x41(%rbp) movb -0x41(%rbp), %al testb $0x1, %al jne 0x6fbeb jmp 0x6fc15 movq -0x38(%rbp), %rax movq %rax, %rcx addq $0x1, %rcx movq %rcx, -0x38(%rbp) movb (%rax), %dl movq -0x20(%rbp), %rax movq -0x40(%rbp), %rcx movb %dl, (%rax,%rcx) movq -0x40(%rbp), %rax addq $0x1, %rax movq %rax, -0x40(%rbp) jmp 0x6fba8 movq -0x20(%rbp), %rax movq -0x40(%rbp), %rcx movb $0x0, (%rax,%rcx) movb $0x1, -0x1(%rbp) movb -0x1(%rbp), %al andb $0x1, %al addq $0x50, %rsp popq %rbp retq
/macressler[P]curl/lib/vauth/digest.c
auth_digest_string_quoted
static char *auth_digest_string_quoted(const char *source) { char *dest, *d; const char *s = source; size_t n = 1; /* null terminator */ /* Calculate size needed */ while(*s) { ++n; if(*s == '"' || *s == '\\') { ++n; } ++s; } dest = malloc(n); if(dest) { s = source; d = dest; while(*s) { if(*s == '"' || *s == '\\') { *d++ = '\\'; } *d++ = *s++; } *d = 0; } return dest; }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x8(%rbp) movq -0x8(%rbp), %rax movq %rax, -0x20(%rbp) movq $0x1, -0x28(%rbp) movq -0x20(%rbp), %rax cmpb $0x0, (%rax) je 0x6fc93 movq -0x28(%rbp), %rax addq $0x1, %rax movq %rax, -0x28(%rbp) movq -0x20(%rbp), %rax movsbl (%rax), %eax cmpl $0x22, %eax je 0x6fc79 movq -0x20(%rbp), %rax movsbl (%rax), %eax cmpl $0x5c, %eax jne 0x6fc85 movq -0x28(%rbp), %rax addq $0x1, %rax movq %rax, -0x28(%rbp) movq -0x20(%rbp), %rax addq $0x1, %rax movq %rax, -0x20(%rbp) jmp 0x6fc4c leaq 0x23dae(%rip), %rax # 0x93a48 movq (%rax), %rax movq -0x28(%rbp), %rdi callq *%rax movq %rax, -0x10(%rbp) cmpq $0x0, -0x10(%rbp) je 0x6fd1c movq -0x8(%rbp), %rax movq %rax, -0x20(%rbp) movq -0x10(%rbp), %rax movq %rax, -0x18(%rbp) movq -0x20(%rbp), %rax cmpb $0x0, (%rax) je 0x6fd15 movq -0x20(%rbp), %rax movsbl (%rax), %eax cmpl $0x22, %eax je 0x6fcdf movq -0x20(%rbp), %rax movsbl (%rax), %eax cmpl $0x5c, %eax jne 0x6fcf1 movq -0x18(%rbp), %rax movq %rax, %rcx addq $0x1, %rcx movq %rcx, -0x18(%rbp) movb $0x5c, (%rax) movq -0x20(%rbp), %rax movq %rax, %rcx addq $0x1, %rcx movq %rcx, -0x20(%rbp) movb (%rax), %cl movq -0x18(%rbp), %rax movq %rax, %rdx addq $0x1, %rdx movq %rdx, -0x18(%rbp) movb %cl, (%rax) jmp 0x6fcbe movq -0x18(%rbp), %rax movb $0x0, (%rax) movq -0x10(%rbp), %rax addq $0x30, %rsp popq %rbp retq nop nopl (%rax,%rax)
/macressler[P]curl/lib/vauth/digest.c
Curl_auth_decode_ntlm_type2_message
CURLcode Curl_auth_decode_ntlm_type2_message(struct Curl_easy *data, const char *type2msg, struct ntlmdata *ntlm) { static const char type2_marker[] = { 0x02, 0x00, 0x00, 0x00 }; /* NTLM type-2 message structure: Index Description Content 0 NTLMSSP Signature Null-terminated ASCII "NTLMSSP" (0x4e544c4d53535000) 8 NTLM Message Type long (0x02000000) 12 Target Name security buffer 20 Flags long 24 Challenge 8 bytes (32) Context 8 bytes (two consecutive longs) (*) (40) Target Information security buffer (*) (48) OS Version Structure 8 bytes (*) 32 (48) (56) Start of data block (*) (*) -> Optional */ CURLcode result = CURLE_OK; unsigned char *type2 = NULL; size_t type2_len = 0; #if defined(NTLM_NEEDS_NSS_INIT) /* Make sure the crypto backend is initialized */ result = Curl_nss_force_init(data); if(result) return result; #elif defined(CURL_DISABLE_VERBOSE_STRINGS) (void)data; #endif /* Decode the base-64 encoded type-2 message */ if(strlen(type2msg) && *type2msg != '=') { result = Curl_base64_decode(type2msg, &type2, &type2_len); if(result) return result; } /* Ensure we have a valid type-2 message */ if(!type2) { infof(data, "NTLM handshake failure (empty type-2 message)\n"); return CURLE_BAD_CONTENT_ENCODING; } ntlm->flags = 0; if((type2_len < 32) || (memcmp(type2, NTLMSSP_SIGNATURE, 8) != 0) || (memcmp(type2 + 8, type2_marker, sizeof(type2_marker)) != 0)) { /* This was not a good enough type-2 message */ free(type2); infof(data, "NTLM handshake failure (bad type-2 message)\n"); return CURLE_BAD_CONTENT_ENCODING; } ntlm->flags = Curl_read32_le(&type2[20]); memcpy(ntlm->nonce, &type2[24], 8); if(ntlm->flags & NTLMFLAG_NEGOTIATE_TARGET_INFO) { result = ntlm_decode_type2_target(data, type2, type2_len, ntlm); if(result) { free(type2); infof(data, "NTLM handshake failure (bad type-2 message)\n"); return result; } } DEBUG_OUT({ fprintf(stderr, "**** TYPE2 header flags=0x%08.8lx ", ntlm->flags); ntlm_print_flags(stderr, ntlm->flags); fprintf(stderr, "\n nonce="); ntlm_print_hex(stderr, (char *)ntlm->nonce, 8); fprintf(stderr, "\n****\n"); fprintf(stderr, "**** Header %s\n ", header); }); free(type2); return result; }
pushq %rbp movq %rsp, %rbp subq $0x40, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq %rdx, -0x20(%rbp) movl $0x0, -0x24(%rbp) movq $0x0, -0x30(%rbp) movq $0x0, -0x38(%rbp) movq -0x18(%rbp), %rdi callq 0x93b0 cmpq $0x0, %rax je 0x6fdad movq -0x18(%rbp), %rax movsbl (%rax), %eax cmpl $0x3d, %eax je 0x6fdad movq -0x18(%rbp), %rdi leaq -0x30(%rbp), %rsi leaq -0x38(%rbp), %rdx callq 0xb290 movl %eax, -0x24(%rbp) cmpl $0x0, -0x24(%rbp) je 0x6fdab movl -0x24(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x6fee4 jmp 0x6fdad cmpq $0x0, -0x30(%rbp) jne 0x6fdd2 movq -0x10(%rbp), %rdi leaq 0x134c1(%rip), %rsi # 0x83280 movb $0x0, %al callq 0x19d00 movl $0x3d, -0x4(%rbp) jmp 0x6fee4 movq -0x20(%rbp), %rax movl $0x0, 0x4(%rax) cmpq $0x20, -0x38(%rbp) jb 0x6fe1b movq -0x30(%rbp), %rax movq (%rax), %rax movabsq $0x5053534d4c544e, %rcx # imm = 0x5053534D4C544E subq %rcx, %rax setne %al movzbl %al, %eax cmpl $0x0, %eax jne 0x6fe1b movq -0x30(%rbp), %rax addq $0x8, %rax movl (%rax), %eax subl $0x2, %eax setne %al movzbl %al, %eax cmpl $0x0, %eax je 0x6fe49 leaq 0x23c2e(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x30(%rbp), %rdi callq *%rax movq -0x10(%rbp), %rdi leaq 0x13481(%rip), %rsi # 0x832b7 movb $0x0, %al callq 0x19d00 movl $0x3d, -0x4(%rbp) jmp 0x6fee4 movq -0x30(%rbp), %rdi addq $0x14, %rdi callq 0x5f830 movl %eax, %ecx movq -0x20(%rbp), %rax movl %ecx, 0x4(%rax) movq -0x20(%rbp), %rax movq -0x30(%rbp), %rcx movq 0x18(%rcx), %rcx movq %rcx, 0x8(%rax) movq -0x20(%rbp), %rax movl 0x4(%rax), %eax andl $0x800000, %eax # imm = 0x800000 cmpl $0x0, %eax je 0x6feca movq -0x10(%rbp), %rdi movq -0x30(%rbp), %rsi movq -0x38(%rbp), %rdx movq -0x20(%rbp), %rcx callq 0x6fef0 movl %eax, -0x24(%rbp) cmpl $0x0, -0x24(%rbp) je 0x6fec8 leaq 0x23bab(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x30(%rbp), %rdi callq *%rax movq -0x10(%rbp), %rdi leaq 0x133fe(%rip), %rsi # 0x832b7 movb $0x0, %al callq 0x19d00 movl -0x24(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x6fee4 jmp 0x6feca jmp 0x6fecc jmp 0x6fece leaq 0x23b7b(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x30(%rbp), %rdi callq *%rax movl -0x24(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x40, %rsp popq %rbp retq nopl (%rax)
/macressler[P]curl/lib/vauth/ntlm.c
Curl_auth_create_ntlm_type1_message
CURLcode Curl_auth_create_ntlm_type1_message(struct Curl_easy *data, const char *userp, const char *passwdp, struct ntlmdata *ntlm, char **outptr, size_t *outlen) { /* NTLM type-1 message structure: Index Description Content 0 NTLMSSP Signature Null-terminated ASCII "NTLMSSP" (0x4e544c4d53535000) 8 NTLM Message Type long (0x01000000) 12 Flags long (16) Supplied Domain security buffer (*) (24) Supplied Workstation security buffer (*) (32) OS Version Structure 8 bytes (*) (32) (40) Start of data block (*) (*) -> Optional */ size_t size; unsigned char ntlmbuf[NTLM_BUFSIZE]; const char *host = ""; /* empty */ const char *domain = ""; /* empty */ size_t hostlen = 0; size_t domlen = 0; size_t hostoff = 0; size_t domoff = hostoff + hostlen; /* This is 0: remember that host and domain are empty */ (void)userp; (void)passwdp; /* Clean up any former leftovers and initialise to defaults */ Curl_auth_ntlm_cleanup(ntlm); #if defined(USE_NTRESPONSES) && defined(USE_NTLM2SESSION) #define NTLM2FLAG NTLMFLAG_NEGOTIATE_NTLM2_KEY #else #define NTLM2FLAG 0 #endif snprintf((char *)ntlmbuf, NTLM_BUFSIZE, NTLMSSP_SIGNATURE "%c" "\x01%c%c%c" /* 32-bit type = 1 */ "%c%c%c%c" /* 32-bit NTLM flag field */ "%c%c" /* domain length */ "%c%c" /* domain allocated space */ "%c%c" /* domain name offset */ "%c%c" /* 2 zeroes */ "%c%c" /* host length */ "%c%c" /* host allocated space */ "%c%c" /* host name offset */ "%c%c" /* 2 zeroes */ "%s" /* host name */ "%s", /* domain string */ 0, /* trailing zero */ 0, 0, 0, /* part of type-1 long */ LONGQUARTET(NTLMFLAG_NEGOTIATE_OEM | NTLMFLAG_REQUEST_TARGET | NTLMFLAG_NEGOTIATE_NTLM_KEY | NTLM2FLAG | NTLMFLAG_NEGOTIATE_ALWAYS_SIGN), SHORTPAIR(domlen), SHORTPAIR(domlen), SHORTPAIR(domoff), 0, 0, SHORTPAIR(hostlen), SHORTPAIR(hostlen), SHORTPAIR(hostoff), 0, 0, host, /* this is empty */ domain /* this is empty */); /* Initial packet length */ size = 32 + hostlen + domlen; DEBUG_OUT({ fprintf(stderr, "* TYPE1 header flags=0x%02.2x%02.2x%02.2x%02.2x " "0x%08.8x ", LONGQUARTET(NTLMFLAG_NEGOTIATE_OEM | NTLMFLAG_REQUEST_TARGET | NTLMFLAG_NEGOTIATE_NTLM_KEY | NTLM2FLAG | NTLMFLAG_NEGOTIATE_ALWAYS_SIGN), NTLMFLAG_NEGOTIATE_OEM | NTLMFLAG_REQUEST_TARGET | NTLMFLAG_NEGOTIATE_NTLM_KEY | NTLM2FLAG | NTLMFLAG_NEGOTIATE_ALWAYS_SIGN); ntlm_print_flags(stderr, NTLMFLAG_NEGOTIATE_OEM | NTLMFLAG_REQUEST_TARGET | NTLMFLAG_NEGOTIATE_NTLM_KEY | NTLM2FLAG | NTLMFLAG_NEGOTIATE_ALWAYS_SIGN); fprintf(stderr, "\n****\n"); }); /* Return with binary blob encoded into base64 */ return Curl_base64_encode(data, (char *)ntlmbuf, size, outptr, outlen); }
pushq %rbp movq %rsp, %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x558, %rsp # imm = 0x558 movq %rdi, -0x30(%rbp) movq %rsi, -0x38(%rbp) movq %rdx, -0x40(%rbp) movq %rcx, -0x48(%rbp) movq %r8, -0x50(%rbp) movq %r9, -0x58(%rbp) leaq 0x13489(%rip), %rax # 0x834ac movq %rax, -0x468(%rbp) leaq 0x1347b(%rip), %rax # 0x834ac movq %rax, -0x470(%rbp) movq $0x0, -0x478(%rbp) movq $0x0, -0x480(%rbp) movq $0x0, -0x488(%rbp) movq -0x488(%rbp), %rax addq -0x478(%rbp), %rax movq %rax, -0x490(%rbp) movq -0x48(%rbp), %rdi callq 0x702b0 leaq -0x460(%rbp), %rdi movq -0x480(%rbp), %rax andq $0xff, %rax movq -0x480(%rbp), %rcx shrq $0x8, %rcx andq $0xff, %rcx movq %rcx, -0x4c0(%rbp) movq -0x480(%rbp), %rcx andq $0xff, %rcx movq %rcx, -0x4b8(%rbp) movq -0x480(%rbp), %rcx shrq $0x8, %rcx andq $0xff, %rcx movq %rcx, -0x4b0(%rbp) movq -0x490(%rbp), %rcx andq $0xff, %rcx movq %rcx, -0x4a8(%rbp) movq -0x490(%rbp), %rcx shrq $0x8, %rcx andq $0xff, %rcx movq %rcx, -0x4a0(%rbp) movq -0x478(%rbp), %r13 andq $0xff, %r13 movq -0x478(%rbp), %r12 shrq $0x8, %r12 andq $0xff, %r12 movq -0x478(%rbp), %r15 andq $0xff, %r15 movq -0x478(%rbp), %r14 shrq $0x8, %r14 andq $0xff, %r14 movq -0x488(%rbp), %rbx andq $0xff, %rbx movq -0x488(%rbp), %r11 shrq $0x8, %r11 andq $0xff, %r11 movq -0x468(%rbp), %r10 movq -0x470(%rbp), %rcx movq %rcx, -0x498(%rbp) movl $0x400, %esi # imm = 0x400 leaq 0x13163(%rip), %rdx # 0x832e4 xorl %r9d, %r9d movl %r9d, %ecx movl %r9d, %r8d movl $0x0, (%rsp) movl $0x6, 0x8(%rsp) movl $0x82, 0x10(%rsp) movl $0x8, 0x18(%rsp) movl $0x0, 0x20(%rsp) movq %rax, 0x28(%rsp) movq -0x4c0(%rbp), %rax movq %rax, 0x30(%rsp) movq -0x4b8(%rbp), %rax movq %rax, 0x38(%rsp) movq -0x4b0(%rbp), %rax movq %rax, 0x40(%rsp) movq -0x4a8(%rbp), %rax movq %rax, 0x48(%rsp) movq -0x4a0(%rbp), %rax movq %rax, 0x50(%rsp) movq -0x498(%rbp), %rax movl $0x0, 0x58(%rsp) movl $0x0, 0x60(%rsp) movq %r13, 0x68(%rsp) movq %r12, 0x70(%rsp) movq %r15, 0x78(%rsp) movq %r14, 0x80(%rsp) movq %rbx, 0x88(%rsp) movq %r11, 0x90(%rsp) movl $0x0, 0x98(%rsp) movl $0x0, 0xa0(%rsp) movq %r10, 0xa8(%rsp) movq %rax, 0xb0(%rsp) movb $0x0, %al callq 0x9510 movq -0x478(%rbp), %rax addq $0x20, %rax addq -0x480(%rbp), %rax movq %rax, -0x60(%rbp) jmp 0x70275 movq -0x30(%rbp), %rdi leaq -0x460(%rbp), %rsi movq -0x60(%rbp), %rdx movq -0x50(%rbp), %rcx movq -0x58(%rbp), %r8 callq 0xb630 addq $0x558, %rsp # imm = 0x558 popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq nopw %cs:(%rax,%rax)
/macressler[P]curl/lib/vauth/ntlm.c
Curl_auth_create_ntlm_type3_message
CURLcode Curl_auth_create_ntlm_type3_message(struct Curl_easy *data, const char *userp, const char *passwdp, struct ntlmdata *ntlm, char **outptr, size_t *outlen) { /* NTLM type-3 message structure: Index Description Content 0 NTLMSSP Signature Null-terminated ASCII "NTLMSSP" (0x4e544c4d53535000) 8 NTLM Message Type long (0x03000000) 12 LM/LMv2 Response security buffer 20 NTLM/NTLMv2 Response security buffer 28 Target Name security buffer 36 User Name security buffer 44 Workstation Name security buffer (52) Session Key security buffer (*) (60) Flags long (*) (64) OS Version Structure 8 bytes (*) 52 (64) (72) Start of data block (*) -> Optional */ CURLcode result = CURLE_OK; size_t size; unsigned char ntlmbuf[NTLM_BUFSIZE]; int lmrespoff; unsigned char lmresp[24]; /* fixed-size */ #ifdef USE_NTRESPONSES int ntrespoff; unsigned int ntresplen = 24; unsigned char ntresp[24]; /* fixed-size */ unsigned char *ptr_ntresp = &ntresp[0]; unsigned char *ntlmv2resp = NULL; #endif bool unicode = (ntlm->flags & NTLMFLAG_NEGOTIATE_UNICODE) ? TRUE : FALSE; char host[HOSTNAME_MAX + 1] = ""; const char *user; const char *domain = ""; size_t hostoff = 0; size_t useroff = 0; size_t domoff = 0; size_t hostlen = 0; size_t userlen = 0; size_t domlen = 0; user = strchr(userp, '\\'); if(!user) user = strchr(userp, '/'); if(user) { domain = userp; domlen = (user - domain); user++; } else user = userp; userlen = strlen(user); /* Get the machine's un-qualified host name as NTLM doesn't like the fully qualified domain name */ if(Curl_gethostname(host, sizeof(host))) { infof(data, "gethostname() failed, continuing without!\n"); hostlen = 0; } else { hostlen = strlen(host); } #if defined(USE_NTRESPONSES) && defined(USE_NTLM_V2) if(ntlm->target_info_len) { unsigned char ntbuffer[0x18]; unsigned char entropy[8]; unsigned char ntlmv2hash[0x18]; result = Curl_rand(data, entropy, 8); if(result) return result; result = Curl_ntlm_core_mk_nt_hash(data, passwdp, ntbuffer); if(result) return result; result = Curl_ntlm_core_mk_ntlmv2_hash(user, userlen, domain, domlen, ntbuffer, ntlmv2hash); if(result) return result; /* LMv2 response */ result = Curl_ntlm_core_mk_lmv2_resp(ntlmv2hash, entropy, &ntlm->nonce[0], lmresp); if(result) return result; /* NTLMv2 response */ result = Curl_ntlm_core_mk_ntlmv2_resp(ntlmv2hash, entropy, ntlm, &ntlmv2resp, &ntresplen); if(result) return result; ptr_ntresp = ntlmv2resp; } else #endif #if defined(USE_NTRESPONSES) && defined(USE_NTLM2SESSION) /* We don't support NTLM2 if we don't have USE_NTRESPONSES */ if(ntlm->flags & NTLMFLAG_NEGOTIATE_NTLM2_KEY) { unsigned char ntbuffer[0x18]; unsigned char tmp[0x18]; unsigned char md5sum[MD5_DIGEST_LENGTH]; unsigned char entropy[8]; /* Need to create 8 bytes random data */ result = Curl_rand(data, entropy, 8); if(result) return result; /* 8 bytes random data as challenge in lmresp */ memcpy(lmresp, entropy, 8); /* Pad with zeros */ memset(lmresp + 8, 0, 0x10); /* Fill tmp with challenge(nonce?) + entropy */ memcpy(tmp, &ntlm->nonce[0], 8); memcpy(tmp + 8, entropy, 8); result = Curl_ssl_md5sum(tmp, 16, md5sum, MD5_DIGEST_LENGTH); if(!result) /* We shall only use the first 8 bytes of md5sum, but the des code in Curl_ntlm_core_lm_resp only encrypt the first 8 bytes */ result = Curl_ntlm_core_mk_nt_hash(data, passwdp, ntbuffer); if(result) return result; Curl_ntlm_core_lm_resp(ntbuffer, md5sum, ntresp); /* End of NTLM2 Session code */ } else #endif { #ifdef USE_NTRESPONSES unsigned char ntbuffer[0x18]; #endif unsigned char lmbuffer[0x18]; #ifdef USE_NTRESPONSES result = Curl_ntlm_core_mk_nt_hash(data, passwdp, ntbuffer); if(result) return result; Curl_ntlm_core_lm_resp(ntbuffer, &ntlm->nonce[0], ntresp); #endif result = Curl_ntlm_core_mk_lm_hash(data, passwdp, lmbuffer); if(result) return result; Curl_ntlm_core_lm_resp(lmbuffer, &ntlm->nonce[0], lmresp); /* A safer but less compatible alternative is: * Curl_ntlm_core_lm_resp(ntbuffer, &ntlm->nonce[0], lmresp); * See https://davenport.sourceforge.io/ntlm.html#ntlmVersion2 */ } if(unicode) { domlen = domlen * 2; userlen = userlen * 2; hostlen = hostlen * 2; } lmrespoff = 64; /* size of the message header */ #ifdef USE_NTRESPONSES ntrespoff = lmrespoff + 0x18; domoff = ntrespoff + ntresplen; #else domoff = lmrespoff + 0x18; #endif useroff = domoff + domlen; hostoff = useroff + userlen; /* Create the big type-3 message binary blob */ size = snprintf((char *)ntlmbuf, NTLM_BUFSIZE, NTLMSSP_SIGNATURE "%c" "\x03%c%c%c" /* 32-bit type = 3 */ "%c%c" /* LanManager length */ "%c%c" /* LanManager allocated space */ "%c%c" /* LanManager offset */ "%c%c" /* 2 zeroes */ "%c%c" /* NT-response length */ "%c%c" /* NT-response allocated space */ "%c%c" /* NT-response offset */ "%c%c" /* 2 zeroes */ "%c%c" /* domain length */ "%c%c" /* domain allocated space */ "%c%c" /* domain name offset */ "%c%c" /* 2 zeroes */ "%c%c" /* user length */ "%c%c" /* user allocated space */ "%c%c" /* user offset */ "%c%c" /* 2 zeroes */ "%c%c" /* host length */ "%c%c" /* host allocated space */ "%c%c" /* host offset */ "%c%c" /* 2 zeroes */ "%c%c" /* session key length (unknown purpose) */ "%c%c" /* session key allocated space (unknown purpose) */ "%c%c" /* session key offset (unknown purpose) */ "%c%c" /* 2 zeroes */ "%c%c%c%c", /* flags */ /* domain string */ /* user string */ /* host string */ /* LanManager response */ /* NT response */ 0, /* zero termination */ 0, 0, 0, /* type-3 long, the 24 upper bits */ SHORTPAIR(0x18), /* LanManager response length, twice */ SHORTPAIR(0x18), SHORTPAIR(lmrespoff), 0x0, 0x0, #ifdef USE_NTRESPONSES SHORTPAIR(ntresplen), /* NT-response length, twice */ SHORTPAIR(ntresplen), SHORTPAIR(ntrespoff), 0x0, 0x0, #else 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, #endif SHORTPAIR(domlen), SHORTPAIR(domlen), SHORTPAIR(domoff), 0x0, 0x0, SHORTPAIR(userlen), SHORTPAIR(userlen), SHORTPAIR(useroff), 0x0, 0x0, SHORTPAIR(hostlen), SHORTPAIR(hostlen), SHORTPAIR(hostoff), 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, LONGQUARTET(ntlm->flags)); DEBUGASSERT(size == 64); DEBUGASSERT(size == (size_t)lmrespoff); /* We append the binary hashes */ if(size < (NTLM_BUFSIZE - 0x18)) { memcpy(&ntlmbuf[size], lmresp, 0x18); size += 0x18; } DEBUG_OUT({ fprintf(stderr, "**** TYPE3 header lmresp="); ntlm_print_hex(stderr, (char *)&ntlmbuf[lmrespoff], 0x18); }); #ifdef USE_NTRESPONSES if(size < (NTLM_BUFSIZE - ntresplen)) { DEBUGASSERT(size == (size_t)ntrespoff); memcpy(&ntlmbuf[size], ptr_ntresp, ntresplen); size += ntresplen; } DEBUG_OUT({ fprintf(stderr, "\n ntresp="); ntlm_print_hex(stderr, (char *)&ntlmbuf[ntrespoff], ntresplen); }); free(ntlmv2resp);/* Free the dynamic buffer allocated for NTLMv2 */ #endif DEBUG_OUT({ fprintf(stderr, "\n flags=0x%02.2x%02.2x%02.2x%02.2x 0x%08.8x ", LONGQUARTET(ntlm->flags), ntlm->flags); ntlm_print_flags(stderr, ntlm->flags); fprintf(stderr, "\n****\n"); }); /* Make sure that the domain, user and host strings fit in the buffer before we copy them there. */ if(size + userlen + domlen + hostlen >= NTLM_BUFSIZE) { failf(data, "user + domain + host name too big"); return CURLE_OUT_OF_MEMORY; } DEBUGASSERT(size == domoff); if(unicode) unicodecpy(&ntlmbuf[size], domain, domlen / 2); else memcpy(&ntlmbuf[size], domain, domlen); size += domlen; DEBUGASSERT(size == useroff); if(unicode) unicodecpy(&ntlmbuf[size], user, userlen / 2); else memcpy(&ntlmbuf[size], user, userlen); size += userlen; DEBUGASSERT(size == hostoff); if(unicode) unicodecpy(&ntlmbuf[size], host, hostlen / 2); else memcpy(&ntlmbuf[size], host, hostlen); size += hostlen; /* Convert domain, user, and host to ASCII but leave the rest as-is */ result = Curl_convert_to_network(data, (char *)&ntlmbuf[domoff], size - domoff); if(result) return CURLE_CONV_FAILED; /* Return with binary blob encoded into base64 */ result = Curl_base64_encode(data, (char *)ntlmbuf, size, outptr, outlen); Curl_auth_ntlm_cleanup(ntlm); return result; }
pushq %rbp movq %rsp, %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0xbf8, %rsp # imm = 0xBF8 movq %rdi, -0x38(%rbp) movq %rsi, -0x40(%rbp) movq %rdx, -0x48(%rbp) movq %rcx, -0x50(%rbp) movq %r8, -0x58(%rbp) movq %r9, -0x60(%rbp) movl $0x0, -0x64(%rbp) movl $0x18, -0x498(%rbp) leaq -0x4b0(%rbp), %rax movq %rax, -0x4b8(%rbp) movq $0x0, -0x4c0(%rbp) movq -0x50(%rbp), %rax movl 0x4(%rax), %edx andl $0x1, %edx xorl %eax, %eax movl $0x1, %ecx cmpl $0x0, %edx cmovnel %ecx, %eax cmpl $0x0, %eax setne %al andb $0x1, %al movb %al, -0x4c1(%rbp) leaq -0x8d0(%rbp), %rdi xorl %esi, %esi movl $0x401, %edx # imm = 0x401 callq 0x9520 leaq 0x13127(%rip), %rax # 0x834ac movq %rax, -0x8e0(%rbp) movq $0x0, -0x8e8(%rbp) movq $0x0, -0x8f0(%rbp) movq $0x0, -0x8f8(%rbp) movq $0x0, -0x900(%rbp) movq $0x0, -0x908(%rbp) movq $0x0, -0x910(%rbp) movq -0x40(%rbp), %rdi movl $0x5c, %esi callq 0x9300 movq %rax, -0x8d8(%rbp) cmpq $0x0, -0x8d8(%rbp) jne 0x70402 movq -0x40(%rbp), %rdi movl $0x2f, %esi callq 0x9300 movq %rax, -0x8d8(%rbp) cmpq $0x0, -0x8d8(%rbp) je 0x70443 movq -0x40(%rbp), %rax movq %rax, -0x8e0(%rbp) movq -0x8d8(%rbp), %rax movq -0x8e0(%rbp), %rcx subq %rcx, %rax movq %rax, -0x910(%rbp) movq -0x8d8(%rbp), %rax addq $0x1, %rax movq %rax, -0x8d8(%rbp) jmp 0x7044e movq -0x40(%rbp), %rax movq %rax, -0x8d8(%rbp) movq -0x8d8(%rbp), %rdi callq 0x93b0 movq %rax, -0x908(%rbp) leaq -0x8d0(%rbp), %rdi movl $0x401, %esi # imm = 0x401 callq 0x57710 cmpl $0x0, %eax je 0x70496 movq -0x38(%rbp), %rdi leaq 0x12e9f(%rip), %rsi # 0x83321 movb $0x0, %al callq 0x19d00 movq $0x0, -0x900(%rbp) jmp 0x704a9 leaq -0x8d0(%rbp), %rdi callq 0x93b0 movq %rax, -0x900(%rbp) movq -0x50(%rbp), %rax cmpl $0x0, 0x18(%rax) je 0x705cd movq -0x38(%rbp), %rdi leaq -0x938(%rbp), %rsi movl $0x8, %edx callq 0x5b930 movl %eax, -0x64(%rbp) cmpl $0x0, -0x64(%rbp) je 0x704e0 movl -0x64(%rbp), %eax movl %eax, -0x2c(%rbp) jmp 0x70ee8 movq -0x38(%rbp), %rdi movq -0x48(%rbp), %rsi leaq -0x930(%rbp), %rdx callq 0x5a270 movl %eax, -0x64(%rbp) cmpl $0x0, -0x64(%rbp) je 0x70508 movl -0x64(%rbp), %eax movl %eax, -0x2c(%rbp) jmp 0x70ee8 movq -0x8d8(%rbp), %rdi movq -0x908(%rbp), %rsi movq -0x8e0(%rbp), %rdx movq -0x910(%rbp), %rcx leaq -0x930(%rbp), %r8 leaq -0x950(%rbp), %r9 callq 0x5a450 movl %eax, -0x64(%rbp) cmpl $0x0, -0x64(%rbp) je 0x7054b movl -0x64(%rbp), %eax movl %eax, -0x2c(%rbp) jmp 0x70ee8 leaq -0x950(%rbp), %rdi leaq -0x938(%rbp), %rsi movq -0x50(%rbp), %rdx addq $0x8, %rdx leaq -0x490(%rbp), %rcx callq 0x5a7c0 movl %eax, -0x64(%rbp) cmpl $0x0, -0x64(%rbp) je 0x70581 movl -0x64(%rbp), %eax movl %eax, -0x2c(%rbp) jmp 0x70ee8 leaq -0x950(%rbp), %rdi leaq -0x938(%rbp), %rsi movq -0x50(%rbp), %rdx leaq -0x4c0(%rbp), %rcx leaq -0x498(%rbp), %r8 callq 0x5a5e0 movl %eax, -0x64(%rbp) cmpl $0x0, -0x64(%rbp) je 0x705ba movl -0x64(%rbp), %eax movl %eax, -0x2c(%rbp) jmp 0x70ee8 movq -0x4c0(%rbp), %rax movq %rax, -0x4b8(%rbp) jmp 0x70740 movq -0x50(%rbp), %rax movl 0x4(%rax), %eax andl $0x80000, %eax # imm = 0x80000 cmpl $0x0, %eax je 0x706b8 movq -0x38(%rbp), %rdi leaq -0x9a8(%rbp), %rsi movl $0x8, %edx callq 0x5b930 movl %eax, -0x64(%rbp) cmpl $0x0, -0x64(%rbp) je 0x7060b movl -0x64(%rbp), %eax movl %eax, -0x2c(%rbp) jmp 0x70ee8 movq -0x9a8(%rbp), %rax movq %rax, -0x490(%rbp) leaq -0x490(%rbp), %rdi addq $0x8, %rdi xorl %esi, %esi movl $0x10, %edx callq 0x9520 movq -0x50(%rbp), %rax movq 0x8(%rax), %rax movq %rax, -0x990(%rbp) movq -0x9a8(%rbp), %rax movq %rax, -0x988(%rbp) leaq -0x990(%rbp), %rdi leaq -0x9a0(%rbp), %rdx movl $0x10, %ecx movq %rcx, %rsi callq 0x79ef0 movl %eax, -0x64(%rbp) cmpl $0x0, -0x64(%rbp) jne 0x70688 movq -0x38(%rbp), %rdi movq -0x48(%rbp), %rsi leaq -0x970(%rbp), %rdx callq 0x5a270 movl %eax, -0x64(%rbp) cmpl $0x0, -0x64(%rbp) je 0x70699 movl -0x64(%rbp), %eax movl %eax, -0x2c(%rbp) jmp 0x70ee8 leaq -0x970(%rbp), %rdi leaq -0x9a0(%rbp), %rsi leaq -0x4b0(%rbp), %rdx callq 0x5a060 jmp 0x7073e movq -0x38(%rbp), %rdi movq -0x48(%rbp), %rsi leaq -0x9c0(%rbp), %rdx callq 0x5a270 movl %eax, -0x64(%rbp) cmpl $0x0, -0x64(%rbp) je 0x706e0 movl -0x64(%rbp), %eax movl %eax, -0x2c(%rbp) jmp 0x70ee8 leaq -0x9c0(%rbp), %rdi movq -0x50(%rbp), %rsi addq $0x8, %rsi leaq -0x4b0(%rbp), %rdx callq 0x5a060 movq -0x38(%rbp), %rdi movq -0x48(%rbp), %rsi leaq -0x9e0(%rbp), %rdx callq 0x5a150 movl %eax, -0x64(%rbp) cmpl $0x0, -0x64(%rbp) je 0x70723 movl -0x64(%rbp), %eax movl %eax, -0x2c(%rbp) jmp 0x70ee8 leaq -0x9e0(%rbp), %rdi movq -0x50(%rbp), %rsi addq $0x8, %rsi leaq -0x490(%rbp), %rdx callq 0x5a060 jmp 0x70740 testb $0x1, -0x4c1(%rbp) je 0x7077c movq -0x910(%rbp), %rax shlq %rax movq %rax, -0x910(%rbp) movq -0x908(%rbp), %rax shlq %rax movq %rax, -0x908(%rbp) movq -0x900(%rbp), %rax shlq %rax movq %rax, -0x900(%rbp) movl $0x40, -0x474(%rbp) movl -0x474(%rbp), %eax addl $0x18, %eax movl %eax, -0x494(%rbp) movl -0x494(%rbp), %eax addl -0x498(%rbp), %eax movl %eax, %eax movq %rax, -0x8f8(%rbp) movq -0x8f8(%rbp), %rax addq -0x910(%rbp), %rax movq %rax, -0x8f0(%rbp) movq -0x8f0(%rbp), %rax addq -0x908(%rbp), %rax movq %rax, -0x8e8(%rbp) leaq -0x470(%rbp), %rdi movl -0x474(%rbp), %eax andl $0xff, %eax movl -0x474(%rbp), %ecx sarl $0x8, %ecx andl $0xff, %ecx movl %ecx, -0xa74(%rbp) movl -0x498(%rbp), %ecx andl $0xff, %ecx movl %ecx, -0xa70(%rbp) movl -0x498(%rbp), %ecx shrl $0x8, %ecx andl $0xff, %ecx movl %ecx, -0xa6c(%rbp) movl -0x498(%rbp), %ecx andl $0xff, %ecx movl %ecx, -0xa68(%rbp) movl -0x498(%rbp), %ecx shrl $0x8, %ecx andl $0xff, %ecx movl %ecx, -0xa64(%rbp) movl -0x494(%rbp), %ecx andl $0xff, %ecx movl %ecx, -0xa60(%rbp) movl -0x494(%rbp), %ecx sarl $0x8, %ecx andl $0xff, %ecx movl %ecx, -0xa5c(%rbp) movq -0x910(%rbp), %rcx andq $0xff, %rcx movq %rcx, -0xa58(%rbp) movq -0x910(%rbp), %rcx shrq $0x8, %rcx andq $0xff, %rcx movq %rcx, -0xa50(%rbp) movq -0x910(%rbp), %rcx andq $0xff, %rcx movq %rcx, -0xa48(%rbp) movq -0x910(%rbp), %rcx shrq $0x8, %rcx andq $0xff, %rcx movq %rcx, -0xa40(%rbp) movq -0x8f8(%rbp), %rcx andq $0xff, %rcx movq %rcx, -0xa38(%rbp) movq -0x8f8(%rbp), %rcx shrq $0x8, %rcx andq $0xff, %rcx movq %rcx, -0xa30(%rbp) movq -0x908(%rbp), %rcx andq $0xff, %rcx movq %rcx, -0xa28(%rbp) movq -0x908(%rbp), %rcx shrq $0x8, %rcx andq $0xff, %rcx movq %rcx, -0xa20(%rbp) movq -0x908(%rbp), %rcx andq $0xff, %rcx movq %rcx, -0xa18(%rbp) movq -0x908(%rbp), %rcx shrq $0x8, %rcx andq $0xff, %rcx movq %rcx, -0xa10(%rbp) movq -0x8f0(%rbp), %rcx andq $0xff, %rcx movq %rcx, -0xa08(%rbp) movq -0x8f0(%rbp), %rcx shrq $0x8, %rcx andq $0xff, %rcx movq %rcx, -0xa00(%rbp) movq -0x900(%rbp), %rcx andq $0xff, %rcx movq %rcx, -0x9f8(%rbp) movq -0x900(%rbp), %rcx shrq $0x8, %rcx andq $0xff, %rcx movq %rcx, -0x9f0(%rbp) movq -0x900(%rbp), %r13 andq $0xff, %r13 movq -0x900(%rbp), %r12 shrq $0x8, %r12 andq $0xff, %r12 movq -0x8e8(%rbp), %r15 andq $0xff, %r15 movq -0x8e8(%rbp), %r14 shrq $0x8, %r14 andq $0xff, %r14 movq -0x50(%rbp), %rcx movl 0x4(%rcx), %ebx andl $0xff, %ebx movq -0x50(%rbp), %rcx movl 0x4(%rcx), %r11d shrl $0x8, %r11d andl $0xff, %r11d movq -0x50(%rbp), %rcx movl 0x4(%rcx), %r10d shrl $0x10, %r10d andl $0xff, %r10d movq -0x50(%rbp), %rcx movl 0x4(%rcx), %ecx shrl $0x18, %ecx andl $0xff, %ecx movl %ecx, -0x9e4(%rbp) movl $0x400, %esi # imm = 0x400 leaq 0x12905(%rip), %rdx # 0x8334c xorl %r9d, %r9d movl %r9d, %ecx movl %r9d, %r8d movl $0x0, (%rsp) movl $0x18, 0x8(%rsp) movl $0x0, 0x10(%rsp) movl $0x18, 0x18(%rsp) movl $0x0, 0x20(%rsp) movl %eax, 0x28(%rsp) movl -0xa74(%rbp), %eax movl %eax, 0x30(%rsp) movl -0xa70(%rbp), %eax movl $0x0, 0x38(%rsp) movl $0x0, 0x40(%rsp) movl %eax, 0x48(%rsp) movl -0xa6c(%rbp), %eax movl %eax, 0x50(%rsp) movl -0xa68(%rbp), %eax movl %eax, 0x58(%rsp) movl -0xa64(%rbp), %eax movl %eax, 0x60(%rsp) movl -0xa60(%rbp), %eax movl %eax, 0x68(%rsp) movl -0xa5c(%rbp), %eax movl %eax, 0x70(%rsp) movq -0xa58(%rbp), %rax movl $0x0, 0x78(%rsp) movl $0x0, 0x80(%rsp) movq %rax, 0x88(%rsp) movq -0xa50(%rbp), %rax movq %rax, 0x90(%rsp) movq -0xa48(%rbp), %rax movq %rax, 0x98(%rsp) movq -0xa40(%rbp), %rax movq %rax, 0xa0(%rsp) movq -0xa38(%rbp), %rax movq %rax, 0xa8(%rsp) movq -0xa30(%rbp), %rax movq %rax, 0xb0(%rsp) movq -0xa28(%rbp), %rax movl $0x0, 0xb8(%rsp) movl $0x0, 0xc0(%rsp) movq %rax, 0xc8(%rsp) movq -0xa20(%rbp), %rax movq %rax, 0xd0(%rsp) movq -0xa18(%rbp), %rax movq %rax, 0xd8(%rsp) movq -0xa10(%rbp), %rax movq %rax, 0xe0(%rsp) movq -0xa08(%rbp), %rax movq %rax, 0xe8(%rsp) movq -0xa00(%rbp), %rax movq %rax, 0xf0(%rsp) movq -0x9f8(%rbp), %rax movl $0x0, 0xf8(%rsp) movl $0x0, 0x100(%rsp) movq %rax, 0x108(%rsp) movq -0x9f0(%rbp), %rax movq %rax, 0x110(%rsp) movl -0x9e4(%rbp), %eax movq %r13, 0x118(%rsp) movq %r12, 0x120(%rsp) movq %r15, 0x128(%rsp) movq %r14, 0x130(%rsp) movl $0x0, 0x138(%rsp) movl $0x0, 0x140(%rsp) movl $0x0, 0x148(%rsp) movl $0x0, 0x150(%rsp) movl $0x0, 0x158(%rsp) movl $0x0, 0x160(%rsp) movl $0x0, 0x168(%rsp) movl $0x0, 0x170(%rsp) movl $0x0, 0x178(%rsp) movl $0x0, 0x180(%rsp) movl %ebx, 0x188(%rsp) movl %r11d, 0x190(%rsp) movl %r10d, 0x198(%rsp) movl %eax, 0x1a0(%rsp) movb $0x0, %al callq 0x9510 cltq movq %rax, -0x70(%rbp) jmp 0x70ca3 jmp 0x70ca5 jmp 0x70ca7 cmpq $0x3e8, -0x70(%rbp) # imm = 0x3E8 jae 0x70cee movq -0x70(%rbp), %rax movq -0x490(%rbp), %rcx movq %rcx, -0x470(%rbp,%rax) movq -0x488(%rbp), %rcx movq %rcx, -0x468(%rbp,%rax) movq -0x480(%rbp), %rcx movq %rcx, -0x460(%rbp,%rax) movq -0x70(%rbp), %rax addq $0x18, %rax movq %rax, -0x70(%rbp) jmp 0x70cf0 jmp 0x70cf2 movq -0x70(%rbp), %rax movl $0x400, %ecx # imm = 0x400 subl -0x498(%rbp), %ecx movl %ecx, %ecx cmpq %rcx, %rax jae 0x70d39 jmp 0x70d0a jmp 0x70d0c leaq -0x470(%rbp), %rdi addq -0x70(%rbp), %rdi movq -0x4b8(%rbp), %rsi movl -0x498(%rbp), %eax movl %eax, %edx callq 0x97b0 movl -0x498(%rbp), %eax addq -0x70(%rbp), %rax movq %rax, -0x70(%rbp) jmp 0x70d3b jmp 0x70d3d leaq 0x22d0c(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x4c0(%rbp), %rdi callq *%rax jmp 0x70d52 movq -0x70(%rbp), %rax addq -0x908(%rbp), %rax addq -0x910(%rbp), %rax addq -0x900(%rbp), %rax cmpq $0x400, %rax # imm = 0x400 jb 0x70d91 movq -0x38(%rbp), %rdi leaq 0x12647(%rip), %rsi # 0x833c5 movb $0x0, %al callq 0x19f90 movl $0x1b, -0x2c(%rbp) jmp 0x70ee8 jmp 0x70d93 jmp 0x70d95 testb $0x1, -0x4c1(%rbp) je 0x70dc1 leaq -0x470(%rbp), %rdi addq -0x70(%rbp), %rdi movq -0x8e0(%rbp), %rsi movq -0x910(%rbp), %rdx shrq %rdx callq 0x70f00 jmp 0x70ddf leaq -0x470(%rbp), %rdi addq -0x70(%rbp), %rdi movq -0x8e0(%rbp), %rsi movq -0x910(%rbp), %rdx callq 0x97b0 movq -0x910(%rbp), %rax addq -0x70(%rbp), %rax movq %rax, -0x70(%rbp) jmp 0x70df0 testb $0x1, -0x4c1(%rbp) je 0x70e1c leaq -0x470(%rbp), %rdi addq -0x70(%rbp), %rdi movq -0x8d8(%rbp), %rsi movq -0x908(%rbp), %rdx shrq %rdx callq 0x70f00 jmp 0x70e3a leaq -0x470(%rbp), %rdi addq -0x70(%rbp), %rdi movq -0x8d8(%rbp), %rsi movq -0x908(%rbp), %rdx callq 0x97b0 movq -0x908(%rbp), %rax addq -0x70(%rbp), %rax movq %rax, -0x70(%rbp) jmp 0x70e4b testb $0x1, -0x4c1(%rbp) je 0x70e77 leaq -0x470(%rbp), %rdi addq -0x70(%rbp), %rdi leaq -0x8d0(%rbp), %rsi movq -0x900(%rbp), %rdx shrq %rdx callq 0x70f00 jmp 0x70e95 leaq -0x470(%rbp), %rdi addq -0x70(%rbp), %rdi leaq -0x8d0(%rbp), %rsi movq -0x900(%rbp), %rdx callq 0x97b0 movq -0x900(%rbp), %rax addq -0x70(%rbp), %rax movq %rax, -0x70(%rbp) movl $0x0, -0x64(%rbp) cmpl $0x0, -0x64(%rbp) je 0x70eba movl $0x4b, -0x2c(%rbp) jmp 0x70ee8 movq -0x38(%rbp), %rdi leaq -0x470(%rbp), %rsi movq -0x70(%rbp), %rdx movq -0x58(%rbp), %rcx movq -0x60(%rbp), %r8 callq 0xb630 movl %eax, -0x64(%rbp) movq -0x50(%rbp), %rdi callq 0x702b0 movl -0x64(%rbp), %eax movl %eax, -0x2c(%rbp) movl -0x2c(%rbp), %eax addq $0xbf8, %rsp # imm = 0xBF8 popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq nopl (%rax)
/macressler[P]curl/lib/vauth/ntlm.c
ossl_connect_common
static CURLcode ossl_connect_common(struct connectdata *conn, int sockindex, bool nonblocking, bool *done) { CURLcode result; struct Curl_easy *data = conn->data; struct ssl_connect_data *connssl = &conn->ssl[sockindex]; curl_socket_t sockfd = conn->sock[sockindex]; time_t timeout_ms; int what; /* check if the connection has already been established */ if(ssl_connection_complete == connssl->state) { *done = TRUE; return CURLE_OK; } if(ssl_connect_1 == connssl->connecting_state) { /* Find out how much more time we're allowed */ timeout_ms = Curl_timeleft(data, NULL, TRUE); if(timeout_ms < 0) { /* no need to continue if time already is up */ failf(data, "SSL connection timeout"); return CURLE_OPERATION_TIMEDOUT; } result = ossl_connect_step1(conn, sockindex); if(result) return result; } while(ssl_connect_2 == connssl->connecting_state || ssl_connect_2_reading == connssl->connecting_state || ssl_connect_2_writing == connssl->connecting_state) { /* check allowed time left */ timeout_ms = Curl_timeleft(data, NULL, TRUE); if(timeout_ms < 0) { /* no need to continue if time already is up */ failf(data, "SSL connection timeout"); return CURLE_OPERATION_TIMEDOUT; } /* if ssl is expecting something, check if it's available. */ if(connssl->connecting_state == ssl_connect_2_reading || connssl->connecting_state == ssl_connect_2_writing) { curl_socket_t writefd = ssl_connect_2_writing == connssl->connecting_state?sockfd:CURL_SOCKET_BAD; curl_socket_t readfd = ssl_connect_2_reading == connssl->connecting_state?sockfd:CURL_SOCKET_BAD; what = Curl_socket_check(readfd, CURL_SOCKET_BAD, writefd, nonblocking?0:timeout_ms); if(what < 0) { /* fatal error */ failf(data, "select/poll on SSL socket, errno: %d", SOCKERRNO); return CURLE_SSL_CONNECT_ERROR; } if(0 == what) { if(nonblocking) { *done = FALSE; return CURLE_OK; } /* timeout */ failf(data, "SSL connection timeout"); return CURLE_OPERATION_TIMEDOUT; } /* socket is readable or writable */ } /* Run transaction, and return to the caller if it failed or if this * connection is done nonblocking and this loop would execute again. This * permits the owner of a multi handle to abort a connection attempt * before step2 has completed while ensuring that a client using select() * or epoll() will always have a valid fdset to wait on. */ result = ossl_connect_step2(conn, sockindex); if(result || (nonblocking && (ssl_connect_2 == connssl->connecting_state || ssl_connect_2_reading == connssl->connecting_state || ssl_connect_2_writing == connssl->connecting_state))) return result; } /* repeat step2 until all transactions are done. */ if(ssl_connect_3 == connssl->connecting_state) { result = ossl_connect_step3(conn, sockindex); if(result) return result; } if(ssl_connect_done == connssl->connecting_state) { connssl->state = ssl_connection_complete; conn->recv[sockindex] = ossl_recv; conn->send[sockindex] = ossl_send; *done = TRUE; } else *done = FALSE; /* Reset our connect state machine */ connssl->connecting_state = ssl_connect_1; return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0x80, %rsp movb %dl, %al movq %rdi, -0x10(%rbp) movl %esi, -0x14(%rbp) andb $0x1, %al movb %al, -0x15(%rbp) movq %rcx, -0x20(%rbp) movq -0x10(%rbp), %rax movq (%rax), %rax movq %rax, -0x30(%rbp) movq -0x10(%rbp), %rax addq $0x290, %rax # imm = 0x290 movslq -0x14(%rbp), %rcx imulq $0x18, %rcx, %rcx addq %rcx, %rax movq %rax, -0x38(%rbp) movq -0x10(%rbp), %rax movslq -0x14(%rbp), %rcx movl 0x258(%rax,%rcx,4), %eax movl %eax, -0x3c(%rbp) movq -0x38(%rbp), %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax jne 0x720e4 movq -0x20(%rbp), %rax movb $0x1, (%rax) movl $0x0, -0x4(%rbp) jmp 0x723c8 movq -0x38(%rbp), %rcx xorl %eax, %eax cmpl 0x8(%rcx), %eax jne 0x7214c movq -0x30(%rbp), %rdi xorl %eax, %eax movl %eax, %esi movl $0x1, %edx callq 0x3ad90 movq %rax, -0x48(%rbp) cmpq $0x0, -0x48(%rbp) jge 0x7212a movq -0x30(%rbp), %rdi leaq 0x11678(%rip), %rsi # 0x8378f movb $0x0, %al callq 0x19f90 movl $0x1c, -0x4(%rbp) jmp 0x723c8 movq -0x10(%rbp), %rdi movl -0x14(%rbp), %esi callq 0x723e0 movl %eax, -0x24(%rbp) cmpl $0x0, -0x24(%rbp) je 0x7214a movl -0x24(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x723c8 jmp 0x7214c jmp 0x7214e movq -0x38(%rbp), %rdx movb $0x1, %al movl $0x1, %ecx cmpl 0x8(%rdx), %ecx movb %al, -0x55(%rbp) je 0x72186 movq -0x38(%rbp), %rdx movb $0x1, %al movl $0x2, %ecx cmpl 0x8(%rdx), %ecx movb %al, -0x55(%rbp) je 0x72186 movq -0x38(%rbp), %rcx movl $0x3, %eax cmpl 0x8(%rcx), %eax sete %al movb %al, -0x55(%rbp) movb -0x55(%rbp), %al testb $0x1, %al jne 0x72192 jmp 0x72332 movq -0x30(%rbp), %rdi xorl %eax, %eax movl %eax, %esi movl $0x1, %edx callq 0x3ad90 movq %rax, -0x48(%rbp) cmpq $0x0, -0x48(%rbp) jge 0x721cd movq -0x30(%rbp), %rdi leaq 0x115d5(%rip), %rsi # 0x8378f movb $0x0, %al callq 0x19f90 movl $0x1c, -0x4(%rbp) jmp 0x723c8 movq -0x38(%rbp), %rax cmpl $0x2, 0x8(%rax) je 0x721e5 movq -0x38(%rbp), %rax cmpl $0x3, 0x8(%rax) jne 0x722dd movq -0x38(%rbp), %rcx movl $0x3, %eax cmpl 0x8(%rcx), %eax jne 0x721fb movl -0x3c(%rbp), %eax movl %eax, -0x5c(%rbp) jmp 0x72205 movl $0xffffffff, %eax # imm = 0xFFFFFFFF movl %eax, -0x5c(%rbp) jmp 0x72205 movl -0x5c(%rbp), %eax movl %eax, -0x50(%rbp) movq -0x38(%rbp), %rcx movl $0x2, %eax cmpl 0x8(%rcx), %eax jne 0x72221 movl -0x3c(%rbp), %eax movl %eax, -0x60(%rbp) jmp 0x7222b movl $0xffffffff, %eax # imm = 0xFFFFFFFF movl %eax, -0x60(%rbp) jmp 0x7222b movl -0x60(%rbp), %eax movl %eax, -0x54(%rbp) movl -0x54(%rbp), %eax movl %eax, -0x68(%rbp) movl -0x50(%rbp), %eax movl %eax, -0x64(%rbp) testb $0x1, -0x15(%rbp) je 0x7224b xorl %eax, %eax movq %rax, -0x70(%rbp) jmp 0x72253 movq -0x48(%rbp), %rax movq %rax, -0x70(%rbp) movl -0x64(%rbp), %edx movl -0x68(%rbp), %edi movq -0x70(%rbp), %rcx movl $0xffffffff, %esi # imm = 0xFFFFFFFF callq 0x47260 movl %eax, -0x4c(%rbp) cmpl $0x0, -0x4c(%rbp) jge 0x7229d movq -0x30(%rbp), %rax movq %rax, -0x78(%rbp) callq 0x90b0 movq -0x78(%rbp), %rdi movl (%rax), %edx leaq 0x113c0(%rip), %rsi # 0x8364a movb $0x0, %al callq 0x19f90 movl $0x23, -0x4(%rbp) jmp 0x723c8 xorl %eax, %eax cmpl -0x4c(%rbp), %eax jne 0x722db testb $0x1, -0x15(%rbp) je 0x722bd movq -0x20(%rbp), %rax movb $0x0, (%rax) movl $0x0, -0x4(%rbp) jmp 0x723c8 movq -0x30(%rbp), %rdi leaq 0x114c7(%rip), %rsi # 0x8378f movb $0x0, %al callq 0x19f90 movl $0x1c, -0x4(%rbp) jmp 0x723c8 jmp 0x722dd movq -0x10(%rbp), %rdi movl -0x14(%rbp), %esi callq 0x73670 movl %eax, -0x24(%rbp) cmpl $0x0, -0x24(%rbp) jne 0x72322 testb $0x1, -0x15(%rbp) je 0x7232d movq -0x38(%rbp), %rcx movl $0x1, %eax cmpl 0x8(%rcx), %eax je 0x72322 movq -0x38(%rbp), %rcx movl $0x2, %eax cmpl 0x8(%rcx), %eax je 0x72322 movq -0x38(%rbp), %rcx movl $0x3, %eax cmpl 0x8(%rcx), %eax jne 0x7232d movl -0x24(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x723c8 jmp 0x7214e movq -0x38(%rbp), %rcx movl $0x4, %eax cmpl 0x8(%rcx), %eax jne 0x7235f movq -0x10(%rbp), %rdi movl -0x14(%rbp), %esi callq 0x73b60 movl %eax, -0x24(%rbp) cmpl $0x0, -0x24(%rbp) je 0x7235d movl -0x24(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x723c8 jmp 0x7235f movq -0x38(%rbp), %rcx movl $0x5, %eax cmpl 0x8(%rcx), %eax jne 0x723af movq -0x38(%rbp), %rax movl $0x2, 0x4(%rax) movq -0x10(%rbp), %rax movslq -0x14(%rbp), %rcx leaq 0x1a89(%rip), %rdx # 0x73e10 movq %rdx, 0x270(%rax,%rcx,8) movq -0x10(%rbp), %rax movslq -0x14(%rbp), %rcx leaq 0x1c52(%rip), %rdx # 0x73ff0 movq %rdx, 0x280(%rax,%rcx,8) movq -0x20(%rbp), %rax movb $0x1, (%rax) jmp 0x723b6 movq -0x20(%rbp), %rax movb $0x0, (%rax) movq -0x38(%rbp), %rax movl $0x0, 0x8(%rax) movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x80, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/macressler[P]curl/lib/vtls/openssl.c
ossl_connect_step1
static CURLcode ossl_connect_step1(struct connectdata *conn, int sockindex) { CURLcode result = CURLE_OK; char *ciphers; struct Curl_easy *data = conn->data; SSL_METHOD_QUAL SSL_METHOD *req_method = NULL; X509_LOOKUP *lookup = NULL; curl_socket_t sockfd = conn->sock[sockindex]; struct ssl_connect_data *connssl = &conn->ssl[sockindex]; long ctx_options = 0; #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME bool sni; const char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name : conn->host.name; #ifdef ENABLE_IPV6 struct in6_addr addr; #else struct in_addr addr; #endif #endif long * const certverifyresult = SSL_IS_PROXY() ? &data->set.proxy_ssl.certverifyresult : &data->set.ssl.certverifyresult; const long int ssl_version = SSL_CONN_CONFIG(version); #ifdef USE_TLS_SRP const enum CURL_TLSAUTH ssl_authtype = SSL_SET_OPTION(authtype); #endif char * const ssl_cert = SSL_SET_OPTION(cert); const char * const ssl_cert_type = SSL_SET_OPTION(cert_type); const char * const ssl_cafile = SSL_CONN_CONFIG(CAfile); const char * const ssl_capath = SSL_CONN_CONFIG(CApath); const bool verifypeer = SSL_CONN_CONFIG(verifypeer); const char * const ssl_crlfile = SSL_SET_OPTION(CRLfile); char error_buffer[256]; DEBUGASSERT(ssl_connect_1 == connssl->connecting_state); /* Make funny stuff to get random input */ result = Curl_ossl_seed(data); if(result) return result; *certverifyresult = !X509_V_OK; /* check to see if we've been told to use an explicit SSL/TLS version */ switch(ssl_version) { case CURL_SSLVERSION_DEFAULT: case CURL_SSLVERSION_TLSv1: case CURL_SSLVERSION_TLSv1_0: case CURL_SSLVERSION_TLSv1_1: case CURL_SSLVERSION_TLSv1_2: case CURL_SSLVERSION_TLSv1_3: /* it will be handled later with the context options */ #if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && \ !defined(LIBRESSL_VERSION_NUMBER) req_method = TLS_client_method(); #else req_method = SSLv23_client_method(); #endif use_sni(TRUE); break; case CURL_SSLVERSION_SSLv2: #ifdef OPENSSL_NO_SSL2 failf(data, OSSL_PACKAGE " was built without SSLv2 support"); return CURLE_NOT_BUILT_IN; #else #ifdef USE_TLS_SRP if(ssl_authtype == CURL_TLSAUTH_SRP) return CURLE_SSL_CONNECT_ERROR; #endif req_method = SSLv2_client_method(); use_sni(FALSE); break; #endif case CURL_SSLVERSION_SSLv3: #ifdef OPENSSL_NO_SSL3_METHOD failf(data, OSSL_PACKAGE " was built without SSLv3 support"); return CURLE_NOT_BUILT_IN; #else #ifdef USE_TLS_SRP if(ssl_authtype == CURL_TLSAUTH_SRP) return CURLE_SSL_CONNECT_ERROR; #endif req_method = SSLv3_client_method(); use_sni(FALSE); break; #endif default: failf(data, "Unrecognized parameter passed via CURLOPT_SSLVERSION"); return CURLE_SSL_CONNECT_ERROR; } if(BACKEND->ctx) SSL_CTX_free(BACKEND->ctx); BACKEND->ctx = SSL_CTX_new(req_method); if(!BACKEND->ctx) { failf(data, "SSL: couldn't create a context: %s", ossl_strerror(ERR_peek_error(), error_buffer, sizeof(error_buffer))); return CURLE_OUT_OF_MEMORY; } #ifdef SSL_MODE_RELEASE_BUFFERS SSL_CTX_set_mode(BACKEND->ctx, SSL_MODE_RELEASE_BUFFERS); #endif #ifdef SSL_CTRL_SET_MSG_CALLBACK if(data->set.fdebug && data->set.verbose) { /* the SSL trace callback is only used for verbose logging */ SSL_CTX_set_msg_callback(BACKEND->ctx, ssl_tls_trace); SSL_CTX_set_msg_callback_arg(BACKEND->ctx, conn); } #endif /* OpenSSL contains code to work-around lots of bugs and flaws in various SSL-implementations. SSL_CTX_set_options() is used to enabled those work-arounds. The man page for this option states that SSL_OP_ALL enables all the work-arounds and that "It is usually safe to use SSL_OP_ALL to enable the bug workaround options if compatibility with somewhat broken implementations is desired." The "-no_ticket" option was introduced in Openssl0.9.8j. It's a flag to disable "rfc4507bis session ticket support". rfc4507bis was later turned into the proper RFC5077 it seems: https://tools.ietf.org/html/rfc5077 The enabled extension concerns the session management. I wonder how often libcurl stops a connection and then resumes a TLS session. also, sending the session data is some overhead. .I suggest that you just use your proposed patch (which explicitly disables TICKET). If someone writes an application with libcurl and openssl who wants to enable the feature, one can do this in the SSL callback. SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG option enabling allowed proper interoperability with web server Netscape Enterprise Server 2.0.1 which was released back in 1996. Due to CVE-2010-4180, option SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG has become ineffective as of OpenSSL 0.9.8q and 1.0.0c. In order to mitigate CVE-2010-4180 when using previous OpenSSL versions we no longer enable this option regardless of OpenSSL version and SSL_OP_ALL definition. OpenSSL added a work-around for a SSL 3.0/TLS 1.0 CBC vulnerability (https://www.openssl.org/~bodo/tls-cbc.txt). In 0.9.6e they added a bit to SSL_OP_ALL that _disables_ that work-around despite the fact that SSL_OP_ALL is documented to do "rather harmless" workarounds. In order to keep the secure work-around, the SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS bit must not be set. */ ctx_options = SSL_OP_ALL; #ifdef SSL_OP_NO_TICKET ctx_options |= SSL_OP_NO_TICKET; #endif #ifdef SSL_OP_NO_COMPRESSION ctx_options |= SSL_OP_NO_COMPRESSION; #endif #ifdef SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG /* mitigate CVE-2010-4180 */ ctx_options &= ~SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG; #endif #ifdef SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS /* unless the user explicitly ask to allow the protocol vulnerability we use the work-around */ if(!SSL_SET_OPTION(enable_beast)) ctx_options &= ~SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS; #endif switch(ssl_version) { case CURL_SSLVERSION_SSLv3: #ifdef USE_TLS_SRP if(ssl_authtype == CURL_TLSAUTH_SRP) { infof(data, "Set version TLSv1.x for SRP authorisation\n"); } #endif ctx_options |= SSL_OP_NO_SSLv2; ctx_options |= SSL_OP_NO_TLSv1; #if OPENSSL_VERSION_NUMBER >= 0x1000100FL ctx_options |= SSL_OP_NO_TLSv1_1; ctx_options |= SSL_OP_NO_TLSv1_2; #ifdef TLS1_3_VERSION ctx_options |= SSL_OP_NO_TLSv1_3; #endif #endif break; case CURL_SSLVERSION_DEFAULT: case CURL_SSLVERSION_TLSv1: ctx_options |= SSL_OP_NO_SSLv2; ctx_options |= SSL_OP_NO_SSLv3; break; case CURL_SSLVERSION_TLSv1_0: case CURL_SSLVERSION_TLSv1_1: case CURL_SSLVERSION_TLSv1_2: case CURL_SSLVERSION_TLSv1_3: result = set_ssl_version_min_max(&ctx_options, conn, sockindex); if(result != CURLE_OK) return result; break; case CURL_SSLVERSION_SSLv2: #ifndef OPENSSL_NO_SSL2 ctx_options |= SSL_OP_NO_SSLv3; ctx_options |= SSL_OP_NO_TLSv1; #if OPENSSL_VERSION_NUMBER >= 0x1000100FL ctx_options |= SSL_OP_NO_TLSv1_1; ctx_options |= SSL_OP_NO_TLSv1_2; #ifdef TLS1_3_VERSION ctx_options |= SSL_OP_NO_TLSv1_3; #endif #endif break; #else failf(data, OSSL_PACKAGE " was built without SSLv2 support"); return CURLE_NOT_BUILT_IN; #endif default: failf(data, "Unrecognized parameter passed via CURLOPT_SSLVERSION"); return CURLE_SSL_CONNECT_ERROR; } SSL_CTX_set_options(BACKEND->ctx, ctx_options); #ifdef HAS_NPN if(conn->bits.tls_enable_npn) SSL_CTX_set_next_proto_select_cb(BACKEND->ctx, select_next_proto_cb, conn); #endif #ifdef HAS_ALPN if(conn->bits.tls_enable_alpn) { int cur = 0; unsigned char protocols[128]; #ifdef USE_NGHTTP2 if(data->set.httpversion >= CURL_HTTP_VERSION_2 && (!SSL_IS_PROXY() || !conn->bits.tunnel_proxy)) { protocols[cur++] = NGHTTP2_PROTO_VERSION_ID_LEN; memcpy(&protocols[cur], NGHTTP2_PROTO_VERSION_ID, NGHTTP2_PROTO_VERSION_ID_LEN); cur += NGHTTP2_PROTO_VERSION_ID_LEN; infof(data, "ALPN, offering %s\n", NGHTTP2_PROTO_VERSION_ID); } #endif protocols[cur++] = ALPN_HTTP_1_1_LENGTH; memcpy(&protocols[cur], ALPN_HTTP_1_1, ALPN_HTTP_1_1_LENGTH); cur += ALPN_HTTP_1_1_LENGTH; infof(data, "ALPN, offering %s\n", ALPN_HTTP_1_1); /* expects length prefixed preference ordered list of protocols in wire * format */ SSL_CTX_set_alpn_protos(BACKEND->ctx, protocols, cur); } #endif if(ssl_cert || ssl_cert_type) { if(!cert_stuff(conn, BACKEND->ctx, ssl_cert, ssl_cert_type, SSL_SET_OPTION(key), SSL_SET_OPTION(key_type), SSL_SET_OPTION(key_passwd))) { /* failf() is already done in cert_stuff() */ return CURLE_SSL_CERTPROBLEM; } } ciphers = SSL_CONN_CONFIG(cipher_list); if(!ciphers) ciphers = (char *)DEFAULT_CIPHER_SELECTION; if(ciphers) { if(!SSL_CTX_set_cipher_list(BACKEND->ctx, ciphers)) { failf(data, "failed setting cipher list: %s", ciphers); return CURLE_SSL_CIPHER; } infof(data, "Cipher selection: %s\n", ciphers); } #ifdef USE_TLS_SRP if(ssl_authtype == CURL_TLSAUTH_SRP) { char * const ssl_username = SSL_SET_OPTION(username); infof(data, "Using TLS-SRP username: %s\n", ssl_username); if(!SSL_CTX_set_srp_username(BACKEND->ctx, ssl_username)) { failf(data, "Unable to set SRP user name"); return CURLE_BAD_FUNCTION_ARGUMENT; } if(!SSL_CTX_set_srp_password(BACKEND->ctx, SSL_SET_OPTION(password))) { failf(data, "failed setting SRP password"); return CURLE_BAD_FUNCTION_ARGUMENT; } if(!SSL_CONN_CONFIG(cipher_list)) { infof(data, "Setting cipher list SRP\n"); if(!SSL_CTX_set_cipher_list(BACKEND->ctx, "SRP")) { failf(data, "failed setting SRP cipher list"); return CURLE_SSL_CIPHER; } } } #endif if(ssl_cafile || ssl_capath) { if(verifypeer) { /* tell SSL where to find CA certificates that are used to verify the servers certificate. */ if(!SSL_CTX_load_verify_locations(BACKEND->ctx, ssl_cafile, ssl_capath)) { /* Fail if we insist on successfully verifying the server. */ failf(data, "error setting certificate verify locations:\n" " CAfile: %s\n CApath: %s", ssl_cafile ? ssl_cafile : "none", ssl_capath ? ssl_capath : "none"); return CURLE_SSL_CACERT_BADFILE; } else { /* Everything is fine. */ infof(data, "successfully set certificate verify locations:\n" " CAfile: %s\n CApath: %s\n", ssl_cafile ? ssl_cafile : "none", ssl_capath ? ssl_capath : "none"); } } else { infof(data, "ignoring certificate verify locations due to " "disabled peer verification\n"); } } #ifdef CURL_CA_FALLBACK else if(verifypeer) { /* verfying the peer without any CA certificates won't work so use openssl's built in default as fallback */ SSL_CTX_set_default_verify_paths(BACKEND->ctx); } #endif if(ssl_crlfile) { /* tell SSL where to find CRL file that is used to check certificate * revocation */ lookup = X509_STORE_add_lookup(SSL_CTX_get_cert_store(BACKEND->ctx), X509_LOOKUP_file()); if(!lookup || (!X509_load_crl_file(lookup, ssl_crlfile, X509_FILETYPE_PEM)) ) { failf(data, "error loading CRL file: %s", ssl_crlfile); return CURLE_SSL_CRL_BADFILE; } /* Everything is fine. */ infof(data, "successfully load CRL file:\n"); X509_STORE_set_flags(SSL_CTX_get_cert_store(BACKEND->ctx), X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL); infof(data, " CRLfile: %s\n", ssl_crlfile); } /* Try building a chain using issuers in the trusted store first to avoid problems with server-sent legacy intermediates. Newer versions of OpenSSL do alternate chain checking by default which gives us the same fix without as much of a performance hit (slight), so we prefer that if available. https://rt.openssl.org/Ticket/Display.html?id=3621&user=guest&pass=guest */ #if defined(X509_V_FLAG_TRUSTED_FIRST) && !defined(X509_V_FLAG_NO_ALT_CHAINS) if(verifypeer) { X509_STORE_set_flags(SSL_CTX_get_cert_store(BACKEND->ctx), X509_V_FLAG_TRUSTED_FIRST); } #endif /* SSL always tries to verify the peer, this only says whether it should * fail to connect if the verification fails, or if it should continue * anyway. In the latter case the result of the verification is checked with * SSL_get_verify_result() below. */ SSL_CTX_set_verify(BACKEND->ctx, verifypeer ? SSL_VERIFY_PEER : SSL_VERIFY_NONE, NULL); /* Enable logging of secrets to the file specified in env SSLKEYLOGFILE. */ #if defined(ENABLE_SSLKEYLOGFILE) && defined(HAVE_KEYLOG_CALLBACK) if(keylog_file_fp) { SSL_CTX_set_keylog_callback(BACKEND->ctx, ossl_keylog_callback); } #endif /* give application a chance to interfere with SSL set up. */ if(data->set.ssl.fsslctx) { result = (*data->set.ssl.fsslctx)(data, BACKEND->ctx, data->set.ssl.fsslctxp); if(result) { failf(data, "error signaled by ssl ctx callback"); return result; } } /* Lets make an SSL structure */ if(BACKEND->handle) SSL_free(BACKEND->handle); BACKEND->handle = SSL_new(BACKEND->ctx); if(!BACKEND->handle) { failf(data, "SSL: couldn't create a context (handle)!"); return CURLE_OUT_OF_MEMORY; } #if (OPENSSL_VERSION_NUMBER >= 0x0090808fL) && !defined(OPENSSL_NO_TLSEXT) && \ !defined(OPENSSL_NO_OCSP) if(SSL_CONN_CONFIG(verifystatus)) SSL_set_tlsext_status_type(BACKEND->handle, TLSEXT_STATUSTYPE_ocsp); #endif SSL_set_connect_state(BACKEND->handle); BACKEND->server_cert = 0x0; #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME if((0 == Curl_inet_pton(AF_INET, hostname, &addr)) && #ifdef ENABLE_IPV6 (0 == Curl_inet_pton(AF_INET6, hostname, &addr)) && #endif sni && !SSL_set_tlsext_host_name(BACKEND->handle, hostname)) infof(data, "WARNING: failed to configure server name indication (SNI) " "TLS extension\n"); #endif /* Check if there's a cached ID we can/should use here! */ if(SSL_SET_OPTION(primary.sessionid)) { void *ssl_sessionid = NULL; Curl_ssl_sessionid_lock(conn); if(!Curl_ssl_getsessionid(conn, &ssl_sessionid, NULL, sockindex)) { /* we got a session id, use it! */ if(!SSL_set_session(BACKEND->handle, ssl_sessionid)) { Curl_ssl_sessionid_unlock(conn); failf(data, "SSL: SSL_set_session failed: %s", ossl_strerror(ERR_get_error(), error_buffer, sizeof(error_buffer))); return CURLE_SSL_CONNECT_ERROR; } /* Informational message */ infof(data, "SSL re-using session ID\n"); } Curl_ssl_sessionid_unlock(conn); } if(conn->proxy_ssl[sockindex].use) { BIO *const bio = BIO_new(BIO_f_ssl()); SSL *handle = conn->proxy_ssl[sockindex].backend->handle; DEBUGASSERT(ssl_connection_complete == conn->proxy_ssl[sockindex].state); DEBUGASSERT(handle != NULL); DEBUGASSERT(bio != NULL); BIO_set_ssl(bio, handle, FALSE); SSL_set_bio(BACKEND->handle, bio, bio); } else if(!SSL_set_fd(BACKEND->handle, (int)sockfd)) { /* pass the raw socket into the SSL layers */ failf(data, "SSL: SSL_set_fd failed: %s", ossl_strerror(ERR_get_error(), error_buffer, sizeof(error_buffer))); return CURLE_SSL_CONNECT_ERROR; } connssl->connecting_state = ssl_connect_2; return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0x370, %rsp # imm = 0x370 movq %rdi, -0x10(%rbp) movl %esi, -0x14(%rbp) movl $0x0, -0x18(%rbp) movq -0x10(%rbp), %rax movq (%rax), %rax movq %rax, -0x28(%rbp) movq $0x0, -0x30(%rbp) movq $0x0, -0x38(%rbp) movq -0x10(%rbp), %rax movslq -0x14(%rbp), %rcx movl 0x258(%rax,%rcx,4), %eax movl %eax, -0x3c(%rbp) movq -0x10(%rbp), %rax addq $0x290, %rax # imm = 0x290 movslq -0x14(%rbp), %rcx imulq $0x18, %rcx, %rcx addq %rcx, %rax movq %rax, -0x48(%rbp) movq $0x0, -0x50(%rbp) movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x724a1 movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x724a1 movq -0x10(%rbp), %rax movq 0x160(%rax), %rax movq %rax, -0x260(%rbp) jmp 0x724b3 movq -0x10(%rbp), %rax movq 0xd8(%rax), %rax movq %rax, -0x260(%rbp) movq -0x260(%rbp), %rax movq %rax, -0x60(%rbp) movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x72521 movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x72521 movq -0x28(%rbp), %rax addq $0x1f0, %rax # imm = 0x1F0 addq $0x4a0, %rax # imm = 0x4A0 addq $0x50, %rax movq %rax, -0x268(%rbp) jmp 0x7253c movq -0x28(%rbp), %rax addq $0x1f0, %rax # imm = 0x1F0 addq $0x3f8, %rax # imm = 0x3F8 addq $0x50, %rax movq %rax, -0x268(%rbp) movq -0x268(%rbp), %rax movq %rax, -0x78(%rbp) movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x725a1 movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x725a1 movq -0x10(%rbp), %rax movq 0x340(%rax), %rax movq %rax, -0x270(%rbp) jmp 0x725b3 movq -0x10(%rbp), %rax movq 0x2f8(%rax), %rax movq %rax, -0x270(%rbp) movq -0x270(%rbp), %rax movq %rax, -0x80(%rbp) movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x72618 movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x72618 movq -0x28(%rbp), %rax movq 0x710(%rax), %rax movq %rax, -0x278(%rbp) jmp 0x7262a movq -0x28(%rbp), %rax movq 0x668(%rax), %rax movq %rax, -0x278(%rbp) movq -0x278(%rbp), %rax movq %rax, -0x88(%rbp) movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x72692 movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x72692 movq -0x28(%rbp), %rax movq 0x718(%rax), %rax movq %rax, -0x280(%rbp) jmp 0x726a4 movq -0x28(%rbp), %rax movq 0x670(%rax), %rax movq %rax, -0x280(%rbp) movq -0x280(%rbp), %rax movq %rax, -0x90(%rbp) movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x7270c movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x7270c movq -0x10(%rbp), %rax movq 0x360(%rax), %rax movq %rax, -0x288(%rbp) jmp 0x7271e movq -0x10(%rbp), %rax movq 0x318(%rax), %rax movq %rax, -0x288(%rbp) movq -0x288(%rbp), %rax movq %rax, -0x98(%rbp) movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x72786 movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x72786 movq -0x10(%rbp), %rax movq 0x358(%rax), %rax movq %rax, -0x290(%rbp) jmp 0x72798 movq -0x10(%rbp), %rax movq 0x310(%rax), %rax movq %rax, -0x290(%rbp) movq -0x290(%rbp), %rax movq %rax, -0xa0(%rbp) movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x72803 movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x72803 movq -0x10(%rbp), %rax movb 0x350(%rax), %al andb $0x1, %al movzbl %al, %eax movl %eax, -0x294(%rbp) jmp 0x72818 movq -0x10(%rbp), %rax movb 0x308(%rax), %al andb $0x1, %al movzbl %al, %eax movl %eax, -0x294(%rbp) movl -0x294(%rbp), %eax cmpl $0x0, %eax setne %al andb $0x1, %al movb %al, -0xa1(%rbp) movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x72886 movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x72886 movq -0x28(%rbp), %rax movq 0x6e8(%rax), %rax movq %rax, -0x2a0(%rbp) jmp 0x72898 movq -0x28(%rbp), %rax movq 0x640(%rax), %rax movq %rax, -0x2a0(%rbp) movq -0x2a0(%rbp), %rax movq %rax, -0xb0(%rbp) jmp 0x728a8 movq -0x28(%rbp), %rdi callq 0x71d30 movl %eax, -0x18(%rbp) cmpl $0x0, -0x18(%rbp) je 0x728c5 movl -0x18(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x7365b movq -0x78(%rbp), %rax movq $0x1, (%rax) movq -0x80(%rbp), %rax movq %rax, -0x2a8(%rbp) subq $0x2, %rax jb 0x72914 jmp 0x728e3 movq -0x2a8(%rbp), %rax subq $0x2, %rax je 0x72923 jmp 0x728f2 movq -0x2a8(%rbp), %rax subq $0x3, %rax je 0x72941 jmp 0x72901 movq -0x2a8(%rbp), %rax addq $-0x4, %rax subq $0x3, %rax ja 0x7295f jmp 0x72914 callq 0x94b0 movq %rax, -0x30(%rbp) movb $0x1, -0x51(%rbp) jmp 0x7297d movq -0x28(%rbp), %rdi leaq 0x10e78(%rip), %rsi # 0x837a6 movb $0x0, %al callq 0x19f90 movl $0x4, -0x4(%rbp) jmp 0x7365b movq -0x28(%rbp), %rdi leaq 0x10e82(%rip), %rsi # 0x837ce movb $0x0, %al callq 0x19f90 movl $0x4, -0x4(%rbp) jmp 0x7365b movq -0x28(%rbp), %rdi leaq 0x10e8c(%rip), %rsi # 0x837f6 movb $0x0, %al callq 0x19f90 movl $0x23, -0x4(%rbp) jmp 0x7365b movq -0x48(%rbp), %rax movq 0x10(%rax), %rax cmpq $0x0, (%rax) je 0x7299b movq -0x48(%rbp), %rax movq 0x10(%rax), %rax movq (%rax), %rdi callq 0x9120 movq -0x30(%rbp), %rdi callq 0x9e60 movq %rax, %rcx movq -0x48(%rbp), %rax movq 0x10(%rax), %rax movq %rcx, (%rax) movq -0x48(%rbp), %rax movq 0x10(%rax), %rax cmpq $0x0, (%rax) jne 0x72a08 movq -0x28(%rbp), %rax movq %rax, -0x2b0(%rbp) callq 0x9180 movq %rax, %rdi leaq -0x1b0(%rbp), %rsi movl $0x100, %edx # imm = 0x100 callq 0x71c20 movq -0x2b0(%rbp), %rdi movq %rax, %rdx leaq 0x10e36(%rip), %rsi # 0x8382b movb $0x0, %al callq 0x19f90 movl $0x1b, -0x4(%rbp) jmp 0x7365b movq -0x48(%rbp), %rax movq 0x10(%rax), %rax movq (%rax), %rdi movl $0x21, %esi movl $0x10, %edx xorl %eax, %eax movl %eax, %ecx callq 0x98b0 movq -0x28(%rbp), %rax cmpq $0x0, 0x2c0(%rax) je 0x72a75 movq -0x28(%rbp), %rax testb $0x1, 0x7a8(%rax) je 0x72a75 movq -0x48(%rbp), %rax movq 0x10(%rax), %rax movq (%rax), %rdi leaq 0x183d(%rip), %rsi # 0x74290 callq 0x9750 movq -0x48(%rbp), %rax movq 0x10(%rax), %rax movq (%rax), %rdi movq -0x10(%rbp), %rcx movl $0x10, %esi xorl %eax, %eax movl %eax, %edx callq 0x98b0 movl $0x80000850, %eax # imm = 0x80000850 movq %rax, -0x50(%rbp) movq -0x50(%rbp), %rax orq $0x4000, %rax # imm = 0x4000 movq %rax, -0x50(%rbp) movq -0x50(%rbp), %rax orq $0x20000, %rax # imm = 0x20000 movq %rax, -0x50(%rbp) movq -0x50(%rbp), %rax andq $-0x1, %rax movq %rax, -0x50(%rbp) movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x72afb movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x72afb movq -0x28(%rbp), %rax testb $0x1, 0x6d8(%rax) jne 0x72b16 jmp 0x72b08 movq -0x28(%rbp), %rax testb $0x1, 0x630(%rax) jne 0x72b16 movq -0x50(%rbp), %rax andq $-0x801, %rax # imm = 0xF7FF movq %rax, -0x50(%rbp) movq -0x80(%rbp), %rax movq %rax, -0x2b8(%rbp) subq $0x7, %rax ja 0x72be8 movq -0x2b8(%rbp), %rax leaq 0x109bf(%rip), %rcx # 0x834f8 movslq (%rcx,%rax,4), %rax addq %rcx, %rax jmpq *%rax movq -0x50(%rbp), %rax orq $0x0, %rax movq %rax, -0x50(%rbp) movq -0x50(%rbp), %rax orq $0x4000000, %rax # imm = 0x4000000 movq %rax, -0x50(%rbp) movq -0x50(%rbp), %rax orq $0x10000000, %rax # imm = 0x10000000 movq %rax, -0x50(%rbp) movq -0x50(%rbp), %rax orq $0x8000000, %rax # imm = 0x8000000 movq %rax, -0x50(%rbp) movq -0x50(%rbp), %rax orq $0x20000000, %rax # imm = 0x20000000 movq %rax, -0x50(%rbp) jmp 0x72c06 movq -0x50(%rbp), %rax orq $0x0, %rax movq %rax, -0x50(%rbp) movq -0x50(%rbp), %rax orq $0x2000000, %rax # imm = 0x2000000 movq %rax, -0x50(%rbp) jmp 0x72c06 movq -0x10(%rbp), %rsi movl -0x14(%rbp), %edx leaq -0x50(%rbp), %rdi callq 0x74510 movl %eax, -0x18(%rbp) cmpl $0x0, -0x18(%rbp) je 0x72bc8 movl -0x18(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x7365b jmp 0x72c06 movq -0x28(%rbp), %rdi leaq 0x10bd1(%rip), %rsi # 0x837a6 movb $0x0, %al callq 0x19f90 movl $0x4, -0x4(%rbp) jmp 0x7365b movq -0x28(%rbp), %rdi leaq 0x10c03(%rip), %rsi # 0x837f6 movb $0x0, %al callq 0x19f90 movl $0x23, -0x4(%rbp) jmp 0x7365b movq -0x48(%rbp), %rax movq 0x10(%rax), %rax movq (%rax), %rdi movq -0x50(%rbp), %rsi callq 0xa240 movq -0x10(%rbp), %rax testb $0x1, 0x3a7(%rax) je 0x72c42 movq -0x48(%rbp), %rax movq 0x10(%rax), %rax movq (%rax), %rdi movq -0x10(%rbp), %rdx leaq 0x1b13(%rip), %rsi # 0x74750 callq 0x9150 movq -0x10(%rbp), %rax testb $0x1, 0x3a8(%rax) je 0x72cd3 movl $0x0, -0x1b4(%rbp) movl -0x1b4(%rbp), %eax movl %eax, %ecx addl $0x1, %ecx movl %ecx, -0x1b4(%rbp) cltq movb $0x8, -0x240(%rbp,%rax) movslq -0x1b4(%rbp), %rax movq 0x10bc8(%rip), %rcx # 0x8384e movq %rcx, -0x240(%rbp,%rax) movl -0x1b4(%rbp), %eax addl $0x8, %eax movl %eax, -0x1b4(%rbp) movq -0x28(%rbp), %rdi leaq 0x10baf(%rip), %rsi # 0x83857 leaq 0x10b9f(%rip), %rdx # 0x8384e movb $0x0, %al callq 0x19d00 movq -0x48(%rbp), %rax movq 0x10(%rax), %rax movq (%rax), %rdi leaq -0x240(%rbp), %rsi movl -0x1b4(%rbp), %edx callq 0xa100 cmpq $0x0, -0x88(%rbp) jne 0x72ceb cmpq $0x0, -0x90(%rbp) je 0x72ed1 movq -0x10(%rbp), %rax movq %rax, -0x2d8(%rbp) movq -0x48(%rbp), %rax movq 0x10(%rax), %rax movq (%rax), %rax movq %rax, -0x2d0(%rbp) movq -0x88(%rbp), %rax movq %rax, -0x2c8(%rbp) movq -0x90(%rbp), %rax movq %rax, -0x2c0(%rbp) movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x72d7e movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x72d7e movq -0x28(%rbp), %rax movq 0x720(%rax), %rax movq %rax, -0x2e0(%rbp) jmp 0x72d90 movq -0x28(%rbp), %rax movq 0x678(%rax), %rax movq %rax, -0x2e0(%rbp) movq -0x2e0(%rbp), %rax movq %rax, -0x2e8(%rbp) movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x72df8 movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x72df8 movq -0x28(%rbp), %rax movq 0x728(%rax), %rax movq %rax, -0x2f0(%rbp) jmp 0x72e0a movq -0x28(%rbp), %rax movq 0x680(%rax), %rax movq %rax, -0x2f0(%rbp) movq -0x2f0(%rbp), %rax movq %rax, -0x2f8(%rbp) movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x72e72 movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x72e72 movq -0x28(%rbp), %rax movq 0x730(%rax), %rax movq %rax, -0x300(%rbp) jmp 0x72e84 movq -0x28(%rbp), %rax movq 0x688(%rax), %rax movq %rax, -0x300(%rbp) movq -0x2f8(%rbp), %r9 movq -0x2e8(%rbp), %r8 movq -0x2c0(%rbp), %rcx movq -0x2c8(%rbp), %rdx movq -0x2d0(%rbp), %rsi movq -0x2d8(%rbp), %rdi movq -0x300(%rbp), %rax movq %rax, (%rsp) callq 0x74820 cmpl $0x0, %eax jne 0x72ecf movl $0x3a, -0x4(%rbp) jmp 0x7365b jmp 0x72ed1 movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x72f2b movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x72f2b movq -0x10(%rbp), %rax movq 0x380(%rax), %rax movq %rax, -0x308(%rbp) jmp 0x72f3d movq -0x10(%rbp), %rax movq 0x338(%rax), %rax movq %rax, -0x308(%rbp) movq -0x308(%rbp), %rax movq %rax, -0x20(%rbp) cmpq $0x0, -0x20(%rbp) jne 0x72f57 movq $0x0, -0x20(%rbp) cmpq $0x0, -0x20(%rbp) je 0x72faf movq -0x48(%rbp), %rax movq 0x10(%rax), %rax movq (%rax), %rdi movq -0x20(%rbp), %rsi callq 0x9940 cmpl $0x0, %eax jne 0x72f99 movq -0x28(%rbp), %rdi movq -0x20(%rbp), %rdx leaq 0x108e4(%rip), %rsi # 0x8386a movb $0x0, %al callq 0x19f90 movl $0x3b, -0x4(%rbp) jmp 0x7365b movq -0x28(%rbp), %rdi movq -0x20(%rbp), %rdx leaq 0x108e1(%rip), %rsi # 0x83889 movb $0x0, %al callq 0x19d00 cmpq $0x0, -0x98(%rbp) jne 0x72fc7 cmpq $0x0, -0xa0(%rbp) je 0x7313d testb $0x1, -0xa1(%rbp) je 0x73129 movq -0x48(%rbp), %rax movq 0x10(%rax), %rax movq (%rax), %rdi movq -0x98(%rbp), %rsi movq -0xa0(%rbp), %rdx callq 0x9c70 cmpl $0x0, %eax jne 0x73097 movq -0x28(%rbp), %rax movq %rax, -0x310(%rbp) cmpq $0x0, -0x98(%rbp) je 0x73020 movq -0x98(%rbp), %rax movq %rax, -0x318(%rbp) jmp 0x73030 leaq 0xa323(%rip), %rax # 0x7d34a movq %rax, -0x318(%rbp) jmp 0x73030 movq -0x318(%rbp), %rax movq %rax, -0x320(%rbp) cmpq $0x0, -0xa0(%rbp) je 0x73058 movq -0xa0(%rbp), %rax movq %rax, -0x328(%rbp) jmp 0x73068 leaq 0xa2eb(%rip), %rax # 0x7d34a movq %rax, -0x328(%rbp) jmp 0x73068 movq -0x320(%rbp), %rdx movq -0x310(%rbp), %rdi movq -0x328(%rbp), %rcx leaq 0x1081b(%rip), %rsi # 0x8389f movb $0x0, %al callq 0x19f90 movl $0x4d, -0x4(%rbp) jmp 0x7365b movq -0x28(%rbp), %rax movq %rax, -0x330(%rbp) cmpq $0x0, -0x98(%rbp) je 0x730bc movq -0x98(%rbp), %rax movq %rax, -0x338(%rbp) jmp 0x730cc leaq 0xa287(%rip), %rax # 0x7d34a movq %rax, -0x338(%rbp) jmp 0x730cc movq -0x338(%rbp), %rax movq %rax, -0x340(%rbp) cmpq $0x0, -0xa0(%rbp) je 0x730f4 movq -0xa0(%rbp), %rax movq %rax, -0x348(%rbp) jmp 0x73104 leaq 0xa24f(%rip), %rax # 0x7d34a movq %rax, -0x348(%rbp) jmp 0x73104 movq -0x340(%rbp), %rdx movq -0x330(%rbp), %rdi movq -0x348(%rbp), %rcx leaq 0x107c5(%rip), %rsi # 0x838e5 movb $0x0, %al callq 0x19d00 jmp 0x7313b movq -0x28(%rbp), %rdi leaq 0x107fb(%rip), %rsi # 0x8392f movb $0x0, %al callq 0x19d00 jmp 0x7313d cmpq $0x0, -0xb0(%rbp) je 0x73208 movq -0x48(%rbp), %rax movq 0x10(%rax), %rax movq (%rax), %rdi callq 0xa200 movq %rax, -0x350(%rbp) callq 0x9c30 movq -0x350(%rbp), %rdi movq %rax, %rsi callq 0x9890 movq %rax, -0x38(%rbp) cmpq $0x0, -0x38(%rbp) je 0x7319b movq -0x38(%rbp), %rdi movq -0xb0(%rbp), %rsi movl $0x1, %edx callq 0xa2b0 cmpl $0x0, %eax jne 0x731c0 movq -0x28(%rbp), %rdi movq -0xb0(%rbp), %rdx leaq 0x107cb(%rip), %rsi # 0x83978 movb $0x0, %al callq 0x19f90 movl $0x52, -0x4(%rbp) jmp 0x7365b movq -0x28(%rbp), %rdi leaq 0x107c8(%rip), %rsi # 0x83993 movb $0x0, %al callq 0x19d00 movq -0x48(%rbp), %rax movq 0x10(%rax), %rax movq (%rax), %rdi callq 0xa200 movq %rax, %rdi movl $0xc, %esi callq 0x9720 movq -0x28(%rbp), %rdi movq -0xb0(%rbp), %rdx leaq 0x107af(%rip), %rsi # 0x839b0 movb $0x0, %al callq 0x19d00 movq -0x48(%rbp), %rax movq 0x10(%rax), %rax movq (%rax), %rdi movb -0xa1(%rbp), %cl xorl %esi, %esi movl $0x1, %eax testb $0x1, %cl cmovnel %eax, %esi xorl %eax, %eax movl %eax, %edx callq 0x91f0 cmpq $0x0, 0x20b09(%rip) # 0x93d40 je 0x73250 movq -0x48(%rbp), %rax movq 0x10(%rax), %rax movq (%rax), %rdi leaq 0x2075(%rip), %rsi # 0x752c0 callq 0x9f30 movq -0x28(%rbp), %rax cmpq $0x0, 0x650(%rax) je 0x732ad movq -0x28(%rbp), %rax movq 0x650(%rax), %rax movq -0x28(%rbp), %rdi movq -0x48(%rbp), %rcx movq 0x10(%rcx), %rcx movq (%rcx), %rsi movq -0x28(%rbp), %rcx movq 0x658(%rcx), %rdx callq *%rax movl %eax, -0x18(%rbp) cmpl $0x0, -0x18(%rbp) je 0x732ab movq -0x28(%rbp), %rdi leaq 0x10726(%rip), %rsi # 0x839bf movb $0x0, %al callq 0x19f90 movl -0x18(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x7365b jmp 0x732ad movq -0x48(%rbp), %rax movq 0x10(%rax), %rax cmpq $0x0, 0x8(%rax) je 0x732cd movq -0x48(%rbp), %rax movq 0x10(%rax), %rax movq 0x8(%rax), %rdi callq 0x9550 movq -0x48(%rbp), %rax movq 0x10(%rax), %rax movq (%rax), %rdi callq 0x99c0 movq %rax, %rcx movq -0x48(%rbp), %rax movq 0x10(%rax), %rax movq %rcx, 0x8(%rax) movq -0x48(%rbp), %rax movq 0x10(%rax), %rax cmpq $0x0, 0x8(%rax) jne 0x73319 movq -0x28(%rbp), %rdi leaq 0x106dc(%rip), %rsi # 0x839e2 movb $0x0, %al callq 0x19f90 movl $0x1b, -0x4(%rbp) jmp 0x7365b movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x7336e movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x7336e movq -0x10(%rbp), %rax testb $0x1, 0x352(%rax) jne 0x7337b jmp 0x7339a movq -0x10(%rbp), %rax testb $0x1, 0x30a(%rax) je 0x7339a movq -0x48(%rbp), %rax movq 0x10(%rax), %rax movq 0x8(%rax), %rdi movl $0x41, %esi movl $0x1, %edx xorl %eax, %eax movl %eax, %ecx callq 0x9340 movq -0x48(%rbp), %rax movq 0x10(%rax), %rax movq 0x8(%rax), %rdi callq 0x92e0 movq -0x48(%rbp), %rax movq 0x10(%rax), %rax movq $0x0, 0x10(%rax) movq -0x60(%rbp), %rsi movl $0x2, %edi leaq -0x70(%rbp), %rdx callq 0xa260 movl %eax, %ecx xorl %eax, %eax cmpl %ecx, %eax jne 0x7342b movq -0x60(%rbp), %rsi movl $0xa, %edi leaq -0x70(%rbp), %rdx callq 0xa260 movl %eax, %ecx xorl %eax, %eax cmpl %ecx, %eax jne 0x7342b testb $0x1, -0x51(%rbp) je 0x7342b movq -0x48(%rbp), %rax movq 0x10(%rax), %rax movq 0x8(%rax), %rdi movq -0x60(%rbp), %rcx movl $0x37, %esi xorl %eax, %eax movl %eax, %edx callq 0x9340 cmpq $0x0, %rax jne 0x7342b movq -0x28(%rbp), %rdi leaq 0x105e7(%rip), %rsi # 0x83a0b movb $0x0, %al callq 0x19d00 movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x73483 movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x73483 movq -0x28(%rbp), %rax testb $0x1, 0x6a3(%rax) jne 0x73494 jmp 0x73550 movq -0x28(%rbp), %rax testb $0x1, 0x5fb(%rax) je 0x73550 movq $0x0, -0x248(%rbp) movq -0x10(%rbp), %rdi callq 0x788b0 movq -0x10(%rbp), %rdi movl -0x14(%rbp), %ecx leaq -0x248(%rbp), %rsi xorl %eax, %eax movl %eax, %edx callq 0x78960 testb $0x1, %al jne 0x73547 movq -0x48(%rbp), %rax movq 0x10(%rax), %rax movq 0x8(%rax), %rdi movq -0x248(%rbp), %rsi callq 0x97d0 cmpl $0x0, %eax jne 0x73535 movq -0x10(%rbp), %rdi callq 0x78910 movq -0x28(%rbp), %rax movq %rax, -0x358(%rbp) callq 0x9d00 movq %rax, %rdi leaq -0x1b0(%rbp), %rsi movl $0x100, %edx # imm = 0x100 callq 0x71c20 movq -0x358(%rbp), %rdi movq %rax, %rdx leaq 0x10532(%rip), %rsi # 0x83a54 movb $0x0, %al callq 0x19f90 movl $0x23, -0x4(%rbp) jmp 0x7365b movq -0x28(%rbp), %rdi leaq 0x10534(%rip), %rsi # 0x83a74 movb $0x0, %al callq 0x19d00 movq -0x10(%rbp), %rdi callq 0x78910 movq -0x10(%rbp), %rax addq $0x2c0, %rax # imm = 0x2C0 movslq -0x14(%rbp), %rcx imulq $0x18, %rcx, %rcx addq %rcx, %rax testb $0x1, (%rax) je 0x735e9 callq 0x9b90 movq %rax, %rdi callq 0xa050 movq %rax, -0x250(%rbp) movq -0x10(%rbp), %rax addq $0x2c0, %rax # imm = 0x2C0 movslq -0x14(%rbp), %rcx imulq $0x18, %rcx, %rcx addq %rcx, %rax movq 0x10(%rax), %rax movq 0x8(%rax), %rax movq %rax, -0x258(%rbp) jmp 0x735a4 jmp 0x735a6 jmp 0x735a8 jmp 0x735aa jmp 0x735ac movq -0x250(%rbp), %rdi movq -0x258(%rbp), %rcx movl $0x6d, %esi xorl %eax, %eax movl %eax, %edx callq 0x9220 movq -0x48(%rbp), %rax movq 0x10(%rax), %rax movq 0x8(%rax), %rdi movq -0x250(%rbp), %rsi movq -0x250(%rbp), %rdx callq 0x99d0 jmp 0x73649 movq -0x48(%rbp), %rax movq 0x10(%rax), %rax movq 0x8(%rax), %rdi movl -0x3c(%rbp), %esi callq 0x95a0 cmpl $0x0, %eax jne 0x73647 movq -0x28(%rbp), %rax movq %rax, -0x360(%rbp) callq 0x9d00 movq %rax, %rdi leaq -0x1b0(%rbp), %rsi movl $0x100, %edx # imm = 0x100 callq 0x71c20 movq -0x360(%rbp), %rdi movq %rax, %rdx leaq 0x10456(%rip), %rsi # 0x83a8d movb $0x0, %al callq 0x19f90 movl $0x23, -0x4(%rbp) jmp 0x7365b jmp 0x73649 movq -0x48(%rbp), %rax movl $0x1, 0x8(%rax) movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x370, %rsp # imm = 0x370 popq %rbp retq nopw (%rax,%rax)
/macressler[P]curl/lib/vtls/openssl.c
ossl_connect_step2
static CURLcode ossl_connect_step2(struct connectdata *conn, int sockindex) { struct Curl_easy *data = conn->data; int err; struct ssl_connect_data *connssl = &conn->ssl[sockindex]; long * const certverifyresult = SSL_IS_PROXY() ? &data->set.proxy_ssl.certverifyresult : &data->set.ssl.certverifyresult; DEBUGASSERT(ssl_connect_2 == connssl->connecting_state || ssl_connect_2_reading == connssl->connecting_state || ssl_connect_2_writing == connssl->connecting_state); ERR_clear_error(); err = SSL_connect(BACKEND->handle); /* If keylogging is enabled but the keylog callback is not supported then log secrets here, immediately after SSL_connect by using tap_ssl_key. */ #if defined(ENABLE_SSLKEYLOGFILE) && !defined(HAVE_KEYLOG_CALLBACK) tap_ssl_key(BACKEND->handle, &BACKEND->tap_state); #endif /* 1 is fine 0 is "not successful but was shut down controlled" <0 is "handshake was not successful, because a fatal error occurred" */ if(1 != err) { int detail = SSL_get_error(BACKEND->handle, err); if(SSL_ERROR_WANT_READ == detail) { connssl->connecting_state = ssl_connect_2_reading; return CURLE_OK; } if(SSL_ERROR_WANT_WRITE == detail) { connssl->connecting_state = ssl_connect_2_writing; return CURLE_OK; } else { /* untreated error */ unsigned long errdetail; char error_buffer[256]=""; CURLcode result; long lerr; int lib; int reason; /* the connection failed, we're not waiting for anything else. */ connssl->connecting_state = ssl_connect_2; /* Get the earliest error code from the thread's error queue and removes the entry. */ errdetail = ERR_get_error(); /* Extract which lib and reason */ lib = ERR_GET_LIB(errdetail); reason = ERR_GET_REASON(errdetail); if((lib == ERR_LIB_SSL) && (reason == SSL_R_CERTIFICATE_VERIFY_FAILED)) { result = CURLE_SSL_CACERT; lerr = SSL_get_verify_result(BACKEND->handle); if(lerr != X509_V_OK) { *certverifyresult = lerr; snprintf(error_buffer, sizeof(error_buffer), "SSL certificate problem: %s", X509_verify_cert_error_string(lerr)); } else /* strcpy() is fine here as long as the string fits within error_buffer */ strcpy(error_buffer, "SSL certificate verification failed"); } else { result = CURLE_SSL_CONNECT_ERROR; ossl_strerror(errdetail, error_buffer, sizeof(error_buffer)); } /* detail is already set to the SSL error above */ /* If we e.g. use SSLv2 request-method and the server doesn't like us * (RST connection etc.), OpenSSL gives no explanation whatsoever and * the SO_ERROR is also lost. */ if(CURLE_SSL_CONNECT_ERROR == result && errdetail == 0) { const char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name : conn->host.name; const long int port = SSL_IS_PROXY() ? conn->port : conn->remote_port; failf(data, OSSL_PACKAGE " SSL_connect: %s in connection to %s:%ld ", SSL_ERROR_to_str(detail), hostname, port); return result; } /* Could be a CERT problem */ failf(data, "%s", error_buffer); return result; } } else { /* we have been connected fine, we're not waiting for anything else. */ connssl->connecting_state = ssl_connect_3; /* Informational message */ infof(data, "SSL connection using %s / %s\n", get_ssl_version_txt(BACKEND->handle), SSL_get_cipher(BACKEND->handle)); #ifdef HAS_ALPN /* Sets data and len to negotiated protocol, len is 0 if no protocol was * negotiated */ if(conn->bits.tls_enable_alpn) { const unsigned char *neg_protocol; unsigned int len; SSL_get0_alpn_selected(BACKEND->handle, &neg_protocol, &len); if(len != 0) { infof(data, "ALPN, server accepted to use %.*s\n", len, neg_protocol); #ifdef USE_NGHTTP2 if(len == NGHTTP2_PROTO_VERSION_ID_LEN && !memcmp(NGHTTP2_PROTO_VERSION_ID, neg_protocol, len)) { conn->negnpn = CURL_HTTP_VERSION_2; } else #endif if(len == ALPN_HTTP_1_1_LENGTH && !memcmp(ALPN_HTTP_1_1, neg_protocol, ALPN_HTTP_1_1_LENGTH)) { conn->negnpn = CURL_HTTP_VERSION_1_1; } } else infof(data, "ALPN, server did not agree to a protocol\n"); } #endif return CURLE_OK; } }
pushq %rbp movq %rsp, %rbp subq $0x1c0, %rsp # imm = 0x1C0 movq %rdi, -0x10(%rbp) movl %esi, -0x14(%rbp) movq -0x10(%rbp), %rax movq (%rax), %rax movq %rax, -0x20(%rbp) movq -0x10(%rbp), %rax addq $0x290, %rax # imm = 0x290 movslq -0x14(%rbp), %rcx imulq $0x18, %rcx, %rcx addq %rcx, %rax movq %rax, -0x30(%rbp) movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x73709 movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x73709 movq -0x20(%rbp), %rax addq $0x1f0, %rax # imm = 0x1F0 addq $0x4a0, %rax # imm = 0x4A0 addq $0x50, %rax movq %rax, -0x190(%rbp) jmp 0x73724 movq -0x20(%rbp), %rax addq $0x1f0, %rax # imm = 0x1F0 addq $0x3f8, %rax # imm = 0x3F8 addq $0x50, %rax movq %rax, -0x190(%rbp) movq -0x190(%rbp), %rax movq %rax, -0x38(%rbp) jmp 0x73731 callq 0x9d60 movq -0x30(%rbp), %rax movq 0x10(%rax), %rax movq 0x8(%rax), %rdi callq 0x9df0 movl %eax, -0x24(%rbp) movl $0x1, %eax cmpl -0x24(%rbp), %eax je 0x73a38 movq -0x30(%rbp), %rax movq 0x10(%rax), %rax movq 0x8(%rax), %rdi movl -0x24(%rbp), %esi callq 0x9090 movl %eax, -0x3c(%rbp) movl $0x2, %eax cmpl -0x3c(%rbp), %eax jne 0x73790 movq -0x30(%rbp), %rax movl $0x2, 0x8(%rax) movl $0x0, -0x4(%rbp) jmp 0x73b4c movl $0x3, %eax cmpl -0x3c(%rbp), %eax jne 0x737b1 movq -0x30(%rbp), %rax movl $0x3, 0x8(%rax) movl $0x0, -0x4(%rbp) jmp 0x73b4c leaq -0x150(%rbp), %rdi xorl %esi, %esi movl $0x100, %edx # imm = 0x100 callq 0x9520 movq -0x30(%rbp), %rax movl $0x1, 0x8(%rax) callq 0x9d00 movq %rax, -0x48(%rbp) movq -0x48(%rbp), %rdi callq 0x75880 movl %eax, -0x164(%rbp) movq -0x48(%rbp), %rdi callq 0x758c0 movl %eax, -0x168(%rbp) cmpl $0x14, -0x164(%rbp) jne 0x7389b cmpl $0x86, -0x168(%rbp) jne 0x7389b movl $0x3c, -0x154(%rbp) movq -0x30(%rbp), %rax movq 0x10(%rax), %rax movq 0x8(%rax), %rdi callq 0x9320 movq %rax, -0x160(%rbp) cmpq $0x0, -0x160(%rbp) je 0x73886 movq -0x160(%rbp), %rcx movq -0x38(%rbp), %rax movq %rcx, (%rax) leaq -0x150(%rbp), %rax movq %rax, -0x198(%rbp) movq -0x160(%rbp), %rdi callq 0x96b0 movq -0x198(%rbp), %rdi movq %rax, %rcx movl $0x100, %esi # imm = 0x100 leaq 0x108e2(%rip), %rdx # 0x8415f movb $0x0, %al callq 0x9510 jmp 0x73899 leaq -0x150(%rbp), %rdi leaq 0x108e7(%rip), %rsi # 0x8417b callq 0x98f0 jmp 0x738ba movl $0x23, -0x154(%rbp) movq -0x48(%rbp), %rdi leaq -0x150(%rbp), %rsi movl $0x100, %edx # imm = 0x100 callq 0x71c20 movl $0x23, %eax cmpl -0x154(%rbp), %eax jne 0x73a11 cmpq $0x0, -0x48(%rbp) jne 0x73a11 movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x73930 movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x73930 movq -0x10(%rbp), %rax movq 0x160(%rax), %rax movq %rax, -0x1a0(%rbp) jmp 0x73942 movq -0x10(%rbp), %rax movq 0xd8(%rax), %rax movq %rax, -0x1a0(%rbp) movq -0x1a0(%rbp), %rax movq %rax, -0x170(%rbp) movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x739aa movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x739aa movq -0x10(%rbp), %rax movq 0x190(%rax), %rax movq %rax, -0x1a8(%rbp) jmp 0x739bc movq -0x10(%rbp), %rax movslq 0x198(%rax), %rax movq %rax, -0x1a8(%rbp) movq -0x1a8(%rbp), %rax movq %rax, -0x178(%rbp) movq -0x20(%rbp), %rax movq %rax, -0x1b0(%rbp) movl -0x3c(%rbp), %edi callq 0x71c50 movq -0x1b0(%rbp), %rdi movq %rax, %rdx movq -0x170(%rbp), %rcx movq -0x178(%rbp), %r8 leaq 0x107a3(%rip), %rsi # 0x8419f movb $0x0, %al callq 0x19f90 movl -0x154(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x73b4c movq -0x20(%rbp), %rdi leaq -0x150(%rbp), %rdx leaq 0x7c88(%rip), %rsi # 0x7b6ab movb $0x0, %al callq 0x19f90 movl -0x154(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x73b4c movq -0x30(%rbp), %rax movl $0x4, 0x8(%rax) movq -0x20(%rbp), %rax movq %rax, -0x1c0(%rbp) movq -0x30(%rbp), %rax movq 0x10(%rax), %rax movq 0x8(%rax), %rdi callq 0x75900 movq %rax, -0x1b8(%rbp) movq -0x30(%rbp), %rax movq 0x10(%rax), %rax movq 0x8(%rax), %rdi callq 0x94f0 movq %rax, %rdi callq 0x9a50 movq -0x1c0(%rbp), %rdi movq -0x1b8(%rbp), %rdx movq %rax, %rcx leaq 0x10739(%rip), %rsi # 0x841d0 movb $0x0, %al callq 0x19d00 movq -0x10(%rbp), %rax testb $0x1, 0x3a8(%rax) je 0x73b45 movq -0x30(%rbp), %rax movq 0x10(%rax), %rax movq 0x8(%rax), %rdi leaq -0x180(%rbp), %rsi leaq -0x184(%rbp), %rdx callq 0x9530 cmpl $0x0, -0x184(%rbp) je 0x73b31 movq -0x20(%rbp), %rdi movl -0x184(%rbp), %edx movq -0x180(%rbp), %rcx leaq 0x106ff(%rip), %rsi # 0x841ee movb $0x0, %al callq 0x19d00 cmpl $0x8, -0x184(%rbp) jne 0x73b2f movq -0x180(%rbp), %rax movq (%rax), %rax movabsq $0x312e312f70747468, %rcx # imm = 0x312E312F70747468 subq %rcx, %rax setne %al movzbl %al, %eax cmpl $0x0, %eax jne 0x73b2f movq -0x10(%rbp), %rax movl $0x2, 0x740(%rax) jmp 0x73b43 movq -0x20(%rbp), %rdi leaq 0x106d5(%rip), %rsi # 0x84211 movb $0x0, %al callq 0x19d00 jmp 0x73b45 movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x1c0, %rsp # imm = 0x1C0 popq %rbp retq nopl (%rax,%rax)
/macressler[P]curl/lib/vtls/openssl.c
ossl_connect_step3
static CURLcode ossl_connect_step3(struct connectdata *conn, int sockindex) { CURLcode result = CURLE_OK; struct Curl_easy *data = conn->data; struct ssl_connect_data *connssl = &conn->ssl[sockindex]; DEBUGASSERT(ssl_connect_3 == connssl->connecting_state); if(SSL_SET_OPTION(primary.sessionid)) { bool incache; SSL_SESSION *our_ssl_sessionid; void *old_ssl_sessionid = NULL; our_ssl_sessionid = SSL_get1_session(BACKEND->handle); /* SSL_get1_session() will increment the reference count and the session will stay in memory until explicitly freed with SSL_SESSION_free(3), regardless of its state. */ Curl_ssl_sessionid_lock(conn); incache = !(Curl_ssl_getsessionid(conn, &old_ssl_sessionid, NULL, sockindex)); if(incache) { if(old_ssl_sessionid != our_ssl_sessionid) { infof(data, "old SSL session ID is stale, removing\n"); Curl_ssl_delsessionid(conn, old_ssl_sessionid); incache = FALSE; } } if(!incache) { result = Curl_ssl_addsessionid(conn, our_ssl_sessionid, 0 /* unknown size */, sockindex); if(result) { Curl_ssl_sessionid_unlock(conn); failf(data, "failed to store ssl session"); return result; } } else { /* Session was incache, so refcount already incremented earlier. * Avoid further increments with each SSL_get1_session() call. * This does not free the session as refcount remains > 0 */ SSL_SESSION_free(our_ssl_sessionid); } Curl_ssl_sessionid_unlock(conn); } /* * We check certificates to authenticate the server; otherwise we risk * man-in-the-middle attack; NEVERTHELESS, if we're told explicitly not to * verify the peer ignore faults and failures from the server cert * operations. */ result = servercert(conn, connssl, (SSL_CONN_CONFIG(verifypeer) || SSL_CONN_CONFIG(verifyhost))); if(!result) connssl->connecting_state = ssl_connect_done; return result; }
pushq %rbp movq %rsp, %rbp subq $0x60, %rsp movq %rdi, -0x10(%rbp) movl %esi, -0x14(%rbp) movl $0x0, -0x18(%rbp) movq -0x10(%rbp), %rax movq (%rax), %rax movq %rax, -0x20(%rbp) movq -0x10(%rbp), %rax addq $0x290, %rax # imm = 0x290 movslq -0x14(%rbp), %rcx imulq $0x18, %rcx, %rcx addq %rcx, %rax movq %rax, -0x28(%rbp) jmp 0x73b9c movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x73bf4 movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x73bf4 movq -0x20(%rbp), %rax testb $0x1, 0x6a3(%rax) jne 0x73c05 jmp 0x73cd8 movq -0x20(%rbp), %rax testb $0x1, 0x5fb(%rax) je 0x73cd8 movq $0x0, -0x40(%rbp) movq -0x28(%rbp), %rax movq 0x10(%rax), %rax movq 0x8(%rax), %rdi callq 0xa230 movq %rax, -0x38(%rbp) movq -0x10(%rbp), %rdi callq 0x788b0 movq -0x10(%rbp), %rdi movl -0x14(%rbp), %ecx leaq -0x40(%rbp), %rsi xorl %eax, %eax movl %eax, %edx callq 0x78960 xorb $-0x1, %al andb $0x1, %al movb %al, -0x29(%rbp) testb $0x1, -0x29(%rbp) je 0x73c7b movq -0x40(%rbp), %rax cmpq -0x38(%rbp), %rax je 0x73c79 movq -0x20(%rbp), %rdi leaq 0x105da(%rip), %rsi # 0x8423b movb $0x0, %al callq 0x19d00 movq -0x10(%rbp), %rdi movq -0x40(%rbp), %rsi callq 0x78d60 movb $0x0, -0x29(%rbp) jmp 0x73c7b testb $0x1, -0x29(%rbp) jne 0x73cc6 movq -0x10(%rbp), %rdi movq -0x38(%rbp), %rsi movl -0x14(%rbp), %ecx xorl %eax, %eax movl %eax, %edx callq 0x78de0 movl %eax, -0x18(%rbp) cmpl $0x0, -0x18(%rbp) je 0x73cc4 movq -0x10(%rbp), %rdi callq 0x78910 movq -0x20(%rbp), %rdi leaq 0x105b0(%rip), %rsi # 0x84262 movb $0x0, %al callq 0x19f90 movl -0x18(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x73e00 jmp 0x73ccf movq -0x38(%rbp), %rdi callq 0xa1c0 movq -0x10(%rbp), %rdi callq 0x78910 movq -0x10(%rbp), %rax movq %rax, -0x50(%rbp) movq -0x28(%rbp), %rax movq %rax, -0x48(%rbp) movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x73d46 movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x73d46 movq -0x10(%rbp), %rcx movb $0x1, %al testb $0x1, 0x350(%rcx) movb %al, -0x51(%rbp) jne 0x73dd0 jmp 0x73d58 movq -0x10(%rbp), %rcx movb $0x1, %al testb $0x1, 0x308(%rcx) movb %al, -0x51(%rbp) jne 0x73dd0 movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x73db2 movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x73db2 movq -0x10(%rbp), %rax movb 0x351(%rax), %al andb $0x1, %al movzbl %al, %eax movl %eax, -0x58(%rbp) jmp 0x73dc4 movq -0x10(%rbp), %rax movb 0x309(%rax), %al andb $0x1, %al movzbl %al, %eax movl %eax, -0x58(%rbp) movl -0x58(%rbp), %eax cmpl $0x0, %eax setne %al movb %al, -0x51(%rbp) movq -0x48(%rbp), %rsi movq -0x50(%rbp), %rdi movb -0x51(%rbp), %al movzbl %al, %edx andl $0x1, %edx callq 0x759e0 movl %eax, -0x18(%rbp) cmpl $0x0, -0x18(%rbp) jne 0x73dfa movq -0x28(%rbp), %rax movl $0x5, 0x8(%rax) movl -0x18(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x60, %rsp popq %rbp retq nopl (%rax)
/macressler[P]curl/lib/vtls/openssl.c
ossl_recv
static ssize_t ossl_recv(struct connectdata *conn, /* connection data */ int num, /* socketindex */ char *buf, /* store read data here */ size_t buffersize, /* max amount to read */ CURLcode *curlcode) { char error_buffer[256]; unsigned long sslerror; ssize_t nread; int buffsize; struct ssl_connect_data *connssl = &conn->ssl[num]; ERR_clear_error(); buffsize = (buffersize > (size_t)INT_MAX) ? INT_MAX : (int)buffersize; nread = (ssize_t)SSL_read(BACKEND->handle, buf, buffsize); if(nread <= 0) { /* failed SSL_read */ int err = SSL_get_error(BACKEND->handle, (int)nread); switch(err) { case SSL_ERROR_NONE: /* this is not an error */ case SSL_ERROR_ZERO_RETURN: /* no more data */ break; case SSL_ERROR_WANT_READ: case SSL_ERROR_WANT_WRITE: /* there's data pending, re-invoke SSL_read() */ *curlcode = CURLE_AGAIN; return -1; default: /* openssl/ssl.h for SSL_ERROR_SYSCALL says "look at error stack/return value/errno" */ /* https://www.openssl.org/docs/crypto/ERR_get_error.html */ sslerror = ERR_get_error(); if((nread < 0) || sslerror) { /* If the return code was negative or there actually is an error in the queue */ failf(conn->data, OSSL_PACKAGE " SSL_read: %s, errno %d", (sslerror ? ossl_strerror(sslerror, error_buffer, sizeof(error_buffer)) : SSL_ERROR_to_str(err)), SOCKERRNO); *curlcode = CURLE_RECV_ERROR; return -1; } } } return nread; }
pushq %rbp movq %rsp, %rbp subq $0x180, %rsp # imm = 0x180 movq %rdi, -0x10(%rbp) movl %esi, -0x14(%rbp) movq %rdx, -0x20(%rbp) movq %rcx, -0x28(%rbp) movq %r8, -0x30(%rbp) movq -0x10(%rbp), %rax addq $0x290, %rax # imm = 0x290 movslq -0x14(%rbp), %rcx imulq $0x18, %rcx, %rcx addq %rcx, %rax movq %rax, -0x150(%rbp) callq 0x9d60 cmpq $0x7fffffff, -0x28(%rbp) # imm = 0x7FFFFFFF jbe 0x73e66 movl $0x7fffffff, %eax # imm = 0x7FFFFFFF movl %eax, -0x158(%rbp) jmp 0x73e70 movq -0x28(%rbp), %rax movl %eax, -0x158(%rbp) movl -0x158(%rbp), %eax movl %eax, -0x144(%rbp) movq -0x150(%rbp), %rax movq 0x10(%rax), %rax movq 0x8(%rax), %rdi movq -0x20(%rbp), %rsi movl -0x144(%rbp), %edx callq 0x90e0 cltq movq %rax, -0x140(%rbp) cmpq $0x0, -0x140(%rbp) jg 0x73fd4 movq -0x150(%rbp), %rax movq 0x10(%rax), %rax movq 0x8(%rax), %rdi movl -0x140(%rbp), %esi callq 0x9090 movl %eax, -0x154(%rbp) movl -0x154(%rbp), %eax movl %eax, -0x15c(%rbp) testl %eax, %eax je 0x73f00 jmp 0x73ee3 movl -0x15c(%rbp), %eax addl $-0x2, %eax subl $0x2, %eax jb 0x73f05 jmp 0x73ef3 movl -0x15c(%rbp), %eax subl $0x6, %eax jne 0x73f1c jmp 0x73f00 jmp 0x73fd2 movq -0x30(%rbp), %rax movl $0x51, (%rax) movq $-0x1, -0x8(%rbp) jmp 0x73fdf callq 0x9d00 movq %rax, -0x138(%rbp) cmpq $0x0, -0x140(%rbp) jl 0x73f40 cmpq $0x0, -0x138(%rbp) je 0x73fd0 movq -0x10(%rbp), %rax movq (%rax), %rax movq %rax, -0x168(%rbp) cmpq $0x0, -0x138(%rbp) je 0x73f79 movq -0x138(%rbp), %rdi leaq -0x130(%rbp), %rsi movl $0x100, %edx # imm = 0x100 callq 0x71c20 movq %rax, -0x170(%rbp) jmp 0x73f8b movl -0x154(%rbp), %edi callq 0x71c50 movq %rax, -0x170(%rbp) movq -0x170(%rbp), %rax movq %rax, -0x178(%rbp) callq 0x90b0 movq -0x168(%rbp), %rdi movq -0x178(%rbp), %rdx movl (%rax), %ecx leaq 0x10825(%rip), %rsi # 0x847da movb $0x0, %al callq 0x19f90 movq -0x30(%rbp), %rax movl $0x38, (%rax) movq $-0x1, -0x8(%rbp) jmp 0x73fdf jmp 0x73fd2 jmp 0x73fd4 movq -0x140(%rbp), %rax movq %rax, -0x8(%rbp) movq -0x8(%rbp), %rax addq $0x180, %rsp # imm = 0x180 popq %rbp retq nopl (%rax)
/macressler[P]curl/lib/vtls/openssl.c
ossl_send
static ssize_t ossl_send(struct connectdata *conn, int sockindex, const void *mem, size_t len, CURLcode *curlcode) { /* SSL_write() is said to return 'int' while write() and send() returns 'size_t' */ int err; char error_buffer[256]; unsigned long sslerror; int memlen; int rc; struct ssl_connect_data *connssl = &conn->ssl[sockindex]; ERR_clear_error(); memlen = (len > (size_t)INT_MAX) ? INT_MAX : (int)len; rc = SSL_write(BACKEND->handle, mem, memlen); if(rc <= 0) { err = SSL_get_error(BACKEND->handle, rc); switch(err) { case SSL_ERROR_WANT_READ: case SSL_ERROR_WANT_WRITE: /* The operation did not complete; the same TLS/SSL I/O function should be called again later. This is basically an EWOULDBLOCK equivalent. */ *curlcode = CURLE_AGAIN; return -1; case SSL_ERROR_SYSCALL: failf(conn->data, "SSL_write() returned SYSCALL, errno = %d", SOCKERRNO); *curlcode = CURLE_SEND_ERROR; return -1; case SSL_ERROR_SSL: /* A failure in the SSL library occurred, usually a protocol error. The OpenSSL error queue contains more information on the error. */ sslerror = ERR_get_error(); if(ERR_GET_LIB(sslerror) == ERR_LIB_SSL && ERR_GET_REASON(sslerror) == SSL_R_BIO_NOT_SET && conn->ssl[sockindex].state == ssl_connection_complete && conn->proxy_ssl[sockindex].state == ssl_connection_complete) { char ver[120]; Curl_ossl_version(ver, 120); failf(conn->data, "Error: %s does not support double SSL tunneling.", ver); } else failf(conn->data, "SSL_write() error: %s", ossl_strerror(sslerror, error_buffer, sizeof(error_buffer))); *curlcode = CURLE_SEND_ERROR; return -1; } /* a true error */ failf(conn->data, OSSL_PACKAGE " SSL_write: %s, errno %d", SSL_ERROR_to_str(err), SOCKERRNO); *curlcode = CURLE_SEND_ERROR; return -1; } *curlcode = CURLE_OK; return (ssize_t)rc; /* number of bytes */ }
pushq %rbp movq %rsp, %rbp subq $0x200, %rsp # imm = 0x200 movq %rdi, -0x10(%rbp) movl %esi, -0x14(%rbp) movq %rdx, -0x20(%rbp) movq %rcx, -0x28(%rbp) movq %r8, -0x30(%rbp) movq -0x10(%rbp), %rax addq $0x290, %rax # imm = 0x290 movslq -0x14(%rbp), %rcx imulq $0x18, %rcx, %rcx addq %rcx, %rax movq %rax, -0x158(%rbp) callq 0x9d60 cmpq $0x7fffffff, -0x28(%rbp) # imm = 0x7FFFFFFF jbe 0x74046 movl $0x7fffffff, %eax # imm = 0x7FFFFFFF movl %eax, -0x1d4(%rbp) jmp 0x74050 movq -0x28(%rbp), %rax movl %eax, -0x1d4(%rbp) movl -0x1d4(%rbp), %eax movl %eax, -0x14c(%rbp) movq -0x158(%rbp), %rax movq 0x10(%rax), %rax movq 0x8(%rax), %rdi movq -0x20(%rbp), %rsi movl -0x14c(%rbp), %edx callq 0xa2c0 movl %eax, -0x150(%rbp) cmpl $0x0, -0x150(%rbp) jg 0x7426d movq -0x158(%rbp), %rax movq 0x10(%rax), %rax movq 0x8(%rax), %rdi movl -0x150(%rbp), %esi callq 0x9090 movl %eax, -0x34(%rbp) movl -0x34(%rbp), %eax movl %eax, -0x1d8(%rbp) subl $0x1, %eax je 0x74132 jmp 0x740ba movl -0x1d8(%rbp), %eax addl $-0x2, %eax subl $0x2, %eax jb 0x740da jmp 0x740ca movl -0x1d8(%rbp), %eax subl $0x5, %eax je 0x740f1 jmp 0x74219 movq -0x30(%rbp), %rax movl $0x51, (%rax) movq $-0x1, -0x8(%rbp) jmp 0x74282 movq -0x10(%rbp), %rax movq (%rax), %rax movq %rax, -0x1e0(%rbp) callq 0x90b0 movq -0x1e0(%rbp), %rdi movl (%rax), %edx leaq 0x106e5(%rip), %rsi # 0x847f9 movb $0x0, %al callq 0x19f90 movq -0x30(%rbp), %rax movl $0x37, (%rax) movq $-0x1, -0x8(%rbp) jmp 0x74282 callq 0x9d00 movq %rax, -0x148(%rbp) movq -0x148(%rbp), %rdi callq 0x75880 cmpl $0x14, %eax jne 0x741c7 movq -0x148(%rbp), %rdi callq 0x758c0 cmpl $0x80, %eax jne 0x741c7 movq -0x10(%rbp), %rax addq $0x290, %rax # imm = 0x290 movslq -0x14(%rbp), %rcx imulq $0x18, %rcx, %rcx addq %rcx, %rax cmpl $0x2, 0x4(%rax) jne 0x741c7 movq -0x10(%rbp), %rax addq $0x2c0, %rax # imm = 0x2C0 movslq -0x14(%rbp), %rcx imulq $0x18, %rcx, %rcx addq %rcx, %rax cmpl $0x2, 0x4(%rax) jne 0x741c7 leaq -0x1d0(%rbp), %rdi movl $0x78, %esi callq 0x71180 movq -0x10(%rbp), %rax movq (%rax), %rdi leaq -0x1d0(%rbp), %rdx leaq 0x10664(%rip), %rsi # 0x84822 movb $0x0, %al callq 0x19f90 jmp 0x74205 movq -0x10(%rbp), %rax movq (%rax), %rax movq %rax, -0x1e8(%rbp) movq -0x148(%rbp), %rdi leaq -0x140(%rbp), %rsi movl $0x100, %edx # imm = 0x100 callq 0x71c20 movq -0x1e8(%rbp), %rdi movq %rax, %rdx leaq 0x10655(%rip), %rsi # 0x84853 movb $0x0, %al callq 0x19f90 movq -0x30(%rbp), %rax movl $0x37, (%rax) movq $-0x1, -0x8(%rbp) jmp 0x74282 movq -0x10(%rbp), %rax movq (%rax), %rax movq %rax, -0x1f8(%rbp) movl -0x34(%rbp), %edi callq 0x71c50 movq %rax, -0x1f0(%rbp) callq 0x90b0 movq -0x1f8(%rbp), %rdi movq -0x1f0(%rbp), %rdx movl (%rax), %ecx leaq 0x10617(%rip), %rsi # 0x84869 movb $0x0, %al callq 0x19f90 movq -0x30(%rbp), %rax movl $0x37, (%rax) movq $-0x1, -0x8(%rbp) jmp 0x74282 movq -0x30(%rbp), %rax movl $0x0, (%rax) movslq -0x150(%rbp), %rax movq %rax, -0x8(%rbp) movq -0x8(%rbp), %rax addq $0x200, %rsp # imm = 0x200 popq %rbp retq nop
/macressler[P]curl/lib/vtls/openssl.c
ssl_tls_trace
static void ssl_tls_trace(int direction, int ssl_ver, int content_type, const void *buf, size_t len, SSL *ssl, void *userp) { struct Curl_easy *data; const char *msg_name, *tls_rt_name; char ssl_buf[1024]; char unknown[32]; int msg_type, txt_len; const char *verstr = NULL; struct connectdata *conn = userp; if(!conn || !conn->data || !conn->data->set.fdebug || (direction != 0 && direction != 1)) return; data = conn->data; switch(ssl_ver) { #ifdef SSL2_VERSION /* removed in recent versions */ case SSL2_VERSION: verstr = "SSLv2"; break; #endif #ifdef SSL3_VERSION case SSL3_VERSION: verstr = "SSLv3"; break; #endif case TLS1_VERSION: verstr = "TLSv1.0"; break; #ifdef TLS1_1_VERSION case TLS1_1_VERSION: verstr = "TLSv1.1"; break; #endif #ifdef TLS1_2_VERSION case TLS1_2_VERSION: verstr = "TLSv1.2"; break; #endif #ifdef TLS1_3_VERSION case TLS1_3_VERSION: verstr = "TLSv1.3"; break; #endif case 0: break; default: snprintf(unknown, sizeof(unknown), "(%x)", ssl_ver); verstr = unknown; break; } if(ssl_ver) { /* the info given when the version is zero is not that useful for us */ ssl_ver >>= 8; /* check the upper 8 bits only below */ /* SSLv2 doesn't seem to have TLS record-type headers, so OpenSSL * always pass-up content-type as 0. But the interesting message-type * is at 'buf[0]'. */ if(ssl_ver == SSL3_VERSION_MAJOR && content_type) tls_rt_name = tls_rt_type(content_type); else tls_rt_name = ""; msg_type = *(char *)buf; msg_name = ssl_msg_type(ssl_ver, msg_type); txt_len = snprintf(ssl_buf, sizeof(ssl_buf), "%s (%s), %s, %s (%d):\n", verstr, direction?"OUT":"IN", tls_rt_name, msg_name, msg_type); Curl_debug(data, CURLINFO_TEXT, ssl_buf, (size_t)txt_len, NULL); } Curl_debug(data, (direction == 1) ? CURLINFO_SSL_DATA_OUT : CURLINFO_SSL_DATA_IN, (char *)buf, len, NULL); (void) ssl; }
pushq %rbp movq %rsp, %rbp subq $0x490, %rsp # imm = 0x490 movq 0x10(%rbp), %rax movl %edi, -0x4(%rbp) movl %esi, -0x8(%rbp) movl %edx, -0xc(%rbp) movq %rcx, -0x18(%rbp) movq %r8, -0x20(%rbp) movq %r9, -0x28(%rbp) movq $0x0, -0x470(%rbp) movq 0x10(%rbp), %rax movq %rax, -0x478(%rbp) cmpq $0x0, -0x478(%rbp) je 0x74301 movq -0x478(%rbp), %rax cmpq $0x0, (%rax) je 0x74301 movq -0x478(%rbp), %rax movq (%rax), %rax cmpq $0x0, 0x2c0(%rax) je 0x74301 cmpl $0x0, -0x4(%rbp) je 0x74306 cmpl $0x1, -0x4(%rbp) je 0x74306 jmp 0x744ff movq -0x478(%rbp), %rax movq (%rax), %rax movq %rax, -0x30(%rbp) movl -0x8(%rbp), %eax movl %eax, -0x47c(%rbp) testl %eax, %eax je 0x743df jmp 0x74327 movl -0x47c(%rbp), %eax subl $0x2, %eax je 0x7437f jmp 0x74334 movl -0x47c(%rbp), %eax subl $0x300, %eax # imm = 0x300 je 0x7438f jmp 0x74343 movl -0x47c(%rbp), %eax subl $0x301, %eax # imm = 0x301 je 0x7439f jmp 0x74352 movl -0x47c(%rbp), %eax subl $0x302, %eax # imm = 0x302 je 0x743af jmp 0x74361 movl -0x47c(%rbp), %eax subl $0x303, %eax # imm = 0x303 je 0x743bf jmp 0x74370 movl -0x47c(%rbp), %eax subl $0x304, %eax # imm = 0x304 je 0x743cf jmp 0x743e1 leaq 0xf722(%rip), %rax # 0x83aa8 movq %rax, -0x470(%rbp) jmp 0x7440c leaq 0xf718(%rip), %rax # 0x83aae movq %rax, -0x470(%rbp) jmp 0x7440c leaq 0xf70e(%rip), %rax # 0x83ab4 movq %rax, -0x470(%rbp) jmp 0x7440c leaq 0xf706(%rip), %rax # 0x83abc movq %rax, -0x470(%rbp) jmp 0x7440c leaq 0xf6fe(%rip), %rax # 0x83ac4 movq %rax, -0x470(%rbp) jmp 0x7440c leaq 0xf6f6(%rip), %rax # 0x83acc movq %rax, -0x470(%rbp) jmp 0x7440c jmp 0x7440c leaq -0x460(%rbp), %rdi movl -0x8(%rbp), %ecx movl $0x20, %esi leaq 0xf6dd(%rip), %rdx # 0x83ad4 movb $0x0, %al callq 0x9510 leaq -0x460(%rbp), %rax movq %rax, -0x470(%rbp) cmpl $0x0, -0x8(%rbp) je 0x744d6 movl -0x8(%rbp), %eax sarl $0x8, %eax movl %eax, -0x8(%rbp) cmpl $0x3, -0x8(%rbp) jne 0x74439 cmpl $0x0, -0xc(%rbp) je 0x74439 movl -0xc(%rbp), %edi callq 0x753e0 movq %rax, -0x40(%rbp) jmp 0x74444 leaq 0xf06c(%rip), %rax # 0x834ac movq %rax, -0x40(%rbp) movq -0x18(%rbp), %rax movsbl (%rax), %eax movl %eax, -0x464(%rbp) movl -0x8(%rbp), %edi movl -0x464(%rbp), %esi callq 0x75470 movq %rax, -0x38(%rbp) leaq -0x440(%rbp), %rdi movq -0x470(%rbp), %rcx movl -0x4(%rbp), %edx leaq 0xe559(%rip), %r8 # 0x829d4 leaq 0x9f94(%rip), %rax # 0x7e416 cmpl $0x0, %edx cmovneq %rax, %r8 movq -0x40(%rbp), %r9 movq -0x38(%rbp), %r10 movl -0x464(%rbp), %eax movl $0x400, %esi # imm = 0x400 leaq 0xf636(%rip), %rdx # 0x83ad9 movq %r10, (%rsp) movl %eax, 0x8(%rsp) movb $0x0, %al callq 0x9510 movl %eax, -0x468(%rbp) movq -0x30(%rbp), %rdi leaq -0x440(%rbp), %rdx movslq -0x468(%rbp), %rcx xorl %esi, %esi xorl %eax, %eax movl %eax, %r8d callq 0x19e00 movq -0x30(%rbp), %rdi movl -0x4(%rbp), %ecx movl $0x5, %esi movl $0x6, %eax cmpl $0x1, %ecx cmovel %eax, %esi movq -0x18(%rbp), %rdx movq -0x20(%rbp), %rcx xorl %eax, %eax movl %eax, %r8d callq 0x19e00 addq $0x490, %rsp # imm = 0x490 popq %rbp retq nopl (%rax,%rax)
/macressler[P]curl/lib/vtls/openssl.c
set_ssl_version_min_max
static CURLcode set_ssl_version_min_max(long *ctx_options, struct connectdata *conn, int sockindex) { #if (OPENSSL_VERSION_NUMBER < 0x1000100FL) || !defined(TLS1_3_VERSION) /* convoluted #if condition just to avoid compiler warnings on unused variable */ struct Curl_easy *data = conn->data; #endif long ssl_version = SSL_CONN_CONFIG(version); long ssl_version_max = SSL_CONN_CONFIG(version_max); if(ssl_version_max == CURL_SSLVERSION_MAX_NONE) { ssl_version_max = ssl_version << 16; } switch(ssl_version) { case CURL_SSLVERSION_TLSv1_3: #ifdef TLS1_3_VERSION { struct ssl_connect_data *connssl = &conn->ssl[sockindex]; SSL_CTX_set_max_proto_version(BACKEND->ctx, TLS1_3_VERSION); *ctx_options |= SSL_OP_NO_TLSv1_2; } #else (void)sockindex; failf(data, OSSL_PACKAGE " was built without TLS 1.3 support"); return CURLE_NOT_BUILT_IN; #endif /* FALLTHROUGH */ case CURL_SSLVERSION_TLSv1_2: #if OPENSSL_VERSION_NUMBER >= 0x1000100FL *ctx_options |= SSL_OP_NO_TLSv1_1; #else failf(data, OSSL_PACKAGE " was built without TLS 1.2 support"); return CURLE_NOT_BUILT_IN; #endif /* FALLTHROUGH */ case CURL_SSLVERSION_TLSv1_1: #if OPENSSL_VERSION_NUMBER >= 0x1000100FL *ctx_options |= SSL_OP_NO_TLSv1; #else failf(data, OSSL_PACKAGE " was built without TLS 1.1 support"); return CURLE_NOT_BUILT_IN; #endif /* FALLTHROUGH */ case CURL_SSLVERSION_TLSv1_0: *ctx_options |= SSL_OP_NO_SSLv2; *ctx_options |= SSL_OP_NO_SSLv3; break; } switch(ssl_version_max) { case CURL_SSLVERSION_MAX_TLSv1_0: #if OPENSSL_VERSION_NUMBER >= 0x1000100FL *ctx_options |= SSL_OP_NO_TLSv1_1; #endif /* FALLTHROUGH */ case CURL_SSLVERSION_MAX_TLSv1_1: #if OPENSSL_VERSION_NUMBER >= 0x1000100FL *ctx_options |= SSL_OP_NO_TLSv1_2; #endif /* FALLTHROUGH */ case CURL_SSLVERSION_MAX_TLSv1_2: case CURL_SSLVERSION_MAX_DEFAULT: #ifdef TLS1_3_VERSION *ctx_options |= SSL_OP_NO_TLSv1_3; #endif break; case CURL_SSLVERSION_MAX_TLSv1_3: #ifdef TLS1_3_VERSION break; #else failf(data, OSSL_PACKAGE " was built without TLS 1.3 support"); return CURLE_NOT_BUILT_IN; #endif } return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0x50, %rsp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movl %edx, -0x14(%rbp) movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x7457a movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x7457a movq -0x10(%rbp), %rax movq 0x340(%rax), %rax movq %rax, -0x38(%rbp) jmp 0x74589 movq -0x10(%rbp), %rax movq 0x2f8(%rax), %rax movq %rax, -0x38(%rbp) movq -0x38(%rbp), %rax movq %rax, -0x20(%rbp) movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x745e8 movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x745e8 movq -0x10(%rbp), %rax movq 0x348(%rax), %rax movq %rax, -0x40(%rbp) jmp 0x745f7 movq -0x10(%rbp), %rax movq 0x300(%rax), %rax movq %rax, -0x40(%rbp) movq -0x40(%rbp), %rax movq %rax, -0x28(%rbp) cmpq $0x0, -0x28(%rbp) jne 0x74612 movq -0x20(%rbp), %rax shlq $0x10, %rax movq %rax, -0x28(%rbp) movq -0x20(%rbp), %rax addq $-0x4, %rax movq %rax, -0x48(%rbp) subq $0x3, %rax ja 0x746c5 movq -0x48(%rbp), %rax leaq 0xeee5(%rip), %rcx # 0x83518 movslq (%rcx,%rax,4), %rax addq %rcx, %rax jmpq *%rax movq -0x10(%rbp), %rax addq $0x290, %rax # imm = 0x290 movslq -0x14(%rbp), %rcx imulq $0x18, %rcx, %rcx addq %rcx, %rax movq %rax, -0x30(%rbp) movq -0x30(%rbp), %rax movq 0x10(%rax), %rax movq (%rax), %rdi movl $0x7c, %esi movl $0x304, %edx # imm = 0x304 xorl %eax, %eax movl %eax, %ecx callq 0x98b0 movq -0x8(%rbp), %rax movq (%rax), %rcx orq $0x8000000, %rcx # imm = 0x8000000 movq %rcx, (%rax) movq -0x8(%rbp), %rax movq (%rax), %rcx orq $0x10000000, %rcx # imm = 0x10000000 movq %rcx, (%rax) movq -0x8(%rbp), %rax movq (%rax), %rcx orq $0x4000000, %rcx # imm = 0x4000000 movq %rcx, (%rax) movq -0x8(%rbp), %rax movq (%rax), %rcx orq $0x0, %rcx movq %rcx, (%rax) movq -0x8(%rbp), %rax movq (%rax), %rcx orq $0x2000000, %rcx # imm = 0x2000000 movq %rcx, (%rax) movq -0x28(%rbp), %rax movq %rax, -0x50(%rbp) subq $0x10000, %rax # imm = 0x10000 je 0x74731 jmp 0x746d7 movq -0x50(%rbp), %rax subq $0x40000, %rax # imm = 0x40000 je 0x7470f jmp 0x746e5 movq -0x50(%rbp), %rax subq $0x50000, %rax # imm = 0x50000 je 0x74720 jmp 0x746f3 movq -0x50(%rbp), %rax subq $0x60000, %rax # imm = 0x60000 je 0x74731 jmp 0x74701 movq -0x50(%rbp), %rax subq $0x70000, %rax # imm = 0x70000 je 0x74744 jmp 0x74746 movq -0x8(%rbp), %rax movq (%rax), %rcx orq $0x10000000, %rcx # imm = 0x10000000 movq %rcx, (%rax) movq -0x8(%rbp), %rax movq (%rax), %rcx orq $0x8000000, %rcx # imm = 0x8000000 movq %rcx, (%rax) movq -0x8(%rbp), %rax movq (%rax), %rcx orq $0x20000000, %rcx # imm = 0x20000000 movq %rcx, (%rax) jmp 0x74746 jmp 0x74746 xorl %eax, %eax addq $0x50, %rsp popq %rbp retq nop
/macressler[P]curl/lib/vtls/openssl.c
select_next_proto_cb
static int select_next_proto_cb(SSL *ssl, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg) { struct connectdata *conn = (struct connectdata*) arg; (void)ssl; #ifdef USE_NGHTTP2 if(conn->data->set.httpversion >= CURL_HTTP_VERSION_2 && !select_next_protocol(out, outlen, in, inlen, NGHTTP2_PROTO_VERSION_ID, NGHTTP2_PROTO_VERSION_ID_LEN)) { infof(conn->data, "NPN, negotiated HTTP2 (%s)\n", NGHTTP2_PROTO_VERSION_ID); conn->negnpn = CURL_HTTP_VERSION_2; return SSL_TLSEXT_ERR_OK; } #endif if(!select_next_protocol(out, outlen, in, inlen, ALPN_HTTP_1_1, ALPN_HTTP_1_1_LENGTH)) { infof(conn->data, "NPN, negotiated HTTP1.1\n"); conn->negnpn = CURL_HTTP_VERSION_1_1; return SSL_TLSEXT_ERR_OK; } infof(conn->data, "NPN, no overlap, use HTTP1.1\n"); *out = (unsigned char *)ALPN_HTTP_1_1; *outlen = ALPN_HTTP_1_1_LENGTH; conn->negnpn = CURL_HTTP_VERSION_1_1; return SSL_TLSEXT_ERR_OK; }
pushq %rbp movq %rsp, %rbp subq $0x40, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq %rdx, -0x20(%rbp) movq %rcx, -0x28(%rbp) movl %r8d, -0x2c(%rbp) movq %r9, -0x38(%rbp) movq -0x38(%rbp), %rax movq %rax, -0x40(%rbp) movq -0x18(%rbp), %rdi movq -0x20(%rbp), %rsi movq -0x28(%rbp), %rdx movl -0x2c(%rbp), %ecx leaq 0xf0c0(%rip), %r8 # 0x8384e movl $0x8, %r9d callq 0x75570 cmpl $0x0, %eax jne 0x747ca movq -0x40(%rbp), %rax movq (%rax), %rdi leaq 0xf445(%rip), %rsi # 0x83bf1 movb $0x0, %al callq 0x19d00 movq -0x40(%rbp), %rax movl $0x2, 0x740(%rax) movl $0x0, -0x4(%rbp) jmp 0x74809 movq -0x40(%rbp), %rax movq (%rax), %rdi leaq 0xf432(%rip), %rsi # 0x83c0a movb $0x0, %al callq 0x19d00 movq -0x18(%rbp), %rax leaq 0xf064(%rip), %rcx # 0x8384e movq %rcx, (%rax) movq -0x20(%rbp), %rax movb $0x8, (%rax) movq -0x40(%rbp), %rax movl $0x2, 0x740(%rax) movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x40, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/macressler[P]curl/lib/vtls/openssl.c
cert_stuff
static int cert_stuff(struct connectdata *conn, SSL_CTX* ctx, char *cert_file, const char *cert_type, char *key_file, const char *key_type, char *key_passwd) { struct Curl_easy *data = conn->data; char error_buffer[256]; bool check_privkey = TRUE; int file_type = do_file_type(cert_type); if(cert_file || (file_type == SSL_FILETYPE_ENGINE)) { SSL *ssl; X509 *x509; int cert_done = 0; if(key_passwd) { /* set the password in the callback userdata */ SSL_CTX_set_default_passwd_cb_userdata(ctx, key_passwd); /* Set passwd callback: */ SSL_CTX_set_default_passwd_cb(ctx, passwd_callback); } switch(file_type) { case SSL_FILETYPE_PEM: /* SSL_CTX_use_certificate_chain_file() only works on PEM files */ if(SSL_CTX_use_certificate_chain_file(ctx, cert_file) != 1) { failf(data, "could not load PEM client certificate, " OSSL_PACKAGE " error %s, " "(no key found, wrong pass phrase, or wrong file format?)", ossl_strerror(ERR_get_error(), error_buffer, sizeof(error_buffer)) ); return 0; } break; case SSL_FILETYPE_ASN1: /* SSL_CTX_use_certificate_file() works with either PEM or ASN1, but we use the case above for PEM so this can only be performed with ASN1 files. */ if(SSL_CTX_use_certificate_file(ctx, cert_file, file_type) != 1) { failf(data, "could not load ASN1 client certificate, " OSSL_PACKAGE " error %s, " "(no key found, wrong pass phrase, or wrong file format?)", ossl_strerror(ERR_get_error(), error_buffer, sizeof(error_buffer)) ); return 0; } break; case SSL_FILETYPE_ENGINE: #if defined(HAVE_OPENSSL_ENGINE_H) && defined(ENGINE_CTRL_GET_CMD_FROM_NAME) { if(data->state.engine) { const char *cmd_name = "LOAD_CERT_CTRL"; struct { const char *cert_id; X509 *cert; } params; params.cert_id = cert_file; params.cert = NULL; /* Does the engine supports LOAD_CERT_CTRL ? */ if(!ENGINE_ctrl(data->state.engine, ENGINE_CTRL_GET_CMD_FROM_NAME, 0, (void *)cmd_name, NULL)) { failf(data, "ssl engine does not support loading certificates"); return 0; } /* Load the certificate from the engine */ if(!ENGINE_ctrl_cmd(data->state.engine, cmd_name, 0, &params, NULL, 1)) { failf(data, "ssl engine cannot load client cert with id" " '%s' [%s]", cert_file, ossl_strerror(ERR_get_error(), error_buffer, sizeof(error_buffer))); return 0; } if(!params.cert) { failf(data, "ssl engine didn't initialized the certificate " "properly."); return 0; } if(SSL_CTX_use_certificate(ctx, params.cert) != 1) { failf(data, "unable to set client certificate"); X509_free(params.cert); return 0; } X509_free(params.cert); /* we don't need the handle any more... */ } else { failf(data, "crypto engine not set, can't load certificate"); return 0; } } break; #else failf(data, "file type ENG for certificate not implemented"); return 0; #endif case SSL_FILETYPE_PKCS12: { FILE *f; PKCS12 *p12; EVP_PKEY *pri; STACK_OF(X509) *ca = NULL; f = fopen(cert_file, "rb"); if(!f) { failf(data, "could not open PKCS12 file '%s'", cert_file); return 0; } p12 = d2i_PKCS12_fp(f, NULL); fclose(f); if(!p12) { failf(data, "error reading PKCS12 file '%s'", cert_file); return 0; } PKCS12_PBE_add(); if(!PKCS12_parse(p12, key_passwd, &pri, &x509, &ca)) { failf(data, "could not parse PKCS12 file, check password, " OSSL_PACKAGE " error %s", ossl_strerror(ERR_get_error(), error_buffer, sizeof(error_buffer)) ); PKCS12_free(p12); return 0; } PKCS12_free(p12); if(SSL_CTX_use_certificate(ctx, x509) != 1) { failf(data, "could not load PKCS12 client certificate, " OSSL_PACKAGE " error %s", ossl_strerror(ERR_get_error(), error_buffer, sizeof(error_buffer)) ); goto fail; } if(SSL_CTX_use_PrivateKey(ctx, pri) != 1) { failf(data, "unable to use private key from PKCS12 file '%s'", cert_file); goto fail; } if(!SSL_CTX_check_private_key (ctx)) { failf(data, "private key from PKCS12 file '%s' " "does not match certificate in same file", cert_file); goto fail; } /* Set Certificate Verification chain */ if(ca) { while(sk_X509_num(ca)) { /* * Note that sk_X509_pop() is used below to make sure the cert is * removed from the stack properly before getting passed to * SSL_CTX_add_extra_chain_cert(), which takes ownership. Previously * we used sk_X509_value() instead, but then we'd clean it in the * subsequent sk_X509_pop_free() call. */ X509 *x = sk_X509_pop(ca); if(!SSL_CTX_add_client_CA(ctx, x)) { X509_free(x); failf(data, "cannot add certificate to client CA list"); goto fail; } if(!SSL_CTX_add_extra_chain_cert(ctx, x)) { X509_free(x); failf(data, "cannot add certificate to certificate chain"); goto fail; } } } cert_done = 1; fail: EVP_PKEY_free(pri); X509_free(x509); sk_X509_pop_free(ca, X509_free); if(!cert_done) return 0; /* failure! */ break; } default: failf(data, "not supported file type '%s' for certificate", cert_type); return 0; } file_type = do_file_type(key_type); switch(file_type) { case SSL_FILETYPE_PEM: if(cert_done) break; if(!key_file) /* cert & key can only be in PEM case in the same file */ key_file = cert_file; /* FALLTHROUGH */ case SSL_FILETYPE_ASN1: if(SSL_CTX_use_PrivateKey_file(ctx, key_file, file_type) != 1) { failf(data, "unable to set private key file: '%s' type %s", key_file, key_type?key_type:"PEM"); return 0; } break; case SSL_FILETYPE_ENGINE: #ifdef HAVE_OPENSSL_ENGINE_H { /* XXXX still needs some work */ EVP_PKEY *priv_key = NULL; if(data->state.engine) { UI_METHOD *ui_method = UI_create_method((char *)"curl user interface"); if(!ui_method) { failf(data, "unable do create " OSSL_PACKAGE " user-interface method"); return 0; } UI_method_set_opener(ui_method, UI_method_get_opener(UI_OpenSSL())); UI_method_set_closer(ui_method, UI_method_get_closer(UI_OpenSSL())); UI_method_set_reader(ui_method, ssl_ui_reader); UI_method_set_writer(ui_method, ssl_ui_writer); /* the typecast below was added to please mingw32 */ priv_key = (EVP_PKEY *) ENGINE_load_private_key(data->state.engine, key_file, ui_method, key_passwd); UI_destroy_method(ui_method); if(!priv_key) { failf(data, "failed to load private key from crypto engine"); return 0; } if(SSL_CTX_use_PrivateKey(ctx, priv_key) != 1) { failf(data, "unable to set private key"); EVP_PKEY_free(priv_key); return 0; } EVP_PKEY_free(priv_key); /* we don't need the handle any more... */ } else { failf(data, "crypto engine not set, can't load private key"); return 0; } } break; #else failf(data, "file type ENG for private key not supported"); return 0; #endif case SSL_FILETYPE_PKCS12: if(!cert_done) { failf(data, "file type P12 for private key not supported"); return 0; } break; default: failf(data, "not supported file type for private key"); return 0; } ssl = SSL_new(ctx); if(!ssl) { failf(data, "unable to create an SSL structure"); return 0; } x509 = SSL_get_certificate(ssl); /* This version was provided by Evan Jordan and is supposed to not leak memory as the previous version: */ if(x509) { EVP_PKEY *pktmp = X509_get_pubkey(x509); EVP_PKEY_copy_parameters(pktmp, SSL_get_privatekey(ssl)); EVP_PKEY_free(pktmp); } #if !defined(OPENSSL_NO_RSA) && !defined(OPENSSL_IS_BORINGSSL) { /* If RSA is used, don't check the private key if its flags indicate * it doesn't support it. */ EVP_PKEY *priv_key = SSL_get_privatekey(ssl); int pktype; #ifdef HAVE_OPAQUE_EVP_PKEY pktype = EVP_PKEY_id(priv_key); #else pktype = priv_key->type; #endif if(pktype == EVP_PKEY_RSA) { RSA *rsa = EVP_PKEY_get1_RSA(priv_key); if(RSA_flags(rsa) & RSA_METHOD_FLAG_NO_CHECK) check_privkey = FALSE; RSA_free(rsa); /* Decrement reference count */ } } #endif SSL_free(ssl); /* If we are using DSA, we can copy the parameters from * the private key */ if(check_privkey == TRUE) { /* Now we know that a key and cert have been set against * the SSL context */ if(!SSL_CTX_check_private_key(ctx)) { failf(data, "Private key does not match the certificate public key"); return 0; } } } return 1; }
pushq %rbp movq %rsp, %rbp subq $0x250, %rsp # imm = 0x250 movq 0x10(%rbp), %rax movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq %rdx, -0x20(%rbp) movq %rcx, -0x28(%rbp) movq %r8, -0x30(%rbp) movq %r9, -0x38(%rbp) movq -0x10(%rbp), %rax movq (%rax), %rax movq %rax, -0x40(%rbp) movb $0x1, -0x141(%rbp) movq -0x28(%rbp), %rdi callq 0x75620 movl %eax, -0x148(%rbp) cmpq $0x0, -0x20(%rbp) jne 0x7487c cmpl $0x2a, -0x148(%rbp) jne 0x752a5 movl $0x0, -0x15c(%rbp) cmpq $0x0, 0x10(%rbp) je 0x748aa movq -0x18(%rbp), %rdi movq 0x10(%rbp), %rsi callq 0xa250 movq -0x18(%rbp), %rdi leaq 0xe2b(%rip), %rsi # 0x756d0 callq 0x9080 movl -0x148(%rbp), %eax movl %eax, -0x1d4(%rbp) subl $0x1, %eax je 0x748f3 jmp 0x748bd movl -0x1d4(%rbp), %eax subl $0x2, %eax je 0x74952 jmp 0x748ce movl -0x1d4(%rbp), %eax subl $0x2a, %eax je 0x749b7 jmp 0x748df movl -0x1d4(%rbp), %eax subl $0x2b, %eax je 0x74b57 jmp 0x74e5c movq -0x18(%rbp), %rdi movq -0x20(%rbp), %rsi callq 0x9790 cmpl $0x1, %eax je 0x7494d movq -0x40(%rbp), %rax movq %rax, -0x1e0(%rbp) callq 0x9d00 movq %rax, %rdi leaq -0x140(%rbp), %rsi movl $0x100, %edx # imm = 0x100 callq 0x71c20 movq -0x1e0(%rbp), %rdi movq %rax, %rdx leaq 0xf2ee(%rip), %rsi # 0x83c28 movb $0x0, %al callq 0x19f90 movl $0x0, -0x4(%rbp) jmp 0x752ac jmp 0x74e7e movq -0x18(%rbp), %rdi movq -0x20(%rbp), %rsi movl -0x148(%rbp), %edx callq 0x9d90 cmpl $0x1, %eax je 0x749b2 movq -0x40(%rbp), %rax movq %rax, -0x1e8(%rbp) callq 0x9d00 movq %rax, %rdi leaq -0x140(%rbp), %rsi movl $0x100, %edx # imm = 0x100 callq 0x71c20 movq -0x1e8(%rbp), %rdi movq %rax, %rdx leaq 0xf2fb(%rip), %rsi # 0x83c9a movb $0x0, %al callq 0x19f90 movl $0x0, -0x4(%rbp) jmp 0x752ac jmp 0x74e7e movq -0x40(%rbp), %rax cmpq $0x0, 0x4e20(%rax) je 0x74b34 leaq 0xf33d(%rip), %rax # 0x83d0d movq %rax, -0x168(%rbp) movq -0x20(%rbp), %rax movq %rax, -0x178(%rbp) movq $0x0, -0x170(%rbp) movq -0x40(%rbp), %rax movq 0x4e20(%rax), %rdi movq -0x168(%rbp), %rcx movl $0xd, %esi xorl %eax, %eax movl %eax, %r8d movq %r8, %rdx callq 0x9470 cmpl $0x0, %eax jne 0x74a34 movq -0x40(%rbp), %rdi leaq 0xf2fb(%rip), %rsi # 0x83d1c movb $0x0, %al callq 0x19f90 movl $0x0, -0x4(%rbp) jmp 0x752ac movq -0x40(%rbp), %rax movq 0x4e20(%rax), %rdi movq -0x168(%rbp), %rsi xorl %eax, %eax movl %eax, %r8d leaq -0x178(%rbp), %rcx movl $0x1, %r9d movq %r8, %rdx callq 0x9330 cmpl $0x0, %eax jne 0x74abf movq -0x40(%rbp), %rax movq %rax, -0x1f8(%rbp) movq -0x20(%rbp), %rax movq %rax, -0x1f0(%rbp) callq 0x9d00 movq %rax, %rdi leaq -0x140(%rbp), %rsi movl $0x100, %edx # imm = 0x100 callq 0x71c20 movq -0x1f8(%rbp), %rdi movq -0x1f0(%rbp), %rdx movq %rax, %rcx leaq 0xf2a1(%rip), %rsi # 0x83d4d movb $0x0, %al callq 0x19f90 movl $0x0, -0x4(%rbp) jmp 0x752ac cmpq $0x0, -0x170(%rbp) jne 0x74ae7 movq -0x40(%rbp), %rdi leaq 0xf2ae(%rip), %rsi # 0x83d82 movb $0x0, %al callq 0x19f90 movl $0x0, -0x4(%rbp) jmp 0x752ac movq -0x18(%rbp), %rdi movq -0x170(%rbp), %rsi callq 0x9db0 cmpl $0x1, %eax je 0x74b26 movq -0x40(%rbp), %rdi leaq 0xf2b3(%rip), %rsi # 0x83dba movb $0x0, %al callq 0x19f90 movq -0x170(%rbp), %rdi callq 0xa388 movl $0x0, -0x4(%rbp) jmp 0x752ac movq -0x170(%rbp), %rdi callq 0xa388 jmp 0x74b52 movq -0x40(%rbp), %rdi leaq 0xf29c(%rip), %rsi # 0x83ddb movb $0x0, %al callq 0x19f90 movl $0x0, -0x4(%rbp) jmp 0x752ac jmp 0x74e7e movq $0x0, -0x198(%rbp) movq -0x20(%rbp), %rdi leaq 0xe359(%rip), %rsi # 0x82ec6 callq 0x9ae0 movq %rax, -0x180(%rbp) cmpq $0x0, -0x180(%rbp) jne 0x74ba5 movq -0x40(%rbp), %rdi movq -0x20(%rbp), %rdx leaq 0xf277(%rip), %rsi # 0x83e09 movb $0x0, %al callq 0x19f90 movl $0x0, -0x4(%rbp) jmp 0x752ac movq -0x180(%rbp), %rdi xorl %eax, %eax movl %eax, %esi callq 0x9430 movq %rax, -0x188(%rbp) movq -0x180(%rbp), %rdi callq 0x9980 cmpq $0x0, -0x188(%rbp) jne 0x74bf4 movq -0x40(%rbp), %rdi movq -0x20(%rbp), %rdx leaq 0xf248(%rip), %rsi # 0x83e29 movb $0x0, %al callq 0x19f90 movl $0x0, -0x4(%rbp) jmp 0x752ac callq 0x94d0 movq -0x188(%rbp), %rdi movq 0x10(%rbp), %rsi leaq -0x190(%rbp), %rdx leaq -0x158(%rbp), %rcx leaq -0x198(%rbp), %r8 callq 0x9fb0 cmpl $0x0, %eax jne 0x74c77 movq -0x40(%rbp), %rax movq %rax, -0x200(%rbp) callq 0x9d00 movq %rax, %rdi leaq -0x140(%rbp), %rsi movl $0x100, %edx # imm = 0x100 callq 0x71c20 movq -0x200(%rbp), %rdi movq %rax, %rdx leaq 0xf1f0(%rip), %rsi # 0x83e48 movb $0x0, %al callq 0x19f90 movq -0x188(%rbp), %rdi callq 0x9650 movl $0x0, -0x4(%rbp) jmp 0x752ac movq -0x188(%rbp), %rdi callq 0x9650 movq -0x18(%rbp), %rdi movq -0x158(%rbp), %rsi callq 0x9db0 cmpl $0x1, %eax je 0x74cd9 movq -0x40(%rbp), %rax movq %rax, -0x208(%rbp) callq 0x9d00 movq %rax, %rdi leaq -0x140(%rbp), %rsi movl $0x100, %edx # imm = 0x100 callq 0x71c20 movq -0x208(%rbp), %rdi movq %rax, %rdx leaq 0xf1b9(%rip), %rsi # 0x83e86 movb $0x0, %al callq 0x19f90 jmp 0x74dff movq -0x18(%rbp), %rdi movq -0x190(%rbp), %rsi callq 0x9870 cmpl $0x1, %eax je 0x74d09 movq -0x40(%rbp), %rdi movq -0x20(%rbp), %rdx leaq 0xf1c4(%rip), %rsi # 0x83ec1 movb $0x0, %al callq 0x19f90 jmp 0x74dff movq -0x18(%rbp), %rdi callq 0xa000 cmpl $0x0, %eax jne 0x74d32 movq -0x40(%rbp), %rdi movq -0x20(%rbp), %rdx leaq 0xf1cb(%rip), %rsi # 0x83ef1 movb $0x0, %al callq 0x19f90 jmp 0x74dff cmpq $0x0, -0x198(%rbp) je 0x74df5 jmp 0x74d42 movq -0x198(%rbp), %rdi callq 0x75740 movq %rax, %rdi callq 0x94a0 cmpl $0x0, %eax je 0x74df3 movq -0x198(%rbp), %rdi callq 0x75750 movq %rax, %rdi callq 0x9b40 movq %rax, -0x1a0(%rbp) movq -0x18(%rbp), %rdi movq -0x1a0(%rbp), %rsi callq 0x9260 cmpl $0x0, %eax jne 0x74daf movq -0x1a0(%rbp), %rdi callq 0xa388 movq -0x40(%rbp), %rdi leaq 0xf195(%rip), %rsi # 0x83f3b movb $0x0, %al callq 0x19f90 jmp 0x74dff movq -0x18(%rbp), %rdi movq -0x1a0(%rbp), %rcx movl $0xe, %esi xorl %eax, %eax movl %eax, %edx callq 0x98b0 cmpq $0x0, %rax jne 0x74dee movq -0x1a0(%rbp), %rdi callq 0xa388 movq -0x40(%rbp), %rdi leaq 0xf17f(%rip), %rsi # 0x83f64 movb $0x0, %al callq 0x19f90 jmp 0x74dff jmp 0x74d42 jmp 0x74df5 movl $0x1, -0x15c(%rbp) movq -0x190(%rbp), %rdi callq 0x95d0 movq -0x158(%rbp), %rdi callq 0xa388 movq -0x198(%rbp), %rdi callq 0x75750 movq %rax, -0x210(%rbp) movq 0x1e14f(%rip), %rdi # 0x92f80 callq 0x75760 movq -0x210(%rbp), %rdi movq %rax, %rsi callq 0xa120 cmpl $0x0, -0x15c(%rbp) jne 0x74e5a movl $0x0, -0x4(%rbp) jmp 0x752ac jmp 0x74e7e movq -0x40(%rbp), %rdi movq -0x28(%rbp), %rdx leaq 0xf125(%rip), %rsi # 0x83f90 movb $0x0, %al callq 0x19f90 movl $0x0, -0x4(%rbp) jmp 0x752ac movq -0x38(%rbp), %rdi callq 0x75620 movl %eax, -0x148(%rbp) movl -0x148(%rbp), %eax movl %eax, -0x214(%rbp) subl $0x1, %eax je 0x74ed2 jmp 0x74ea0 movl -0x214(%rbp), %eax subl $0x2, %eax je 0x74ef1 jmp 0x74ead movl -0x214(%rbp), %eax subl $0x2a, %eax je 0x74f77 jmp 0x74ebe movl -0x214(%rbp), %eax subl $0x2b, %eax je 0x75110 jmp 0x75139 cmpl $0x0, -0x15c(%rbp) je 0x74ee0 jmp 0x75157 cmpq $0x0, -0x30(%rbp) jne 0x74eef movq -0x20(%rbp), %rax movq %rax, -0x30(%rbp) jmp 0x74ef1 movq -0x18(%rbp), %rdi movq -0x30(%rbp), %rsi movl -0x148(%rbp), %edx callq 0x9040 cmpl $0x1, %eax je 0x74f72 movq -0x40(%rbp), %rax movq %rax, -0x228(%rbp) movq -0x30(%rbp), %rax movq %rax, -0x220(%rbp) cmpq $0x0, -0x38(%rbp) je 0x74f33 movq -0x38(%rbp), %rax movq %rax, -0x230(%rbp) jmp 0x74f43 leaq 0xf0b0(%rip), %rax # 0x83fea movq %rax, -0x230(%rbp) jmp 0x74f43 movq -0x220(%rbp), %rdx movq -0x228(%rbp), %rdi movq -0x230(%rbp), %rcx leaq 0xf05e(%rip), %rsi # 0x83fbd movb $0x0, %al callq 0x19f90 movl $0x0, -0x4(%rbp) jmp 0x752ac jmp 0x75157 movq $0x0, -0x1a8(%rbp) movq -0x40(%rbp), %rax cmpq $0x0, 0x4e20(%rax) je 0x750f0 leaq 0xf053(%rip), %rdi # 0x83fee callq 0x9060 movq %rax, -0x1b0(%rbp) cmpq $0x0, -0x1b0(%rbp) jne 0x74fcf movq -0x40(%rbp), %rdi leaq 0xf046(%rip), %rsi # 0x84002 movb $0x0, %al callq 0x19f90 movl $0x0, -0x4(%rbp) jmp 0x752ac movq -0x1b0(%rbp), %rax movq %rax, -0x240(%rbp) callq 0x9900 movq %rax, %rdi callq 0x9670 movq -0x240(%rbp), %rdi movq %rax, %rsi callq 0xa110 movq -0x1b0(%rbp), %rax movq %rax, -0x238(%rbp) callq 0x9900 movq %rax, %rdi callq 0x97a0 movq -0x238(%rbp), %rdi movq %rax, %rsi callq 0x91b0 movq -0x1b0(%rbp), %rdi leaq 0x73f(%rip), %rsi # 0x75770 callq 0x9660 movq -0x1b0(%rbp), %rdi leaq 0x7bc(%rip), %rsi # 0x75800 callq 0x98c0 movq -0x40(%rbp), %rax movq 0x4e20(%rax), %rdi movq -0x30(%rbp), %rsi movq -0x1b0(%rbp), %rdx movq 0x10(%rbp), %rcx callq 0x9460 movq %rax, -0x1a8(%rbp) movq -0x1b0(%rbp), %rdi callq 0x9f70 cmpq $0x0, -0x1a8(%rbp) jne 0x750a3 movq -0x40(%rbp), %rdi leaq 0xefa1(%rip), %rsi # 0x84031 movb $0x0, %al callq 0x19f90 movl $0x0, -0x4(%rbp) jmp 0x752ac movq -0x18(%rbp), %rdi movq -0x1a8(%rbp), %rsi callq 0x9870 cmpl $0x1, %eax je 0x750e2 movq -0x40(%rbp), %rdi leaq 0xef9c(%rip), %rsi # 0x8405f movb $0x0, %al callq 0x19f90 movq -0x1a8(%rbp), %rdi callq 0x95d0 movl $0x0, -0x4(%rbp) jmp 0x752ac movq -0x1a8(%rbp), %rdi callq 0x95d0 jmp 0x7510e movq -0x40(%rbp), %rdi leaq 0xef7e(%rip), %rsi # 0x84079 movb $0x0, %al callq 0x19f90 movl $0x0, -0x4(%rbp) jmp 0x752ac jmp 0x75157 cmpl $0x0, -0x15c(%rbp) jne 0x75137 movq -0x40(%rbp), %rdi leaq 0xef83(%rip), %rsi # 0x840a7 movb $0x0, %al callq 0x19f90 movl $0x0, -0x4(%rbp) jmp 0x752ac jmp 0x75157 movq -0x40(%rbp), %rdi leaq 0xef8f(%rip), %rsi # 0x840d3 movb $0x0, %al callq 0x19f90 movl $0x0, -0x4(%rbp) jmp 0x752ac movq -0x18(%rbp), %rdi callq 0x99c0 movq %rax, -0x150(%rbp) cmpq $0x0, -0x150(%rbp) jne 0x7518f movq -0x40(%rbp), %rdi leaq 0xef7f(%rip), %rsi # 0x840fb movb $0x0, %al callq 0x19f90 movl $0x0, -0x4(%rbp) jmp 0x752ac movq -0x150(%rbp), %rdi callq 0x9b80 movq %rax, -0x158(%rbp) cmpq $0x0, -0x158(%rbp) je 0x751f4 movq -0x158(%rbp), %rdi callq 0xa040 movq %rax, -0x1b8(%rbp) movq -0x1b8(%rbp), %rax movq %rax, -0x248(%rbp) movq -0x150(%rbp), %rdi callq 0x9610 movq -0x248(%rbp), %rdi movq %rax, %rsi callq 0x9ee0 movq -0x1b8(%rbp), %rdi callq 0x95d0 movq -0x150(%rbp), %rdi callq 0x9610 movq %rax, -0x1c0(%rbp) movq -0x1c0(%rbp), %rdi callq 0x97f0 movl %eax, -0x1c4(%rbp) cmpl $0x6, -0x1c4(%rbp) jne 0x7525c movq -0x1c0(%rbp), %rdi callq 0x9fa0 movq %rax, -0x1d0(%rbp) movq -0x1d0(%rbp), %rdi callq 0x9270 andl $0x1, %eax cmpl $0x0, %eax je 0x75250 movb $0x0, -0x141(%rbp) movq -0x1d0(%rbp), %rdi callq 0x9ab0 movq -0x150(%rbp), %rdi callq 0x9550 movb -0x141(%rbp), %al andb $0x1, %al movzbl %al, %eax cmpl $0x1, %eax jne 0x752a3 movq -0x18(%rbp), %rdi callq 0xa000 cmpl $0x0, %eax jne 0x752a1 movq -0x40(%rbp), %rdi leaq 0xee8c(%rip), %rsi # 0x8411d movb $0x0, %al callq 0x19f90 movl $0x0, -0x4(%rbp) jmp 0x752ac jmp 0x752a3 jmp 0x752a5 movl $0x1, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x250, %rsp # imm = 0x250 popq %rbp retq nopl (%rax,%rax)
/macressler[P]curl/lib/vtls/openssl.c
ossl_keylog_callback
static void ossl_keylog_callback(const SSL *ssl, const char *line) { (void)ssl; /* Using fputs here instead of fprintf since libcurl's fprintf replacement may not be thread-safe. */ if(keylog_file_fp && line && *line) { char stackbuf[256]; char *buf; size_t linelen = strlen(line); if(linelen <= sizeof(stackbuf) - 2) buf = stackbuf; else { buf = malloc(linelen + 2); if(!buf) return; } strncpy(buf, line, linelen); buf[linelen] = '\n'; buf[linelen + 1] = '\0'; fputs(buf, keylog_file_fp); if(buf != stackbuf) free(buf); } }
pushq %rbp movq %rsp, %rbp subq $0x120, %rsp # imm = 0x120 movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) cmpq $0x0, 0x1ea65(%rip) # 0x93d40 je 0x753cc cmpq $0x0, -0x10(%rbp) je 0x753cc movq -0x10(%rbp), %rax movsbl (%rax), %eax cmpl $0x0, %eax je 0x753cc movq -0x10(%rbp), %rdi callq 0x93b0 movq %rax, -0x120(%rbp) cmpq $0xfe, -0x120(%rbp) ja 0x75329 leaq -0x110(%rbp), %rax movq %rax, -0x118(%rbp) jmp 0x75355 leaq 0x1e718(%rip), %rax # 0x93a48 movq (%rax), %rax movq -0x120(%rbp), %rdi addq $0x2, %rdi callq *%rax movq %rax, -0x118(%rbp) cmpq $0x0, -0x118(%rbp) jne 0x75353 jmp 0x753cc jmp 0x75355 movq -0x118(%rbp), %rdi movq -0x10(%rbp), %rsi movq -0x120(%rbp), %rdx callq 0x94e0 movq -0x118(%rbp), %rax movq -0x120(%rbp), %rcx movb $0xa, (%rax,%rcx) movq -0x118(%rbp), %rax movq -0x120(%rbp), %rcx movb $0x0, 0x1(%rax,%rcx) movq -0x118(%rbp), %rdi movq 0x1e9a1(%rip), %rsi # 0x93d40 callq 0x9b10 movq -0x118(%rbp), %rax leaq -0x110(%rbp), %rcx cmpq %rcx, %rax je 0x753ca leaq 0x1e692(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x118(%rbp), %rdi callq *%rax jmp 0x753cc addq $0x120, %rsp # imm = 0x120 popq %rbp retq nopw %cs:(%rax,%rax)
/macressler[P]curl/lib/vtls/openssl.c
tls_rt_type
static const char *tls_rt_type(int type) { switch(type) { #ifdef SSL3_RT_HEADER case SSL3_RT_HEADER: return "TLS header"; #endif case SSL3_RT_CHANGE_CIPHER_SPEC: return "TLS change cipher"; case SSL3_RT_ALERT: return "TLS alert"; case SSL3_RT_HANDSHAKE: return "TLS handshake"; case SSL3_RT_APPLICATION_DATA: return "TLS app data"; default: return "TLS Unknown"; } }
pushq %rbp movq %rsp, %rbp movl %edi, -0xc(%rbp) movl -0xc(%rbp), %eax movl %eax, -0x10(%rbp) subl $0x14, %eax je 0x7542b jmp 0x753f4 movl -0x10(%rbp), %eax subl $0x15, %eax je 0x75438 jmp 0x753fe movl -0x10(%rbp), %eax subl $0x16, %eax je 0x75445 jmp 0x75408 movl -0x10(%rbp), %eax subl $0x17, %eax je 0x75452 jmp 0x75412 movl -0x10(%rbp), %eax subl $0x100, %eax # imm = 0x100 jne 0x7545f jmp 0x7541e leaq 0xe6cb(%rip), %rax # 0x83af0 movq %rax, -0x8(%rbp) jmp 0x7546a leaq 0xe6c9(%rip), %rax # 0x83afb movq %rax, -0x8(%rbp) jmp 0x7546a leaq 0xe6ce(%rip), %rax # 0x83b0d movq %rax, -0x8(%rbp) jmp 0x7546a leaq 0xe6cb(%rip), %rax # 0x83b17 movq %rax, -0x8(%rbp) jmp 0x7546a leaq 0xe6cc(%rip), %rax # 0x83b25 movq %rax, -0x8(%rbp) jmp 0x7546a leaq 0xe6cc(%rip), %rax # 0x83b32 movq %rax, -0x8(%rbp) movq -0x8(%rbp), %rax popq %rbp retq
/macressler[P]curl/lib/vtls/openssl.c
ssl_msg_type
static const char *ssl_msg_type(int ssl_ver, int msg) { #ifdef SSL2_VERSION_MAJOR if(ssl_ver == SSL2_VERSION_MAJOR) { switch(msg) { case SSL2_MT_ERROR: return "Error"; case SSL2_MT_CLIENT_HELLO: return "Client hello"; case SSL2_MT_CLIENT_MASTER_KEY: return "Client key"; case SSL2_MT_CLIENT_FINISHED: return "Client finished"; case SSL2_MT_SERVER_HELLO: return "Server hello"; case SSL2_MT_SERVER_VERIFY: return "Server verify"; case SSL2_MT_SERVER_FINISHED: return "Server finished"; case SSL2_MT_REQUEST_CERTIFICATE: return "Request CERT"; case SSL2_MT_CLIENT_CERTIFICATE: return "Client CERT"; } } else #endif if(ssl_ver == SSL3_VERSION_MAJOR) { switch(msg) { case SSL3_MT_HELLO_REQUEST: return "Hello request"; case SSL3_MT_CLIENT_HELLO: return "Client hello"; case SSL3_MT_SERVER_HELLO: return "Server hello"; #ifdef SSL3_MT_NEWSESSION_TICKET case SSL3_MT_NEWSESSION_TICKET: return "Newsession Ticket"; #endif case SSL3_MT_CERTIFICATE: return "Certificate"; case SSL3_MT_SERVER_KEY_EXCHANGE: return "Server key exchange"; case SSL3_MT_CLIENT_KEY_EXCHANGE: return "Client key exchange"; case SSL3_MT_CERTIFICATE_REQUEST: return "Request CERT"; case SSL3_MT_SERVER_DONE: return "Server finished"; case SSL3_MT_CERTIFICATE_VERIFY: return "CERT verify"; case SSL3_MT_FINISHED: return "Finished"; #ifdef SSL3_MT_CERTIFICATE_STATUS case SSL3_MT_CERTIFICATE_STATUS: return "Certificate Status"; #endif } } return "Unknown"; }
pushq %rbp movq %rsp, %rbp movl %edi, -0xc(%rbp) movl %esi, -0x10(%rbp) cmpl $0x3, -0xc(%rbp) jne 0x75550 movl -0x10(%rbp), %eax movq %rax, -0x18(%rbp) subq $0x16, %rax ja 0x7554e movq -0x18(%rbp), %rax leaq 0xe088(%rip), %rcx # 0x83528 movslq (%rcx,%rax,4), %rax addq %rcx, %rax jmpq *%rax leaq 0xe68e(%rip), %rax # 0x83b3e movq %rax, -0x8(%rbp) jmp 0x7555b leaq 0xe68c(%rip), %rax # 0x83b4c movq %rax, -0x8(%rbp) jmp 0x7555b leaq 0xe689(%rip), %rax # 0x83b59 movq %rax, -0x8(%rbp) jmp 0x7555b leaq 0xe686(%rip), %rax # 0x83b66 movq %rax, -0x8(%rbp) jmp 0x7555b leaq 0xe68b(%rip), %rax # 0x83b78 movq %rax, -0x8(%rbp) jmp 0x7555b leaq 0xe68a(%rip), %rax # 0x83b84 movq %rax, -0x8(%rbp) jmp 0x7555b leaq 0xe691(%rip), %rax # 0x83b98 movq %rax, -0x8(%rbp) jmp 0x7555b leaq 0xe698(%rip), %rax # 0x83bac movq %rax, -0x8(%rbp) jmp 0x7555b leaq 0xe698(%rip), %rax # 0x83bb9 movq %rax, -0x8(%rbp) jmp 0x7555b leaq 0xe69b(%rip), %rax # 0x83bc9 movq %rax, -0x8(%rbp) jmp 0x7555b leaq 0xe69a(%rip), %rax # 0x83bd5 movq %rax, -0x8(%rbp) jmp 0x7555b leaq 0xe696(%rip), %rax # 0x83bde movq %rax, -0x8(%rbp) jmp 0x7555b jmp 0x75550 leaq 0xe5df(%rip), %rax # 0x83b36 movq %rax, -0x8(%rbp) movq -0x8(%rbp), %rax popq %rbp retq nopw %cs:(%rax,%rax)
/macressler[P]curl/lib/vtls/openssl.c
do_file_type
static int do_file_type(const char *type) { if(!type || !type[0]) return SSL_FILETYPE_PEM; if(strcasecompare(type, "PEM")) return SSL_FILETYPE_PEM; if(strcasecompare(type, "DER")) return SSL_FILETYPE_ASN1; if(strcasecompare(type, "ENG")) return SSL_FILETYPE_ENGINE; if(strcasecompare(type, "P12")) return SSL_FILETYPE_PKCS12; return -1; }
pushq %rbp movq %rsp, %rbp subq $0x10, %rsp movq %rdi, -0x10(%rbp) cmpq $0x0, -0x10(%rbp) je 0x7563c movq -0x10(%rbp), %rax cmpb $0x0, (%rax) jne 0x75645 movl $0x1, -0x4(%rbp) jmp 0x756c4 movq -0x10(%rbp), %rdi leaq 0xe99a(%rip), %rsi # 0x83fea callq 0x36690 cmpl $0x0, %eax je 0x75663 movl $0x1, -0x4(%rbp) jmp 0x756c4 movq -0x10(%rbp), %rdi leaq 0xeae5(%rip), %rsi # 0x84153 callq 0x36690 cmpl $0x0, %eax je 0x75681 movl $0x2, -0x4(%rbp) jmp 0x756c4 movq -0x10(%rbp), %rdi leaq 0xeacb(%rip), %rsi # 0x84157 callq 0x36690 cmpl $0x0, %eax je 0x7569f movl $0x2a, -0x4(%rbp) jmp 0x756c4 movq -0x10(%rbp), %rdi leaq 0xeab1(%rip), %rsi # 0x8415b callq 0x36690 cmpl $0x0, %eax je 0x756bd movl $0x2b, -0x4(%rbp) jmp 0x756c4 movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF movl -0x4(%rbp), %eax addq $0x10, %rsp popq %rbp retq nopl (%rax)
/macressler[P]curl/lib/vtls/openssl.c
passwd_callback
static int passwd_callback(char *buf, int num, int encrypting, void *global_passwd) { DEBUGASSERT(0 == encrypting); if(!encrypting) { int klen = curlx_uztosi(strlen((char *)global_passwd)); if(num > klen) { memcpy(buf, global_passwd, klen + 1); return klen; } } return 0; }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x10(%rbp) movl %esi, -0x14(%rbp) movl %edx, -0x18(%rbp) movq %rcx, -0x20(%rbp) jmp 0x756e8 cmpl $0x0, -0x18(%rbp) jne 0x7572a movq -0x20(%rbp), %rdi callq 0x93b0 movq %rax, %rdi callq 0x57290 movl %eax, -0x24(%rbp) movl -0x14(%rbp), %eax cmpl -0x24(%rbp), %eax jle 0x75728 movq -0x10(%rbp), %rdi movq -0x20(%rbp), %rsi movl -0x24(%rbp), %eax addl $0x1, %eax movslq %eax, %rdx callq 0x97b0 movl -0x24(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x75731 jmp 0x7572a movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x30, %rsp popq %rbp retq nopw (%rax,%rax)
/macressler[P]curl/lib/vtls/openssl.c
ssl_ui_reader
static int ssl_ui_reader(UI *ui, UI_STRING *uis) { const char *password; switch(UI_get_string_type(uis)) { case UIT_PROMPT: case UIT_VERIFY: password = (const char *)UI_get0_user_data(ui); if(password && (UI_get_input_flags(uis) & UI_INPUT_FLAG_DEFAULT_PWD)) { UI_set_result(ui, uis, password); return 1; } default: break; } return (UI_method_get_reader(UI_OpenSSL()))(ui, uis); }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq -0x18(%rbp), %rdi callq 0xa330 decl %eax subl $0x1, %eax ja 0x757d3 jmp 0x75792 movq -0x10(%rbp), %rdi callq 0x93e0 movq %rax, -0x20(%rbp) cmpq $0x0, -0x20(%rbp) je 0x757d1 movq -0x18(%rbp), %rdi callq 0x9310 andl $0x2, %eax cmpl $0x0, %eax je 0x757d1 movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi movq -0x20(%rbp), %rdx callq 0x9210 movl $0x1, -0x4(%rbp) jmp 0x757ef jmp 0x757d3 jmp 0x757d5 callq 0x9900 movq %rax, %rdi callq 0x90d0 movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi callq *%rax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x20, %rsp popq %rbp retq nopl (%rax,%rax)
/macressler[P]curl/lib/vtls/openssl.c
ssl_ui_writer
static int ssl_ui_writer(UI *ui, UI_STRING *uis) { switch(UI_get_string_type(uis)) { case UIT_PROMPT: case UIT_VERIFY: if(UI_get0_user_data(ui) && (UI_get_input_flags(uis) & UI_INPUT_FLAG_DEFAULT_PWD)) { return 1; } default: break; } return (UI_method_get_writer(UI_OpenSSL()))(ui, uis); }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq -0x18(%rbp), %rdi callq 0xa330 decl %eax subl $0x1, %eax ja 0x7584d jmp 0x75822 movq -0x10(%rbp), %rdi callq 0x93e0 cmpq $0x0, %rax je 0x7584b movq -0x18(%rbp), %rdi callq 0x9310 andl $0x2, %eax cmpl $0x0, %eax je 0x7584b movl $0x1, -0x4(%rbp) jmp 0x75869 jmp 0x7584d jmp 0x7584f callq 0x9900 movq %rax, %rdi callq 0x9a70 movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi callq *%rax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x20, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/macressler[P]curl/lib/vtls/openssl.c
get_ssl_version_txt
static const char * get_ssl_version_txt(SSL *ssl) { if(!ssl) return ""; switch(SSL_version(ssl)) { #ifdef TLS1_3_VERSION case TLS1_3_VERSION: return "TLSv1.3"; #endif #if OPENSSL_VERSION_NUMBER >= 0x1000100FL case TLS1_2_VERSION: return "TLSv1.2"; case TLS1_1_VERSION: return "TLSv1.1"; #endif case TLS1_VERSION: return "TLSv1.0"; case SSL3_VERSION: return "SSLv3"; case SSL2_VERSION: return "SSLv2"; } return "unknown"; }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x10(%rbp) cmpq $0x0, -0x10(%rbp) jne 0x75923 leaq 0xdb92(%rip), %rax # 0x834ac movq %rax, -0x8(%rbp) jmp 0x759cd movq -0x10(%rbp), %rdi callq 0x94c0 movl %eax, %ecx movl %ecx, -0x14(%rbp) subl $0x2, %eax je 0x759b5 jmp 0x75938 movl -0x14(%rbp), %eax subl $0x300, %eax # imm = 0x300 je 0x759a8 jmp 0x75944 movl -0x14(%rbp), %eax subl $0x301, %eax # imm = 0x301 je 0x7599b jmp 0x75950 movl -0x14(%rbp), %eax subl $0x302, %eax # imm = 0x302 je 0x7598e jmp 0x7595c movl -0x14(%rbp), %eax subl $0x303, %eax # imm = 0x303 je 0x75981 jmp 0x75968 movl -0x14(%rbp), %eax subl $0x304, %eax # imm = 0x304 jne 0x759c2 jmp 0x75974 leaq 0xe151(%rip), %rax # 0x83acc movq %rax, -0x8(%rbp) jmp 0x759cd leaq 0xe13c(%rip), %rax # 0x83ac4 movq %rax, -0x8(%rbp) jmp 0x759cd leaq 0xe127(%rip), %rax # 0x83abc movq %rax, -0x8(%rbp) jmp 0x759cd leaq 0xe112(%rip), %rax # 0x83ab4 movq %rax, -0x8(%rbp) jmp 0x759cd leaq 0xe0ff(%rip), %rax # 0x83aae movq %rax, -0x8(%rbp) jmp 0x759cd leaq 0xe0ec(%rip), %rax # 0x83aa8 movq %rax, -0x8(%rbp) jmp 0x759cd leaq 0xdd94(%rip), %rax # 0x8375d movq %rax, -0x8(%rbp) movq -0x8(%rbp), %rax addq $0x20, %rsp popq %rbp retq nopw (%rax,%rax)
/macressler[P]curl/lib/vtls/openssl.c
servercert
static CURLcode servercert(struct connectdata *conn, struct ssl_connect_data *connssl, bool strict) { CURLcode result = CURLE_OK; int rc; long lerr, len; struct Curl_easy *data = conn->data; X509 *issuer; FILE *fp; char buffer[2048]; const char *ptr; long * const certverifyresult = SSL_IS_PROXY() ? &data->set.proxy_ssl.certverifyresult : &data->set.ssl.certverifyresult; BIO *mem = BIO_new(BIO_s_mem()); if(data->set.ssl.certinfo) /* we've been asked to gather certificate info! */ (void)get_cert_chain(conn, connssl); BACKEND->server_cert = SSL_get_peer_certificate(BACKEND->handle); if(!BACKEND->server_cert) { BIO_free(mem); if(!strict) return CURLE_OK; failf(data, "SSL: couldn't get peer certificate!"); return CURLE_PEER_FAILED_VERIFICATION; } infof(data, "%s certificate:\n", SSL_IS_PROXY() ? "Proxy" : "Server"); rc = x509_name_oneline(X509_get_subject_name(BACKEND->server_cert), buffer, sizeof(buffer)); infof(data, " subject: %s\n", rc?"[NONE]":buffer); ASN1_TIME_print(mem, X509_get0_notBefore(BACKEND->server_cert)); len = BIO_get_mem_data(mem, (char **) &ptr); infof(data, " start date: %.*s\n", len, ptr); (void)BIO_reset(mem); ASN1_TIME_print(mem, X509_get0_notAfter(BACKEND->server_cert)); len = BIO_get_mem_data(mem, (char **) &ptr); infof(data, " expire date: %.*s\n", len, ptr); (void)BIO_reset(mem); BIO_free(mem); if(SSL_CONN_CONFIG(verifyhost)) { result = verifyhost(conn, BACKEND->server_cert); if(result) { X509_free(BACKEND->server_cert); BACKEND->server_cert = NULL; return result; } } rc = x509_name_oneline(X509_get_issuer_name(BACKEND->server_cert), buffer, sizeof(buffer)); if(rc) { if(strict) failf(data, "SSL: couldn't get X509-issuer name!"); result = CURLE_SSL_CONNECT_ERROR; } else { infof(data, " issuer: %s\n", buffer); /* We could do all sorts of certificate verification stuff here before deallocating the certificate. */ /* e.g. match issuer name with provided issuer certificate */ if(SSL_SET_OPTION(issuercert)) { fp = fopen(SSL_SET_OPTION(issuercert), FOPEN_READTEXT); if(!fp) { if(strict) failf(data, "SSL: Unable to open issuer cert (%s)", SSL_SET_OPTION(issuercert)); X509_free(BACKEND->server_cert); BACKEND->server_cert = NULL; return CURLE_SSL_ISSUER_ERROR; } issuer = PEM_read_X509(fp, NULL, ZERO_NULL, NULL); if(!issuer) { if(strict) failf(data, "SSL: Unable to read issuer cert (%s)", SSL_SET_OPTION(issuercert)); X509_free(BACKEND->server_cert); X509_free(issuer); fclose(fp); return CURLE_SSL_ISSUER_ERROR; } fclose(fp); if(X509_check_issued(issuer, BACKEND->server_cert) != X509_V_OK) { if(strict) failf(data, "SSL: Certificate issuer check failed (%s)", SSL_SET_OPTION(issuercert)); X509_free(BACKEND->server_cert); X509_free(issuer); BACKEND->server_cert = NULL; return CURLE_SSL_ISSUER_ERROR; } infof(data, " SSL certificate issuer check ok (%s)\n", SSL_SET_OPTION(issuercert)); X509_free(issuer); } lerr = *certverifyresult = SSL_get_verify_result(BACKEND->handle); if(*certverifyresult != X509_V_OK) { if(SSL_CONN_CONFIG(verifypeer)) { /* We probably never reach this, because SSL_connect() will fail and we return earlier if verifypeer is set? */ if(strict) failf(data, "SSL certificate verify result: %s (%ld)", X509_verify_cert_error_string(lerr), lerr); result = CURLE_PEER_FAILED_VERIFICATION; } else infof(data, " SSL certificate verify result: %s (%ld)," " continuing anyway.\n", X509_verify_cert_error_string(lerr), lerr); } else infof(data, " SSL certificate verify ok.\n"); } #if (OPENSSL_VERSION_NUMBER >= 0x0090808fL) && !defined(OPENSSL_NO_TLSEXT) && \ !defined(OPENSSL_NO_OCSP) if(SSL_CONN_CONFIG(verifystatus)) { result = verifystatus(conn, connssl); if(result) { X509_free(BACKEND->server_cert); BACKEND->server_cert = NULL; return result; } } #endif if(!strict) /* when not strict, we don't bother about the verify cert problems */ result = CURLE_OK; ptr = SSL_IS_PROXY() ? data->set.str[STRING_SSL_PINNEDPUBLICKEY_PROXY] : data->set.str[STRING_SSL_PINNEDPUBLICKEY_ORIG]; if(!result && ptr) { result = pkp_pin_peer_pubkey(data, BACKEND->server_cert, ptr); if(result) failf(data, "SSL: public key does not match pinned public key!"); } X509_free(BACKEND->server_cert); BACKEND->server_cert = NULL; connssl->connecting_state = ssl_connect_done; return result; }
pushq %rbp movq %rsp, %rbp subq $0x900, %rsp # imm = 0x900 movb %dl, %al movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) andb $0x1, %al movb %al, -0x19(%rbp) movl $0x0, -0x20(%rbp) movq -0x10(%rbp), %rax movq (%rax), %rax movq %rax, -0x40(%rbp) movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x75a6f movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x75a6f movq -0x40(%rbp), %rax addq $0x1f0, %rax # imm = 0x1F0 addq $0x4a0, %rax # imm = 0x4A0 addq $0x50, %rax movq %rax, -0x870(%rbp) jmp 0x75a8a movq -0x40(%rbp), %rax addq $0x1f0, %rax # imm = 0x1F0 addq $0x3f8, %rax # imm = 0x3F8 addq $0x50, %rax movq %rax, -0x870(%rbp) movq -0x870(%rbp), %rax movq %rax, -0x860(%rbp) callq 0x9850 movq %rax, %rdi callq 0xa050 movq %rax, -0x868(%rbp) movq -0x40(%rbp), %rax testb $0x1, 0x660(%rax) je 0x75ac6 movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi callq 0x76580 movq -0x18(%rbp), %rax movq 0x10(%rax), %rax movq 0x8(%rax), %rdi callq 0xa1d0 movq %rax, %rcx movq -0x18(%rbp), %rax movq 0x10(%rax), %rax movq %rcx, 0x10(%rax) movq -0x18(%rbp), %rax movq 0x10(%rax), %rax cmpq $0x0, 0x10(%rax) jne 0x75b31 movq -0x868(%rbp), %rdi callq 0x9a00 testb $0x1, -0x19(%rbp) jne 0x75b13 movl $0x0, -0x4(%rbp) jmp 0x76565 movq -0x40(%rbp), %rdi leaq 0xe760(%rip), %rsi # 0x8427e movb $0x0, %al callq 0x19f90 movl $0x33, -0x4(%rbp) jmp 0x76565 movq -0x40(%rbp), %rax movq %rax, -0x880(%rbp) movq -0x10(%rbp), %rdx xorl %eax, %eax movl $0x2, %ecx cmpl 0x178(%rdx), %ecx movb %al, -0x871(%rbp) jne 0x75b91 movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax setne %al movb %al, -0x871(%rbp) movq -0x880(%rbp), %rdi movb -0x871(%rbp), %cl leaq 0x6472(%rip), %rdx # 0x7c017 leaq 0x6465(%rip), %rax # 0x7c011 testb $0x1, %cl cmovneq %rax, %rdx leaq 0xe6e8(%rip), %rsi # 0x842a2 movb $0x0, %al callq 0x19d00 movq -0x18(%rbp), %rax movq 0x10(%rax), %rax movq 0x10(%rax), %rdi callq 0x9a30 movq %rax, %rdi leaq -0x850(%rbp), %rsi movl $0x800, %edx # imm = 0x800 callq 0x76f30 movl %eax, -0x24(%rbp) movq -0x40(%rbp), %rax movq %rax, -0x888(%rbp) cmpl $0x0, -0x24(%rbp) je 0x75c0a leaq 0xe6c0(%rip), %rax # 0x842c1 movq %rax, -0x890(%rbp) jmp 0x75c18 leaq -0x850(%rbp), %rax movq %rax, -0x890(%rbp) movq -0x888(%rbp), %rdi movq -0x890(%rbp), %rdx leaq 0xe686(%rip), %rsi # 0x842b3 movb $0x0, %al callq 0x19d00 movq -0x868(%rbp), %rax movq %rax, -0x8a0(%rbp) movq -0x18(%rbp), %rax movq 0x10(%rax), %rax movq 0x10(%rax), %rdi callq 0xa090 movq -0x8a0(%rbp), %rdi movq %rax, %rsi callq 0xa2f0 movq -0x868(%rbp), %rdi movl $0x3, %esi xorl %eax, %eax movl %eax, %edx leaq -0x858(%rbp), %rcx callq 0x9220 movq %rax, -0x38(%rbp) movq -0x40(%rbp), %rdi movq -0x38(%rbp), %rdx movq -0x858(%rbp), %rcx leaq 0xe630(%rip), %rsi # 0x842c8 movb $0x0, %al callq 0x19d00 movq -0x868(%rbp), %rdi movl $0x1, %esi xorl %eax, %eax movl %eax, %ecx movq %rcx, %rdx callq 0x9220 movq -0x868(%rbp), %rax movq %rax, -0x898(%rbp) movq -0x18(%rbp), %rax movq 0x10(%rax), %rax movq 0x10(%rax), %rdi callq 0xa010 movq -0x898(%rbp), %rdi movq %rax, %rsi callq 0xa2f0 movq -0x868(%rbp), %rdi movl $0x3, %esi xorl %eax, %eax movl %eax, %edx leaq -0x858(%rbp), %rcx callq 0x9220 movq %rax, -0x38(%rbp) movq -0x40(%rbp), %rdi movq -0x38(%rbp), %rdx movq -0x858(%rbp), %rcx leaq 0xe5c0(%rip), %rsi # 0x842db movb $0x0, %al callq 0x19d00 movq -0x868(%rbp), %rdi movl $0x1, %esi xorl %eax, %eax movl %eax, %ecx movq %rcx, %rdx callq 0x9220 movq -0x868(%rbp), %rdi callq 0x9a00 movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x75d9b movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x75d9b movq -0x10(%rbp), %rax testb $0x1, 0x351(%rax) jne 0x75da8 jmp 0x75df4 movq -0x10(%rbp), %rax testb $0x1, 0x309(%rax) je 0x75df4 movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rax movq 0x10(%rax), %rax movq 0x10(%rax), %rsi callq 0x77000 movl %eax, -0x20(%rbp) cmpl $0x0, -0x20(%rbp) je 0x75df2 movq -0x18(%rbp), %rax movq 0x10(%rax), %rax movq 0x10(%rax), %rdi callq 0xa388 movq -0x18(%rbp), %rax movq 0x10(%rax), %rax movq $0x0, 0x10(%rax) movl -0x20(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x76565 jmp 0x75df4 movq -0x18(%rbp), %rax movq 0x10(%rax), %rax movq 0x10(%rax), %rdi callq 0x99a0 movq %rax, %rdi leaq -0x850(%rbp), %rsi movl $0x800, %edx # imm = 0x800 callq 0x76f30 movl %eax, -0x24(%rbp) cmpl $0x0, -0x24(%rbp) je 0x75e46 testb $0x1, -0x19(%rbp) je 0x75e3a movq -0x40(%rbp), %rdi leaq 0xe4bc(%rip), %rsi # 0x842ef movb $0x0, %al callq 0x19f90 movl $0x23, -0x20(%rbp) jmp 0x763bd movq -0x40(%rbp), %rdi leaq -0x850(%rbp), %rdx leaq 0xe4bb(%rip), %rsi # 0x84313 movb $0x0, %al callq 0x19d00 movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x75eb8 movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x75eb8 movq -0x40(%rbp), %rax cmpq $0x0, 0x6f0(%rax) jne 0x75eca jmp 0x762a6 movq -0x40(%rbp), %rax cmpq $0x0, 0x648(%rax) je 0x762a6 movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x75f24 movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x75f24 movq -0x40(%rbp), %rax movq 0x6f0(%rax), %rax movq %rax, -0x8a8(%rbp) jmp 0x75f36 movq -0x40(%rbp), %rax movq 0x648(%rax), %rax movq %rax, -0x8a8(%rbp) movq -0x8a8(%rbp), %rdi leaq 0xa858(%rip), %rsi # 0x8079c callq 0x9ae0 movq %rax, -0x50(%rbp) cmpq $0x0, -0x50(%rbp) jne 0x76022 testb $0x1, -0x19(%rbp) je 0x75ff5 movq -0x40(%rbp), %rax movq %rax, -0x8b0(%rbp) movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x75fc7 movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x75fc7 movq -0x40(%rbp), %rax movq 0x6f0(%rax), %rax movq %rax, -0x8b8(%rbp) jmp 0x75fd9 movq -0x40(%rbp), %rax movq 0x648(%rax), %rax movq %rax, -0x8b8(%rbp) movq -0x8b0(%rbp), %rdi movq -0x8b8(%rbp), %rdx leaq 0xe332(%rip), %rsi # 0x84320 movb $0x0, %al callq 0x19f90 movq -0x18(%rbp), %rax movq 0x10(%rax), %rax movq 0x10(%rax), %rdi callq 0xa388 movq -0x18(%rbp), %rax movq 0x10(%rax), %rax movq $0x0, 0x10(%rax) movl $0x53, -0x4(%rbp) jmp 0x76565 movq -0x50(%rbp), %rdi xorl %eax, %eax movl %eax, %ecx movq %rcx, %rsi movq %rcx, %rdx callq 0x9d70 movq %rax, -0x48(%rbp) cmpq $0x0, -0x48(%rbp) jne 0x76110 testb $0x1, -0x19(%rbp) je 0x760e1 movq -0x40(%rbp), %rax movq %rax, -0x8c0(%rbp) movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x760b3 movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x760b3 movq -0x40(%rbp), %rax movq 0x6f0(%rax), %rax movq %rax, -0x8c8(%rbp) jmp 0x760c5 movq -0x40(%rbp), %rax movq 0x648(%rax), %rax movq %rax, -0x8c8(%rbp) movq -0x8c0(%rbp), %rdi movq -0x8c8(%rbp), %rdx leaq 0xe26b(%rip), %rsi # 0x84345 movb $0x0, %al callq 0x19f90 movq -0x18(%rbp), %rax movq 0x10(%rax), %rax movq 0x10(%rax), %rdi callq 0xa388 movq -0x48(%rbp), %rdi callq 0xa388 movq -0x50(%rbp), %rdi callq 0x9980 movl $0x53, -0x4(%rbp) jmp 0x76565 movq -0x50(%rbp), %rdi callq 0x9980 movq -0x48(%rbp), %rdi movq -0x18(%rbp), %rax movq 0x10(%rax), %rax movq 0x10(%rax), %rsi callq 0x9860 cmpl $0x0, %eax je 0x7620a testb $0x1, -0x19(%rbp) je 0x761d4 movq -0x40(%rbp), %rax movq %rax, -0x8d0(%rbp) movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x761a6 movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x761a6 movq -0x40(%rbp), %rax movq 0x6f0(%rax), %rax movq %rax, -0x8d8(%rbp) jmp 0x761b8 movq -0x40(%rbp), %rax movq 0x648(%rax), %rax movq %rax, -0x8d8(%rbp) movq -0x8d0(%rbp), %rdi movq -0x8d8(%rbp), %rdx leaq 0xe19d(%rip), %rsi # 0x8436a movb $0x0, %al callq 0x19f90 movq -0x18(%rbp), %rax movq 0x10(%rax), %rax movq 0x10(%rax), %rdi callq 0xa388 movq -0x48(%rbp), %rdi callq 0xa388 movq -0x18(%rbp), %rax movq 0x10(%rax), %rax movq $0x0, 0x10(%rax) movl $0x53, -0x4(%rbp) jmp 0x76565 movq -0x40(%rbp), %rax movq %rax, -0x8e0(%rbp) movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x7626f movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x7626f movq -0x40(%rbp), %rax movq 0x6f0(%rax), %rax movq %rax, -0x8e8(%rbp) jmp 0x76281 movq -0x40(%rbp), %rax movq 0x648(%rax), %rax movq %rax, -0x8e8(%rbp) movq -0x8e0(%rbp), %rdi movq -0x8e8(%rbp), %rdx leaq 0xe0fe(%rip), %rsi # 0x84394 movb $0x0, %al callq 0x19d00 movq -0x48(%rbp), %rdi callq 0xa388 movq -0x18(%rbp), %rax movq 0x10(%rax), %rax movq 0x8(%rax), %rdi callq 0x9320 movq -0x860(%rbp), %rcx movq %rax, (%rcx) movq %rax, -0x30(%rbp) movq -0x860(%rbp), %rax cmpq $0x0, (%rax) je 0x763a9 movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x7632b movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x7632b movq -0x10(%rbp), %rax testb $0x1, 0x350(%rax) jne 0x76338 jmp 0x76377 movq -0x10(%rbp), %rax testb $0x1, 0x308(%rax) je 0x76377 testb $0x1, -0x19(%rbp) je 0x7636e movq -0x40(%rbp), %rax movq %rax, -0x8f0(%rbp) movq -0x30(%rbp), %rdi callq 0x96b0 movq -0x8f0(%rbp), %rdi movq %rax, %rdx movq -0x30(%rbp), %rcx leaq 0xe054(%rip), %rsi # 0x843bb movb $0x0, %al callq 0x19f90 movl $0x33, -0x20(%rbp) jmp 0x763a7 movq -0x40(%rbp), %rax movq %rax, -0x8f8(%rbp) movq -0x30(%rbp), %rdi callq 0x96b0 movq -0x8f8(%rbp), %rdi movq %rax, %rdx movq -0x30(%rbp), %rcx leaq 0xe043(%rip), %rsi # 0x843e3 movb $0x0, %al callq 0x19d00 jmp 0x763bb movq -0x40(%rbp), %rdi leaq 0xe06d(%rip), %rsi # 0x84421 movb $0x0, %al callq 0x19d00 jmp 0x763bd movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x76412 movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x76412 movq -0x10(%rbp), %rax testb $0x1, 0x352(%rax) jne 0x7641f jmp 0x76463 movq -0x10(%rbp), %rax testb $0x1, 0x30a(%rax) je 0x76463 movq -0x10(%rbp), %rdi movq -0x18(%rbp), %rsi callq 0x77670 movl %eax, -0x20(%rbp) cmpl $0x0, -0x20(%rbp) je 0x76461 movq -0x18(%rbp), %rax movq 0x10(%rax), %rax movq 0x10(%rax), %rdi callq 0xa388 movq -0x18(%rbp), %rax movq 0x10(%rax), %rax movq $0x0, 0x10(%rax) movl -0x20(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x76565 jmp 0x76463 testb $0x1, -0x19(%rbp) jne 0x76470 movl $0x0, -0x20(%rbp) movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x764ca movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x764ca movq -0x40(%rbp), %rax movq 0x8e8(%rax), %rax movq %rax, -0x900(%rbp) jmp 0x764dc movq -0x40(%rbp), %rax movq 0x8e0(%rax), %rax movq %rax, -0x900(%rbp) movq -0x900(%rbp), %rax movq %rax, -0x858(%rbp) cmpl $0x0, -0x20(%rbp) jne 0x76533 cmpq $0x0, -0x858(%rbp) je 0x76533 movq -0x40(%rbp), %rdi movq -0x18(%rbp), %rax movq 0x10(%rax), %rax movq 0x10(%rax), %rsi movq -0x858(%rbp), %rdx callq 0x77990 movl %eax, -0x20(%rbp) cmpl $0x0, -0x20(%rbp) je 0x76531 movq -0x40(%rbp), %rdi leaq 0xdf14(%rip), %rsi # 0x8443e movb $0x0, %al callq 0x19f90 jmp 0x76533 movq -0x18(%rbp), %rax movq 0x10(%rax), %rax movq 0x10(%rax), %rdi callq 0xa388 movq -0x18(%rbp), %rax movq 0x10(%rax), %rax movq $0x0, 0x10(%rax) movq -0x18(%rbp), %rax movl $0x5, 0x8(%rax) movl -0x20(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x900, %rsp # imm = 0x900 popq %rbp retq nopw %cs:(%rax,%rax)
/macressler[P]curl/lib/vtls/openssl.c
get_cert_chain
static CURLcode get_cert_chain(struct connectdata *conn, struct ssl_connect_data *connssl) { CURLcode result; STACK_OF(X509) *sk; int i; struct Curl_easy *data = conn->data; int numcerts; BIO *mem; sk = SSL_get_peer_cert_chain(BACKEND->handle); if(!sk) { return CURLE_OUT_OF_MEMORY; } numcerts = sk_X509_num(sk); result = Curl_ssl_init_certinfo(data, numcerts); if(result) { return result; } mem = BIO_new(BIO_s_mem()); for(i = 0; i < numcerts; i++) { ASN1_INTEGER *num; X509 *x = sk_X509_value(sk, i); EVP_PKEY *pubkey = NULL; int j; char *ptr; const ASN1_BIT_STRING *psig = NULL; X509_NAME_print_ex(mem, X509_get_subject_name(x), 0, XN_FLAG_ONELINE); push_certinfo("Subject", i); X509_NAME_print_ex(mem, X509_get_issuer_name(x), 0, XN_FLAG_ONELINE); push_certinfo("Issuer", i); BIO_printf(mem, "%lx", X509_get_version(x)); push_certinfo("Version", i); num = X509_get_serialNumber(x); if(num->type == V_ASN1_NEG_INTEGER) BIO_puts(mem, "-"); for(j = 0; j < num->length; j++) BIO_printf(mem, "%02x", num->data[j]); push_certinfo("Serial Number", i); #if defined(HAVE_X509_GET0_SIGNATURE) && defined(HAVE_X509_GET0_EXTENSIONS) { const X509_ALGOR *palg = NULL; ASN1_STRING *a = ASN1_STRING_new(); if(a) { X509_get0_signature(&psig, &palg, x); X509_signature_print(mem, palg, a); ASN1_STRING_free(a); if(palg) { i2a_ASN1_OBJECT(mem, palg->algorithm); push_certinfo("Public Key Algorithm", i); } } X509V3_ext(data, i, X509_get0_extensions(x)); } #else { /* before OpenSSL 1.0.2 */ X509_CINF *cinf = x->cert_info; i2a_ASN1_OBJECT(mem, cinf->signature->algorithm); push_certinfo("Signature Algorithm", i); i2a_ASN1_OBJECT(mem, cinf->key->algor->algorithm); push_certinfo("Public Key Algorithm", i); X509V3_ext(data, i, cinf->extensions); psig = x->signature; } #endif ASN1_TIME_print(mem, X509_get0_notBefore(x)); push_certinfo("Start date", i); ASN1_TIME_print(mem, X509_get0_notAfter(x)); push_certinfo("Expire date", i); pubkey = X509_get_pubkey(x); if(!pubkey) infof(data, " Unable to load public key\n"); else { int pktype; #ifdef HAVE_OPAQUE_EVP_PKEY pktype = EVP_PKEY_id(pubkey); #else pktype = pubkey->type; #endif switch(pktype) { case EVP_PKEY_RSA: { RSA *rsa; #ifdef HAVE_OPAQUE_EVP_PKEY rsa = EVP_PKEY_get0_RSA(pubkey); #else rsa = pubkey->pkey.rsa; #endif #ifdef HAVE_OPAQUE_RSA_DSA_DH { const BIGNUM *n; const BIGNUM *e; RSA_get0_key(rsa, &n, &e, NULL); BN_print(mem, n); push_certinfo("RSA Public Key", i); print_pubkey_BN(rsa, n, i); print_pubkey_BN(rsa, e, i); } #else BIO_printf(mem, "%d", BN_num_bits(rsa->n)); push_certinfo("RSA Public Key", i); print_pubkey_BN(rsa, n, i); print_pubkey_BN(rsa, e, i); #endif break; } case EVP_PKEY_DSA: { #ifndef OPENSSL_NO_DSA DSA *dsa; #ifdef HAVE_OPAQUE_EVP_PKEY dsa = EVP_PKEY_get0_DSA(pubkey); #else dsa = pubkey->pkey.dsa; #endif #ifdef HAVE_OPAQUE_RSA_DSA_DH { const BIGNUM *p; const BIGNUM *q; const BIGNUM *g; const BIGNUM *pub_key; DSA_get0_pqg(dsa, &p, &q, &g); DSA_get0_key(dsa, &pub_key, NULL); print_pubkey_BN(dsa, p, i); print_pubkey_BN(dsa, q, i); print_pubkey_BN(dsa, g, i); print_pubkey_BN(dsa, pub_key, i); } #else print_pubkey_BN(dsa, p, i); print_pubkey_BN(dsa, q, i); print_pubkey_BN(dsa, g, i); print_pubkey_BN(dsa, pub_key, i); #endif #endif /* !OPENSSL_NO_DSA */ break; } case EVP_PKEY_DH: { DH *dh; #ifdef HAVE_OPAQUE_EVP_PKEY dh = EVP_PKEY_get0_DH(pubkey); #else dh = pubkey->pkey.dh; #endif #ifdef HAVE_OPAQUE_RSA_DSA_DH { const BIGNUM *p; const BIGNUM *q; const BIGNUM *g; const BIGNUM *pub_key; DH_get0_pqg(dh, &p, &q, &g); DH_get0_key(dh, &pub_key, NULL); print_pubkey_BN(dh, p, i); print_pubkey_BN(dh, q, i); print_pubkey_BN(dh, g, i); print_pubkey_BN(dh, pub_key, i); } #else print_pubkey_BN(dh, p, i); print_pubkey_BN(dh, g, i); print_pubkey_BN(dh, pub_key, i); #endif break; } #if 0 case EVP_PKEY_EC: /* symbol not present in OpenSSL 0.9.6 */ /* left TODO */ break; #endif } EVP_PKEY_free(pubkey); } if(psig) { for(j = 0; j < psig->length; j++) BIO_printf(mem, "%02x:", psig->data[j]); push_certinfo("Signature", i); } PEM_write_bio_X509(mem, x); push_certinfo("Cert", i); } BIO_free(mem); return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0x190, %rsp # imm = 0x190 movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq -0x10(%rbp), %rax movq (%rax), %rax movq %rax, -0x38(%rbp) movq -0x18(%rbp), %rax movq 0x10(%rax), %rax movq 0x8(%rax), %rdi callq 0x9170 movq %rax, -0x28(%rbp) cmpq $0x0, -0x28(%rbp) jne 0x765c6 movl $0x1b, -0x4(%rbp) jmp 0x76f16 movq -0x28(%rbp), %rdi callq 0x75740 movq %rax, %rdi callq 0x94a0 movl %eax, -0x3c(%rbp) movq -0x38(%rbp), %rdi movl -0x3c(%rbp), %esi callq 0x79640 movl %eax, -0x1c(%rbp) cmpl $0x0, -0x1c(%rbp) je 0x765fa movl -0x1c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x76f16 callq 0x9850 movq %rax, %rdi callq 0xa050 movq %rax, -0x48(%rbp) movl $0x0, -0x2c(%rbp) movl -0x2c(%rbp), %eax cmpl -0x3c(%rbp), %eax jge 0x76f06 movq -0x28(%rbp), %rdi callq 0x75740 movq %rax, %rdi movl -0x2c(%rbp), %esi callq 0x9cc0 movq %rax, -0x58(%rbp) movq $0x0, -0x60(%rbp) movq $0x0, -0x78(%rbp) movq -0x48(%rbp), %rax movq %rax, -0x150(%rbp) movq -0x58(%rbp), %rdi callq 0x9a30 movq -0x150(%rbp), %rdi movq %rax, %rsi xorl %edx, %edx movl $0x82031f, %ecx # imm = 0x82031F callq 0x90c0 movq -0x48(%rbp), %rdi movl $0x3, %esi xorl %eax, %eax movl %eax, %edx leaq -0x70(%rbp), %rcx callq 0x9220 movq %rax, -0x80(%rbp) movq -0x38(%rbp), %rdi movl -0x2c(%rbp), %esi movq -0x70(%rbp), %rcx movq -0x80(%rbp), %r8 leaq 0xddd0(%rip), %rdx # 0x84470 callq 0x796c0 movq -0x48(%rbp), %rdi movl $0x1, %esi xorl %eax, %eax movl %eax, %ecx movq %rcx, %rdx callq 0x9220 movl %eax, %ecx movl $0x1, %eax cmpl %ecx, %eax je 0x766c7 jmp 0x766c9 jmp 0x766c9 movq -0x48(%rbp), %rax movq %rax, -0x158(%rbp) movq -0x58(%rbp), %rdi callq 0x99a0 movq -0x158(%rbp), %rdi movq %rax, %rsi xorl %edx, %edx movl $0x82031f, %ecx # imm = 0x82031F callq 0x90c0 movq -0x48(%rbp), %rdi movl $0x3, %esi xorl %eax, %eax movl %eax, %edx leaq -0x70(%rbp), %rcx callq 0x9220 movq %rax, -0x88(%rbp) movq -0x38(%rbp), %rdi movl -0x2c(%rbp), %esi movq -0x70(%rbp), %rcx movq -0x88(%rbp), %r8 leaq 0xdd4f(%rip), %rdx # 0x84478 callq 0x796c0 movq -0x48(%rbp), %rdi movl $0x1, %esi xorl %eax, %eax movl %eax, %ecx movq %rcx, %rdx callq 0x9220 movl %eax, %ecx movl $0x1, %eax cmpl %ecx, %eax je 0x76750 jmp 0x76752 jmp 0x76752 movq -0x48(%rbp), %rax movq %rax, -0x160(%rbp) movq -0x58(%rbp), %rdi callq 0x9c10 movq -0x160(%rbp), %rdi movq %rax, %rdx leaq 0x9ffb(%rip), %rsi # 0x80772 movb $0x0, %al callq 0xa370 movq -0x48(%rbp), %rdi movl $0x3, %esi xorl %eax, %eax movl %eax, %edx leaq -0x70(%rbp), %rcx callq 0x9220 movq %rax, -0x90(%rbp) movq -0x38(%rbp), %rdi movl -0x2c(%rbp), %esi movq -0x70(%rbp), %rcx movq -0x90(%rbp), %r8 leaq 0xb735(%rip), %rdx # 0x81ee9 callq 0x796c0 movq -0x48(%rbp), %rdi movl $0x1, %esi xorl %eax, %eax movl %eax, %ecx movq %rcx, %rdx callq 0x9220 movl %eax, %ecx movl $0x1, %eax cmpl %ecx, %eax je 0x767db jmp 0x767dd jmp 0x767dd movq -0x58(%rbp), %rdi callq 0x9e50 movq %rax, -0x50(%rbp) movq -0x50(%rbp), %rax cmpl $0x102, 0x4(%rax) # imm = 0x102 jne 0x76807 movq -0x48(%rbp), %rdi leaq 0xc6f2(%rip), %rsi # 0x82ef4 callq 0x9d30 movl $0x0, -0x64(%rbp) movl -0x64(%rbp), %eax movq -0x50(%rbp), %rcx cmpl (%rcx), %eax jge 0x76846 movq -0x48(%rbp), %rdi movq -0x50(%rbp), %rax movq 0x8(%rax), %rax movslq -0x64(%rbp), %rcx movzbl (%rax,%rcx), %edx leaq 0x8691(%rip), %rsi # 0x7eec5 movb $0x0, %al callq 0xa370 movl -0x64(%rbp), %eax addl $0x1, %eax movl %eax, -0x64(%rbp) jmp 0x7680e jmp 0x76848 movq -0x48(%rbp), %rdi movl $0x3, %esi xorl %eax, %eax movl %eax, %edx leaq -0x70(%rbp), %rcx callq 0x9220 movq %rax, -0x98(%rbp) movq -0x38(%rbp), %rdi movl -0x2c(%rbp), %esi movq -0x70(%rbp), %rcx movq -0x98(%rbp), %r8 leaq 0xdc01(%rip), %rdx # 0x8447f callq 0x796c0 movq -0x48(%rbp), %rdi movl $0x1, %esi xorl %eax, %eax movl %eax, %ecx movq %rcx, %rdx callq 0x9220 movl %eax, %ecx movl $0x1, %eax cmpl %ecx, %eax je 0x768a5 jmp 0x768a7 jmp 0x768a7 movq $0x0, -0xa0(%rbp) callq 0x9af0 movq %rax, -0xa8(%rbp) cmpq $0x0, -0xa8(%rbp) je 0x76983 movq -0x58(%rbp), %rdx leaq -0x78(%rbp), %rdi leaq -0xa0(%rbp), %rsi callq 0x9f50 movq -0x48(%rbp), %rdi movq -0xa0(%rbp), %rsi movq -0xa8(%rbp), %rdx callq 0x9960 movq -0xa8(%rbp), %rdi callq 0xa0e0 cmpq $0x0, -0xa0(%rbp) je 0x76981 movq -0x48(%rbp), %rdi movq -0xa0(%rbp), %rax movq (%rax), %rsi callq 0x9580 movq -0x48(%rbp), %rdi movl $0x3, %esi xorl %eax, %eax movl %eax, %edx leaq -0x70(%rbp), %rcx callq 0x9220 movq %rax, -0xb0(%rbp) movq -0x38(%rbp), %rdi movl -0x2c(%rbp), %esi movq -0x70(%rbp), %rcx movq -0xb0(%rbp), %r8 leaq 0xdb37(%rip), %rdx # 0x8448d callq 0x796c0 movq -0x48(%rbp), %rdi movl $0x1, %esi xorl %eax, %eax movl %eax, %ecx movq %rcx, %rdx callq 0x9220 movl %eax, %ecx movl $0x1, %eax cmpl %ecx, %eax je 0x7697d jmp 0x7697f jmp 0x7697f jmp 0x76981 jmp 0x76983 movq -0x38(%rbp), %rax movq %rax, -0x178(%rbp) movl -0x2c(%rbp), %eax movl %eax, -0x16c(%rbp) movq -0x58(%rbp), %rdi callq 0x9a40 movq -0x178(%rbp), %rdi movl -0x16c(%rbp), %esi movq %rax, %rdx callq 0x77ab0 movq -0x48(%rbp), %rax movq %rax, -0x168(%rbp) movq -0x58(%rbp), %rdi callq 0xa090 movq -0x168(%rbp), %rdi movq %rax, %rsi callq 0xa2f0 movq -0x48(%rbp), %rdi movl $0x3, %esi xorl %eax, %eax movl %eax, %edx leaq -0x70(%rbp), %rcx callq 0x9220 movq %rax, -0xb8(%rbp) movq -0x38(%rbp), %rdi movl -0x2c(%rbp), %esi movq -0x70(%rbp), %rcx movq -0xb8(%rbp), %r8 leaq 0xda94(%rip), %rdx # 0x844a2 callq 0x796c0 movq -0x48(%rbp), %rdi movl $0x1, %esi xorl %eax, %eax movl %eax, %ecx movq %rcx, %rdx callq 0x9220 movl %eax, %ecx movl $0x1, %eax cmpl %ecx, %eax je 0x76a35 jmp 0x76a37 jmp 0x76a37 movq -0x48(%rbp), %rax movq %rax, -0x180(%rbp) movq -0x58(%rbp), %rdi callq 0xa010 movq -0x180(%rbp), %rdi movq %rax, %rsi callq 0xa2f0 movq -0x48(%rbp), %rdi movl $0x3, %esi xorl %eax, %eax movl %eax, %edx leaq -0x70(%rbp), %rcx callq 0x9220 movq %rax, -0xc0(%rbp) movq -0x38(%rbp), %rdi movl -0x2c(%rbp), %esi movq -0x70(%rbp), %rcx movq -0xc0(%rbp), %r8 leaq 0xda1d(%rip), %rdx # 0x844ad callq 0x796c0 movq -0x48(%rbp), %rdi movl $0x1, %esi xorl %eax, %eax movl %eax, %ecx movq %rcx, %rdx callq 0x9220 movl %eax, %ecx movl $0x1, %eax cmpl %ecx, %eax je 0x76ab7 jmp 0x76ab9 jmp 0x76ab9 movq -0x58(%rbp), %rdi callq 0xa040 movq %rax, -0x60(%rbp) cmpq $0x0, -0x60(%rbp) jne 0x76ae4 movq -0x38(%rbp), %rdi leaq 0xd9e1(%rip), %rsi # 0x844b9 movb $0x0, %al callq 0x19d00 jmp 0x76ddd movq -0x60(%rbp), %rdi callq 0x97f0 movl %eax, -0xc4(%rbp) movl -0xc4(%rbp), %eax movl %eax, -0x184(%rbp) subl $0x6, %eax je 0x76b2b jmp 0x76b06 movl -0x184(%rbp), %eax subl $0x1c, %eax je 0x76cf8 jmp 0x76b17 movl -0x184(%rbp), %eax subl $0x74, %eax je 0x76c17 jmp 0x76dd4 movq -0x60(%rbp), %rdi callq 0x9350 movq %rax, -0xd0(%rbp) movq -0xd0(%rbp), %rdi leaq -0xd8(%rbp), %rsi leaq -0xe0(%rbp), %rdx xorl %eax, %eax movl %eax, %ecx callq 0x9ea0 movq -0x48(%rbp), %rdi movq -0xd8(%rbp), %rsi callq 0x96f0 movq -0x48(%rbp), %rdi movl $0x3, %esi xorl %eax, %eax movl %eax, %edx leaq -0x70(%rbp), %rcx callq 0x9220 movq %rax, -0xe8(%rbp) movq -0x38(%rbp), %rdi movl -0x2c(%rbp), %esi movq -0x70(%rbp), %rcx movq -0xe8(%rbp), %r8 leaq 0xd938(%rip), %rdx # 0x844d7 callq 0x796c0 movq -0x48(%rbp), %rdi movl $0x1, %esi xorl %eax, %eax movl %eax, %ecx movq %rcx, %rdx callq 0x9220 movl %eax, %ecx movl $0x1, %eax cmpl %ecx, %eax je 0x76bc6 jmp 0x76bc8 jmp 0x76bc8 movq -0x38(%rbp), %rdi movq -0x48(%rbp), %rsi movl -0x2c(%rbp), %edx movq -0xd8(%rbp), %r9 leaq 0xd905(%rip), %rcx # 0x844e6 leaq 0x9c23(%rip), %r8 # 0x8080b callq 0x77d50 movq -0x38(%rbp), %rdi movq -0x48(%rbp), %rsi movl -0x2c(%rbp), %edx movq -0xe0(%rbp), %r9 leaq 0xd8e0(%rip), %rcx # 0x844e6 leaq 0xd3f3(%rip), %r8 # 0x84000 callq 0x77d50 jmp 0x76dd4 movq -0x60(%rbp), %rdi callq 0x9cd0 movq %rax, -0xf0(%rbp) movq -0xf0(%rbp), %rdi leaq -0xf8(%rbp), %rsi leaq -0x100(%rbp), %rdx leaq -0x108(%rbp), %rcx callq 0xa340 movq -0xf0(%rbp), %rdi leaq -0x110(%rbp), %rsi xorl %eax, %eax movl %eax, %edx callq 0x9b70 movq -0x38(%rbp), %rdi movq -0x48(%rbp), %rsi movl -0x2c(%rbp), %edx movq -0xf8(%rbp), %r9 leaq 0xd872(%rip), %rcx # 0x844ea leaq 0x6ee4(%rip), %r8 # 0x7db63 callq 0x77d50 movq -0x38(%rbp), %rdi movq -0x48(%rbp), %rsi movl -0x2c(%rbp), %edx movq -0x100(%rbp), %r9 leaq 0xd84d(%rip), %rcx # 0x844ea leaq 0x985e(%rip), %r8 # 0x80502 callq 0x77d50 movq -0x38(%rbp), %rdi movq -0x48(%rbp), %rsi movl -0x2c(%rbp), %edx movq -0x108(%rbp), %r9 leaq 0xd828(%rip), %rcx # 0x844ea leaq 0xc0d9(%rip), %r8 # 0x82da2 callq 0x77d50 movq -0x38(%rbp), %rdi movq -0x48(%rbp), %rsi movl -0x2c(%rbp), %edx movq -0x110(%rbp), %r9 leaq 0xd803(%rip), %rcx # 0x844ea leaq 0xd800(%rip), %r8 # 0x844ee callq 0x77d50 jmp 0x76dd4 movq -0x60(%rbp), %rdi callq 0x9cb0 movq %rax, -0x118(%rbp) movq -0x118(%rbp), %rdi leaq -0x120(%rbp), %rsi leaq -0x128(%rbp), %rdx leaq -0x130(%rbp), %rcx callq 0x9f40 movq -0x118(%rbp), %rdi leaq -0x138(%rbp), %rsi xorl %eax, %eax movl %eax, %edx callq 0x9630 movq -0x38(%rbp), %rdi movq -0x48(%rbp), %rsi movl -0x2c(%rbp), %edx movq -0x120(%rbp), %r9 leaq 0x46ee(%rip), %rcx # 0x7b447 leaq 0x6e03(%rip), %r8 # 0x7db63 callq 0x77d50 movq -0x38(%rbp), %rdi movq -0x48(%rbp), %rsi movl -0x2c(%rbp), %edx movq -0x128(%rbp), %r9 leaq 0x46c9(%rip), %rcx # 0x7b447 leaq 0x977d(%rip), %r8 # 0x80502 callq 0x77d50 movq -0x38(%rbp), %rdi movq -0x48(%rbp), %rsi movl -0x2c(%rbp), %edx movq -0x130(%rbp), %r9 leaq 0x46a4(%rip), %rcx # 0x7b447 leaq 0xbff8(%rip), %r8 # 0x82da2 callq 0x77d50 movq -0x38(%rbp), %rdi movq -0x48(%rbp), %rsi movl -0x2c(%rbp), %edx movq -0x138(%rbp), %r9 leaq 0x467f(%rip), %rcx # 0x7b447 leaq 0xd71f(%rip), %r8 # 0x844ee callq 0x77d50 movq -0x60(%rbp), %rdi callq 0x95d0 cmpq $0x0, -0x78(%rbp) je 0x76e8a movl $0x0, -0x64(%rbp) movl -0x64(%rbp), %eax movq -0x78(%rbp), %rcx cmpl (%rcx), %eax jge 0x76e27 movq -0x48(%rbp), %rdi movq -0x78(%rbp), %rax movq 0x8(%rax), %rax movslq -0x64(%rbp), %rcx movzbl (%rax,%rcx), %edx leaq 0xd6e1(%rip), %rsi # 0x844f6 movb $0x0, %al callq 0xa370 movl -0x64(%rbp), %eax addl $0x1, %eax movl %eax, -0x64(%rbp) jmp 0x76def jmp 0x76e29 movq -0x48(%rbp), %rdi movl $0x3, %esi xorl %eax, %eax movl %eax, %edx leaq -0x70(%rbp), %rcx callq 0x9220 movq %rax, -0x140(%rbp) movq -0x38(%rbp), %rdi movl -0x2c(%rbp), %esi movq -0x70(%rbp), %rcx movq -0x140(%rbp), %r8 leaq 0xd69d(%rip), %rdx # 0x844fc callq 0x796c0 movq -0x48(%rbp), %rdi movl $0x1, %esi xorl %eax, %eax movl %eax, %ecx movq %rcx, %rdx callq 0x9220 movl %eax, %ecx movl $0x1, %eax cmpl %ecx, %eax je 0x76e86 jmp 0x76e88 jmp 0x76e88 jmp 0x76e8a movq -0x48(%rbp), %rdi movq -0x58(%rbp), %rsi callq 0x9c40 movq -0x48(%rbp), %rdi movl $0x3, %esi xorl %eax, %eax movl %eax, %edx leaq -0x70(%rbp), %rcx callq 0x9220 movq %rax, -0x148(%rbp) movq -0x38(%rbp), %rdi movl -0x2c(%rbp), %esi movq -0x70(%rbp), %rcx movq -0x148(%rbp), %r8 leaq 0xd639(%rip), %rdx # 0x84506 callq 0x796c0 movq -0x48(%rbp), %rdi movl $0x1, %esi xorl %eax, %eax movl %eax, %ecx movq %rcx, %rdx callq 0x9220 movl %eax, %ecx movl $0x1, %eax cmpl %ecx, %eax je 0x76ef4 jmp 0x76ef6 jmp 0x76ef6 jmp 0x76ef8 movl -0x2c(%rbp), %eax addl $0x1, %eax movl %eax, -0x2c(%rbp) jmp 0x76612 movq -0x48(%rbp), %rdi callq 0x9a00 movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x190, %rsp # imm = 0x190 popq %rbp retq nopw %cs:(%rax,%rax)
/macressler[P]curl/lib/vtls/openssl.c
x509_name_oneline
static int x509_name_oneline(X509_NAME *a, char *buf, size_t size) { #if 0 return X509_NAME_oneline(a, buf, size); #else BIO *bio_out = BIO_new(BIO_s_mem()); BUF_MEM *biomem; int rc; if(!bio_out) return 1; /* alloc failed! */ rc = X509_NAME_print_ex(bio_out, a, 0, XN_FLAG_SEP_SPLUS_SPC); BIO_get_mem_ptr(bio_out, &biomem); if((size_t)biomem->length < size) size = biomem->length; else size--; /* don't overwrite the buffer end */ memcpy(buf, biomem->data, size); buf[size] = 0; BIO_free(bio_out); return !rc; #endif }
pushq %rbp movq %rsp, %rbp subq $0x40, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq %rdx, -0x20(%rbp) callq 0x9850 movq %rax, %rdi callq 0xa050 movq %rax, -0x28(%rbp) cmpq $0x0, -0x28(%rbp) jne 0x76f68 movl $0x1, -0x4(%rbp) jmp 0x76ff6 movq -0x28(%rbp), %rdi movq -0x10(%rbp), %rsi xorl %edx, %edx movl $0x30000, %ecx # imm = 0x30000 callq 0x90c0 movl %eax, -0x34(%rbp) movq -0x28(%rbp), %rdi movl $0x73, %esi xorl %eax, %eax movl %eax, %edx leaq -0x30(%rbp), %rcx callq 0x9220 movq -0x30(%rbp), %rax movq (%rax), %rax cmpq -0x20(%rbp), %rax jae 0x76faf movq -0x30(%rbp), %rax movq (%rax), %rax movq %rax, -0x20(%rbp) jmp 0x76fbb movq -0x20(%rbp), %rax addq $-0x1, %rax movq %rax, -0x20(%rbp) movq -0x18(%rbp), %rdi movq -0x30(%rbp), %rax movq 0x8(%rax), %rsi movq -0x20(%rbp), %rdx callq 0x97b0 movq -0x18(%rbp), %rax movq -0x20(%rbp), %rcx movb $0x0, (%rax,%rcx) movq -0x28(%rbp), %rdi callq 0x9a00 cmpl $0x0, -0x34(%rbp) setne %al xorb $-0x1, %al andb $0x1, %al movzbl %al, %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x40, %rsp popq %rbp retq nop
/macressler[P]curl/lib/vtls/openssl.c
verifyhost
static CURLcode verifyhost(struct connectdata *conn, X509 *server_cert) { bool matched = FALSE; int target = GEN_DNS; /* target type, GEN_DNS or GEN_IPADD */ size_t addrlen = 0; struct Curl_easy *data = conn->data; STACK_OF(GENERAL_NAME) *altnames; #ifdef ENABLE_IPV6 struct in6_addr addr; #else struct in_addr addr; #endif CURLcode result = CURLE_OK; bool dNSName = FALSE; /* if a dNSName field exists in the cert */ bool iPAddress = FALSE; /* if a iPAddress field exists in the cert */ const char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name : conn->host.name; const char * const dispname = SSL_IS_PROXY() ? conn->http_proxy.host.dispname : conn->host.dispname; #ifdef ENABLE_IPV6 if(conn->bits.ipv6_ip && Curl_inet_pton(AF_INET6, hostname, &addr)) { target = GEN_IPADD; addrlen = sizeof(struct in6_addr); } else #endif if(Curl_inet_pton(AF_INET, hostname, &addr)) { target = GEN_IPADD; addrlen = sizeof(struct in_addr); } /* get a "list" of alternative names */ altnames = X509_get_ext_d2i(server_cert, NID_subject_alt_name, NULL, NULL); if(altnames) { int numalts; int i; bool dnsmatched = FALSE; bool ipmatched = FALSE; /* get amount of alternatives, RFC2459 claims there MUST be at least one, but we don't depend on it... */ numalts = sk_GENERAL_NAME_num(altnames); /* loop through all alternatives - until a dnsmatch */ for(i = 0; (i < numalts) && !dnsmatched; i++) { /* get a handle to alternative name number i */ const GENERAL_NAME *check = sk_GENERAL_NAME_value(altnames, i); if(check->type == GEN_DNS) dNSName = TRUE; else if(check->type == GEN_IPADD) iPAddress = TRUE; /* only check alternatives of the same type the target is */ if(check->type == target) { /* get data and length */ const char *altptr = (char *)ASN1_STRING_get0_data(check->d.ia5); size_t altlen = (size_t) ASN1_STRING_length(check->d.ia5); switch(target) { case GEN_DNS: /* name/pattern comparison */ /* The OpenSSL man page explicitly says: "In general it cannot be assumed that the data returned by ASN1_STRING_data() is null terminated or does not contain embedded nulls." But also that "The actual format of the data will depend on the actual string type itself: for example for and IA5String the data will be ASCII" Gisle researched the OpenSSL sources: "I checked the 0.9.6 and 0.9.8 sources before my patch and it always 0-terminates an IA5String." */ if((altlen == strlen(altptr)) && /* if this isn't true, there was an embedded zero in the name string and we cannot match it. */ Curl_cert_hostcheck(altptr, hostname)) { dnsmatched = TRUE; infof(data, " subjectAltName: host \"%s\" matched cert's \"%s\"\n", dispname, altptr); } break; case GEN_IPADD: /* IP address comparison */ /* compare alternative IP address if the data chunk is the same size our server IP address is */ if((altlen == addrlen) && !memcmp(altptr, &addr, altlen)) { ipmatched = TRUE; infof(data, " subjectAltName: host \"%s\" matched cert's IP address!\n", dispname); } break; } } } GENERAL_NAMES_free(altnames); if(dnsmatched || ipmatched) matched = TRUE; } if(matched) /* an alternative name matched */ ; else if(dNSName || iPAddress) { infof(data, " subjectAltName does not match %s\n", dispname); failf(data, "SSL: no alternative certificate subject name matches " "target host name '%s'", dispname); result = CURLE_PEER_FAILED_VERIFICATION; } else { /* we have to look to the last occurrence of a commonName in the distinguished one to get the most significant one. */ int j, i = -1; /* The following is done because of a bug in 0.9.6b */ unsigned char *nulstr = (unsigned char *)""; unsigned char *peer_CN = nulstr; X509_NAME *name = X509_get_subject_name(server_cert); if(name) while((j = X509_NAME_get_index_by_NID(name, NID_commonName, i)) >= 0) i = j; /* we have the name entry and we will now convert this to a string that we can use for comparison. Doing this we support BMPstring, UTF8 etc. */ if(i >= 0) { ASN1_STRING *tmp = X509_NAME_ENTRY_get_data(X509_NAME_get_entry(name, i)); /* In OpenSSL 0.9.7d and earlier, ASN1_STRING_to_UTF8 fails if the input is already UTF-8 encoded. We check for this case and copy the raw string manually to avoid the problem. This code can be made conditional in the future when OpenSSL has been fixed. Work-around brought by Alexis S. L. Carvalho. */ if(tmp) { if(ASN1_STRING_type(tmp) == V_ASN1_UTF8STRING) { j = ASN1_STRING_length(tmp); if(j >= 0) { peer_CN = OPENSSL_malloc(j + 1); if(peer_CN) { memcpy(peer_CN, ASN1_STRING_get0_data(tmp), j); peer_CN[j] = '\0'; } } } else /* not a UTF8 name */ j = ASN1_STRING_to_UTF8(&peer_CN, tmp); if(peer_CN && (curlx_uztosi(strlen((char *)peer_CN)) != j)) { /* there was a terminating zero before the end of string, this cannot match and we return failure! */ failf(data, "SSL: illegal cert name field"); result = CURLE_PEER_FAILED_VERIFICATION; } } } if(peer_CN == nulstr) peer_CN = NULL; else { /* convert peer_CN from UTF8 */ CURLcode rc = Curl_convert_from_utf8(data, (char *)peer_CN, strlen((char *)peer_CN)); /* Curl_convert_from_utf8 calls failf if unsuccessful */ if(rc) { OPENSSL_free(peer_CN); return rc; } } if(result) /* error already detected, pass through */ ; else if(!peer_CN) { failf(data, "SSL: unable to obtain common name from peer certificate"); result = CURLE_PEER_FAILED_VERIFICATION; } else if(!Curl_cert_hostcheck((const char *)peer_CN, hostname)) { failf(data, "SSL: certificate subject name '%s' does not match " "target host name '%s'", peer_CN, dispname); result = CURLE_PEER_FAILED_VERIFICATION; } else { infof(data, " common name: %s (matched)\n", peer_CN); } if(peer_CN) OPENSSL_free(peer_CN); } return result; }
pushq %rbp movq %rsp, %rbp subq $0xe0, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movb $0x0, -0x19(%rbp) movl $0x2, -0x20(%rbp) movq $0x0, -0x28(%rbp) movq -0x10(%rbp), %rax movq (%rax), %rax movq %rax, -0x30(%rbp) movl $0x0, -0x4c(%rbp) movb $0x0, -0x4d(%rbp) movb $0x0, -0x4e(%rbp) movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x7709a movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x7709a movq -0x10(%rbp), %rax movq 0x160(%rax), %rax movq %rax, -0xc0(%rbp) jmp 0x770ac movq -0x10(%rbp), %rax movq 0xd8(%rax), %rax movq %rax, -0xc0(%rbp) movq -0xc0(%rbp), %rax movq %rax, -0x58(%rbp) movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x77111 movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x77111 movq -0x10(%rbp), %rax movq 0x168(%rax), %rax movq %rax, -0xc8(%rbp) jmp 0x77123 movq -0x10(%rbp), %rax movq 0xe0(%rax), %rax movq %rax, -0xc8(%rbp) movq -0xc8(%rbp), %rax movq %rax, -0x60(%rbp) movq -0x10(%rbp), %rax testb $0x1, 0x392(%rax) je 0x77163 movq -0x58(%rbp), %rsi movl $0xa, %edi leaq -0x48(%rbp), %rdx callq 0xa260 cmpl $0x0, %eax je 0x77163 movl $0x7, -0x20(%rbp) movq $0x10, -0x28(%rbp) jmp 0x7718b movq -0x58(%rbp), %rsi movl $0x2, %edi leaq -0x48(%rbp), %rdx callq 0xa260 cmpl $0x0, %eax je 0x77189 movl $0x7, -0x20(%rbp) movq $0x4, -0x28(%rbp) jmp 0x7718b movq -0x18(%rbp), %rdi movl $0x55, %esi xorl %eax, %eax movl %eax, %ecx movq %rcx, %rdx callq 0x9c50 movq %rax, -0x38(%rbp) cmpq $0x0, -0x38(%rbp) je 0x7734f movb $0x0, -0x69(%rbp) movb $0x0, -0x6a(%rbp) movq -0x38(%rbp), %rdi callq 0x77e70 movq %rax, %rdi callq 0x94a0 movl %eax, -0x64(%rbp) movl $0x0, -0x68(%rbp) movl -0x68(%rbp), %ecx xorl %eax, %eax cmpl -0x64(%rbp), %ecx movb %al, -0xc9(%rbp) jge 0x771ed movb -0x69(%rbp), %al xorb $-0x1, %al movb %al, -0xc9(%rbp) movb -0xc9(%rbp), %al testb $0x1, %al jne 0x771fc jmp 0x77334 movq -0x38(%rbp), %rdi callq 0x77e70 movq %rax, %rdi movl -0x68(%rbp), %esi callq 0x9cc0 movq %rax, -0x78(%rbp) movq -0x78(%rbp), %rax cmpl $0x2, (%rax) jne 0x77223 movb $0x1, -0x4d(%rbp) jmp 0x77232 movq -0x78(%rbp), %rax cmpl $0x7, (%rax) jne 0x77230 movb $0x1, -0x4e(%rbp) jmp 0x77232 movq -0x78(%rbp), %rax movl (%rax), %eax cmpl -0x20(%rbp), %eax jne 0x77324 movq -0x78(%rbp), %rax movq 0x8(%rax), %rdi callq 0xa1b0 movq %rax, -0x80(%rbp) movq -0x78(%rbp), %rax movq 0x8(%rax), %rdi callq 0xa1f0 cltq movq %rax, -0x88(%rbp) movl -0x20(%rbp), %eax movl %eax, -0xd0(%rbp) subl $0x2, %eax je 0x77288 jmp 0x77278 movl -0xd0(%rbp), %eax subl $0x7, %eax je 0x772e0 jmp 0x77322 movq -0x88(%rbp), %rax movq %rax, -0xd8(%rbp) movq -0x80(%rbp), %rdi callq 0x93b0 movq %rax, %rcx movq -0xd8(%rbp), %rax cmpq %rcx, %rax jne 0x772de movq -0x80(%rbp), %rdi movq -0x58(%rbp), %rsi callq 0x5bca0 cmpl $0x0, %eax je 0x772de movb $0x1, -0x69(%rbp) movq -0x30(%rbp), %rdi movq -0x60(%rbp), %rdx movq -0x80(%rbp), %rcx leaq 0xd23b(%rip), %rsi # 0x84512 movb $0x0, %al callq 0x19d00 jmp 0x77322 movq -0x88(%rbp), %rax cmpq -0x28(%rbp), %rax jne 0x77320 movq -0x80(%rbp), %rdi movq -0x88(%rbp), %rdx leaq -0x48(%rbp), %rsi callq 0x93d0 cmpl $0x0, %eax jne 0x77320 movb $0x1, -0x6a(%rbp) movq -0x30(%rbp), %rdi movq -0x60(%rbp), %rdx leaq 0xd229(%rip), %rsi # 0x84542 movb $0x0, %al callq 0x19d00 jmp 0x77322 jmp 0x77324 jmp 0x77326 movl -0x68(%rbp), %eax addl $0x1, %eax movl %eax, -0x68(%rbp) jmp 0x771d2 movq -0x38(%rbp), %rdi callq 0x96a0 testb $0x1, -0x69(%rbp) jne 0x77349 testb $0x1, -0x6a(%rbp) je 0x7734d movb $0x1, -0x19(%rbp) jmp 0x7734f testb $0x1, -0x19(%rbp) je 0x7735a jmp 0x77651 testb $0x1, -0x4d(%rbp) jne 0x77366 testb $0x1, -0x4e(%rbp) je 0x7739e movq -0x30(%rbp), %rdi movq -0x60(%rbp), %rdx leaq 0xd204(%rip), %rsi # 0x84579 movb $0x0, %al callq 0x19d00 movq -0x30(%rbp), %rdi movq -0x60(%rbp), %rdx leaq 0xd211(%rip), %rsi # 0x8459c movb $0x0, %al callq 0x19f90 movl $0x33, -0x4c(%rbp) jmp 0x7764f movl $0xffffffff, -0x90(%rbp) # imm = 0xFFFFFFFF leaq 0xc0fd(%rip), %rax # 0x834ac movq %rax, -0x98(%rbp) movq -0x98(%rbp), %rax movq %rax, -0xa0(%rbp) movq -0x18(%rbp), %rdi callq 0x9a30 movq %rax, -0xa8(%rbp) cmpq $0x0, -0xa8(%rbp) je 0x77412 jmp 0x773e0 movq -0xa8(%rbp), %rdi movl -0x90(%rbp), %edx movl $0xd, %esi callq 0x9ca0 movl %eax, -0x8c(%rbp) cmpl $0x0, %eax jl 0x77410 movl -0x8c(%rbp), %eax movl %eax, -0x90(%rbp) jmp 0x773e0 jmp 0x77412 cmpl $0x0, -0x90(%rbp) jl 0x7754e movq -0xa8(%rbp), %rdi movl -0x90(%rbp), %esi callq 0x9bb0 movq %rax, %rdi callq 0xa350 movq %rax, -0xb0(%rbp) cmpq $0x0, -0xb0(%rbp) je 0x7754c movq -0xb0(%rbp), %rdi callq 0x90a0 cmpl $0xc, %eax jne 0x774f2 movq -0xb0(%rbp), %rdi callq 0xa1f0 movl %eax, -0x8c(%rbp) cmpl $0x0, -0x8c(%rbp) jl 0x774f0 movl -0x8c(%rbp), %eax addl $0x1, %eax movslq %eax, %rdi leaq 0xd156(%rip), %rsi # 0x845e7 movl $0x5c9, %edx # imm = 0x5C9 callq 0xa1e0 movq %rax, -0xa0(%rbp) cmpq $0x0, -0xa0(%rbp) je 0x774ee movq -0xa0(%rbp), %rax movq %rax, -0xe0(%rbp) movq -0xb0(%rbp), %rdi callq 0xa1b0 movq -0xe0(%rbp), %rdi movq %rax, %rsi movslq -0x8c(%rbp), %rdx callq 0x97b0 movq -0xa0(%rbp), %rax movslq -0x8c(%rbp), %rcx movb $0x0, (%rax,%rcx) jmp 0x774f0 jmp 0x7750b movq -0xb0(%rbp), %rsi leaq -0xa0(%rbp), %rdi callq 0x9930 movl %eax, -0x8c(%rbp) cmpq $0x0, -0xa0(%rbp) je 0x7754a movq -0xa0(%rbp), %rdi callq 0x93b0 movq %rax, %rdi callq 0x57290 cmpl -0x8c(%rbp), %eax je 0x7754a movq -0x30(%rbp), %rdi leaq 0xd107(%rip), %rsi # 0x84643 movb $0x0, %al callq 0x19f90 movl $0x33, -0x4c(%rbp) jmp 0x7754c jmp 0x7754e movq -0xa0(%rbp), %rax cmpq -0x98(%rbp), %rax jne 0x7756b movq $0x0, -0xa0(%rbp) jmp 0x775a6 movl $0x0, -0xb4(%rbp) cmpl $0x0, -0xb4(%rbp) je 0x775a4 movq -0xa0(%rbp), %rdi leaq 0xd05b(%rip), %rsi # 0x845e7 movl $0x5e4, %edx # imm = 0x5E4 callq 0x9640 movl -0xb4(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x77657 jmp 0x775a6 cmpl $0x0, -0x4c(%rbp) je 0x775ae jmp 0x7762b cmpq $0x0, -0xa0(%rbp) jne 0x775d3 movq -0x30(%rbp), %rdi leaq 0xd09d(%rip), %rsi # 0x84660 movb $0x0, %al callq 0x19f90 movl $0x33, -0x4c(%rbp) jmp 0x77629 movq -0xa0(%rbp), %rdi movq -0x58(%rbp), %rsi callq 0x5bca0 cmpl $0x0, %eax jne 0x7760e movq -0x30(%rbp), %rdi movq -0xa0(%rbp), %rdx movq -0x60(%rbp), %rcx leaq 0xd09a(%rip), %rsi # 0x84698 movb $0x0, %al callq 0x19f90 movl $0x33, -0x4c(%rbp) jmp 0x77627 movq -0x30(%rbp), %rdi movq -0xa0(%rbp), %rdx leaq 0xd0c0(%rip), %rsi # 0x846e0 movb $0x0, %al callq 0x19d00 jmp 0x77629 jmp 0x7762b cmpq $0x0, -0xa0(%rbp) je 0x7764d movq -0xa0(%rbp), %rdi leaq 0xcfa4(%rip), %rsi # 0x845e7 movl $0x5fa, %edx # imm = 0x5FA callq 0x9640 jmp 0x7764f jmp 0x77651 movl -0x4c(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0xe0, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/macressler[P]curl/lib/vtls/openssl.c
verifystatus
static CURLcode verifystatus(struct connectdata *conn, struct ssl_connect_data *connssl) { int i, ocsp_status; const unsigned char *p; CURLcode result = CURLE_OK; struct Curl_easy *data = conn->data; OCSP_RESPONSE *rsp = NULL; OCSP_BASICRESP *br = NULL; X509_STORE *st = NULL; STACK_OF(X509) *ch = NULL; long len = SSL_get_tlsext_status_ocsp_resp(BACKEND->handle, &p); if(!p) { failf(data, "No OCSP response received"); result = CURLE_SSL_INVALIDCERTSTATUS; goto end; } rsp = d2i_OCSP_RESPONSE(NULL, &p, len); if(!rsp) { failf(data, "Invalid OCSP response"); result = CURLE_SSL_INVALIDCERTSTATUS; goto end; } ocsp_status = OCSP_response_status(rsp); if(ocsp_status != OCSP_RESPONSE_STATUS_SUCCESSFUL) { failf(data, "Invalid OCSP response status: %s (%d)", OCSP_response_status_str(ocsp_status), ocsp_status); result = CURLE_SSL_INVALIDCERTSTATUS; goto end; } br = OCSP_response_get1_basic(rsp); if(!br) { failf(data, "Invalid OCSP response"); result = CURLE_SSL_INVALIDCERTSTATUS; goto end; } ch = SSL_get_peer_cert_chain(BACKEND->handle); st = SSL_CTX_get_cert_store(BACKEND->ctx); #if ((OPENSSL_VERSION_NUMBER <= 0x1000201fL) /* Fixed after 1.0.2a */ || \ (defined(LIBRESSL_VERSION_NUMBER) && \ LIBRESSL_VERSION_NUMBER <= 0x2040200fL)) /* The authorized responder cert in the OCSP response MUST be signed by the peer cert's issuer (see RFC6960 section 4.2.2.2). If that's a root cert, no problem, but if it's an intermediate cert OpenSSL has a bug where it expects this issuer to be present in the chain embedded in the OCSP response. So we add it if necessary. */ /* First make sure the peer cert chain includes both a peer and an issuer, and the OCSP response contains a responder cert. */ if(sk_X509_num(ch) >= 2 && sk_X509_num(br->certs) >= 1) { X509 *responder = sk_X509_value(br->certs, sk_X509_num(br->certs) - 1); /* Find issuer of responder cert and add it to the OCSP response chain */ for(i = 0; i < sk_X509_num(ch); i++) { X509 *issuer = sk_X509_value(ch, i); if(X509_check_issued(issuer, responder) == X509_V_OK) { if(!OCSP_basic_add1_cert(br, issuer)) { failf(data, "Could not add issuer cert to OCSP response"); result = CURLE_SSL_INVALIDCERTSTATUS; goto end; } } } } #endif if(OCSP_basic_verify(br, ch, st, 0) <= 0) { failf(data, "OCSP response verification failed"); result = CURLE_SSL_INVALIDCERTSTATUS; goto end; } for(i = 0; i < OCSP_resp_count(br); i++) { int cert_status, crl_reason; OCSP_SINGLERESP *single = NULL; ASN1_GENERALIZEDTIME *rev, *thisupd, *nextupd; single = OCSP_resp_get0(br, i); if(!single) continue; cert_status = OCSP_single_get0_status(single, &crl_reason, &rev, &thisupd, &nextupd); if(!OCSP_check_validity(thisupd, nextupd, 300L, -1L)) { failf(data, "OCSP response has expired"); result = CURLE_SSL_INVALIDCERTSTATUS; goto end; } infof(data, "SSL certificate status: %s (%d)\n", OCSP_cert_status_str(cert_status), cert_status); switch(cert_status) { case V_OCSP_CERTSTATUS_GOOD: break; case V_OCSP_CERTSTATUS_REVOKED: result = CURLE_SSL_INVALIDCERTSTATUS; failf(data, "SSL certificate revocation reason: %s (%d)", OCSP_crl_reason_str(crl_reason), crl_reason); goto end; case V_OCSP_CERTSTATUS_UNKNOWN: result = CURLE_SSL_INVALIDCERTSTATUS; goto end; } } end: if(br) OCSP_BASICRESP_free(br); OCSP_RESPONSE_free(rsp); return result; }
pushq %rbp movq %rsp, %rbp subq $0xa0, %rsp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movl $0x0, -0x24(%rbp) movq -0x8(%rbp), %rax movq (%rax), %rax movq %rax, -0x30(%rbp) movq $0x0, -0x38(%rbp) movq $0x0, -0x40(%rbp) movq $0x0, -0x48(%rbp) movq $0x0, -0x50(%rbp) movq -0x10(%rbp), %rax movq 0x10(%rax), %rax movq 0x8(%rax), %rdi movl $0x46, %esi xorl %eax, %eax movl %eax, %edx leaq -0x20(%rbp), %rcx callq 0x9340 movq %rax, -0x58(%rbp) cmpq $0x0, -0x20(%rbp) jne 0x776fc movq -0x30(%rbp), %rdi leaq 0xd013(%rip), %rsi # 0x846fc movb $0x0, %al callq 0x19f90 movl $0x5b, -0x24(%rbp) jmp 0x77968 movq -0x58(%rbp), %rdx xorl %eax, %eax movl %eax, %edi leaq -0x20(%rbp), %rsi callq 0x9b00 movq %rax, -0x38(%rbp) cmpq $0x0, -0x38(%rbp) jne 0x77736 movq -0x30(%rbp), %rdi leaq 0xcff3(%rip), %rsi # 0x84716 movb $0x0, %al callq 0x19f90 movl $0x5b, -0x24(%rbp) jmp 0x77968 movq -0x38(%rbp), %rdi callq 0x9680 movl %eax, -0x18(%rbp) cmpl $0x0, -0x18(%rbp) je 0x77783 movq -0x30(%rbp), %rax movq %rax, -0x88(%rbp) movslq -0x18(%rbp), %rdi callq 0xa1a0 movq -0x88(%rbp), %rdi movq %rax, %rdx movl -0x18(%rbp), %ecx leaq 0xcfbc(%rip), %rsi # 0x8472c movb $0x0, %al callq 0x19f90 movl $0x5b, -0x24(%rbp) jmp 0x77968 movq -0x38(%rbp), %rdi callq 0x92c0 movq %rax, -0x40(%rbp) cmpq $0x0, -0x40(%rbp) jne 0x777b5 movq -0x30(%rbp), %rdi leaq 0xcf74(%rip), %rsi # 0x84716 movb $0x0, %al callq 0x19f90 movl $0x5b, -0x24(%rbp) jmp 0x77968 movq -0x10(%rbp), %rax movq 0x10(%rax), %rax movq 0x8(%rax), %rdi callq 0x9170 movq %rax, -0x50(%rbp) movq -0x10(%rbp), %rax movq 0x10(%rax), %rax movq (%rax), %rdi callq 0xa200 movq %rax, -0x48(%rbp) movq -0x40(%rbp), %rdi movq -0x50(%rbp), %rsi movq -0x48(%rbp), %rdx xorl %eax, %eax movl %eax, %ecx callq 0x9840 cmpl $0x0, %eax jg 0x77816 movq -0x30(%rbp), %rdi leaq 0xcf4f(%rip), %rsi # 0x84752 movb $0x0, %al callq 0x19f90 movl $0x5b, -0x24(%rbp) jmp 0x77968 movl $0x0, -0x14(%rbp) movl -0x14(%rbp), %eax movl %eax, -0x8c(%rbp) movq -0x40(%rbp), %rdi callq 0x9e80 movl %eax, %ecx movl -0x8c(%rbp), %eax cmpl %ecx, %eax jge 0x77966 movq $0x0, -0x68(%rbp) movq -0x40(%rbp), %rdi movl -0x14(%rbp), %esi callq 0x9d20 movq %rax, -0x68(%rbp) cmpq $0x0, -0x68(%rbp) jne 0x77863 jmp 0x77958 movq -0x68(%rbp), %rdi leaq -0x60(%rbp), %rsi leaq -0x70(%rbp), %rdx leaq -0x78(%rbp), %rcx leaq -0x80(%rbp), %r8 callq 0x9390 movl %eax, -0x5c(%rbp) movq -0x78(%rbp), %rdi movq -0x80(%rbp), %rsi movl $0x12c, %edx # imm = 0x12C movq $-0x1, %rcx callq 0xa210 cmpl $0x0, %eax jne 0x778bb movq -0x30(%rbp), %rdi leaq 0xcecc(%rip), %rsi # 0x84774 movb $0x0, %al callq 0x19f90 movl $0x5b, -0x24(%rbp) jmp 0x77968 movq -0x30(%rbp), %rax movq %rax, -0x98(%rbp) movslq -0x5c(%rbp), %rdi callq 0x9370 movq -0x98(%rbp), %rdi movq %rax, %rdx movl -0x5c(%rbp), %ecx leaq 0xceab(%rip), %rsi # 0x8478e xorl %eax, %eax callq 0x19d00 movl -0x5c(%rbp), %eax movl %eax, -0x90(%rbp) testl %eax, %eax je 0x77913 jmp 0x778f9 movl -0x90(%rbp), %eax subl $0x1, %eax je 0x77915 jmp 0x77906 movl -0x90(%rbp), %eax subl $0x2, %eax je 0x7794d jmp 0x77956 jmp 0x77956 movl $0x5b, -0x24(%rbp) movq -0x30(%rbp), %rax movq %rax, -0xa0(%rbp) movslq -0x60(%rbp), %rdi callq 0x9710 movq -0xa0(%rbp), %rdi movq %rax, %rdx movl -0x60(%rbp), %ecx leaq 0xce6b(%rip), %rsi # 0x847af movb $0x0, %al callq 0x19f90 jmp 0x77968 movl $0x5b, -0x24(%rbp) jmp 0x77968 jmp 0x77958 movl -0x14(%rbp), %eax addl $0x1, %eax movl %eax, -0x14(%rbp) jmp 0x7781d jmp 0x77968 cmpq $0x0, -0x40(%rbp) je 0x77978 movq -0x40(%rbp), %rdi callq 0x91e0 movq -0x38(%rbp), %rdi callq 0x9e10 movl -0x24(%rbp), %eax addq $0xa0, %rsp popq %rbp retq nopl (%rax)
/macressler[P]curl/lib/vtls/openssl.c
pkp_pin_peer_pubkey
static CURLcode pkp_pin_peer_pubkey(struct Curl_easy *data, X509* cert, const char *pinnedpubkey) { /* Scratch */ int len1 = 0, len2 = 0; unsigned char *buff1 = NULL, *temp = NULL; /* Result is returned to caller */ CURLcode result = CURLE_SSL_PINNEDPUBKEYNOTMATCH; /* if a path wasn't specified, don't pin */ if(!pinnedpubkey) return CURLE_OK; if(!cert) return result; do { /* Begin Gyrations to get the subjectPublicKeyInfo */ /* Thanks to Viktor Dukhovni on the OpenSSL mailing list */ /* https://groups.google.com/group/mailing.openssl.users/browse_thread /thread/d61858dae102c6c7 */ len1 = i2d_X509_PUBKEY(X509_get_X509_PUBKEY(cert), NULL); if(len1 < 1) break; /* failed */ /* https://www.openssl.org/docs/crypto/buffer.html */ buff1 = temp = malloc(len1); if(!buff1) break; /* failed */ /* https://www.openssl.org/docs/crypto/d2i_X509.html */ len2 = i2d_X509_PUBKEY(X509_get_X509_PUBKEY(cert), &temp); /* * These checks are verifying we got back the same values as when we * sized the buffer. It's pretty weak since they should always be the * same. But it gives us something to test. */ if((len1 != len2) || !temp || ((temp - buff1) != len1)) break; /* failed */ /* End Gyrations */ /* The one good exit point */ result = Curl_pin_peer_pubkey(data, pinnedpubkey, buff1, len1); } while(0); /* https://www.openssl.org/docs/crypto/buffer.html */ if(buff1) free(buff1); return result; }
pushq %rbp movq %rsp, %rbp subq $0x40, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq %rdx, -0x20(%rbp) movl $0x0, -0x24(%rbp) movl $0x0, -0x28(%rbp) movq $0x0, -0x30(%rbp) movq $0x0, -0x38(%rbp) movl $0x5a, -0x3c(%rbp) cmpq $0x0, -0x20(%rbp) jne 0x779dc movl $0x0, -0x4(%rbp) jmp 0x77aa3 cmpq $0x0, -0x18(%rbp) jne 0x779ee movl -0x3c(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x77aa3 jmp 0x779f0 movq -0x18(%rbp), %rdi callq 0x9d50 movq %rax, %rdi xorl %eax, %eax movl %eax, %esi callq 0x91c0 movl %eax, -0x24(%rbp) cmpl $0x1, -0x24(%rbp) jge 0x77a10 jmp 0x77a86 leaq 0x1c031(%rip), %rax # 0x93a48 movq (%rax), %rax movslq -0x24(%rbp), %rdi callq *%rax movq %rax, -0x38(%rbp) movq %rax, -0x30(%rbp) cmpq $0x0, -0x30(%rbp) jne 0x77a31 jmp 0x77a86 movq -0x18(%rbp), %rdi callq 0x9d50 movq %rax, %rdi leaq -0x38(%rbp), %rsi callq 0x91c0 movl %eax, -0x28(%rbp) movl -0x24(%rbp), %eax cmpl -0x28(%rbp), %eax jne 0x77a6c cmpq $0x0, -0x38(%rbp) je 0x77a6c movq -0x38(%rbp), %rax movq -0x30(%rbp), %rcx subq %rcx, %rax movslq -0x24(%rbp), %rcx cmpq %rcx, %rax je 0x77a6e jmp 0x77a86 movq -0x10(%rbp), %rdi movq -0x20(%rbp), %rsi movq -0x30(%rbp), %rdx movslq -0x24(%rbp), %rcx callq 0x79890 movl %eax, -0x3c(%rbp) cmpq $0x0, -0x30(%rbp) je 0x77a9d leaq 0x1bfbc(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x30(%rbp), %rdi callq *%rax movl -0x3c(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x40, %rsp popq %rbp retq nopl (%rax)
/macressler[P]curl/lib/vtls/openssl.c
X509V3_ext
static int X509V3_ext(struct Curl_easy *data, int certnum, CONST_EXTS STACK_OF(X509_EXTENSION) *exts) { int i; size_t j; if((int)sk_X509_EXTENSION_num(exts) <= 0) /* no extensions, bail out */ return 1; for(i = 0; i < (int)sk_X509_EXTENSION_num(exts); i++) { ASN1_OBJECT *obj; X509_EXTENSION *ext = sk_X509_EXTENSION_value(exts, i); BUF_MEM *biomem; char buf[512]; char *ptr = buf; char namebuf[128]; BIO *bio_out = BIO_new(BIO_s_mem()); if(!bio_out) return 1; obj = X509_EXTENSION_get_object(ext); asn1_object_dump(obj, namebuf, sizeof(namebuf)); if(!X509V3_EXT_print(bio_out, ext, 0, 0)) ASN1_STRING_print(bio_out, (ASN1_STRING *)X509_EXTENSION_get_data(ext)); BIO_get_mem_ptr(bio_out, &biomem); for(j = 0; j < (size_t)biomem->length; j++) { const char *sep = ""; if(biomem->data[j] == '\n') { sep = ", "; j++; /* skip the newline */ }; while((j<(size_t)biomem->length) && (biomem->data[j] == ' ')) j++; if(j<(size_t)biomem->length) ptr += snprintf(ptr, sizeof(buf)-(ptr-buf), "%s%c", sep, biomem->data[j]); } Curl_ssl_push_certinfo(data, certnum, namebuf, buf); BIO_free(bio_out); } return 0; /* all is fine */ }
pushq %rbp movq %rsp, %rbp subq $0x310, %rsp # imm = 0x310 movq %rdi, -0x10(%rbp) movl %esi, -0x14(%rbp) movq %rdx, -0x20(%rbp) movq -0x20(%rbp), %rdi callq 0x77e00 movq %rax, %rdi callq 0x94a0 cmpl $0x0, %eax jg 0x77ae8 movl $0x1, -0x4(%rbp) jmp 0x77d3f movl $0x0, -0x24(%rbp) movl -0x24(%rbp), %eax movl %eax, -0x2f4(%rbp) movq -0x20(%rbp), %rdi callq 0x77e00 movq %rax, %rdi callq 0x94a0 movl %eax, %ecx movl -0x2f4(%rbp), %eax cmpl %ecx, %eax jge 0x77d38 movq -0x20(%rbp), %rdi callq 0x77e00 movq %rax, %rdi movl -0x24(%rbp), %esi callq 0x9cc0 movq %rax, -0x40(%rbp) leaq -0x250(%rbp), %rax movq %rax, -0x258(%rbp) callq 0x9850 movq %rax, %rdi callq 0xa050 movq %rax, -0x2e8(%rbp) cmpq $0x0, -0x2e8(%rbp) jne 0x77b69 movl $0x1, -0x4(%rbp) jmp 0x77d3f movq -0x40(%rbp), %rdi callq 0x93c0 movq %rax, -0x38(%rbp) movq -0x38(%rbp), %rdi leaq -0x2e0(%rbp), %rsi movl $0x80, %edx callq 0x77e10 movq -0x2e8(%rbp), %rdi movq -0x40(%rbp), %rsi xorl %eax, %eax movl %eax, %edx xorl %ecx, %ecx callq 0x9e40 cmpl $0x0, %eax jne 0x77bcc movq -0x2e8(%rbp), %rax movq %rax, -0x300(%rbp) movq -0x40(%rbp), %rdi callq 0x9f90 movq -0x300(%rbp), %rdi movq %rax, %rsi callq 0x9fc0 movq -0x2e8(%rbp), %rdi movl $0x73, %esi xorl %eax, %eax movl %eax, %edx leaq -0x48(%rbp), %rcx callq 0x9220 movq $0x0, -0x30(%rbp) movq -0x30(%rbp), %rax movq -0x48(%rbp), %rcx cmpq (%rcx), %rax jae 0x77d04 leaq 0xb8a7(%rip), %rax # 0x834ac movq %rax, -0x2f0(%rbp) movq -0x48(%rbp), %rax movq 0x8(%rax), %rax movq -0x30(%rbp), %rcx movsbl (%rax,%rcx), %eax cmpl $0xa, %eax jne 0x77c3b leaq 0x3d20(%rip), %rax # 0x7b948 movq %rax, -0x2f0(%rbp) movq -0x30(%rbp), %rax addq $0x1, %rax movq %rax, -0x30(%rbp) jmp 0x77c3d movq -0x30(%rbp), %rcx movq -0x48(%rbp), %rdx xorl %eax, %eax cmpq (%rdx), %rcx movb %al, -0x301(%rbp) jae 0x77c6e movq -0x48(%rbp), %rax movq 0x8(%rax), %rax movq -0x30(%rbp), %rcx movsbl (%rax,%rcx), %eax cmpl $0x20, %eax sete %al movb %al, -0x301(%rbp) movb -0x301(%rbp), %al testb $0x1, %al jne 0x77c7a jmp 0x77c88 movq -0x30(%rbp), %rax addq $0x1, %rax movq %rax, -0x30(%rbp) jmp 0x77c3d movq -0x30(%rbp), %rax movq -0x48(%rbp), %rcx cmpq (%rcx), %rax jae 0x77cf1 movq -0x258(%rbp), %rdi movq -0x258(%rbp), %rax leaq -0x250(%rbp), %rcx subq %rcx, %rax movl $0x200, %esi # imm = 0x200 subq %rax, %rsi movq -0x2f0(%rbp), %rcx movq -0x48(%rbp), %rax movq 0x8(%rax), %rax movq -0x30(%rbp), %rdx movsbl (%rax,%rdx), %r8d leaq 0x9052(%rip), %rdx # 0x80d26 movb $0x0, %al callq 0x9510 movl %eax, %ecx movq -0x258(%rbp), %rax movslq %ecx, %rcx addq %rcx, %rax movq %rax, -0x258(%rbp) jmp 0x77cf3 movq -0x30(%rbp), %rax addq $0x1, %rax movq %rax, -0x30(%rbp) jmp 0x77bed movq -0x10(%rbp), %rdi movl -0x14(%rbp), %esi leaq -0x2e0(%rbp), %rdx leaq -0x250(%rbp), %rcx callq 0x79800 movq -0x2e8(%rbp), %rdi callq 0x9a00 movl -0x24(%rbp), %eax addl $0x1, %eax movl %eax, -0x24(%rbp) jmp 0x77aef movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x310, %rsp # imm = 0x310 popq %rbp retq nopl (%rax,%rax)
/macressler[P]curl/lib/vtls/openssl.c
pubkey_show
static void pubkey_show(struct Curl_easy *data, BIO *mem, int num, const char *type, const char *name, #ifdef HAVE_OPAQUE_RSA_DSA_DH const #endif BIGNUM *bn) { char *ptr; char namebuf[32]; snprintf(namebuf, sizeof(namebuf), "%s(%s)", type, name); if(bn) BN_print(mem, bn); push_certinfo(namebuf, num); }
pushq %rbp movq %rsp, %rbp subq $0x70, %rsp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movl %edx, -0x14(%rbp) movq %rcx, -0x20(%rbp) movq %r8, -0x28(%rbp) movq %r9, -0x30(%rbp) leaq -0x60(%rbp), %rdi movq -0x20(%rbp), %rcx movq -0x28(%rbp), %r8 movl $0x20, %esi leaq 0xc784(%rip), %rdx # 0x8450b movb $0x0, %al callq 0x9510 cmpq $0x0, -0x30(%rbp) je 0x77da2 movq -0x10(%rbp), %rdi movq -0x30(%rbp), %rsi callq 0x96f0 jmp 0x77da4 movq -0x10(%rbp), %rdi movl $0x3, %esi xorl %eax, %eax movl %eax, %edx leaq -0x38(%rbp), %rcx callq 0x9220 movq %rax, -0x68(%rbp) movq -0x8(%rbp), %rdi movl -0x14(%rbp), %esi leaq -0x60(%rbp), %rdx movq -0x38(%rbp), %rcx movq -0x68(%rbp), %r8 callq 0x796c0 movq -0x10(%rbp), %rdi movl $0x1, %esi xorl %eax, %eax movl %eax, %ecx movq %rcx, %rdx callq 0x9220 movl %eax, %ecx movl $0x1, %eax cmpl %ecx, %eax je 0x77df8 jmp 0x77dfa jmp 0x77dfa addq $0x70, %rsp popq %rbp retq
/macressler[P]curl/lib/vtls/openssl.c
asn1_object_dump
static int asn1_object_dump(ASN1_OBJECT *a, char *buf, size_t len) { int i, ilen; ilen = (int)len; if(ilen < 0) return 1; /* buffer too big */ i = i2t_ASN1_OBJECT(buf, ilen, a); if(i >= ilen) return 1; /* buffer too small */ return 0; }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq %rdx, -0x20(%rbp) movq -0x20(%rbp), %rax movl %eax, -0x28(%rbp) cmpl $0x0, -0x28(%rbp) jge 0x77e3a movl $0x1, -0x4(%rbp) jmp 0x77e65 movq -0x18(%rbp), %rdi movl -0x28(%rbp), %esi movq -0x10(%rbp), %rdx callq 0x9280 movl %eax, -0x24(%rbp) movl -0x24(%rbp), %eax cmpl -0x28(%rbp), %eax jl 0x77e5e movl $0x1, -0x4(%rbp) jmp 0x77e65 movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x30, %rsp popq %rbp retq nop
/macressler[P]curl/lib/vtls/openssl.c
Curl_ssl_config_matches
bool Curl_ssl_config_matches(struct ssl_primary_config* data, struct ssl_primary_config* needle) { if((data->version == needle->version) && (data->version_max == needle->version_max) && (data->verifypeer == needle->verifypeer) && (data->verifyhost == needle->verifyhost) && (data->verifystatus == needle->verifystatus) && Curl_safe_strcasecompare(data->CApath, needle->CApath) && Curl_safe_strcasecompare(data->CAfile, needle->CAfile) && Curl_safe_strcasecompare(data->clientcert, needle->clientcert) && Curl_safe_strcasecompare(data->random_file, needle->random_file) && Curl_safe_strcasecompare(data->egdsocket, needle->egdsocket) && Curl_safe_strcasecompare(data->cipher_list, needle->cipher_list)) return TRUE; return FALSE; }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq -0x10(%rbp), %rax movq (%rax), %rax movq -0x18(%rbp), %rcx cmpq (%rcx), %rax jne 0x78063 movq -0x10(%rbp), %rax movq 0x8(%rax), %rax movq -0x18(%rbp), %rcx cmpq 0x8(%rcx), %rax jne 0x78063 movq -0x10(%rbp), %rax movb 0x10(%rax), %al andb $0x1, %al movzbl %al, %eax movq -0x18(%rbp), %rcx movb 0x10(%rcx), %cl andb $0x1, %cl movzbl %cl, %ecx cmpl %ecx, %eax jne 0x78063 movq -0x10(%rbp), %rax movb 0x11(%rax), %al andb $0x1, %al movzbl %al, %eax movq -0x18(%rbp), %rcx movb 0x11(%rcx), %cl andb $0x1, %cl movzbl %cl, %ecx cmpl %ecx, %eax jne 0x78063 movq -0x10(%rbp), %rax movb 0x12(%rax), %al andb $0x1, %al movzbl %al, %eax movq -0x18(%rbp), %rcx movb 0x12(%rcx), %cl andb $0x1, %cl movzbl %cl, %ecx cmpl %ecx, %eax jne 0x78063 movq -0x10(%rbp), %rax movq 0x18(%rax), %rdi movq -0x18(%rbp), %rax movq 0x18(%rax), %rsi callq 0x36750 cmpl $0x0, %eax je 0x78063 movq -0x10(%rbp), %rax movq 0x20(%rax), %rdi movq -0x18(%rbp), %rax movq 0x20(%rax), %rsi callq 0x36750 cmpl $0x0, %eax je 0x78063 movq -0x10(%rbp), %rax movq 0x28(%rax), %rdi movq -0x18(%rbp), %rax movq 0x28(%rax), %rsi callq 0x36750 cmpl $0x0, %eax je 0x78063 movq -0x10(%rbp), %rax movq 0x30(%rax), %rdi movq -0x18(%rbp), %rax movq 0x30(%rax), %rsi callq 0x36750 cmpl $0x0, %eax je 0x78063 movq -0x10(%rbp), %rax movq 0x38(%rax), %rdi movq -0x18(%rbp), %rax movq 0x38(%rax), %rsi callq 0x36750 cmpl $0x0, %eax je 0x78063 movq -0x10(%rbp), %rax movq 0x40(%rax), %rdi movq -0x18(%rbp), %rax movq 0x40(%rax), %rsi callq 0x36750 cmpl $0x0, %eax je 0x78063 movb $0x1, -0x1(%rbp) jmp 0x78067 movb $0x0, -0x1(%rbp) movb -0x1(%rbp), %al andb $0x1, %al addq $0x20, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/macressler[P]curl/lib/vtls/vtls.c
Curl_clone_primary_ssl_config
bool Curl_clone_primary_ssl_config(struct ssl_primary_config *source, struct ssl_primary_config *dest) { dest->version = source->version; dest->version_max = source->version_max; dest->verifypeer = source->verifypeer; dest->verifyhost = source->verifyhost; dest->verifystatus = source->verifystatus; dest->sessionid = source->sessionid; CLONE_STRING(CApath); CLONE_STRING(CAfile); CLONE_STRING(clientcert); CLONE_STRING(random_file); CLONE_STRING(egdsocket); CLONE_STRING(cipher_list); return TRUE; }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq -0x10(%rbp), %rax movq (%rax), %rcx movq -0x18(%rbp), %rax movq %rcx, (%rax) movq -0x10(%rbp), %rax movq 0x8(%rax), %rcx movq -0x18(%rbp), %rax movq %rcx, 0x8(%rax) movq -0x10(%rbp), %rax movb 0x10(%rax), %cl movq -0x18(%rbp), %rax andb $0x1, %cl movb %cl, 0x10(%rax) movq -0x10(%rbp), %rax movb 0x11(%rax), %cl movq -0x18(%rbp), %rax andb $0x1, %cl movb %cl, 0x11(%rax) movq -0x10(%rbp), %rax movb 0x12(%rax), %cl movq -0x18(%rbp), %rax andb $0x1, %cl movb %cl, 0x12(%rax) movq -0x10(%rbp), %rax movb 0x13(%rax), %cl movq -0x18(%rbp), %rax andb $0x1, %cl movb %cl, 0x13(%rax) movq -0x10(%rbp), %rax cmpq $0x0, 0x18(%rax) je 0x78132 leaq 0x1b95c(%rip), %rax # 0x93a60 movq (%rax), %rax movq -0x10(%rbp), %rcx movq 0x18(%rcx), %rdi callq *%rax movq %rax, %rcx movq -0x18(%rbp), %rax movq %rcx, 0x18(%rax) movq -0x18(%rbp), %rax cmpq $0x0, 0x18(%rax) jne 0x78130 movb $0x0, -0x1(%rbp) jmp 0x782b8 jmp 0x7813e movq -0x18(%rbp), %rax movq $0x0, 0x18(%rax) movq -0x10(%rbp), %rax cmpq $0x0, 0x20(%rax) je 0x7817e leaq 0x1b910(%rip), %rax # 0x93a60 movq (%rax), %rax movq -0x10(%rbp), %rcx movq 0x20(%rcx), %rdi callq *%rax movq %rax, %rcx movq -0x18(%rbp), %rax movq %rcx, 0x20(%rax) movq -0x18(%rbp), %rax cmpq $0x0, 0x20(%rax) jne 0x7817c movb $0x0, -0x1(%rbp) jmp 0x782b8 jmp 0x7818a movq -0x18(%rbp), %rax movq $0x0, 0x20(%rax) movq -0x10(%rbp), %rax cmpq $0x0, 0x28(%rax) je 0x781ca leaq 0x1b8c4(%rip), %rax # 0x93a60 movq (%rax), %rax movq -0x10(%rbp), %rcx movq 0x28(%rcx), %rdi callq *%rax movq %rax, %rcx movq -0x18(%rbp), %rax movq %rcx, 0x28(%rax) movq -0x18(%rbp), %rax cmpq $0x0, 0x28(%rax) jne 0x781c8 movb $0x0, -0x1(%rbp) jmp 0x782b8 jmp 0x781d6 movq -0x18(%rbp), %rax movq $0x0, 0x28(%rax) movq -0x10(%rbp), %rax cmpq $0x0, 0x30(%rax) je 0x78216 leaq 0x1b878(%rip), %rax # 0x93a60 movq (%rax), %rax movq -0x10(%rbp), %rcx movq 0x30(%rcx), %rdi callq *%rax movq %rax, %rcx movq -0x18(%rbp), %rax movq %rcx, 0x30(%rax) movq -0x18(%rbp), %rax cmpq $0x0, 0x30(%rax) jne 0x78214 movb $0x0, -0x1(%rbp) jmp 0x782b8 jmp 0x78222 movq -0x18(%rbp), %rax movq $0x0, 0x30(%rax) movq -0x10(%rbp), %rax cmpq $0x0, 0x38(%rax) je 0x7825f leaq 0x1b82c(%rip), %rax # 0x93a60 movq (%rax), %rax movq -0x10(%rbp), %rcx movq 0x38(%rcx), %rdi callq *%rax movq %rax, %rcx movq -0x18(%rbp), %rax movq %rcx, 0x38(%rax) movq -0x18(%rbp), %rax cmpq $0x0, 0x38(%rax) jne 0x7825d movb $0x0, -0x1(%rbp) jmp 0x782b8 jmp 0x7826b movq -0x18(%rbp), %rax movq $0x0, 0x38(%rax) movq -0x10(%rbp), %rax cmpq $0x0, 0x40(%rax) je 0x782a8 leaq 0x1b7e3(%rip), %rax # 0x93a60 movq (%rax), %rax movq -0x10(%rbp), %rcx movq 0x40(%rcx), %rdi callq *%rax movq %rax, %rcx movq -0x18(%rbp), %rax movq %rcx, 0x40(%rax) movq -0x18(%rbp), %rax cmpq $0x0, 0x40(%rax) jne 0x782a6 movb $0x0, -0x1(%rbp) jmp 0x782b8 jmp 0x782b4 movq -0x18(%rbp), %rax movq $0x0, 0x40(%rax) movb $0x1, -0x1(%rbp) movb -0x1(%rbp), %al andb $0x1, %al addq $0x20, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/macressler[P]curl/lib/vtls/vtls.c
Curl_free_primary_ssl_config
void Curl_free_primary_ssl_config(struct ssl_primary_config* sslc) { Curl_safefree(sslc->CApath); Curl_safefree(sslc->CAfile); Curl_safefree(sslc->clientcert); Curl_safefree(sslc->random_file); Curl_safefree(sslc->egdsocket); Curl_safefree(sslc->cipher_list); }
pushq %rbp movq %rsp, %rbp subq $0x10, %rsp movq %rdi, -0x8(%rbp) leaq 0x1b76d(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x8(%rbp), %rcx movq 0x18(%rcx), %rdi callq *%rax movq -0x8(%rbp), %rax movq $0x0, 0x18(%rax) jmp 0x782fe leaq 0x1b74b(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x8(%rbp), %rcx movq 0x20(%rcx), %rdi callq *%rax movq -0x8(%rbp), %rax movq $0x0, 0x20(%rax) jmp 0x78320 leaq 0x1b729(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x8(%rbp), %rcx movq 0x28(%rcx), %rdi callq *%rax movq -0x8(%rbp), %rax movq $0x0, 0x28(%rax) jmp 0x78342 leaq 0x1b707(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x8(%rbp), %rcx movq 0x30(%rcx), %rdi callq *%rax movq -0x8(%rbp), %rax movq $0x0, 0x30(%rax) jmp 0x78364 leaq 0x1b6e5(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x8(%rbp), %rcx movq 0x38(%rcx), %rdi callq *%rax movq -0x8(%rbp), %rax movq $0x0, 0x38(%rax) jmp 0x78386 leaq 0x1b6c3(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x8(%rbp), %rcx movq 0x40(%rcx), %rdi callq *%rax movq -0x8(%rbp), %rax movq $0x0, 0x40(%rax) addq $0x10, %rsp popq %rbp retq nopl (%rax)
/macressler[P]curl/lib/vtls/vtls.c
Curl_ssl_backend
int Curl_ssl_backend(void) { #ifdef USE_SSL multissl_init(NULL); return Curl_ssl->info.id; #else return (int)CURLSSLBACKEND_NONE; #endif }
pushq %rbp movq %rsp, %rbp xorl %eax, %eax movl %eax, %edi callq 0x783d0 movq 0x1b6cc(%rip), %rax # 0x93a90 movl (%rax), %eax popq %rbp retq nopl (%rax,%rax)
/macressler[P]curl/lib/vtls/vtls.c
multissl_init
static int multissl_init(const struct Curl_ssl *backend) { const char *env; char *env_tmp; int i; if(Curl_ssl != &Curl_ssl_multi) return 1; if(backend) { Curl_ssl = backend; return 0; } if(!available_backends[0]) return 1; env = env_tmp = curl_getenv("CURL_SSL_BACKEND"); #ifdef CURL_DEFAULT_SSL_BACKEND if(!env) env = CURL_DEFAULT_SSL_BACKEND; #endif if(env) { for(i = 0; available_backends[i]; i++) { if(strcasecompare(env, available_backends[i]->info.name)) { Curl_ssl = available_backends[i]; curl_free(env_tmp); return 0; } } } /* Fall back to first available backend */ Curl_ssl = available_backends[0]; curl_free(env_tmp); return 0; }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x10(%rbp) leaq 0x1a8cd(%rip), %rax # 0x92cb0 cmpq %rax, 0x1b6a6(%rip) # 0x93a90 je 0x783f8 movl $0x1, -0x4(%rbp) jmp 0x784d6 cmpq $0x0, -0x10(%rbp) je 0x78416 movq -0x10(%rbp), %rax movq %rax, 0x1b686(%rip) # 0x93a90 movl $0x0, -0x4(%rbp) jmp 0x784d6 cmpq $0x0, 0x1b682(%rip) # 0x93aa0 jne 0x7842c movl $0x1, -0x4(%rbp) jmp 0x784d6 leaq 0xc5b2(%rip), %rdi # 0x849e5 callq 0xa2d0 movq %rax, -0x20(%rbp) movq %rax, -0x18(%rbp) cmpq $0x0, -0x18(%rbp) je 0x784b8 movl $0x0, -0x24(%rbp) movslq -0x24(%rbp), %rcx leaq 0x1b647(%rip), %rax # 0x93aa0 cmpq $0x0, (%rax,%rcx,8) je 0x784b6 movq -0x18(%rbp), %rdi movslq -0x24(%rbp), %rcx leaq 0x1b631(%rip), %rax # 0x93aa0 movq (%rax,%rcx,8), %rax movq 0x8(%rax), %rsi callq 0x36690 cmpl $0x0, %eax je 0x784a9 movslq -0x24(%rbp), %rcx leaq 0x1b614(%rip), %rax # 0x93aa0 movq (%rax,%rcx,8), %rax movq %rax, 0x1b5f9(%rip) # 0x93a90 movq -0x20(%rbp), %rdi callq 0x9bf0 movl $0x0, -0x4(%rbp) jmp 0x784d6 jmp 0x784ab movl -0x24(%rbp), %eax addl $0x1, %eax movl %eax, -0x24(%rbp) jmp 0x7844e jmp 0x784b8 movq 0x1b5e1(%rip), %rax # 0x93aa0 movq %rax, 0x1b5ca(%rip) # 0x93a90 movq -0x20(%rbp), %rdi callq 0x9bf0 movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x30, %rsp popq %rbp retq nop
/macressler[P]curl/lib/vtls/vtls.c
Curl_ssl_connect
CURLcode Curl_ssl_connect(struct connectdata *conn, int sockindex) { CURLcode result; if(conn->bits.proxy_ssl_connected[sockindex]) { result = ssl_connect_init_proxy(conn, sockindex); if(result) return result; } if(!ssl_prefs_check(conn->data)) return CURLE_SSL_CONNECT_ERROR; /* mark this is being ssl-enabled from here on. */ conn->ssl[sockindex].use = TRUE; conn->ssl[sockindex].state = ssl_connection_negotiating; result = Curl_ssl->connect(conn, sockindex); if(!result) Curl_pgrsTime(conn->data, TIMER_APPCONNECT); /* SSL is connected */ return result; }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x10(%rbp) movl %esi, -0x14(%rbp) movq -0x10(%rbp), %rax movslq -0x14(%rbp), %rcx testb $0x1, 0x3a9(%rax,%rcx) je 0x78583 movq -0x10(%rbp), %rdi movl -0x14(%rbp), %esi callq 0x78610 movl %eax, -0x18(%rbp) cmpl $0x0, -0x18(%rbp) je 0x78581 movl -0x18(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x78604 jmp 0x78583 movq -0x10(%rbp), %rax movq (%rax), %rdi callq 0x78750 testb $0x1, %al jne 0x7859c movl $0x23, -0x4(%rbp) jmp 0x78604 movq -0x10(%rbp), %rax addq $0x290, %rax # imm = 0x290 movslq -0x14(%rbp), %rcx imulq $0x18, %rcx, %rcx addq %rcx, %rax movb $0x1, (%rax) movq -0x10(%rbp), %rax addq $0x290, %rax # imm = 0x290 movslq -0x14(%rbp), %rcx imulq $0x18, %rcx, %rcx addq %rcx, %rax movl $0x1, 0x4(%rax) movq 0x1b4b9(%rip), %rax # 0x93a90 movq 0x60(%rax), %rax movq -0x10(%rbp), %rdi movl -0x14(%rbp), %esi callq *%rax movl %eax, -0x18(%rbp) cmpl $0x0, -0x18(%rbp) jne 0x785fe movq -0x10(%rbp), %rax movq (%rax), %rdi movl $0x5, %esi callq 0xdb40 movl -0x18(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x20, %rsp popq %rbp retq nopl (%rax)
/macressler[P]curl/lib/vtls/vtls.c
ssl_prefs_check
static bool ssl_prefs_check(struct Curl_easy *data) { /* check for CURLOPT_SSLVERSION invalid parameter value */ const long sslver = data->set.ssl.primary.version; if((sslver < 0) || (sslver >= CURL_SSLVERSION_LAST)) { failf(data, "Unrecognized parameter value passed via CURLOPT_SSLVERSION"); return FALSE; } switch(data->set.ssl.primary.version_max) { case CURL_SSLVERSION_MAX_NONE: case CURL_SSLVERSION_MAX_DEFAULT: break; default: if((data->set.ssl.primary.version_max >> 16) < sslver) { failf(data, "CURL_SSLVERSION_MAX incompatible with CURL_SSLVERSION"); return FALSE; } } return TRUE; }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x10(%rbp) movq -0x10(%rbp), %rax movq 0x5e8(%rax), %rax movq %rax, -0x18(%rbp) cmpq $0x0, -0x18(%rbp) jl 0x78779 cmpq $0x8, -0x18(%rbp) jl 0x78791 movq -0x10(%rbp), %rdi leaq 0xc1bb(%rip), %rsi # 0x8493f movb $0x0, %al callq 0x19f90 movb $0x0, -0x1(%rbp) jmp 0x787db movq -0x10(%rbp), %rax movq 0x5f0(%rax), %rax testq $-0x10001, %rax # imm = 0xFFFEFFFF je 0x787a6 jmp 0x787a8 jmp 0x787d7 movq -0x10(%rbp), %rax movq 0x5f0(%rax), %rax sarq $0x10, %rax cmpq -0x18(%rbp), %rax jge 0x787d5 movq -0x10(%rbp), %rdi leaq 0xc1b2(%rip), %rsi # 0x8497a movb $0x0, %al callq 0x19f90 movb $0x0, -0x1(%rbp) jmp 0x787db jmp 0x787d7 movb $0x1, -0x1(%rbp) movb -0x1(%rbp), %al andb $0x1, %al addq $0x20, %rsp popq %rbp retq nopw %cs:(%rax,%rax)
/macressler[P]curl/lib/vtls/vtls.c
Curl_ssl_connect_nonblocking
CURLcode Curl_ssl_connect_nonblocking(struct connectdata *conn, int sockindex, bool *done) { CURLcode result; if(conn->bits.proxy_ssl_connected[sockindex]) { result = ssl_connect_init_proxy(conn, sockindex); if(result) return result; } if(!ssl_prefs_check(conn->data)) return CURLE_SSL_CONNECT_ERROR; /* mark this is being ssl requested from here on. */ conn->ssl[sockindex].use = TRUE; result = Curl_ssl->connect_nonblocking(conn, sockindex, done); if(!result && *done) Curl_pgrsTime(conn->data, TIMER_APPCONNECT); /* SSL is connected */ return result; }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x10(%rbp) movl %esi, -0x14(%rbp) movq %rdx, -0x20(%rbp) movq -0x10(%rbp), %rax movslq -0x14(%rbp), %rcx testb $0x1, 0x3a9(%rax,%rcx) je 0x78834 movq -0x10(%rbp), %rdi movl -0x14(%rbp), %esi callq 0x78610 movl %eax, -0x24(%rbp) cmpl $0x0, -0x24(%rbp) je 0x78832 movl -0x24(%rbp), %eax movl %eax, -0x4(%rbp) jmp 0x788a6 jmp 0x78834 movq -0x10(%rbp), %rax movq (%rax), %rdi callq 0x78750 testb $0x1, %al jne 0x7884d movl $0x23, -0x4(%rbp) jmp 0x788a6 movq -0x10(%rbp), %rax addq $0x290, %rax # imm = 0x290 movslq -0x14(%rbp), %rcx imulq $0x18, %rcx, %rcx addq %rcx, %rax movb $0x1, (%rax) movq 0x1b224(%rip), %rax # 0x93a90 movq 0x68(%rax), %rax movq -0x10(%rbp), %rdi movl -0x14(%rbp), %esi movq -0x20(%rbp), %rdx callq *%rax movl %eax, -0x24(%rbp) cmpl $0x0, -0x24(%rbp) jne 0x788a0 movq -0x20(%rbp), %rax testb $0x1, (%rax) je 0x788a0 movq -0x10(%rbp), %rax movq (%rax), %rdi movl $0x5, %esi callq 0xdb40 movl -0x24(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x30, %rsp popq %rbp retq nop
/macressler[P]curl/lib/vtls/vtls.c
Curl_ssl_getsessionid
bool Curl_ssl_getsessionid(struct connectdata *conn, void **ssl_sessionid, size_t *idsize, /* set 0 if unknown */ int sockindex) { struct curl_ssl_session *check; struct Curl_easy *data = conn->data; size_t i; long *general_age; bool no_match = TRUE; const bool isProxy = CONNECT_PROXY_SSL(); struct ssl_primary_config * const ssl_config = isProxy ? &conn->proxy_ssl_config : &conn->ssl_config; const char * const name = isProxy ? conn->http_proxy.host.name : conn->host.name; int port = isProxy ? (int)conn->port : conn->remote_port; *ssl_sessionid = NULL; DEBUGASSERT(SSL_SET_OPTION(primary.sessionid)); if(!SSL_SET_OPTION(primary.sessionid)) /* session ID re-use is disabled */ return TRUE; /* Lock if shared */ if(SSLSESSION_SHARED(data)) general_age = &data->share->sessionage; else general_age = &data->state.sessionage; for(i = 0; i < data->set.general_ssl.max_ssl_sessions; i++) { check = &data->state.session[i]; if(!check->sessionid) /* not session ID means blank entry */ continue; if(strcasecompare(name, check->name) && ((!conn->bits.conn_to_host && !check->conn_to_host) || (conn->bits.conn_to_host && check->conn_to_host && strcasecompare(conn->conn_to_host.name, check->conn_to_host))) && ((!conn->bits.conn_to_port && check->conn_to_port == -1) || (conn->bits.conn_to_port && check->conn_to_port != -1 && conn->conn_to_port == check->conn_to_port)) && (port == check->remote_port) && strcasecompare(conn->handler->scheme, check->scheme) && Curl_ssl_config_matches(ssl_config, &check->ssl_config)) { /* yes, we have a session ID! */ (*general_age)++; /* increase general age */ check->age = *general_age; /* set this as used in this age */ *ssl_sessionid = check->sessionid; if(idsize) *idsize = check->idsize; no_match = FALSE; break; } } return no_match; }
pushq %rbp movq %rsp, %rbp subq $0x80, %rsp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movq %rdx, -0x20(%rbp) movl %ecx, -0x24(%rbp) movq -0x10(%rbp), %rax movq (%rax), %rax movq %rax, -0x38(%rbp) movb $0x1, -0x49(%rbp) movq -0x10(%rbp), %rcx xorl %eax, %eax cmpl $0x2, 0x178(%rcx) movb %al, -0x65(%rbp) jne 0x789af movq -0x10(%rbp), %rax movslq -0x24(%rbp), %rcx movb 0x3a9(%rax,%rcx), %al xorb $-0x1, %al movb %al, -0x65(%rbp) movb -0x65(%rbp), %al andb $0x1, %al movb %al, -0x4a(%rbp) testb $0x1, -0x4a(%rbp) je 0x789cd movq -0x10(%rbp), %rax addq $0x340, %rax # imm = 0x340 movq %rax, -0x70(%rbp) jmp 0x789db movq -0x10(%rbp), %rax addq $0x2f8, %rax # imm = 0x2F8 movq %rax, -0x70(%rbp) movq -0x70(%rbp), %rax movq %rax, -0x58(%rbp) testb $0x1, -0x4a(%rbp) je 0x789fa movq -0x10(%rbp), %rax movq 0x160(%rax), %rax movq %rax, -0x78(%rbp) jmp 0x78a09 movq -0x10(%rbp), %rax movq 0xd8(%rax), %rax movq %rax, -0x78(%rbp) movq -0x78(%rbp), %rax movq %rax, -0x60(%rbp) testb $0x1, -0x4a(%rbp) je 0x78a27 movq -0x10(%rbp), %rax movq 0x190(%rax), %rax movl %eax, -0x7c(%rbp) jmp 0x78a34 movq -0x10(%rbp), %rax movl 0x198(%rax), %eax movl %eax, -0x7c(%rbp) movl -0x7c(%rbp), %eax movl %eax, -0x64(%rbp) movq -0x18(%rbp), %rax movq $0x0, (%rax) jmp 0x78a47 movq -0x10(%rbp), %rcx movl $0x2, %eax cmpl 0x178(%rcx), %eax jne 0x78a9c movq -0x10(%rbp), %rcx addq $0x2c0, %rcx # imm = 0x2C0 movq -0x10(%rbp), %rax movl 0x25c(%rax), %esi movl $0x1, %eax xorl %edx, %edx cmpl $-0x1, %esi cmovel %edx, %eax cltq imulq $0x18, %rax, %rax addq %rax, %rcx movl $0x2, %eax cmpl 0x4(%rcx), %eax je 0x78a9c movq -0x38(%rbp), %rax testb $0x1, 0x6a3(%rax) jne 0x78ab2 jmp 0x78aa9 movq -0x38(%rbp), %rax testb $0x1, 0x5fb(%rax) jne 0x78ab2 movb $0x1, -0x1(%rbp) jmp 0x78cac movq -0x38(%rbp), %rax cmpq $0x0, 0xb8(%rax) je 0x78aec movq -0x38(%rbp), %rax movq 0xb8(%rax), %rax movl (%rax), %eax andl $0x10, %eax cmpl $0x0, %eax je 0x78aec movq -0x38(%rbp), %rax movq 0xb8(%rax), %rax addq $0xc0, %rax movq %rax, -0x48(%rbp) jmp 0x78b00 movq -0x38(%rbp), %rax addq $0xc68, %rax # imm = 0xC68 addq $0x4070, %rax # imm = 0x4070 movq %rax, -0x48(%rbp) movq $0x0, -0x40(%rbp) movq -0x40(%rbp), %rax movq -0x38(%rbp), %rcx cmpq 0x738(%rcx), %rax jae 0x78ca4 movq -0x38(%rbp), %rax movq 0x4cd0(%rax), %rax movq -0x40(%rbp), %rcx shlq $0x7, %rcx addq %rcx, %rax movq %rax, -0x30(%rbp) movq -0x30(%rbp), %rax cmpq $0x0, 0x18(%rax) jne 0x78b47 jmp 0x78c93 movq -0x60(%rbp), %rdi movq -0x30(%rbp), %rax movq (%rax), %rsi callq 0x36690 cmpl $0x0, %eax je 0x78c91 movq -0x10(%rbp), %rax testb $0x1, 0x38b(%rax) jne 0x78b78 movq -0x30(%rbp), %rax cmpq $0x0, 0x8(%rax) je 0x78bb9 movq -0x10(%rbp), %rax testb $0x1, 0x38b(%rax) je 0x78c91 movq -0x30(%rbp), %rax cmpq $0x0, 0x8(%rax) je 0x78c91 movq -0x10(%rbp), %rax movq 0x100(%rax), %rdi movq -0x30(%rbp), %rax movq 0x8(%rax), %rsi callq 0x36690 cmpl $0x0, %eax je 0x78c91 movq -0x10(%rbp), %rax testb $0x1, 0x38c(%rax) jne 0x78bd0 movq -0x30(%rbp), %rax cmpl $-0x1, 0x34(%rax) je 0x78c06 movq -0x10(%rbp), %rax testb $0x1, 0x38c(%rax) je 0x78c91 movq -0x30(%rbp), %rax cmpl $-0x1, 0x34(%rax) je 0x78c91 movq -0x10(%rbp), %rax movl 0x19c(%rax), %eax movq -0x30(%rbp), %rcx cmpl 0x34(%rcx), %eax jne 0x78c91 movl -0x64(%rbp), %eax movq -0x30(%rbp), %rcx cmpl 0x30(%rcx), %eax jne 0x78c91 movq -0x10(%rbp), %rax movq 0x3d0(%rax), %rax movq (%rax), %rdi movq -0x30(%rbp), %rax movq 0x10(%rax), %rsi callq 0x36690 cmpl $0x0, %eax je 0x78c91 movq -0x58(%rbp), %rdi movq -0x30(%rbp), %rsi addq $0x38, %rsi callq 0x77f20 testb $0x1, %al jne 0x78c49 jmp 0x78c91 movq -0x48(%rbp), %rax movq (%rax), %rcx addq $0x1, %rcx movq %rcx, (%rax) movq -0x48(%rbp), %rax movq (%rax), %rcx movq -0x30(%rbp), %rax movq %rcx, 0x28(%rax) movq -0x30(%rbp), %rax movq 0x18(%rax), %rcx movq -0x18(%rbp), %rax movq %rcx, (%rax) cmpq $0x0, -0x20(%rbp) je 0x78c8b movq -0x30(%rbp), %rax movq 0x20(%rax), %rcx movq -0x20(%rbp), %rax movq %rcx, (%rax) movb $0x0, -0x49(%rbp) jmp 0x78ca4 jmp 0x78c93 movq -0x40(%rbp), %rax addq $0x1, %rax movq %rax, -0x40(%rbp) jmp 0x78b08 movb -0x49(%rbp), %al andb $0x1, %al movb %al, -0x1(%rbp) movb -0x1(%rbp), %al andb $0x1, %al addq $0x80, %rsp popq %rbp retq nopw (%rax,%rax)
/macressler[P]curl/lib/vtls/vtls.c
Curl_ssl_delsessionid
void Curl_ssl_delsessionid(struct connectdata *conn, void *ssl_sessionid) { size_t i; struct Curl_easy *data = conn->data; for(i = 0; i < data->set.general_ssl.max_ssl_sessions; i++) { struct curl_ssl_session *check = &data->state.session[i]; if(check->sessionid == ssl_sessionid) { Curl_ssl_kill_session(check); break; } } }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x8(%rbp) movq %rsi, -0x10(%rbp) movq -0x8(%rbp), %rax movq (%rax), %rax movq %rax, -0x20(%rbp) movq $0x0, -0x18(%rbp) movq -0x18(%rbp), %rax movq -0x20(%rbp), %rcx cmpq 0x738(%rcx), %rax jae 0x78dd7 movq -0x20(%rbp), %rax movq 0x4cd0(%rax), %rax movq -0x18(%rbp), %rcx shlq $0x7, %rcx addq %rcx, %rax movq %rax, -0x28(%rbp) movq -0x28(%rbp), %rax movq 0x18(%rax), %rax cmpq -0x10(%rbp), %rax jne 0x78dc7 movq -0x28(%rbp), %rdi callq 0x78cc0 jmp 0x78dd7 jmp 0x78dc9 movq -0x18(%rbp), %rax addq $0x1, %rax movq %rax, -0x18(%rbp) jmp 0x78d83 addq $0x30, %rsp popq %rbp retq nopl (%rax)
/macressler[P]curl/lib/vtls/vtls.c
Curl_ssl_close_all
void Curl_ssl_close_all(struct Curl_easy *data) { size_t i; /* kill the session ID cache if not shared */ if(data->state.session && !SSLSESSION_SHARED(data)) { for(i = 0; i < data->set.general_ssl.max_ssl_sessions; i++) /* the single-killer function handles empty table slots */ Curl_ssl_kill_session(&data->state.session[i]); /* free the cache data */ Curl_safefree(data->state.session); } Curl_ssl->close_all(data); }
pushq %rbp movq %rsp, %rbp subq $0x10, %rsp movq %rdi, -0x8(%rbp) movq -0x8(%rbp), %rax cmpq $0x0, 0x4cd0(%rax) je 0x7926d movq -0x8(%rbp), %rax cmpq $0x0, 0xb8(%rax) je 0x79201 movq -0x8(%rbp), %rax movq 0xb8(%rax), %rax movl (%rax), %eax andl $0x10, %eax cmpl $0x0, %eax jne 0x7926d movq $0x0, -0x10(%rbp) movq -0x10(%rbp), %rax movq -0x8(%rbp), %rcx cmpq 0x738(%rcx), %rax jae 0x79243 movq -0x8(%rbp), %rax movq 0x4cd0(%rax), %rdi movq -0x10(%rbp), %rax shlq $0x7, %rax addq %rax, %rdi callq 0x78cc0 movq -0x10(%rbp), %rax addq $0x1, %rax movq %rax, -0x10(%rbp) jmp 0x79209 jmp 0x79245 leaq 0x1a804(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x8(%rbp), %rcx movq 0x4cd0(%rcx), %rdi callq *%rax movq -0x8(%rbp), %rax movq $0x0, 0x4cd0(%rax) jmp 0x7926d movq 0x1a81c(%rip), %rax # 0x93a90 movq 0x80(%rax), %rax movq -0x8(%rbp), %rdi callq *%rax addq $0x10, %rsp popq %rbp retq nopw (%rax,%rax)
/macressler[P]curl/lib/vtls/vtls.c
Curl_ssl_getsock
int Curl_ssl_getsock(struct connectdata *conn, curl_socket_t *socks, int numsocks) { struct ssl_connect_data *connssl = &conn->ssl[FIRSTSOCKET]; if(!numsocks) return GETSOCK_BLANK; if(connssl->connecting_state == ssl_connect_2_writing) { /* write mode */ socks[0] = conn->sock[FIRSTSOCKET]; return GETSOCK_WRITESOCK(0); } if(connssl->connecting_state == ssl_connect_2_reading) { /* read mode */ socks[0] = conn->sock[FIRSTSOCKET]; return GETSOCK_READSOCK(0); } return GETSOCK_BLANK; }
pushq %rbp movq %rsp, %rbp movq %rdi, -0x10(%rbp) movq %rsi, -0x18(%rbp) movl %edx, -0x1c(%rbp) movq -0x10(%rbp), %rax addq $0x290, %rax # imm = 0x290 movq %rax, -0x28(%rbp) cmpl $0x0, -0x1c(%rbp) jne 0x792bc movl $0x0, -0x4(%rbp) jmp 0x79309 movq -0x28(%rbp), %rax cmpl $0x3, 0x8(%rax) jne 0x792df movq -0x10(%rbp), %rax movl 0x258(%rax), %ecx movq -0x18(%rbp), %rax movl %ecx, (%rax) movl $0x10000, -0x4(%rbp) # imm = 0x10000 jmp 0x79309 movq -0x28(%rbp), %rax cmpl $0x2, 0x8(%rax) jne 0x79302 movq -0x10(%rbp), %rax movl 0x258(%rax), %ecx movq -0x18(%rbp), %rax movl %ecx, (%rax) movl $0x1, -0x4(%rbp) jmp 0x79309 movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax popq %rbp retq nop
/macressler[P]curl/lib/vtls/vtls.c
Curl_ssl_free_certinfo
void Curl_ssl_free_certinfo(struct Curl_easy *data) { int i; struct curl_certinfo *ci = &data->info.certs; if(ci->num_of_certs) { /* free all individual lists used */ for(i = 0; i<ci->num_of_certs; i++) { curl_slist_free_all(ci->certinfo[i]); ci->certinfo[i] = NULL; } free(ci->certinfo); /* free the actual array too */ ci->certinfo = NULL; ci->num_of_certs = 0; } }
pushq %rbp movq %rsp, %rbp subq $0x20, %rsp movq %rdi, -0x8(%rbp) movq -0x8(%rbp), %rax addq $0x5158, %rax # imm = 0x5158 addq $0xd8, %rax movq %rax, -0x18(%rbp) movq -0x18(%rbp), %rax cmpl $0x0, (%rax) je 0x79639 movl $0x0, -0xc(%rbp) movl -0xc(%rbp), %eax movq -0x18(%rbp), %rcx cmpl (%rcx), %eax jge 0x7960f movq -0x18(%rbp), %rax movq 0x8(%rax), %rax movslq -0xc(%rbp), %rcx movq (%rax,%rcx,8), %rdi callq 0x9c00 movq -0x18(%rbp), %rax movq 0x8(%rax), %rax movslq -0xc(%rbp), %rcx movq $0x0, (%rax,%rcx,8) movl -0xc(%rbp), %eax addl $0x1, %eax movl %eax, -0xc(%rbp) jmp 0x795d0 leaq 0x1a43a(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x18(%rbp), %rcx movq 0x8(%rcx), %rdi callq *%rax movq -0x18(%rbp), %rax movq $0x0, 0x8(%rax) movq -0x18(%rbp), %rax movl $0x0, (%rax) addq $0x20, %rsp popq %rbp retq nop
/macressler[P]curl/lib/vtls/vtls.c
Curl_ssl_init_certinfo
CURLcode Curl_ssl_init_certinfo(struct Curl_easy *data, int num) { struct curl_certinfo *ci = &data->info.certs; struct curl_slist **table; /* Free any previous certificate information structures */ Curl_ssl_free_certinfo(data); /* Allocate the required certificate information structures */ table = calloc((size_t) num, sizeof(struct curl_slist *)); if(!table) return CURLE_OUT_OF_MEMORY; ci->num_of_certs = num; ci->certinfo = table; return CURLE_OK; }
pushq %rbp movq %rsp, %rbp subq $0x30, %rsp movq %rdi, -0x10(%rbp) movl %esi, -0x14(%rbp) movq -0x10(%rbp), %rax addq $0x5158, %rax # imm = 0x5158 addq $0xd8, %rax movq %rax, -0x20(%rbp) movq -0x10(%rbp), %rdi callq 0x795a0 leaq 0x1a3f5(%rip), %rax # 0x93a68 movq (%rax), %rax movslq -0x14(%rbp), %rdi movl $0x8, %esi callq *%rax movq %rax, -0x28(%rbp) cmpq $0x0, -0x28(%rbp) jne 0x79695 movl $0x1b, -0x4(%rbp) jmp 0x796b1 movl -0x14(%rbp), %ecx movq -0x20(%rbp), %rax movl %ecx, (%rax) movq -0x28(%rbp), %rcx movq -0x20(%rbp), %rax movq %rcx, 0x8(%rax) movl $0x0, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x30, %rsp popq %rbp retq nopw (%rax,%rax)
/macressler[P]curl/lib/vtls/vtls.c
Curl_ssl_push_certinfo_len
CURLcode Curl_ssl_push_certinfo_len(struct Curl_easy *data, int certnum, const char *label, const char *value, size_t valuelen) { struct curl_certinfo *ci = &data->info.certs; char *output; struct curl_slist *nl; CURLcode result = CURLE_OK; size_t labellen = strlen(label); size_t outlen = labellen + 1 + valuelen + 1; /* label:value\0 */ output = malloc(outlen); if(!output) return CURLE_OUT_OF_MEMORY; /* sprintf the label and colon */ snprintf(output, outlen, "%s:", label); /* memcpy the value (it might not be zero terminated) */ memcpy(&output[labellen + 1], value, valuelen); /* zero terminate the output */ output[labellen + 1 + valuelen] = 0; nl = Curl_slist_append_nodup(ci->certinfo[certnum], output); if(!nl) { free(output); curl_slist_free_all(ci->certinfo[certnum]); result = CURLE_OUT_OF_MEMORY; } ci->certinfo[certnum] = nl; return result; }
pushq %rbp movq %rsp, %rbp subq $0x60, %rsp movq %rdi, -0x10(%rbp) movl %esi, -0x14(%rbp) movq %rdx, -0x20(%rbp) movq %rcx, -0x28(%rbp) movq %r8, -0x30(%rbp) movq -0x10(%rbp), %rax addq $0x5158, %rax # imm = 0x5158 addq $0xd8, %rax movq %rax, -0x38(%rbp) movl $0x0, -0x4c(%rbp) movq -0x20(%rbp), %rdi callq 0x93b0 movq %rax, -0x58(%rbp) movq -0x58(%rbp), %rax addq $0x1, %rax addq -0x30(%rbp), %rax addq $0x1, %rax movq %rax, -0x60(%rbp) leaq 0x1a32a(%rip), %rax # 0x93a48 movq (%rax), %rax movq -0x60(%rbp), %rdi callq *%rax movq %rax, -0x40(%rbp) cmpq $0x0, -0x40(%rbp) jne 0x7973e movl $0x1b, -0x4(%rbp) jmp 0x797f2 movq -0x40(%rbp), %rdi movq -0x60(%rbp), %rsi movq -0x20(%rbp), %rcx leaq 0xb1c1(%rip), %rdx # 0x84912 movb $0x0, %al callq 0x9510 movq -0x40(%rbp), %rdi movq -0x58(%rbp), %rax addq $0x1, %rax addq %rax, %rdi movq -0x28(%rbp), %rsi movq -0x30(%rbp), %rdx callq 0x97b0 movq -0x40(%rbp), %rax movq -0x58(%rbp), %rcx addq $0x1, %rcx addq -0x30(%rbp), %rcx movb $0x0, (%rax,%rcx) movq -0x38(%rbp), %rax movq 0x8(%rax), %rax movslq -0x14(%rbp), %rcx movq (%rax,%rcx,8), %rdi movq -0x40(%rbp), %rsi callq 0x4c940 movq %rax, -0x48(%rbp) cmpq $0x0, -0x48(%rbp) jne 0x797d8 leaq 0x1a29d(%rip), %rax # 0x93a50 movq (%rax), %rax movq -0x40(%rbp), %rdi callq *%rax movq -0x38(%rbp), %rax movq 0x8(%rax), %rax movslq -0x14(%rbp), %rcx movq (%rax,%rcx,8), %rdi callq 0x9c00 movl $0x1b, -0x4c(%rbp) movq -0x48(%rbp), %rdx movq -0x38(%rbp), %rax movq 0x8(%rax), %rax movslq -0x14(%rbp), %rcx movq %rdx, (%rax,%rcx,8) movl -0x4c(%rbp), %eax movl %eax, -0x4(%rbp) movl -0x4(%rbp), %eax addq $0x60, %rsp popq %rbp retq nopl (%rax,%rax)
/macressler[P]curl/lib/vtls/vtls.c
parallel_inc(void*)
void *parallel_inc(void * arg){ auto p = reinterpret_cast<Argument *>(arg); while(*(p->x) != p->n); //usleep(1); std::cout << "thread #" << p->n << std::endl; ++*(p->x); return nullptr; }
pushq %rbx movq %rdi, %rbx movq 0x2cc1(%rip), %rdi # 0x4fc8 leaq 0xcf6(%rip), %rsi # 0x3004 callq 0x2140 movq 0x8(%rbx), %rsi movq %rax, %rdi callq 0x20e0 movq %rax, %rdi callq 0x20a0 movq (%rbx), %rax incq (%rax) xorl %eax, %eax popq %rbx retq
/ant-tr-v[P]treading_at_mipt/all_at_one.cpp
parse_arg(int, char**)
ulong parse_arg(int argc, char *argv[]){ ulong res; if(argc < 2) throw std::runtime_error("Incorrect input"); try{ res = std::stoul(argv[1]); }catch(...){ throw std::runtime_error("Parsing failed"); } return res; }
pushq %r14 pushq %rbx subq $0x28, %rsp cmpl $0x1, %edi jle 0x2377 movq 0x8(%rsi), %rsi leaq 0x8(%rsp), %rdi leaq 0x7(%rsp), %rdx callq 0x2070 leaq 0x8(%rsp), %rdi pushq $0xa popq %rdx xorl %esi, %esi callq 0x25c3 movq %rax, %rbx leaq 0x8(%rsp), %rdi callq 0x2090 movq %rbx, %rax addq $0x28, %rsp popq %rbx popq %r14 retq pushq $0x10 popq %rdi callq 0x20b0 movq %rax, %r14 leaq 0xc84(%rip), %rsi # 0x300d movq %rax, %rdi callq 0x2060 movq 0x2c58(%rip), %rsi # 0x4ff0 movq 0x2c21(%rip), %rdx # 0x4fc0 movq %r14, %rdi callq 0x2190 movq %rax, %rbx movq %r14, %rdi callq 0x20f0 jmp 0x2413 movq %rax, %rbx leaq 0x8(%rsp), %rdi callq 0x2090 jmp 0x23c6 movq %rax, %rbx movq %rbx, %rdi callq 0x2080 pushq $0x10 popq %rdi callq 0x20b0 movq %rax, %r14 leaq 0xc3d(%rip), %rsi # 0x301d movq %rax, %rdi callq 0x2060 movq 0x2c01(%rip), %rsi # 0x4ff0 movq 0x2bca(%rip), %rdx # 0x4fc0 movq %r14, %rdi callq 0x2190 movq %rax, %rbx jmp 0x240e movq %rax, %rbx movq %r14, %rdi callq 0x20f0 callq 0x2180 movq %rbx, %rdi callq 0x21b0 movq %rax, %rdi callq 0x25df
/ant-tr-v[P]treading_at_mipt/all_at_one.cpp
main
int main(int argc, char *argv[]) { ulong N; try{ N = parse_arg(argc, argv); }catch(std::runtime_error &err){ std::cerr << err.what(); return -1; } std::vector<Argument> args(N); std::vector<pthread_t> threads(N); ulong X = 0; for(ulong i = N - 1; i > 0; --i){ args[i] = {&X, i}; int ret; if((ret = pthread_create(threads.data() + i, nullptr, parallel_inc, reinterpret_cast<void *>(args.data() + i))) != 0){ std::cerr << "pthread_create() terminated with code " << ret; return -1; } } std::cout << "Master thread" << std::endl; ++X; for(ulong i = 1; i < N; ++i){ pthread_join(threads[i], nullptr); } return 0; }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x38, %rsp callq 0x2331 movq %rax, %rbx leaq 0x20(%rsp), %rdi leaq 0x8(%rsp), %rdx movq %rax, %rsi callq 0x25ea leaq 0x8(%rsp), %rdi movq %rsp, %rdx movq %rbx, %rsi callq 0x263c andq $0x0, (%rsp) movq %rbx, %r12 shlq $0x4, %r12 addq $-0x10, %r12 leaq -0x1(%rbx), %rax leaq -0x8(,%rbx,8), %r13 leaq -0x182(%rip), %r15 # 0x22fc movq %rax, %r14 subq $0x1, %r14 jb 0x250e movq 0x20(%rsp), %rcx movq %rsp, %rdx movq %rdx, (%rcx,%r12) movq %rax, 0x8(%rcx,%r12) movq 0x8(%rsp), %rdi addq %r13, %rdi movq 0x20(%rsp), %rcx addq %r12, %rcx xorl %esi, %esi movq %r15, %rdx callq 0x21c0 movl %eax, %ebp addq $-0x10, %r12 addq $-0x8, %r13 movq %r14, %rax testl %ebp, %ebp je 0x2481 movq 0x2b1a(%rip), %rdi # 0x4fe8 leaq 0xb57(%rip), %rsi # 0x302c callq 0x2140 movq %rax, %rdi movl %ebp, %esi callq 0x21a0 pushq $-0x1 popq %r14 leaq 0x8(%rsp), %rdi callq 0x285e leaq 0x20(%rsp), %rdi callq 0x2774 movl %r14d, %eax addq $0x38, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq movq 0x2ab3(%rip), %rdi # 0x4fc8 leaq 0xb37(%rip), %rsi # 0x3053 callq 0x2140 movq %rax, %rdi callq 0x20a0 incq (%rsp) pushq $0x1 popq %r15 xorl %r14d, %r14d cmpq %rbx, %r15 jae 0x24e8 movq 0x8(%rsp), %rax movq (%rax,%r15,8), %rdi xorl %esi, %esi callq 0x2120 incq %r15 jmp 0x2534 jmp 0x25a4 movq %rax, %rbx jmp 0x25b1 movq %rax, %rbx jmp 0x25bb movq %rax, %rbx cmpl $0x1, %edx jne 0x25bb movq %rbx, %rdi callq 0x2080 movq (%rax), %rcx movq %rax, %rdi callq *0x10(%rcx) movq 0x2a6e(%rip), %rdi # 0x4fe8 movq %rax, %rsi callq 0x2140 callq 0x2180 pushq $-0x1 popq %r14 jmp 0x24fc movq %rax, %rbx callq 0x2180 jmp 0x25bb movq %rax, %rdi callq 0x25df jmp 0x25a4 movq %rax, %rbx leaq 0x8(%rsp), %rdi callq 0x285e leaq 0x20(%rsp), %rdi callq 0x2774 movq %rbx, %rdi callq 0x21b0
/ant-tr-v[P]treading_at_mipt/all_at_one.cpp
TestHarness::AddType(int, int, char const*)
void TestHarness::AddType(int type, int weight, const char* name) { Type t; t.name = name; t.type = type; t.weight = weight; types_.push_back(t); total_weight_ += weight; }
pushq %rbp movq %rsp, %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x28, %rsp movq %rcx, %r12 movl %edx, %ebx movl %esi, %r15d movq %rdi, %r14 leaq -0x40(%rbp), %r13 movq %r13, -0x10(%r13) movq $0x0, -0x8(%r13) movb $0x0, (%r13) movq %rcx, %rdi callq 0xa2a0 leaq -0x50(%rbp), %rdi xorl %esi, %esi xorl %edx, %edx movq %r12, %rcx movq %rax, %r8 callq 0xaac0 leaq -0x50(%rbp), %rsi movl %r15d, 0x20(%rsi) movl %ebx, 0x24(%rsi) movq %r14, %rdi callq 0x15b0a addl %ebx, 0x18(%r14) movq -0x50(%rbp), %rdi cmpq %r13, %rdi je 0xd7b2 movq -0x40(%rbp), %rsi incq %rsi callq 0xa0c0 addq $0x28, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq movq %rax, %rbx movq -0x50(%rbp), %rdi cmpq %r13, %rdi je 0xd7d9 movq -0x40(%rbp), %rsi incq %rsi callq 0xa0c0 movq %rbx, %rdi callq 0xac20 nop
/alk[P]gperftools/src/tests/tcmalloc_unittest.cc
TCMallocTest_ManyThreads_Test::TestBody()
TEST(TCMallocTest, ManyThreads) { printf("Testing threaded allocation/deallocation (%d threads)\n", FLAGS_numthreads); std::vector<std::unique_ptr<TesterThread>> ptrs; ptrs.reserve(FLAGS_numthreads); // Note, the logic inside PassObject requires us to create all // TesterThreads first, before starting any of them. for (int i = 0; i < FLAGS_numthreads; i++) { ptrs.emplace_back(std::make_unique<TesterThread>(ptrs, i)); } std::vector<std::thread> threads; threads.reserve(FLAGS_numthreads); for (int i = 0; i < FLAGS_numthreads; i++) { threads.emplace_back([thr = ptrs[i].get()] () { thr->Run(); }); } for (auto& t : threads) { t.join(); } }
pushq %rbp movq %rsp, %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x48, %rsp leaq 0x3b692(%rip), %rdi # 0x4921c xorl %ebx, %ebx movl $0xa, %esi xorl %eax, %eax callq 0xa080 xorps %xmm0, %xmm0 leaq -0x70(%rbp), %rdi movaps %xmm0, (%rdi) movq $0x0, 0x10(%rdi) movl $0xa, %esi callq 0x15d9c leaq -0x70(%rbp), %r14 leaq -0x40(%rbp), %r15 movl $0xa8, %edi callq 0xad68 movq %rax, %r12 movq %rax, %rdi movq %r14, %rsi movl %ebx, %edx callq 0x17a06 movq %r12, -0x40(%rbp) movq %r14, %rdi movq %r15, %rsi callq 0x15e52 movq -0x40(%rbp), %rdi testq %rdi, %rdi je 0xdbf4 movq (%rdi), %rax callq *0x8(%rax) incl %ebx cmpl $0xa, %ebx jne 0xdbbc xorps %xmm0, %xmm0 leaq -0x40(%rbp), %rdi movaps %xmm0, (%rdi) movq $0x0, 0x10(%rdi) movl $0xa, %esi callq 0x15e94 xorl %r14d, %r14d xorl %r15d, %r15d movq -0x70(%rbp), %rax movq (%rax,%r15,8), %rax movq %rax, -0x50(%rbp) movq -0x38(%rbp), %r13 cmpq -0x30(%rbp), %r13 je 0xdc49 movq %r13, %rdi leaq -0x50(%rbp), %rsi callq 0x15494 addq $0x8, -0x38(%rbp) jmp 0xdd15 movq -0x40(%rbp), %rax movq %r13, %rbx movq %rax, -0x58(%rbp) subq %rax, %rbx movabsq $0x7ffffffffffffff8, %rax # imm = 0x7FFFFFFFFFFFFFF8 cmpq %rax, %rbx je 0xdd5e sarq $0x3, %rbx cmpq $0x1, %rbx movq %rbx, %rax adcq $0x0, %rax leaq (%rax,%rbx), %rsi movabsq $0xfffffffffffffff, %rcx # imm = 0xFFFFFFFFFFFFFFF cmpq %rcx, %rsi cmovaeq %rcx, %rsi addq %rbx, %rax cmovbq %rcx, %rsi testq %rsi, %rsi movq %rsi, -0x48(%rbp) je 0xdcae leaq -0x40(%rbp), %rdi xorl %edx, %edx callq 0x184da movq %rax, %r12 jmp 0xdcb1 xorl %r12d, %r12d leaq (%r12,%rbx,8), %rbx movq %rbx, %rdi leaq -0x50(%rbp), %rsi callq 0x15494 movq %r12, %rbx movq -0x58(%rbp), %rdi cmpq %r13, %rdi je 0xdcec movq %r12, %rbx movq %rdi, %rax movq %r14, (%rbx) movq (%rax), %rcx movq %rcx, (%rbx) movq %r14, (%rax) addq $0x8, %rax addq $0x8, %rbx cmpq %r13, %rax jne 0xdcd3 testq %rdi, %rdi je 0xdcfd movq -0x30(%rbp), %rsi subq %rdi, %rsi callq 0xa0c0 addq $0x8, %rbx movq %r12, -0x40(%rbp) movq %rbx, -0x38(%rbp) movq -0x48(%rbp), %rax leaq (%r12,%rax,8), %rax movq %rax, -0x30(%rbp) incq %r15 cmpq $0xa, %r15 jne 0xdc1d movq -0x40(%rbp), %rbx movq -0x38(%rbp), %r14 cmpq %r14, %rbx je 0xdd3d movq %rbx, %rdi callq 0xabb0 addq $0x8, %rbx jmp 0xdd2a leaq -0x40(%rbp), %rdi callq 0x15f4a leaq -0x70(%rbp), %rdi callq 0x15f88 addq $0x48, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq leaq 0x3bf17(%rip), %rdi # 0x49c7c callq 0xa380 jmp 0xddb1 jmp 0xddbf movq %rax, %rdi callq 0xa290 testq %r12, %r12 jne 0xdd86 cmpq $0x0, (%rbx) je 0xdd96 callq 0xa1a0 movq %r12, %rdi movq -0x48(%rbp), %rsi shlq $0x3, %rsi callq 0xa0c0 callq 0xa9e0 movq %rax, %rbx callq 0xab50 jmp 0xddb4 movq %rax, %rdi callq 0x1672e jmp 0xddb1 jmp 0xddb1 movq %rax, %rbx leaq -0x40(%rbp), %rdi callq 0x15f4a jmp 0xddf0 movq %rax, %rbx jmp 0xddf0 movq %rax, %rbx movl $0xa8, %esi movq %r12, %rdi callq 0xa0c0 jmp 0xddf0 movq %rax, %rbx movq -0x40(%rbp), %rdi testq %rdi, %rdi je 0xdde8 movq (%rdi), %rax callq *0x8(%rax) movq $0x0, -0x40(%rbp) leaq -0x70(%rbp), %rdi callq 0x15f88 movq %rbx, %rdi callq 0xac20 nop
/alk[P]gperftools/src/tests/tcmalloc_unittest.cc
TCMallocTest_Ranges_Test::TestBody()
TEST(TCMallocTest, Ranges) { static const int MB = 1048576; void* a = malloc(MB); void* b = malloc(MB); base::MallocRange::Type releasedType = TestingPortal::Get()->HaveSystemRelease() ? base::MallocRange::UNMAPPED : base::MallocRange::FREE; CheckRangeCallback(a, base::MallocRange::INUSE, MB); CheckRangeCallback(b, base::MallocRange::INUSE, MB); (noopt(free))(a); CheckRangeCallback(a, base::MallocRange::FREE, MB); CheckRangeCallback(b, base::MallocRange::INUSE, MB); MallocExtension::instance()->ReleaseFreeMemory(); CheckRangeCallback(a, releasedType, MB); CheckRangeCallback(b, base::MallocRange::INUSE, MB); (noopt(free))(b); CheckRangeCallback(a, releasedType, MB); CheckRangeCallback(b, base::MallocRange::FREE, MB); }
pushq %rbp movq %rsp, %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx pushq %rax movl $0x100000, %edi # imm = 0x100000 callq 0xad80 movq %rax, %rbx movl $0x100000, %edi # imm = 0x100000 callq 0xad80 movq %rax, %r14 callq 0x15fe6 movq (%rax), %rcx movq %rax, %rdi callq *(%rcx) movzbl %al, %r15d incl %r15d movq %rbx, %rdi xorl %esi, %esi callq 0xe539 movq %r14, %rdi xorl %esi, %esi callq 0xe539 movq 0x55a75(%rip), %r13 # 0x63f18 leaq -0x30(%rbp), %r12 movq %r13, (%r12) movq 0x56206(%rip), %rax # 0x646b8 movq %r12, %rdi callq *%rax movq %rbx, %rdi callq *(%r12) movq %rbx, %rdi movl $0x1, %esi callq 0xe539 movq %r14, %rdi xorl %esi, %esi callq 0xe539 callq 0xad40 movq (%rax), %rcx movq %rax, %rdi callq *0x90(%rcx) movq %rbx, %rdi movl %r15d, %esi callq 0xe539 movq %r14, %rdi xorl %esi, %esi callq 0xe539 movq %r13, (%r12) movq 0x561b2(%rip), %rax # 0x646b8 movq %r12, %rdi callq *%rax movq %r14, %rdi callq *(%r12) movq %rbx, %rdi movl %r15d, %esi callq 0xe539 movq %r14, %rdi movl $0x1, %esi callq 0xe539 addq $0x8, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq
/alk[P]gperftools/src/tests/tcmalloc_unittest.cc
testing::AssertionResult testing::internal::CmpHelperOpFailure<unsigned long, int>(char const*, char const*, unsigned long const&, int const&, char const*)
AssertionResult CmpHelperOpFailure(const char* expr1, const char* expr2, const T1& val1, const T2& val2, const char* op) { return AssertionFailure() << "Expected: (" << expr1 << ") " << op << " (" << expr2 << "), actual: " << FormatForComparisonFailureMessage(val1, val2) << " vs " << FormatForComparisonFailureMessage(val2, val1); }
pushq %rbp movq %rsp, %rbp pushq %r15 pushq %r14 pushq %r12 pushq %rbx subq $0x70, %rsp movq %r8, %r14 movq %rcx, %r15 movq %rdi, %rbx movq %rsi, -0x48(%rbp) movq %rdx, -0x40(%rbp) movq %r9, -0x38(%rbp) leaq -0x30(%rbp), %r12 movq %r12, %rdi callq 0x1ba60 leaq 0x2fb3b(%rip), %rsi # 0x49f50 movq %r12, %rdi callq 0x18690 leaq -0x48(%rbp), %rsi movq %rax, %rdi callq 0x1870c leaq 0x2fb2c(%rip), %rsi # 0x49f5c movq %rax, %rdi callq 0x187a6 leaq -0x38(%rbp), %rsi movq %rax, %rdi callq 0x1870c leaq 0x2fb0e(%rip), %rsi # 0x49f59 movq %rax, %rdi callq 0x187a6 leaq -0x40(%rbp), %rsi movq %rax, %rdi callq 0x1870c leaq 0x2faf9(%rip), %rsi # 0x49f5f movq %rax, %rdi callq 0x18690 movq %rax, %r12 leaq -0x88(%rbp), %rdi movq %r15, %rsi callq 0x18d04 leaq -0x88(%rbp), %rsi movq %r12, %rdi callq 0x18822 leaq 0x2fad5(%rip), %rsi # 0x49f6b movq %rax, %rdi callq 0x18894 movq %rax, %r15 leaq -0x68(%rbp), %rdi movq %r14, %rsi callq 0x18e96 leaq -0x68(%rbp), %rsi movq %r15, %rdi callq 0x18822 movq %rbx, %rdi movq %rax, %rsi callq 0x1b974 leaq -0x58(%rbp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x1a4dd movq -0x58(%rbp), %rsi incq %rsi callq 0xa0c0 leaq -0x78(%rbp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x1a4f6 movq -0x78(%rbp), %rsi incq %rsi callq 0xa0c0 movq -0x28(%rbp), %rsi testq %rsi, %rsi je 0x1a508 leaq -0x28(%rbp), %rdi callq 0x1678c movq %rbx, %rax addq $0x70, %rsp popq %rbx popq %r12 popq %r14 popq %r15 popq %rbp retq jmp 0x1a53a jmp 0x1a558 movq %rax, %rbx leaq -0x58(%rbp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x1a53d movq -0x58(%rbp), %rsi incq %rsi callq 0xa0c0 jmp 0x1a53d movq %rax, %rbx leaq -0x78(%rbp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x1a55b movq -0x78(%rbp), %rsi incq %rsi callq 0xa0c0 jmp 0x1a55b movq %rax, %rbx movq -0x28(%rbp), %rsi testq %rsi, %rsi je 0x1a56d leaq -0x28(%rbp), %rdi callq 0x1678c movq %rbx, %rdi callq 0xac20
/alk[P]gperftools/vendor/googletest/googletest/include/gtest/gtest.h
testing::internal::RE::Init(char const*)
void RE::Init(const char* regex) { pattern_ = regex; // NetBSD (and Android, which takes its regex implemntation from NetBSD) does // not include the GNU regex extensions (such as Perl style character classes // like \w) in REG_EXTENDED. REG_EXTENDED is only specified to include the // [[:alpha:]] style character classes. Enable REG_GNU wherever it is defined // so users can use those extensions. #if defined(REG_GNU) constexpr int reg_flags = REG_EXTENDED | REG_GNU; #else constexpr int reg_flags = REG_EXTENDED; #endif // Reserves enough bytes to hold the regular expression used for a // full match. const size_t full_regex_len = strlen(regex) + 10; char* const full_pattern = new char[full_regex_len]; snprintf(full_pattern, full_regex_len, "^(%s)$", regex); is_valid_ = regcomp(&full_regex_, full_pattern, reg_flags) == 0; // We want to call regcomp(&partial_regex_, ...) even if the // previous expression returns false. Otherwise partial_regex_ may // not be properly initialized can may cause trouble when it's // freed. // // Some implementation of POSIX regex (e.g. on at least some // versions of Cygwin) doesn't accept the empty string as a valid // regex. We change it to an equivalent form "()" to be safe. if (is_valid_) { const char* const partial_regex = (*regex == '\0') ? "()" : regex; is_valid_ = regcomp(&partial_regex_, partial_regex, reg_flags) == 0; } EXPECT_TRUE(is_valid_) << "Regular expression \"" << regex << "\" is not a valid POSIX Extended regular expression."; delete[] full_pattern; }
pushq %rbp movq %rsp, %rbp pushq %r15 pushq %r14 pushq %r12 pushq %rbx subq $0x40, %rsp movq %rsi, %r15 movq %rdi, %rbx movq 0x8(%rdi), %r14 movq %rsi, %rdi callq 0xa2a0 movq %rbx, %rdi xorl %esi, %esi movq %r14, %rdx movq %r15, %rcx movq %rax, %r8 callq 0xaac0 movq %r15, %rdi callq 0xa2a0 leaq 0xa(%rax), %r12 movq %r12, %rdi callq 0xad98 movq %rax, %r14 leaq 0x2eff2(%rip), %rdx # 0x4ae3e movq %rax, %rdi movq %r12, %rsi movq %r15, %rcx xorl %eax, %eax callq 0xab00 leaq 0x28(%rbx), %rdi movq %r14, %rsi movl $0x1, %edx callq 0xa7b0 testl %eax, %eax sete 0x20(%rbx) jne 0x1be98 cmpb $0x0, (%r15) leaq 0x30eed(%rip), %rsi # 0x4cd6d cmovneq %r15, %rsi leaq 0x68(%rbx), %rdi movl $0x1, %edx callq 0xa7b0 testl %eax, %eax sete 0x20(%rbx) movb 0x20(%rbx), %al leaq -0x38(%rbp), %rbx movb %al, -0x8(%rbx) movq $0x0, (%rbx) testb %al, %al jne 0x1bf9b leaq -0x28(%rbp), %rdi callq 0x229e0 movq -0x28(%rbp), %rdi addq $0x10, %rdi leaq 0x2ef7c(%rip), %rsi # 0x4ae45 movl $0x14, %edx callq 0xa7a0 movq -0x28(%rbp), %r12 addq $0x10, %r12 testq %r15, %r15 je 0x1beed movq %r15, %rdi callq 0xa2a0 movq %rax, %rdx jmp 0x1bef9 movl $0x6, %edx leaq 0x2e077(%rip), %r15 # 0x49f70 movq %r12, %rdi movq %r15, %rsi callq 0xa7a0 movq -0x28(%rbp), %rdi addq $0x10, %rdi leaq 0x2ef47(%rip), %rsi # 0x4ae5a movl $0x33, %edx callq 0xa7a0 leaq 0x2efe1(%rip), %rdx # 0x4af05 leaq 0x2d3f8(%rip), %rcx # 0x49323 leaq 0x2d3f7(%rip), %r8 # 0x49329 leaq -0x60(%rbp), %rdi leaq -0x40(%rbp), %rsi callq 0x23eb4 movq -0x60(%rbp), %r8 leaq 0x2ef44(%rip), %rdx # 0x4ae8e leaq -0x30(%rbp), %rdi movl $0x1, %esi movl $0x2e9, %ecx # imm = 0x2E9 callq 0x1ec36 leaq -0x30(%rbp), %rdi leaq -0x28(%rbp), %rsi callq 0x1ecee leaq -0x30(%rbp), %rdi callq 0x1ecae leaq -0x50(%rbp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x1bf8c movq -0x50(%rbp), %rsi incq %rsi callq 0xa0c0 movq -0x28(%rbp), %rdi testq %rdi, %rdi je 0x1bf9b movq (%rdi), %rax callq *0x8(%rax) movq -0x38(%rbp), %rsi testq %rsi, %rsi je 0x1bfac movq %rbx, %rdi callq 0x1678c movq %r14, %rdi callq 0xa2b0 addq $0x40, %rsp popq %rbx popq %r12 popq %r14 popq %r15 popq %rbp retq movq %rax, %r14 leaq -0x30(%rbp), %rdi callq 0x1ecae jmp 0x1bfd2 movq %rax, %r14 leaq -0x50(%rbp), %rax movq -0x10(%rax), %rdi cmpq %rax, %rdi je 0x1bff7 movq -0x50(%rbp), %rsi incq %rsi callq 0xa0c0 jmp 0x1bff7 jmp 0x1bff4 movq %rax, %r14 jmp 0x1c00e movq %rax, %r14 movq -0x28(%rbp), %rdi testq %rdi, %rdi je 0x1c006 movq (%rdi), %rax callq *0x8(%rax) movq $0x0, -0x28(%rbp) movq -0x38(%rbp), %rsi testq %rsi, %rsi je 0x1c01f movq %rbx, %rdi callq 0x1678c movq %r14, %rdi callq 0xac20
/alk[P]gperftools/vendor/googletest/googletest/src/gtest-port.cc
testing::internal::CapturedStream::~CapturedStream()
~CapturedStream() { remove(filename_.c_str()); }
pushq %rbp movq %rsp, %rbp pushq %rbx pushq %rax movq %rdi, %rbx movq 0x8(%rdi), %rdi callq 0xac60 movq 0x8(%rbx), %rdi addq $0x18, %rbx cmpq %rbx, %rdi je 0x1d5d0 movq (%rbx), %rsi incq %rsi addq $0x8, %rsp popq %rbx popq %rbp jmp 0xa0c0 addq $0x8, %rsp popq %rbx popq %rbp retq nop
/alk[P]gperftools/vendor/googletest/googletest/src/gtest-port.cc
testing::internal::PrintBytesInObjectTo(unsigned char const*, unsigned long, std::ostream*)
void PrintBytesInObjectTo(const unsigned char* obj_bytes, size_t count, ostream* os) { PrintBytesInObjectToImpl(obj_bytes, count, os); }
pushq %rbp movq %rsp, %rbp pushq %r15 pushq %r14 pushq %rbx pushq %rax movq %rdx, %rbx movq %rsi, %r14 movq %rdi, %r15 movq %rdx, %rdi callq 0xa460 leaq 0x2daa9(%rip), %rsi # 0x4b1f7 movl $0xe, %edx movq %rax, %rdi callq 0xa7a0 cmpq $0x83, %r14 ja 0x1d76b movq %r15, %rdi xorl %esi, %esi jmp 0x1d79f movl $0x40, %edx movq %r15, %rdi xorl %esi, %esi movq %rbx, %rcx callq 0x1e27a leaq 0x2da82(%rip), %rsi # 0x4b206 movl $0x5, %edx movq %rbx, %rdi callq 0xa7a0 leaq -0x3f(%r14), %rsi andq $-0x2, %rsi subq %rsi, %r14 movq %r15, %rdi movq %r14, %rdx movq %rbx, %rcx callq 0x1e27a leaq 0x2fa02(%rip), %rsi # 0x4d1b3 movl $0x1, %edx movq %rbx, %rdi addq $0x8, %rsp popq %rbx popq %r14 popq %r15 popq %rbp jmp 0xa7a0
/alk[P]gperftools/vendor/googletest/googletest/src/gtest-printers.cc
testing::internal::PrintAsStringLiteralTo(char32_t, std::ostream*)
static CharFormat PrintAsStringLiteralTo(char32_t c, ostream* os) { switch (c) { case L'\'': *os << "'"; return kAsIs; case L'"': *os << "\\\""; return kSpecialEscape; default: return PrintAsCharLiteralTo(c, os); } }
pushq %rbp movq %rsp, %rbp pushq %r15 pushq %r14 pushq %rbx pushq %rax movq %rsi, %rbx movl %edi, %r14d cmpl $0x21, %edi jg 0x1e370 cmpl $0xd, %r14d ja 0x1e3f7 movl %r14d, %eax leaq 0x2ce5e(%rip), %rcx # 0x4b1bc movslq (%rcx,%rax,4), %rax addq %rcx, %rax jmpq *%rax leaq 0x2ceb8(%rip), %rsi # 0x4b226 jmp 0x1e3da cmpl $0x22, %r14d je 0x1e3ca cmpl $0x5c, %r14d je 0x1e3d3 cmpl $0x27, %r14d jne 0x1e3f7 leaq 0x2e198(%rip), %rsi # 0x4c521 jmp 0x1e407 leaq 0x2cea6(%rip), %rsi # 0x4b238 jmp 0x1e3da leaq 0x2ce9a(%rip), %rsi # 0x4b235 jmp 0x1e3da leaq 0x2ce8e(%rip), %rsi # 0x4b232 jmp 0x1e3da leaq 0x2ce82(%rip), %rsi # 0x4b22f jmp 0x1e3da leaq 0x2ce88(%rip), %rsi # 0x4b23e jmp 0x1e3da leaq 0x2ce7c(%rip), %rsi # 0x4b23b jmp 0x1e3da leaq 0x2ce79(%rip), %rsi # 0x4b241 jmp 0x1e3da leaq 0x2ce9d(%rip), %rsi # 0x4b26e jmp 0x1e3da leaq 0x2ce52(%rip), %rsi # 0x4b22c movl $0x2, %edx movq %rbx, %rdi callq 0xa7a0 movl $0x2, %eax addq $0x8, %rsp popq %rbx popq %r14 popq %r15 popq %rbp retq leal -0x20(%r14), %eax cmpl $0x5e, %eax ja 0x1e418 leaq -0x19(%rbp), %rsi movb %r14b, (%rsi) movl $0x1, %edx movq %rbx, %rdi callq 0xa7a0 xorl %eax, %eax jmp 0x1e3ec movq (%rbx), %rax movq -0x18(%rax), %rax movl 0x18(%rbx,%rax), %r15d leaq 0x2ce19(%rip), %rsi # 0x4b244 movl $0x2, %edx movq %rbx, %rdi callq 0xa7a0 movq (%rbx), %rax movq -0x18(%rax), %rcx movl 0x18(%rbx,%rcx), %edx andl $-0x4b, %edx orl $0x8, %edx movl %edx, 0x18(%rbx,%rcx) movq -0x18(%rax), %rax orl $0x4000, 0x18(%rbx,%rax) # imm = 0x4000 movq %rbx, %rdi movl %r14d, %esi callq 0xabd0 movq (%rbx), %rax movq -0x18(%rax), %rax movl %r15d, 0x18(%rbx,%rax) movl $0x1, %eax jmp 0x1e3ec
/alk[P]gperftools/vendor/googletest/googletest/src/gtest-printers.cc