From: Jason Ish Date: Fri, 2 May 2025 17:21:57 +0000 (-0600) Subject: rust/asn1: replace rs_ naming with SC naming X-Git-Tag: suricata-8.0.0-rc1~370 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=713034d0dd76cb5f0498dc038305f2afda0cd2e4;p=thirdparty%2Fsuricata.git rust/asn1: replace rs_ naming with SC naming --- diff --git a/rust/src/asn1/mod.rs b/rust/src/asn1/mod.rs index e458342742..40cd7a76aa 100644 --- a/rust/src/asn1/mod.rs +++ b/rust/src/asn1/mod.rs @@ -215,9 +215,9 @@ fn asn1_decode<'a>( /// # Safety /// /// input must be a valid buffer of at least input_len bytes -/// pointer must be freed using `rs_asn1_free` +/// pointer must be freed using `SCAsn1Free` #[no_mangle] -pub unsafe extern "C" fn rs_asn1_decode( +pub unsafe extern "C" fn SCAsn1Decode( input: *const u8, input_len: u32, buffer_offset: u32, ad_ptr: *const DetectAsn1Data, ) -> *mut Asn1<'static> { if input.is_null() || input_len == 0 || ad_ptr.is_null() { @@ -240,9 +240,9 @@ pub unsafe extern "C" fn rs_asn1_decode( /// /// # Safety /// -/// ptr must be a valid object obtained using `rs_asn1_decode` +/// ptr must be a valid object obtained using `SCAsn1Decode` #[no_mangle] -pub unsafe extern "C" fn rs_asn1_free(ptr: *mut Asn1) { +pub unsafe extern "C" fn SCAsn1Free(ptr: *mut Asn1) { if ptr.is_null() { return; } @@ -256,12 +256,12 @@ pub unsafe extern "C" fn rs_asn1_free(ptr: *mut Asn1) { /// /// # Safety /// -/// ptr must be a valid object obtained using `rs_asn1_decode` -/// ad_ptr must be a valid object obtained using `rs_detect_asn1_parse` +/// ptr must be a valid object obtained using `SCAsn1Decode` +/// ad_ptr must be a valid object obtained using `SCAsn1DetectParse` /// /// Returns 1 if any of the options match, 0 if not #[no_mangle] -pub unsafe extern "C" fn rs_asn1_checks(ptr: *const Asn1, ad_ptr: *const DetectAsn1Data) -> u8 { +pub unsafe extern "C" fn SCAsn1Checks(ptr: *const Asn1, ad_ptr: *const DetectAsn1Data) -> u8 { if ptr.is_null() || ad_ptr.is_null() { return 0; } diff --git a/rust/src/asn1/parse_rules.rs b/rust/src/asn1/parse_rules.rs index 9a857868db..9bb0b2558e 100644 --- a/rust/src/asn1/parse_rules.rs +++ b/rust/src/asn1/parse_rules.rs @@ -32,9 +32,9 @@ const ASN1_DEFAULT_MAX_FRAMES: u16 = 30; /// /// # Safety /// -/// pointer must be free'd using `rs_detect_asn1_free` +/// pointer must be free'd using `SCAsn1DetectFree` #[no_mangle] -pub unsafe extern "C" fn rs_detect_asn1_parse(input: *const c_char) -> *mut DetectAsn1Data { +pub unsafe extern "C" fn SCAsn1DetectParse(input: *const c_char) -> *mut DetectAsn1Data { if input.is_null() { return std::ptr::null_mut(); } @@ -73,9 +73,9 @@ pub unsafe extern "C" fn rs_detect_asn1_parse(input: *const c_char) -> *mut Dete /// /// # Safety /// -/// ptr must be a valid object obtained using `rs_detect_asn1_parse` +/// ptr must be a valid object obtained using `SCAsn1DetectParse` #[no_mangle] -pub unsafe extern "C" fn rs_detect_asn1_free(ptr: *mut DetectAsn1Data) { +pub unsafe extern "C" fn SCAsn1DetectFree(ptr: *mut DetectAsn1Data) { if ptr.is_null() { return; } diff --git a/src/detect-asn1.c b/src/detect-asn1.c index c70bf8921f..63d40d6219 100644 --- a/src/detect-asn1.c +++ b/src/detect-asn1.c @@ -59,9 +59,9 @@ bool DetectAsn1Match(const SigMatchData *smd, const uint8_t *buffer, const uint3 const uint32_t offset) { const DetectAsn1Data *ad = (const DetectAsn1Data *)smd->ctx; - Asn1 *asn1 = rs_asn1_decode(buffer, buffer_len, offset, ad); - uint8_t ret = rs_asn1_checks(asn1, ad); - rs_asn1_free(asn1); + Asn1 *asn1 = SCAsn1Decode(buffer, buffer_len, offset, ad); + uint8_t ret = SCAsn1Checks(asn1, ad); + SCAsn1Free(asn1); return ret == 1; } @@ -75,7 +75,7 @@ bool DetectAsn1Match(const SigMatchData *smd, const uint8_t *buffer, const uint3 */ static DetectAsn1Data *DetectAsn1Parse(const char *asn1str) { - DetectAsn1Data *ad = rs_detect_asn1_parse(asn1str); + DetectAsn1Data *ad = SCAsn1DetectParse(asn1str); if (ad == NULL) { SCLogError("Malformed asn1 argument: %s", asn1str); @@ -120,7 +120,7 @@ static int DetectAsn1Setup(DetectEngineCtx *de_ctx, Signature *s, const char *as static void DetectAsn1Free(DetectEngineCtx *de_ctx, void *ptr) { DetectAsn1Data *ad = (DetectAsn1Data *)ptr; - rs_detect_asn1_free(ad); + SCAsn1DetectFree(ad); } #ifdef UNITTESTS