diff --git a/rust/src/x509/mod.rs b/rust/src/x509/mod.rs index a38cf85317..4873f392b2 100644 --- a/rust/src/x509/mod.rs +++ b/rust/src/x509/mod.rs @@ -67,7 +67,7 @@ impl fmt::Display for SCGeneralName<'_> { /// /// input must be a valid buffer of at least input_len bytes #[no_mangle] -pub unsafe extern "C" fn rs_x509_decode( +pub unsafe extern "C" fn SCX509Decode( input: *const u8, input_len: u32, err_code: *mut u32, @@ -85,7 +85,7 @@ pub unsafe extern "C" fn rs_x509_decode( } #[no_mangle] -pub unsafe extern "C" fn rs_x509_get_subject(ptr: *const X509) -> *mut c_char { +pub unsafe extern "C" fn SCX509GetSubject(ptr: *const X509) -> *mut c_char { if ptr.is_null() { return std::ptr::null_mut(); } @@ -95,7 +95,7 @@ pub unsafe extern "C" fn rs_x509_get_subject(ptr: *const X509) -> *mut c_char { } #[no_mangle] -pub unsafe extern "C" fn rs_x509_get_subjectaltname_len(ptr: *const X509) -> u16 { +pub unsafe extern "C" fn SCX509GetSubjectAltNameLen(ptr: *const X509) -> u16 { if ptr.is_null() { return 0; } @@ -111,7 +111,7 @@ pub unsafe extern "C" fn rs_x509_get_subjectaltname_len(ptr: *const X509) -> u16 } #[no_mangle] -pub unsafe extern "C" fn rs_x509_get_subjectaltname_at(ptr: *const X509, idx: u16) -> *mut c_char { +pub unsafe extern "C" fn SCX509GetSubjectAltNameAt(ptr: *const X509, idx: u16) -> *mut c_char { if ptr.is_null() { return std::ptr::null_mut(); } @@ -126,7 +126,7 @@ pub unsafe extern "C" fn rs_x509_get_subjectaltname_at(ptr: *const X509, idx: u1 } #[no_mangle] -pub unsafe extern "C" fn rs_x509_get_issuer(ptr: *const X509) -> *mut c_char { +pub unsafe extern "C" fn SCX509GetIssuer(ptr: *const X509) -> *mut c_char { if ptr.is_null() { return std::ptr::null_mut(); } @@ -136,7 +136,7 @@ pub unsafe extern "C" fn rs_x509_get_issuer(ptr: *const X509) -> *mut c_char { } #[no_mangle] -pub unsafe extern "C" fn rs_x509_get_serial(ptr: *const X509) -> *mut c_char { +pub unsafe extern "C" fn SCX509GetSerial(ptr: *const X509) -> *mut c_char { if ptr.is_null() { return std::ptr::null_mut(); } @@ -151,9 +151,9 @@ pub unsafe extern "C" fn rs_x509_get_serial(ptr: *const X509) -> *mut c_char { /// /// # Safety /// -/// ptr must be a valid object obtained using `rs_x509_decode` +/// ptr must be a valid object obtained using `SCX509Decode` #[no_mangle] -pub unsafe extern "C" fn rs_x509_get_validity( +pub unsafe extern "C" fn SCX509GetValidity( ptr: *const X509, not_before: *mut i64, not_after: *mut i64, @@ -173,9 +173,9 @@ pub unsafe extern "C" fn rs_x509_get_validity( /// /// # Safety /// -/// ptr must be a valid object obtained using `rs_x509_decode` +/// ptr must be a valid object obtained using `SCX509Decode` #[no_mangle] -pub unsafe extern "C" fn rs_x509_free(ptr: *mut X509) { +pub unsafe extern "C" fn SCX509Free(ptr: *mut X509) { if ptr.is_null() { return; } diff --git a/src/app-layer-ssl.c b/src/app-layer-ssl.c index 8cdc1c784e..10c9dce7ca 100644 --- a/src/app-layer-ssl.c +++ b/src/app-layer-ssl.c @@ -572,49 +572,49 @@ static int TlsDecodeHSCertificate(SSLState *ssl_state, SSLStateConnp *connp, /* only store fields from the first certificate in the chain */ if (certn == 0 && connp->cert0_subject == NULL && connp->cert0_issuerdn == NULL && connp->cert0_serial == NULL) { - x509 = rs_x509_decode(input, cert_len, &err_code); + x509 = SCX509Decode(input, cert_len, &err_code); if (x509 == NULL) { TlsDecodeHSCertificateErrSetEvent(ssl_state, err_code); goto next; } - char *str = rs_x509_get_subject(x509); + char *str = SCX509GetSubject(x509); if (str == NULL) { err_code = ERR_EXTRACT_SUBJECT; goto error; } connp->cert0_subject = str; - str = rs_x509_get_issuer(x509); + str = SCX509GetIssuer(x509); if (str == NULL) { err_code = ERR_EXTRACT_ISSUER; goto error; } connp->cert0_issuerdn = str; - connp->cert0_sans_len = rs_x509_get_subjectaltname_len(x509); + connp->cert0_sans_len = SCX509GetSubjectAltNameLen(x509); char **sans = SCCalloc(connp->cert0_sans_len, sizeof(char *)); if (sans == NULL) { goto error; } for (uint16_t i = 0; i < connp->cert0_sans_len; i++) { - sans[i] = rs_x509_get_subjectaltname_at(x509, i); + sans[i] = SCX509GetSubjectAltNameAt(x509, i); } connp->cert0_sans = sans; - str = rs_x509_get_serial(x509); + str = SCX509GetSerial(x509); if (str == NULL) { err_code = ERR_INVALID_SERIAL; goto error; } connp->cert0_serial = str; - rc = rs_x509_get_validity(x509, &connp->cert0_not_before, &connp->cert0_not_after); + rc = SCX509GetValidity(x509, &connp->cert0_not_before, &connp->cert0_not_after); if (rc != 0) { err_code = ERR_EXTRACT_VALIDITY; goto error; } - rs_x509_free(x509); + SCX509Free(x509); x509 = NULL; rc = TlsDecodeHSCertificateFingerprint(connp, input, cert_len); @@ -638,7 +638,7 @@ error: if (err_code != 0) TlsDecodeHSCertificateErrSetEvent(ssl_state, err_code); if (x509 != NULL) - rs_x509_free(x509); + SCX509Free(x509); SSLStateCertSANFree(connp); return -1;