summaryrefslogtreecommitdiffstats
path: root/src/shrpx_quic.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/shrpx_quic.h34
1 files changed, 18 insertions, 16 deletions
diff --git a/src/shrpx_quic.h b/src/shrpx_quic.h
index dae6e31..bc7f729 100644
--- a/src/shrpx_quic.h
+++ b/src/shrpx_quic.h
@@ -30,6 +30,8 @@
#include <stdint.h>
#include <functional>
+#include <optional>
+#include <span>
#include <openssl/evp.h>
@@ -115,7 +117,7 @@ ngtcp2_tstamp quic_timestamp();
int quic_send_packet(const UpstreamAddr *faddr, const sockaddr *remote_sa,
size_t remote_salen, const sockaddr *local_sa,
size_t local_salen, const ngtcp2_pkt_info &pi,
- const uint8_t *data, size_t datalen, size_t gso_size);
+ std::span<const uint8_t> data, size_t gso_size);
int generate_quic_retry_connection_id(ngtcp2_cid &cid, uint32_t server_id,
uint8_t km_id, EVP_CIPHER_CTX *ctx);
@@ -138,27 +140,27 @@ int generate_quic_stateless_reset_token(uint8_t *token, const ngtcp2_cid &cid,
const uint8_t *secret,
size_t secretlen);
-int generate_retry_token(uint8_t *token, size_t &tokenlen, uint32_t version,
- const sockaddr *sa, socklen_t salen,
- const ngtcp2_cid &retry_scid, const ngtcp2_cid &odcid,
- const uint8_t *secret, size_t secretlen);
+std::optional<std::span<const uint8_t>>
+generate_retry_token(std::span<uint8_t> token, uint32_t version,
+ const sockaddr *sa, socklen_t salen,
+ const ngtcp2_cid &retry_scid, const ngtcp2_cid &odcid,
+ std::span<const uint8_t> secret);
-int verify_retry_token(ngtcp2_cid &odcid, const uint8_t *token, size_t tokenlen,
+int verify_retry_token(ngtcp2_cid &odcid, std::span<const uint8_t> token,
uint32_t version, const ngtcp2_cid &dcid,
const sockaddr *sa, socklen_t salen,
- const uint8_t *secret, size_t secretlen);
+ std::span<const uint8_t> secret);
-int generate_token(uint8_t *token, size_t &tokenlen, const sockaddr *sa,
- size_t salen, const uint8_t *secret, size_t secretlen);
+std::optional<std::span<const uint8_t>>
+generate_token(std::span<uint8_t> token, const sockaddr *sa, size_t salen,
+ std::span<const uint8_t> secret, uint8_t km_id);
-int verify_token(const uint8_t *token, size_t tokenlen, const sockaddr *sa,
- socklen_t salen, const uint8_t *secret, size_t secretlen);
+int verify_token(std::span<const uint8_t> token, const sockaddr *sa,
+ socklen_t salen, std::span<const uint8_t> secret);
-int generate_quic_connection_id_encryption_key(uint8_t *key, size_t keylen,
- const uint8_t *secret,
- size_t secretlen,
- const uint8_t *salt,
- size_t saltlen);
+int generate_quic_connection_id_encryption_key(std::span<uint8_t> key,
+ std::span<const uint8_t> secret,
+ std::span<const uint8_t> salt);
const QUICKeyingMaterial *
select_quic_keying_material(const QUICKeyingMaterials &qkms, uint8_t km_id);