quic: update quicly to v0.0.6-vpp
[vpp.git] / build / external / patches / quicly_0.0.6-vpp / 0001-Add-function-ptr-in-ptls-ctx-for-aead_encrypt.patch
1 diff --git a/deps/picotls/include/picotls.h b/deps/picotls/include/picotls.h
2 index 06d62f9..de33b86 100644
3 --- a/deps/picotls/include/picotls.h
4 +++ b/deps/picotls/include/picotls.h
5 @@ -276,6 +276,8 @@ typedef struct st_ptls_aead_context_t {
6      size_t (*do_encrypt_final)(struct st_ptls_aead_context_t *ctx, void *output);
7      size_t (*do_decrypt)(struct st_ptls_aead_context_t *ctx, void *output, const void *input, size_t inlen, const void *iv,
8                           const void *aad, size_t aadlen);
9 +    size_t (*do_encrypt)(struct st_ptls_aead_context_t *ctx, void *output, const void *input, size_t inlen, uint64_t seq,
10 +                         const void *iv, const void *aad, size_t aadlen);
11  } ptls_aead_context_t;
12  
13  /**
14 diff --git a/deps/picotls/lib/picotls.c b/deps/picotls/lib/picotls.c
15 index 70d2fef..f98f7b4 100644
16 --- a/deps/picotls/lib/picotls.c
17 +++ b/deps/picotls/lib/picotls.c
18 @@ -4890,6 +4890,13 @@ size_t ptls_aead_encrypt(ptls_aead_context_t *ctx, void *output, const void *inp
19  {
20      size_t off = 0;
21  
22 +    if(ctx->do_encrypt)
23 +    {
24 +        uint8_t iv[PTLS_MAX_IV_SIZE];
25 +        ptls_aead__build_iv(ctx, iv, seq);
26 +        return ctx->do_encrypt(ctx, output, input, inlen, seq, iv, aad, aadlen);
27 +    }
28 +
29      ptls_aead_encrypt_init(ctx, seq, aad, aadlen);
30      off += ptls_aead_encrypt_update(ctx, ((uint8_t *)output) + off, input, inlen);
31      off += ptls_aead_encrypt_final(ctx, ((uint8_t *)output) + off);
32
33