add some experiemental support to dvmpatch to support clear to enc one-way patching;

r05a04_dev
Bryan Biedenkapp 1 month ago
parent 23e6823ea0
commit 2e4bb275ab

@ -88,6 +88,9 @@ network:
tekKeyId: 1 tekKeyId: 1
# Flag indicating whether or not the patch is two-way. # Flag indicating whether or not the patch is two-way.
# NOTE: If false (one-way patch from source to destination), and patching clear to
# encrypted traffic, only the destination TEK will be used for encryption. The clear
# traffic must appear on the source side only.
twoWay: false twoWay: false
# Hostname/IP address of MMDVM gateway to connect to. # Hostname/IP address of MMDVM gateway to connect to.

@ -1170,6 +1170,11 @@ void HostPatch::processP25Network(uint8_t* buffer, uint32_t length)
if (tekEnable && tekAlgoId != ALGO_UNENCRYPT && tekKeyId != 0U) { if (tekEnable && tekAlgoId != ALGO_UNENCRYPT && tekKeyId != 0U) {
cryptP25AudioFrame(netLDU, reverseEncrypt, 1U); cryptP25AudioFrame(netLDU, reverseEncrypt, 1U);
} else {
if (!m_twoWayPatch && m_tekDstEnable && m_tekDstAlgoId != ALGO_UNENCRYPT && m_tekDstKeyId != 0U) {
// for one-way patches, if the destination TEK is enabled, use it
cryptP25AudioFrame(netLDU, false, 1U);
}
} }
control = lc::LC(*dfsiLC.control()); control = lc::LC(*dfsiLC.control());
@ -1208,6 +1213,18 @@ void HostPatch::processP25Network(uint8_t* buffer, uint32_t length)
m_p25DstCrypto->getMI(mi); m_p25DstCrypto->getMI(mi);
control.setMI(mi); control.setMI(mi);
} else {
if (!m_twoWayPatch && m_tekDstEnable && m_tekDstAlgoId != ALGO_UNENCRYPT && m_tekDstKeyId != 0U) {
// for one-way patches, if the destination TEK is enabled, use it
control.setAlgId(m_tekDstAlgoId);
control.setKId(m_tekDstKeyId);
uint8_t mi[MI_LENGTH_BYTES];
::memset(mi, 0x00U, MI_LENGTH_BYTES);
m_p25DstCrypto->getMI(mi);
control.setMI(mi);
}
} }
if (m_mmdvmP25Reflector) { if (m_mmdvmP25Reflector) {
@ -1270,6 +1287,11 @@ void HostPatch::processP25Network(uint8_t* buffer, uint32_t length)
if (tekEnable && tekAlgoId != ALGO_UNENCRYPT && tekKeyId != 0U) { if (tekEnable && tekAlgoId != ALGO_UNENCRYPT && tekKeyId != 0U) {
cryptP25AudioFrame(netLDU, reverseEncrypt, 2U); cryptP25AudioFrame(netLDU, reverseEncrypt, 2U);
} else {
if (!m_twoWayPatch && m_tekDstEnable && m_tekDstAlgoId != ALGO_UNENCRYPT && m_tekDstKeyId != 0U) {
// for one-way patches, if the destination TEK is enabled, use it
cryptP25AudioFrame(netLDU, false, 2U);
}
} }
control = lc::LC(*dfsiLC.control()); control = lc::LC(*dfsiLC.control());
@ -1290,6 +1312,18 @@ void HostPatch::processP25Network(uint8_t* buffer, uint32_t length)
m_p25DstCrypto->getMI(mi); m_p25DstCrypto->getMI(mi);
control.setMI(mi); control.setMI(mi);
} else {
if (!m_twoWayPatch && m_tekDstEnable && m_tekDstAlgoId != ALGO_UNENCRYPT && m_tekDstKeyId != 0U) {
// for one-way patches, if the destination TEK is enabled, use it
control.setAlgId(m_tekDstAlgoId);
control.setKId(m_tekDstKeyId);
uint8_t mi[MI_LENGTH_BYTES];
::memset(mi, 0x00U, MI_LENGTH_BYTES);
m_p25DstCrypto->getMI(mi);
control.setMI(mi);
}
} }
if (m_mmdvmP25Reflector) { if (m_mmdvmP25Reflector) {

Loading…
Cancel
Save

Powered by TurnKey Linux.