1 /* Copyright (C) 2020 Open Information Security Foundation
3 * You can copy, redistribute or modify this Program under the terms of
4 * the GNU General Public License version 2 as published by the Free
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * version 2 along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 use super::ssh::SSHTransaction;
19 use crate::core::{STREAM_TOCLIENT, STREAM_TOSERVER};
23 pub unsafe extern "C" fn rs_ssh_tx_get_protocol(
24 tx: *mut std::os::raw::c_void, buffer: *mut *const u8, buffer_len: *mut u32, direction: u8,
26 let tx = cast_pointer!(tx, SSHTransaction);
29 let m = &tx.cli_hdr.protover;
32 *buffer_len = m.len() as u32;
37 let m = &tx.srv_hdr.protover;
40 *buffer_len = m.len() as u32;
46 *buffer = ptr::null();
53 pub unsafe extern "C" fn rs_ssh_tx_get_software(
54 tx: *mut std::os::raw::c_void, buffer: *mut *const u8, buffer_len: *mut u32, direction: u8,
56 let tx = cast_pointer!(tx, SSHTransaction);
59 let m = &tx.cli_hdr.swver;
62 *buffer_len = m.len() as u32;
67 let m = &tx.srv_hdr.swver;
70 *buffer_len = m.len() as u32;
76 *buffer = ptr::null();
83 pub unsafe extern "C" fn rs_ssh_tx_get_hassh(
84 tx: *mut std::os::raw::c_void,
85 buffer: *mut *const u8,
89 let tx = cast_pointer!(tx, SSHTransaction);
92 let m = &tx.cli_hdr.hassh;
95 *buffer_len = m.len() as u32;
100 let m = &tx.srv_hdr.hassh;
102 *buffer = m.as_ptr();
103 *buffer_len = m.len() as u32;
109 *buffer = ptr::null();
116 pub unsafe extern "C" fn rs_ssh_tx_get_hassh_string(
117 tx: *mut std::os::raw::c_void,
118 buffer: *mut *const u8,
119 buffer_len: *mut u32,
122 let tx = cast_pointer!(tx, SSHTransaction);
125 let m = &tx.cli_hdr.hassh_string;
127 *buffer = m.as_ptr();
128 *buffer_len = m.len() as u32;
133 let m = &tx.srv_hdr.hassh_string;
135 *buffer = m.as_ptr();
136 *buffer_len = m.len() as u32;
142 *buffer = ptr::null();