use std::ptr;
#[no_mangle]
-pub unsafe extern "C" fn rs_ssh_tx_get_protocol(
+pub unsafe extern "C" fn SCSshTxGetProtocol(
tx: *mut std::os::raw::c_void, buffer: *mut *const u8, buffer_len: *mut u32, direction: u8,
) -> u8 {
let tx = cast_pointer!(tx, SSHTransaction);
}
#[no_mangle]
-pub unsafe extern "C" fn rs_ssh_tx_get_software(
+pub unsafe extern "C" fn SCSshTxGetSoftware(
tx: *mut std::os::raw::c_void, buffer: *mut *const u8, buffer_len: *mut u32, direction: u8,
) -> u8 {
let tx = cast_pointer!(tx, SSHTransaction);
}
#[no_mangle]
-pub unsafe extern "C" fn rs_ssh_tx_get_hassh(
+pub unsafe extern "C" fn SCSshTxGetHassh(
tx: *mut std::os::raw::c_void,
buffer: *mut *const u8,
buffer_len: *mut u32,
}
#[no_mangle]
-pub unsafe extern "C" fn rs_ssh_tx_get_hassh_string(
+pub unsafe extern "C" fn SCSshTxGetHasshString(
tx: *mut std::os::raw::c_void,
buffer: *mut *const u8,
buffer_len: *mut u32,
}
#[no_mangle]
-pub unsafe extern "C" fn rs_ssh_log_json(tx: *mut std::os::raw::c_void, js: &mut JsonBuilder) -> bool {
+pub unsafe extern "C" fn SCSshLogJson(tx: *mut std::os::raw::c_void, js: &mut JsonBuilder) -> bool {
let tx = cast_pointer!(tx, SSHTransaction);
if let Ok(x) = log_ssh(tx, js) {
return x;
export_tx_data_get!(ssh_get_tx_data, SSHTransaction);
export_state_data_get!(ssh_get_state_data, SSHState);
-#[no_mangle]
-pub extern "C" fn rs_ssh_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void {
+extern "C" fn ssh_state_new(_orig_state: *mut std::os::raw::c_void, _orig_proto: AppProto) -> *mut std::os::raw::c_void {
let state = SSHState::new();
let boxed = Box::new(state);
return Box::into_raw(boxed) as *mut _;
}
-#[no_mangle]
-pub unsafe extern "C" fn rs_ssh_state_free(state: *mut std::os::raw::c_void) {
+unsafe extern "C" fn ssh_state_free(state: *mut std::os::raw::c_void) {
std::mem::drop(Box::from_raw(state as *mut SSHState));
}
-#[no_mangle]
-pub extern "C" fn rs_ssh_state_tx_free(_state: *mut std::os::raw::c_void, _tx_id: u64) {
+extern "C" fn ssh_state_tx_free(_state: *mut std::os::raw::c_void, _tx_id: u64) {
//do nothing
}
-#[no_mangle]
-pub unsafe extern "C" fn rs_ssh_parse_request(
+unsafe extern "C" fn rs_ssh_parse_request(
flow: *const Flow, state: *mut std::os::raw::c_void, pstate: *mut std::os::raw::c_void,
stream_slice: StreamSlice,
_data: *const std::os::raw::c_void
}
}
-#[no_mangle]
-pub unsafe extern "C" fn rs_ssh_parse_response(
+unsafe extern "C" fn ssh_parse_response(
flow: *const Flow, state: *mut std::os::raw::c_void, pstate: *mut std::os::raw::c_void,
stream_slice: StreamSlice,
_data: *const std::os::raw::c_void
}
#[no_mangle]
-pub unsafe extern "C" fn rs_ssh_state_get_tx(
+pub unsafe extern "C" fn SCSshStateGetTx(
state: *mut std::os::raw::c_void, _tx_id: u64,
) -> *mut std::os::raw::c_void {
let state = cast_pointer!(state, SSHState);
return &state.transaction as *const _ as *mut _;
}
-#[no_mangle]
-pub extern "C" fn rs_ssh_state_get_tx_count(_state: *mut std::os::raw::c_void) -> u64 {
+extern "C" fn ssh_state_get_tx_count(_state: *mut std::os::raw::c_void) -> u64 {
return 1;
}
#[no_mangle]
-pub unsafe extern "C" fn rs_ssh_tx_get_flags(
+pub unsafe extern "C" fn SCSshTxGetFlags(
tx: *mut std::os::raw::c_void, direction: u8,
) -> SSHConnectionState {
let tx = cast_pointer!(tx, SSHTransaction);
}
#[no_mangle]
-pub unsafe extern "C" fn rs_ssh_tx_get_alstate_progress(
+pub unsafe extern "C" fn SCSshTxGetAlStateProgress(
tx: *mut std::os::raw::c_void, direction: u8,
) -> std::os::raw::c_int {
let tx = cast_pointer!(tx, SSHTransaction);
const PARSER_NAME: &[u8] = b"ssh\0";
#[no_mangle]
-pub unsafe extern "C" fn rs_ssh_register_parser() {
+pub unsafe extern "C" fn SCRegisterSshParser() {
let parser = RustParser {
name: PARSER_NAME.as_ptr() as *const std::os::raw::c_char,
default_port: std::ptr::null(),
probe_tc: None,
min_depth: 0,
max_depth: 0,
- state_new: rs_ssh_state_new,
- state_free: rs_ssh_state_free,
- tx_free: rs_ssh_state_tx_free,
+ state_new: ssh_state_new,
+ state_free: ssh_state_free,
+ tx_free: ssh_state_tx_free,
parse_ts: rs_ssh_parse_request,
- parse_tc: rs_ssh_parse_response,
- get_tx_count: rs_ssh_state_get_tx_count,
- get_tx: rs_ssh_state_get_tx,
+ parse_tc: ssh_parse_response,
+ get_tx_count: ssh_state_get_tx_count,
+ get_tx: SCSshStateGetTx,
tx_comp_st_ts: SSHConnectionState::SshStateFinished as i32,
tx_comp_st_tc: SSHConnectionState::SshStateFinished as i32,
- tx_get_progress: rs_ssh_tx_get_alstate_progress,
+ tx_get_progress: SCSshTxGetAlStateProgress,
get_eventinfo: Some(SSHEvent::get_event_info),
get_eventinfo_byid: Some(SSHEvent::get_event_info_by_id),
localstorage_new: None,
}
#[no_mangle]
-pub extern "C" fn rs_ssh_enable_hassh() {
+pub extern "C" fn SCSshEnableHassh() {
HASSH_ENABLED.store(true, Ordering::Relaxed)
}
#[no_mangle]
-pub extern "C" fn rs_ssh_hassh_is_enabled() -> bool {
+pub extern "C" fn SCSshHasshIsEnabled() -> bool {
hassh_is_enabled()
}
#[no_mangle]
-pub unsafe extern "C" fn rs_ssh_tx_get_log_condition( tx: *mut std::os::raw::c_void) -> bool {
+pub unsafe extern "C" fn SCSshTxGetLogCondition( tx: *mut std::os::raw::c_void) -> bool {
let tx = cast_pointer!(tx, SSHTransaction);
- if rs_ssh_hassh_is_enabled() {
+ if SCSshHasshIsEnabled() {
if tx.cli_hdr.flags == SSHConnectionState::SshStateFinished &&
tx.srv_hdr.flags == SSHConnectionState::SshStateFinished {
return true;
bool SSHTxLogCondition(ThreadVars *tv, const Packet *p, void *state, void *tx, uint64_t tx_id)
{
- return rs_ssh_tx_get_log_condition(tx);
+ return SCSshTxGetLogCondition(tx);
}
/** \brief Function to register the SSH protocol parsers and other functions
}
if (RunmodeIsUnittests() || enable_hassh) {
- rs_ssh_enable_hassh();
+ SCSshEnableHassh();
}
}
SCLogDebug("Registering Rust SSH parser.");
- rs_ssh_register_parser();
-
+ SCRegisterSshParser();
#ifdef UNITTESTS
AppLayerParserRegisterProtocolUnittests(IPPROTO_TCP, ALPROTO_SSH, SSHParserRegisterTests);
const uint8_t *software = NULL;
uint32_t s_len = 0;
- if (rs_ssh_tx_get_protocol(tx, &protocol, &p_len, flags) != 1) {
+ if (SCSshTxGetProtocol(tx, &protocol, &p_len, flags) != 1) {
printf("Version string not parsed correctly return: ");
return 1;
}
}
if (softexp != NULL) {
- if (rs_ssh_tx_get_software(tx, &software, &s_len, flags) != 1)
+ if (SCSshTxGetSoftware(tx, &software, &s_len, flags) != 1)
return 1;
if (software == NULL)
return 1;
goto end;
}
- void * tx = rs_ssh_state_get_tx(ssh_state, 0);
- if ( rs_ssh_tx_get_alstate_progress(tx, STREAM_TOSERVER) != SshStateBannerDone ) {
+ void *tx = SCSshStateGetTx(ssh_state, 0);
+ if (SCSshTxGetAlStateProgress(tx, STREAM_TOSERVER) != SshStateBannerDone) {
printf("Client version string not parsed: ");
goto end;
}
printf("no ssh state: ");
goto end;
}
- void * tx = rs_ssh_state_get_tx(ssh_state, 0);
+ void *tx = SCSshStateGetTx(ssh_state, 0);
- if ( rs_ssh_tx_get_alstate_progress(tx, STREAM_TOSERVER) != SshStateBannerDone ) {
+ if (SCSshTxGetAlStateProgress(tx, STREAM_TOSERVER) != SshStateBannerDone) {
printf("Client version string not parsed: ");
goto end;
}
printf("no ssh state: ");
goto end;
}
- void * tx = rs_ssh_state_get_tx(ssh_state, 0);
+ void *tx = SCSshStateGetTx(ssh_state, 0);
- if ( rs_ssh_tx_get_alstate_progress(tx, STREAM_TOSERVER) == SshStateBannerDone ) {
+ if (SCSshTxGetAlStateProgress(tx, STREAM_TOSERVER) == SshStateBannerDone) {
printf("Client version string parsed? It's not a valid string: ");
goto end;
}
const uint8_t *dummy = NULL;
uint32_t dummy_len = 0;
- if (rs_ssh_tx_get_protocol(tx, &dummy, &dummy_len, STREAM_TOSERVER) != 0)
+ if (SCSshTxGetProtocol(tx, &dummy, &dummy_len, STREAM_TOSERVER) != 0)
goto end;
- if (rs_ssh_tx_get_software(tx, &dummy, &dummy_len, STREAM_TOSERVER) != 0)
+ if (SCSshTxGetSoftware(tx, &dummy, &dummy_len, STREAM_TOSERVER) != 0)
goto end;
result = 1;
printf("no ssh state: ");
goto end;
}
- void * tx = rs_ssh_state_get_tx(ssh_state, 0);
+ void *tx = SCSshStateGetTx(ssh_state, 0);
- if ( rs_ssh_tx_get_alstate_progress(tx, STREAM_TOCLIENT) != SshStateBannerDone ) {
+ if (SCSshTxGetAlStateProgress(tx, STREAM_TOCLIENT) != SshStateBannerDone) {
printf("Client version string not parsed: ");
goto end;
}
printf("no ssh state: ");
goto end;
}
- void * tx = rs_ssh_state_get_tx(ssh_state, 0);
+ void *tx = SCSshStateGetTx(ssh_state, 0);
- if ( rs_ssh_tx_get_alstate_progress(tx, STREAM_TOCLIENT) != SshStateBannerDone ) {
+ if (SCSshTxGetAlStateProgress(tx, STREAM_TOCLIENT) != SshStateBannerDone) {
printf("Client version string not parsed: ");
goto end;
}
printf("no ssh state: ");
goto end;
}
- void * tx = rs_ssh_state_get_tx(ssh_state, 0);
+ void *tx = SCSshStateGetTx(ssh_state, 0);
- if ( rs_ssh_tx_get_alstate_progress(tx, STREAM_TOCLIENT) == SshStateBannerDone ) {
+ if (SCSshTxGetAlStateProgress(tx, STREAM_TOCLIENT) == SshStateBannerDone) {
printf("Client version string parsed? It's not a valid string: ");
goto end;
}
const uint8_t *dummy = NULL;
uint32_t dummy_len = 0;
- if (rs_ssh_tx_get_protocol(tx, &dummy, &dummy_len, STREAM_TOCLIENT) != 0)
+ if (SCSshTxGetProtocol(tx, &dummy, &dummy_len, STREAM_TOCLIENT) != 0)
goto end;
- if (rs_ssh_tx_get_software(tx, &dummy, &dummy_len, STREAM_TOCLIENT) != 0)
+ if (SCSshTxGetSoftware(tx, &dummy, &dummy_len, STREAM_TOCLIENT) != 0)
goto end;
void *ssh_state = f->alstate;
FAIL_IF_NULL(ssh_state);
- void * tx = rs_ssh_state_get_tx(ssh_state, 0);
- FAIL_IF( rs_ssh_tx_get_alstate_progress(tx, STREAM_TOSERVER) != SshStateBannerDone );
+ void *tx = SCSshStateGetTx(ssh_state, 0);
+ FAIL_IF(SCSshTxGetAlStateProgress(tx, STREAM_TOSERVER) != SshStateBannerDone);
FAIL_IF(SSHParserTestUtilCheck("2.0", "MySSHClient-0.5.1", tx, STREAM_TOSERVER));
void *ssh_state = f->alstate;
FAIL_IF_NULL(ssh_state);
- void * tx = rs_ssh_state_get_tx(ssh_state, 0);
- FAIL_IF( rs_ssh_tx_get_alstate_progress(tx, STREAM_TOSERVER) != SshStateBannerDone );
+ void *tx = SCSshStateGetTx(ssh_state, 0);
+ FAIL_IF(SCSshTxGetAlStateProgress(tx, STREAM_TOSERVER) != SshStateBannerDone);
FAIL_IF(SSHParserTestUtilCheck("2.0", "MySSHClient-0.5.1", tx, STREAM_TOSERVER));
void *ssh_state = f->alstate;
FAIL_IF_NULL(ssh_state);
- void * tx = rs_ssh_state_get_tx(ssh_state, 0);
- FAIL_IF( rs_ssh_tx_get_alstate_progress(tx, STREAM_TOCLIENT) != SshStateBannerDone );
+ void *tx = SCSshStateGetTx(ssh_state, 0);
+ FAIL_IF(SCSshTxGetAlStateProgress(tx, STREAM_TOCLIENT) != SshStateBannerDone);
FAIL_IF(SSHParserTestUtilCheck("2.0", "MySSHClient-0.5.1", tx, STREAM_TOCLIENT));
void *ssh_state = f->alstate;
FAIL_IF_NULL(ssh_state);
- void * tx = rs_ssh_state_get_tx(ssh_state, 0);
- FAIL_IF( rs_ssh_tx_get_alstate_progress(tx, STREAM_TOCLIENT) != SshStateBannerDone );
+ void *tx = SCSshStateGetTx(ssh_state, 0);
+ FAIL_IF(SCSshTxGetAlStateProgress(tx, STREAM_TOCLIENT) != SshStateBannerDone);
FAIL_IF(SSHParserTestUtilCheck("2.0", "MySSHClient-0.5.1", tx, STREAM_TOCLIENT));
printf("no ssh state: ");
goto end;
}
- void * tx = rs_ssh_state_get_tx(ssh_state, 0);
- if ( rs_ssh_tx_get_flags(tx, STREAM_TOSERVER) != SshStateFinished ) {
+ void *tx = SCSshStateGetTx(ssh_state, 0);
+ if (SCSshTxGetFlags(tx, STREAM_TOSERVER) != SshStateFinished) {
printf("Didn't detect the msg code of new keys (ciphered data starts): ");
goto end;
}
printf("no ssh state: ");
goto end;
}
- void * tx = rs_ssh_state_get_tx(ssh_state, 0);
- if ( rs_ssh_tx_get_flags(tx, STREAM_TOSERVER) != SshStateFinished ) {
+ void *tx = SCSshStateGetTx(ssh_state, 0);
+ if (SCSshTxGetFlags(tx, STREAM_TOSERVER) != SshStateFinished) {
printf("Didn't detect the msg code of new keys (ciphered data starts): ");
goto end;
}
void *ssh_state = f->alstate;
FAIL_IF_NULL(ssh_state);
- void * tx = rs_ssh_state_get_tx(ssh_state, 0);
- FAIL_IF( rs_ssh_tx_get_flags(tx, STREAM_TOSERVER) != SshStateFinished );
+ void *tx = SCSshStateGetTx(ssh_state, 0);
+ FAIL_IF(SCSshTxGetFlags(tx, STREAM_TOSERVER) != SshStateFinished);
FAIL_IF(SSHParserTestUtilCheck("2.0", "MySSHClient-0.5.1", tx, STREAM_TOSERVER));
void *ssh_state = f->alstate;
FAIL_IF_NULL(ssh_state);
- void * tx = rs_ssh_state_get_tx(ssh_state, 0);
- FAIL_IF( rs_ssh_tx_get_flags(tx, STREAM_TOSERVER) != SshStateFinished );
+ void *tx = SCSshStateGetTx(ssh_state, 0);
+ FAIL_IF(SCSshTxGetFlags(tx, STREAM_TOSERVER) != SshStateFinished);
FAIL_IF(SSHParserTestUtilCheck("2.0", "MySSHClient-0.5.1", tx, STREAM_TOSERVER));
void *ssh_state = f->alstate;
FAIL_IF_NULL(ssh_state);
- void * tx = rs_ssh_state_get_tx(ssh_state, 0);
- FAIL_IF( rs_ssh_tx_get_flags(tx, STREAM_TOSERVER) != SshStateFinished );
+ void *tx = SCSshStateGetTx(ssh_state, 0);
+ FAIL_IF(SCSshTxGetFlags(tx, STREAM_TOSERVER) != SshStateFinished);
FAIL_IF(SSHParserTestUtilCheck("2.0", "MySSHClient-0.5.1", tx, STREAM_TOSERVER));
void *ssh_state = f->alstate;
FAIL_IF_NULL(ssh_state);
- void * tx = rs_ssh_state_get_tx(ssh_state, 0);
- FAIL_IF( rs_ssh_tx_get_flags(tx, STREAM_TOCLIENT) != SshStateFinished );
+ void *tx = SCSshStateGetTx(ssh_state, 0);
+ FAIL_IF(SCSshTxGetFlags(tx, STREAM_TOCLIENT) != SshStateFinished);
FAIL_IF(SSHParserTestUtilCheck("2.0", "MySSHClient-0.5.1", tx, STREAM_TOCLIENT));
void *ssh_state = f->alstate;
FAIL_IF_NULL(ssh_state);
- void * tx = rs_ssh_state_get_tx(ssh_state, 0);
- FAIL_IF( rs_ssh_tx_get_flags(tx, STREAM_TOCLIENT) != SshStateFinished );
+ void *tx = SCSshStateGetTx(ssh_state, 0);
+ FAIL_IF(SCSshTxGetFlags(tx, STREAM_TOCLIENT) != SshStateFinished);
FAIL_IF(SSHParserTestUtilCheck("2.0", "MySSHClient-0.5.1", tx, STREAM_TOCLIENT));
void *ssh_state = f->alstate;
FAIL_IF_NULL(ssh_state);
- void * tx = rs_ssh_state_get_tx(ssh_state, 0);
- FAIL_IF( rs_ssh_tx_get_flags(tx, STREAM_TOCLIENT) != SshStateFinished );
+ void *tx = SCSshStateGetTx(ssh_state, 0);
+ FAIL_IF(SCSshTxGetFlags(tx, STREAM_TOCLIENT) != SshStateFinished);
FAIL_IF(!(AppLayerParserStateIssetFlag(f->alparser, APP_LAYER_PARSER_NO_INSPECTION)));
void *ssh_state = f->alstate;
FAIL_IF_NULL(ssh_state);
- void * tx = rs_ssh_state_get_tx(ssh_state, 0);
- FAIL_IF( rs_ssh_tx_get_flags(tx, STREAM_TOCLIENT) != SshStateFinished );
+ void *tx = SCSshStateGetTx(ssh_state, 0);
+ FAIL_IF(SCSshTxGetFlags(tx, STREAM_TOCLIENT) != SshStateFinished);
sshbuf3[sizeof(sshbuf3) - 2] = 0;
FAIL_IF(SSHParserTestUtilCheck("2.0", (char *)sshbuf3, tx, STREAM_TOCLIENT));
void *ssh_state = f->alstate;
FAIL_IF_NULL(ssh_state);
- void * tx = rs_ssh_state_get_tx(ssh_state, 0);
- FAIL_IF( rs_ssh_tx_get_flags(tx, STREAM_TOCLIENT) != SshStateFinished );
+ void *tx = SCSshStateGetTx(ssh_state, 0);
+ FAIL_IF(SCSshTxGetFlags(tx, STREAM_TOCLIENT) != SshStateFinished);
FAIL_IF(SSHParserTestUtilCheck("2.0", NULL, tx, STREAM_TOCLIENT));
void *ssh_state = f->alstate;
FAIL_IF_NULL(ssh_state);
- void * tx = rs_ssh_state_get_tx(ssh_state, 0);
- FAIL_IF( rs_ssh_tx_get_flags(tx, STREAM_TOCLIENT) != SshStateFinished );
+ void *tx = SCSshStateGetTx(ssh_state, 0);
+ FAIL_IF(SCSshTxGetFlags(tx, STREAM_TOCLIENT) != SshStateFinished);
FAIL_IF(SSHParserTestUtilCheck("2.0", NULL, tx, STREAM_TOCLIENT));
void *ssh_state = f->alstate;
FAIL_IF_NULL(ssh_state);
- void * tx = rs_ssh_state_get_tx(ssh_state, 0);
- FAIL_IF( rs_ssh_tx_get_flags(tx, STREAM_TOCLIENT) != SshStateFinished );
+ void *tx = SCSshStateGetTx(ssh_state, 0);
+ FAIL_IF(SCSshTxGetFlags(tx, STREAM_TOCLIENT) != SshStateFinished);
FAIL_IF(SSHParserTestUtilCheck("2.0", "libssh", tx, STREAM_TOCLIENT));
printf("no ssh state: ");
goto end;
}
- void * tx = rs_ssh_state_get_tx(ssh_state, 0);
- if ( rs_ssh_tx_get_flags(tx, STREAM_TOSERVER) != SshStateBannerDone ) {
+ void *tx = SCSshStateGetTx(ssh_state, 0);
+ if (SCSshTxGetFlags(tx, STREAM_TOSERVER) != SshStateBannerDone) {
printf("Didn't detect the msg code of new keys (ciphered data starts): ");
goto end;
}
void *ssh_state = f.alstate;
FAIL_IF_NULL(ssh_state);
- void * tx = rs_ssh_state_get_tx(ssh_state, 0);
- FAIL_IF( rs_ssh_tx_get_flags(tx, STREAM_TOSERVER) == SshStateBannerDone );
+ void *tx = SCSshStateGetTx(ssh_state, 0);
+ FAIL_IF(SCSshTxGetFlags(tx, STREAM_TOSERVER) == SshStateBannerDone);
const uint8_t *dummy = NULL;
uint32_t dummy_len = 0;
- FAIL_IF (rs_ssh_tx_get_software(tx, &dummy, &dummy_len, STREAM_TOCLIENT) != 0);
+ FAIL_IF(SCSshTxGetSoftware(tx, &dummy, &dummy_len, STREAM_TOCLIENT) != 0);
AppLayerParserThreadCtxFree(alp_tctx);
StreamTcpFreeConfig(true);
const uint8_t *hassh = NULL;
uint32_t b_len = 0;
- if (rs_ssh_tx_get_hassh_string(txv, &hassh, &b_len, flow_flags) != 1)
+ if (SCSshTxGetHasshString(txv, &hassh, &b_len, flow_flags) != 1)
return NULL;
if (hassh == NULL || b_len == 0) {
SCLogDebug("SSH hassh string is not set");
return -1;
/* try to enable Hassh */
- rs_ssh_enable_hassh();
+ SCSshEnableHassh();
/* Check if Hassh is disabled */
- if (!RunmodeIsUnittests() && !rs_ssh_hassh_is_enabled()) {
+ if (!RunmodeIsUnittests() && !SCSshHasshIsEnabled()) {
if (!SigMatchSilentErrorEnabled(de_ctx, DETECT_SSH_HASSH_SERVER_STRING)) {
SCLogError("hassh support is not enabled");
}
const uint8_t *hasshServer = NULL;
uint32_t b_len = 0;
- if (rs_ssh_tx_get_hassh(txv, &hasshServer, &b_len, flow_flags) != 1)
+ if (SCSshTxGetHassh(txv, &hasshServer, &b_len, flow_flags) != 1)
return NULL;
if (hasshServer == NULL || b_len == 0) {
SCLogDebug("SSH hassh not set");
return -1;
/* try to enable Hassh */
- rs_ssh_enable_hassh();
+ SCSshEnableHassh();
/* Check if Hassh is disabled */
- if (!RunmodeIsUnittests() && !rs_ssh_hassh_is_enabled()) {
+ if (!RunmodeIsUnittests() && !SCSshHasshIsEnabled()) {
if (!SigMatchSilentErrorEnabled(de_ctx, DETECT_SSH_HASSH_SERVER)) {
SCLogError("hassh support is not enabled");
}
const uint8_t *hassh = NULL;
uint32_t b_len = 0;
- if (rs_ssh_tx_get_hassh_string(txv, &hassh, &b_len, flow_flags) != 1)
+ if (SCSshTxGetHasshString(txv, &hassh, &b_len, flow_flags) != 1)
return NULL;
if (hassh == NULL || b_len == 0) {
SCLogDebug("SSH hassh string is not set");
return -1;
/* try to enable Hassh */
- rs_ssh_enable_hassh();
+ SCSshEnableHassh();
/* Check if Hassh is disabled */
- if (!RunmodeIsUnittests() && !rs_ssh_hassh_is_enabled()) {
+ if (!RunmodeIsUnittests() && !SCSshHasshIsEnabled()) {
if (!SigMatchSilentErrorEnabled(de_ctx, DETECT_SSH_HASSH_STRING)) {
SCLogError("hassh support is not enabled");
}
const uint8_t *hassh = NULL;
uint32_t b_len = 0;
- if (rs_ssh_tx_get_hassh(txv, &hassh, &b_len, flow_flags) != 1)
+ if (SCSshTxGetHassh(txv, &hassh, &b_len, flow_flags) != 1)
return NULL;
if (hassh == NULL || b_len == 0) {
SCLogDebug("SSH hassh not set");
return -1;
/* try to enable Hassh */
- rs_ssh_enable_hassh();
+ SCSshEnableHassh();
/* Check if Hassh is disabled */
- if (!RunmodeIsUnittests() && !rs_ssh_hassh_is_enabled()) {
+ if (!RunmodeIsUnittests() && !SCSshHasshIsEnabled()) {
if (!SigMatchSilentErrorEnabled(de_ctx, DETECT_SSH_HASSH)) {
SCLogError("hassh support is not enabled");
}
const uint8_t *protocol = NULL;
uint32_t b_len = 0;
- if (rs_ssh_tx_get_protocol(txv, &protocol, &b_len, flow_flags) != 1)
+ if (SCSshTxGetProtocol(txv, &protocol, &b_len, flow_flags) != 1)
return NULL;
if (protocol == NULL || b_len == 0) {
SCLogDebug("SSH protocol not set");
const uint8_t *software = NULL;
uint32_t b_len = 0;
- if (rs_ssh_tx_get_software(txv, &software, &b_len, flow_flags) != 1)
+ if (SCSshTxGetSoftware(txv, &software, &b_len, flow_flags) != 1)
return NULL;
if (software == NULL || b_len == 0) {
SCLogDebug("SSH software version not set");
// ALPROTO_SMTP special: uses state
RegisterSimpleJsonApplayerLogger(ALPROTO_TLS, JsonTlsLogJSONExtended, NULL);
// no cast here but done in rust for SSHTransaction
- RegisterSimpleJsonApplayerLogger(ALPROTO_SSH, rs_ssh_log_json, NULL);
+ RegisterSimpleJsonApplayerLogger(ALPROTO_SSH, SCSshLogJson, NULL);
// ALPROTO_SMB special: uses state
// ALPROTO_DCERPC special: uses state
RegisterSimpleJsonApplayerLogger(ALPROTO_DNS, AlertJsonDns, NULL);
const uint8_t *hassh_server_string = NULL;
uint32_t b_len = 0;
- void *tx = rs_ssh_state_get_tx(state, 0);
- if (rs_ssh_tx_get_hassh_string(tx, &hassh_server_string, &b_len, STREAM_TOCLIENT) != 1)
+ void *tx = SCSshStateGetTx(state, 0);
+ if (SCSshTxGetHasshString(tx, &hassh_server_string, &b_len, STREAM_TOCLIENT) != 1)
return LuaCallbackError(luastate, "error: no server hassh string");
if (hassh_server_string == NULL || b_len == 0) {
return LuaCallbackError(luastate, "error: no server hassh string");
const uint8_t *hassh_server = NULL;
uint32_t b_len = 0;
- void *tx = rs_ssh_state_get_tx(state, 0);
- if (rs_ssh_tx_get_hassh(tx, &hassh_server, &b_len, STREAM_TOCLIENT) != 1)
+ void *tx = SCSshStateGetTx(state, 0);
+ if (SCSshTxGetHassh(tx, &hassh_server, &b_len, STREAM_TOCLIENT) != 1)
return LuaCallbackError(luastate, "error: no server hassh");
if (hassh_server == NULL || b_len == 0) {
return LuaCallbackError(luastate, "error: no server hassh");
const uint8_t *hassh_string = NULL;
uint32_t b_len = 0;
- void *tx = rs_ssh_state_get_tx(state, 0);
- if (rs_ssh_tx_get_hassh_string(tx, &hassh_string, &b_len, STREAM_TOSERVER) != 1)
+ void *tx = SCSshStateGetTx(state, 0);
+ if (SCSshTxGetHasshString(tx, &hassh_string, &b_len, STREAM_TOSERVER) != 1)
return LuaCallbackError(luastate, "error: no client hassh_string");
if (hassh_string == NULL || b_len == 0) {
return LuaCallbackError(luastate, "error: no client hassh_string");
const uint8_t *hassh = NULL;
uint32_t b_len = 0;
- void *tx = rs_ssh_state_get_tx(state, 0);
- if (rs_ssh_tx_get_hassh(tx, &hassh, &b_len, STREAM_TOSERVER) != 1)
+ void *tx = SCSshStateGetTx(state, 0);
+ if (SCSshTxGetHassh(tx, &hassh, &b_len, STREAM_TOSERVER) != 1)
return LuaCallbackError(luastate, "error: no client hassh");
if (hassh == NULL || b_len == 0) {
return LuaCallbackError(luastate, "error: no client hassh");
const uint8_t *protocol = NULL;
uint32_t b_len = 0;
- void *tx = rs_ssh_state_get_tx(state, 0);
- if (rs_ssh_tx_get_protocol(tx, &protocol, &b_len, STREAM_TOCLIENT) != 1)
+ void *tx = SCSshStateGetTx(state, 0);
+ if (SCSshTxGetProtocol(tx, &protocol, &b_len, STREAM_TOCLIENT) != 1)
return LuaCallbackError(luastate, "error: no server proto version");
if (protocol == NULL || b_len == 0) {
return LuaCallbackError(luastate, "error: no server proto version");
const uint8_t *software = NULL;
uint32_t b_len = 0;
- void *tx = rs_ssh_state_get_tx(state, 0);
- if (rs_ssh_tx_get_software(tx, &software, &b_len, STREAM_TOCLIENT) != 1)
+ void *tx = SCSshStateGetTx(state, 0);
+ if (SCSshTxGetSoftware(tx, &software, &b_len, STREAM_TOCLIENT) != 1)
return LuaCallbackError(luastate, "error: no server software version");
if (software == NULL || b_len == 0) {
return LuaCallbackError(luastate, "error: no server software version");
const uint8_t *protocol = NULL;
uint32_t b_len = 0;
- void *tx = rs_ssh_state_get_tx(state, 0);
- if (rs_ssh_tx_get_protocol(tx, &protocol, &b_len, STREAM_TOSERVER) != 1)
+ void *tx = SCSshStateGetTx(state, 0);
+ if (SCSshTxGetProtocol(tx, &protocol, &b_len, STREAM_TOSERVER) != 1)
return LuaCallbackError(luastate, "error: no client proto version");
if (protocol == NULL || b_len == 0) {
return LuaCallbackError(luastate, "error: no client proto version");
const uint8_t *software = NULL;
uint32_t b_len = 0;
- void *tx = rs_ssh_state_get_tx(state, 0);
- if (rs_ssh_tx_get_software(tx, &software, &b_len, STREAM_TOSERVER) != 1)
+ void *tx = SCSshStateGetTx(state, 0);
+ if (SCSshTxGetSoftware(tx, &software, &b_len, STREAM_TOSERVER) != 1)
return LuaCallbackError(luastate, "error: no client software version");
if (software == NULL || b_len == 0) {
return LuaCallbackError(luastate, "error: no client software version");