From 263bab56ff8f2ea3ff8e50b8cff7f472cb0617a5 Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Thu, 29 Sep 2022 12:15:42 -0400 Subject: [PATCH] add TSBK getters/setters for authentication data; --- p25/lc/TSBK.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++++++ p25/lc/TSBK.h | 14 ++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/p25/lc/TSBK.cpp b/p25/lc/TSBK.cpp index a5d84491..da82d050 100644 --- a/p25/lc/TSBK.cpp +++ b/p25/lc/TSBK.cpp @@ -1246,6 +1246,52 @@ void TSBK::setCallsign(std::string callsign) } } +/** Authentication data */ +/// Gets the authentication result. +/// +void TSBK::getAuthRes(uint8_t* res) const +{ + assert(res != NULL); + + ::memcpy(res, m_authRes, P25_AUTH_RES_LENGTH_BYTES); +} + +/// Sets the authentication random seed. +/// +void TSBK::setAuthRS(const uint8_t* rs) +{ + assert(rs != NULL); + + ::memcpy(m_authRS, rs, P25_AUTH_RS_LENGTH_BYTES); +} + +/// Gets the authentication random seed. +/// +void TSBK::getAuthRS(uint8_t* rs) const +{ + assert(rs != NULL); + + ::memcpy(rs, m_authRS, P25_AUTH_RS_LENGTH_BYTES); +} + +/// Sets the authentication random challenge. +/// +void TSBK::setAuthRand(const uint8_t* rand) +{ + assert(rand != NULL); + + ::memcpy(m_authRand, rand, P25_AUTH_RAND_LENGTH_BYTES); +} + +/// Gets the authentication random challenge. +/// +void TSBK::getAuthRand(uint8_t* rand) const +{ + assert(rand != NULL); + + ::memcpy(rand, m_authRand, P25_AUTH_RAND_LENGTH_BYTES); +} + // --------------------------------------------------------------------------- // Private Class Members // --------------------------------------------------------------------------- diff --git a/p25/lc/TSBK.h b/p25/lc/TSBK.h index 02d42142..f5fc5e62 100644 --- a/p25/lc/TSBK.h +++ b/p25/lc/TSBK.h @@ -95,6 +95,20 @@ namespace p25 /// Sets the callsign. void setCallsign(std::string callsign); + /** Authentication data */ + /// Gets the authentication result. + void getAuthRes(uint8_t* res) const; + + /// Sets the authentication random seed. + void setAuthRS(const uint8_t* rs); + /// Gets the authentication random seed. + void getAuthRS(uint8_t* mi) const; + + /// Sets the authentication random challenge. + void setAuthRand(const uint8_t* rand); + /// Gets the authentication random challenge. + void getAuthRand(uint8_t* mrandi) const; + public: /// Flag indicating verbose log output. __PROPERTY(bool, verbose, Verbose);