name
stringlengths
1
473k
code
stringlengths
7
647k
asm
stringlengths
4
3.39M
file
stringlengths
8
196
mbedtls_asn1_write_int
int mbedtls_asn1_write_int( unsigned char **p, unsigned char *start, int val ) { int ret; size_t len = 0; // TODO negative values and values larger than 128 // DER format assumes 2s complement for numbers, so the leftmost bit // should be 0 for positive numbers and 1 for negative numbers. // if( *p - start < 1 ) return( MBEDTLS_ERR_ASN1_BUF_TOO_SMALL ); len += 1; *--(*p) = val; if( val > 0 && **p & 0x80 ) { if( *p - start < 1 ) return( MBEDTLS_ERR_ASN1_BUF_TOO_SMALL ); *--(*p) = 0x00; len += 1; } MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_len( p, start, len ) ); MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_tag( p, start, MBEDTLS_ASN1_INTEGER ) ); return( (int) len ); }
pushq %r15 pushq %r14 pushq %r12 pushq %rbx pushq %rax movq (%rdi), %rax movq %rax, %rcx subq %rsi, %rcx pushq $-0x6c popq %rbx testq %rcx, %rcx jle 0x2aace movq %rsi, %r15 movq %rdi, %r14 leaq -0x1(%rax), %rcx movq %rcx, (%rdi) movb %dl, -0x1(%rax) pushq $0x1 popq %r12 testl %edx, %edx jle 0x2aa99 movq (%r14), %rax cmpb $0x0, (%rax) jns 0x2aa99 movq %rax, %rcx subq %r15, %rcx testq %rcx, %rcx jle 0x2aace leaq -0x1(%rax), %rcx movq %rcx, (%r14) movb $0x0, -0x1(%rax) pushq $0x2 popq %r12 movq %r14, %rdi movq %r15, %rsi movq %r12, %rdx callq 0x2a650 testl %eax, %eax js 0x2aacc movq (%r14), %rcx movq %rcx, %rdx subq %r15, %rdx testq %rdx, %rdx jle 0x2aace leaq -0x1(%rcx), %rdx movq %rdx, (%r14) movb $0x2, -0x1(%rcx) leal (%r12,%rax), %ebx incl %ebx jmp 0x2aace movl %eax, %ebx movl %ebx, %eax addq $0x8, %rsp popq %rbx popq %r12 popq %r14 popq %r15 retq
/project-everest[P]mbedtls/library/asn1write.c
mbedtls_asn1_write_printable_string
int mbedtls_asn1_write_printable_string( unsigned char **p, unsigned char *start, const char *text, size_t text_len ) { int ret; size_t len = 0; MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_raw_buffer( p, start, (const unsigned char *) text, text_len ) ); MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_len( p, start, len ) ); MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_tag( p, start, MBEDTLS_ASN1_PRINTABLE_STRING ) ); return( (int) len ); }
pushq %rbp pushq %r15 pushq %r14 pushq %rbx pushq %rax movq %rcx, %rbx movq %rdi, %r14 movq (%rdi), %rdi movq %rdi, %rax subq %rsi, %rax setb %cl cmpq %rbx, %rax setb %al orb %cl, %al pushq $-0x6c popq %rbp jne 0x2ab57 movq %rsi, %r15 subq %rbx, %rdi movq %rdi, (%r14) movq %rdx, %rsi movq %rbx, %rdx callq 0xc150 testl %ebx, %ebx js 0x2ab51 movl %ebx, %edx andl $0x7fffffff, %edx # imm = 0x7FFFFFFF movq %r14, %rdi movq %r15, %rsi callq 0x2a650 testl %eax, %eax js 0x2ab55 movq (%r14), %rcx movq %rcx, %rdx subq %r15, %rdx testq %rdx, %rdx jle 0x2ab57 leaq -0x1(%rcx), %rdx movq %rdx, (%r14) movb $0x13, -0x1(%rcx) leal (%rbx,%rax), %ebp incl %ebp jmp 0x2ab57 movl %ebx, %ebp jmp 0x2ab57 movl %eax, %ebp movl %ebp, %eax addq $0x8, %rsp popq %rbx popq %r14 popq %r15 popq %rbp retq
/project-everest[P]mbedtls/library/asn1write.c
mbedtls_asn1_write_ia5_string
int mbedtls_asn1_write_ia5_string( unsigned char **p, unsigned char *start, const char *text, size_t text_len ) { int ret; size_t len = 0; MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_raw_buffer( p, start, (const unsigned char *) text, text_len ) ); MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_len( p, start, len ) ); MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_tag( p, start, MBEDTLS_ASN1_IA5_STRING ) ); return( (int) len ); }
pushq %rbp pushq %r15 pushq %r14 pushq %rbx pushq %rax movq %rcx, %rbx movq %rdi, %r14 movq (%rdi), %rdi movq %rdi, %rax subq %rsi, %rax setb %cl cmpq %rbx, %rax setb %al orb %cl, %al pushq $-0x6c popq %rbp jne 0x2abdf movq %rsi, %r15 subq %rbx, %rdi movq %rdi, (%r14) movq %rdx, %rsi movq %rbx, %rdx callq 0xc150 testl %ebx, %ebx js 0x2abd9 movl %ebx, %edx andl $0x7fffffff, %edx # imm = 0x7FFFFFFF movq %r14, %rdi movq %r15, %rsi callq 0x2a650 testl %eax, %eax js 0x2abdd movq (%r14), %rcx movq %rcx, %rdx subq %r15, %rdx testq %rdx, %rdx jle 0x2abdf leaq -0x1(%rcx), %rdx movq %rdx, (%r14) movb $0x16, -0x1(%rcx) leal (%rbx,%rax), %ebp incl %ebp jmp 0x2abdf movl %ebx, %ebp jmp 0x2abdf movl %eax, %ebp movl %ebp, %eax addq $0x8, %rsp popq %rbx popq %r14 popq %r15 popq %rbp retq
/project-everest[P]mbedtls/library/asn1write.c
mbedtls_asn1_write_bitstring
int mbedtls_asn1_write_bitstring( unsigned char **p, unsigned char *start, const unsigned char *buf, size_t bits ) { int ret; size_t len = 0, size; size = ( bits / 8 ) + ( ( bits % 8 ) ? 1 : 0 ); // Calculate byte length // if( *p < start || (size_t)( *p - start ) < size + 1 ) return( MBEDTLS_ERR_ASN1_BUF_TOO_SMALL ); len = size + 1; (*p) -= size; memcpy( *p, buf, size ); // Write unused bits // *--(*p) = (unsigned char) (size * 8 - bits); MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_len( p, start, len ) ); MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_tag( p, start, MBEDTLS_ASN1_BIT_STRING ) ); return( (int) len ); }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx pushq %rax movq %rcx, %r13 movq %rdi, %rbx movq %rcx, %r12 shrq $0x3, %r12 movl %r13d, %eax andl $0x7, %eax cmpq $0x1, %rax sbbq $-0x1, %r12 movq (%rdi), %rdi pushq $-0x6c popq %rbp movq %rdi, %rax subq %rsi, %rax jb 0x2ac88 cmpq %r12, %rax jbe 0x2ac88 movq %rsi, %r14 leaq 0x1(%r12), %r15 subq %r12, %rdi movq %rdi, (%rbx) movq %rdx, %rsi movq %r12, %rdx callq 0xc150 shll $0x3, %r12d subl %r13d, %r12d movq (%rbx), %rax leaq -0x1(%rax), %rcx movq %rcx, (%rbx) movb %r12b, -0x1(%rax) movq %rbx, %rdi movq %r14, %rsi movq %r15, %rdx callq 0x2a650 testl %eax, %eax js 0x2ac86 movq (%rbx), %rcx movq %rcx, %rdx subq %r14, %rdx testq %rdx, %rdx jle 0x2ac88 leaq -0x1(%rcx), %rdx movq %rdx, (%rbx) movb $0x3, -0x1(%rcx) leal (%r15,%rax), %ebp incl %ebp jmp 0x2ac88 movl %eax, %ebp movl %ebp, %eax addq $0x8, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq
/project-everest[P]mbedtls/library/asn1write.c
mbedtls_asn1_write_octet_string
int mbedtls_asn1_write_octet_string( unsigned char **p, unsigned char *start, const unsigned char *buf, size_t size ) { int ret; size_t len = 0; MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_raw_buffer( p, start, buf, size ) ); MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_len( p, start, len ) ); MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_tag( p, start, MBEDTLS_ASN1_OCTET_STRING ) ); return( (int) len ); }
pushq %rbp pushq %r15 pushq %r14 pushq %rbx pushq %rax movq %rcx, %rbx movq %rdi, %r14 movq (%rdi), %rdi movq %rdi, %rax subq %rsi, %rax setb %cl cmpq %rbx, %rax setb %al orb %cl, %al pushq $-0x6c popq %rbp jne 0x2ad14 movq %rsi, %r15 subq %rbx, %rdi movq %rdi, (%r14) movq %rdx, %rsi movq %rbx, %rdx callq 0xc150 testl %ebx, %ebx js 0x2ad0e movl %ebx, %edx andl $0x7fffffff, %edx # imm = 0x7FFFFFFF movq %r14, %rdi movq %r15, %rsi callq 0x2a650 testl %eax, %eax js 0x2ad12 movq (%r14), %rcx movq %rcx, %rdx subq %r15, %rdx testq %rdx, %rdx jle 0x2ad14 leaq -0x1(%rcx), %rdx movq %rdx, (%r14) movb $0x4, -0x1(%rcx) leal (%rbx,%rax), %ebp incl %ebp jmp 0x2ad14 movl %ebx, %ebp jmp 0x2ad14 movl %eax, %ebp movl %ebp, %eax addq $0x8, %rsp popq %rbx popq %r14 popq %r15 popq %rbp retq
/project-everest[P]mbedtls/library/asn1write.c
mbedtls_asn1_store_named_data
mbedtls_asn1_named_data *mbedtls_asn1_store_named_data( mbedtls_asn1_named_data **head, const char *oid, size_t oid_len, const unsigned char *val, size_t val_len ) { mbedtls_asn1_named_data *cur; if( ( cur = mbedtls_asn1_find_named_data( *head, oid, oid_len ) ) == NULL ) { // Add new entry if not present yet based on OID // cur = (mbedtls_asn1_named_data*)mbedtls_calloc( 1, sizeof(mbedtls_asn1_named_data) ); if( cur == NULL ) return( NULL ); cur->oid.len = oid_len; cur->oid.p = mbedtls_calloc( 1, oid_len ); if( cur->oid.p == NULL ) { mbedtls_free( cur ); return( NULL ); } memcpy( cur->oid.p, oid, oid_len ); cur->val.len = val_len; cur->val.p = mbedtls_calloc( 1, val_len ); if( cur->val.p == NULL ) { mbedtls_free( cur->oid.p ); mbedtls_free( cur ); return( NULL ); } cur->next = *head; *head = cur; } else if( cur->val.len < val_len ) { /* * Enlarge existing value buffer if needed * Preserve old data until the allocation succeeded, to leave list in * a consistent state in case allocation fails. */ void *p = mbedtls_calloc( 1, val_len ); if( p == NULL ) return( NULL ); mbedtls_free( cur->val.p ); cur->val.p = p; cur->val.len = val_len; } if( val != NULL ) memcpy( cur->val.p, val, val_len ); return( cur ); }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx pushq %rax movq %r8, %r14 movq %rcx, %r15 movq %rdx, %r13 movq %rsi, %rbp movq %rdi, %r12 movq (%rdi), %rdi callq 0x107ff testq %rax, %rax je 0x2ad85 movq %rax, %rbx cmpq %r14, 0x20(%rax) jae 0x2aded movq %r15, %r12 pushq $0x1 popq %rdi movq %r14, %rsi callq 0xc110 testq %rax, %rax je 0x2ae13 movq %rax, %r15 movq 0x28(%rbx), %rdi callq 0xc030 movq %r15, 0x28(%rbx) movq %r14, 0x20(%rbx) movq %r12, %r15 jmp 0x2aded pushq $0x1 popq %rdi pushq $0x40 popq %rsi callq 0xc110 testq %rax, %rax je 0x2ae13 movq %rax, %rbx movq %r15, (%rsp) movq %r13, 0x8(%rax) pushq $0x1 popq %rdi movq %r13, %rsi callq 0xc110 movq %rax, 0x10(%rbx) testq %rax, %rax je 0x2ae0b movq %rax, %r15 movq %rax, %rdi movq %rbp, %rsi movq %r13, %rdx callq 0xc150 movq %r14, 0x20(%rbx) pushq $0x1 popq %rdi movq %r14, %rsi callq 0xc110 movq %rax, 0x28(%rbx) testq %rax, %rax je 0x2ae03 movq (%r12), %rax movq %rax, 0x30(%rbx) movq %rbx, (%r12) movq (%rsp), %r15 testq %r15, %r15 je 0x2ae15 movq 0x28(%rbx), %rdi movq %r15, %rsi movq %r14, %rdx callq 0xc150 jmp 0x2ae15 movq %r15, %rdi callq 0xc030 movq %rbx, %rdi callq 0xc030 xorl %ebx, %ebx movq %rbx, %rax addq $0x8, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq nop
/project-everest[P]mbedtls/library/asn1write.c
mbedtls_cipher_list
const int *mbedtls_cipher_list( void ) { const mbedtls_cipher_definition_t *def; int *type; if( ! supported_init ) { def = mbedtls_cipher_definitions; type = mbedtls_cipher_supported; while( def->type != 0 ) *type++ = (*def++).type; *type = 0; supported_init = 1; } return( mbedtls_cipher_supported ); }
cmpb $0x0, 0x20629(%rip) # 0x4b458 jne 0x2ae5c xorl %eax, %eax leaq 0x1d946(%rip), %rdx # 0x48780 leaq 0x2061f(%rip), %rcx # 0x4b460 movl (%rdx,%rax,4), %esi testl %esi, %esi je 0x2ae51 movl %esi, (%rcx,%rax) addq $0x4, %rax jmp 0x2ae41 andl $0x0, (%rcx,%rax) movb $0x1, 0x205fc(%rip) # 0x4b458 leaq 0x205fd(%rip), %rax # 0x4b460 retq
/project-everest[P]mbedtls/library/cipher.c
mbedtls_cipher_info_from_values
const mbedtls_cipher_info_t *mbedtls_cipher_info_from_values( const mbedtls_cipher_id_t cipher_id, int key_bitlen, const mbedtls_cipher_mode_t mode ) { const mbedtls_cipher_definition_t *def; for( def = mbedtls_cipher_definitions; def->info != NULL; def++ ) if( def->info->base->cipher == cipher_id && def->info->key_bitlen == (unsigned) key_bitlen && def->info->mode == mode ) return( def->info ); return( NULL ); }
leaq 0x1d8b3(%rip), %rcx # 0x48780 addq $0x8, %rcx movq (%rcx), %rax testq %rax, %rax je 0x2aef2 movq 0x28(%rax), %r8 cmpl %edi, (%r8) jne 0x2aeec cmpl %esi, 0x8(%rax) jne 0x2aeec cmpl %edx, 0x4(%rax) je 0x2aef2 addq $0x10, %rcx jmp 0x2aed1 retq
/project-everest[P]mbedtls/library/cipher.c
mbedtls_cipher_free
void mbedtls_cipher_free( mbedtls_cipher_context_t *ctx ) { if( ctx == NULL ) return; #if defined(MBEDTLS_CMAC_C) if( ctx->cmac_ctx ) { mbedtls_zeroize( ctx->cmac_ctx, sizeof( mbedtls_cmac_context_t ) ); mbedtls_free( ctx->cmac_ctx ); } #endif if( ctx->cipher_ctx ) ctx->cipher_info->base->ctx_free_func( ctx->cipher_ctx ); mbedtls_zeroize( ctx, sizeof(mbedtls_cipher_context_t) ); }
testq %rdi, %rdi je 0x2af3e pushq %rbx movq %rdi, %rbx movq 0x50(%rdi), %rdi testq %rdi, %rdi je 0x2af2b movq (%rbx), %rax movq 0x28(%rax), %rax callq *0x48(%rax) pushq $-0x58 popq %rax testq %rax, %rax je 0x2af3d movb $0x0, 0x58(%rbx,%rax) incq %rax jmp 0x2af2e popq %rbx retq
/project-everest[P]mbedtls/library/cipher.c
mbedtls_cipher_setup
int mbedtls_cipher_setup( mbedtls_cipher_context_t *ctx, const mbedtls_cipher_info_t *cipher_info ) { if( NULL == cipher_info || NULL == ctx ) return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ); memset( ctx, 0, sizeof( mbedtls_cipher_context_t ) ); if( NULL == ( ctx->cipher_ctx = cipher_info->base->ctx_alloc_func() ) ) return( MBEDTLS_ERR_CIPHER_ALLOC_FAILED ); ctx->cipher_info = cipher_info; #if defined(MBEDTLS_CIPHER_MODE_WITH_PADDING) /* * Ignore possible errors caused by a cipher mode that doesn't use padding */ #if defined(MBEDTLS_CIPHER_PADDING_PKCS7) (void) mbedtls_cipher_set_padding_mode( ctx, MBEDTLS_PADDING_PKCS7 ); #else (void) mbedtls_cipher_set_padding_mode( ctx, MBEDTLS_PADDING_NONE ); #endif #endif /* MBEDTLS_CIPHER_MODE_WITH_PADDING */ return( 0 ); }
testq %rsi, %rsi sete %al testq %rdi, %rdi sete %cl orb %al, %cl movl $0xffff9f00, %eax # imm = 0xFFFF9F00 jne 0x2afb9 pushq %r14 pushq %rbx pushq %rax movq %rsi, %r14 movq %rdi, %rbx xorps %xmm0, %xmm0 movups %xmm0, 0x40(%rdi) movups %xmm0, 0x30(%rdi) movups %xmm0, 0x20(%rdi) movups %xmm0, 0x10(%rdi) movups %xmm0, (%rdi) andq $0x0, 0x50(%rdi) movq 0x28(%rsi), %rax callq *0x40(%rax) movq %rax, 0x50(%rbx) testq %rax, %rax je 0x2afad movq %r14, (%rbx) xorl %eax, %eax cmpl $0x2, 0x4(%r14) jne 0x2afb2 leaq 0x584(%rip), %rcx # 0x2b520 movq %rcx, 0x10(%rbx) leaq 0x592(%rip), %rcx # 0x2b539 movq %rcx, 0x18(%rbx) jmp 0x2afb2 movl $0xffff9e80, %eax # imm = 0xFFFF9E80 addq $0x8, %rsp popq %rbx popq %r14 retq
/project-everest[P]mbedtls/library/cipher.c
mbedtls_cipher_set_padding_mode
int mbedtls_cipher_set_padding_mode( mbedtls_cipher_context_t *ctx, mbedtls_cipher_padding_t mode ) { if( NULL == ctx || MBEDTLS_MODE_CBC != ctx->cipher_info->mode ) { return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ); } switch( mode ) { #if defined(MBEDTLS_CIPHER_PADDING_PKCS7) case MBEDTLS_PADDING_PKCS7: ctx->add_padding = add_pkcs_padding; ctx->get_padding = get_pkcs_padding; break; #endif #if defined(MBEDTLS_CIPHER_PADDING_ONE_AND_ZEROS) case MBEDTLS_PADDING_ONE_AND_ZEROS: ctx->add_padding = add_one_and_zeros_padding; ctx->get_padding = get_one_and_zeros_padding; break; #endif #if defined(MBEDTLS_CIPHER_PADDING_ZEROS_AND_LEN) case MBEDTLS_PADDING_ZEROS_AND_LEN: ctx->add_padding = add_zeros_and_len_padding; ctx->get_padding = get_zeros_and_len_padding; break; #endif #if defined(MBEDTLS_CIPHER_PADDING_ZEROS) case MBEDTLS_PADDING_ZEROS: ctx->add_padding = add_zeros_padding; ctx->get_padding = get_zeros_padding; break; #endif case MBEDTLS_PADDING_NONE: ctx->add_padding = NULL; ctx->get_padding = get_no_padding; break; default: return( MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE ); } return( 0 ); }
movl $0xffff9f00, %eax # imm = 0xFFFF9F00 testq %rdi, %rdi je 0x2aff9 movq (%rdi), %rcx cmpl $0x2, 0x4(%rcx) jne 0x2aff9 movl $0xffff9f80, %eax # imm = 0xFFFF9F80 cmpl $0x4, %esi ja 0x2aff9 movl %esi, %eax leaq 0x1ce80(%rip), %rcx # 0x47e60 movq (%rcx,%rax,8), %rcx leaq 0x1ce9d(%rip), %rdx # 0x47e88 movq (%rdx,%rax,8), %rax movq %rcx, 0x10(%rdi) movq %rax, 0x18(%rdi) xorl %eax, %eax retq
/project-everest[P]mbedtls/library/cipher.c
mbedtls_cipher_setkey
int mbedtls_cipher_setkey( mbedtls_cipher_context_t *ctx, const unsigned char *key, int key_bitlen, const mbedtls_operation_t operation ) { if( NULL == ctx || NULL == ctx->cipher_info ) return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ); if( ( ctx->cipher_info->flags & MBEDTLS_CIPHER_VARIABLE_KEY_LEN ) == 0 && (int) ctx->cipher_info->key_bitlen != key_bitlen ) { return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ); } ctx->key_bitlen = key_bitlen; ctx->operation = operation; /* * For CFB and CTR mode always use the encryption key schedule */ if( MBEDTLS_ENCRYPT == operation || MBEDTLS_MODE_CFB == ctx->cipher_info->mode || MBEDTLS_MODE_CTR == ctx->cipher_info->mode ) { return ctx->cipher_info->base->setkey_enc_func( ctx->cipher_ctx, key, ctx->key_bitlen ); } if( MBEDTLS_DECRYPT == operation ) return ctx->cipher_info->base->setkey_dec_func( ctx->cipher_ctx, key, ctx->key_bitlen ); return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ); }
testq %rdi, %rdi je 0x2b035 movq (%rdi), %rax testq %rax, %rax je 0x2b035 testb $0x2, 0x1c(%rax) jne 0x2b012 cmpl %edx, 0x8(%rax) jne 0x2b035 movl %edx, 0x8(%rdi) movl %ecx, 0xc(%rdi) pushq $0x30 popq %r8 cmpl $0x1, %ecx je 0x2b03f movl 0x4(%rax), %r9d cmpl $0x3, %r9d je 0x2b03f cmpl $0x5, %r9d je 0x2b03f testl %ecx, %ecx je 0x2b03b movl $0xffff9f00, %eax # imm = 0xFFFF9F00 retq pushq $0x38 popq %r8 movq 0x28(%rax), %rax movq (%rax,%r8), %rax movq 0x50(%rdi), %rdi jmpq *%rax
/project-everest[P]mbedtls/library/cipher.c
mbedtls_cipher_set_iv
int mbedtls_cipher_set_iv( mbedtls_cipher_context_t *ctx, const unsigned char *iv, size_t iv_len ) { size_t actual_iv_size; if( NULL == ctx || NULL == ctx->cipher_info || NULL == iv ) return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ); /* avoid buffer overflow in ctx->iv */ if( iv_len > MBEDTLS_MAX_IV_LENGTH ) return( MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE ); if( ( ctx->cipher_info->flags & MBEDTLS_CIPHER_VARIABLE_IV_LEN ) != 0 ) actual_iv_size = iv_len; else { actual_iv_size = ctx->cipher_info->iv_size; /* avoid reading past the end of input buffer */ if( actual_iv_size > iv_len ) return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ); } memcpy( ctx->iv, iv, actual_iv_size ); ctx->iv_size = actual_iv_size; return( 0 ); }
movl $0xffff9f00, %eax # imm = 0xFFFF9F00 testq %rdi, %rdi je 0x2b0b0 pushq %r14 pushq %rbx pushq %rax movq %rdx, %rbx movq %rdi, %r14 movq (%rdi), %rcx testq %rcx, %rcx sete %dl testq %rsi, %rsi sete %dil orb %dl, %dil jne 0x2b0a9 movl $0xffff9f80, %eax # imm = 0xFFFF9F80 cmpq $0x10, %rbx ja 0x2b0a9 testb $0x1, 0x1c(%rcx) jne 0x2b097 movl 0x18(%rcx), %ecx movl $0xffff9f00, %eax # imm = 0xFFFF9F00 cmpq %rbx, %rcx movq %rcx, %rbx ja 0x2b0a9 leaq 0x38(%r14), %rdi movq %rbx, %rdx callq 0xc150 movq %rbx, 0x48(%r14) xorl %eax, %eax addq $0x8, %rsp popq %rbx popq %r14 retq
/project-everest[P]mbedtls/library/cipher.c
mbedtls_cipher_update_ad
int mbedtls_cipher_update_ad( mbedtls_cipher_context_t *ctx, const unsigned char *ad, size_t ad_len ) { if( NULL == ctx || NULL == ctx->cipher_info ) return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ); if( MBEDTLS_MODE_GCM == ctx->cipher_info->mode ) { return mbedtls_gcm_starts( (mbedtls_gcm_context *) ctx->cipher_ctx, ctx->operation, ctx->iv, ctx->iv_size, ad, ad_len ); } return( 0 ); }
movl $0xffff9f00, %eax # imm = 0xFFFF9F00 testq %rdi, %rdi je 0x2b100 movq %rdx, %r9 movq %rdi, %rdx movq (%rdi), %rcx testq %rcx, %rcx je 0x2b100 xorl %eax, %eax cmpl $0x6, 0x4(%rcx) jne 0x2b100 movq %rsi, %r8 movq 0x50(%rdx), %rdi movl 0xc(%rdx), %esi movq 0x48(%rdx), %rcx addq $0x38, %rdx jmp 0x2bd81 retq
/project-everest[P]mbedtls/library/cipher.c
mbedtls_cipher_update
int mbedtls_cipher_update( mbedtls_cipher_context_t *ctx, const unsigned char *input, size_t ilen, unsigned char *output, size_t *olen ) { int ret; size_t block_size = 0; if( NULL == ctx || NULL == ctx->cipher_info || NULL == olen ) { return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ); } *olen = 0; block_size = mbedtls_cipher_get_block_size( ctx ); if( ctx->cipher_info->mode == MBEDTLS_MODE_ECB ) { if( ilen != block_size ) return( MBEDTLS_ERR_CIPHER_FULL_BLOCK_EXPECTED ); *olen = ilen; if( 0 != ( ret = ctx->cipher_info->base->ecb_func( ctx->cipher_ctx, ctx->operation, input, output ) ) ) { return( ret ); } return( 0 ); } #if defined(MBEDTLS_GCM_C) if( ctx->cipher_info->mode == MBEDTLS_MODE_GCM ) { *olen = ilen; return mbedtls_gcm_update( (mbedtls_gcm_context *) ctx->cipher_ctx, ilen, input, output ); } #endif if ( 0 == block_size ) { return MBEDTLS_ERR_CIPHER_INVALID_CONTEXT; } if( input == output && ( ctx->unprocessed_len != 0 || ilen % block_size ) ) { return( MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA ); } #if defined(MBEDTLS_CIPHER_MODE_CBC) if( ctx->cipher_info->mode == MBEDTLS_MODE_CBC ) { size_t copy_len = 0; /* * If there is not enough data for a full block, cache it. */ if( ( ctx->operation == MBEDTLS_DECRYPT && NULL != ctx->add_padding && ilen <= block_size - ctx->unprocessed_len ) || ( ctx->operation == MBEDTLS_DECRYPT && NULL == ctx->add_padding && ilen < block_size - ctx->unprocessed_len ) || ( ctx->operation == MBEDTLS_ENCRYPT && ilen < block_size - ctx->unprocessed_len ) ) { memcpy( &( ctx->unprocessed_data[ctx->unprocessed_len] ), input, ilen ); ctx->unprocessed_len += ilen; return( 0 ); } /* * Process cached data first */ if( 0 != ctx->unprocessed_len ) { copy_len = block_size - ctx->unprocessed_len; memcpy( &( ctx->unprocessed_data[ctx->unprocessed_len] ), input, copy_len ); if( 0 != ( ret = ctx->cipher_info->base->cbc_func( ctx->cipher_ctx, ctx->operation, block_size, ctx->iv, ctx->unprocessed_data, output ) ) ) { return( ret ); } *olen += block_size; output += block_size; ctx->unprocessed_len = 0; input += copy_len; ilen -= copy_len; } /* * Cache final, incomplete block */ if( 0 != ilen ) { if( 0 == block_size ) { return MBEDTLS_ERR_CIPHER_INVALID_CONTEXT; } /* Encryption: only cache partial blocks * Decryption w/ padding: always keep at least one whole block * Decryption w/o padding: only cache partial blocks */ copy_len = ilen % block_size; if( copy_len == 0 && ctx->operation == MBEDTLS_DECRYPT && NULL != ctx->add_padding) { copy_len = block_size; } memcpy( ctx->unprocessed_data, &( input[ilen - copy_len] ), copy_len ); ctx->unprocessed_len += copy_len; ilen -= copy_len; } /* * Process remaining full blocks */ if( ilen ) { if( 0 != ( ret = ctx->cipher_info->base->cbc_func( ctx->cipher_ctx, ctx->operation, ilen, ctx->iv, input, output ) ) ) { return( ret ); } *olen += ilen; } return( 0 ); } #endif /* MBEDTLS_CIPHER_MODE_CBC */ #if defined(MBEDTLS_CIPHER_MODE_CFB) if( ctx->cipher_info->mode == MBEDTLS_MODE_CFB ) { if( 0 != ( ret = ctx->cipher_info->base->cfb_func( ctx->cipher_ctx, ctx->operation, ilen, &ctx->unprocessed_len, ctx->iv, input, output ) ) ) { return( ret ); } *olen = ilen; return( 0 ); } #endif /* MBEDTLS_CIPHER_MODE_CFB */ #if defined(MBEDTLS_CIPHER_MODE_CTR) if( ctx->cipher_info->mode == MBEDTLS_MODE_CTR ) { if( 0 != ( ret = ctx->cipher_info->base->ctr_func( ctx->cipher_ctx, ilen, &ctx->unprocessed_len, ctx->iv, ctx->unprocessed_data, input, output ) ) ) { return( ret ); } *olen = ilen; return( 0 ); } #endif /* MBEDTLS_CIPHER_MODE_CTR */ #if defined(MBEDTLS_CIPHER_MODE_STREAM) if( ctx->cipher_info->mode == MBEDTLS_MODE_STREAM ) { if( 0 != ( ret = ctx->cipher_info->base->stream_func( ctx->cipher_ctx, ilen, input, output ) ) ) { return( ret ); } *olen = ilen; return( 0 ); } #endif /* MBEDTLS_CIPHER_MODE_STREAM */ return( MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE ); }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x28, %rsp movl $0xffff9f00, %ebp # imm = 0xFFFF9F00 testq %rdi, %rdi je 0x2b138 movq %r8, %r14 movq %rcx, %r13 movq %rdx, %rbx movq %rdi, %r12 movq (%rdi), %rcx testq %rcx, %rcx sete %al testq %r8, %r8 sete %dl orb %al, %dl je 0x2b149 movl %ebp, %eax addq $0x28, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq movq %rsi, %r15 andq $0x0, (%r14) movl 0x4(%rcx), %esi cmpl $0x6, %esi je 0x2b195 movl 0x20(%rcx), %edi cmpl $0x1, %esi jne 0x2b1b9 movl $0xffff9d80, %ebp # imm = 0xFFFF9D80 cmpq %rbx, %rdi jne 0x2b138 movq %rbx, (%r14) movq 0x28(%rcx), %rax movq 0x8(%rax), %rax movq 0x50(%r12), %rdi movl 0xc(%r12), %esi movq %r15, %rdx movq %r13, %rcx addq $0x28, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp jmpq *%rax movq %rbx, (%r14) movq 0x50(%r12), %rdi movq %rbx, %rsi movq %r15, %rdx movq %r13, %rcx addq $0x28, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp jmp 0x2c09f testq %rdi, %rdi je 0x2b237 cmpq %r13, %r15 je 0x2b241 movl $0xffff9f80, %ebp # imm = 0xFFFF9F80 addl $-0x2, %esi cmpl $0x5, %esi ja 0x2b138 leaq 0xdcfd(%rip), %rax # 0x38ed8 movslq (%rax,%rsi,4), %rdx addq %rax, %rdx jmpq *%rdx movl 0xc(%r12), %eax cmpl $0x1, %eax je 0x2b2df testl %eax, %eax jne 0x2b2f3 movq 0x30(%r12), %rax movq %rdi, %rcx subq %rax, %rcx cmpq $0x0, 0x10(%r12) je 0x2b2ea cmpq %rbx, %rcx jb 0x2b2f3 leaq (%r12,%rax), %rdi addq $0x20, %rdi movq %r15, %rsi movq %rbx, %rdx callq 0xc150 addq %rbx, 0x30(%r12) jmp 0x2b2d8 movl $0xffff9c80, %ebp # imm = 0xFFFF9C80 jmp 0x2b138 cmpq $0x0, 0x30(%r12) jne 0x2b138 movq %rbx, %rax xorl %edx, %edx divq %rdi testq %rdx, %rdx jne 0x2b138 jmp 0x2b1c3 movq 0x28(%rcx), %rax movq 0x50(%r12), %rdi leaq 0x30(%r12), %rdx leaq 0x38(%r12), %rcx addq $0x20, %r12 movq %r13, (%rsp) movq %rbx, %rsi movq %r12, %r8 movq %r15, %r9 callq *0x20(%rax) jmp 0x2b2ca movq 0x28(%rcx), %rax movq 0x50(%r12), %rdi movl 0xc(%r12), %esi leaq 0x30(%r12), %rcx addq $0x38, %r12 movq %r13, (%rsp) movq %rbx, %rdx movq %r12, %r8 movq %r15, %r9 callq *0x18(%rax) jmp 0x2b2ca movq 0x28(%rcx), %rax movq 0x50(%r12), %rdi movq %rbx, %rsi movq %r15, %rdx movq %r13, %rcx callq *0x28(%rax) testl %eax, %eax je 0x2b2d5 movl %eax, %ebp jmp 0x2b138 movq %rbx, (%r14) xorl %ebp, %ebp jmp 0x2b138 movq 0x30(%r12), %rax movq %rdi, %rcx subq %rax, %rcx cmpq %rbx, %rcx ja 0x2b21a movq 0x30(%r12), %rax testq %rax, %rax je 0x2b373 movq %rdi, %rdx subq %rax, %rdx leaq 0x20(%r12), %rcx movq %rcx, 0x10(%rsp) movq %rdi, %rbp leaq (%r12,%rax), %rdi addq $0x20, %rdi movq %r15, %rsi movq %rdx, 0x18(%rsp) callq 0xc150 movq (%r12), %rax movq 0x28(%rax), %rax movq 0x50(%r12), %rdi movl 0xc(%r12), %esi leaq 0x38(%r12), %rcx movq %rbp, 0x20(%rsp) movq %rbp, %rdx movq 0x10(%rsp), %r8 movq %r13, %r9 callq *0x10(%rax) testl %eax, %eax jne 0x2b2ce movq 0x20(%rsp), %rdi addq %rdi, (%r14) andq $0x0, 0x30(%r12) addq %rdi, %r13 movq 0x18(%rsp), %rax addq %rax, %r15 subq %rax, %rbx testq %rbx, %rbx je 0x2b2d8 xorl %ebp, %ebp movq %rbx, %rax xorl %edx, %edx divq %rdi testq %rdx, %rdx jne 0x2b3a6 cmpl $0x0, 0xc(%r12) je 0x2b397 xorl %edx, %edx jmp 0x2b3a6 movq 0x10(%r12), %rax testq %rax, %rax cmoveq %rax, %rdi movq %rdi, %rdx leaq 0x20(%r12), %rdi movq %rbx, %rax subq %rdx, %rax leaq (%r15,%rax), %rsi movq %rdx, 0x10(%rsp) callq 0xc150 movq 0x10(%rsp), %rax addq %rax, 0x30(%r12) subq %rax, %rbx je 0x2b138 movq (%r12), %rax movq 0x28(%rax), %rax movq 0x50(%r12), %rdi movl 0xc(%r12), %esi addq $0x38, %r12 movq %rbx, %rdx movq %r12, %rcx movq %r15, %r8 movq %r13, %r9 callq *0x10(%rax) testl %eax, %eax jne 0x2b2ce addq %rbx, (%r14) jmp 0x2b138
/project-everest[P]mbedtls/library/cipher.c
chacha20poly1305_init
static void chacha20poly1305_init(ptls_aead_context_t *_ctx, const void *iv, const void *aad, size_t aadlen) { struct chacha20poly1305_context_t *ctx = (struct chacha20poly1305_context_t *)_ctx; uint8_t tmpbuf[64]; /* init chacha */ memset(tmpbuf, 0, 16 - PTLS_CHACHA20POLY1305_IV_SIZE); memcpy(tmpbuf + 16 - PTLS_CHACHA20POLY1305_IV_SIZE, iv, PTLS_CHACHA20POLY1305_IV_SIZE); cf_chacha20_init_custom(&ctx->chacha, ctx->key, sizeof(ctx->key), tmpbuf, 4); /* init poly1305 (by using first 16 bytes of the key stream of the first block) */ cf_chacha20_cipher(&ctx->chacha, zeros64, tmpbuf, 64); cf_poly1305_init(&ctx->poly, tmpbuf, tmpbuf + 16); ptls_clear_memory(tmpbuf, sizeof(tmpbuf)); /* aad */ if (aadlen != 0) { cf_poly1305_update(&ctx->poly, aad, aadlen); chacha20poly1305_encrypt_pad(&ctx->poly, aadlen); } ctx->aadlen = aadlen; ctx->textlen = 0; }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x58, %rsp movq %rcx, %rbx movq %rdx, 0x8(%rsp) leaq 0x20(%rsp), %r12 andl $0x0, -0x10(%r12) movq %rdi, %r14 movq (%rsi), %rax movq %rax, -0xc(%r12) movl 0x8(%rsi), %eax movl %eax, -0x4(%r12) leaq 0x60(%rdi), %r13 leaq 0x40(%rdi), %rsi pushq $0x20 popq %rdx leaq 0x10(%rsp), %rbp pushq $0x4 popq %r8 movq %r13, %rdi movq %rbp, %rcx callq 0x86e4 leaq 0x11ac7(%rip), %rsi # 0x193e0 pushq $0x40 popq %r15 movq %r13, %rdi movq %rbp, %rdx movq %r15, %rcx callq 0x871c leaq 0xe8(%r14), %r13 movq %r13, %rdi movq %rbp, %rsi movq %r12, %rdx callq 0xa2d0 leaq 0x1bb59(%rip), %rax # 0x234a0 movq (%rax), %rax movq %rbp, %rdi movq %r15, %rsi callq *%rax testq %rbx, %rbx je 0x7972 movq %r13, %rdi movq 0x8(%rsp), %rsi movq %rbx, %rdx callq 0xa3aa movq %r13, %rdi movq %rbx, %rsi callq 0x7ac9 movq %rbx, 0x198(%r14) andq $0x0, 0x1a0(%r14) addq $0x58, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq
/rperper[P]picotls/lib/cifra.c
select_u8
static inline uint8_t select_u8(uint32_t i, volatile const uint8_t *tab, uint32_t n) { uint8_t r = 0; uint32_t ii; for (ii = 0; ii < n; ii++) { uint8_t mask = mask_u8(i, ii); r = (r & ~mask) | (tab[ii] & mask); } return r; }
xorl %ecx, %ecx xorl %eax, %eax cmpq $0x2, %rcx je 0x9fa1 movl %ecx, %edx xorl %edi, %edx negl %edx movl %edi, %r8d orb %dl, %r8b movzbl (%rsi,%rcx), %edx movzbl %al, %eax cmovnsl %edx, %eax incq %rcx jmp 0x9f80 retq
/rperper[P]picotls/deps/cifra/src/bitops.h
cf_poly1305_init
void cf_poly1305_init(cf_poly1305 *ctx, const uint8_t r[16], const uint8_t s[16]) { memset(ctx, 0, sizeof *ctx); ctx->r[0] = r[0]; ctx->r[1] = r[1]; ctx->r[2] = r[2]; ctx->r[3] = r[3] & 0x0f; ctx->r[4] = r[4] & 0xfc; ctx->r[5] = r[5]; ctx->r[6] = r[6]; ctx->r[7] = r[7] & 0x0f; ctx->r[8] = r[8] & 0xfc; ctx->r[9] = r[9]; ctx->r[10] = r[10]; ctx->r[11] = r[11] & 0x0f; ctx->r[12] = r[12] & 0xfc; ctx->r[13] = r[13]; ctx->r[14] = r[14]; ctx->r[15] = r[15] & 0x0f; ctx->r[16] = 0; memcpy(ctx->s, s, 16); }
pushq %r15 pushq %r14 pushq %rbx movq %rdx, %rbx movq %rsi, %r15 movq %rdi, %r14 movl $0xb0, %edx xorl %esi, %esi callq 0x61b0 movzbl (%r15), %eax movl %eax, 0x44(%r14) movzbl 0x1(%r15), %eax movl %eax, 0x48(%r14) movzbl 0x2(%r15), %eax movl %eax, 0x4c(%r14) movzbl 0x3(%r15), %eax andl $0xf, %eax movl %eax, 0x50(%r14) movzbl 0x4(%r15), %eax andl $-0x4, %eax movl %eax, 0x54(%r14) movzbl 0x5(%r15), %eax movl %eax, 0x58(%r14) movzbl 0x6(%r15), %eax movl %eax, 0x5c(%r14) movzbl 0x7(%r15), %eax andl $0xf, %eax movl %eax, 0x60(%r14) movzbl 0x8(%r15), %eax andl $-0x4, %eax movl %eax, 0x64(%r14) movzbl 0x9(%r15), %eax movl %eax, 0x68(%r14) movzbl 0xa(%r15), %eax movl %eax, 0x6c(%r14) movzbl 0xb(%r15), %eax andl $0xf, %eax movl %eax, 0x70(%r14) movzbl 0xc(%r15), %eax andl $-0x4, %eax movl %eax, 0x74(%r14) movzbl 0xd(%r15), %eax movl %eax, 0x78(%r14) movzbl 0xe(%r15), %eax movl %eax, 0x7c(%r14) movzbl 0xf(%r15), %eax andl $0xf, %eax movl %eax, 0x80(%r14) andl $0x0, 0x84(%r14) movups (%rbx), %xmm0 movups %xmm0, 0x88(%r14) popq %rbx popq %r14 popq %r15 retq
/rperper[P]picotls/deps/cifra/src/poly1305.c
cf_poly1305_finish
void cf_poly1305_finish(cf_poly1305 *ctx, uint8_t out[16]) { if (ctx->npartial) poly1305_last_block(ctx); uint32_t s[17]; size_t i; for (i = 0; i < 16; i++) s[i] = ctx->s[i]; s[16] = 0; poly1305_full_reduce(ctx->h); poly1305_add(ctx->h, s); for (i = 0; i < 16; i++) out[i] = ctx->h[i]; mem_clean(ctx, sizeof *ctx); }
pushq %r15 pushq %r14 pushq %rbx subq $0xa0, %rsp movq %rsi, %r14 movq %rdi, %rbx movq 0xa8(%rdi), %rax testq %rax, %rax je 0xa465 xorps %xmm0, %xmm0 movaps %xmm0, 0x30(%rsp) movaps %xmm0, 0x20(%rsp) movaps %xmm0, 0x10(%rsp) movaps %xmm0, (%rsp) andl $0x0, 0x40(%rsp) xorl %ecx, %ecx cmpq %rcx, %rax je 0xa453 movzbl 0x98(%rbx,%rcx), %edx movl %edx, (%rsp,%rcx,4) incq %rcx jmp 0xa43e movl $0x1, (%rsp,%rax,4) movq %rsp, %rsi movq %rbx, %rdi callq 0xa52c xorl %eax, %eax cmpq $0x10, %rax je 0xa47e movzbl 0x88(%rbx,%rax), %ecx movl %ecx, 0x50(%rsp,%rax,4) incq %rax jmp 0xa467 andl $0x0, 0x90(%rsp) xorl %eax, %eax cmpq $0x11, %rax je 0xa499 movl (%rbx,%rax,4), %ecx movl %ecx, (%rsp,%rax,4) incq %rax jmp 0xa488 leaq 0xf2f0(%rip), %rsi # 0x19790 movq %rsp, %r15 movq %r15, %rdi callq 0xa50d xorl %eax, %eax movl 0x40(%r15), %ecx cmpq $0x11, %rax je 0xa4ce testb %cl, %cl leaq (%rbx,%rax,4), %rdx leaq (%rsp,%rax,4), %rsi cmovsq %rdx, %rsi movl (%rsi), %esi movl %esi, (%rdx) incq %rax jmp 0xa4b1 leaq 0x50(%rsp), %rsi movq %rbx, %rdi callq 0xa50d xorl %eax, %eax cmpq $0x10, %rax je 0xa4ef movb (%rbx,%rax,4), %cl movb %cl, (%r14,%rax) incq %rax jmp 0xa4dd movl $0xb0, %edx movq %rbx, %rdi xorl %esi, %esi callq 0x61b0 movb (%rbx), %al addq $0xa0, %rsp popq %rbx popq %r14 popq %r15 retq
/rperper[P]picotls/deps/cifra/src/poly1305.c
poly1305_block
static void poly1305_block(cf_poly1305 *ctx, const uint32_t c[17]) { poly1305_add(ctx->h, c); poly1305_mul(ctx->h, ctx->r); }
pushq %rbx subq $0x50, %rsp movq %rdi, %rbx callq 0xa50d leaq 0x44(%rbx), %rax leaq 0x84(%rbx), %rcx pushq $0x1 popq %rdx xorl %esi, %esi cmpq $0x11, %rsi je 0xa5a7 xorl %r8d, %r8d movq %rax, %r9 xorl %edi, %edi cmpq %r8, %rdx je 0xa570 movl (%r9), %r10d imull (%rbx,%r8,4), %r10d addl %r10d, %edi incq %r8 addq $-0x4, %r9 jmp 0xa557 movq %rsi, %r8 movq %rcx, %r9 cmpq $0x10, %r8 je 0xa598 movl 0x4(%rbx,%r8,4), %r10d imull (%r9), %r10d imull $0x140, %r10d, %r10d # imm = 0x140 addl %r10d, %edi addq $-0x4, %r9 incq %r8 jmp 0xa576 movl %edi, (%rsp,%rsi,4) incq %rsi incq %rdx addq $0x4, %rax jmp 0xa549 xorl %ecx, %ecx xorl %eax, %eax cmpq $0x10, %rcx je 0xa5c2 addl (%rsp,%rcx,4), %eax movzbl %al, %edx movl %edx, (%rsp,%rcx,4) shrl $0x8, %eax incq %rcx jmp 0xa5ab addl 0x40(%rsp), %eax movl %eax, %ecx andl $0x3, %ecx movl %ecx, 0x40(%rsp) shrl $0x2, %eax leal (%rax,%rax,4), %eax xorl %ecx, %ecx cmpq $0x10, %rcx je 0xa5ee addl (%rsp,%rcx,4), %eax movzbl %al, %edx movl %edx, (%rsp,%rcx,4) shrl $0x8, %eax incq %rcx jmp 0xa5d7 addl %eax, 0x40(%rsp) xorl %eax, %eax cmpq $0x11, %rax je 0xa605 movl (%rsp,%rax,4), %ecx movl %ecx, (%rbx,%rax,4) incq %rax jmp 0xa5f4 addq $0x50, %rsp popq %rbx retq nop
/rperper[P]picotls/deps/cifra/src/poly1305.c
cf_sha224_init
void cf_sha224_init(cf_sha256_context *ctx) { memset(ctx, 0, sizeof *ctx); ctx->H[0] = 0xc1059ed8; ctx->H[1] = 0x367cd507; ctx->H[2] = 0x3070dd17; ctx->H[3] = 0xf70e5939; ctx->H[4] = 0xffc00b31; ctx->H[5] = 0x68581511; ctx->H[6] = 0x64f98fa7; ctx->H[7] = 0xbefa4fa4; }
xorps %xmm0, %xmm0 movups %xmm0, 0x60(%rdi) movups %xmm0, 0x50(%rdi) movups %xmm0, 0x40(%rdi) movups %xmm0, 0x30(%rdi) movups %xmm0, 0x20(%rdi) movaps 0xf1a9(%rip), %xmm0 # 0x19800 movups %xmm0, (%rdi) movaps 0xf1af(%rip), %xmm0 # 0x19810 movups %xmm0, 0x10(%rdi) retq
/rperper[P]picotls/deps/cifra/src/sha256.c
cf_sha256_digest
void cf_sha256_digest(const cf_sha256_context *ctx, uint8_t hash[CF_SHA256_HASHSZ]) { /* We copy the context, so the finalisation doesn't effect the caller's * context. This means the caller can do: * * x = init() * x.update('hello') * h1 = x.digest() * x.update(' world') * h2 = x.digest() * * to get h1 = H('hello') and h2 = H('hello world') * * This wouldn't work if we applied MD-padding to *ctx. */ cf_sha256_context ours = *ctx; cf_sha256_digest_final(&ours, hash); }
subq $0x78, %rsp movq %rsi, %rax movq %rdi, %rsi pushq $0xe popq %rcx leaq 0x8(%rsp), %rdx movq %rdx, %rdi rep movsq (%rsi), %es:(%rdi) movq %rdx, %rdi movq %rax, %rsi callq 0xa872 addq $0x78, %rsp retq
/rperper[P]picotls/deps/cifra/src/sha256.c
cf_sha512_init
void cf_sha512_init(cf_sha512_context *ctx) { memset(ctx, 0, sizeof *ctx); ctx->H[0] = UINT64_C(0x6a09e667f3bcc908); ctx->H[1] = UINT64_C(0xbb67ae8584caa73b); ctx->H[2] = UINT64_C(0x3c6ef372fe94f82b); ctx->H[3] = UINT64_C(0xa54ff53a5f1d36f1); ctx->H[4] = UINT64_C(0x510e527fade682d1); ctx->H[5] = UINT64_C(0x9b05688c2b3e6c1f); ctx->H[6] = UINT64_C(0x1f83d9abfb41bd6b); ctx->H[7] = UINT64_C(0x5be0cd19137e2179); }
pushq %rbx movq %rdi, %rbx addq $0x40, %rdi movl $0x90, %edx xorl %esi, %esi callq 0x61b0 movabsq $0x6a09e667f3bcc908, %rax # imm = 0x6A09E667F3BCC908 movq %rax, (%rbx) movabsq $-0x4498517a7b3558c5, %rax # imm = 0xBB67AE8584CAA73B movq %rax, 0x8(%rbx) movabsq $0x3c6ef372fe94f82b, %rax # imm = 0x3C6EF372FE94F82B movq %rax, 0x10(%rbx) movabsq $-0x5ab00ac5a0e2c90f, %rax # imm = 0xA54FF53A5F1D36F1 movq %rax, 0x18(%rbx) movabsq $0x510e527fade682d1, %rax # imm = 0x510E527FADE682D1 movq %rax, 0x20(%rbx) movabsq $-0x64fa9773d4c193e1, %rax # imm = 0x9B05688C2B3E6C1F movq %rax, 0x28(%rbx) movabsq $0x1f83d9abfb41bd6b, %rax # imm = 0x1F83D9ABFB41BD6B movq %rax, 0x30(%rbx) movabsq $0x5be0cd19137e2179, %rax # imm = 0x5BE0CD19137E2179 movq %rax, 0x38(%rbx) popq %rbx retq
/rperper[P]picotls/deps/cifra/src/sha512.c
sha512_update_block
static void sha512_update_block(void *vctx, const uint8_t *inp) { cf_sha512_context *ctx = vctx; uint64_t W[16]; uint64_t a = ctx->H[0], b = ctx->H[1], c = ctx->H[2], d = ctx->H[3], e = ctx->H[4], f = ctx->H[5], g = ctx->H[6], h = ctx->H[7], Wt; size_t t; for (t = 0; t < 80; t++) { if (t < 16) { W[t] = Wt = read64_be(inp); inp += 8; } else { Wt = SSIG1(W[(t - 2) % 16]) + W[(t - 7) % 16] + SSIG0(W[(t - 15) % 16]) + W[(t - 16) % 16]; W[t % 16] = Wt; } uint64_t T1 = h + BSIG1(e) + CH(e, f, g) + K[t] + Wt; uint64_t T2 = BSIG0(a) + MAJ(a, b, c); h = g; g = f; f = e; e = d + T1; d = c; c = b; b = a; a = T1 + T2; } ctx->H[0] += a; ctx->H[1] += b; ctx->H[2] += c; ctx->H[3] += d; ctx->H[4] += e; ctx->H[5] += f; ctx->H[6] += g; ctx->H[7] += h; ctx->blocks++; }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0xf8, %rsp movq %rsi, %r9 movq (%rdi), %rbx movq 0x8(%rdi), %rcx movq 0x10(%rdi), %r8 movq 0x18(%rdi), %rsi movq 0x20(%rdi), %rdx movq 0x28(%rdi), %rbp movq 0x30(%rdi), %rax movq %rdi, 0x40(%rsp) movq 0x38(%rdi), %r12 xorl %r13d, %r13d movq %rcx, 0x8(%rsp) movq %r8, 0x10(%rsp) movq %r8, %r14 movq %rsi, 0x18(%rsp) movq %rsi, %r11 movq %rdx, 0x20(%rsp) movq %rbp, 0x28(%rsp) movq %rax, 0x30(%rsp) movq %rax, %r10 movq %r12, 0x38(%rsp) movq %rbx, (%rsp) movq %r10, %r15 movq %rbp, %r10 movq %rdx, %rbp movq %r14, %rdx movq %rcx, %r14 cmpq $0x50, %r13 je 0xad09 movq %rdx, 0x68(%rsp) cmpq $0xf, %r13 ja 0xac17 movq %r9, %rdi movq %r14, 0x50(%rsp) movq %r9, %r14 movq %r10, 0x60(%rsp) movq %r11, 0x58(%rsp) callq 0xaf94 movq %r15, 0x48(%rsp) movl %eax, %r15d leaq 0x4(%r14), %rdi callq 0xaf94 movq 0x58(%rsp), %r11 movq 0x60(%rsp), %r10 movq %r14, %r9 movq 0x50(%rsp), %r14 shlq $0x20, %r15 movl %eax, %ecx orq %r15, %rcx movq 0x48(%rsp), %r15 movq %rcx, 0x70(%rsp,%r13,8) addq $0x8, %r9 leaq 0x1(%r13), %rax jmp 0xac7f leal 0xe(%r13), %eax andl $0xf, %eax movq 0x70(%rsp,%rax,8), %rcx movq %rcx, %rax rolq $0x2d, %rax movq %rcx, %rdx rolq $0x3, %rdx xorq %rax, %rdx shrq $0x6, %rcx xorq %rdx, %rcx leal 0x9(%r13), %eax andl $0xf, %eax addq 0x70(%rsp,%rax,8), %rcx leaq 0x1(%r13), %rax movl %eax, %edx andl $0xf, %edx movq 0x70(%rsp,%rdx,8), %rdx movq %rdx, %rsi rorq %rsi movq %rdx, %rdi rolq $0x38, %rdi xorq %rsi, %rdi shrq $0x7, %rdx xorq %rdi, %rdx movl %r13d, %esi andl $0xf, %esi addq 0x70(%rsp,%rsi,8), %rcx addq %rdx, %rcx movq %rcx, 0x70(%rsp,%rsi,8) movq %rbp, %rdx rolq $0x32, %rdx movq %rbp, %rsi rolq $0x2e, %rsi xorq %rdx, %rsi movq %rbp, %rdx rolq $0x17, %rdx xorq %rsi, %rdx movq %r10, %rsi xorq %r15, %rsi andq %rbp, %rsi xorq %r15, %rsi addq %rsi, %r12 addq %rdx, %r12 addq %rcx, %r12 leaq 0xec6a(%rip), %rcx # 0x19920 addq (%rcx,%r13,8), %r12 movq %rbx, %rdx movq %rbx, %rsi movq 0x68(%rsp), %r13 movq %r13, %rdi xorq %r14, %rdi andq %rbx, %rdi movq %rbx, %r8 rolq $0x24, %r8 rolq $0x1e, %rdx movq %rbx, %rcx xorq %r8, %rdx rolq $0x19, %rsi xorq %rdx, %rsi movq %r13, %rbx andq %r14, %rbx xorq %rdi, %rbx addq %rsi, %rbx movq %r11, %rdx addq %r12, %rdx addq %r12, %rbx movq %r13, %r11 movq %r15, %r12 movq %rax, %r13 jmp 0xab99 addq (%rsp), %rbx movq 0x40(%rsp), %rax movq %rbx, (%rax) addq 0x8(%rsp), %r14 movq %r14, 0x8(%rax) addq 0x10(%rsp), %rdx movq %rdx, 0x10(%rax) addq 0x18(%rsp), %r11 movq %r11, 0x18(%rax) addq 0x20(%rsp), %rbp movq %rbp, 0x20(%rax) addq 0x28(%rsp), %r10 movq %r10, 0x28(%rax) addq 0x30(%rsp), %r15 movq %r15, 0x30(%rax) addq 0x38(%rsp), %r12 movq %r12, 0x38(%rax) incl 0xc0(%rax) addq $0xf8, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq
/rperper[P]picotls/deps/cifra/src/sha512.c
cf_sha512_digest_final
void cf_sha512_digest_final(cf_sha512_context *ctx, uint8_t hash[CF_SHA512_HASHSZ]) { uint64_t digested_bytes = ctx->blocks; digested_bytes = digested_bytes * CF_SHA512_BLOCKSZ + ctx->npartial; uint64_t digested_bits = digested_bytes * 8; size_t padbytes = CF_SHA512_BLOCKSZ - ((digested_bytes + 16) % CF_SHA512_BLOCKSZ); /* Hash 0x80 00 ... block first. */ cf_blockwise_acc_pad(ctx->partial, &ctx->npartial, sizeof ctx->partial, 0x80, 0x00, 0x00, padbytes, sha512_update_block, ctx); /* Now hash length (this is 128 bits long). */ uint8_t buf[8]; write64_be(0, buf); cf_sha512_update(ctx, buf, 8); write64_be(digested_bits, buf); cf_sha512_update(ctx, buf, 8); /* We ought to have got our padding calculation right! */ assert(ctx->npartial == 0); write64_be(ctx->H[0], hash + 0); write64_be(ctx->H[1], hash + 8); write64_be(ctx->H[2], hash + 16); write64_be(ctx->H[3], hash + 24); write64_be(ctx->H[4], hash + 32); write64_be(ctx->H[5], hash + 40); write64_be(ctx->H[6], hash + 48); write64_be(ctx->H[7], hash + 56); memset(ctx, 0, sizeof *ctx); }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx pushq %rax movq %rsi, %r14 movq %rdi, %rbx movl 0xc0(%rdi), %eax leaq 0xc8(%rdi), %rsi movq 0xc8(%rdi), %rcx shlq $0xa, %rax leaq (,%rcx,8), %r13 leaq (%rax,%rcx,8), %rbp addl $0x10, %ecx andl $0x7f, %ecx movl $0x80, %eax subq %rcx, %rax addq $0x40, %rdi subq $0x8, %rsp leaq -0x2cd(%rip), %r10 # 0xab2e movl $0x80, %edx movl $0x80, %ecx xorl %r8d, %r8d xorl %r9d, %r9d pushq %rbx pushq %r10 pushq %rax callq 0xb23f addq $0x20, %rsp movq %rsp, %r15 andq $0x0, (%r15) pushq $0x8 popq %r12 movq %rbx, %rdi movq %r15, %rsi movq %r12, %rdx callq 0xab02 movq %rbp, %rcx movq %rbp, %rax shrq $0x38, %rax movb %al, (%r15) movq %rbp, %rax shrq $0x30, %rax movb %al, 0x1(%r15) movq %rbp, %rax shrq $0x28, %rax movb %al, 0x2(%r15) movq %rbp, %rax shrq $0x20, %rax movb %al, 0x3(%r15) movl %ebp, %eax shrl $0x18, %eax movb %al, 0x4(%r15) movl %ebp, %eax shrl $0x10, %eax movb %al, 0x5(%r15) movb %ch, 0x6(%rsp) movb %r13b, 0x7(%r15) movq %rbx, %rdi movq %r15, %rsi movq %r12, %rdx callq 0xab02 cmpq $0x0, 0xc8(%rbx) jne 0xaf1c movq (%rbx), %rdi movq %r14, %rsi callq 0xaf21 movq 0x8(%rbx), %rdi leaq 0x8(%r14), %rsi callq 0xaf21 movq 0x10(%rbx), %rdi leaq 0x10(%r14), %rsi callq 0xaf21 movq 0x18(%rbx), %rdi leaq 0x18(%r14), %rsi callq 0xaf21 movq 0x20(%rbx), %rdi leaq 0x20(%r14), %rsi callq 0xaf21 movq 0x28(%rbx), %rdi leaq 0x28(%r14), %rsi callq 0xaf21 movq 0x30(%rbx), %rdi leaq 0x30(%r14), %rsi callq 0xaf21 movq 0x38(%rbx), %rdi addq $0x38, %r14 movq %r14, %rsi callq 0xaf21 movl $0xd0, %edx movq %rbx, %rdi xorl %esi, %esi callq 0x61b0 addq $0x8, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq callq 0x61c0
/rperper[P]picotls/deps/cifra/src/sha512.c
cf_blockwise_accumulate_final
void cf_blockwise_accumulate_final(uint8_t *partial, size_t *npartial, size_t nblock, const void *inp, size_t nbytes, cf_blockwise_in_fn process, cf_blockwise_in_fn process_final, void *ctx) { const uint8_t *bufin = inp; assert(partial && *npartial < nblock); assert(inp || !nbytes); assert(process && ctx); /* If we have partial data, copy in to buffer. */ if (*npartial && nbytes) { size_t space = nblock - *npartial; size_t taken = MIN(space, nbytes); memcpy(partial + *npartial, bufin, taken); bufin += taken; nbytes -= taken; *npartial += taken; /* If that gives us a full block, process it. */ if (*npartial == nblock) { if (nbytes == 0) process_final(ctx, partial); else process(ctx, partial); *npartial = 0; } } /* now nbytes < nblock or *npartial == 0. */ /* If we have a full block of data, process it directly. */ while (nbytes >= nblock) { /* Partial buffer must be empty, or we're ignoring extant data */ assert(*npartial == 0); if (nbytes == nblock) process_final(ctx, bufin); else process(ctx, bufin); bufin += nblock; nbytes -= nblock; } /* Finally, if we have remaining data, buffer it. */ while (nbytes) { size_t space = nblock - *npartial; size_t taken = MIN(space, nbytes); memcpy(partial + *npartial, bufin, taken); bufin += taken; nbytes -= taken; *npartial += taken; /* If we started with *npartial, we must have copied it * in first. */ assert(*npartial < nblock); } }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx pushq %rax testq %rdi, %rdi je 0xb0d1 movq %rdx, %r15 movq %rsi, %r12 movq %rdi, %r13 movq (%rsi), %rdi subq %rdi, %rdx jbe 0xb0d1 movq %r8, %rbx movq %rcx, %r14 testq %rcx, %rcx setne %al testq %r8, %r8 sete %cl orb %al, %cl je 0xb0d1 movq %r9, %rbp testq %r9, %r9 je 0xb0d1 cmpq $0x0, 0x48(%rsp) je 0xb0d1 testq %rbx, %rbx sete %al testq %rdi, %rdi sete %cl orb %al, %cl jne 0xb081 cmpq %rbx, %rdx cmovaeq %rbx, %rdx addq %r13, %rdi movq %r14, %rsi movq %rdx, (%rsp) callq 0x6320 movq (%rsp), %rax addq %rax, %r14 subq %rax, %rbx addq (%r12), %rax movq %rax, (%r12) cmpq %r15, %rax jne 0xb081 testq %rbx, %rbx movq %rbp, %rax cmoveq 0x40(%rsp), %rax movq 0x48(%rsp), %rdi movq %r13, %rsi callq *%rax andq $0x0, (%r12) jmp 0xb081 cmpq $0x0, (%r12) jne 0xb0d1 subq %r15, %rbx movq %rbp, %rax cmoveq 0x40(%rsp), %rax movq 0x48(%rsp), %rdi movq %r14, %rsi callq *%rax addq %r15, %r14 cmpq %r15, %rbx jae 0xb061 jmp 0xb0bd movq (%r12), %rdi movq %r15, %rbp subq %rdi, %rbp cmpq %rbx, %rbp cmovaeq %rbx, %rbp addq %r13, %rdi movq %r14, %rsi movq %rbp, %rdx callq 0x6320 movq (%r12), %rax addq %rbp, %rax movq %rax, (%r12) cmpq %r15, %rax jae 0xb0d1 subq %rbp, %rbx addq %rbp, %r14 testq %rbx, %rbx jne 0xb088 addq $0x8, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq callq 0x61c0
/rperper[P]picotls/deps/cifra/src/blockwise.c
cf_hash
void cf_hash(const cf_chash *h, const void *m, size_t nm, uint8_t *out) { cf_chash_ctx ctx; assert(h); h->init(&ctx); h->update(&ctx, m, nm); h->digest(&ctx, out); mem_clean(&ctx, sizeof ctx); }
pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x170, %rsp # imm = 0x170 testq %rdi, %rdi je 0xb3f0 movq %rcx, %rbx movq %rdx, %r15 movq %rsi, %r12 movq %rdi, %r14 leaq 0x8(%rsp), %r13 movq %r13, %rdi callq *0x10(%r14) movq %r13, %rdi movq %r12, %rsi movq %r15, %rdx callq *0x18(%r14) movq %r13, %rdi movq %rbx, %rsi callq *0x20(%r14) movl $0x168, %edx # imm = 0x168 movq %r13, %rdi xorl %esi, %esi callq 0x61b0 movb (%r13), %al addq $0x170, %rsp # imm = 0x170 popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 retq callq 0x61c0 nopl (%rax)
/rperper[P]picotls/deps/cifra/src/chash.c
ptls_openssl_init_sign_certificate
int ptls_openssl_init_sign_certificate(ptls_openssl_sign_certificate_t *self, EVP_PKEY *key) { *self = (ptls_openssl_sign_certificate_t){{sign_certificate}}; size_t scheme_index = 0; #define PUSH_SCHEME(id, md) \ self->schemes[scheme_index++] = (struct st_ptls_openssl_signature_scheme_t) \ { \ id, md \ } switch (EVP_PKEY_id(key)) { case EVP_PKEY_RSA: PUSH_SCHEME(PTLS_SIGNATURE_RSA_PSS_RSAE_SHA256, EVP_sha256()); PUSH_SCHEME(PTLS_SIGNATURE_RSA_PSS_RSAE_SHA384, EVP_sha384()); PUSH_SCHEME(PTLS_SIGNATURE_RSA_PSS_RSAE_SHA512, EVP_sha512()); break; case EVP_PKEY_EC: { EC_KEY *eckey = EVP_PKEY_get1_EC_KEY(key); switch (EC_GROUP_get_curve_name(EC_KEY_get0_group(eckey))) { case NID_X9_62_prime256v1: PUSH_SCHEME(PTLS_SIGNATURE_ECDSA_SECP256R1_SHA256, EVP_sha256()); break; #if defined(NID_secp384r1) && !OPENSSL_NO_SHA384 case NID_secp384r1: PUSH_SCHEME(PTLS_SIGNATURE_ECDSA_SECP384R1_SHA384, EVP_sha384()); break; #endif #if defined(NID_secp384r1) && !OPENSSL_NO_SHA512 case NID_secp521r1: PUSH_SCHEME(PTLS_SIGNATURE_ECDSA_SECP521R1_SHA512, EVP_sha512()); break; #endif default: EC_KEY_free(eckey); return PTLS_ERROR_INCOMPATIBLE_KEY; } EC_KEY_free(eckey); } break; default: return PTLS_ERROR_INCOMPATIBLE_KEY; } PUSH_SCHEME(UINT16_MAX, NULL); assert(scheme_index <= sizeof(self->schemes) / sizeof(self->schemes[0])); #undef PUSH_SCHEME EVP_PKEY_up_ref(key); self->key = key; return 0; }
pushq %rbp pushq %r15 pushq %r14 pushq %rbx pushq %rax movq %rsi, %rbx movq %rdi, %r14 leaq 0x108(%rip), %rax # 0xb6a3 movq %rax, (%rdi) xorps %xmm0, %xmm0 movups %xmm0, 0x8(%rdi) movups %xmm0, 0x18(%rdi) movups %xmm0, 0x28(%rdi) movups %xmm0, 0x38(%rdi) andq $0x0, 0x48(%rdi) movq %rsi, %rdi callq 0x6360 movl $0x204, %ebp # imm = 0x204 cmpl $0x198, %eax # imm = 0x198 je 0xb607 cmpl $0x6, %eax jne 0xb68c callq 0x6750 movw $0x804, 0x10(%r14) # imm = 0x804 movq %rax, 0x18(%r14) callq 0x6530 movw $0x805, 0x20(%r14) # imm = 0x805 movq %rax, 0x28(%r14) callq 0x6510 movw $0x806, 0x30(%r14) # imm = 0x806 movq %rax, 0x38(%r14) pushq $0x3 jmp 0xb66d movq %rbx, %rdi callq 0x6690 movq %rax, %r15 movq %rax, %rdi callq 0x63e0 movq %rax, %rdi callq 0x6120 cmpl $0x2cc, %eax # imm = 0x2CC je 0xb653 cmpl $0x2cb, %eax # imm = 0x2CB je 0xb645 cmpl $0x19f, %eax # imm = 0x19F jne 0xb699 callq 0x6750 movw $0x403, 0x10(%r14) # imm = 0x403 jmp 0xb65f callq 0x6530 movw $0x503, 0x10(%r14) # imm = 0x503 jmp 0xb65f callq 0x6510 movw $0x603, 0x10(%r14) # imm = 0x603 movq %rax, 0x18(%r14) movq %r15, %rdi callq 0x67a0 pushq $0x1 popq %rax shll $0x4, %eax orw $-0x1, 0x10(%r14,%rax) andq $0x0, 0x18(%r14,%rax) movq %rbx, %rdi callq 0x67d0 movq %rbx, 0x8(%r14) xorl %ebp, %ebp movl %ebp, %eax addq $0x8, %rsp popq %rbx popq %r14 popq %r15 popq %rbp retq movq %r15, %rdi callq 0x67a0 jmp 0xb68c
/rperper[P]picotls/lib/openssl.c
secp_key_exchange
static int secp_key_exchange(ptls_key_exchange_algorithm_t *algo, ptls_iovec_t *pubkey, ptls_iovec_t *secret, ptls_iovec_t peerkey) { EC_GROUP *group = NULL; BN_CTX *bn_ctx = NULL; int ret; if ((group = EC_GROUP_new_by_curve_name((int)algo->data)) == NULL) { ret = PTLS_ERROR_LIBRARY; goto Exit; } if ((bn_ctx = BN_CTX_new()) == NULL) { ret = PTLS_ERROR_NO_MEMORY; goto Exit; } ret = x9_62_key_exchange(group, pubkey, secret, peerkey, bn_ctx); Exit: if (bn_ctx != NULL) BN_CTX_free(bn_ctx); if (group != NULL) EC_GROUP_free(group); return ret; }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x18, %rsp movq %r8, %r13 movq %rcx, %rbp movq %rdx, %r14 movq %rsi, %r15 movl 0x18(%rdi), %edi callq 0x6710 testq %rax, %rax je 0xc207 movq %rax, %rbx callq 0x6240 testq %rax, %rax je 0xc20e movq %rax, %r12 xorps %xmm0, %xmm0 movups %xmm0, (%r15) movups %xmm0, (%r14) movq %rbx, %rdi movq %rbp, %rsi movq %r13, %rdx movq %rax, %rcx callq 0xc816 testq %rax, %rax je 0xc23e movq %rax, 0x10(%rsp) movq %rbx, %rdi callq 0xcbd7 movq %rax, %r13 movl $0x201, %ebp # imm = 0x201 testq %rax, %rax je 0xc215 movq %r13, %rdi callq 0x6250 movq %rbx, %rdi movq %rax, %rsi movq %r12, %rdx callq 0xc867 movq %rax, (%r15) movq %rdx, 0x8(%r15) testq %rax, %rax je 0xc215 movq %rbx, %rdi callq 0x6500 addl $0x7, %eax pushq $0x8 popq %rcx cltd idivl %ecx movslq %eax, %rdi movq %rdi, 0x8(%r14) movq %rdi, 0x8(%rsp) callq 0x6550 movq %rax, (%r14) testq %rax, %rax je 0xc215 movq %rax, %rdi movq 0x8(%rsp), %rsi movq 0x10(%rsp), %rdx movq %r13, %rcx xorl %r8d, %r8d callq 0x66f0 testl %eax, %eax pushq $0x28 popq %rbp movl $0x0, %eax cmovgl %eax, %ebp setg %al movq %rax, 0x8(%rsp) jmp 0xc21e movl $0x203, %ebp # imm = 0x203 jmp 0xc26f movl $0x201, %ebp # imm = 0x201 jmp 0xc267 movq $0x0, 0x8(%rsp) movq 0x10(%rsp), %rdi callq 0x65a0 testq %r13, %r13 je 0xc235 movq %r13, %rdi callq 0x67a0 cmpb $0x0, 0x8(%rsp) je 0xc241 jmp 0xc25f pushq $0x32 popq %rbp movq (%r15), %rdi callq 0x6490 xorps %xmm0, %xmm0 movups %xmm0, (%r15) movq (%r14), %rdi callq 0x6490 xorps %xmm0, %xmm0 movups %xmm0, (%r14) movq %r12, %rdi callq 0x65c0 movq %rbx, %rdi callq 0x6390 movl %ebp, %eax addq $0x18, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq
/rperper[P]picotls/lib/openssl.c
sha384_create
static int sign_certificate(ptls_sign_certificate_t *_self, ptls_t *tls, uint16_t *selected_algorithm, ptls_buffer_t *outbuf, ptls_iovec_t input, const uint16_t *algorithms, size_t num_algorithms) { ptls_openssl_sign_certificate_t *self = (ptls_openssl_sign_certificate_t *)_self; const struct st_ptls_openssl_signature_scheme_t *scheme; /* select the algorithm */ for (scheme = self->schemes; scheme->scheme_id != UINT16_MAX; ++scheme) { size_t i; for (i = 0; i != num_algorithms; ++i) if (algorithms[i] == scheme->scheme_id) goto Found; } return PTLS_ALERT_HANDSHAKE_FAILURE; Found: *selected_algorithm = scheme->scheme_id; return do_sign(self->key, outbuf, input, scheme->scheme_md); }
pushq %rbx movl $0xf0, %edi callq 0x6550 movq %rax, %rbx testq %rax, %rax je 0xc5af leaq 0xca1(%rip), %rax # 0xd22b movq %rax, (%rbx) leaq 0xca0(%rip), %rax # 0xd234 movq %rax, 0x8(%rbx) leaq 0xd6f(%rip), %rax # 0xd30e movq %rax, 0x10(%rbx) movq %rbx, %rdi addq $0x18, %rdi callq 0x6480 movq %rbx, %rax popq %rbx retq
/rperper[P]picotls/lib/openssl.c
x9_62_decode_point
static EC_POINT *x9_62_decode_point(const EC_GROUP *group, ptls_iovec_t vec, BN_CTX *bn_ctx) { EC_POINT *point = NULL; if ((point = EC_POINT_new(group)) == NULL) return NULL; if (!EC_POINT_oct2point(group, point, vec.base, vec.len, bn_ctx)) { EC_POINT_free(point); return NULL; } return point; }
pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx movq %rcx, %r14 movq %rdx, %r15 movq %rsi, %r12 movq %rdi, %r13 callq 0x6780 testq %rax, %rax je 0xc858 movq %rax, %rbx movq %r13, %rdi movq %rax, %rsi movq %r12, %rdx movq %r15, %rcx movq %r14, %r8 callq 0x6700 testl %eax, %eax jne 0xc85a movq %rbx, %rdi callq 0x65a0 xorl %ebx, %ebx movq %rbx, %rax popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 retq
/rperper[P]picotls/lib/openssl.c
aead_do_encrypt_final
static size_t aead_do_encrypt_final(ptls_aead_context_t *_ctx, void *_output) { struct aead_crypto_context_t *ctx = (struct aead_crypto_context_t *)_ctx; uint8_t *output = _output; size_t off = 0, tag_size = ctx->super.algo->tag_size; int blocklen, ret; ret = EVP_EncryptFinal_ex(ctx->evp_ctx, output + off, &blocklen); assert(ret); off += blocklen; ret = EVP_CIPHER_CTX_ctrl(ctx->evp_ctx, EVP_CTRL_GCM_GET_TAG, (int)tag_size, output + off); assert(ret); off += tag_size; return off; }
pushq %r15 pushq %r14 pushq %r12 pushq %rbx pushq %rax movq %rsi, %r14 movq %rdi, %r15 movq (%rdi), %rax movq 0x28(%rax), %rbx movq 0x40(%rdi), %rdi leaq 0x4(%rsp), %rdx callq 0x6670 testl %eax, %eax je 0xcfc5 movslq 0x4(%rsp), %r12 movq 0x40(%r15), %rdi addq %r12, %r14 pushq $0x10 popq %rsi movl %ebx, %edx movq %r14, %rcx callq 0x6610 testl %eax, %eax je 0xcfe4 addq %r12, %rbx movq %rbx, %rax addq $0x8, %rsp popq %rbx popq %r12 popq %r14 popq %r15 retq leaq 0xcfce(%rip), %rdi # 0x19f9a leaq 0xcc20(%rip), %rsi # 0x19bf3 leaq 0xd14e(%rip), %rcx # 0x1a128 movl $0x3a2, %edx # imm = 0x3A2 callq 0x6260 leaq 0xcfaf(%rip), %rdi # 0x19f9a leaq 0xcc01(%rip), %rsi # 0x19bf3 leaq 0xd12f(%rip), %rcx # 0x1a128 movl $0x3a5, %edx # imm = 0x3A5 callq 0x6260
/rperper[P]picotls/lib/openssl.c
aead_do_decrypt
static size_t aead_do_decrypt(ptls_aead_context_t *_ctx, void *_output, const void *input, size_t inlen, const void *iv, const void *aad, size_t aadlen) { struct aead_crypto_context_t *ctx = (struct aead_crypto_context_t *)_ctx; uint8_t *output = _output; size_t off = 0, tag_size = ctx->super.algo->tag_size; int blocklen, ret; if (inlen < tag_size) return SIZE_MAX; ret = EVP_DecryptInit_ex(ctx->evp_ctx, NULL, NULL, NULL, iv); assert(ret); if (aadlen != 0) { ret = EVP_DecryptUpdate(ctx->evp_ctx, NULL, &blocklen, aad, (int)aadlen); assert(ret); } ret = EVP_DecryptUpdate(ctx->evp_ctx, output + off, &blocklen, input, (int)(inlen - tag_size)); assert(ret); off += blocklen; if (!EVP_CIPHER_CTX_ctrl(ctx->evp_ctx, EVP_CTRL_GCM_SET_TAG, (int)tag_size, (void *)((uint8_t *)input + inlen - tag_size))) return SIZE_MAX; if (!EVP_DecryptFinal_ex(ctx->evp_ctx, output + off, &blocklen)) return SIZE_MAX; off += blocklen; return off; }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx pushq %rax movq (%rdi), %rax movq 0x28(%rax), %r13 pushq $-0x1 popq %rax cmpq %r13, %rcx jb 0xd0d3 movq %r9, %rbx movq %rcx, %rbp movq %rdx, %r12 movq %rsi, %r14 movq %rdi, %r15 movq 0x40(%rdi), %rdi xorl %esi, %esi xorl %edx, %edx xorl %ecx, %ecx callq 0x60a0 testl %eax, %eax je 0xd0e2 movq 0x40(%rsp), %r8 testq %r8, %r8 je 0xd06c movq 0x40(%r15), %rdi leaq 0x4(%rsp), %rdx xorl %esi, %esi movq %rbx, %rcx callq 0x61f0 testl %eax, %eax je 0xd120 movq 0x40(%r15), %rdi movl %ebp, %r8d subl %r13d, %r8d leaq 0x4(%rsp), %rdx movq %r14, %rsi movq %r12, %rcx callq 0x61f0 testl %eax, %eax je 0xd101 movslq 0x4(%rsp), %rbx movq 0x40(%r15), %rdi addq %rbp, %r12 subq %r13, %r12 pushq $0x11 popq %rsi movl %r13d, %edx movq %r12, %rcx callq 0x6610 testl %eax, %eax je 0xd0d0 movq 0x40(%r15), %rdi addq %rbx, %r14 leaq 0x4(%rsp), %rdx movq %r14, %rsi callq 0x6100 testl %eax, %eax pushq $-0x1 popq %rax je 0xd0d3 movslq 0x4(%rsp), %rax addq %rbx, %rax jmp 0xd0d3 pushq $-0x1 popq %rax addq $0x8, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq leaq 0xceb1(%rip), %rdi # 0x19f9a leaq 0xcb03(%rip), %rsi # 0x19bf3 leaq 0xd06d(%rip), %rcx # 0x1a164 movl $0x3b7, %edx # imm = 0x3B7 callq 0x6260 leaq 0xce92(%rip), %rdi # 0x19f9a leaq 0xcae4(%rip), %rsi # 0x19bf3 leaq 0xd04e(%rip), %rcx # 0x1a164 movl $0x3bd, %edx # imm = 0x3BD callq 0x6260 leaq 0xce73(%rip), %rdi # 0x19f9a leaq 0xcac5(%rip), %rsi # 0x19bf3 leaq 0xd02f(%rip), %rcx # 0x1a164 movl $0x3ba, %edx # imm = 0x3BA callq 0x6260
/rperper[P]picotls/lib/openssl.c
sha384_clone
static int sign_certificate(ptls_sign_certificate_t *_self, ptls_t *tls, uint16_t *selected_algorithm, ptls_buffer_t *outbuf, ptls_iovec_t input, const uint16_t *algorithms, size_t num_algorithms) { ptls_openssl_sign_certificate_t *self = (ptls_openssl_sign_certificate_t *)_self; const struct st_ptls_openssl_signature_scheme_t *scheme; /* select the algorithm */ for (scheme = self->schemes; scheme->scheme_id != UINT16_MAX; ++scheme) { size_t i; for (i = 0; i != num_algorithms; ++i) if (algorithms[i] == scheme->scheme_id) goto Found; } return PTLS_ALERT_HANDSHAKE_FAILURE; Found: *selected_algorithm = scheme->scheme_id; return do_sign(self->key, outbuf, input, scheme->scheme_md); }
pushq %rbx movq %rdi, %rbx movl $0xf0, %edi callq 0x6550 testq %rax, %rax je 0xd332 movl $0xf0, %edx movq %rax, %rdi movq %rbx, %rsi popq %rbx jmp 0x6320 popq %rbx retq
/rperper[P]picotls/lib/openssl.c
ptls_buffer__do_pushv
int ptls_buffer__do_pushv(ptls_buffer_t *buf, const void *src, size_t len) { int ret; if (len == 0) return 0; if ((ret = ptls_buffer_reserve(buf, len)) != 0) return ret; memcpy(buf->base + buf->off, src, len); buf->off += len; return 0; }
xorl %eax, %eax testq %rdx, %rdx je 0xd423 pushq %r15 pushq %r14 pushq %rbx movq %rdx, %rbx movq %rsi, %r15 movq %rdi, %r14 movq %rdx, %rsi callq 0xd359 testl %eax, %eax jne 0xd41e movq (%r14), %rdi addq 0x10(%r14), %rdi movq %r15, %rsi movq %rbx, %rdx callq 0x6320 addq %rbx, 0x10(%r14) xorl %eax, %eax popq %rbx popq %r14 popq %r15 retq
/rperper[P]picotls/lib/picotls.c
ptls_new
ptls_t *ptls_new(ptls_context_t *ctx, int is_server) { ptls_t *tls; assert(ctx->get_time != NULL && "please set ctx->get_time to `&ptls_get_time`; see #92"); if ((tls = malloc(sizeof(*tls))) == NULL) return NULL; update_open_count(ctx, 1); *tls = (ptls_t){ctx}; tls->is_server = is_server; tls->send_change_cipher_spec = ctx->send_change_cipher_spec; if (!is_server) { tls->state = PTLS_STATE_CLIENT_HANDSHAKE_START; tls->ctx->random_bytes(tls->client_random, sizeof(tls->client_random)); tls->ctx->random_bytes(tls->client.legacy_session_id, sizeof(tls->client.legacy_session_id)); } else { tls->state = PTLS_STATE_SERVER_EXPECT_CLIENT_HELLO; tls->server.early_data_skipped_bytes = UINT32_MAX; } return tls; }
pushq %rbp pushq %r15 pushq %r14 pushq %rbx pushq %rax cmpq $0x0, 0x8(%rdi) je 0xdac3 movl %esi, %ebp movq %rdi, %r14 movl $0x218, %edi # imm = 0x218 callq 0x6550 movq %rax, %rbx testq %rax, %rax je 0xdab5 movq 0x88(%r14), %rdi testq %rdi, %rdi je 0xda4d pushq $0x1 popq %rsi callq *(%rdi) leaq 0x8(%rbx), %rdi movl $0x210, %edx # imm = 0x210 xorl %esi, %esi callq 0x61b0 movq %r14, (%rbx) movb 0x160(%rbx), %al movl %ebp, %ecx andb $0x1, %cl andb $-0x6, %al orb %cl, %al movb 0x68(%r14), %cl andb $0x4, %cl orb %al, %cl movb %cl, 0x160(%rbx) testl %ebp, %ebp je 0xda92 movl $0x8, 0x8(%rbx) orl $-0x1, 0x1d0(%rbx) jmp 0xdab5 leaq 0x128(%rbx), %rdi pushq $0x20 popq %r15 movq %r15, %rsi callq *(%r14) movq (%rbx), %rax movq %rbx, %rdi addq $0x190, %rdi # imm = 0x190 movq %r15, %rsi callq *(%rax) movq %rbx, %rax addq $0x8, %rsp popq %rbx popq %r14 popq %r15 popq %rbp retq leaq 0xc85e(%rip), %rdi # 0x1a328 leaq 0xc8a8(%rip), %rsi # 0x1a379 leaq 0xc8f3(%rip), %rcx # 0x1a3cb movl $0x1039, %edx # imm = 0x1039 callq 0x6260
/rperper[P]picotls/lib/picotls.c
send_client_hello
static int send_client_hello(ptls_t *tls, ptls_message_emitter_t *emitter, ptls_handshake_properties_t *properties, ptls_iovec_t *cookie) { ptls_iovec_t resumption_secret = {NULL}, resumption_ticket; uint32_t obfuscated_ticket_age = 0; size_t msghash_off; uint8_t binder_key[PTLS_MAX_DIGEST_SIZE]; int ret, is_second_flight = tls->key_schedule != NULL, send_sni = tls->server_name != NULL && !ptls_server_name_is_ipaddr(tls->server_name); if (properties != NULL) { /* try to use ESNI */ if (!is_second_flight && send_sni && properties->client.esni_keys.base != NULL) { if ((ret = client_setup_esni(tls->ctx, &tls->esni, properties->client.esni_keys, tls->client_random)) != 0) goto Exit; if (tls->ctx->update_esni_key != NULL) { if ((ret = tls->ctx->update_esni_key->cb(tls->ctx->update_esni_key, tls, tls->esni->secret, tls->esni->client.cipher->hash, tls->esni->esni_contents_hash)) != 0) goto Exit; } } /* setup resumption-related data. If successful, resumption_secret becomes a non-zero value. */ if (properties->client.session_ticket.base != NULL) { ptls_key_exchange_algorithm_t *key_share = NULL; ptls_cipher_suite_t *cipher_suite = NULL; uint32_t max_early_data_size; if (decode_stored_session_ticket(tls, &key_share, &cipher_suite, &resumption_secret, &obfuscated_ticket_age, &resumption_ticket, &max_early_data_size, properties->client.session_ticket.base, properties->client.session_ticket.base + properties->client.session_ticket.len) == 0) { tls->client.offered_psk = 1; /* key-share selected by HRR should not be overridden */ if (tls->key_share == NULL) tls->key_share = key_share; tls->cipher_suite = cipher_suite; if (!is_second_flight && max_early_data_size != 0 && properties->client.max_early_data_size != NULL) { tls->client.using_early_data = 1; *properties->client.max_early_data_size = max_early_data_size; } } else { resumption_secret = ptls_iovec_init(NULL, 0); } } if (tls->client.using_early_data) { properties->client.early_data_acceptance = PTLS_EARLY_DATA_ACCEPTANCE_UNKNOWN; } else { if (properties->client.max_early_data_size != NULL) *properties->client.max_early_data_size = 0; properties->client.early_data_acceptance = PTLS_EARLY_DATA_REJECTED; } } /* use the default key share if still not undetermined */ if (tls->key_share == NULL && !(properties != NULL && properties->client.negotiate_before_key_exchange)) tls->key_share = tls->ctx->key_exchanges[0]; if (!is_second_flight) { tls->key_schedule = key_schedule_new(tls->cipher_suite, tls->ctx->cipher_suites, tls->ctx->hkdf_label_prefix__obsolete); if ((ret = key_schedule_extract(tls->key_schedule, resumption_secret)) != 0) goto Exit; } msghash_off = emitter->buf->off + emitter->record_header_length; ptls_push_message(emitter, NULL, PTLS_HANDSHAKE_TYPE_CLIENT_HELLO, { ptls_buffer_t *sendbuf = emitter->buf; /* legacy_version */ ptls_buffer_push16(sendbuf, 0x0303); /* random_bytes */ ptls_buffer_pushv(sendbuf, tls->client_random, sizeof(tls->client_random)); /* lecagy_session_id */ ptls_buffer_push_block( sendbuf, 1, { ptls_buffer_pushv(sendbuf, tls->client.legacy_session_id, sizeof(tls->client.legacy_session_id)); }); /* cipher_suites */ ptls_buffer_push_block(sendbuf, 2, { ptls_cipher_suite_t **cs = tls->ctx->cipher_suites; for (; *cs != NULL; ++cs) ptls_buffer_push16(sendbuf, (*cs)->id); }); /* legacy_compression_methods */ ptls_buffer_push_block(sendbuf, 1, { ptls_buffer_push(sendbuf, 0); }); /* extensions */ ptls_buffer_push_block(sendbuf, 2, { struct { size_t off; size_t len; } key_share_client_hello; buffer_push_extension(sendbuf, PTLS_EXTENSION_TYPE_KEY_SHARE, { key_share_client_hello.off = sendbuf->off; ptls_buffer_push_block(sendbuf, 2, { if (tls->key_share != NULL) { if ((ret = tls->key_share->create(tls->key_share, &tls->client.key_share_ctx)) != 0) goto Exit; if ((ret = push_key_share_entry(sendbuf, tls->key_share->id, tls->client.key_share_ctx->pubkey)) != 0) goto Exit; } }); key_share_client_hello.len = sendbuf->off - key_share_client_hello.off; }); if (send_sni) { if (tls->esni != NULL) { buffer_push_extension(sendbuf, PTLS_EXTENSION_TYPE_ENCRYPTED_SERVER_NAME, { if ((ret = emit_esni_extension(tls->esni, sendbuf, properties->client.esni_keys, tls->server_name, key_share_client_hello.off, key_share_client_hello.len)) != 0) goto Exit; }); } else { buffer_push_extension(sendbuf, PTLS_EXTENSION_TYPE_SERVER_NAME, { if ((ret = emit_server_name_extension(sendbuf, tls->server_name)) != 0) goto Exit; }); } } if (properties != NULL && properties->client.negotiated_protocols.count != 0) { buffer_push_extension(sendbuf, PTLS_EXTENSION_TYPE_ALPN, { ptls_buffer_push_block(sendbuf, 2, { size_t i; for (i = 0; i != properties->client.negotiated_protocols.count; ++i) { ptls_buffer_push_block(sendbuf, 1, { ptls_iovec_t p = properties->client.negotiated_protocols.list[i]; ptls_buffer_pushv(sendbuf, p.base, p.len); }); } }); }); } if (tls->ctx->decompress_certificate != NULL) { buffer_push_extension(sendbuf, PTLS_EXTENSION_TYPE_COMPRESS_CERTIFICATE, { ptls_buffer_push_block(sendbuf, 1, { const uint16_t *algo = tls->ctx->decompress_certificate->supported_algorithms; assert(*algo != UINT16_MAX); for (; *algo != UINT16_MAX; ++algo) ptls_buffer_push16(sendbuf, *algo); }); }); } buffer_push_extension(sendbuf, PTLS_EXTENSION_TYPE_SUPPORTED_VERSIONS, { ptls_buffer_push_block(sendbuf, 1, { size_t i; for (i = 0; i != sizeof(supported_versions) / sizeof(supported_versions[0]); ++i) ptls_buffer_push16(sendbuf, supported_versions[i]); }); }); buffer_push_extension(sendbuf, PTLS_EXTENSION_TYPE_SIGNATURE_ALGORITHMS, { if ((ret = push_signature_algorithms(sendbuf)) != 0) goto Exit; }); buffer_push_extension(sendbuf, PTLS_EXTENSION_TYPE_SUPPORTED_GROUPS, { ptls_key_exchange_algorithm_t **algo = tls->ctx->key_exchanges; ptls_buffer_push_block(sendbuf, 2, { for (; *algo != NULL; ++algo) ptls_buffer_push16(sendbuf, (*algo)->id); }); }); if (cookie != NULL && cookie->base != NULL) { buffer_push_extension(sendbuf, PTLS_EXTENSION_TYPE_COOKIE, { ptls_buffer_push_block(sendbuf, 2, { ptls_buffer_pushv(sendbuf, cookie->base, cookie->len); }); }); } if ((ret = push_additional_extensions(properties, sendbuf)) != 0) goto Exit; if (tls->ctx->save_ticket != NULL || resumption_secret.base != NULL) { buffer_push_extension(sendbuf, PTLS_EXTENSION_TYPE_PSK_KEY_EXCHANGE_MODES, { ptls_buffer_push_block(sendbuf, 1, { if (!tls->ctx->require_dhe_on_psk) ptls_buffer_push(sendbuf, PTLS_PSK_KE_MODE_PSK); ptls_buffer_push(sendbuf, PTLS_PSK_KE_MODE_PSK_DHE); }); }); } if (resumption_secret.base != NULL) { if (tls->client.using_early_data && !is_second_flight) buffer_push_extension(sendbuf, PTLS_EXTENSION_TYPE_EARLY_DATA, {}); /* pre-shared key "MUST be the last extension in the ClientHello" (draft-17 section 4.2.6) */ buffer_push_extension(sendbuf, PTLS_EXTENSION_TYPE_PRE_SHARED_KEY, { ptls_buffer_push_block(sendbuf, 2, { ptls_buffer_push_block(sendbuf, 2, { ptls_buffer_pushv(sendbuf, resumption_ticket.base, resumption_ticket.len); }); ptls_buffer_push32(sendbuf, obfuscated_ticket_age); }); /* allocate space for PSK binder. the space is filled at the bottom of the function */ ptls_buffer_push_block(sendbuf, 2, { ptls_buffer_push_block(sendbuf, 1, { if ((ret = ptls_buffer_reserve(sendbuf, tls->key_schedule->hashes[0].algo->digest_size)) != 0) goto Exit; sendbuf->off += tls->key_schedule->hashes[0].algo->digest_size; }); }); }); } }); }); /* update the message hash, filling in the PSK binder HMAC if necessary */ if (resumption_secret.base != NULL) { size_t psk_binder_off = emitter->buf->off - (3 + tls->key_schedule->hashes[0].algo->digest_size); if ((ret = derive_secret_with_empty_digest(tls->key_schedule, binder_key, "res binder")) != 0) goto Exit; ptls__key_schedule_update_hash(tls->key_schedule, emitter->buf->base + msghash_off, psk_binder_off - msghash_off); msghash_off = psk_binder_off; if ((ret = calc_verify_data(emitter->buf->base + psk_binder_off + 3, tls->key_schedule, binder_key)) != 0) goto Exit; } ptls__key_schedule_update_hash(tls->key_schedule, emitter->buf->base + msghash_off, emitter->buf->off - msghash_off); if (tls->client.using_early_data) { assert(!is_second_flight); if ((ret = setup_traffic_protection(tls, 1, "c e traffic", 1, 0)) != 0) goto Exit; if ((ret = push_change_cipher_spec(tls, emitter->buf)) != 0) goto Exit; } if (resumption_secret.base != NULL && !is_second_flight) { if ((ret = derive_exporter_secret(tls, 1)) != 0) goto Exit; } tls->state = cookie == NULL ? PTLS_STATE_CLIENT_EXPECT_SERVER_HELLO : PTLS_STATE_CLIENT_EXPECT_SECOND_SERVER_HELLO; ret = PTLS_ERROR_IN_PROGRESS; Exit: ptls_clear_memory(binder_key, sizeof(binder_key)); return ret; }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x138, %rsp # imm = 0x138 movq %rcx, %r15 movq %rsi, %rbp movq %rdi, %rbx movq 0x50(%rdi), %r12 movq 0x108(%rdi), %rdi testq %rdi, %rdi movq %rdx, 0x20(%rsp) je 0xe18e callq 0x12b68 movq 0x20(%rsp), %rdx testl %eax, %eax sete %cl jmp 0xe190 xorl %ecx, %ecx testq %rdx, %rdx movl %ecx, 0x18(%rsp) je 0xe287 testq %r12, %r12 sete %al andb %cl, %al cmpb $0x1, %al jne 0xe39f movq 0x30(%rdx), %rax testq %rax, %rax je 0xe39f movq %rax, 0x30(%rsp) movq (%rbx), %rax movq %rax, 0x50(%rsp) movq 0x38(%rdx), %r14 pushq $0x1 popq %rdi movl $0xc8, %esi callq 0x6280 movq %rax, 0x148(%rbx) testq %rax, %rax je 0xe2ba movq %rbp, 0x48(%rsp) leaq 0x148(%rbx), %rdi cmpq $0x2, %r14 movq %r14, %rsi movq 0x30(%rsp), %r14 jl 0xe34b movq %rax, %r13 movzwl (%r14), %eax rolw $0x8, %ax cmpw $0xff01, %ax # imm = 0xFF01 jne 0xe34b movq %r15, 0x38(%rsp) cmpq $0x6, %rsi jb 0xe346 leaq 0x128(%rbx), %rax movq %rax, 0x78(%rsp) leaq 0x60(%r13), %rax movq %rax, 0x80(%rsp) movq %r13, %rax addq $0x68, %rax movq %rax, 0x88(%rsp) leaq (%r14,%rsi), %rax movq %rax, 0x28(%rsp) leaq 0x2(%r14), %r15 movq 0x50(%rsp), %rax movq 0x18(%rax), %rax movq (%rax), %rcx testq %rcx, %rcx je 0xe346 movzwl (%rcx), %edx orl $0x2, %edx cmpl $0x1303, %edx # imm = 0x1303 je 0xe2c5 addq $0x8, %rax jmp 0xe267 movq $0x0, 0x30(%rsp) cmpq $0x0, 0x118(%rbx) leaq 0x118(%rbx), %r13 movl $0x0, %r14d movl $0x0, %eax movl $0x0, %ecx jne 0xe4c5 jmp 0xe4b2 movl $0x201, %r14d # imm = 0x201 jmp 0xe66e movq 0x10(%rcx), %rax movq %rdi, 0x10(%rsp) movq %rsi, 0x40(%rsp) callq *0x10(%rax) movq 0x10(%rsp), %rdi testq %rax, %rax je 0xe346 movq %rax, %rbp pushq $0x2 popq %rdx movq %rax, %rdi movq %r14, %rsi callq *(%rax) leaq 0xbfdb(%rip), %rsi # 0x1a2d0 pushq $0x4 popq %rdx movq %rbp, %rdi callq *(%rbp) leaq 0x6(%r14), %rsi movq 0x40(%rsp), %rax leaq -0x6(%rax), %rdx movq %rbp, %rdi movq %rdx, 0xa0(%rsp) callq *(%rbp) leaq 0xf0(%rsp), %rsi movq %rbp, %rdi xorl %edx, %edx callq *0x8(%rbp) movq 0x40(%rsp), %rcx movq 0x10(%rsp), %rdi movl (%r15), %eax leaq 0xf0(%rsp), %rdx cmpl (%rdx), %eax je 0xe809 movq 0x38(%rsp), %r15 movq %rdi, %r14 movq (%rdi), %rdi callq 0x6490 andq $0x0, (%r14) movq (%rbx), %rax movq 0xa0(%rax), %rdi testq %rdi, %rdi movq 0x48(%rsp), %rbp movq 0x20(%rsp), %rdx je 0xe39f movq 0x148(%rbx), %rax movq 0x68(%rax), %rcx movq 0x10(%rcx), %r8 leaq 0x20(%rax), %r9 movq (%rax), %rdx movq 0x8(%rax), %rcx movq %rbx, %rsi callq *(%rdi) movq 0x20(%rsp), %rdx testl %eax, %eax jne 0xe66b movq 0x10(%rdx), %rax xorl %r13d, %r13d testq %rax, %rax je 0xe46d movq %rbp, 0x48(%rsp) movq %r12, 0x40(%rsp) movq %r15, %r12 movq 0x18(%rdx), %rbp addq %rax, %rbp leaq 0x58(%rsp), %rsi movq %rax, (%rsi) leaq 0xa8(%rsp), %rdi movq %rbp, %rdx callq 0xd592 testl %eax, %eax jne 0xe44b movq 0x58(%rsp), %rax movq %rbp, %rcx subq %rax, %rcx cmpq $0x2, %rcx jl 0xe44b addq $-0x2, %rcx cmpq $0x2, %rcx jl 0xe44b leaq 0x4(%rax), %rcx movq %rbp, %rdx subq %rcx, %rdx cmpq $0x3, %rdx jb 0xe44b movzwl (%rax), %r8d rolw $0x8, %r8w movzwl 0x2(%rax), %edi rolw $0x8, %di xorl %edx, %edx xorl %r15d, %r15d movq %r15, %rsi shlq $0x8, %rsi movzbl (%rcx,%rdx), %r15d orq %rsi, %r15 incq %rdx cmpq $0x3, %rdx jne 0xe420 addq $0x7, %rax movq %rbp, %rcx subq %rax, %rcx cmpq %rcx, %r15 jbe 0xe697 xorl %eax, %eax movq $0x0, 0x30(%rsp) xorl %r14d, %r14d movq 0x20(%rsp), %rdx movq %r12, %r15 movq 0x40(%rsp), %r12 movq 0x48(%rsp), %rbp jmp 0xe47b movq $0x0, 0x30(%rsp) xorl %r14d, %r14d xorl %eax, %eax testb $0x2, 0x1b8(%rbx) jne 0xe495 movq 0x20(%rdx), %rcx pushq $0x1 popq %r13 testq %rcx, %rcx je 0xe495 andq $0x0, (%rcx) movl %r13d, 0x28(%rdx) leaq 0x118(%rbx), %r13 cmpq $0x0, 0x118(%rbx) jne 0xe4c3 testb $0x1, 0x2c(%rdx) movl %eax, %ecx jne 0xe4c5 movq (%rbx), %rcx movq 0x10(%rcx), %rcx movq (%rcx), %rcx movq %rcx, 0x118(%rbx) movl %eax, %ecx movl %ecx, 0x50(%rsp) testq %r12, %r12 je 0xe638 movq %r13, 0x10(%rsp) movq (%rbp), %rax movq 0x10(%rbp), %r13 addq 0x10(%rax), %r13 movq %rbp, %rdi callq *0x18(%rbp) testl %eax, %eax jne 0xe66b movq %r13, 0x80(%rsp) movq (%rbp), %r13 leaq 0x77(%rsp), %rsi movb $0x1, (%rsi) pushq $0x1 popq %rdx movq %r13, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b movq %rbp, 0x48(%rsp) leaq 0xcf4a(%rip), %rsi # 0x1b46e pushq $0x3 popq %rdx movq %r13, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b movq 0x10(%r13), %rax movq %rax, 0x28(%rsp) movq 0x48(%rsp), %rax movq (%rax), %rbp leaq 0xd6(%rsp), %rsi movw $0x303, (%rsi) # imm = 0x303 pushq $0x2 popq %rdx movq %rbp, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b leaq 0x128(%rbx), %rsi pushq $0x20 popq %rdx movq %rbp, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b leaq 0xcee5(%rip), %rsi # 0x1b46e pushq $0x1 popq %rdx movq %rbp, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b movq %r15, 0x38(%rsp) movq 0x10(%rbp), %r15 leaq 0x190(%rbx), %rsi pushq $0x20 popq %rdx movq %rbp, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b movl 0x10(%rbp), %eax subl %r15d, %eax movq (%rbp), %rcx movb %al, -0x1(%rcx,%r15) leaq 0xce99(%rip), %rsi # 0x1b46e pushq $0x2 popq %rdx movq %rbp, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b movq %r13, 0x88(%rsp) pushq $0x10 popq %rax movq %rax, 0x78(%rsp) movq 0x10(%rbp), %r13 movq (%rbx), %rax movq 0x18(%rax), %r15 movq (%r15), %rax testq %rax, %rax je 0xe9e5 movzwl (%rax), %eax rolw $0x8, %ax movw %ax, 0x75(%rsp) movq %rbp, %rdi leaq 0x75(%rsp), %rsi pushq $0x2 popq %rdx callq 0xd3e5 movl %eax, %r14d addq $0x8, %r15 testl %eax, %eax je 0xe603 jmp 0xe66e movq (%rbx), %rax movq 0x120(%rbx), %rdi movq 0x18(%rax), %rsi movq 0x60(%rax), %rdx callq 0x12c75 movq %rax, 0x50(%rbx) movq %rax, %rdi movq 0x30(%rsp), %rsi movq %r14, %rdx callq 0x12df7 testl %eax, %eax je 0xe4d2 movl %eax, %r14d movq 0x14e2b(%rip), %rax # 0x234a0 leaq 0xf0(%rsp), %rdi pushq $0x40 popq %rsi callq *%rax movl %r14d, %eax addq $0x138, %rsp # imm = 0x138 popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq addq %rax, %r15 movq %r15, 0x8(%rsp) movq %rax, (%rsp) leaq 0xe8(%rsp), %rsi leaq 0xb4(%rsp), %rdx leaq 0xf0(%rsp), %rcx movw %r8w, 0x50(%rsp) leaq 0xd8(%rsp), %r8 leaq 0xb0(%rsp), %r9 movl %edi, %r14d movq %rbx, %rdi callq 0x13697 movzwl 0x50(%rsp), %edi movq %rbp, %rcx subq %r15, %rcx cmpq $0x2, %rcx jb 0xe44b testl %eax, %eax jne 0xe44b movl %r14d, %esi movzwl (%r15), %eax rolw $0x8, %ax movzwl %ax, %r14d leaq 0x2(%r15), %rdx movq %rbp, %rax movq %rdx, 0x30(%rsp) subq %rdx, %rax cmpq %rax, %r14 setbe %al leaq (%r15,%r14), %rcx addq $0x2, %rcx cmpq %rbp, %rcx sete %cl andb %al, %cl cmpb $0x1, %cl jne 0xe44b movq (%rbx), %rax movq 0x10(%rax), %rcx movq (%rcx), %r15 testq %r15, %r15 je 0xe44b addq $0x8, %rcx cmpw %di, (%r15) jne 0xe73d movq 0x18(%rax), %rcx movq (%rcx), %rbp testq %rbp, %rbp je 0xe44b addq $0x8, %rcx cmpw %si, (%rbp) jne 0xe757 movq 0x8(%rax), %rdi callq *(%rdi) subq 0xa8(%rsp), %rax jb 0xe44b cmpq $0x240c83ff, %rax # imm = 0x240C83FF ja 0xe44b movb 0x1b8(%rbx), %cl movl %ecx, %edx addl 0xb4(%rsp), %eax orb $0x1, %dl movb %dl, 0x1b8(%rbx) cmpq $0x0, 0x118(%rbx) jne 0xe7b6 movq %r15, 0x118(%rbx) cmpq $0x0, 0x40(%rsp) setne %sil movq %rbp, 0x120(%rbx) movl 0xb0(%rsp), %edx testl %edx, %edx sete %dil orb %sil, %dil jne 0xe459 movq 0x20(%rsp), %rsi cmpq $0x0, 0x20(%rsi) je 0xe459 movl %edx, %esi orb $0x3, %cl movb %cl, 0x1b8(%rbx) movq 0x20(%rsp), %rdx movq 0x20(%rdx), %rcx movq %rsi, (%rcx) jmp 0xe45e cmpq $0x2, 0xa0(%rsp) movq 0x38(%rsp), %r15 jb 0xe34b movzwl 0x6(%r14), %eax rolw $0x8, %ax movzwl %ax, %eax leaq 0x8(%r14), %rbp movq %rbp, 0x58(%rsp) addq $-0x8, %rcx cmpq %rcx, %rax ja 0xe34b addq %rax, %rbp movq 0x50(%rsp), %rax movq 0x10(%rax), %rdx leaq 0xd8(%rsp), %rsi leaq 0x58(%rsp), %rcx movq 0x80(%rsp), %rdi movq %rbp, %r8 xorl %r9d, %r9d callq 0x13548 movq 0x10(%rsp), %rdi testl %eax, %eax jne 0xe34b movq 0x58(%rsp), %rdx cmpq %rbp, %rdx jne 0xe34b movq 0x28(%rsp), %rax subq %rbp, %rax cmpq $0x2, %rax jb 0xe34b movzwl (%rdx), %eax rolw $0x8, %ax movzwl %ax, %r14d addq $0x2, %rdx movq 0x28(%rsp), %rax subq %rdx, %rax cmpq %rax, %r14 ja 0xe34b addq %rdx, %r14 movq 0x50(%rsp), %rax movq 0x18(%rax), %rsi movq 0x88(%rsp), %rdi movq %r14, %rcx callq 0x135ec movq 0x10(%rsp), %rdi testl %eax, %eax jne 0xe34b movq 0x28(%rsp), %rax subq %r14, %rax cmpq $0x2, %rax jl 0xe34b movzwl (%r14), %eax rolw $0x8, %ax movw %ax, 0xc0(%r13) addq $0x2, %r14 leaq 0x58(%rsp), %rsi movq %r14, (%rsi) leaq 0xa8(%rsp), %rdi movq 0x28(%rsp), %rdx callq 0xd592 movq 0x10(%rsp), %rdi testl %eax, %eax jne 0xe34b leaq 0xe8(%rsp), %rdi leaq 0x58(%rsp), %rsi movq 0x28(%rsp), %rdx callq 0xd592 movq 0x10(%rsp), %rdi testl %eax, %eax jne 0xe34b movq 0x58(%rsp), %rax movq 0x28(%rsp), %rcx subq %rax, %rcx cmpq $0x2, %rcx jb 0xe34b movzwl (%rax), %ecx rolw $0x8, %cx movzwl %cx, %ecx addq $0x2, %rax movq 0x28(%rsp), %rdx subq %rax, %rdx cmpq %rdx, %rcx ja 0xe34b movq %r12, %r13 addq %rax, %rcx movq 0x38(%rsp), %r15 movq 0x10(%rsp), %rdi cmpq %rcx, %rax je 0xed93 movq %rcx, %rdx subq %rax, %rdx cmpq $0x2, %rdx movq %r13, %r12 jl 0xe34b addq $-0x2, %rdx cmpq $0x2, %rdx jb 0xe34b movzwl 0x2(%rax), %edx rolw $0x8, %dx movzwl %dx, %edx addq $0x4, %rax movq %rcx, %rsi subq %rax, %rsi cmpq %rsi, %rdx ja 0xe34b addq %rdx, %rax jmp 0xe998 movq (%rbp), %rax movq 0x10(%rbp), %rcx movq %r13, %rdx subq %r13, %rcx movb %ch, -0x2(%rax,%rdx) movq (%rbp), %rax movb %cl, -0x1(%rax,%r13) leaq 0xca67(%rip), %rsi # 0x1b46e pushq $0x1 popq %rdx movq %rbp, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b movq %r12, 0x40(%rsp) movq 0x10(%rbp), %r15 leaq 0x74(%rsp), %rsi movb $0x0, (%rsi) pushq $0x1 popq %rdx movq %rbp, %r12 movq %rbp, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b movq %r12, %rdi movl 0x10(%r12), %eax subl %r15d, %eax movq (%r12), %rcx movb %al, -0x1(%rcx,%r15) leaq 0xca12(%rip), %rsi # 0x1b46e pushq $0x2 popq %rdx callq 0xd3e5 testl %eax, %eax jne 0xe66b movq %r12, %rdi movq 0x10(%r12), %rax movq %rax, 0xa0(%rsp) leaq 0xd4(%rsp), %rsi movw $0x3300, (%rsi) # imm = 0x3300 pushq $0x2 popq %rdx callq 0xd3e5 testl %eax, %eax jne 0xe66b leaq 0xc9ce(%rip), %rsi # 0x1b46e pushq $0x2 popq %rdx movq %r12, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b movq %r12, %rdi movq 0x10(%r12), %r15 leaq 0xc9ac(%rip), %rsi # 0x1b46e pushq $0x2 popq %rdx callq 0xd3e5 testl %eax, %eax jne 0xe66b movq 0x10(%r12), %rcx movq 0x10(%rsp), %rax movq (%rax), %rdi movq %rcx, %rbp movq %rcx, %rax testq %rdi, %rdi je 0xeb2b leaq 0x1b0(%rbx), %r13 movq %r13, %rsi callq *0x8(%rdi) testl %eax, %eax jne 0xe66b movq 0x10(%rsp), %rax movq (%rax), %rax movzwl (%rax), %esi movq (%r13), %rax movq 0x8(%rax), %rdx movq 0x10(%rax), %rcx movq %r12, %rdi callq 0x12ea2 testl %eax, %eax jne 0xe66b movq 0x10(%r12), %rax subq %rbp, %rax movq (%r12), %rcx movb %ah, -0x2(%rcx,%rbp) movq (%r12), %rcx movb %al, -0x1(%rcx,%rbp) movq (%r12), %rax movq 0x10(%r12), %rcx movq %r15, %rsi subq %r15, %rcx movb %ch, -0x2(%rax,%rsi) movq (%r12), %rax movq %rcx, 0x10(%rsp) movb %cl, -0x1(%rax,%r15) cmpb $0x0, 0x18(%rsp) je 0xef1a cmpq $0x0, 0x148(%rbx) je 0xeea3 leaq 0xd2(%rsp), %rsi movw $0xceff, (%rsi) # imm = 0xCEFF pushq $0x2 popq %rdx movq %r12, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b leaq 0xc8cf(%rip), %rsi # 0x1b46e pushq $0x2 popq %rdx movq %r12, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b movq 0x10(%r12), %rax movq %rax, 0x18(%rsp) movq 0x108(%rbx), %rax movq %rax, 0x98(%rsp) movq 0x148(%rbx), %rax leaq 0xf0(%rsp), %rdi andq $0x0, (%rdi) movq 0x68(%rax), %rdx leaq 0x20(%rax), %r9 movq (%rax), %rcx movq %rax, 0x60(%rsp) movq 0x8(%rax), %r8 pushq $0x1 popq %rsi callq 0x13901 testl %eax, %eax jne 0xed6d movq 0x60(%rsp), %rax movq 0x68(%rax), %rax movzwl (%rax), %eax rolw $0x8, %ax leaq 0x58(%rsp), %rsi movw %ax, (%rsi) pushq $0x2 popq %rdx movq %r12, %rdi callq 0xd3e5 testl %eax, %eax jne 0xed6d movq 0x60(%rsp), %rcx movq 0x60(%rcx), %rax movq 0x70(%rcx), %rdx movzwl (%rax), %esi movq 0x78(%rcx), %rcx movq %r12, %rdi callq 0x12ea2 testl %eax, %eax jne 0xed6d leaq 0xc816(%rip), %rsi # 0x1b46e pushq $0x2 popq %rdx movq %r12, %rdi callq 0xd3e5 testl %eax, %eax jne 0xed6d movq %r12, %rdi movq 0x10(%r12), %rbp movq 0x60(%rsp), %rax leaq 0x80(%rax), %rsi movq 0x68(%rax), %rax movq 0x10(%rax), %rax movq 0x8(%rax), %rdx callq 0xd3e5 testl %eax, %eax jne 0xed6d movq %r12, %rdi movq (%r12), %rax movq 0x10(%r12), %rcx subq %rbp, %rcx movb %ch, -0x2(%rax,%rbp) movq (%r12), %rax movb %cl, -0x1(%rax,%rbp) leaq 0xc7b4(%rip), %rsi # 0x1b46e pushq $0x2 popq %rdx callq 0xd3e5 testl %eax, %eax jne 0xed6d movq %r12, %rdi movq 0x10(%r12), %rax movq %rax, 0x90(%rsp) movq 0x60(%rsp), %rax leaq 0x10(%rax), %rsi pushq $0x10 popq %rdx callq 0xd3e5 testl %eax, %eax jne 0xed6d movq %r12, %rdi movq 0x98(%rsp), %rsi callq 0x12f1b testl %eax, %eax jne 0xed6d movq 0x10(%r12), %rax subq 0x90(%rsp), %rax movq 0x60(%rsp), %rcx movzwl 0xc0(%rcx), %r13d addq $0x10, %r13 subq %rax, %r13 jbe 0xed4d movq %r12, %rdi movq %r13, %rsi callq 0xd359 testl %eax, %eax jne 0xed6d movq (%r12), %rdi addq 0x10(%r12), %rdi xorl %esi, %esi movq %r13, %rdx callq 0x61b0 addq %r13, 0x10(%r12) movq 0xf0(%rsp), %rbp movq (%rbp), %rax movq 0x28(%rax), %rsi movq %r12, %rdi callq 0xd359 testl %eax, %eax je 0xf77c movl %eax, %r14d movq 0xf0(%rsp), %rdi testq %rdi, %rdi je 0xed82 callq 0xdd56 testl %r14d, %r14d movq %r12, %r15 jne 0xe66e jmp 0xef00 cmpq 0x28(%rsp), %rcx movq 0x38(%rsp), %r15 movq %r13, %r12 movq 0x10(%rsp), %rdi movq 0x30(%rsp), %r14 jne 0xe34b movq 0x50(%rsp), %rax movq 0x8(%rax), %rdi callq *(%rdi) movq 0x40(%rsp), %r8 movq 0x10(%rsp), %rdi movl $0x3e8, %ecx # imm = 0x3E8 xorl %edx, %edx divq %rcx cmpq %rax, 0xa8(%rsp) ja 0xe34b cmpq 0xe8(%rsp), %rax ja 0xe34b movq %rdi, %r15 movq (%rdi), %rdi addq $0x10, %rdi pushq $0x10 popq %rsi movq %r8, %r12 movq 0x50(%rsp), %rax callq *(%rax) movq (%r15), %rsi movq 0x68(%rsi), %rax movq 0x10(%rax), %rdi subq $-0x80, %rsi movq %r14, %rdx movq %r12, %rcx callq 0x1058a testl %eax, %eax jne 0xee8f movq 0x10(%rsp), %rax movq (%rax), %rdx movq 0x60(%rdx), %rdi leaq 0x70(%rdx), %rsi movq 0xd8(%rsp), %rcx movq 0xe0(%rsp), %r8 callq *0x10(%rdi) testl %eax, %eax jne 0xee8f movq 0x10(%rsp), %rax movq (%rax), %rax movq 0x60(%rax), %rcx movq 0x68(%rax), %rdx movq 0x10(%rdx), %rdi leaq 0x20(%rax), %rsi leaq 0x80(%rax), %rdx movzwl (%rcx), %ecx movq 0x70(%rax), %r8 movq 0x78(%rax), %r9 movq 0x78(%rsp), %rax movq %rax, (%rsp) callq 0x13445 testl %eax, %eax movq 0x38(%rsp), %r15 movq %r13, %r12 je 0xe35a movl %eax, %r14d movq 0x10(%rsp), %rdi xorl %esi, %esi callq 0xdc8b jmp 0xe66e leaq 0xd0(%rsp), %rsi andw $0x0, (%rsi) pushq $0x2 popq %rdx movq %r12, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b leaq 0xc5a5(%rip), %rsi # 0x1b46e pushq $0x2 popq %rdx movq %r12, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b movq %r12, %r15 movq 0x10(%r12), %rax movq %rax, 0x18(%rsp) movq 0x108(%rbx), %rsi movq %r12, %rdi callq 0x12f1b testl %eax, %eax jne 0xe66b movq (%r15), %rax movq 0x10(%r15), %rcx movq 0x18(%rsp), %rdx subq %rdx, %rcx movb %ch, -0x2(%rax,%rdx) movq (%r15), %rax movb %cl, -0x1(%rax,%rdx) cmpq $0x0, 0x20(%rsp) je 0xf062 movq 0x20(%rsp), %rax cmpq $0x0, 0x8(%rax) je 0xf062 leaq 0xce(%rsp), %rsi movw $0x1000, (%rsi) # imm = 0x1000 pushq $0x2 popq %rdx movq %r12, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b leaq 0xc511(%rip), %rsi # 0x1b46e pushq $0x2 popq %rdx movq %r12, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b movq %r12, %rdi movq 0x10(%r12), %rax movq %rax, 0x60(%rsp) leaq 0xc4ea(%rip), %rsi # 0x1b46e pushq $0x2 popq %rdx callq 0xd3e5 testl %eax, %eax jne 0xe66b movq 0x10(%r12), %rax movq %rax, 0x98(%rsp) pushq $0x8 popq %rax movq %rax, 0x10(%rsp) movq $0x0, 0x18(%rsp) movq 0x20(%rsp), %rax movq 0x18(%rsp), %rcx cmpq 0x8(%rax), %rcx je 0xf025 movq %r12, %rdi leaq 0xc4a2(%rip), %rsi # 0x1b46e pushq $0x1 popq %rdx callq 0xd3e5 testl %eax, %eax jne 0xe66b movq %r12, %rdi movq 0x10(%r12), %r15 movq 0x20(%rsp), %rax movq (%rax), %rax movq 0x10(%rsp), %rcx movq -0x8(%rax,%rcx), %rsi movq (%rax,%rcx), %rdx callq 0xd3e5 testl %eax, %eax jne 0xe66b movl 0x10(%r12), %eax subl %r15d, %eax movq (%r12), %rcx movb %al, -0x1(%rcx,%r15) incq 0x18(%rsp) addq $0x10, 0x10(%rsp) jmp 0xefb2 movq (%r12), %rax movq 0x10(%r12), %rcx movq 0x98(%rsp), %rsi subq %rsi, %rcx movb %ch, -0x2(%rax,%rsi) movq (%r12), %rax movb %cl, -0x1(%rax,%rsi) movq (%r12), %rax movq 0x10(%r12), %rcx movq 0x60(%rsp), %rsi subq %rsi, %rcx movb %ch, -0x2(%rax,%rsi) movq (%r12), %rax movb %cl, -0x1(%rax,%rsi) movq (%rbx), %rax cmpq $0x0, 0x98(%rax) je 0xf157 leaq 0xcc(%rsp), %rsi movw $0x1b00, (%rsi) # imm = 0x1B00 pushq $0x2 popq %rdx movq %r12, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b leaq 0xc3d4(%rip), %rsi # 0x1b46e pushq $0x2 popq %rdx movq %r12, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b movq %r12, %rdi movq 0x10(%r12), %rax movq %rax, 0x18(%rsp) leaq 0xc3ad(%rip), %rsi # 0x1b46e pushq $0x1 popq %rdx callq 0xd3e5 testl %eax, %eax jne 0xe66b movq (%rbx), %rax movq 0x98(%rax), %rax movq (%rax), %r15 movzwl (%r15), %eax cmpw $-0x1, %ax je 0xf94f movq 0x10(%r12), %r13 addq $0x2, %r15 leaq 0x72(%rsp), %rbp cmpw $-0x1, %ax je 0xf129 rolw $0x8, %ax movw %ax, 0x72(%rsp) movq %r12, %rdi movq %rbp, %rsi pushq $0x2 popq %rdx callq 0xd3e5 testl %eax, %eax jne 0xe66b movzwl (%r15), %eax addq $0x2, %r15 jmp 0xf0fa movl 0x10(%r12), %eax subl %r13d, %eax movq (%r12), %rcx movb %al, -0x1(%rcx,%r13) movq (%r12), %rax movq 0x10(%r12), %rcx movq 0x18(%rsp), %rsi subq %rsi, %rcx movb %ch, -0x2(%rax,%rsi) movq (%r12), %rax movb %cl, -0x1(%rax,%rsi) leaq 0xca(%rsp), %rsi movw $0x2b00, (%rsi) # imm = 0x2B00 pushq $0x2 popq %rdx movq %r12, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b leaq 0xc2f0(%rip), %rsi # 0x1b46e pushq $0x2 popq %rdx movq %r12, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b movq %r12, %rdi movq 0x10(%r12), %rax movq %rax, 0x18(%rsp) leaq 0xc2c9(%rip), %rsi # 0x1b46e pushq $0x1 popq %rdx callq 0xd3e5 testl %eax, %eax jne 0xe66b movq 0x10(%r12), %r13 xorl %r15d, %r15d leaq 0xc2b2(%rip), %rbp # 0x1b476 cmpq $0x8, %r15 je 0xf1f8 movzwl (%r15,%rbp), %eax rolw $0x8, %ax movw %ax, 0x70(%rsp) movq %r12, %rdi leaq 0x70(%rsp), %rsi pushq $0x2 popq %rdx callq 0xd3e5 movl %eax, %r14d addq $0x2, %r15 testl %eax, %eax je 0xf1c4 jmp 0xe66e movq %r12, %rdi movl 0x10(%r12), %eax subl %r13d, %eax movq (%r12), %rcx movb %al, -0x1(%rcx,%r13) movq (%r12), %rax movq 0x10(%r12), %rcx movq 0x18(%rsp), %rdx subq %rdx, %rcx movb %ch, -0x2(%rax,%rdx) movq (%r12), %rax movb %cl, -0x1(%rax,%rdx) leaq 0xc8(%rsp), %rsi movw $0xd00, (%rsi) # imm = 0xD00 pushq $0x2 popq %rdx callq 0xd3e5 testl %eax, %eax jne 0xe66b leaq 0xc221(%rip), %rsi # 0x1b46e pushq $0x2 popq %rdx movq %r12, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b movq %r12, %rdi movq 0x10(%r12), %rbp callq 0x12fc5 testl %eax, %eax jne 0xe66b movq %r12, %rdi movq (%r12), %rax movq 0x10(%r12), %rcx subq %rbp, %rcx movb %ch, -0x2(%rax,%rbp) movq (%r12), %rax movb %cl, -0x1(%rax,%rbp) leaq 0xc6(%rsp), %rsi movw $0xa00, (%rsi) # imm = 0xA00 pushq $0x2 popq %rdx callq 0xd3e5 testl %eax, %eax jne 0xe66b leaq 0xc1ba(%rip), %rsi # 0x1b46e pushq $0x2 popq %rdx movq %r12, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b movq %r12, %rdi movq 0x10(%r12), %rax movq %rax, 0x18(%rsp) movq (%rbx), %rax movq 0x10(%rax), %r15 leaq 0xc18c(%rip), %rsi # 0x1b46e pushq $0x2 popq %rdx callq 0xd3e5 testl %eax, %eax jne 0xe66b movq 0x10(%r12), %rbp leaq 0x6e(%rsp), %r13 movq (%r15), %rax testq %rax, %rax je 0xf32e movzwl (%rax), %eax rolw $0x8, %ax movw %ax, 0x6e(%rsp) movq %r12, %rdi movq %r13, %rsi pushq $0x2 popq %rdx callq 0xd3e5 movl %eax, %r14d addq $0x8, %r15 testl %eax, %eax je 0xf2fc jmp 0xe66e movq (%r12), %rax movq 0x10(%r12), %rcx subq %rbp, %rcx movb %ch, -0x2(%rax,%rbp) movq (%r12), %rax movb %cl, -0x1(%rax,%rbp) movq (%r12), %rax movq 0x10(%r12), %rcx movq 0x18(%rsp), %rsi subq %rsi, %rcx movb %ch, -0x2(%rax,%rsi) movq (%r12), %rax movb %cl, -0x1(%rax,%rsi) cmpq $0x0, 0x38(%rsp) je 0xf42c movq 0x38(%rsp), %rax cmpq $0x0, (%rax) je 0xf42c leaq 0xc4(%rsp), %rsi movw $0x2c00, (%rsi) # imm = 0x2C00 pushq $0x2 popq %rdx movq %r12, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b leaq 0xc0c9(%rip), %rsi # 0x1b46e pushq $0x2 popq %rdx movq %r12, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b movq %r12, %rdi movq 0x10(%r12), %rbp leaq 0xc0a7(%rip), %rsi # 0x1b46e pushq $0x2 popq %rdx callq 0xd3e5 testl %eax, %eax jne 0xe66b movq %r12, %rdi movq 0x10(%r12), %r15 movq 0x38(%rsp), %rax movq (%rax), %rsi movq 0x8(%rax), %rdx callq 0xd3e5 testl %eax, %eax jne 0xe66b movq (%r12), %rax movq 0x10(%r12), %rcx movq %r15, %rsi subq %r15, %rcx movb %ch, -0x2(%rax,%rsi) movq (%r12), %rax movb %cl, -0x1(%rax,%r15) movq (%r12), %rax movq 0x10(%r12), %rcx subq %rbp, %rcx movb %ch, -0x2(%rax,%rbp) movq (%r12), %rax movb %cl, -0x1(%rax,%rbp) movq 0x20(%rsp), %rdi movq %r12, %rsi callq 0x13062 testl %eax, %eax jne 0xe66b movq (%rbx), %rax movq 0x78(%rax), %rax orq 0x30(%rsp), %rax je 0xf70d leaq 0xc2(%rsp), %rsi movw $0x2d00, (%rsi) # imm = 0x2D00 pushq $0x2 popq %rdx movq %r12, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b leaq 0xbff4(%rip), %rsi # 0x1b46e pushq $0x2 popq %rdx movq %r12, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b movq %r12, %rdi movq 0x10(%r12), %r15 leaq 0xbfd2(%rip), %rsi # 0x1b46e pushq $0x1 popq %rdx callq 0xd3e5 testl %eax, %eax jne 0xe66b movq 0x10(%r12), %r13 movq (%rbx), %rax testb $0x1, 0x68(%rax) jne 0xf4d5 leaq 0x6d(%rsp), %rsi movb $0x0, (%rsi) pushq $0x1 popq %rdx movq %r12, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b leaq 0x6c(%rsp), %rsi movb $0x1, (%rsi) pushq $0x1 popq %rdx movq %r12, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b movl 0x10(%r12), %eax subl %r13d, %eax movq (%r12), %rcx movb %al, -0x1(%rcx,%r13) movq (%r12), %rax movq 0x10(%r12), %rcx movq %r15, %rsi subq %r15, %rcx movb %ch, -0x2(%rax,%rsi) movq (%r12), %rax movb %cl, -0x1(%rax,%r15) cmpq $0x0, 0x30(%rsp) je 0xf70d cmpq $0x0, 0x40(%rsp) setne %al testb $0x2, 0x1b8(%rbx) sete %cl orb %al, %cl je 0xf96e leaq 0xbe(%rsp), %rsi movw $0x2900, (%rsi) # imm = 0x2900 pushq $0x2 popq %rdx movq %r12, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b leaq 0xbf03(%rip), %rsi # 0x1b46e pushq $0x2 popq %rdx movq %r12, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b movq %r12, %rdi movq 0x10(%r12), %rax movq %rax, 0x20(%rsp) leaq 0xbedc(%rip), %rsi # 0x1b46e pushq $0x2 popq %rdx callq 0xd3e5 testl %eax, %eax jne 0xe66b movq %r12, %rdi movq 0x10(%r12), %r15 leaq 0xbebd(%rip), %rsi # 0x1b46e pushq $0x2 popq %rdx callq 0xd3e5 testl %eax, %eax jne 0xe66b movq %r12, %rdi movq 0x10(%r12), %rbp movq 0xd8(%rsp), %rsi movq 0xe0(%rsp), %rdx callq 0xd3e5 testl %eax, %eax jne 0xe66b movq %r12, %rdi movq (%r12), %rax movq 0x10(%r12), %rcx subq %rbp, %rcx movb %ch, -0x2(%rax,%rbp) movq (%r12), %rax movb %cl, -0x1(%rax,%rbp) movl 0x50(%rsp), %ecx movl %ecx, %eax shrl $0x18, %eax leaq 0xba(%rsp), %rsi movb %al, (%rsi) movl %ecx, %eax shrl $0x10, %eax movb %al, 0x1(%rsi) movb %ch, 0xbc(%rsp) movb %cl, 0x3(%rsi) pushq $0x4 popq %rdx callq 0xd3e5 testl %eax, %eax jne 0xe66b movq %r12, %rdi movq (%r12), %rax movq 0x10(%r12), %rcx movq %r15, %rdx subq %r15, %rcx movb %ch, -0x2(%rax,%rdx) movq (%r12), %rax movb %cl, -0x1(%rax,%r15) leaq 0xbe12(%rip), %rsi # 0x1b46e pushq $0x2 popq %rdx callq 0xd3e5 testl %eax, %eax jne 0xe66b movq %r12, %rdi movq 0x10(%r12), %rax movq %rax, 0x18(%rsp) leaq 0xbdee(%rip), %rsi # 0x1b46e pushq $0x1 popq %rdx callq 0xd3e5 testl %eax, %eax jne 0xe66b movq %r12, %rdi movq 0x10(%r12), %r15 movq 0x50(%rbx), %rax movq 0x58(%rax), %rax movq 0x8(%rax), %rsi callq 0xd359 testl %eax, %eax jne 0xe66b movq 0x50(%rbx), %rax movq 0x58(%rax), %rax movq 0x10(%r12), %rcx addq 0x8(%rax), %rcx movq (%r12), %rax movq %rcx, 0x10(%r12) subl %r15d, %ecx movb %cl, -0x1(%rax,%r15) movq (%r12), %rax movq 0x10(%r12), %rcx movq 0x18(%rsp), %rsi subq %rsi, %rcx movb %ch, -0x2(%rax,%rsi) movq (%r12), %rax movb %cl, -0x1(%rax,%rsi) movq (%r12), %rax movq 0x10(%r12), %rcx movq 0x20(%rsp), %rsi subq %rsi, %rcx movb %ch, -0x2(%rax,%rsi) movq (%r12), %rax movb %cl, -0x1(%rax,%rsi) movq (%r12), %rax movq 0x10(%r12), %rcx movq 0xa0(%rsp), %rdx subq %rdx, %rcx movb %ch, -0x2(%rax,%rdx) movq (%r12), %rax movb %cl, -0x1(%rax,%rdx) movq 0x88(%rsp), %rax movq 0x10(%rax), %rax subq 0x28(%rsp), %rax cmpq $-0x8, 0x78(%rsp) je 0xf7e9 movq %rax, %rdx movq 0x78(%rsp), %rcx shrq %cl, %rdx movq 0x88(%rsp), %rsi movq (%rsi), %rdi movq 0x28(%rsp), %rsi movb %dl, -0x3(%rdi,%rsi) addq $-0x8, %rcx movq %rcx, 0x78(%rsp) incq %rsi movq %rsi, 0x28(%rsp) jmp 0xf73e movq (%r12), %rax movq 0x10(%r12), %rcx movq 0x90(%rsp), %rsi leaq (%rax,%rsi), %rdx subq %rsi, %rcx addq %rax, %r15 movq 0x10(%rsp), %rax movq %rax, (%rsp) xorl %r14d, %r14d movq %rbp, %rdi movq %rdx, %rsi xorl %r8d, %r8d movq %r15, %r9 callq 0x10c77 movq (%rbp), %rcx movq (%r12), %rdx movq 0x10(%r12), %rax addq 0x28(%rcx), %rax movq %rax, 0x10(%r12) movq 0x90(%rsp), %rcx subq %rcx, %rax movb %ah, -0x2(%rdx,%rcx) movq %rcx, %rdx movq (%r12), %rcx movb %al, -0x1(%rcx,%rdx) jmp 0xed70 movq 0x48(%rsp), %rdi callq *0x20(%rdi) testl %eax, %eax jne 0xe66b cmpq $0x0, 0x30(%rsp) je 0xf894 movq 0x48(%rsp), %rax movq (%rax), %rax movq 0x10(%rax), %r15 movq 0x50(%rbx), %rdi movq 0x58(%rdi), %rcx movq 0x8(%rcx), %r13 addq $0x18, %rcx leaq 0xb031(%rip), %rdx # 0x1a859 leaq 0xf0(%rsp), %rsi callq 0x13997 testl %eax, %eax jne 0xe66b subq %r13, %r15 addq $-0x3, %r15 movq 0x50(%rbx), %rdi movq 0x48(%rsp), %r14 movq (%r14), %rax movq %r15, %rdx movq 0x80(%rsp), %rsi subq %rsi, %rdx addq (%rax), %rsi callq 0xd5b5 movq (%r14), %rax movq (%rax), %rdi addq %r15, %rdi addq $0x3, %rdi movq 0x50(%rbx), %rsi leaq 0xf0(%rsp), %rdx callq 0x1310f movq %r15, 0x80(%rsp) testl %eax, %eax jne 0xe66b movq 0x50(%rbx), %rdi movq 0x48(%rsp), %rax movq (%rax), %rax movq (%rax), %rsi movq 0x80(%rsp), %rcx addq %rcx, %rsi movq 0x10(%rax), %rdx subq %rcx, %rdx callq 0xd5b5 testb $0x2, 0x1b8(%rbx) jne 0xf906 cmpq $0x0, 0x30(%rsp) sete %al cmpq $0x0, 0x40(%rsp) setne %cl orb %al, %cl jne 0xf8ec pushq $0x1 popq %rsi movq %rbx, %rdi callq 0x13370 testl %eax, %eax jne 0xe66b cmpq $0x1, 0x38(%rsp) pushq $0x2 popq %rax sbbl $0x0, %eax movl %eax, 0x8(%rbx) movl $0x202, %r14d # imm = 0x202 jmp 0xe66e cmpq $0x0, 0x40(%rsp) jne 0xf9c9 leaq 0xaf5d(%rip), %rdx # 0x1a876 pushq $0x1 popq %rsi pushq $0x1 popq %rcx movq %rbx, %rdi xorl %r8d, %r8d callq 0x131e1 testl %eax, %eax jne 0xe66b movq 0x48(%rsp), %rax movq (%rax), %rsi movq %rbx, %rdi callq 0x132dc testl %eax, %eax jne 0xe66b jmp 0xf8c3 leaq 0xae86(%rip), %rdi # 0x1a7dc leaq 0xaa1c(%rip), %rsi # 0x1a379 leaq 0xae8c(%rip), %rcx # 0x1a7f0 movl $0x796, %edx # imm = 0x796 callq 0x6260 leaq 0xc0(%rsp), %rsi movw $0x2a00, (%rsi) # imm = 0x2A00 pushq $0x2 popq %rdx movq %r12, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b leaq 0xbad9(%rip), %rsi # 0x1b46e pushq $0x2 popq %rdx movq %r12, %rdi callq 0xd3e5 testl %eax, %eax jne 0xe66b movq 0x10(%r12), %rax pushq $-0x2 popq %rcx testq %rcx, %rcx je 0xf544 movq (%r12), %rdx addq %rax, %rdx movb $0x0, (%rcx,%rdx) incq %rcx jmp 0xf9b0 leaq 0xae94(%rip), %rdi # 0x1a864 leaq 0xa9a2(%rip), %rsi # 0x1a379 leaq 0xae12(%rip), %rcx # 0x1a7f0 movl $0x7e2, %edx # imm = 0x7E2 callq 0x6260
/rperper[P]picotls/lib/picotls.c
ptls_calc_hash
int ptls_calc_hash(ptls_hash_algorithm_t *algo, void *output, const void *src, size_t len) { ptls_hash_context_t *ctx; if ((ctx = algo->create()) == NULL) return PTLS_ERROR_NO_MEMORY; ctx->update(ctx, src, len); ctx->final(ctx, output, PTLS_HASH_FINAL_MODE_FREE); return 0; }
pushq %rbp pushq %r15 pushq %r14 pushq %r12 pushq %rbx movq %rcx, %r15 movq %rdx, %r12 movq %rsi, %rbx callq *0x10(%rdi) testq %rax, %rax je 0x105c1 movq %rax, %r14 movq %rax, %rdi movq %r12, %rsi movq %r15, %rdx callq *(%rax) xorl %ebp, %ebp movq %r14, %rdi movq %rbx, %rsi xorl %edx, %edx callq *0x8(%r14) jmp 0x105c6 movl $0x201, %ebp # imm = 0x201 movl %ebp, %eax popq %rbx popq %r12 popq %r14 popq %r15 popq %rbp retq
/rperper[P]picotls/lib/picotls.c
setup_traffic_protection
static int setup_traffic_protection(ptls_t *tls, int is_enc, const char *secret_label, size_t epoch, int skip_notify) { static const char *log_labels[2][4] = { {NULL, "CLIENT_EARLY_TRAFFIC_SECRET", "CLIENT_HANDSHAKE_TRAFFIC_SECRET", "CLIENT_TRAFFIC_SECRET_0"}, {NULL, NULL, "SERVER_HANDSHAKE_TRAFFIC_SECRET", "SERVER_TRAFFIC_SECRET_0"}}; struct st_ptls_traffic_protection_t *ctx = is_enc ? &tls->traffic_protection.enc : &tls->traffic_protection.dec; if (secret_label != NULL) { int ret; if ((ret = derive_secret(tls->key_schedule, ctx->secret, secret_label)) != 0) return ret; } ctx->epoch = epoch; /* special path for applications having their own record layer */ if (tls->ctx->update_traffic_key != NULL) { if (skip_notify) return 0; return tls->ctx->update_traffic_key->cb(tls->ctx->update_traffic_key, tls, is_enc, epoch, ctx->secret); } if (ctx->aead != NULL) ptls_aead_free(ctx->aead); if ((ctx->aead = ptls_aead_new(tls->cipher_suite->aead, tls->cipher_suite->hash, is_enc, ctx->secret, tls->ctx->hkdf_label_prefix__obsolete)) == NULL) return PTLS_ERROR_NO_MEMORY; /* TODO obtain error from ptls_aead_new */ ctx->seq = 0; log_secret(tls, log_labels[ptls_is_server(tls) == is_enc][epoch], ptls_iovec_init(ctx->secret, tls->key_schedule->hashes[0].algo->digest_size)); PTLS_DEBUGF("[%s] %02x%02x,%02x%02x\n", log_labels[ptls_is_server(tls)][epoch], (unsigned)ctx->secret[0], (unsigned)ctx->secret[1], (unsigned)ctx->aead->static_iv[0], (unsigned)ctx->aead->static_iv[1]); return 0; }
pushq %rbp pushq %r15 pushq %r14 pushq %r12 pushq %rbx movl %r8d, %r12d movq %rcx, %r15 movl %esi, %ebp movq %rdi, %r14 leaq 0xb0(%rdi), %rbx leaq 0x58(%rdi), %rax testl %esi, %esi cmoveq %rax, %rbx testq %rdx, %rdx je 0x1321e movq 0x50(%r14), %rdi movq %rbx, %rsi callq 0x139d6 testl %eax, %eax jne 0x132d3 movq %r15, 0x40(%rbx) movq (%r14), %rax movq 0x90(%rax), %rdi testq %rdi, %rdi je 0x13254 xorl %eax, %eax testl %r12d, %r12d jne 0x132d3 movq (%rdi), %rax movq %r14, %rsi movl %ebp, %edx movq %r15, %rcx movq %rbx, %r8 popq %rbx popq %r12 popq %r14 popq %r15 popq %rbp jmpq *%rax movq 0x48(%rbx), %rdi testq %rdi, %rdi je 0x13265 callq 0xdd56 movq (%r14), %rax movq 0x120(%r14), %rcx movq 0x8(%rcx), %rdi movq 0x10(%rcx), %rsi movq 0x60(%rax), %r8 movl %ebp, %edx movq %rbx, %rcx callq 0x10b53 movq %rax, 0x48(%rbx) testq %rax, %rax je 0x132ce andq $0x0, 0x50(%rbx) movzbl 0x160(%r14), %eax andl $0x1, %eax xorl %ecx, %ecx cmpl %ebp, %eax sete %cl shll $0x5, %ecx leaq 0xfab4(%rip), %rax # 0x22d60 addq %rcx, %rax movq (%rax,%r15,8), %rsi movq 0x50(%r14), %rax movq 0x58(%rax), %rax movq 0x8(%rax), %rcx movq %r14, %rdi movq %rbx, %rdx callq 0x13a2a xorl %eax, %eax jmp 0x132d3 movl $0x201, %eax # imm = 0x201 popq %rbx popq %r12 popq %r14 popq %r15 popq %rbp retq
/rperper[P]picotls/lib/picotls.c
push_change_cipher_spec
static int push_change_cipher_spec(ptls_t *tls, ptls_buffer_t *sendbuf) { int ret = 0; if (!tls->send_change_cipher_spec) goto Exit; buffer_push_record(sendbuf, PTLS_CONTENT_TYPE_CHANGE_CIPHER_SPEC, { ptls_buffer_push(sendbuf, 1); }); tls->send_change_cipher_spec = 0; Exit: return ret; }
pushq %rbp pushq %r15 pushq %r14 pushq %rbx pushq %rax xorl %ebx, %ebx testb $0x4, 0x160(%rdi) je 0x13344 movq %rsi, %r15 movq %rdi, %r14 leaq 0x5(%rsp), %rsi movw $0x314, (%rsi) # imm = 0x314 movb $0x3, 0x2(%rsi) pushq $0x3 popq %rdx movq %r15, %rdi callq 0xd3e5 testl %eax, %eax jne 0x13342 leaq 0x8156(%rip), %rsi # 0x1b46e pushq $0x2 popq %rdx movq %r15, %rdi callq 0xd3e5 testl %eax, %eax jne 0x13342 movq 0x10(%r15), %rbp leaq 0x4(%rsp), %rsi movb $0x1, (%rsi) pushq $0x1 popq %rdx movq %r15, %rdi callq 0xd3e5 testl %eax, %eax je 0x13351 movl %eax, %ebx movl %ebx, %eax addq $0x8, %rsp popq %rbx popq %r14 popq %r15 popq %rbp retq movq (%r15), %rax movq 0x10(%r15), %rcx subq %rbp, %rcx movb %ch, -0x2(%rax,%rbp) movq (%r15), %rax movb %cl, -0x1(%rax,%rbp) andb $-0x5, 0x160(%r14) jmp 0x13344
/rperper[P]picotls/lib/picotls.c
aead_encrypt
static size_t aead_encrypt(struct st_ptls_traffic_protection_t *ctx, void *output, const void *input, size_t inlen, uint8_t content_type) { uint8_t aad[5]; size_t off = 0; build_aad(aad, inlen + 1 + ctx->aead->algo->tag_size); ptls_aead_encrypt_init(ctx->aead, ctx->seq++, aad, sizeof(aad)); off += ptls_aead_encrypt_update(ctx->aead, ((uint8_t *)output) + off, input, inlen); off += ptls_aead_encrypt_update(ctx->aead, ((uint8_t *)output) + off, &content_type, 1); off += ptls_aead_encrypt_final(ctx->aead, ((uint8_t *)output) + off); return off; }
pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x10, %rsp movq %rcx, %r12 movq %rdx, %r13 movq %rsi, %rbx movq %rdi, %r14 leaq 0xa(%rsp), %r15 movb %r8b, (%r15) movq 0x48(%rdi), %rdi movq (%rdi), %rax movq 0x28(%rax), %rax leaq 0x1(%rcx,%rax), %rax leaq 0xb(%rsp), %rdx movw $0x317, (%rdx) # imm = 0x317 movb $0x3, 0x2(%rdx) movb %ah, 0xe(%rsp) movb %al, 0x4(%rdx) movq 0x50(%r14), %rsi leaq 0x1(%rsi), %rax movq %rax, 0x50(%r14) pushq $0x5 popq %rcx callq 0x10ccc movq 0x48(%r14), %rdi movq %rbx, %rsi movq %r13, %rdx movq %r12, %rcx callq *0x28(%rdi) movq %rax, %r12 movq 0x48(%r14), %rdi leaq (%rbx,%rax), %rsi pushq $0x1 popq %rcx movq %r15, %rdx callq *0x28(%rdi) movq %rax, %r15 addq %r12, %r15 movq 0x48(%r14), %rdi addq %r15, %rbx movq %rbx, %rsi callq *0x30(%rdi) addq %r15, %rax addq $0x10, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 retq
/rperper[P]picotls/lib/picotls.c
handle_key_update
static int handle_key_update(ptls_t *tls, ptls_message_emitter_t *emitter, ptls_iovec_t message) { const uint8_t *src = message.base + PTLS_HANDSHAKE_HEADER_SIZE, *const end = message.base + message.len; int ret; /* validate */ if (end - src != 1 || *src > 1) return PTLS_ALERT_DECODE_ERROR; /* update receive key */ if ((ret = update_traffic_key(tls, 0)) != 0) return ret; if (*src) { if (tls->ctx->update_traffic_key != NULL) return PTLS_ALERT_UNEXPECTED_MESSAGE; tls->needs_key_update = 1; } return 0; }
pushq $0x32 popq %rax cmpq $0x5, %rdx jne 0x17aca pushq %r14 pushq %rbx pushq %rax movq %rsi, %r14 cmpb $0x1, 0x4(%rsi) ja 0x17ac3 movq %rdi, %rbx xorl %esi, %esi callq 0x13b17 testl %eax, %eax jne 0x17ac3 cmpb $0x0, 0x4(%r14) je 0x17ac1 movq (%rbx), %rax cmpq $0x0, 0x90(%rax) je 0x17aba pushq $0xa popq %rax jmp 0x17ac3 orb $0x8, 0x160(%rbx) xorl %eax, %eax addq $0x8, %rsp popq %rbx popq %r14 retq
/rperper[P]picotls/lib/picotls.c
send_certificate_and_certificate_verify
static int send_certificate_and_certificate_verify(ptls_t *tls, ptls_message_emitter_t *emitter, struct st_ptls_signature_algorithms_t *signature_algorithms, ptls_iovec_t context, const char *context_string, int push_status_request) { static ptls_emit_certificate_t default_emit_certificate = {default_emit_certificate_cb}; ptls_emit_certificate_t *emit_certificate = tls->ctx->emit_certificate != NULL ? tls->ctx->emit_certificate : &default_emit_certificate; int ret; msg("send_certificate_and_certificate_verify"); if (tls->in_handshake) goto resume_handshake; if (signature_algorithms->count == 0) { ret = PTLS_ALERT_MISSING_EXTENSION; goto Exit; } /* send Certificate (or the equivalent) */ if ((ret = emit_certificate->cb(emit_certificate, tls, emitter, tls->key_schedule, context, push_status_request)) != 0) goto Exit; /* build and send CertificateVerify */ if (tls->ctx->sign_certificate != NULL) { if ((tls->ctx->private_key_method) && (tls->is_server)) { uint8_t handshake_data[PTLS_MAX_CERTIFICATE_VERIFY_SIGNDATA_SIZE]; size_t handshake_len = 0; if (!tls->in_handshake) { ptls_buffer_init(&tls->handshake_buf, "", 0); handshake_len = build_certificate_verify_signdata(handshake_data, tls->key_schedule, context_string); } enum ptls_private_key_result_t res; uint16_t algo; if (!tls->in_handshake) { res = tls->ctx->private_key_method->sign(tls->ctx->sign_certificate, tls, &algo, &tls->handshake_buf, ptls_iovec_init(handshake_data, handshake_len), signature_algorithms->list, signature_algorithms->count); } else resume_handshake: res = tls->ctx->private_key_method->complete(tls->ctx->sign_certificate, tls, &algo, &tls->handshake_buf); switch (res) { case ptls_private_key_success: msg("Completed private_key_method"); ret = 0; tls->in_handshake = 0; ptls_push_message(emitter, tls->key_schedule, PTLS_HANDSHAKE_TYPE_CERTIFICATE_VERIFY, { ptls_buffer_t *sendbuf = emitter->buf; size_t algo_off = sendbuf->off; size_t siglen = tls->handshake_buf.off; msg("signature len: %ld", siglen); ptls_buffer_push16(sendbuf, 0); /* filled in later */ ptls_buffer_push_block(sendbuf, 2, { if ((ret = ptls_buffer_reserve(sendbuf, siglen)) != 0) { msg("Error reserving data space in signature"); goto Exit; } memcpy(sendbuf->base + sendbuf->off, tls->handshake_buf.base, siglen); sendbuf->off += siglen; ptls_buffer_dispose(&tls->handshake_buf); sendbuf->base[algo_off] = (uint8_t)(algo >> 8); sendbuf->base[algo_off + 1] = (uint8_t)algo; }); }); break; case ptls_private_key_retry: msg("Retry private_key_method"); ret = PTLS_ERROR_IN_PROGRESS; tls->in_handshake = 1; goto Exit; case ptls_private_key_failure: msg("FAILED private_key_method"); ret = PTLS_ERROR_SIGN_FAILURE; tls->in_handshake = 0; goto Exit; } } else ptls_push_message(emitter, tls->key_schedule, PTLS_HANDSHAKE_TYPE_CERTIFICATE_VERIFY, { ptls_buffer_t *sendbuf = emitter->buf; size_t algo_off = sendbuf->off; ptls_buffer_push16(sendbuf, 0); /* filled in later */ ptls_buffer_push_block(sendbuf, 2, { uint16_t algo; uint8_t data[PTLS_MAX_CERTIFICATE_VERIFY_SIGNDATA_SIZE]; size_t datalen = build_certificate_verify_signdata(data, tls->key_schedule, context_string); if ((ret = tls->ctx->sign_certificate->cb(tls->ctx->sign_certificate, tls, &algo, sendbuf, ptls_iovec_init(data, datalen), signature_algorithms->list, signature_algorithms->count)) != 0) { goto Exit; } sendbuf->base[algo_off] = (uint8_t)(algo >> 8); sendbuf->base[algo_off + 1] = (uint8_t)algo; }); }); } Exit: return ret; }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x218, %rsp # imm = 0x218 movq %r9, %rbp movq %r8, %r9 movq %rcx, %r8 movq %rsi, %rbx movq %rdi, %r14 movq (%rdi), %rcx movq 0x40(%rcx), %rax testq %rax, %rax leaq 0xb758(%rip), %rdi # 0x234b8 cmovneq %rax, %rdi testb $0x20, 0x160(%r14) jne 0x17fae movq %rdx, %r15 cmpq $0x0, 0x20(%rdx) je 0x17f25 movl 0x250(%rsp), %eax movq 0x50(%r14), %rcx subq $0x8, %rsp movq %r14, %rsi movq %rbx, %rdx pushq %rax callq *(%rdi) addq $0x10, %rsp testl %eax, %eax jne 0x1816b movq (%r14), %rcx cmpq $0x0, 0x48(%rcx) je 0x1814b cmpq $0x0, 0xc0(%rcx) je 0x17dcc movb 0x160(%r14), %dl testb $0x1, %dl jne 0x17f2d movq %rbx, %rdi callq *0x18(%rbx) testl %eax, %eax jne 0x1816b movq (%rbx), %r12 movq 0x50(%r14), %rax movq %rax, 0x8(%rsp) movq 0x10(%r12), %r13 leaq 0x16(%rsp), %rsi movb $0xf, (%rsi) pushq $0x1 popq %rdx movq %r12, %rdi callq 0xd3e5 testl %eax, %eax jne 0x1816b movq %r13, 0x20(%rsp) leaq 0x365c(%rip), %rsi # 0x1b46e pushq $0x3 popq %rdx movq %r12, %rdi callq 0xd3e5 testl %eax, %eax jne 0x1816b movq 0x10(%r12), %r13 movq (%rbx), %rdi movq 0x10(%rdi), %rax movq %rax, 0x28(%rsp) leaq 0x34(%rsp), %rsi andw $0x0, (%rsi) pushq $0x2 popq %rdx movq %rdi, 0x18(%rsp) callq 0xd3e5 testl %eax, %eax jne 0x1816b leaq 0x3613(%rip), %rsi # 0x1b46e pushq $0x2 popq %rdx movq 0x18(%rsp), %rdi callq 0xd3e5 testl %eax, %eax jne 0x1816b movq 0x18(%rsp), %rax movq 0x10(%rax), %rax movq %rax, 0x38(%rsp) movq 0x50(%r14), %rsi leaq 0x40(%rsp), %rdi movq %rbp, %rdx callq 0x186d2 movq (%r14), %rcx movq 0x48(%rcx), %rdi leaq 0x6(%rsp), %rdx movq %r14, %rsi movq 0x18(%rsp), %rcx leaq 0x40(%rsp), %r8 movq %rax, %r9 pushq 0x20(%r15) pushq %r15 callq *(%rdi) addq $0x10, %rsp testl %eax, %eax jne 0x1816b movb 0x7(%rsp), %al movq 0x18(%rsp), %rdx movq (%rdx), %rcx movq 0x28(%rsp), %rsi movb %al, (%rcx,%rsi) movb 0x6(%rsp), %al movq (%rdx), %rcx movb %al, 0x1(%rcx,%rsi) movq (%rdx), %rax movq 0x10(%rdx), %rcx movq 0x38(%rsp), %rsi subq %rsi, %rcx movb %ch, -0x2(%rax,%rsi) movq (%rdx), %rax movb %cl, -0x1(%rax,%rsi) movq 0x10(%r12), %rax subq %r13, %rax pushq $0x10 popq %rcx cmpq $-0x8, %rcx je 0x18196 movq %rax, %rdx shrq %cl, %rdx movq (%r12), %rsi movb %dl, -0x3(%rsi,%r13) addq $-0x8, %rcx incq %r13 jmp 0x17f03 pushq $0x6d popq %rax jmp 0x1816b testb $0x20, %dl jne 0x17f73 leaq 0x1cb9(%rip), %rax # 0x19bf2 movq %rax, 0x168(%r14) xorps %xmm0, %xmm0 movups %xmm0, 0x170(%r14) andl $0x0, 0x180(%r14) movq 0x50(%r14), %rsi leaq 0x130(%rsp), %rdi movq %rbp, %rdx callq 0x186d2 movb 0x160(%r14), %dl movq (%r14), %rcx jmp 0x17f75 xorl %eax, %eax testb $0x20, %dl jne 0x17fae movq 0x48(%rcx), %rdi movq 0xc0(%rcx), %r10 leaq 0x168(%r14), %rcx leaq 0x4(%rsp), %rdx leaq 0x130(%rsp), %r8 movq %r14, %rsi movq %rax, %r9 pushq 0x20(%r15) pushq %r15 callq *(%r10) addq $0x10, %rsp jmp 0x17fcb movq 0x48(%rcx), %rdi movq 0xc0(%rcx), %rax leaq 0x168(%r14), %rcx leaq 0x4(%rsp), %rdx movq %r14, %rsi callq *0x8(%rax) cmpl $0x2, %eax je 0x1815e cmpl $0x1, %eax je 0x1814f testl %eax, %eax jne 0x1814b andb $-0x21, 0x160(%r14) movq %rbx, %rdi callq *0x18(%rbx) testl %eax, %eax jne 0x1816b movq (%rbx), %r12 movq 0x50(%r14), %r15 movq 0x10(%r12), %rbp leaq 0x17(%rsp), %rsi movb $0xf, (%rsi) pushq $0x1 popq %rdx movq %r12, %rdi callq 0xd3e5 testl %eax, %eax jne 0x1816b leaq 0x3445(%rip), %rsi # 0x1b46e pushq $0x3 popq %rdx movq %r12, %rdi callq 0xd3e5 testl %eax, %eax jne 0x1816b movq 0x10(%r12), %r13 movq (%rbx), %rdi movq 0x10(%rdi), %rax movq %rax, 0x18(%rsp) movq 0x178(%r14), %rax movq %rax, 0x20(%rsp) leaq 0x36(%rsp), %rsi andw $0x0, (%rsi) pushq $0x2 popq %rdx movq %rdi, 0x8(%rsp) callq 0xd3e5 testl %eax, %eax jne 0x1816b leaq 0x33f0(%rip), %rsi # 0x1b46e pushq $0x2 popq %rdx movq 0x8(%rsp), %rdi callq 0xd3e5 testl %eax, %eax jne 0x1816b movq 0x8(%rsp), %rdi movq 0x10(%rdi), %rax movq %rax, 0x28(%rsp) movq 0x20(%rsp), %rsi callq 0xd359 testl %eax, %eax jne 0x1816b addq $0x168, %r14 # imm = 0x168 movq 0x8(%rsp), %rax movq (%rax), %rdi addq 0x10(%rax), %rdi movq (%r14), %rsi movq 0x20(%rsp), %rdx callq 0x6320 movq 0x8(%rsp), %rax movq 0x20(%rsp), %rcx addq %rcx, 0x10(%rax) movq %r14, %rdi callq 0xdc1a movb 0x5(%rsp), %al movq 0x8(%rsp), %rsi movq (%rsi), %rcx movq 0x18(%rsp), %rdx movb %al, (%rcx,%rdx) movb 0x4(%rsp), %al movq (%rsi), %rcx movb %al, 0x1(%rcx,%rdx) movq (%rsi), %rax movq 0x10(%rsi), %rcx movq 0x28(%rsp), %rdx subq %rdx, %rcx movb %ch, -0x2(%rax,%rdx) movq (%rsi), %rax movb %cl, -0x1(%rax,%rdx) movq 0x10(%r12), %rax subq %r13, %rax pushq $0x10 popq %rcx cmpq $-0x8, %rcx je 0x1817d movq %rax, %rdx shrq %cl, %rdx movq (%r12), %rsi movb %dl, -0x3(%rsi,%r13) addq $-0x8, %rcx incq %r13 jmp 0x1812d xorl %eax, %eax jmp 0x1816b orb $0x20, 0x160(%r14) movl $0x202, %eax # imm = 0x202 jmp 0x1816b andb $-0x21, 0x160(%r14) movl $0x209, %eax # imm = 0x209 addq $0x218, %rsp # imm = 0x218 popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq testq %r15, %r15 je 0x181b9 movq (%r12), %rsi addq %rbp, %rsi movq 0x10(%r12), %rdx subq %rbp, %rdx movq %r15, %rdi jmp 0x181b4 movq 0x8(%rsp), %rdi testq %rdi, %rdi je 0x181b9 movq (%r12), %rsi movq 0x20(%rsp), %rax addq %rax, %rsi movq 0x10(%r12), %rdx subq %rax, %rdx callq 0xd5b5 movq %rbx, %rdi callq *0x20(%rbx) jmp 0x1816b
/rperper[P]picotls/lib/picotls.c
decode_signature_algorithms
static int decode_signature_algorithms(struct st_ptls_signature_algorithms_t *sa, const uint8_t **src, const uint8_t *end) { int ret; ptls_decode_block(*src, end, 2, { do { uint16_t id; if ((ret = ptls_decode16(&id, src, end)) != 0) goto Exit; if (sa->count < sizeof(sa->list) / sizeof(sa->list[0])) sa->list[sa->count++] = id; } while (*src != end); }); ret = 0; Exit: return ret; }
movq (%rsi), %r8 movq %rdx, %rcx subq %r8, %rcx movl $0x32, %eax cmpq $0x2, %rcx jb 0x184e3 pushq %rbx leaq 0x1(%r8), %rcx movq %rcx, (%rsi) movzbl (%r8), %r9d shll $0x8, %r9d leaq 0x2(%r8), %rcx movq %rcx, (%rsi) movzbl 0x1(%r8), %r8d orq %r9, %r8 movq %rdx, %r9 subq %rcx, %r9 cmpq %r9, %r8 ja 0x184e2 leaq (%rcx,%r8), %r9 cmpq $0x2, %r8 jl 0x184e2 movzbl (%rcx), %ebx movzbl 0x1(%rcx), %r11d addq $0x2, %rcx movq %rcx, (%rsi) movq 0x20(%rdi), %r10 cmpq $0xf, %r10 ja 0x184cc movzwl %bx, %ebx shll $0x8, %ebx movzwl %r11w, %r11d orl %ebx, %r11d leaq 0x1(%r10), %rbx movq %rbx, 0x20(%rdi) movw %r11w, (%rdi,%r10,2) addq $-0x2, %r8 cmpq %r9, %rcx jne 0x18493 xorl %ecx, %ecx cmpq %rdx, %r9 movl $0x32, %eax cmovel %ecx, %eax popq %rbx retq
/rperper[P]picotls/lib/picotls.c
derive_resumption_secret
static int derive_resumption_secret(ptls_key_schedule_t *sched, uint8_t *secret, ptls_iovec_t nonce) { int ret; if ((ret = derive_secret(sched, secret, "res master")) != 0) goto Exit; if ((ret = hkdf_expand_label(sched->hashes[0].algo, secret, sched->hashes[0].algo->digest_size, ptls_iovec_init(secret, sched->hashes[0].algo->digest_size), "resumption", nonce, sched->hkdf_label_prefix)) != 0) goto Exit; Exit: if (ret != 0) ptls_clear_memory(secret, sched->hashes[0].algo->digest_size); return ret; }
pushq %rbp pushq %r14 pushq %rbx subq $0x30, %rsp movq %rsi, %rbx movq %rdi, %r14 movq %rdx, 0x20(%rsp) movq %rcx, 0x28(%rsp) leaq 0x2af6(%rip), %rdx # 0x1b289 callq 0x139d6 testl %eax, %eax jne 0x187cf movq 0x8(%r14), %rax movq 0x58(%r14), %rdi movq 0x8(%rdi), %rdx movups 0x20(%rsp), %xmm0 movups %xmm0, (%rsp) movq %rax, 0x10(%rsp) leaq 0x2ad7(%rip), %r9 # 0x1b294 movq %rbx, %rsi movq %rbx, %rcx movq %rdx, %r8 callq 0x105d1 testl %eax, %eax je 0x187f0 movl %eax, %ebp movq 0xacc8(%rip), %rax # 0x234a0 movq 0x58(%r14), %rcx movq 0x8(%rcx), %rsi movq %rbx, %rdi callq *%rax movl %ebp, %eax addq $0x30, %rsp popq %rbx popq %r14 popq %rbp retq xorl %ebp, %ebp jmp 0x187e5
/rperper[P]picotls/lib/picotls.c
client_do_handle_certificate
static int client_do_handle_certificate(ptls_t *tls, const uint8_t *src, const uint8_t *end) { int got_certs, ret; if ((ret = handle_certificate(tls, src, end, &got_certs)) != 0) return ret; if (!got_certs) return PTLS_ALERT_ILLEGAL_PARAMETER; return 0; }
pushq %rbx subq $0x10, %rsp leaq 0xc(%rsp), %rbx movq %rbx, %rcx callq 0x18916 xorl %ecx, %ecx cmpl $0x0, (%rbx) pushq $0x2f popq %rdx cmovnel %ecx, %edx testl %eax, %eax cmovel %edx, %eax addq $0x10, %rsp popq %rbx retq
/rperper[P]picotls/lib/picotls.c
handle_certificate_verify
static int handle_certificate_verify(ptls_t *tls, ptls_iovec_t message, const char *context_string) { const uint8_t *src = message.base + PTLS_HANDSHAKE_HEADER_SIZE, *const end = message.base + message.len; uint16_t algo; ptls_iovec_t signature; uint8_t signdata[PTLS_MAX_CERTIFICATE_VERIFY_SIGNDATA_SIZE]; size_t signdata_size; int ret; /* decode */ if ((ret = ptls_decode16(&algo, &src, end)) != 0) goto Exit; ptls_decode_block(src, end, 2, { signature = ptls_iovec_init(src, end - src); src = end; }); /* validate */ switch (algo) { case PTLS_SIGNATURE_RSA_PSS_RSAE_SHA256: case PTLS_SIGNATURE_ECDSA_SECP256R1_SHA256: /* ok */ break; default: ret = PTLS_ALERT_ILLEGAL_PARAMETER; goto Exit; } signdata_size = build_certificate_verify_signdata(signdata, tls->key_schedule, context_string); if (tls->certificate_verify.cb != NULL) { ret = tls->certificate_verify.cb(tls->certificate_verify.verify_ctx, ptls_iovec_init(signdata, signdata_size), signature); } else { ret = 0; } ptls_clear_memory(signdata, signdata_size); tls->certificate_verify.cb = NULL; if (ret != 0) { goto Exit; } ptls__key_schedule_update_hash(tls->key_schedule, message.base, message.len); Exit: return ret; }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0xe8, %rsp pushq $0x32 popq %rbp cmpq $0x6, %rdx jl 0x18ca0 movq %rdx, %rbx movabsq $0x7ffffffffffffffe, %rax # imm = 0x7FFFFFFFFFFFFFFE andq %rdx, %rax cmpq $0x6, %rax je 0x18ca0 movq %rsi, %r14 leaq (%rsi,%rbx), %rax movzwl 0x6(%rsi), %edx rolw $0x8, %dx movzwl %dx, %r12d leaq -0x8(%rbx), %rdx cmpq %rdx, %r12 setbe %dl addq %r12, %rsi addq $0x8, %rsi cmpq %rax, %rsi sete %al andb %dl, %al cmpb $0x1, %al jne 0x18ca0 movq %rdi, %r15 movzwl 0x4(%r14), %eax rolw $0x8, %ax movzwl %ax, %eax cmpl $0x804, %eax # imm = 0x804 je 0x18c35 cmpl $0x403, %eax # imm = 0x403 jne 0x18c6d movq 0x50(%r15), %rsi movq %rsp, %rdi movq %rcx, %rdx callq 0x186d2 movq %rax, %r13 movq 0x1f8(%r15), %rax testq %rax, %rax je 0x18c72 leaq 0x8(%r14), %rcx movq 0x200(%r15), %rdi movq %rsp, %rsi movq %r13, %rdx movq %r12, %r8 callq *%rax movl %eax, %ebp jmp 0x18c74 pushq $0x2f popq %rbp jmp 0x18ca0 xorl %ebp, %ebp movq 0xa825(%rip), %rax # 0x234a0 movq %rsp, %rdi movq %r13, %rsi callq *%rax andq $0x0, 0x1f8(%r15) testl %ebp, %ebp jne 0x18ca0 movq 0x50(%r15), %rdi movq %r14, %rsi movq %rbx, %rdx callq 0xd5b5 xorl %ebp, %ebp movl %ebp, %eax addq $0xe8, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq
/rperper[P]picotls/lib/picotls.c
Fossilize::FeatureFilter::Impl::validate_module_capability(spv::Capability) const
bool FeatureFilter::Impl::validate_module_capability(spv::Capability cap) const { // From table 75 in Vulkan spec. switch (cap) { case spv::CapabilityMatrix: case spv::CapabilityShader: case spv::CapabilityInputAttachment: case spv::CapabilitySampled1D: case spv::CapabilityImage1D: case spv::CapabilitySampledBuffer: case spv::CapabilityImageBuffer: case spv::CapabilityImageQuery: case spv::CapabilityDerivativeControl: case spv::CapabilityStorageImageExtendedFormats: return true; case spv::CapabilityDeviceGroup: return api_version >= VK_API_VERSION_1_1; case spv::CapabilityGeometry: return features2.features.geometryShader == VK_TRUE; case spv::CapabilityTessellation: return features2.features.tessellationShader == VK_TRUE; case spv::CapabilityFloat64: return features2.features.shaderFloat64 == VK_TRUE; case spv::CapabilityInt64: return features2.features.shaderInt64 == VK_TRUE; case spv::CapabilityInt64Atomics: return features.atomic_int64.shaderBufferInt64Atomics == VK_TRUE || features.atomic_int64.shaderSharedInt64Atomics == VK_TRUE || features.shader_image_atomic_int64.shaderImageInt64Atomics == VK_TRUE; case spv::CapabilityAtomicFloat16AddEXT: return features.shader_atomic_float2.shaderBufferFloat16AtomicAdd == VK_TRUE || features.shader_atomic_float2.shaderSharedFloat16AtomicAdd == VK_TRUE; case spv::CapabilityAtomicFloat32AddEXT: return features.shader_atomic_float.shaderBufferFloat32AtomicAdd == VK_TRUE || features.shader_atomic_float.shaderSharedFloat32AtomicAdd == VK_TRUE || features.shader_atomic_float.shaderImageFloat32AtomicAdd == VK_TRUE; case spv::CapabilityAtomicFloat64AddEXT: return features.shader_atomic_float.shaderBufferFloat64AtomicAdd == VK_TRUE || features.shader_atomic_float.shaderSharedFloat64AtomicAdd == VK_TRUE; case spv::CapabilityAtomicFloat16MinMaxEXT: return features.shader_atomic_float2.shaderBufferFloat16AtomicMinMax == VK_TRUE || features.shader_atomic_float2.shaderSharedFloat16AtomicMinMax == VK_TRUE; case spv::CapabilityAtomicFloat32MinMaxEXT: return features.shader_atomic_float2.shaderBufferFloat32AtomicMinMax == VK_TRUE || features.shader_atomic_float2.shaderSharedFloat32AtomicMinMax == VK_TRUE; case spv::CapabilityAtomicFloat64MinMaxEXT: return features.shader_atomic_float2.shaderBufferFloat64AtomicMinMax == VK_TRUE || features.shader_atomic_float2.shaderSharedFloat64AtomicMinMax == VK_TRUE; case spv::CapabilityInt64ImageEXT: return features.shader_image_atomic_int64.shaderImageInt64Atomics == VK_TRUE; case spv::CapabilityGroups: return enabled_extensions.count(VK_AMD_SHADER_BALLOT_EXTENSION_NAME); case spv::CapabilityInt16: return features2.features.shaderInt16 == VK_TRUE; case spv::CapabilityTessellationPointSize: case spv::CapabilityGeometryPointSize: return features2.features.shaderTessellationAndGeometryPointSize == VK_TRUE; case spv::CapabilityImageGatherExtended: return features2.features.shaderImageGatherExtended == VK_TRUE; case spv::CapabilityStorageImageMultisample: return features2.features.shaderStorageImageMultisample == VK_TRUE; case spv::CapabilityUniformBufferArrayDynamicIndexing: return features2.features.shaderUniformBufferArrayDynamicIndexing == VK_TRUE; case spv::CapabilitySampledImageArrayDynamicIndexing: return features2.features.shaderSampledImageArrayDynamicIndexing == VK_TRUE; case spv::CapabilityStorageBufferArrayDynamicIndexing: return features2.features.shaderStorageBufferArrayDynamicIndexing == VK_TRUE; case spv::CapabilityStorageImageArrayDynamicIndexing: return features2.features.shaderStorageImageArrayDynamicIndexing == VK_TRUE; case spv::CapabilityClipDistance: return features2.features.shaderClipDistance == VK_TRUE; case spv::CapabilityCullDistance: return features2.features.shaderCullDistance == VK_TRUE; case spv::CapabilityImageCubeArray: return features2.features.imageCubeArray == VK_TRUE; case spv::CapabilitySampleRateShading: return features2.features.sampleRateShading == VK_TRUE; case spv::CapabilitySparseResidency: return features2.features.shaderResourceResidency == VK_TRUE; case spv::CapabilityMinLod: return features2.features.shaderResourceMinLod == VK_TRUE; case spv::CapabilitySampledCubeArray: return features2.features.imageCubeArray == VK_TRUE; case spv::CapabilityImageMSArray: return features2.features.shaderStorageImageMultisample == VK_TRUE; case spv::CapabilityInterpolationFunction: return features2.features.sampleRateShading == VK_TRUE; case spv::CapabilityStorageImageReadWithoutFormat: return features2.features.shaderStorageImageReadWithoutFormat == VK_TRUE || api_version >= VK_API_VERSION_1_3 || enabled_extensions.count(VK_KHR_FORMAT_FEATURE_FLAGS_2_EXTENSION_NAME) != 0; case spv::CapabilityStorageImageWriteWithoutFormat: return features2.features.shaderStorageImageWriteWithoutFormat == VK_TRUE || api_version >= VK_API_VERSION_1_3 || enabled_extensions.count(VK_KHR_FORMAT_FEATURE_FLAGS_2_EXTENSION_NAME) != 0; case spv::CapabilityMultiViewport: return features2.features.multiViewport == VK_TRUE; case spv::CapabilityDrawParameters: return features.draw_parameters.shaderDrawParameters == VK_TRUE; case spv::CapabilityMultiView: return features.multiview.multiview == VK_TRUE; case spv::CapabilityVariablePointersStorageBuffer: return features.variable_pointers.variablePointersStorageBuffer == VK_TRUE; case spv::CapabilityVariablePointers: return features.variable_pointers.variablePointers == VK_TRUE; case spv::CapabilityShaderClockKHR: // There aren't two separate capabilities, so we'd have to analyze all opcodes to deduce this. // Just gate this on both feature bits being supported to be safe. return features.shader_clock.shaderDeviceClock == VK_TRUE && features.shader_clock.shaderSubgroupClock == VK_TRUE; case spv::CapabilityStencilExportEXT: return enabled_extensions.count(VK_EXT_SHADER_STENCIL_EXPORT_EXTENSION_NAME) != 0; case spv::CapabilitySubgroupBallotKHR: return enabled_extensions.count(VK_EXT_SHADER_SUBGROUP_BALLOT_EXTENSION_NAME) != 0; case spv::CapabilitySubgroupVoteKHR: return enabled_extensions.count(VK_EXT_SHADER_SUBGROUP_VOTE_EXTENSION_NAME) != 0; case spv::CapabilityImageReadWriteLodAMD: return enabled_extensions.count(VK_AMD_SHADER_IMAGE_LOAD_STORE_LOD_EXTENSION_NAME) != 0; case spv::CapabilityImageGatherBiasLodAMD: return enabled_extensions.count(VK_AMD_TEXTURE_GATHER_BIAS_LOD_EXTENSION_NAME) != 0; case spv::CapabilityFragmentMaskAMD: return enabled_extensions.count(VK_AMD_SHADER_FRAGMENT_MASK_EXTENSION_NAME) != 0; case spv::CapabilitySampleMaskOverrideCoverageNV: return enabled_extensions.count(VK_NV_SAMPLE_MASK_OVERRIDE_COVERAGE_EXTENSION_NAME) != 0; case spv::CapabilityGeometryShaderPassthroughNV: return enabled_extensions.count(VK_NV_GEOMETRY_SHADER_PASSTHROUGH_EXTENSION_NAME) != 0; case spv::CapabilityShaderViewportIndex: return features.vk12.shaderOutputViewportIndex || enabled_extensions.count(VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME) != 0; case spv::CapabilityShaderLayer: return features.vk12.shaderOutputLayer || enabled_extensions.count(VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME) != 0; case spv::CapabilityShaderViewportIndexLayerEXT: // NV version is a cloned enum. return enabled_extensions.count(VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME) != 0 || enabled_extensions.count(VK_NV_VIEWPORT_ARRAY2_EXTENSION_NAME) != 0; case spv::CapabilityShaderViewportMaskNV: return enabled_extensions.count(VK_NV_VIEWPORT_ARRAY2_EXTENSION_NAME) != 0; case spv::CapabilityPerViewAttributesNV: return enabled_extensions.count(VK_NVX_MULTIVIEW_PER_VIEW_ATTRIBUTES_EXTENSION_NAME) != 0; case spv::CapabilityStorageBuffer16BitAccess: return features.storage_16bit.storageBuffer16BitAccess == VK_TRUE; case spv::CapabilityUniformAndStorageBuffer16BitAccess: return features.storage_16bit.uniformAndStorageBuffer16BitAccess == VK_TRUE; case spv::CapabilityStoragePushConstant16: return features.storage_16bit.storagePushConstant16 == VK_TRUE; case spv::CapabilityStorageInputOutput16: return features.storage_16bit.storageInputOutput16 == VK_TRUE; case spv::CapabilityGroupNonUniform: return (props.subgroup.supportedOperations & VK_SUBGROUP_FEATURE_BASIC_BIT) != 0; case spv::CapabilityGroupNonUniformVote: return (props.subgroup.supportedOperations & VK_SUBGROUP_FEATURE_VOTE_BIT) != 0; case spv::CapabilityGroupNonUniformArithmetic: return (props.subgroup.supportedOperations & VK_SUBGROUP_FEATURE_ARITHMETIC_BIT) != 0; case spv::CapabilityGroupNonUniformBallot: return (props.subgroup.supportedOperations & VK_SUBGROUP_FEATURE_BALLOT_BIT) != 0; case spv::CapabilityGroupNonUniformShuffle: return (props.subgroup.supportedOperations & VK_SUBGROUP_FEATURE_SHUFFLE_BIT) != 0; case spv::CapabilityGroupNonUniformShuffleRelative: return (props.subgroup.supportedOperations & VK_SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT) != 0; case spv::CapabilityGroupNonUniformClustered: return (props.subgroup.supportedOperations & VK_SUBGROUP_FEATURE_CLUSTERED_BIT) != 0; case spv::CapabilityGroupNonUniformQuad: return (props.subgroup.supportedOperations & VK_SUBGROUP_FEATURE_QUAD_BIT) != 0; case spv::CapabilityGroupNonUniformPartitionedNV: return (props.subgroup.supportedOperations & VK_SUBGROUP_FEATURE_PARTITIONED_BIT_NV) != 0; case spv::CapabilitySampleMaskPostDepthCoverage: return enabled_extensions.count(VK_EXT_POST_DEPTH_COVERAGE_EXTENSION_NAME) != 0; case spv::CapabilityShaderNonUniform: return enabled_extensions.count(VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME) != 0 || api_version >= VK_API_VERSION_1_2; case spv::CapabilityRuntimeDescriptorArray: return features.descriptor_indexing.runtimeDescriptorArray == VK_TRUE; case spv::CapabilityInputAttachmentArrayDynamicIndexing: return features.descriptor_indexing.shaderInputAttachmentArrayDynamicIndexing == VK_TRUE; case spv::CapabilityUniformTexelBufferArrayDynamicIndexing: return features.descriptor_indexing.shaderUniformTexelBufferArrayDynamicIndexing == VK_TRUE; case spv::CapabilityStorageTexelBufferArrayDynamicIndexing: return features.descriptor_indexing.shaderStorageTexelBufferArrayDynamicIndexing == VK_TRUE; case spv::CapabilityUniformBufferArrayNonUniformIndexing: return features.descriptor_indexing.shaderUniformBufferArrayNonUniformIndexing == VK_TRUE; case spv::CapabilitySampledImageArrayNonUniformIndexing: return features.descriptor_indexing.shaderSampledImageArrayNonUniformIndexing == VK_TRUE; case spv::CapabilityUniformTexelBufferArrayNonUniformIndexing: return features.descriptor_indexing.shaderUniformTexelBufferArrayNonUniformIndexing == VK_TRUE; case spv::CapabilityStorageBufferArrayNonUniformIndexing: return features.descriptor_indexing.shaderStorageBufferArrayNonUniformIndexing == VK_TRUE; case spv::CapabilityStorageImageArrayNonUniformIndexing: return features.descriptor_indexing.shaderStorageImageArrayNonUniformIndexing == VK_TRUE; case spv::CapabilityInputAttachmentArrayNonUniformIndexing: return features.descriptor_indexing.shaderInputAttachmentArrayNonUniformIndexing == VK_TRUE; case spv::CapabilityStorageTexelBufferArrayNonUniformIndexing: return features.descriptor_indexing.shaderStorageTexelBufferArrayNonUniformIndexing == VK_TRUE; case spv::CapabilityFloat16: return features.float16_int8.shaderFloat16 == VK_TRUE || enabled_extensions.count(VK_AMD_GPU_SHADER_HALF_FLOAT_EXTENSION_NAME) != 0; case spv::CapabilityInt8: return features.float16_int8.shaderInt8 == VK_TRUE; case spv::CapabilityStorageBuffer8BitAccess: return features.storage_8bit.storageBuffer8BitAccess == VK_TRUE; case spv::CapabilityUniformAndStorageBuffer8BitAccess: return features.storage_8bit.uniformAndStorageBuffer8BitAccess == VK_TRUE; case spv::CapabilityStoragePushConstant8: return features.storage_8bit.storagePushConstant8 == VK_TRUE; case spv::CapabilityVulkanMemoryModel: return features.memory_model.vulkanMemoryModel == VK_TRUE; case spv::CapabilityVulkanMemoryModelDeviceScope: return features.memory_model.vulkanMemoryModelDeviceScope == VK_TRUE; case spv::CapabilityDenormPreserve: // Not sure if we have to inspect every possible type. Assume compiler won't barf if at least one property is set. return props.float_control.shaderDenormPreserveFloat16 == VK_TRUE || props.float_control.shaderDenormPreserveFloat32 == VK_TRUE || props.float_control.shaderDenormPreserveFloat64 == VK_TRUE; case spv::CapabilityDenormFlushToZero: // Not sure if we have to inspect every possible type. Assume compiler won't barf if at least one property is set. return props.float_control.shaderDenormFlushToZeroFloat16 == VK_TRUE || props.float_control.shaderDenormFlushToZeroFloat32 == VK_TRUE || props.float_control.shaderDenormFlushToZeroFloat64 == VK_TRUE; case spv::CapabilitySignedZeroInfNanPreserve: // Not sure if we have to inspect every possible type. Assume compiler won't barf if at least one property is set. return props.float_control.shaderSignedZeroInfNanPreserveFloat16 == VK_TRUE || props.float_control.shaderSignedZeroInfNanPreserveFloat32 == VK_TRUE || props.float_control.shaderSignedZeroInfNanPreserveFloat64 == VK_TRUE; case spv::CapabilityRoundingModeRTE: // Not sure if we have to inspect every possible type. Assume compiler won't barf if at least one property is set. return props.float_control.shaderRoundingModeRTEFloat16 == VK_TRUE || props.float_control.shaderRoundingModeRTEFloat32 == VK_TRUE || props.float_control.shaderRoundingModeRTEFloat64 == VK_TRUE; case spv::CapabilityRoundingModeRTZ: // Not sure if we have to inspect every possible type. Assume compiler won't barf if at least one property is set. return props.float_control.shaderRoundingModeRTZFloat16 == VK_TRUE || props.float_control.shaderRoundingModeRTZFloat32 == VK_TRUE || props.float_control.shaderRoundingModeRTZFloat64 == VK_TRUE; case spv::CapabilityComputeDerivativeGroupQuadsKHR: return features.compute_shader_derivatives.computeDerivativeGroupQuads == VK_TRUE; case spv::CapabilityComputeDerivativeGroupLinearKHR: return features.compute_shader_derivatives.computeDerivativeGroupLinear == VK_TRUE; case spv::CapabilityFragmentBarycentricKHR: return features.barycentric.fragmentShaderBarycentric == VK_TRUE; case spv::CapabilityImageFootprintNV: return features.image_footprint_nv.imageFootprint == VK_TRUE; case spv::CapabilityFragmentDensityEXT: // Spec mentions ShadingRateImageNV, but that does not appear to exist? return features.shading_rate_nv.shadingRateImage == VK_TRUE || features.fragment_density.fragmentDensityMap == VK_TRUE; case spv::CapabilityMeshShadingNV: return features.mesh_shader_nv.meshShader == VK_TRUE; case spv::CapabilityRayTracingNV: return enabled_extensions.count(VK_NV_RAY_TRACING_EXTENSION_NAME) != 0; case spv::CapabilityTransformFeedback: return features.transform_feedback.transformFeedback == VK_TRUE; case spv::CapabilityGeometryStreams: return features.transform_feedback.geometryStreams == VK_TRUE; case spv::CapabilityPhysicalStorageBufferAddresses: // Apparently these are different types? return features.buffer_device_address.bufferDeviceAddress == VK_TRUE || features.buffer_device_address_ext.bufferDeviceAddress == VK_TRUE; case spv::CapabilityCooperativeMatrixNV: return features.cooperative_matrix_nv.cooperativeMatrix == VK_TRUE; case spv::CapabilityIntegerFunctions2INTEL: return features.integer_functions2_intel.shaderIntegerFunctions2 == VK_TRUE; case spv::CapabilityShaderSMBuiltinsNV: return features.sm_builtins_nv.shaderSMBuiltins == VK_TRUE; case spv::CapabilityFragmentShaderSampleInterlockEXT: return features.shader_interlock.fragmentShaderSampleInterlock == VK_TRUE; case spv::CapabilityFragmentShaderPixelInterlockEXT: return features.shader_interlock.fragmentShaderPixelInterlock == VK_TRUE; case spv::CapabilityFragmentShaderShadingRateInterlockEXT: return features.shader_interlock.fragmentShaderShadingRateInterlock == VK_TRUE || features.shading_rate_nv.shadingRateImage == VK_TRUE; case spv::CapabilityDemoteToHelperInvocation: return features.demote_to_helper.shaderDemoteToHelperInvocation == VK_TRUE; case spv::CapabilityFragmentShadingRateKHR: return features.fragment_shading_rate.primitiveFragmentShadingRate == VK_TRUE; case spv::CapabilityRayQueryKHR: return features.ray_query.rayQuery == VK_TRUE; case spv::CapabilityRayTracingKHR: return features.ray_tracing_pipeline.rayTracingPipeline == VK_TRUE; case spv::CapabilityRayTraversalPrimitiveCullingKHR: return features.ray_tracing_pipeline.rayTraversalPrimitiveCulling == VK_TRUE || features.ray_query.rayQuery == VK_TRUE; case spv::CapabilityWorkgroupMemoryExplicitLayoutKHR: return features.workgroup_memory_explicit_layout.workgroupMemoryExplicitLayout == VK_TRUE; case spv::CapabilityWorkgroupMemoryExplicitLayout8BitAccessKHR: return features.workgroup_memory_explicit_layout.workgroupMemoryExplicitLayout8BitAccess == VK_TRUE; case spv::CapabilityWorkgroupMemoryExplicitLayout16BitAccessKHR: return features.workgroup_memory_explicit_layout.workgroupMemoryExplicitLayout16BitAccess == VK_TRUE; case spv::CapabilityDotProduct: case spv::CapabilityDotProductInputAll: case spv::CapabilityDotProductInput4x8Bit: case spv::CapabilityDotProductInput4x8BitPacked: return features.shader_integer_dot_product.shaderIntegerDotProduct == VK_TRUE; case spv::CapabilityMeshShadingEXT: return features.mesh_shader.meshShader == VK_TRUE; case spv::CapabilityFragmentFullyCoveredEXT: return enabled_extensions.count(VK_EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME) != 0; // AtomicFloat16VectorNV does not seem to exist. case spv::CapabilityRayCullMaskKHR: return features.ray_tracing_maintenance1.rayTracingMaintenance1 == VK_TRUE; case spv::CapabilityRayTracingMotionBlurNV: return features.ray_tracing_motion_blur_nv.rayTracingMotionBlur == VK_TRUE; case spv::CapabilityRayTracingOpacityMicromapEXT: return enabled_extensions.count(VK_EXT_OPACITY_MICROMAP_EXTENSION_NAME) != 0; case spv::CapabilityTextureSampleWeightedQCOM: return features.image_processing_qcom.textureSampleWeighted == VK_TRUE; case spv::CapabilityTextureBoxFilterQCOM: return features.image_processing_qcom.textureBoxFilter == VK_TRUE; case spv::CapabilityTextureBlockMatchQCOM: return features.image_processing_qcom.textureBlockMatch == VK_TRUE; case spv::CapabilityTextureBlockMatch2QCOM: return features.image_processing2_qcom.textureBlockMatch2 == VK_TRUE; case spv::CapabilityCoreBuiltinsARM: return features.shader_core_builtins_arm.shaderCoreBuiltins == VK_TRUE; case spv::CapabilityShaderInvocationReorderNV: return enabled_extensions.count(VK_NV_RAY_TRACING_INVOCATION_REORDER_EXTENSION_NAME) != 0; // Ignore CapabilityClusterCullingShadingHUAWEI. It does not exist in SPIR-V headers. case spv::CapabilityRayTracingPositionFetchKHR: case spv::CapabilityRayQueryPositionFetchKHR: return features.ray_tracing_position_fetch.rayTracingPositionFetch == VK_TRUE; case spv::CapabilityTileImageColorReadAccessEXT: return features.shader_tile_image.shaderTileImageColorReadAccess == VK_TRUE; case spv::CapabilityTileImageDepthReadAccessEXT: return features.shader_tile_image.shaderTileImageDepthReadAccess == VK_TRUE; case spv::CapabilityTileImageStencilReadAccessEXT: return features.shader_tile_image.shaderTileImageStencilReadAccess == VK_TRUE; case spv::CapabilityCooperativeMatrixKHR: return features.cooperative_matrix.cooperativeMatrix == VK_TRUE; // Ignore ShaderEnqueueAMDX, it's a beta extension. case spv::CapabilityGroupNonUniformRotateKHR: return features.shader_subgroup_rotate.shaderSubgroupRotate == VK_TRUE; case spv::CapabilityExpectAssumeKHR: return features.expect_assume.shaderExpectAssume == VK_TRUE; case spv::CapabilityFloatControls2: return features.shader_float_controls2.shaderFloatControls2 == VK_TRUE; case spv::CapabilityQuadControlKHR: return features.shader_quad_control.shaderQuadControl == VK_TRUE; case spv::CapabilityRawAccessChainsNV: return features.raw_access_chains_nv.shaderRawAccessChains == VK_TRUE; case spv::CapabilityReplicatedCompositesEXT: return features.shader_replicated_composites.shaderReplicatedComposites == VK_TRUE; default: LOGE("Unrecognized SPIR-V capability %u, treating as unsupported.\n", unsigned(cap)); return false; } }
pushq %r15 pushq %r14 pushq %rbx subq $0x50, %rsp movl %esi, %edx movq %rdi, %r14 movb $0x1, %bl cmpl $0x46, %esi jbe 0xb0f5 leal -0x1146(%rdx), %eax cmpl $0x4c, %eax jbe 0xb114 leal -0x1491(%rdx), %eax cmpl $0x2f, %eax jbe 0xb131 leal -0x1780(%rdx), %eax cmpl $0x12, %eax jbe 0xb14d leal -0x14d8(%rdx), %eax cmpl $0xe, %eax jbe 0xb16a leal -0x14fc(%rdx), %eax cmpl $0xb, %eax jbe 0xb187 leal -0x1391(%rdx), %eax cmpl $0x7, %eax jbe 0xb1af leal -0x1481(%rdx), %eax cmpl $0xb, %eax jbe 0xb1cb leal -0x1045(%rdx), %eax cmpl $0x3, %eax jbe 0xb1e7 cmpl $0x13bf, %edx # imm = 0x13BF je 0xba2f cmpl $0x13df, %edx # imm = 0x13DF je 0xb9fd cmpl $0x14ed, %edx # imm = 0x14ED je 0xb988 cmpl $0x14f3, %edx # imm = 0x14F3 je 0xb9b7 cmpl $0x150f, %edx # imm = 0x150F je 0xb17a cmpl $0x1526, %edx # imm = 0x1526 je 0xb9d9 cmpl $0x15d0, %edx # imm = 0x15D0 je 0xba11 cmpl $0x15ec, %edx # imm = 0x15EC je 0xb995 cmpl $0x15ed, %edx # imm = 0x15ED je 0xb9e3 cmpl $0x15f0, %edx # imm = 0x15F0 je 0xb9c4 cmpl $0x15fd, %edx # imm = 0x15FD je 0xb9aa cmpl $0x17cf, %edx # imm = 0x17CF jne 0xba54 cmpl $0x1, 0xa3c(%r14) sete %al cmpl $0x1, 0xa50(%r14) jmp 0xb9f6 movl %edx, %eax leaq 0x6146(%rip), %rcx # 0x11244 movslq (%rcx,%rax,4), %rax addq %rcx, %rax jmpq *%rax cmpl $0x1, 0x40c(%r14) jmp 0xba45 leaq 0x6255(%rip), %rcx # 0x11370 movslq (%rcx,%rax,4), %rax addq %rcx, %rax jmpq *%rax cmpl $0x1, 0x66c(%r14) jmp 0xba45 leaq 0x63bc(%rip), %rcx # 0x114f4 movslq (%rcx,%rax,4), %rax addq %rcx, %rax jmpq *%rax leaq 0x72d5(%rip), %rsi # 0x1241d jmp 0xb958 leaq 0x64cc(%rip), %rcx # 0x11620 movslq (%rcx,%rax,4), %rax addq %rcx, %rax jmpq *%rax cmpl $0x1, 0x710(%r14) jmp 0xba45 leaq 0x6443(%rip), %rcx # 0x115b4 movslq (%rcx,%rax,4), %rax addq %rcx, %rax jmpq *%rax cmpl $0x1, 0xd18(%r14) jmp 0xba45 leaq 0x6462(%rip), %rcx # 0x115f0 movslq (%rcx,%rax,4), %rax addq %rcx, %rax jmpq *%rax cmpl $0x1, 0x850(%r14) sete %al cmpl $0x1, 0xaf0(%r14) jmp 0xb9f6 leaq 0x62ee(%rip), %rcx # 0x114a4 movslq (%rcx,%rax,4), %rax addq %rcx, %rax jmpq *%rax leaq 0x7533(%rip), %rsi # 0x126f9 jmp 0xb958 leaq 0x62f2(%rip), %rcx # 0x114c4 movslq (%rcx,%rax,4), %rax addq %rcx, %rax jmpq *%rax leaq 0x774b(%rip), %rsi # 0x1292d jmp 0xb958 leaq 0x6172(%rip), %rcx # 0x11360 movslq (%rcx,%rax,4), %rax addq %rcx, %rax jmpq *%rax cmpl $0x1, 0xd00(%r14) jmp 0xba45 cmpl $0x1, 0x3b8(%r14) jmp 0xba45 cmpl $0x1, 0x418(%r14) jmp 0xba45 cmpl $0x1, 0x3a8(%r14) jmp 0xba45 leaq 0x79a5(%rip), %rsi # 0x12bd7 jmp 0xb958 cmpl $0x1, 0xcb0(%r14) jmp 0xba45 cmpl $0x1, 0x5c8(%r14) jmp 0xba45 cmpl $0x1, 0xaac(%r14) jmp 0xba45 cmpl $0x1, 0x630(%r14) sete %al cmpl $0x1, 0x888(%r14) jmp 0xb9f6 cmpl $0x1, 0x5cc(%r14) jmp 0xba45 leaq 0x77b2(%rip), %rsi # 0x12a3c jmp 0xb958 leaq 0x70d7(%rip), %rsi # 0x1236d jmp 0xb958 cmpl $0x1, 0x84c(%r14) jmp 0xba45 cmpl $0x1, 0xb20(%r14) jmp 0xba45 cmpl $0x1, 0x830(%r14) jmp 0xba45 leaq 0x73b2(%rip), %rsi # 0x1267b jmp 0xb958 leaq 0x75b0(%rip), %rsi # 0x12885 jmp 0xb958 leaq 0x735a(%rip), %rsi # 0x1263b jmp 0xb958 cmpl $0x1, 0xde0(%r14) jmp 0xba45 cmpl $0x1, 0xd50(%r14) jmp 0xba45 cmpl $0x1, 0xa04(%r14) sete %al cmpl $0x1, 0xa14(%r14) jmp 0xb9f6 cmpl $0x1, 0xd98(%r14) jmp 0xba45 cmpl $0x1, 0x9fc(%r14) je 0xba48 cmpl $0x1, 0xa0c(%r14) je 0xba48 cmpl $0x1, 0xa1c(%r14) jmp 0xba45 cmpl $0x1, 0xd68(%r14) jmp 0xba45 cmpl $0x1, 0xc98(%r14) jmp 0xba45 cmpl $0x1, 0xac0(%r14) jmp 0xba45 cmpl $0x1, 0x5b4(%r14) jmp 0xba45 cmpl $0x1, 0xaf0(%r14) sete %al cmpl $0x1, 0x868(%r14) jmp 0xb9f6 cmpl $0x1, 0xad8(%r14) jmp 0xba45 cmpl $0x1, 0xbf4(%r14) jmp 0xba45 cmpl $0x1, 0xc0c(%r14) jmp 0xba45 cmpl $0x1, 0x56c(%r14) jmp 0xba45 cmpl $0x1, 0xaa8(%r14) jmp 0xba45 movb 0x10b1(%r14), %bl jmp 0xb817 leaq 0x6439(%rip), %rsi # 0x11827 leaq 0x10(%rsp), %r15 leaq 0x30(%rsp), %rdx movq %r15, %rdi callq 0x3060 movq %r14, %rdi movq %r15, %rsi callq 0xf554 testq %rax, %rax setne %al cmpl $0x402000, 0x40(%r14) # imm = 0x402000 setae %bl orb %al, %bl jmp 0xb97b cmpl $0x1, 0x570(%r14) jmp 0xba45 cmpl $0x1, 0x574(%r14) jmp 0xba45 cmpl $0x1, 0x57c(%r14) jmp 0xba45 cmpl $0x1, 0x58c(%r14) jmp 0xba45 cmpl $0x1, 0x568(%r14) jmp 0xba45 cmpl $0x1, 0x578(%r14) jmp 0xba45 cmpl $0x1, 0x588(%r14) jmp 0xba45 cmpl $0x1, 0x584(%r14) jmp 0xba45 cmpl $0x1, 0x580(%r14) jmp 0xba45 cmpl $0x1, 0x10f4(%r14) je 0xba48 cmpl $0x1, 0x10f8(%r14) je 0xba48 cmpl $0x1, 0x10fc(%r14) jmp 0xba45 cmpl $0x1, 0xccc(%r14) jmp 0xba45 cmpl $0x1, 0x10e8(%r14) je 0xba48 cmpl $0x1, 0x10ec(%r14) je 0xba48 cmpl $0x1, 0x10f0(%r14) jmp 0xba45 cmpl $0x1, 0x4b0(%r14) jmp 0xba45 leaq 0x7341(%rip), %rsi # 0x1284c jmp 0xb958 cmpl $0x401000, 0x40(%r14) # imm = 0x401000 setae %bl jmp 0xba48 cmpl $0x1, 0xcd0(%r14) jmp 0xba45 cmpl $0x1, 0x498(%r14) jmp 0xba45 cmpl $0x1, 0x4d0(%r14) jmp 0xba45 cmpl $0x1, 0x6fc(%r14) jmp 0xba45 cmpl $0x1, 0x49c(%r14) jmp 0xba45 cmpl $0x1, 0x4d4(%r14) jmp 0xba45 leaq 0x7377(%rip), %rsi # 0x128ec jmp 0xb958 cmpl $0x1, 0x688(%r14) jmp 0xba45 cmpl $0x1, 0x6f8(%r14) jmp 0xba45 cmpl $0x1, 0x500(%r14) jmp 0xba45 cmpl $0x1, 0x51c(%r14) jmp 0xba45 cmpl $0x1, 0x6f0(%r14) jmp 0xba45 cmpl $0x1, 0x494(%r14) jmp 0xba45 cmpl $0x1, 0x10d0(%r14) je 0xba48 cmpl $0x1, 0x10d4(%r14) je 0xba48 cmpl $0x1, 0x10d8(%r14) jmp 0xba45 leaq 0x72c0(%rip), %rsi # 0x128b8 jmp 0xb958 cmpl $0x1, 0x490(%r14) jmp 0xba45 cmpl $0x1, 0x6b0(%r14) sete %al cmpl $0x1, 0x688(%r14) jmp 0xb9f6 cmpl $0x1, 0x518(%r14) jmp 0xba45 cmpl $0x1, 0x10dc(%r14) je 0xba48 cmpl $0x1, 0x10e0(%r14) je 0xba48 cmpl $0x1, 0x10e4(%r14) jmp 0xba45 cmpl $0x1, 0x1100(%r14) je 0xba48 cmpl $0x1, 0x1104(%r14) je 0xba48 cmpl $0x1, 0x1108(%r14) jmp 0xba45 cmpl $0x1, 0x520(%r14) jmp 0xba45 cmpl $0x1, 0xce8(%r14) jmp 0xba45 cmpl $0x1, 0xcc8(%r14) jmp 0xba45 cmpl $0x1, 0x6a0(%r14) jmp 0xba45 cmpl $0x1, 0x3e8(%r14) jmp 0xba45 movb 0x10b0(%r14), %bl andb $0x10, %bl shrb $0x4, %bl jmp 0xba48 cmpl $0x1, 0x434(%r14) jmp 0xba45 cmpl $0x1, 0x554(%r14) jmp 0xba45 cmpl $0x0, 0x100c(%r14) jne 0xba48 jmp 0xb896 cmpl $0x1, 0x410(%r14) jmp 0xba45 cmpl $0x1, 0x43c(%r14) jmp 0xba45 cmpl $0x1, 0x7bc(%r14) jmp 0xba45 leaq 0x6eda(%rip), %rsi # 0x12609 jmp 0xb958 cmpl $0x1, 0x428(%r14) jmp 0xba45 cmpl $0x1, 0x3b0(%r14) jmp 0xba45 cmpl $0x1, 0x440(%r14) jmp 0xba45 movb 0x10b0(%r14), %bl andb $0x40, %bl shrb $0x6, %bl jmp 0xba48 cmpl $0x1, 0x424(%r14) jmp 0xba45 cmpl $0x1, 0x550(%r14) je 0xba48 leaq 0x6e16(%rip), %rsi # 0x125a5 jmp 0xb958 movb 0x10b0(%r14), %bl andb $0x8, %bl shrb $0x3, %bl jmp 0xba48 cmpl $0x1, 0x444(%r14) jmp 0xba45 cmpl $0x1, 0x3b4(%r14) jmp 0xba45 cmpl $0x1, 0x430(%r14) jmp 0xba45 cmpl $0x1, 0x538(%r14) je 0xba48 cmpl $0x1, 0x53c(%r14) je 0xba48 cmpl $0x1, 0x9e0(%r14) jmp 0xba45 cmpl $0x1, 0x448(%r14) jmp 0xba45 cmpl $0x1, 0x7b8(%r14) jmp 0xba45 movb 0x10b0(%r14), %bl andb $0x1, %bl jmp 0xba48 movb 0x10b0(%r14), %bl shrb $0x7, %bl jmp 0xba48 cmpl $0x1, 0x438(%r14) jmp 0xba45 cmpl $0x1, 0x42c(%r14) jmp 0xba45 cmpl $0x1, 0x41c(%r14) jne 0xb8b0 jmp 0xba48 movb 0x10b0(%r14), %bl andb $0x20, %bl shrb $0x5, %bl jmp 0xba48 movb 0x10b0(%r14), %bl andb $0x4, %bl shrb $0x2, %bl jmp 0xba48 cmpl $0x1, 0x44c(%r14) jmp 0xba45 cmpl $0x0, 0x1008(%r14) jne 0xba48 leaq 0x71e8(%rip), %rsi # 0x12a85 jmp 0xb958 cmpl $0x1, 0x420(%r14) je 0xba48 cmpl $0x402fff, 0x40(%r14) # imm = 0x402FFF ja 0xba48 leaq 0x7a4c(%rip), %rsi # 0x13311 jmp 0xb958 movb 0x10b0(%r14), %bl andb $0x2, %bl shrb %bl jmp 0xba48 leaq 0x70de(%rip), %rsi # 0x129c0 jmp 0xb958 leaq 0x719a(%rip), %rsi # 0x12a85 leaq 0x10(%rsp), %rbx leaq 0xf(%rsp), %rdx movq %rbx, %rdi callq 0x3060 movq %r14, %rdi movq %rbx, %rsi callq 0xf554 movb $0x1, %bl testq %rax, %rax jne 0xb941 leaq 0x70aa(%rip), %rsi # 0x129c0 leaq 0x30(%rsp), %r15 leaq 0xe(%rsp), %rdx movq %r15, %rdi callq 0x3060 movq %r14, %rdi movq %r15, %rsi callq 0xf554 testq %rax, %rax setne %bl movq %r15, %rdi callq 0x3130 leaq 0x10(%rsp), %rdi jmp 0xb97e leaq 0x7025(%rip), %rsi # 0x12974 jmp 0xb958 leaq 0x7176(%rip), %rsi # 0x12ace leaq 0x10(%rsp), %r15 leaq 0x30(%rsp), %rdx movq %r15, %rdi callq 0x3060 movq %r14, %rdi movq %r15, %rsi callq 0xf554 testq %rax, %rax setne %bl movq %r15, %rdi callq 0x3130 jmp 0xba48 cmpl $0x1, 0xb08(%r14) jmp 0xba45 cmpl $0x1, 0xa44(%r14) sete %al cmpl $0x1, 0xa58(%r14) jmp 0xb9f6 cmpl $0x1, 0xd80(%r14) jmp 0xba45 cmpl $0x1, 0x848(%r14) jmp 0xba45 cmpl $0x1, 0xa40(%r14) sete %al cmpl $0x1, 0xa54(%r14) jmp 0xb9f6 cmpl $0x1, 0xdc8(%r14) jmp 0xba45 cmpl $0x1, 0xa48(%r14) sete %al cmpl $0x1, 0xa5c(%r14) sete %bl orb %al, %bl jmp 0xba48 cmpl $0x1, 0xdb0(%r14) jmp 0xba45 cmpl $0x1, 0xd34(%r14) jmp 0xba45 cmpl $0x1, 0xb38(%r14) jmp 0xba45 cmpl $0x1, 0xd38(%r14) jmp 0xba45 cmpl $0x1, 0xd30(%r14) jmp 0xba45 movl 0x650(%r14), %eax movl 0x654(%r14), %ecx xorl $0x1, %ecx xorl $0x1, %eax orl %ecx, %eax sete %bl movl %ebx, %eax addq $0x50, %rsp popq %rbx popq %r14 popq %r15 retq movq 0xc585(%rip), %r14 # 0x17fe0 movq (%r14), %rdi leaq 0x78c9(%rip), %rsi # 0x1332e xorl %ebx, %ebx xorl %eax, %eax callq 0x3180 movq (%r14), %rdi callq 0x3110 jmp 0xba48
/ValveSoftware[P]Fossilize/cli/fossilize_feature_filter.cpp
panic
static int panic (lua_State *L) { const char *msg = (lua_type(L, -1) == LUA_TSTRING) ? lua_tostring(L, -1) : "error object is not a string"; lua_writestringerror("PANIC: unprotected error in call to Lua API (%s)\n", msg); return 0; /* return to Lua to abort */ }
pushq %rbx movq %rdi, %rbx pushq $-0x1 popq %rsi callq 0x68d4 cmpl $0x4, %eax jne 0x5627 pushq $-0x1 popq %rsi movq %rbx, %rdi xorl %edx, %edx callq 0x6bb8 movq %rax, %rdx jmp 0x562e leaq 0x2410b(%rip), %rdx # 0x29739 movq 0x349a3(%rip), %rbx # 0x39fd8 movq (%rbx), %rdi leaq 0x24117(%rip), %rsi # 0x29756 xorl %eax, %eax callq 0x5430 movq (%rbx), %rdi callq 0x53b0 xorl %eax, %eax popq %rbx retq
/mmanyen[P]CLua/build_O1/_deps/lua/lauxlib.c
warnfcont
static void warnfcont (void *ud, const char *message, int tocont) { lua_State *L = (lua_State *)ud; lua_writestringerror("%s", message); /* write message */ if (tocont) /* not the last part? */ lua_setwarnf(L, warnfcont, L); /* to be continued */ else { /* last part */ lua_writestringerror("%s", "\n"); /* finish message with end-of-line */ lua_setwarnf(L, warnfon, L); /* next call is a new message */ } }
pushq %rbp pushq %r14 pushq %rbx movl %edx, %ebp movq %rsi, %rax movq %rdi, %rbx movq 0x34973(%rip), %r14 # 0x39fd8 movq (%r14), %rsi movq %rax, %rdi callq 0x53a0 movq (%r14), %rdi callq 0x53b0 testl %ebp, %ebp je 0x5692 leaq -0x31(%rip), %rsi # 0x5652 movq %rbx, %rdi movq %rbx, %rdx popq %rbx popq %r14 popq %rbp jmp 0x7eed movq (%r14), %rsi leaq 0x23b36(%rip), %rdi # 0x291d2 callq 0x53a0 movq (%r14), %rdi callq 0x53b0 leaq 0x47c2(%rip), %rsi # 0x9e72 jmp 0x5683
/mmanyen[P]CLua/build_O1/_deps/lua/lauxlib.c
db_debug
static int db_debug (lua_State *L) { for (;;) { char buffer[250]; lua_writestringerror("%s", "lua_debug> "); if (fgets(buffer, sizeof(buffer), stdin) == NULL || strcmp(buffer, "cont\n") == 0) return 0; if (luaL_loadbuffer(L, buffer, strlen(buffer), "=(debug command)") || lua_pcall(L, 0, 0, 0)) lua_writestringerror("%s\n", luaL_tolstring(L, -1, NULL)); lua_settop(L, 0); /* remove eventual returns */ } }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x108, %rsp # imm = 0x108 movq %rdi, %rbx movq 0x34376(%rip), %rbp # 0x39fd8 movq (%rbp), %rsi leaq 0x2613a(%rip), %rdi # 0x2bda7 callq 0x53a0 movq (%rbp), %rdi callq 0x53b0 movq 0x3434e(%rip), %r14 # 0x39fd0 movq (%r14), %rdx movq %rsp, %rdi movl $0xfa, %esi callq 0x54a0 testq %rax, %rax je 0x5d7a leaq 0x26111(%rip), %r13 # 0x2bdb3 movq %rsp, %r15 pushq $0x6 popq %r12 movq %r15, %rdi movq %r13, %rsi movq %r12, %rdx callq 0x5350 testl %eax, %eax je 0x5d7a movq %r15, %rdi callq 0x5180 movq %rbx, %rdi movq %r15, %rsi movq %rax, %rdx leaq 0x260e2(%rip), %rcx # 0x2bdb9 xorl %r8d, %r8d callq 0x967b testl %eax, %eax jne 0x5cfb movq %rbx, %rdi xorl %esi, %esi xorl %edx, %edx xorl %ecx, %ecx xorl %r8d, %r8d xorl %r9d, %r9d callq 0x794a testl %eax, %eax je 0x5d3e movq %r14, %r15 movq %r12, %r14 movq %r13, %r12 movq (%rbp), %r13 movq %rbx, %rdi pushq $-0x1 popq %rsi xorl %edx, %edx callq 0x97a7 movq %r13, %rdi movq %r12, %r13 movq %r14, %r12 movq %r15, %r14 movq %rsp, %r15 leaq 0x23300(%rip), %rsi # 0x2902b movq %rax, %rdx xorl %eax, %eax callq 0x5430 movq (%rbp), %rdi callq 0x53b0 movq %rbx, %rdi xorl %esi, %esi callq 0x664e movq (%rbp), %rsi leaq 0x26054(%rip), %rdi # 0x2bda7 callq 0x53a0 movq (%rbp), %rdi callq 0x53b0 movq (%r14), %rdx movq %r15, %rdi movl $0xfa, %esi callq 0x54a0 testq %rax, %rax jne 0x5ca9 xorl %eax, %eax addq $0x108, %rsp # imm = 0x108 popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq nop
/mmanyen[P]CLua/build_O1/_deps/lua/ldblib.c
StringTest
LuaGlue(StringTest) { if (pLua->GetArgumentType(1) != LuaArgType::ARG_TYPE_STRING) { printf("Fail: StringTest argument is not a String\n"); sLuaBasedTestResult += -4; } const char* r = pLua->GetStringArgument(1, "fail"); pLua->PushString(r); return 1; }
pushq %rax movq 0x3448f(%rip), %rdi # 0x3a348 movl $0x1, %esi callq 0x650c cmpl $0x2, %eax je 0x5edb leaq 0x231ea(%rip), %rdi # 0x290b9 callq 0x5480 addl $-0x4, 0x34475(%rip) # 0x3a350 movq 0x34466(%rip), %rdi # 0x3a348 leaq 0x23137(%rip), %rdx # 0x29020 movl $0x1, %esi callq 0x64ba movq 0x3444e(%rip), %rdi # 0x3a348 movq %rax, %rsi callq 0x6544 movl $0x1, %eax popq %rcx retq
/mmanyen[P]CLua/test/test.cpp
NumberTest
LuaGlue(NumberTest) { if (pLua->GetArgumentType(1) != LuaArgType::ARG_TYPE_NUMBER) { printf("Fail: NumberTest argument is not a Number\n"); sLuaBasedTestResult += -5; } double r = pLua->GetNumberArgument(1, INFINITY); pLua->PushNumber(r); return 1; }
pushq %rax movq 0x34437(%rip), %rdi # 0x3a348 movl $0x1, %esi callq 0x650c cmpl $0x1, %eax je 0x5f33 leaq 0x231bc(%rip), %rdi # 0x290e3 callq 0x5480 addl $-0x5, 0x3441d(%rip) # 0x3a350 movq 0x3440e(%rip), %rdi # 0x3a348 movsd 0x230c6(%rip), %xmm0 # 0x29008 movl $0x1, %esi callq 0x64c6 movq 0x343f5(%rip), %rdi # 0x3a348 callq 0x654e movl $0x1, %eax popq %rcx retq
/mmanyen[P]CLua/test/test.cpp
BoolTest
LuaGlue(BoolTest) { if (pLua->GetArgumentType(1) != LuaArgType::ARG_TYPE_BOOL) { printf("Fail: BoolTest argument is not a Boolean\n"); sLuaBasedTestResult += -7; } bool r = pLua->GetBoolArgument(1); pLua->PushBool(r); return 1; }
pushq %rax movq 0x34383(%rip), %rdi # 0x3a348 movl $0x1, %esi callq 0x650c cmpl $0x3, %eax je 0x5fe7 leaq 0x2315d(%rip), %rdi # 0x29138 callq 0x5480 addl $-0x7, 0x34369(%rip) # 0x3a350 movq 0x3435a(%rip), %rdi # 0x3a348 movl $0x1, %esi xorl %edx, %edx callq 0x64dc movq 0x34347(%rip), %rdi # 0x3a348 movzbl %al, %esi callq 0x6530 movl $0x1, %eax popq %rcx retq
/mmanyen[P]CLua/test/test.cpp
main
int main() { int retval = 0; printf("Hello World!\n"); pLua = new CLua(); pLua->AddFunction("FAIL", FAIL); pLua->AddFunction(myFunctions); if (!pLua->RunString("print('Test String has run')")) { printf("Failed to run c string\n"); retval += -1; } if (!pLua->RunScript("scripttest.lua")) { printf("Failed to run script file\n"); retval += -2; } retval += sLuaBasedTestResult; if (retval == 0) { printf("All tests passed\n"); } else { printf("Some test failed: Guru Medition:%d", retval); } return retval; }
pushq %r14 pushq %rbx pushq %rax leaq 0x23132(%rip), %rdi # 0x29161 callq 0x5480 movl $0x20, %edi callq 0x5330 movq %rax, %rbx movq %rax, %rdi callq 0x615e movq %rbx, 0x342f8(%rip) # 0x3a348 leaq 0x22fd8(%rip), %rsi # 0x2902f leaq -0x1e2(%rip), %rdx # 0x5e7c movq %rbx, %rdi callq 0x647e movq 0x342db(%rip), %rdi # 0x3a348 leaq 0x32b5c(%rip), %rsi # 0x38bd0 callq 0x6226 movq 0x342c8(%rip), %rdi # 0x3a348 leaq 0x22fad(%rip), %rsi # 0x29034 callq 0x63aa xorl %ebx, %ebx testb %al, %al jne 0x60a3 leaq 0x230d5(%rip), %rdi # 0x2916e callq 0x5480 movl $0xffffffff, %ebx # imm = 0xFFFFFFFF movq 0x3429e(%rip), %rdi # 0x3a348 leaq 0x22fa0(%rip), %rsi # 0x29051 callq 0x62b2 testb %al, %al jne 0x60c9 leaq 0x230c4(%rip), %rdi # 0x29185 callq 0x5480 addl $-0x2, %ebx addl 0x34281(%rip), %ebx # 0x3a350 je 0x60e3 leaq 0x22f88(%rip), %rdi # 0x29060 movl %ebx, %esi xorl %eax, %eax callq 0x5070 jmp 0x60ef leaq 0x230b5(%rip), %rdi # 0x2919f callq 0x5480 movl %ebx, %eax addq $0x8, %rsp popq %rbx popq %r14 retq movq %rax, %r14 movl $0x20, %esi movq %rbx, %rdi callq 0x5340 movq %r14, %rdi callq 0x5520 nopl (%rax)
/mmanyen[P]CLua/test/test.cpp
lua_rawlen
LUA_API lua_Unsigned lua_rawlen (lua_State *L, int idx) { const TValue *o = index2value(L, idx); switch (ttypetag(o)) { case LUA_VSHRSTR: return cast(lua_Unsigned, tsvalue(o)->shrlen); case LUA_VLNGSTR: return cast(lua_Unsigned, tsvalue(o)->u.lnglen); case LUA_VUSERDATA: return cast(lua_Unsigned, uvalue(o)->len); case LUA_VTABLE: return luaH_getn(hvalue(o)); default: return 0; } }
pushq %rax callq 0x6836 movq %rax, %rcx movzbl 0x8(%rax), %edx andl $0x3f, %edx xorl %eax, %eax cmpl $0x6, %edx jg 0x6c7b cmpl $0x4, %edx je 0x6c8e cmpl $0x5, %edx jne 0x6c96 movq (%rcx), %rdi popq %rax jmp 0x1ba26 cmpl $0x7, %edx je 0x6c85 cmpl $0x14, %edx jne 0x6c96 movq (%rcx), %rax movq 0x10(%rax), %rax jmp 0x6c96 movq (%rcx), %rax movsbq 0xb(%rax), %rax popq %rcx retq
/mmanyen[P]CLua/build_O1/_deps/lua/lapi.c
lua_topointer
LUA_API const void *lua_topointer (lua_State *L, int idx) { const TValue *o = index2value(L, idx); switch (ttypetag(o)) { case LUA_VLCF: return cast_voidp(cast_sizet(fvalue(o))); case LUA_VUSERDATA: case LUA_VLIGHTUSERDATA: return touserdata(o); default: { if (iscollectable(o)) return gcvalue(o); else return NULL; } } }
pushq %rax callq 0x6836 movzbl 0x8(%rax), %ecx movl %ecx, %edx andl $0x3f, %edx cmpl $0x2, %edx je 0x6d36 cmpl $0x7, %edx je 0x6d36 cmpl $0x16, %edx je 0x6d68 testb $0x40, %cl jne 0x6d68 jmp 0x6d6d movl %ecx, %edx andb $0xf, %dl cmpb $0x2, %dl je 0x6d68 andl $0xf, %ecx cmpl $0x7, %ecx jne 0x6d6d movq (%rax), %rcx movzwl 0xa(%rcx), %eax movl %eax, %edx shll $0x4, %edx addq $0x28, %rdx testl %eax, %eax movl $0x20, %eax cmovneq %rdx, %rax addq %rcx, %rax jmp 0x6d6f movq (%rax), %rax jmp 0x6d6f xorl %eax, %eax popq %rcx retq
/mmanyen[P]CLua/build_O1/_deps/lua/lapi.c
lua_pushlstring
LUA_API const char *lua_pushlstring (lua_State *L, const char *s, size_t len) { TString *ts; lua_lock(L); ts = (len == 0) ? luaS_new(L, "") : luaS_newlstr(L, s, len); setsvalue2s(L, L->top.p, ts); api_incr_top(L); luaC_checkGC(L); lua_unlock(L); return getstr(ts); }
pushq %r14 pushq %rbx pushq %rax movq %rdi, %rbx testq %rdx, %rdx je 0x6db8 movq %rbx, %rdi callq 0x170cb jmp 0x6dc7 leaq 0x23438(%rip), %rsi # 0x2a1f7 movq %rbx, %rdi callq 0x1734a movq %rax, %r14 movq 0x10(%rbx), %rax movq %r14, (%rax) movb 0x8(%r14), %cl orb $0x40, %cl movb %cl, 0x8(%rax) addq $0x10, 0x10(%rbx) movq 0x18(%rbx), %rax cmpq $0x0, 0x18(%rax) jg 0x6df3 movq %rbx, %rdi callq 0xdd3f leaq 0x18(%r14), %rax cmpb $0x0, 0xb(%r14) jns 0x6e01 movq (%rax), %rax addq $0x8, %rsp popq %rbx popq %r14 retq
/mmanyen[P]CLua/build_O1/_deps/lua/lapi.c
lua_pushexternalstring
LUA_API const char *lua_pushexternalstring (lua_State *L, const char *s, size_t len, lua_Alloc falloc, void *ud) { TString *ts; lua_lock(L); api_check(L, len <= MAX_SIZE, "string too large"); api_check(L, s[len] == '\0', "string not ending with zero"); ts = luaS_newextlstr (L, s, len, falloc, ud); setsvalue2s(L, L->top.p, ts); api_incr_top(L); luaC_checkGC(L); lua_unlock(L); return getstr(ts); }
pushq %r15 pushq %r14 pushq %rbx movq %rdi, %r14 callq 0x17456 movq %rax, %rbx movq 0x10(%r14), %rax movq %rbx, (%rax) movb 0x8(%rbx), %cl orb $0x40, %cl movb %cl, 0x8(%rax) addq $0x10, 0x10(%r14) movq %rbx, %r15 movq 0x18(%r14), %rax cmpq $0x0, 0x18(%rax) jg 0x6e44 movq %r14, %rdi callq 0xdd3f addq $0x18, %rbx cmpb $0x0, 0xb(%r15) jns 0x6e52 movq (%rbx), %rbx movq %rbx, %rax popq %rbx popq %r14 popq %r15 retq
/mmanyen[P]CLua/build_O1/_deps/lua/lapi.c
lua_pushstring
LUA_API const char *lua_pushstring (lua_State *L, const char *s) { lua_lock(L); if (s == NULL) setnilvalue(s2v(L->top.p)); else { TString *ts; ts = luaS_new(L, s); setsvalue2s(L, L->top.p, ts); s = getstr(ts); /* internal copy's address */ } api_incr_top(L); luaC_checkGC(L); lua_unlock(L); return s; }
pushq %r14 pushq %rbx pushq %rax movq %rdi, %rbx testq %rsi, %rsi je 0x6e8e movq %rbx, %rdi callq 0x1734a movq 0x10(%rbx), %rcx movq %rax, (%rcx) movb 0x8(%rax), %dl orb $0x40, %dl movb %dl, 0x8(%rcx) leaq 0x18(%rax), %r14 cmpb $0x0, 0xb(%rax) jns 0x6e99 movq (%r14), %r14 jmp 0x6e99 movq 0x10(%rbx), %rax movb $0x0, 0x8(%rax) xorl %r14d, %r14d addq $0x10, 0x10(%rbx) movq 0x18(%rbx), %rax cmpq $0x0, 0x18(%rax) jg 0x6eb1 movq %rbx, %rdi callq 0xdd3f movq %r14, %rax addq $0x8, %rsp popq %rbx popq %r14 retq
/mmanyen[P]CLua/build_O1/_deps/lua/lapi.c
lua_pushvfstring
LUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt, va_list argp) { const char *ret; lua_lock(L); ret = luaO_pushvfstring(L, fmt, argp); luaC_checkGC(L); lua_unlock(L); return ret; }
pushq %r14 pushq %rbx pushq %rax movq %rdi, %rbx callq 0x12822 movq %rax, %r14 movq 0x18(%rbx), %rax cmpq $0x0, 0x18(%rax) jg 0x6ede movq %rbx, %rdi callq 0xdd3f movq %r14, %rax addq $0x8, %rsp popq %rbx popq %r14 retq
/mmanyen[P]CLua/build_O1/_deps/lua/lapi.c
lua_pushfstring
LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...) { const char *ret; va_list argp; lua_lock(L); va_start(argp, fmt); ret = luaO_pushvfstring(L, fmt, argp); va_end(argp); luaC_checkGC(L); if (ret == NULL) /* error? */ luaD_throw(L, LUA_ERRMEM); lua_unlock(L); return ret; }
pushq %r14 pushq %rbx subq $0xd8, %rsp movq %rdi, %rbx leaq 0x20(%rsp), %rdi movq %rdx, 0x10(%rdi) movq %rcx, 0x18(%rdi) movq %r8, 0x20(%rdi) movq %r9, 0x28(%rdi) testb %al, %al je 0x6f46 movaps %xmm0, 0x50(%rsp) movaps %xmm1, 0x60(%rsp) movaps %xmm2, 0x70(%rsp) movaps %xmm3, 0x80(%rsp) movaps %xmm4, 0x90(%rsp) movaps %xmm5, 0xa0(%rsp) movaps %xmm6, 0xb0(%rsp) movaps %xmm7, 0xc0(%rsp) movq %rsp, %rdx movq %rdi, 0x10(%rdx) leaq 0xf0(%rsp), %rax movq %rax, 0x8(%rdx) movabsq $0x3000000010, %rax # imm = 0x3000000010 movq %rax, (%rdx) movq %rbx, %rdi callq 0x12822 movq %rax, %r14 movq 0x18(%rbx), %rax cmpq $0x0, 0x18(%rax) jg 0x6f84 movq %rbx, %rdi callq 0xdd3f testq %r14, %r14 je 0x6f97 movq %r14, %rax addq $0xd8, %rsp popq %rbx popq %r14 retq movq %rbx, %rdi movl $0x4, %esi callq 0xb220
/mmanyen[P]CLua/build_O1/_deps/lua/lapi.c
lua_pushcclosure
LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { lua_lock(L); if (n == 0) { setfvalue(s2v(L->top.p), fn); api_incr_top(L); } else { int i; CClosure *cl; api_checkpop(L, n); api_check(L, n <= MAXUPVAL, "upvalue index too large"); cl = luaF_newCclosure(L, n); cl->f = fn; for (i = 0; i < n; i++) { setobj2n(L, &cl->upvalue[i], s2v(L->top.p - n + i)); /* does not need barrier because closure is white */ lua_assert(iswhite(cl)); } L->top.p -= n; setclCvalue(L, s2v(L->top.p), cl); api_incr_top(L); luaC_checkGC(L); } lua_unlock(L); }
pushq %rbp pushq %r14 pushq %rbx movq %rsi, %r14 movq %rdi, %rbx testl %edx, %edx je 0x7037 movl %edx, %ebp movq %rbx, %rdi movl %edx, %esi callq 0xcfb0 movq %r14, 0x18(%rax) testl %ebp, %ebp jle 0x6ffb movl %ebp, %ecx shlq $0x4, %rcx movq %rcx, %rdx negq %rdx xorl %esi, %esi movq 0x10(%rbx), %rdi addq %rdx, %rdi movq (%rsi,%rdi), %r8 movq %r8, 0x20(%rax,%rsi) movb 0x8(%rsi,%rdi), %dil movb %dil, 0x28(%rax,%rsi) addq $0x10, %rsi cmpq %rsi, %rcx jne 0x6fd8 movq 0x10(%rbx), %rcx movslq %ebp, %rdx shlq $0x4, %rdx movq %rcx, %rsi subq %rdx, %rsi movq %rsi, 0x10(%rbx) movq %rax, (%rsi) negq %rdx movb $0x66, 0x8(%rcx,%rdx) addq $0x10, 0x10(%rbx) movq 0x18(%rbx), %rax cmpq $0x0, 0x18(%rax) jg 0x7047 movq %rbx, %rdi popq %rbx popq %r14 popq %rbp jmp 0xdd3f movq 0x10(%rbx), %rax movq %r14, (%rax) movb $0x16, 0x8(%rax) addq $0x10, 0x10(%rbx) popq %rbx popq %r14 popq %rbp retq
/mmanyen[P]CLua/build_O1/_deps/lua/lapi.c
lua_pushboolean
LUA_API void lua_pushboolean (lua_State *L, int b) { lua_lock(L); if (b) setbtvalue(s2v(L->top.p)); else setbfvalue(s2v(L->top.p)); api_incr_top(L); lua_unlock(L); }
testl %esi, %esi setne %al movq 0x10(%rdi), %rcx shlb $0x4, %al incb %al movb %al, 0x8(%rcx) addq $0x10, 0x10(%rdi) retq
/mmanyen[P]CLua/build_O1/_deps/lua/lapi.c
auxgetstr
static int auxgetstr (lua_State *L, const TValue *t, const char *k) { lu_byte tag; TString *str = luaS_new(L, k); luaV_fastget(t, str, s2v(L->top.p), luaH_getstr, tag); if (!tagisempty(tag)) api_incr_top(L); else { setsvalue2s(L, L->top.p, str); api_incr_top(L); tag = luaV_finishget(L, t, s2v(L->top.p - 1), L->top.p - 1, tag); } lua_unlock(L); return novariant(tag); }
pushq %r15 pushq %r14 pushq %rbx movq %rsi, %r14 movq %rdi, %rbx movq %rdx, %rsi callq 0x1734a movq %rax, %r15 movb $0x30, %al cmpb $0x45, 0x8(%r14) jne 0x7103 movq (%r14), %rdi movq 0x10(%rbx), %rdx movq %r15, %rsi callq 0x1af59 movq 0x10(%rbx), %rcx testb $0xf, %al je 0x7115 addq $0x10, %rcx movq %rcx, 0x10(%rbx) jmp 0x7140 movq %r15, (%rcx) movb 0x8(%r15), %dl orb $0x40, %dl movb %dl, 0x8(%rcx) movq 0x10(%rbx), %rcx leaq 0x10(%rcx), %rdx movq %rdx, 0x10(%rbx) movzbl %al, %r8d movq %rbx, %rdi movq %r14, %rsi movq %rcx, %rdx callq 0x1dd75 andb $0xf, %al movzbl %al, %eax popq %rbx popq %r14 popq %r15 retq
/mmanyen[P]CLua/build_O1/_deps/lua/lapi.c
lua_gettable
LUA_API int lua_gettable (lua_State *L, int idx) { lu_byte tag; TValue *t; lua_lock(L); api_checkpop(L, 1); t = index2value(L, idx); luaV_fastget(t, s2v(L->top.p - 1), s2v(L->top.p - 1), luaH_get, tag); if (tagisempty(tag)) tag = luaV_finishget(L, t, s2v(L->top.p - 1), L->top.p - 1, tag); lua_unlock(L); return novariant(tag); }
pushq %r14 pushq %rbx pushq %rax movq %rdi, %rbx callq 0x6836 movq %rax, %r14 movb $0x30, %al cmpb $0x45, 0x8(%r14) jne 0x7176 movq (%r14), %rdi movq 0x10(%rbx), %rdx addq $-0x10, %rdx movq %rdx, %rsi callq 0x1afe1 testb $0xf, %al jne 0x7194 movq 0x10(%rbx), %rcx addq $-0x10, %rcx movzbl %al, %r8d movq %rbx, %rdi movq %r14, %rsi movq %rcx, %rdx callq 0x1dd75 andb $0xf, %al movzbl %al, %eax addq $0x8, %rsp popq %rbx popq %r14 retq
/mmanyen[P]CLua/build_O1/_deps/lua/lapi.c
lua_geti
LUA_API int lua_geti (lua_State *L, int idx, lua_Integer n) { TValue *t; lu_byte tag; lua_lock(L); t = index2value(L, idx); luaV_fastgeti(t, n, s2v(L->top.p), tag); if (tagisempty(tag)) { TValue key; setivalue(&key, n); tag = luaV_finishget(L, t, &key, L->top.p, tag); } api_incr_top(L); lua_unlock(L); return novariant(tag); }
pushq %r15 pushq %r14 pushq %rbx subq $0x10, %rsp movq %rdx, %r14 movq %rdi, %rbx callq 0x6836 movq %rax, %r15 movb $0x30, %al cmpb $0x45, 0x8(%r15) jne 0x722d movq (%r15), %rdi leaq -0x1(%r14), %rax movl 0xc(%rdi), %ecx cmpq %rcx, %rax jae 0x7221 movq 0x10(%rdi), %rcx movb 0x4(%rcx,%rax), %al testb $0xf, %al je 0x722d movq 0x10(%rbx), %rcx movb %al, 0x8(%rcx) movq 0x10(%rbx), %rcx movq 0x10(%rdi), %rdx movl $0x1, %esi subq %r14, %rsi movq -0x8(%rdx,%rsi,8), %rdx movq %rdx, (%rcx) jmp 0x722d movq 0x10(%rbx), %rdx movq %r14, %rsi callq 0x1adfe testb $0xf, %al jne 0x724e movq %rsp, %rdx movq %r14, (%rdx) movb $0x3, 0x8(%rdx) movq 0x10(%rbx), %rcx movzbl %al, %r8d movq %rbx, %rdi movq %r15, %rsi callq 0x1dd75 addq $0x10, 0x10(%rbx) andb $0xf, %al movzbl %al, %eax addq $0x10, %rsp popq %rbx popq %r14 popq %r15 retq
/mmanyen[P]CLua/build_O1/_deps/lua/lapi.c
lua_rawget
LUA_API int lua_rawget (lua_State *L, int idx) { Table *t; lu_byte tag; lua_lock(L); api_checkpop(L, 1); t = gettable(L, idx); tag = luaH_get(t, s2v(L->top.p - 1), s2v(L->top.p - 1)); L->top.p--; /* pop key */ return finishrawget(L, tag); }
pushq %rbx movq %rdi, %rbx callq 0x6836 movq (%rax), %rdi movq 0x10(%rbx), %rdx addq $-0x10, %rdx movq %rdx, %rsi callq 0x1afe1 movq 0x10(%rbx), %rcx leaq -0x10(%rcx), %rdx movq %rdx, 0x10(%rbx) andb $0xf, %al jne 0x7292 movb $0x0, -0x8(%rcx) movzbl %al, %eax addq $0x10, 0x10(%rbx) popq %rbx retq
/mmanyen[P]CLua/build_O1/_deps/lua/lapi.c
lua_rawgeti
LUA_API int lua_rawgeti (lua_State *L, int idx, lua_Integer n) { Table *t; lu_byte tag; lua_lock(L); t = gettable(L, idx); luaH_fastgeti(t, n, s2v(L->top.p), tag); return finishrawget(L, tag); }
pushq %r14 pushq %rbx pushq %rax movq %rdx, %r14 movq %rdi, %rbx callq 0x6836 movq (%rax), %rdi leaq -0x1(%r14), %rax movl 0xc(%rdi), %ecx cmpq %rcx, %rax jae 0x72e7 movq 0x10(%rdi), %rcx movb 0x4(%rcx,%rax), %al testb $0xf, %al je 0x72f3 movq 0x10(%rbx), %rcx movb %al, 0x8(%rcx) movq 0x10(%rbx), %rcx movq 0x10(%rdi), %rdx movl $0x1, %esi subq %r14, %rsi movq -0x8(%rdx,%rsi,8), %rdx movq %rdx, (%rcx) jmp 0x72f3 movq 0x10(%rbx), %rdx movq %r14, %rsi callq 0x1adfe andb $0xf, %al jne 0x72ff movq 0x10(%rbx), %rcx movb $0x0, 0x8(%rcx) movzbl %al, %eax addq $0x10, 0x10(%rbx) addq $0x8, %rsp popq %rbx popq %r14 retq
/mmanyen[P]CLua/build_O1/_deps/lua/lapi.c
lua_rawgetp
LUA_API int lua_rawgetp (lua_State *L, int idx, const void *p) { Table *t; TValue k; lua_lock(L); t = gettable(L, idx); setpvalue(&k, cast_voidp(p)); return finishrawget(L, luaH_get(t, &k, s2v(L->top.p))); }
pushq %r14 pushq %rbx subq $0x18, %rsp movq %rdx, %r14 movq %rdi, %rbx callq 0x6836 movq (%rax), %rdi leaq 0x8(%rsp), %rsi movq %r14, (%rsi) movb $0x2, 0x8(%rsi) movq 0x10(%rbx), %rdx callq 0x1afe1 andb $0xf, %al jne 0x7345 movq 0x10(%rbx), %rcx movb $0x0, 0x8(%rcx) movzbl %al, %eax addq $0x10, 0x10(%rbx) addq $0x18, %rsp popq %rbx popq %r14 retq
/mmanyen[P]CLua/build_O1/_deps/lua/lapi.c
lua_createtable
LUA_API void lua_createtable (lua_State *L, int narray, int nrec) { Table *t; lua_lock(L); t = luaH_new(L); sethvalue2s(L, L->top.p, t); api_incr_top(L); if (narray > 0 || nrec > 0) luaH_resize(L, t, cast_uint(narray), cast_uint(nrec)); luaC_checkGC(L); lua_unlock(L); }
pushq %rbp pushq %r14 pushq %rbx movl %edx, %ebp movl %esi, %r14d movq %rdi, %rbx callq 0x1ad47 movq 0x10(%rbx), %rcx movq %rax, (%rcx) movb $0x45, 0x8(%rcx) addq $0x10, 0x10(%rbx) testl %r14d, %r14d setle %cl testl %ebp, %ebp setle %dl testb %dl, %cl jne 0x7395 movq %rbx, %rdi movq %rax, %rsi movl %r14d, %edx movl %ebp, %ecx callq 0x1a8a6 movq 0x18(%rbx), %rax cmpq $0x0, 0x18(%rax) jle 0x73a5 popq %rbx popq %r14 popq %rbp retq movq %rbx, %rdi popq %rbx popq %r14 popq %rbp jmp 0xdd3f
/mmanyen[P]CLua/build_O1/_deps/lua/lapi.c
lua_getmetatable
LUA_API int lua_getmetatable (lua_State *L, int objindex) { const TValue *obj; Table *mt; int res = 0; lua_lock(L); obj = index2value(L, objindex); switch (ttype(obj)) { case LUA_TTABLE: mt = hvalue(obj)->metatable; break; case LUA_TUSERDATA: mt = uvalue(obj)->metatable; break; default: mt = G(L)->mt[ttype(obj)]; break; } if (mt != NULL) { sethvalue2s(L, L->top.p, mt); api_incr_top(L); res = 1; } lua_unlock(L); return res; }
pushq %rbx movq %rdi, %rbx callq 0x6836 movzbl 0x8(%rax), %ecx andl $0xf, %ecx cmpq $0x7, %rcx je 0x73d5 cmpl $0x5, %ecx jne 0x73de movq (%rax), %rax addq $0x20, %rax jmp 0x73ec movq (%rax), %rax addq $0x18, %rax jmp 0x73ec movq 0x18(%rbx), %rax leaq (%rax,%rcx,8), %rax addq $0x1d8, %rax # imm = 0x1D8 movq (%rax), %rax testq %rax, %rax je 0x740b movq 0x10(%rbx), %rcx movq %rax, (%rcx) movb $0x45, 0x8(%rcx) addq $0x10, 0x10(%rbx) movl $0x1, %eax jmp 0x740d xorl %eax, %eax popq %rbx retq
/mmanyen[P]CLua/build_O1/_deps/lua/lapi.c
lua_getiuservalue
LUA_API int lua_getiuservalue (lua_State *L, int idx, int n) { TValue *o; int t; lua_lock(L); o = index2value(L, idx); api_check(L, ttisfulluserdata(o), "full userdata expected"); if (n <= 0 || n > uvalue(o)->nuvalue) { setnilvalue(s2v(L->top.p)); t = LUA_TNONE; } else { setobj2s(L, L->top.p, &uvalue(o)->uv[n - 1].uv); t = ttype(s2v(L->top.p)); } api_incr_top(L); lua_unlock(L); return t; }
pushq %r14 pushq %rbx pushq %rax movq %rdi, %rbx testl %edx, %edx jle 0x7431 movl %edx, %r14d movq %rbx, %rdi callq 0x6836 movq (%rax), %rax movzwl 0xa(%rax), %ecx cmpl %r14d, %ecx jge 0x7440 movq 0x10(%rbx), %rax movb $0x0, 0x8(%rax) movl $0xffffffff, %eax # imm = 0xFFFFFFFF jmp 0x7466 movq 0x10(%rbx), %rcx decl %r14d shlq $0x4, %r14 movq 0x28(%rax,%r14), %rdx movq %rdx, (%rcx) movb 0x30(%rax,%r14), %al movb %al, 0x8(%rcx) movq 0x10(%rbx), %rax movzbl 0x8(%rax), %eax andl $0xf, %eax addq $0x10, 0x10(%rbx) addq $0x8, %rsp popq %rbx popq %r14 retq
/mmanyen[P]CLua/build_O1/_deps/lua/lapi.c
auxsetstr
static void auxsetstr (lua_State *L, const TValue *t, const char *k) { int hres; TString *str = luaS_new(L, k); api_checkpop(L, 1); luaV_fastset(t, str, s2v(L->top.p - 1), hres, luaH_psetstr); if (hres == HOK) { luaV_finishfastset(L, t, s2v(L->top.p - 1)); L->top.p--; /* pop value */ } else { setsvalue2s(L, L->top.p, str); /* push 'str' (to make it a TValue) */ api_incr_top(L); luaV_finishset(L, t, s2v(L->top.p - 1), s2v(L->top.p - 2), hres); L->top.p -= 2; /* pop value and key */ } lua_unlock(L); /* lock done by caller */ }
pushq %r15 pushq %r14 pushq %rbx movq %rsi, %r14 movq %rdi, %rbx movq %rdx, %rsi callq 0x1734a movq %rax, %r15 movl $0x2, %r8d cmpb $0x45, 0x8(%r14) jne 0x74eb movq (%r14), %rdi movq 0x10(%rbx), %rdx addq $-0x10, %rdx movq %r15, %rsi callq 0x1b457 movl %eax, %r8d movq 0x10(%rbx), %rax testl %r8d, %r8d je 0x7525 movq %r15, (%rax) movb 0x8(%r15), %cl orb $0x40, %cl movb %cl, 0x8(%rax) movq 0x10(%rbx), %rdx leaq 0x10(%rdx), %rax movq %rax, 0x10(%rbx) leaq -0x10(%rdx), %rcx movq %rbx, %rdi movq %r14, %rsi callq 0x1de6d movq $-0x20, %r15 jmp 0x754d movq $-0x10, %r15 testb $0x40, -0x8(%rax) je 0x754d movq (%r14), %rsi testb $0x20, 0x9(%rsi) je 0x754d movq -0x10(%rax), %rax testb $0x18, 0x9(%rax) je 0x754d movq %rbx, %rdi callq 0xd62e addq %r15, 0x10(%rbx) popq %rbx popq %r14 popq %r15 retq
/mmanyen[P]CLua/build_O1/_deps/lua/lapi.c
lua_settable
LUA_API void lua_settable (lua_State *L, int idx) { TValue *t; int hres; lua_lock(L); api_checkpop(L, 2); t = index2value(L, idx); luaV_fastset(t, s2v(L->top.p - 2), s2v(L->top.p - 1), hres, luaH_pset); if (hres == HOK) luaV_finishfastset(L, t, s2v(L->top.p - 1)); else luaV_finishset(L, t, s2v(L->top.p - 2), s2v(L->top.p - 1), hres); L->top.p -= 2; /* pop index and value */ lua_unlock(L); }
pushq %r14 pushq %rbx pushq %rax movq %rdi, %rbx callq 0x6836 movq %rax, %r14 movl $0x2, %r8d cmpb $0x45, 0x8(%rax) jne 0x7589 movq (%r14), %rdi movq 0x10(%rbx), %rdx leaq -0x20(%rdx), %rsi addq $-0x10, %rdx callq 0x1b4dc movl %eax, %r8d movq 0x10(%rbx), %rcx testl %r8d, %r8d je 0x75a7 leaq -0x20(%rcx), %rdx addq $-0x10, %rcx movq %rbx, %rdi movq %r14, %rsi callq 0x1de6d jmp 0x75c8 testb $0x40, -0x8(%rcx) je 0x75c8 movq (%r14), %rsi testb $0x20, 0x9(%rsi) je 0x75c8 movq -0x10(%rcx), %rax testb $0x18, 0x9(%rax) je 0x75c8 movq %rbx, %rdi callq 0xd62e addq $-0x20, 0x10(%rbx) addq $0x8, %rsp popq %rbx popq %r14 retq
/mmanyen[P]CLua/build_O1/_deps/lua/lapi.c
lua_pcallk
LUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc, lua_KContext ctx, lua_KFunction k) { struct CallS c; TStatus status; ptrdiff_t func; lua_lock(L); api_check(L, k == NULL || !isLua(L->ci), "cannot use continuations inside hooks"); api_checkpop(L, nargs + 1); api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread"); checkresults(L, nargs, nresults); if (errfunc == 0) func = 0; else { StkId o = index2stack(L, errfunc); api_check(L, ttisfunction(s2v(o)), "error handler must be a function"); func = savestack(L, o); } c.func = L->top.p - (nargs+1); /* function to be called */ if (k == NULL || !yieldable(L)) { /* no continuation or no yieldable? */ c.nresults = nresults; /* do a 'conventional' protected call */ status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func); } else { /* prepare continuation (call is already protected by 'resume') */ CallInfo *ci = L->ci; ci->u.c.k = k; /* save continuation */ ci->u.c.ctx = ctx; /* save context */ /* save information for error recovery */ ci->u2.funcidx = cast_int(savestack(L, c.func)); ci->u.c.old_errfunc = L->errfunc; L->errfunc = func; setoah(ci, L->allowhook); /* save value of 'allowhook' */ ci->callstatus |= CIST_YPCALL; /* function can do error recovery */ luaD_call(L, c.func, nresults); /* do the call */ ci->callstatus &= ~CIST_YPCALL; L->errfunc = ci->u.c.old_errfunc; status = LUA_OK; /* if it is here, there were no errors */ } adjustresults(L, nresults); lua_unlock(L); return APIstatus(status); }
pushq %rbp pushq %r14 pushq %rbx subq $0x10, %rsp movq %r8, %rax movl %edx, %ebp movq %rdi, %rbx testl %ecx, %ecx je 0x7970 jle 0x7975 movq 0x20(%rbx), %rdx movl %ecx, %r8d shlq $0x4, %r8 addq (%rdx), %r8 jmp 0x7980 xorl %r8d, %r8d jmp 0x7984 movslq %ecx, %r8 shlq $0x4, %r8 addq 0x10(%rbx), %r8 subq 0x30(%rbx), %r8 notl %esi movslq %esi, %rcx shlq $0x4, %rcx addq 0x10(%rbx), %rcx movq %rcx, (%rsp) testq %r9, %r9 je 0x7a10 cmpl $0x10000, 0xb0(%rbx) # imm = 0x10000 jae 0x7a10 movq 0x20(%rbx), %r14 movq %r9, 0x20(%r14) movq %rax, 0x30(%r14) movl 0x30(%rbx), %eax movl %ecx, %edx subl %eax, %edx movl %edx, 0x38(%r14) movq 0xa8(%rbx), %rax movq %rax, 0x28(%r14) movq %r8, 0xa8(%rbx) xorl %eax, %eax cmpb $0x0, 0xa(%rbx) setne %al movl $0xffd7ffff, %edx # imm = 0xFFD7FFFF andl 0x3c(%r14), %edx shll $0x13, %eax addl %edx, %eax addl $0x200000, %eax # imm = 0x200000 movl %eax, 0x3c(%r14) movq %rbx, %rdi movq %rcx, %rsi movl %ebp, %edx callq 0xbf14 andb $-0x21, 0x3e(%r14) movq 0x28(%r14), %rax movq %rax, 0xa8(%rbx) xorl %eax, %eax jmp 0x7a2c movq %rsp, %rdx movl %ebp, 0x8(%rdx) subq 0x30(%rbx), %rcx leaq 0x2a(%rip), %rsi # 0x7a4b movq %rbx, %rdi callq 0xc37c movzbl %al, %eax testl %ebp, %ebp jns 0x7a42 movq 0x10(%rbx), %rcx movq 0x20(%rbx), %rdx cmpq %rcx, 0x8(%rdx) jae 0x7a42 movq %rcx, 0x8(%rdx) addq $0x10, %rsp popq %rbx popq %r14 popq %rbp retq
/mmanyen[P]CLua/build_O1/_deps/lua/lapi.c
lua_setupvalue
LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) { const char *name; TValue *val = NULL; /* to avoid warnings */ GCObject *owner = NULL; /* to avoid warnings */ TValue *fi; lua_lock(L); fi = index2value(L, funcindex); api_checknelems(L, 1); name = aux_upvalue(fi, n, &val, &owner); if (name) { L->top.p--; setobj(L, val, s2v(L->top.p)); luaC_barrier(L, owner, val); } lua_unlock(L); return name; }
pushq %rbp pushq %r15 pushq %r14 pushq %rbx subq $0x18, %rsp movl %edx, %ebp movq %rdi, %rbx xorl %eax, %eax leaq 0x10(%rsp), %r14 movq %rax, (%r14) leaq 0x8(%rsp), %r15 movq %rax, (%r15) callq 0x6836 movq %rax, %rdi movl %ebp, %esi movq %r14, %rdx movq %r15, %rcx callq 0x7fb5 movq %rax, %r14 testq %rax, %rax je 0x80c5 movq 0x10(%rbx), %rcx leaq -0x10(%rcx), %rax movq %rax, 0x10(%rbx) movq 0x10(%rsp), %rax movq -0x10(%rcx), %rdx movq %rdx, (%rax) movb -0x8(%rcx), %cl movb %cl, 0x8(%rax) testb $0x40, %cl je 0x80c5 movq 0x8(%rsp), %rsi testb $0x20, 0x9(%rsi) je 0x80c5 movq (%rax), %rdx testb $0x18, 0x9(%rdx) je 0x80c5 movq %rbx, %rdi callq 0xd508 movq %r14, %rax addq $0x18, %rsp popq %rbx popq %r14 popq %r15 popq %rbp retq
/mmanyen[P]CLua/build_O1/_deps/lua/lapi.c
luaL_argerror
LUALIB_API int luaL_argerror (lua_State *L, int arg, const char *extramsg) { lua_Debug ar; const char *argword; if (!lua_getstack(L, 0, &ar)) /* no stack frame? */ return luaL_error(L, "bad argument #%d (%s)", arg, extramsg); lua_getinfo(L, "nt", &ar); if (arg <= ar.extraargs) /* error in an extra argument? */ argword = "extra argument"; else { arg -= ar.extraargs; /* do not count extra arguments */ if (strcmp(ar.namewhat, "method") == 0) { /* colon syntax? */ arg--; /* do not count (extra) self argument */ if (arg == 0) /* error in self argument? */ return luaL_error(L, "calling '%s' on bad self (%s)", ar.name, extramsg); /* else go through; error in a regular argument */ } argword = "argument"; } if (ar.name == NULL) ar.name = (pushglobalfuncname(L, &ar)) ? lua_tostring(L, -1) : "?"; return luaL_error(L, "bad %s #%d to '%s' (%s)", argword, arg, ar.name, extramsg); }
pushq %rbp pushq %r15 pushq %r14 pushq %r12 pushq %rbx subq $0x90, %rsp movq %rdx, %rbx movl %esi, %ebp movq %rdi, %r14 movq %rsp, %rdx xorl %esi, %esi callq 0x9f91 testl %eax, %eax je 0x8722 leaq 0x21360(%rip), %rsi # 0x29a46 movq %rsp, %r15 movq %r14, %rdi movq %r15, %rdx callq 0xa19e movzbl 0x3f(%r15), %eax movl %ebp, %r12d subl %eax, %r12d jle 0x873a movq 0x10(%rsp), %rdi leaq 0x2134c(%rip), %rsi # 0x29a59 callq 0x5420 leaq 0x20da0(%rip), %r15 # 0x294b9 testl %eax, %eax je 0x8769 movl %r12d, %ebp jmp 0x8741 leaq 0x20d74(%rip), %rsi # 0x2949d movq %r14, %rdi movl %ebp, %edx movq %rbx, %rcx xorl %eax, %eax callq 0x87c6 jmp 0x87b6 leaq 0x20d72(%rip), %r15 # 0x294b3 cmpq $0x0, 0x8(%rsp) jne 0x8798 movq %rsp, %rsi movq %r14, %rdi callq 0x8882 testl %eax, %eax je 0x878c movq %r14, %rdi movl $0xffffffff, %esi # imm = 0xFFFFFFFF xorl %edx, %edx callq 0x6bb8 jmp 0x8793 decl %r12d movl %r12d, %ebp jne 0x8741 movq 0x8(%rsp), %rdx leaq 0x20d45(%rip), %rsi # 0x294c2 movq %r14, %rdi movq %rbx, %rcx xorl %eax, %eax callq 0x87c6 jmp 0x87b6 leaq 0x21277(%rip), %rax # 0x29a0a movq %rax, 0x8(%rsp) movq 0x8(%rsp), %r8 leaq 0x20d3c(%rip), %rsi # 0x294e0 movq %r14, %rdi movq %r15, %rdx movl %ebp, %ecx movq %rbx, %r9 xorl %eax, %eax callq 0x87c6 addq $0x90, %rsp popq %rbx popq %r12 popq %r14 popq %r15 popq %rbp retq
/mmanyen[P]CLua/build_O1/_deps/lua/lauxlib.c
luaL_error
LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) { va_list argp; va_start(argp, fmt); luaL_where(L, 1); lua_pushvfstring(L, fmt, argp); va_end(argp); lua_concat(L, 2); return lua_error(L); }
pushq %r15 pushq %r14 pushq %rbx subq $0xd0, %rsp movq %rsi, %rbx movq %rdi, %r14 leaq 0x20(%rsp), %rsi movq %rdx, 0x10(%rsi) movq %rcx, 0x18(%rsi) movq %r8, 0x20(%rsi) movq %r9, 0x28(%rsi) testb %al, %al je 0x8828 movaps %xmm0, 0x50(%rsp) movaps %xmm1, 0x60(%rsp) movaps %xmm2, 0x70(%rsp) movaps %xmm3, 0x80(%rsp) movaps %xmm4, 0x90(%rsp) movaps %xmm5, 0xa0(%rsp) movaps %xmm6, 0xb0(%rsp) movaps %xmm7, 0xc0(%rsp) movq %rsp, %r15 movq %rsi, 0x10(%r15) leaq 0xf0(%rsp), %rax movq %rax, 0x8(%r15) movabsq $0x3000000010, %rax # imm = 0x3000000010 movq %rax, (%r15) movl $0x1, %esi callq 0x8a5d movq %r14, %rdi movq %rbx, %rsi movq %r15, %rdx callq 0x6ebc movq %r14, %rdi movl $0x2, %esi callq 0x7e4f movq %r14, %rdi callq 0x7db6 addq $0xd0, %rsp popq %rbx popq %r14 popq %r15 retq
/mmanyen[P]CLua/build_O1/_deps/lua/lauxlib.c
pushglobalfuncname
static int pushglobalfuncname (lua_State *L, lua_Debug *ar) { int top = lua_gettop(L); lua_getinfo(L, "f", ar); /* push function */ lua_getfield(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE); luaL_checkstack(L, 6, "not enough stack"); /* slots for 'findfield' */ if (findfield(L, top + 1, 2)) { const char *name = lua_tostring(L, -1); if (strncmp(name, LUA_GNAME ".", 3) == 0) { /* name start with '_G.'? */ lua_pushstring(L, name + 3); /* push name without prefix */ lua_remove(L, -2); /* remove original name */ } lua_copy(L, -1, top + 1); /* copy name to proper place */ lua_settop(L, top + 1); /* remove table "loaded" and name copy */ return 1; } else { lua_settop(L, top); /* remove function and global table */ return 0; } }
pushq %rbp pushq %r15 pushq %r14 pushq %rbx pushq %rax movq %rsi, %r15 movq %rdi, %rbx callq 0x663a movl %eax, %r14d leaq 0x20dce(%rip), %rsi # 0x2966c movq %rbx, %rdi movq %r15, %rdx callq 0xa19e leaq 0x20d4f(%rip), %rdx # 0x295ff movq %rbx, %rdi movl $0xfff0b9d8, %esi # imm = 0xFFF0B9D8 callq 0x71a1 leaq 0x20ddc(%rip), %rdx # 0x296a0 movq %rbx, %rdi movl $0x6, %esi callq 0x8e28 leal 0x1(%r14), %ebp movq %rbx, %rdi movl %ebp, %esi movl $0x2, %edx callq 0x9cf2 testl %eax, %eax je 0x8957 movq %rbx, %rdi movl $0xffffffff, %esi # imm = 0xFFFFFFFF xorl %edx, %edx callq 0x6bb8 movq %rax, %r14 leaq 0x20db0(%rip), %rsi # 0x296b1 movl $0x3, %edx movq %rax, %rdi callq 0x5190 testl %eax, %eax jne 0x8940 addq $0x3, %r14 movq %rbx, %rdi movq %r14, %rsi callq 0x6e5b movq %rbx, %rdi movl $0xfffffffe, %esi # imm = 0xFFFFFFFE movl $0xffffffff, %edx # imm = 0xFFFFFFFF callq 0x66f8 movq %rbx, %rdi movl $0xfffffffe, %esi # imm = 0xFFFFFFFE callq 0x664e movq %rbx, %rdi movl $0xffffffff, %esi # imm = 0xFFFFFFFF movl %ebp, %edx callq 0x67d5 movl $0x1, %r15d jmp 0x895d xorl %r15d, %r15d movl %r14d, %ebp movq %rbx, %rdi movl %ebp, %esi callq 0x664e movl %r15d, %eax addq $0x8, %rsp popq %rbx popq %r14 popq %r15 popq %rbp retq
/mmanyen[P]CLua/build_O1/_deps/lua/lauxlib.c
luaL_typeerror
LUALIB_API int luaL_typeerror (lua_State *L, int arg, const char *tname) { const char *msg; const char *typearg; /* name for the type of the actual argument */ if (luaL_getmetafield(L, arg, "__name") == LUA_TSTRING) typearg = lua_tostring(L, -1); /* use the given type name */ else if (lua_type(L, arg) == LUA_TLIGHTUSERDATA) typearg = "light userdata"; /* special name for messages */ else typearg = luaL_typename(L, arg); /* standard name */ msg = lua_pushfstring(L, "%s expected, got %s", tname, typearg); return luaL_argerror(L, arg, msg); }
pushq %r15 pushq %r14 pushq %rbx movq %rdx, %r15 movl %esi, %ebx movq %rdi, %r14 leaq 0x20b6f(%rip), %rdx # 0x294f8 callq 0x89f6 movq %r14, %rdi cmpl $0x4, %eax jne 0x89a4 movl $0xffffffff, %esi # imm = 0xFFFFFFFF xorl %edx, %edx callq 0x6bb8 jmp 0x89cd movl %ebx, %esi callq 0x68d4 cmpl $0x2, %eax jne 0x89b9 leaq 0x20b48(%rip), %rcx # 0x294ff jmp 0x89d0 movq %r14, %rdi movl %ebx, %esi callq 0x68d4 movq %r14, %rdi movl %eax, %esi callq 0x68fa movq %rax, %rcx leaq 0x20b37(%rip), %rsi # 0x2950e movq %r14, %rdi movq %r15, %rdx xorl %eax, %eax callq 0x6ee9 movq %r14, %rdi movl %ebx, %esi movq %rax, %rdx popq %rbx popq %r14 popq %r15 jmp 0x86ba
/mmanyen[P]CLua/build_O1/_deps/lua/lauxlib.c
resizebox
static void *resizebox (lua_State *L, int idx, size_t newsize) { UBox *box = (UBox *)lua_touserdata(L, idx); if (box->bsize == newsize) /* not changing size? */ return box->box; /* keep the buffer */ else { void *ud; lua_Alloc allocf = lua_getallocf(L, &ud); void *temp = allocf(ud, box->box, box->bsize, newsize); if (l_unlikely(temp == NULL && newsize > 0)) { /* allocation error? */ lua_pushliteral(L, "not enough memory"); lua_error(L); /* raise a memory error */ } box->box = temp; box->bsize = newsize; return temp; } }
pushq %r15 pushq %r14 pushq %r12 pushq %rbx pushq %rax movq %rdx, %rbx movq %rdi, %r15 callq 0x6cbc movq %rax, %r14 cmpq %rbx, 0x8(%rax) jne 0x9193 movq (%r14), %r12 jmp 0x91c5 movq %rsp, %r12 movq %r15, %rdi movq %r12, %rsi callq 0x7ec9 movq (%r12), %rdi movq (%r14), %rsi movq 0x8(%r14), %rdx movq %rbx, %rcx callq *%rax movq %rax, %r12 testq %rbx, %rbx je 0x91be testq %r12, %r12 je 0x91d4 movq %r12, (%r14) movq %rbx, 0x8(%r14) movq %r12, %rax addq $0x8, %rsp popq %rbx popq %r12 popq %r14 popq %r15 retq movq %r15, %rdi callq 0x572a jmp 0x91be
/mmanyen[P]CLua/build_O1/_deps/lua/lauxlib.c
luaL_ref
LUALIB_API int luaL_ref (lua_State *L, int t) { int ref; if (lua_isnil(L, -1)) { lua_pop(L, 1); /* remove from stack */ return LUA_REFNIL; /* 'nil' has a unique fixed reference */ } t = lua_absindex(L, t); if (lua_rawgeti(L, t, 1) == LUA_TNUMBER) /* already initialized? */ ref = (int)lua_tointeger(L, -1); /* ref = t[1] */ else { /* first access */ lua_assert(!lua_toboolean(L, -1)); /* must be nil or false */ ref = 0; /* list is empty */ lua_pushinteger(L, 0); /* initialize as an empty list */ lua_rawseti(L, t, 1); /* ref = t[1] = 0 */ } lua_pop(L, 1); /* remove element from stack */ if (ref != 0) { /* any free element? */ lua_rawgeti(L, t, ref); /* remove it from list */ lua_rawseti(L, t, 1); /* (t[1] = t[ref]) */ } else /* no free elements */ ref = (int)lua_rawlen(L, t) + 1; /* get a new reference */ lua_rawseti(L, t, ref); return ref; }
pushq %rbp pushq %r14 pushq %rbx movl %esi, %ebp movq %rdi, %rbx movl $0xffffffff, %r14d # imm = 0xFFFFFFFF movl $0xffffffff, %esi # imm = 0xFFFFFFFF callq 0x68d4 testl %eax, %eax je 0x9279 movq %rbx, %rdi movl %ebp, %esi callq 0x6619 movl %eax, %ebp movl $0x1, %edx movq %rbx, %rdi movl %eax, %esi callq 0x729c cmpl $0x3, %eax jne 0x9288 movq %rbx, %rdi movl $0xffffffff, %esi # imm = 0xFFFFFFFF xorl %edx, %edx callq 0x6b52 movq %rax, %r14 jmp 0x92a4 movq %rbx, %rdi movl $0xfffffffe, %esi # imm = 0xFFFFFFFE callq 0x664e jmp 0x92f1 xorl %r14d, %r14d movq %rbx, %rdi xorl %esi, %esi callq 0x6d91 movl $0x1, %edx movq %rbx, %rdi movl %ebp, %esi callq 0x7782 movq %rbx, %rdi movl $0xfffffffe, %esi # imm = 0xFFFFFFFE callq 0x664e testl %r14d, %r14d je 0x92d4 movslq %r14d, %rdx movq %rbx, %rdi movl %ebp, %esi callq 0x729c movl $0x1, %edx movq %rbx, %rdi movl %ebp, %esi callq 0x7782 jmp 0x92e4 movq %rbx, %rdi movl %ebp, %esi callq 0x6c51 movq %rax, %r14 incl %r14d movslq %r14d, %rdx movq %rbx, %rdi movl %ebp, %esi callq 0x7782 movl %r14d, %eax popq %rbx popq %r14 popq %rbp retq
/mmanyen[P]CLua/build_O1/_deps/lua/lauxlib.c
luaL_unref
LUALIB_API void luaL_unref (lua_State *L, int t, int ref) { if (ref >= 0) { t = lua_absindex(L, t); lua_rawgeti(L, t, 1); lua_assert(lua_isinteger(L, -1)); lua_rawseti(L, t, ref); /* t[ref] = t[1] */ lua_pushinteger(L, ref); lua_rawseti(L, t, 1); /* t[1] = ref */ } }
testl %edx, %edx js 0x9356 pushq %rbp pushq %r15 pushq %r14 pushq %rbx pushq %rax movl %edx, %ebp movq %rdi, %rbx callq 0x6619 movl %eax, %r14d movl $0x1, %edx movq %rbx, %rdi movl %eax, %esi callq 0x729c movl %ebp, %r15d movq %rbx, %rdi movl %r14d, %esi movq %r15, %rdx callq 0x7782 movq %rbx, %rdi movq %r15, %rsi callq 0x6d91 movl $0x1, %edx movq %rbx, %rdi movl %r14d, %esi addq $0x8, %rsp popq %rbx popq %r14 popq %r15 popq %rbp jmp 0x7782 retq
/mmanyen[P]CLua/build_O1/_deps/lua/lauxlib.c
luaL_loadfilex
LUALIB_API int luaL_loadfilex (lua_State *L, const char *filename, const char *mode) { LoadF lf; int status, readstatus; int c; int fnameindex = lua_gettop(L) + 1; /* index of filename on the stack */ if (filename == NULL) { lua_pushliteral(L, "=stdin"); lf.f = stdin; } else { lua_pushfstring(L, "@%s", filename); errno = 0; lf.f = fopen(filename, "r"); if (lf.f == NULL) return errfile(L, "open", fnameindex); } lf.n = 0; if (skipcomment(lf.f, &c)) /* read initial portion */ lf.buff[lf.n++] = '\n'; /* add newline to correct line numbers */ if (c == LUA_SIGNATURE[0]) { /* binary file? */ lf.n = 0; /* remove possible newline */ if (filename) { /* "real" file? */ errno = 0; lf.f = freopen(filename, "rb", lf.f); /* reopen in binary mode */ if (lf.f == NULL) return errfile(L, "reopen", fnameindex); skipcomment(lf.f, &c); /* re-read initial portion */ } } if (c != EOF) lf.buff[lf.n++] = cast_char(c); /* 'c' is the first character */ status = lua_load(L, getF, &lf, lua_tostring(L, -1), mode); readstatus = ferror(lf.f); errno = 0; /* no useful error number until here */ if (filename) fclose(lf.f); /* close file (even in case of errors) */ if (readstatus) { lua_settop(L, fnameindex); /* ignore results from 'lua_load' */ return errfile(L, "read", fnameindex); } lua_remove(L, fnameindex); return status; }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x2018, %rsp # imm = 0x2018 movq %rdx, %r15 movq %rsi, %r14 movq %rdi, %rbx callq 0x663a movl %eax, %ebp incl %ebp testq %r14, %r14 je 0x93c3 leaq 0x201fa(%rip), %rsi # 0x29580 movq %rbx, %rdi movq %r14, %rdx xorl %eax, %eax callq 0x6ee9 callq 0x5060 movl $0x0, (%rax) leaq 0x2111e(%rip), %rsi # 0x2a4c3 movq %r14, %rdi callq 0x5390 movq %rax, 0x10(%rsp) testq %rax, %rax jne 0x93e1 leaq 0x201cb(%rip), %rsi # 0x29589 jmp 0x94df leaq 0x201af(%rip), %rsi # 0x29579 movq %rbx, %rdi callq 0x6e5b movq 0x30bf7(%rip), %rax # 0x39fd0 movq (%rax), %rax movq %rax, 0x10(%rsp) movl $0x0, 0x8(%rsp) movq 0x10(%rsp), %rdi leaq 0x4(%rsp), %rsi callq 0x95b6 testl %eax, %eax je 0x940c movl 0x8(%rsp), %eax leal 0x1(%rax), %ecx movl %ecx, 0x8(%rsp) movb $0xa, 0x18(%rsp,%rax) cmpl $0x1b, 0x4(%rsp) jne 0x945a movl $0x0, 0x8(%rsp) testq %r14, %r14 je 0x945a callq 0x5060 movl $0x0, (%rax) movq 0x10(%rsp), %rdx leaq 0x2014d(%rip), %rsi # 0x29584 movq %r14, %rdi callq 0x5300 movq %rax, 0x10(%rsp) testq %rax, %rax je 0x951f leaq 0x4(%rsp), %rsi movq %rax, %rdi callq 0x95b6 movl 0x4(%rsp), %eax cmpl $-0x1, %eax je 0x9472 movl 0x8(%rsp), %ecx leal 0x1(%rcx), %edx movl %edx, 0x8(%rsp) movb %al, 0x18(%rsp,%rcx) movq %rbx, %rdi movl $0xffffffff, %esi # imm = 0xFFFFFFFF xorl %edx, %edx callq 0x6bb8 leaq 0x19d(%rip), %rsi # 0x9625 leaq 0x8(%rsp), %r12 movq %rbx, %rdi movq %r12, %rdx movq %rax, %rcx movq %r15, %r8 callq 0x7a59 movl %eax, %r15d movq 0x8(%r12), %r12 movq %r12, %rdi callq 0x5580 movl %eax, %r13d callq 0x5060 movl $0x0, (%rax) testq %r14, %r14 je 0x94c9 movq %r12, %rdi callq 0x5320 movq %rbx, %rdi testl %r13d, %r13d je 0x94f1 movl %ebp, %esi callq 0x664e leaq 0x21dfb(%rip), %rsi # 0x2b2da movq %rbx, %rdi movl %ebp, %edx callq 0x9528 movl $0x6, %r15d jmp 0x950a movl %ebp, %esi movl $0xffffffff, %edx # imm = 0xFFFFFFFF callq 0x66f8 movq %rbx, %rdi movl $0xfffffffe, %esi # imm = 0xFFFFFFFE callq 0x664e movl %r15d, %eax addq $0x2018, %rsp # imm = 0x2018 popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp retq leaq 0x20061(%rip), %rsi # 0x29587 jmp 0x94df
/mmanyen[P]CLua/build_O1/_deps/lua/lauxlib.c
skipcomment
static int skipcomment (FILE *f, int *cp) { int c = *cp = skipBOM(f); if (c == '#') { /* first line is a comment (Unix exec. file)? */ do { /* skip first line */ c = getc(f); } while (c != EOF && c != '\n'); *cp = getc(f); /* next character after comment, if present */ return 1; /* there was a comment */ } else return 0; /* no comment */ }
pushq %rbp pushq %r14 pushq %rbx movq %rsi, %rbx movq %rdi, %r14 callq 0x5120 movl %eax, %ebp cmpl $0xef, %eax jne 0x95f6 movq %r14, %rdi callq 0x5120 cmpl $0xbb, %eax jne 0x95f6 movq %r14, %rdi callq 0x5120 cmpl $0xbf, %eax jne 0x95f6 movq %r14, %rdi callq 0x5120 movl %eax, %ebp movl %ebp, (%rbx) xorl %eax, %eax cmpl $0x23, %ebp jne 0x9620 movq %r14, %rdi callq 0x5120 cmpl $0xa, %eax je 0x9611 cmpl $-0x1, %eax jne 0x95ff movq %r14, %rdi callq 0x5120 movl %eax, (%rbx) movl $0x1, %eax popq %rbx popq %r14 popq %rbp retq
/mmanyen[P]CLua/build_O1/_deps/lua/lauxlib.c
getF
static const char *getF (lua_State *L, void *ud, size_t *size) { LoadF *lf = (LoadF *)ud; (void)L; /* not used */ if (lf->n > 0) { /* are there pre-read characters to be read? */ *size = lf->n; /* return them (chars already in buffer) */ lf->n = 0; /* no more pre-read characters */ } else { /* read a block from file */ /* 'fread' can return > 0 *and* set the EOF flag. If next call to 'getF' called 'fread', it might still wait for user input. The next check avoids this problem. */ if (feof(lf->f)) return NULL; *size = fread(lf->buff, 1, sizeof(lf->buff), lf->f); /* read block */ } return lf->buff; }
pushq %r14 pushq %rbx pushq %rax movq %rdx, %r14 movq %rsi, %rbx movl (%rsi), %eax testq %rax, %rax je 0x9645 movq %rax, (%r14) movl $0x0, (%rbx) addq $0x10, %rbx jmp 0x9654 movq 0x8(%rbx), %rdi callq 0x5490 testl %eax, %eax je 0x965f xorl %ebx, %ebx movq %rbx, %rax addq $0x8, %rsp popq %rbx popq %r14 retq leaq 0x10(%rbx), %rdi movq 0x8(%rbx), %rcx movl $0x1, %esi movl $0x2000, %edx # imm = 0x2000 callq 0x5460 movq %rax, (%r14) jmp 0x963f
/mmanyen[P]CLua/build_O1/_deps/lua/lauxlib.c
getS
static const char *getS (lua_State *L, void *ud, size_t *size) { LoadS *ls = (LoadS *)ud; (void)L; /* not used */ if (ls->size == 0) return NULL; *size = ls->size; ls->size = 0; return ls->s; }
movq 0x8(%rsi), %rax testq %rax, %rax je 0x96b7 movq %rax, (%rdx) movq $0x0, 0x8(%rsi) movq (%rsi), %rax retq xorl %eax, %eax retq
/mmanyen[P]CLua/build_O1/_deps/lua/lauxlib.c
luaL_len
LUALIB_API lua_Integer luaL_len (lua_State *L, int idx) { lua_Integer l; int isnum; lua_len(L, idx); l = lua_tointegerx(L, -1, &isnum); if (l_unlikely(!isnum)) luaL_error(L, "object length is not an integer"); lua_pop(L, 1); /* remove object */ return l; }
pushq %r15 pushq %r14 pushq %rbx subq $0x10, %rsp movq %rdi, %rbx callq 0x7eaa leaq 0xc(%rsp), %r15 movq %rbx, %rdi movl $0xffffffff, %esi # imm = 0xFFFFFFFF movq %r15, %rdx callq 0x6b52 movq %rax, %r14 cmpl $0x0, (%r15) je 0x9794 movq %rbx, %rdi movl $0xfffffffe, %esi # imm = 0xFFFFFFFE callq 0x664e movq %r14, %rax addq $0x10, %rsp popq %rbx popq %r14 popq %r15 retq leaq 0x1fdf3(%rip), %rsi # 0x2958e movq %rbx, %rdi xorl %eax, %eax callq 0x87c6 jmp 0x977a
/mmanyen[P]CLua/build_O1/_deps/lua/lauxlib.c
luaL_tolstring
LUALIB_API const char *luaL_tolstring (lua_State *L, int idx, size_t *len) { idx = lua_absindex(L,idx); if (luaL_callmeta(L, idx, "__tostring")) { /* metafield? */ if (!lua_isstring(L, -1)) luaL_error(L, "'__tostring' must return a string"); } else { switch (lua_type(L, idx)) { case LUA_TNUMBER: { char buff[LUA_N2SBUFFSZ]; lua_numbertocstring(L, idx, buff); lua_pushstring(L, buff); break; } case LUA_TSTRING: lua_pushvalue(L, idx); break; case LUA_TBOOLEAN: lua_pushstring(L, (lua_toboolean(L, idx) ? "true" : "false")); break; case LUA_TNIL: lua_pushliteral(L, "nil"); break; default: { int tt = luaL_getmetafield(L, idx, "__name"); /* try name */ const char *kind = (tt == LUA_TSTRING) ? lua_tostring(L, -1) : luaL_typename(L, idx); lua_pushfstring(L, "%s: %p", kind, lua_topointer(L, idx)); if (tt != LUA_TNIL) lua_remove(L, -2); /* remove '__name' */ break; } } } return lua_tolstring(L, -1, len); }
pushq %rbp pushq %r15 pushq %r14 pushq %r12 pushq %rbx subq $0x40, %rsp movq %rdx, %rbx movq %rdi, %r14 callq 0x6619 movl %eax, %ebp leaq 0x1fde7(%rip), %rdx # 0x295ae movq %r14, %rdi movl %eax, %esi callq 0x96f8 movq %r14, %rdi testl %eax, %eax je 0x9800 movl $0xffffffff, %esi # imm = 0xFFFFFFFF callq 0x6960 testl %eax, %eax jne 0x98fc leaq 0x1fdc8(%rip), %rsi # 0x295b9 movq %r14, %rdi xorl %eax, %eax callq 0x87c6 jmp 0x98fc movl %ebp, %esi callq 0x68d4 cmpl $0x4, %eax ja 0x9879 movl %eax, %eax leaq 0x1fc17(%rip), %rcx # 0x2942c movslq (%rcx,%rax,4), %rax addq %rcx, %rax jmpq *%rax leaq 0x21981(%rip), %rsi # 0x2b1a6 jmp 0x985d movq %rsp, %r15 movq %r14, %rdi movl %ebp, %esi movq %r15, %rdx callq 0x6abb movq %r14, %rdi movq %r15, %rsi jmp 0x9860 movq %r14, %rdi movl %ebp, %esi callq 0x6b9e testl %eax, %eax leaq 0x1fd8e(%rip), %rax # 0x295e0 leaq 0x1fd82(%rip), %rsi # 0x295db cmoveq %rax, %rsi movq %r14, %rdi callq 0x6e5b jmp 0x98fc movq %r14, %rdi movl %ebp, %esi callq 0x68aa jmp 0x98fc leaq 0x1fc78(%rip), %rdx # 0x294f8 movq %r14, %rdi movl %ebp, %esi callq 0x89f6 movl %eax, %r15d movq %r14, %rdi cmpl $0x4, %eax jne 0x98a3 movl $0xffffffff, %esi # imm = 0xFFFFFFFF xorl %edx, %edx callq 0x6bb8 jmp 0x98b4 movl %ebp, %esi callq 0x68d4 movq %r14, %rdi movl %eax, %esi callq 0x68fa movq %rax, %r12 movq %r14, %rdi movl %ebp, %esi callq 0x6d11 leaq 0x1fd1e(%rip), %rsi # 0x295e6 movq %r14, %rdi movq %r12, %rdx movq %rax, %rcx xorl %eax, %eax callq 0x6ee9 testl %r15d, %r15d je 0x98fc movq %r14, %rdi movl $0xfffffffe, %esi # imm = 0xFFFFFFFE movl $0xffffffff, %edx # imm = 0xFFFFFFFF callq 0x66f8 movq %r14, %rdi movl $0xfffffffe, %esi # imm = 0xFFFFFFFE callq 0x664e movq %r14, %rdi movl $0xffffffff, %esi # imm = 0xFFFFFFFF movq %rbx, %rdx callq 0x6bb8 addq $0x40, %rsp popq %rbx popq %r12 popq %r14 popq %r15 popq %rbp retq
/mmanyen[P]CLua/build_O1/_deps/lua/lauxlib.c
luaL_setfuncs
LUALIB_API void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) { luaL_checkstack(L, nup, "too many upvalues"); for (; l->name != NULL; l++) { /* fill the table with given functions */ if (l->func == NULL) /* placeholder? */ lua_pushboolean(L, 0); else { int i; for (i = 0; i < nup; i++) /* copy upvalues to the top */ lua_pushvalue(L, -nup); lua_pushcclosure(L, l->func, nup); /* closure with those upvalues */ } lua_setfield(L, -(nup + 2), l->name); } lua_pop(L, nup); /* remove upvalues */ }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx pushq %rax movl %edx, %ebx movq %rsi, %r15 movq %rdi, %r14 leaq 0x1fcba(%rip), %rdx # 0x295ed movl %ebx, %esi callq 0x8e28 cmpq $0x0, (%r15) je 0x999d movl %ebx, %ebp negl %ebp movl $0xfffffffe, %r12d # imm = 0xFFFFFFFE subl %ebx, %r12d cmpq $0x0, 0x8(%r15) je 0x997a movl %ebx, %r13d testl %ebx, %ebx jle 0x996a movq %r14, %rdi movl %ebp, %esi callq 0x68aa decl %r13d jne 0x995b movq 0x8(%r15), %rsi movq %r14, %rdi movl %ebx, %edx callq 0x6fa4 jmp 0x9984 movq %r14, %rdi xorl %esi, %esi callq 0x704c movq (%r15), %rdx movq %r14, %rdi movl %r12d, %esi callq 0x75d5 cmpq $0x0, 0x10(%r15) leaq 0x10(%r15), %r15 jne 0x994d notl %ebx movq %r14, %rdi movl %ebx, %esi addq $0x8, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp jmp 0x664e
/mmanyen[P]CLua/build_O1/_deps/lua/lauxlib.c
luaL_getsubtable
LUALIB_API int luaL_getsubtable (lua_State *L, int idx, const char *fname) { if (lua_getfield(L, idx, fname) == LUA_TTABLE) return 1; /* table already there */ else { lua_pop(L, 1); /* remove previous result */ idx = lua_absindex(L, idx); lua_newtable(L); lua_pushvalue(L, -1); /* copy to be left at top */ lua_setfield(L, idx, fname); /* assign new table to field */ return 0; /* false, because did not find table there */ } }
pushq %rbp pushq %r15 pushq %r14 pushq %rbx pushq %rax movq %rdx, %rbx movl %esi, %r15d movq %rdi, %r14 callq 0x71a1 movl $0x1, %ebp cmpl $0x5, %eax je 0x9a1a movq %r14, %rdi movl $0xfffffffe, %esi # imm = 0xFFFFFFFE callq 0x664e movq %r14, %rdi movl %r15d, %esi callq 0x6619 movl %eax, %r15d xorl %ebp, %ebp movq %r14, %rdi xorl %esi, %esi xorl %edx, %edx callq 0x7355 movq %r14, %rdi movl $0xffffffff, %esi # imm = 0xFFFFFFFF callq 0x68aa movq %r14, %rdi movl %r15d, %esi movq %rbx, %rdx callq 0x75d5 movl %ebp, %eax addq $0x8, %rsp popq %rbx popq %r14 popq %r15 popq %rbp retq
/mmanyen[P]CLua/build_O1/_deps/lua/lauxlib.c
luaL_requiref
LUALIB_API void luaL_requiref (lua_State *L, const char *modname, lua_CFunction openf, int glb) { luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE); lua_getfield(L, -1, modname); /* LOADED[modname] */ if (!lua_toboolean(L, -1)) { /* package not already loaded? */ lua_pop(L, 1); /* remove field */ lua_pushcfunction(L, openf); lua_pushstring(L, modname); /* argument to open function */ lua_call(L, 1, 1); /* call 'openf' to open module */ lua_pushvalue(L, -1); /* make copy of module (call result) */ lua_setfield(L, -3, modname); /* LOADED[modname] = module */ } lua_remove(L, -2); /* remove LOADED table */ if (glb) { lua_pushvalue(L, -1); /* copy of module */ lua_setglobal(L, modname); /* _G[modname] = module */ } }
pushq %rbp pushq %r15 pushq %r14 pushq %rbx pushq %rax movl %ecx, %ebp movq %rdx, %r15 movq %rsi, %rbx movq %rdi, %r14 leaq 0x1fbbf(%rip), %rdx # 0x295ff movl $0xfff0b9d8, %esi # imm = 0xFFF0B9D8 callq 0x99b7 movq %r14, %rdi movl $0xffffffff, %esi # imm = 0xFFFFFFFF movq %rbx, %rdx callq 0x71a1 movq %r14, %rdi movl $0xffffffff, %esi # imm = 0xFFFFFFFF callq 0x6b9e testl %eax, %eax jne 0x9ac4 movq %r14, %rdi movl $0xfffffffe, %esi # imm = 0xFFFFFFFE callq 0x664e movq %r14, %rdi movq %r15, %rsi xorl %edx, %edx callq 0x6fa4 movq %r14, %rdi movq %rbx, %rsi callq 0x6e5b movq %r14, %rdi movl $0x1, %esi movl $0x1, %edx xorl %ecx, %ecx xorl %r8d, %r8d callq 0x78e1 movq %r14, %rdi movl $0xffffffff, %esi # imm = 0xFFFFFFFF callq 0x68aa movq %r14, %rdi movl $0xfffffffd, %esi # imm = 0xFFFFFFFD movq %rbx, %rdx callq 0x75d5 movq %r14, %rdi movl $0xfffffffe, %esi # imm = 0xFFFFFFFE movl $0xffffffff, %edx # imm = 0xFFFFFFFF callq 0x66f8 movq %r14, %rdi movl $0xfffffffe, %esi # imm = 0xFFFFFFFE callq 0x664e testl %ebp, %ebp je 0x9b09 movq %r14, %rdi movl $0xffffffff, %esi # imm = 0xFFFFFFFF callq 0x68aa movq %r14, %rdi movq %rbx, %rsi addq $0x8, %rsp popq %rbx popq %r14 popq %r15 popq %rbp jmp 0x7473 addq $0x8, %rsp popq %rbx popq %r14 popq %r15 popq %rbp retq
/mmanyen[P]CLua/build_O1/_deps/lua/lauxlib.c
luaL_addgsub
LUALIB_API void luaL_addgsub (luaL_Buffer *b, const char *s, const char *p, const char *r) { const char *wild; size_t l = strlen(p); while ((wild = strstr(s, p)) != NULL) { luaL_addlstring(b, s, ct_diff2sz(wild - s)); /* push prefix */ luaL_addstring(b, r); /* push replacement in place of pattern */ s = wild + l; /* continue after 'p' */ } luaL_addstring(b, s); /* push last suffix */ }
pushq %rbp pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx pushq %rax movq %rcx, (%rsp) movq %rdx, %r15 movq %rsi, %r12 movq %rdi, %rbx movq %rdx, %rdi callq 0x5180 movq %rax, %r13 movq %r12, %rdi movq %r15, %rsi callq 0x50f0 testq %rax, %rax je 0x9b99 movq %rax, %r14 movq %r14, %rbp subq %r12, %rbp je 0x9b74 movq %rbx, %rdi movq %rbp, %rsi movl $0xffffffff, %edx # imm = 0xFFFFFFFF callq 0x8fe5 movq %rax, %rdi movq %r12, %rsi movq %rbp, %rdx callq 0x52a0 addq %rbp, 0x10(%rbx) movq %rbx, %rdi movq (%rsp), %rsi callq 0x8537 movq %r14, %r12 addq %r13, %r12 movq %r12, %rdi movq %r15, %rsi callq 0x50f0 movq %rax, %r14 testq %rax, %rax jne 0x9b4a movq %rbx, %rdi movq %r12, %rsi addq $0x8, %rsp popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 popq %rbp jmp 0x8537
/mmanyen[P]CLua/build_O1/_deps/lua/lauxlib.c
luaL_gsub
LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p, const char *r) { luaL_Buffer b; luaL_buffinit(L, &b); luaL_addgsub(&b, s, p, r); luaL_pushresult(&b); return lua_tostring(L, -1); }
pushq %r15 pushq %r14 pushq %r13 pushq %r12 pushq %rbx subq $0x420, %rsp # imm = 0x420 movq %rcx, %rbx movq %rdx, %r14 movq %rsi, %r15 movq %rdi, %r12 leaq 0x20(%rsp), %rax movq %rdi, -0x8(%rax) movq %rax, -0x20(%rax) movq $0x0, -0x10(%rax) movq $0x400, -0x18(%rax) # imm = 0x400 movq %rsp, %r13 movq %r13, %rsi callq 0x7063 movq %r13, %rdi movq %r15, %rsi movq %r14, %rdx movq %rbx, %rcx callq 0x9b14 movq %r13, %rdi callq 0x85e7 movq %r12, %rdi movl $0xffffffff, %esi # imm = 0xFFFFFFFF xorl %edx, %edx callq 0x6bb8 addq $0x420, %rsp # imm = 0x420 popq %rbx popq %r12 popq %r13 popq %r14 popq %r15 retq
/mmanyen[P]CLua/build_O1/_deps/lua/lauxlib.c
luai_makeseed
static unsigned int luai_makeseed (void) { unsigned int buff[BUFSEED]; unsigned int res; unsigned int i; time_t t = time(NULL); char *b = (char*)buff; addbuff(b, b); /* local variable's address */ addbuff(b, t); /* time */ /* fill (rare but possible) remain of the buffer with zeros */ memset(b, 0, sizeof(buff) - BUFSEEDB); res = buff[0]; for (i = 1; i < BUFSEED; i++) res ^= (res >> 3) + (res << 7) + buff[i]; return res; }
subq $0x18, %rsp xorl %edi, %edi callq 0x52e0 movq %rax, %rcx movq %rsp, %rax movq %rax, (%rax) movq %rcx, 0x8(%rax) movl $0x1, %ecx movl %eax, %edx movl %eax, %esi shrl $0x3, %esi shll $0x7, %eax addl %esi, %eax addl (%rsp,%rcx,4), %eax xorl %edx, %eax incq %rcx cmpq $0x4, %rcx jne 0x9c4e addq $0x18, %rsp retq
/mmanyen[P]CLua/build_O1/_deps/lua/lauxlib.c
l_alloc
static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) { (void)ud; (void)osize; /* not used */ if (nsize == 0) { free(ptr); return NULL; } else return realloc(ptr, nsize); }
movq %rsi, %rdi testq %rcx, %rcx je 0x9c7d movq %rcx, %rsi jmp 0x54c0 pushq %rax callq 0x53c0 xorl %eax, %eax popq %rcx retq
/mmanyen[P]CLua/build_O1/_deps/lua/lauxlib.c
luaL_checkversion_
LUALIB_API void luaL_checkversion_ (lua_State *L, lua_Number ver, size_t sz) { lua_Number v = lua_version(L); if (sz != LUAL_NUMSIZES) /* check numeric types */ luaL_error(L, "core and library have incompatible numeric types"); else if (v != ver) luaL_error(L, "version mismatch: app. needs %f, Lua core provides %f", (LUAI_UACNUMBER)ver, (LUAI_UACNUMBER)v); }
pushq %r14 pushq %rbx pushq %rax movq %rsi, %r14 movsd %xmm0, (%rsp) movq %rdi, %rbx callq 0x6610 cmpq $0x88, %r14 jne 0x9cd2 movapd %xmm0, %xmm1 movsd (%rsp), %xmm0 ucomisd %xmm0, %xmm1 jne 0x9cba jnp 0x9cea leaq 0x1f977(%rip), %rsi # 0x29638 movq %rbx, %rdi movb $0x2, %al addq $0x8, %rsp popq %rbx popq %r14 jmp 0x87c6 leaq 0x1f92e(%rip), %rsi # 0x29607 movq %rbx, %rdi xorl %eax, %eax addq $0x8, %rsp popq %rbx popq %r14 jmp 0x87c6 addq $0x8, %rsp popq %rbx popq %r14 retq
/mmanyen[P]CLua/build_O1/_deps/lua/lauxlib.c
findfield
static int findfield (lua_State *L, int objidx, int level) { if (level == 0 || !lua_istable(L, -1)) return 0; /* not found */ lua_pushnil(L); /* start 'next' loop */ while (lua_next(L, -2)) { /* for each pair in table */ if (lua_type(L, -2) == LUA_TSTRING) { /* ignore non-string keys */ if (lua_rawequal(L, objidx, -1)) { /* found object? */ lua_pop(L, 1); /* remove value (but keep name) */ return 1; } else if (findfield(L, objidx, level - 1)) { /* try recursively */ /* stack: lib_name, lib_table, field_name (top) */ lua_pushliteral(L, "."); /* place '.' between the two names */ lua_replace(L, -3); /* (in the slot occupied by table) */ lua_concat(L, 3); /* lib_name.field_name */ return 1; } } lua_pop(L, 1); /* remove value */ } return 0; /* not found */ }
pushq %rbp pushq %r15 pushq %r14 pushq %rbx pushq %rax xorl %ebp, %ebp testl %edx, %edx je 0x9de6 movl %edx, %r14d movl %esi, %r15d movq %rdi, %rbx movl $0xffffffff, %esi # imm = 0xFFFFFFFF callq 0x68d4 cmpl $0x5, %eax jne 0x9de6 movq %rbx, %rdi callq 0x6d71 movq %rbx, %rdi movl $0xfffffffe, %esi # imm = 0xFFFFFFFE callq 0x7de1 testl %eax, %eax je 0x9de6 decl %r14d movq %rbx, %rdi movl $0xfffffffe, %esi # imm = 0xFFFFFFFE callq 0x68d4 cmpl $0x4, %eax jne 0x9d77 movq %rbx, %rdi movl %r15d, %esi movl $0xffffffff, %edx # imm = 0xFFFFFFFF callq 0x6993 testl %eax, %eax jne 0x9d97 movq %rbx, %rdi movl %r15d, %esi movl %r14d, %edx callq 0x9cf2 testl %eax, %eax jne 0x9da6 movq %rbx, %rdi movl $0xfffffffe, %esi # imm = 0xFFFFFFFE callq 0x664e movq %rbx, %rdi movl $0xfffffffe, %esi # imm = 0xFFFFFFFE callq 0x7de1 testl %eax, %eax jne 0x9d3f jmp 0x9de6 movq %rbx, %rdi movl $0xfffffffe, %esi # imm = 0xFFFFFFFE callq 0x664e jmp 0x9de1 leaq 0x20603(%rip), %rsi # 0x2a3b0 movq %rbx, %rdi callq 0x6e5b movq %rbx, %rdi movl $0xffffffff, %esi # imm = 0xFFFFFFFF movl $0xfffffffd, %edx # imm = 0xFFFFFFFD callq 0x67d5 movq %rbx, %rdi movl $0xfffffffe, %esi # imm = 0xFFFFFFFE callq 0x664e movq %rbx, %rdi movl $0x3, %esi callq 0x7e4f movl $0x1, %ebp movl %ebp, %eax addq $0x8, %rsp popq %rbx popq %r14 popq %r15 popq %rbp retq
/mmanyen[P]CLua/build_O1/_deps/lua/lauxlib.c
checkcontrol
static int checkcontrol (lua_State *L, const char *message, int tocont) { if (tocont || *(message++) != '@') /* not a control message? */ return 0; else { if (strcmp(message, "off") == 0) lua_setwarnf(L, warnfoff, L); /* turn warnings off */ else if (strcmp(message, "on") == 0) lua_setwarnf(L, warnfon, L); /* turn warnings on */ return 1; /* it was a control message */ } }
xorl %eax, %eax testl %edx, %edx je 0x9e0b retq pushq %r14 pushq %rbx pushq %rax movq %rsi, %r14 cmpb $0x40, (%rsi) jne 0x9e6a movq %rdi, %rbx incq %r14 leaq 0x1f964(%rip), %rsi # 0x29788 movq %r14, %rdi callq 0x5420 testl %eax, %eax je 0x9e53 leaq 0x2152b(%rip), %rsi # 0x2b362 movq %r14, %rdi callq 0x5420 movl %eax, %ecx movl $0x1, %eax testl %ecx, %ecx jne 0x9e6a leaq 0x21(%rip), %rsi # 0x9e72 jmp 0x9e5a leaq -0x1d3(%rip), %rsi # 0x9c87 movq %rbx, %rdi movq %rbx, %rdx callq 0x7eed movl $0x1, %eax addq $0x8, %rsp popq %rbx popq %r14 retq
/mmanyen[P]CLua/build_O1/_deps/lua/lauxlib.c