quic_record_rx.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. /*
  2. * Copyright 2022-2024 The OpenSSL Project Authors. All Rights Reserved.
  3. *
  4. * Licensed under the Apache License 2.0 (the "License"). You may not use
  5. * this file except in compliance with the License. You can obtain a copy
  6. * in the file LICENSE in the source distribution or at
  7. * https://www.openssl.org/source/license.html
  8. */
  9. #ifndef OSSL_QUIC_RECORD_RX_H
  10. # define OSSL_QUIC_RECORD_RX_H
  11. # include <openssl/ssl.h>
  12. # include "internal/quic_wire_pkt.h"
  13. # include "internal/quic_types.h"
  14. # include "internal/quic_predef.h"
  15. # include "internal/quic_record_util.h"
  16. # include "internal/quic_demux.h"
  17. # ifndef OPENSSL_NO_QUIC
  18. /*
  19. * QUIC Record Layer - RX
  20. * ======================
  21. */
  22. typedef struct ossl_qrx_st OSSL_QRX;
  23. typedef struct ossl_qrx_args_st {
  24. OSSL_LIB_CTX *libctx;
  25. const char *propq;
  26. /* Demux which owns the URXEs passed to us. */
  27. QUIC_DEMUX *demux;
  28. /* Length of connection IDs used in short-header packets in bytes. */
  29. size_t short_conn_id_len;
  30. /*
  31. * Maximum number of deferred datagrams buffered at any one time.
  32. * Suggested value: 32.
  33. */
  34. size_t max_deferred;
  35. /* Initial reference PN used for RX. */
  36. QUIC_PN init_largest_pn[QUIC_PN_SPACE_NUM];
  37. /* Initial key phase. For debugging use only; always 0 in real use. */
  38. unsigned char init_key_phase_bit;
  39. } OSSL_QRX_ARGS;
  40. /* Instantiates a new QRX. */
  41. OSSL_QRX *ossl_qrx_new(const OSSL_QRX_ARGS *args);
  42. /*
  43. * Frees the QRX. All packets obtained using ossl_qrx_read_pkt must already
  44. * have been released by calling ossl_qrx_release_pkt.
  45. *
  46. * You do not need to call ossl_qrx_remove_dst_conn_id first; this function will
  47. * unregister the QRX from the demuxer for all registered destination connection
  48. * IDs (DCIDs) automatically.
  49. */
  50. void ossl_qrx_free(OSSL_QRX *qrx);
  51. /* Setters for the msg_callback and msg_callback_arg */
  52. void ossl_qrx_set_msg_callback(OSSL_QRX *qrx, ossl_msg_cb msg_callback,
  53. SSL *msg_callback_ssl);
  54. void ossl_qrx_set_msg_callback_arg(OSSL_QRX *qrx,
  55. void *msg_callback_arg);
  56. /*
  57. * Secret Management
  58. * =================
  59. *
  60. * A QRX has several encryption levels (Initial, Handshake, 0-RTT, 1-RTT) and
  61. * two directions (RX, TX). At any given time, key material is managed for each
  62. * (EL, RX/TX) combination.
  63. *
  64. * Broadly, for a given (EL, RX/TX), the following state machine is applicable:
  65. *
  66. * WAITING_FOR_KEYS --[Provide]--> HAVE_KEYS --[Discard]--> | DISCARDED |
  67. * \-------------------------------------[Discard]--> | |
  68. *
  69. * To transition the RX side of an EL from WAITING_FOR_KEYS to HAVE_KEYS, call
  70. * ossl_qrx_provide_secret (for the INITIAL EL, use of
  71. * ossl_quic_provide_initial_secret is recommended).
  72. *
  73. * Once keys have been provisioned for an EL, you call
  74. * ossl_qrx_discard_enc_level to transition the EL to the DISCARDED state. You
  75. * can also call this function to transition directly to the DISCARDED state
  76. * even before any keys have been provisioned for that EL.
  77. *
  78. * The DISCARDED state is terminal for a given EL; you cannot provide a secret
  79. * again for that EL after reaching it.
  80. *
  81. * Incoming packets cannot be processed and decrypted if they target an EL
  82. * not in the HAVE_KEYS state. However, there is a distinction between
  83. * the WAITING_FOR_KEYS and DISCARDED states:
  84. *
  85. * - In the WAITING_FOR_KEYS state, the QRX assumes keys for the given
  86. * EL will eventually arrive. Therefore, if it receives any packet
  87. * for an EL in this state, it buffers it and tries to process it
  88. * again once the EL reaches HAVE_KEYS.
  89. *
  90. * - In the DISCARDED state, the QRX assumes no keys for the given
  91. * EL will ever arrive again. If it receives any packet for an EL
  92. * in this state, it is simply discarded.
  93. *
  94. * If the user wishes to instantiate a new QRX to replace an old one for
  95. * whatever reason, for example to take over for an already established QUIC
  96. * connection, it is important that all ELs no longer being used (i.e., INITIAL,
  97. * 0-RTT, 1-RTT) are transitioned to the DISCARDED state. Otherwise, the QRX
  98. * will assume that keys for these ELs will arrive in future, and will buffer
  99. * any received packets for those ELs perpetually. This can be done by calling
  100. * ossl_qrx_discard_enc_level for all non-1-RTT ELs immediately after
  101. * instantiating the QRX.
  102. *
  103. * The INITIAL EL is not setup automatically when the QRX is instantiated. This
  104. * allows the caller to instead discard it immediately after instantiation of
  105. * the QRX if it is not needed, for example if the QRX is being instantiated to
  106. * take over handling of an existing connection which has already passed the
  107. * INITIAL phase. This avoids the unnecessary derivation of INITIAL keys where
  108. * they are not needed. In the ordinary case, ossl_quic_provide_initial_secret
  109. * should be called immediately after instantiation.
  110. */
  111. /*
  112. * Provides a secret to the QRX, which arises due to an encryption level change.
  113. * enc_level is a QUIC_ENC_LEVEL_* value. To initialise the INITIAL encryption
  114. * level, it is recommended to use ossl_quic_provide_initial_secret instead.
  115. *
  116. * You should seek to call this function for a given EL before packets of that
  117. * EL arrive and are processed by the QRX. However, if packets have already
  118. * arrived for a given EL, the QRX will defer processing of them and perform
  119. * processing of them when this function is eventually called for the EL in
  120. * question.
  121. *
  122. * suite_id is a QRL_SUITE_* value which determines the AEAD function used for
  123. * the QRX.
  124. *
  125. * The secret passed is used directly to derive the "quic key", "quic iv" and
  126. * "quic hp" values.
  127. *
  128. * secret_len is the length of the secret buffer in bytes. The buffer must be
  129. * sized correctly to the chosen suite, else the function fails.
  130. *
  131. * This function can only be called once for a given EL, except for the INITIAL
  132. * EL, which can need rekeying when a connection retry occurs. Subsequent calls
  133. * for non-INITIAL ELs fail, as do calls made after a corresponding call to
  134. * ossl_qrx_discard_enc_level for that EL. The secret for a non-INITIAL EL
  135. * cannot be changed after it is set because QUIC has no facility for
  136. * introducing additional key material after an EL is setup. QUIC key updates
  137. * are managed semi-automatically by the QRX but do require some caller handling
  138. * (see below).
  139. *
  140. * md is for internal use and should be NULL.
  141. *
  142. * Returns 1 on success or 0 on failure.
  143. */
  144. int ossl_qrx_provide_secret(OSSL_QRX *qrx,
  145. uint32_t enc_level,
  146. uint32_t suite_id,
  147. EVP_MD *md,
  148. const unsigned char *secret,
  149. size_t secret_len);
  150. /*
  151. * Informs the QRX that it can now discard key material for a given EL. The QRX
  152. * will no longer be able to process incoming packets received at that
  153. * encryption level. This function is idempotent and succeeds if the EL has
  154. * already been discarded.
  155. *
  156. * Returns 1 on success and 0 on failure.
  157. */
  158. int ossl_qrx_discard_enc_level(OSSL_QRX *qrx, uint32_t enc_level);
  159. /*
  160. * Packet Reception
  161. * ================
  162. */
  163. /* Information about a received packet. */
  164. struct ossl_qrx_pkt_st {
  165. /*
  166. * Points to a logical representation of the decoded QUIC packet header. The
  167. * data and len fields point to the decrypted QUIC payload (i.e., to a
  168. * sequence of zero or more (potentially malformed) frames to be decoded).
  169. */
  170. QUIC_PKT_HDR *hdr;
  171. /*
  172. * Address the packet was received from. If this is not available for this
  173. * packet, this field is NULL (but this can only occur for manually injected
  174. * packets).
  175. */
  176. const BIO_ADDR *peer;
  177. /*
  178. * Local address the packet was sent to. If this is not available for this
  179. * packet, this field is NULL.
  180. */
  181. const BIO_ADDR *local;
  182. /*
  183. * This is the length of the datagram which contained this packet. Note that
  184. * the datagram may have contained other packets than this. The intended use
  185. * for this is so that the user can enforce minimum datagram sizes (e.g. for
  186. * datagrams containing INITIAL packets), as required by RFC 9000.
  187. */
  188. size_t datagram_len;
  189. /* The PN which was decoded for the packet, if the packet has a PN field. */
  190. QUIC_PN pn;
  191. /*
  192. * Time the packet was received, or ossl_time_zero() if the demuxer is not
  193. * using a now() function.
  194. */
  195. OSSL_TIME time;
  196. /* The QRX which was used to receive the packet. */
  197. OSSL_QRX *qrx;
  198. /*
  199. * The key epoch the packet was received with. Always 0 for non-1-RTT
  200. * packets.
  201. */
  202. uint64_t key_epoch;
  203. /*
  204. * This monotonically increases with each datagram received.
  205. * It is for diagnostic use only.
  206. */
  207. uint64_t datagram_id;
  208. };
  209. /*
  210. * Tries to read a new decrypted packet from the QRX.
  211. *
  212. * On success, *pkt points to a OSSL_QRX_PKT structure. The structure should be
  213. * freed when no longer needed by calling ossl_qrx_pkt_release(). The structure
  214. * is refcounted; to gain extra references, call ossl_qrx_pkt_up_ref(). This
  215. * will cause a corresponding number of calls to ossl_qrx_pkt_release() to be
  216. * ignored.
  217. *
  218. * The resources referenced by (*pkt)->hdr, (*pkt)->hdr->data and (*pkt)->peer
  219. * have the same lifetime as *pkt.
  220. *
  221. * Returns 1 on success and 0 on failure.
  222. */
  223. int ossl_qrx_read_pkt(OSSL_QRX *qrx, OSSL_QRX_PKT **pkt);
  224. /*
  225. * Decrement the reference count for the given packet and frees it if the
  226. * reference count drops to zero. No-op if pkt is NULL.
  227. */
  228. void ossl_qrx_pkt_release(OSSL_QRX_PKT *pkt);
  229. /* Increments the reference count for the given packet. */
  230. void ossl_qrx_pkt_up_ref(OSSL_QRX_PKT *pkt);
  231. /*
  232. * Returns 1 if there are any already processed (i.e. decrypted) packets waiting
  233. * to be read from the QRX.
  234. */
  235. int ossl_qrx_processed_read_pending(OSSL_QRX *qrx);
  236. /*
  237. * Returns 1 if there are any unprocessed (i.e. not yet decrypted) packets
  238. * waiting to be processed by the QRX. These may or may not result in
  239. * successfully decrypted packets once processed. This indicates whether
  240. * unprocessed data is buffered by the QRX, not whether any data is available in
  241. * a kernel socket buffer.
  242. */
  243. int ossl_qrx_unprocessed_read_pending(OSSL_QRX *qrx);
  244. /*
  245. * Returns the number of UDP payload bytes received from the network so far
  246. * since the last time this counter was cleared. If clear is 1, clears the
  247. * counter and returns the old value.
  248. *
  249. * The intended use of this is to allow callers to determine how much credit to
  250. * add to their anti-amplification budgets. This is reported separately instead
  251. * of in the OSSL_QRX_PKT structure so that a caller can apply
  252. * anti-amplification credit as soon as a datagram is received, before it has
  253. * necessarily read all processed packets contained within that datagram from
  254. * the QRX.
  255. */
  256. uint64_t ossl_qrx_get_bytes_received(OSSL_QRX *qrx, int clear);
  257. /*
  258. * Sets a callback which is called when a packet is received and being validated
  259. * before being queued in the read queue. This is called after packet body
  260. * decryption and authentication to prevent exposing side channels. pn_space is
  261. * a QUIC_PN_SPACE_* value denoting which PN space the PN belongs to.
  262. *
  263. * If this callback returns 1, processing continues normally.
  264. * If this callback returns 0, the packet is discarded.
  265. *
  266. * Other packets in the same datagram will still be processed where possible.
  267. *
  268. * The callback is optional and can be unset by passing NULL for cb.
  269. * cb_arg is an opaque value passed to cb.
  270. */
  271. typedef int (ossl_qrx_late_validation_cb)(QUIC_PN pn, int pn_space,
  272. void *arg);
  273. int ossl_qrx_set_late_validation_cb(OSSL_QRX *qrx,
  274. ossl_qrx_late_validation_cb *cb,
  275. void *cb_arg);
  276. /*
  277. * Forcibly injects a URXE which has been issued by the DEMUX into the QRX for
  278. * processing. This can be used to pass a received datagram to the QRX if it
  279. * would not be correctly routed to the QRX via standard DCID-based routing; for
  280. * example, when handling an incoming Initial packet which is attempting to
  281. * establish a new connection.
  282. */
  283. void ossl_qrx_inject_urxe(OSSL_QRX *qrx, QUIC_URXE *e);
  284. /*
  285. * Decryption of 1-RTT packets must be explicitly enabled by calling this
  286. * function. This is to comply with the requirement that we not process 1-RTT
  287. * packets until the handshake is complete, even if we already have 1-RTT
  288. * secrets. Even if a 1-RTT secret is provisioned for the QRX, incoming 1-RTT
  289. * packets will be handled as though no key is available until this function is
  290. * called. Calling this function will then requeue any such deferred packets for
  291. * processing.
  292. */
  293. void ossl_qrx_allow_1rtt_processing(OSSL_QRX *qrx);
  294. /*
  295. * Key Update (RX)
  296. * ===============
  297. *
  298. * Key update on the RX side is a largely but not entirely automatic process.
  299. *
  300. * Key update is initially triggered by receiving a 1-RTT packet with a
  301. * different Key Phase value. This could be caused by an attacker in the network
  302. * flipping random bits, therefore such a key update is tentative until the
  303. * packet payload is successfully decrypted and authenticated by the AEAD with
  304. * the 'next' keys. These 'next' keys then become the 'current' keys and the
  305. * 'current' keys then become the 'previous' keys. The 'previous' keys must be
  306. * kept around temporarily as some packets may still be in flight in the network
  307. * encrypted with the old keys. If the old Key Phase value is X and the new Key
  308. * Phase Value is Y (where obviously X != Y), this creates an ambiguity as any
  309. * new packet received with a KP of X could either be an attempt to initiate yet
  310. * another key update right after the last one, or an old packet encrypted
  311. * before the key update.
  312. *
  313. * RFC 9001 provides some guidance on handling this issue:
  314. *
  315. * Strategy 1:
  316. * Three keys, disambiguation using packet numbers
  317. *
  318. * "A recovered PN that is lower than any PN from the current KP uses the
  319. * previous packet protection keys; a recovered PN that is higher than any
  320. * PN from the current KP requires use of the next packet protection
  321. * keys."
  322. *
  323. * Strategy 2:
  324. * Two keys and a timer
  325. *
  326. * "Alternatively, endpoints can retain only two sets of packet protection
  327. * keys, swapping previous keys for next after enough time has passed to
  328. * allow for reordering in the network. In this case, the KP bit alone can
  329. * be used to select keys."
  330. *
  331. * Strategy 2 is more efficient (we can keep fewer cipher contexts around) and
  332. * should cover all actually possible network conditions. It also allows a delay
  333. * after we make the 'next' keys our 'current' keys before we generate new
  334. * 'next' keys, which allows us to mitigate against malicious peers who try to
  335. * initiate an excessive number of key updates.
  336. *
  337. * We therefore model the following state machine:
  338. *
  339. *
  340. * PROVISIONED
  341. * _______________________________
  342. * | |
  343. * UNPROVISIONED --|----> NORMAL <----------\ |------> DISCARDED
  344. * | | | |
  345. * | | | |
  346. * | v | |
  347. * | UPDATING | |
  348. * | | | |
  349. * | | | |
  350. * | v | |
  351. * | COOLDOWN | |
  352. * | | | |
  353. * | | | |
  354. * | \---------------| |
  355. * |_______________________________|
  356. *
  357. *
  358. * The RX starts (once a secret has been provisioned) in the NORMAL state. In
  359. * the NORMAL state, the current expected value of the Key Phase bit is
  360. * recorded. When a flipped Key Phase bit is detected, the RX attempts to
  361. * decrypt and authenticate the received packet with the 'next' keys rather than
  362. * the 'current' keys. If (and only if) this authentication is successful, we
  363. * move to the UPDATING state. (An attacker in the network could flip
  364. * the Key Phase bit randomly, so it is essential we do nothing until AEAD
  365. * authentication is complete.)
  366. *
  367. * In the UPDATING state, we know a key update is occurring and record
  368. * the new Key Phase bit value as the newly current value, but we still keep the
  369. * old keys around so that we can still process any packets which were still in
  370. * flight when the key update was initiated. In the UPDATING state, a
  371. * Key Phase bit value different to the current expected value is treated not as
  372. * the initiation of another key update, but a reference to our old keys.
  373. *
  374. * Eventually we will be reasonably sure we are not going to receive any more
  375. * packets with the old keys. At this point, we can transition to the COOLDOWN
  376. * state. This transition occurs automatically after a certain amount of time;
  377. * RFC 9001 recommends it be the PTO interval, which relates to our RTT to the
  378. * peer. The duration also SHOULD NOT exceed three times the PTO to assist with
  379. * maintaining PFS.
  380. *
  381. * In the COOLDOWN phase, the old keys have been securely erased and only one
  382. * set of keys can be used: the current keys. If a packet is received with a Key
  383. * Phase bit value different to the current Key Phase Bit value, this is treated
  384. * as a request for a Key Update, but this request is ignored and the packet is
  385. * treated as malformed. We do this to allow mitigation against malicious peers
  386. * trying to initiate an excessive number of Key Updates. The timeout for the
  387. * transition from UPDATING to COOLDOWN is recommended as adequate for
  388. * this purpose in itself by the RFC, so the normal additional timeout value for
  389. * the transition from COOLDOWN to normal is zero (immediate transition).
  390. *
  391. * A summary of each state:
  392. *
  393. * Epoch Exp KP Uses Keys KS0 KS1 If Non-Expected KP Bit
  394. * ----- ------ --------- ------ ----- ----------------------
  395. * NORMAL 0 0 Keyset 0 Gen 0 Gen 1 → UPDATING
  396. * UPDATING 1 1 Keyset 1 Gen 0 Gen 1 Use Keyset 0
  397. * COOLDOWN 1 1 Keyset 1 Erased Gen 1 Ignore Packet (*)
  398. *
  399. * NORMAL 1 1 Keyset 1 Gen 2 Gen 1 → UPDATING
  400. * UPDATING 2 0 Keyset 0 Gen 2 Gen 1 Use Keyset 1
  401. * COOLDOWN 2 0 Keyset 0 Gen 2 Erased Ignore Packet (*)
  402. *
  403. * (*) Actually implemented by attempting to decrypt the packet with the
  404. * wrong keys (which ultimately has the same outcome), as recommended
  405. * by RFC 9001 to avoid creating timing channels.
  406. *
  407. * Note that the key material for the next key generation ("key epoch") is
  408. * always kept in the NORMAL state (necessary to avoid side-channel attacks).
  409. * This material is derived during the transition from COOLDOWN to NORMAL.
  410. *
  411. * Note that when a peer initiates a Key Update, we MUST also initiate a Key
  412. * Update as per the RFC. The caller is responsible for detecting this condition
  413. * and making the necessary calls to the TX side by detecting changes to the
  414. * return value of ossl_qrx_get_key_epoch().
  415. *
  416. * The above states (NORMAL, UPDATING, COOLDOWN) can themselves be
  417. * considered substates of the PROVISIONED state. Providing a secret to the QRX
  418. * for an EL transitions from UNPROVISIONED, the initial state, to PROVISIONED
  419. * (NORMAL). Dropping key material for an EL transitions from whatever the
  420. * current substate of the PROVISIONED state is to the DISCARDED state, which is
  421. * the terminal state.
  422. *
  423. * Note that non-1RTT ELs cannot undergo key update, therefore a non-1RTT EL is
  424. * always in the NORMAL substate if it is in the PROVISIONED state.
  425. */
  426. /*
  427. * Return the current RX key epoch for the 1-RTT encryption level. This is
  428. * initially zero and is incremented by one for every Key Update successfully
  429. * signalled by the peer. If the 1-RTT EL has not yet been provisioned or has
  430. * been discarded, returns UINT64_MAX.
  431. *
  432. * A necessary implication of this API is that the least significant bit of the
  433. * returned value corresponds to the currently expected Key Phase bit, though
  434. * callers are not anticipated to have any need of this information.
  435. *
  436. * It is not possible for the returned value to overflow, as a QUIC connection
  437. * cannot support more than 2**62 packet numbers, and a connection must be
  438. * terminated if this limit is reached.
  439. *
  440. * The caller should use this function to detect when the key epoch has changed
  441. * and use it to initiate a key update on the TX side.
  442. *
  443. * The value returned by this function increments specifically at the transition
  444. * from the NORMAL to the UPDATING state discussed above.
  445. */
  446. uint64_t ossl_qrx_get_key_epoch(OSSL_QRX *qrx);
  447. /*
  448. * Sets an optional callback which will be called when the key epoch changes.
  449. *
  450. * The callback is optional and can be unset by passing NULL for cb.
  451. * cb_arg is an opaque value passed to cb. pn is the PN of the packet.
  452. * Since key update is only supported for 1-RTT packets, the PN is always
  453. * in the Application Data PN space.
  454. */
  455. typedef void (ossl_qrx_key_update_cb)(QUIC_PN pn, void *arg);
  456. int ossl_qrx_set_key_update_cb(OSSL_QRX *qrx,
  457. ossl_qrx_key_update_cb *cb, void *cb_arg);
  458. /*
  459. * Relates to the 1-RTT encryption level. The caller should call this after the
  460. * UPDATING state is reached, after a timeout to be determined by the caller.
  461. *
  462. * This transitions from the UPDATING state to the COOLDOWN state (if
  463. * still in the UPDATING state). If normal is 1, then transitions from
  464. * the COOLDOWN state to the NORMAL state. Both transitions can be performed at
  465. * once if desired.
  466. *
  467. * If in the normal state, or if in the COOLDOWN state and normal is 0, this is
  468. * a no-op and returns 1. Returns 0 if the 1-RTT EL has not been provisioned or
  469. * has been dropped.
  470. *
  471. * It is essential that the caller call this within a few PTO intervals of a key
  472. * update occurring (as detected by the caller in a call to
  473. * ossl_qrx_key_get_key_epoch()), as otherwise the peer will not be able to
  474. * perform a Key Update ever again.
  475. */
  476. int ossl_qrx_key_update_timeout(OSSL_QRX *qrx, int normal);
  477. /*
  478. * Key Expiration
  479. * ==============
  480. */
  481. /*
  482. * Returns the number of seemingly forged packets which have been received by
  483. * the QRX. If this value reaches the value returned by
  484. * ossl_qrx_get_max_epoch_forged_pkt_count() for a given EL, all further
  485. * received encrypted packets for that EL will be discarded without processing.
  486. *
  487. * Note that the forged packet limit is for the connection lifetime, thus it is
  488. * not reset by a key update. It is suggested that the caller terminate the
  489. * connection a reasonable margin before the limit is reached. However, the
  490. * exact limit imposed does vary by EL due to the possibility that different ELs
  491. * use different AEADs.
  492. */
  493. uint64_t ossl_qrx_get_cur_forged_pkt_count(OSSL_QRX *qrx);
  494. /*
  495. * Returns the maximum number of forged packets which the record layer will
  496. * permit to be verified using this QRX instance.
  497. */
  498. uint64_t ossl_qrx_get_max_forged_pkt_count(OSSL_QRX *qrx,
  499. uint32_t enc_level);
  500. # endif
  501. #endif