Commit f184e00d authored by Jan Včelák's avatar Jan Včelák 🚀

TSIG: add context reset function

parent da492263
...@@ -44,6 +44,16 @@ void tsig_cleanup(tsig_ctx_t *ctx) ...@@ -44,6 +44,16 @@ void tsig_cleanup(tsig_ctx_t *ctx)
memset(ctx, 0, sizeof(*ctx)); memset(ctx, 0, sizeof(*ctx));
} }
void tsig_reset(tsig_ctx_t *ctx)
{
if (!ctx) {
return;
}
const knot_tsig_key_t *backup = ctx->key;
tsig_init(ctx, backup);
}
int tsig_sign_packet(tsig_ctx_t *ctx, knot_pkt_t *packet) int tsig_sign_packet(tsig_ctx_t *ctx, knot_pkt_t *packet)
{ {
if (!ctx || !packet) { if (!ctx || !packet) {
......
...@@ -56,6 +56,11 @@ void tsig_init(tsig_ctx_t *ctx, const knot_tsig_key_t *key); ...@@ -56,6 +56,11 @@ void tsig_init(tsig_ctx_t *ctx, const knot_tsig_key_t *key);
*/ */
void tsig_cleanup(tsig_ctx_t *ctx); void tsig_cleanup(tsig_ctx_t *ctx);
/*!
* \brief Reset TSIG context for new message exchange.
*/
void tsig_reset(tsig_ctx_t *ctx);
/*! /*!
* \brief Sign outgoing packet. * \brief Sign outgoing packet.
* *
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment