Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to understand ptls_buffer_push_block and ptls_buffer_push #338

Open
gmusjha opened this issue Mar 9, 2021 · 0 comments
Open

Trying to understand ptls_buffer_push_block and ptls_buffer_push #338

gmusjha opened this issue Mar 9, 2021 · 0 comments

Comments

@gmusjha
Copy link

gmusjha commented Mar 9, 2021

I am trying to learn picotls a little bit better, I this process I come across code like the following:

I have tried to use gcc -E to expand macro but still, I thought I should ask

The first-line below has a capacity of 3. What it has to be like that? why not 1 or 2 or any other number. Second ptls_buffer_pushv allocates memory. How come it is taking certificates[i].len bot certificate[i].len * sizeof(char)

your thoughts will be appreciated.

ptls_buffer_push_block(buf, 3, { size_t i; for (i = 0; i != num_certificates; ++i) { ptls_buffer_push_block(buf, 3, { ptls_buffer_pushv(buf, certificates[i].base, certificates[i].len); }); ptls_buffer_push_block(buf, 2, { if (i == 0 && ocsp_status.len != 0) { buffer_push_extension(buf, PTLS_EXTENSION_TYPE_STATUS_REQUEST, { ptls_buffer_push(buf, 1); /* status_type == ocsp */ ptls_buffer_push_block(buf, 3, { ptls_buffer_pushv(buf, ocsp_status.base, ocsp_status.len); }); }); } }); } });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant