Created
January 29, 2026 07:57
-
-
Save kazuho/ac85028fe7810c68255a8d967eb2400d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Pull request #651 (https://github.com/h2o/quicly/pull/651) introduced an extra parameter called `payload` that specifies the | |
| * location of the payload to be encrypted (i.e., out-of-place encryption). Custom encryption callbacks can either adopt the new | |
| * API directly, or use a wrapper function that copies the out-of-place payload then calls the original function. | |
| * | |
| * The function below is an example of such a wrapper function. | |
| */ | |
| void new_encrypt_packet(struct st_quicly_crypto_engine_t *engine, quicly_conn_t *conn, ptls_cipher_context_t *header_protect_ctx, | |
| ptls_aead_context_t *packet_protect_ctx, ptls_iovec_t datagram, size_t first_byte_at, | |
| size_t payload_from, const void *payload, uint64_t packet_number, int coalesced) | |
| { | |
| if (datagram.base + payload_from != payload) | |
| memcpy(datagram.base, payload, datagram.len - payload_from - packet_protect_ctx->algo->tag_size); | |
| old_encrypt_packet(engine, conn, header_protect_ctx, packet_protext_ctx, datagram, first_byte_at, payload_from, | |
| packet_number, coalesced); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment