From 5dfafbc5a9214587533ec8b1dae2a962118d3650 Mon Sep 17 00:00:00 2001 From: vnugent Date: Fri, 12 Jul 2024 22:14:00 -0400 Subject: feat: add decryption functionality to public api --- src/nc-util.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/nc-util.h') diff --git a/src/nc-util.h b/src/nc-util.h index e94a222..d0afe28 100644 --- a/src/nc-util.h +++ b/src/nc-util.h @@ -151,4 +151,18 @@ static _nc_fn_inline span_t ncSpanSlice(span_t span, uint32_t offset, uint32_t s return slice; } +static _nc_fn_inline cspan_t ncSpanSliceC(cspan_t span, uint32_t offset, uint32_t size) +{ + cspan_t slice; + + DEBUG_ASSERT2(span.data != NULL, "Expected span to be non-null"); + DEBUG_ASSERT2(offset + size <= span.size, "Expected offset + size to be less than span size") + + /* Initialize slice, offset input data by the specified offset */ + ncSpanInitC(&slice, span.data + offset, size); + + return slice; +} + + #endif /* !_NC_UTIL_H */ \ No newline at end of file -- cgit