Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 3 additions & 60 deletions src/deviceutils/device_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,64 +40,6 @@

#define MAC_ADDRESS_LEN 17

/* function isSecureDbgSrvUnlocked - determines whether secure debug services may be enabled for the given build type.
* Usage: bool isSecureDbgSrvUnlocked(BUILDTYPE eBuildType)
*
* For non-prod builds, debug services are always unlocked.
*
* For ePROD builds, debug services are unlocked only when all of the following are true:
* - debug services are enabled via isDebugServicesEnabled() (RFC-controlled),
* - the LABSIGNED_ENABLED device property indicates a labsigned image, and
* - the deviceType value from RFC allows test devices (for example "test").
*
* RETURN - true if secure debug services are allowed to run for the given build type; false otherwise.
*/
bool isSecureDbgSrvUnlocked(BUILDTYPE eBuildType)
{
char deviceType[16] = {0};
bool isDebugServicesUnlocked = false;
char labsigned[8] = {0};
int ret = -1;

if ((eBuildType != ePROD) && (eBuildType != eUNKNOWN)) {
isDebugServicesUnlocked = true;
}

else if (eBuildType == ePROD)
{
bool dbgServices = isDebugServicesEnabled();
getDeviceTypeRFC(deviceType, sizeof(deviceType));
ret = getDevicePropertyData("LABSIGNED_ENABLED", labsigned, sizeof(labsigned));
if (ret == UTILS_SUCCESS)
{
if (0 == strncmp(labsigned, "true", 4))
{
if ((strcmp(deviceType, "test") == 0) && dbgServices)
{
isDebugServicesUnlocked = true;
}
else
{
SWLOG_INFO("isSecureDbgSrvUnlocked: unable to enable debug services...\n");
}
}
else
{
SWLOG_INFO("LABSIGNED_ENABLED not enabled (value: %s); debug services remain locked\n", labsigned);
}
}
else
{
SWLOG_ERROR("%s: getDevicePropertyData() for LABSIGNED_ENABLED failed\n", __FUNCTION__);
}
SWLOG_INFO("isSecureDbgSrvUnlocked: dbgServices=%s, deviceType=%s, LABSIGNED_ENABLED=%s\n", dbgServices ? "true" : "false", deviceType, labsigned);
}
if(isDebugServicesUnlocked){
SWLOG_INFO("isSecureDbgSrvUnlocked: Enabling debug services...\n");
t2ValNotify("SYST_INFO_FW_DbgSrv", "true");
}
return isDebugServicesUnlocked;
}

/* function GetServerUrlFile - scans a file for a URL.
Usage: size_t GetServerUrlFile <char *pServUrl> <size_t szBufSize> <char *pFileName>
Expand Down Expand Up @@ -946,14 +888,15 @@ size_t GetServURL( char *pServURL, size_t szBufSize )
BUILDTYPE eBuildType;
char buf[URL_MAX_LEN];
bool skip = false;
bool dbgServices = isDebugServicesEnabled(); //check debug services enabled

Comment thread
KTirumalaSrihari marked this conversation as resolved.
if( pServURL != NULL )
{
*pServURL = 0;
GetBuildType( buf, sizeof(buf), &eBuildType );
if( isInStateRed() )
{
if(isSecureDbgSrvUnlocked(eBuildType))
if(( eBuildType != ePROD ) || ( dbgServices == true ))
{
len = GetServerUrlFile( pServURL, szBufSize, STATE_RED_CONF );
}
Comment thread
KTirumalaSrihari marked this conversation as resolved.
Expand All @@ -976,7 +919,7 @@ size_t GetServURL( char *pServURL, size_t szBufSize )
}
else
{
if(isSecureDbgSrvUnlocked(eBuildType))
if(( eBuildType != ePROD ) || ( dbgServices == true ))
{
if( (filePresentCheck( SWUPDATE_CONF ) == RDK_API_SUCCESS) ) // if the file exists
{
Comment thread
KTirumalaSrihari marked this conversation as resolved.
Expand Down
22 changes: 0 additions & 22 deletions src/deviceutils/device_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@
#include "iarmInterface.h"
#endif

#ifdef GTEST_ENABLE
#include "rdkv_cdl_log_wrapper.h"
#endif

#ifndef GTEST_ENABLE
#include "rdk_fwdl_utils.h"
#include "common_device_api.h"
Expand Down Expand Up @@ -309,22 +305,4 @@ size_t GetTR181Url(TR181URL eURL, char *pUrlOut, size_t szBufSize);
*/
size_t GetServURL(char *pServURL, size_t szBufSize);

/* function isSecureDbgSrvUnlocked - determines whether the secure debug service may be unlocked.
*
* The decision is based on:
* - DbgServices RFC
* - DeviceType RFC
* - build type (Prod vs non-Prod; e.g. ePROD vs known non-ePROD types; eUNKNOWN is
* treated as locked/Prod-like)
* - LABSIGNED_ENABLED property value from /etc/device.properties
*
* Usage: bool isSecureDbgSrvUnlocked(BUILDTYPE eBuildType)
*
* RETURN - true if:
* - the build type is non-Prod (i.e. not ePROD and not eUNKNOWN); or
* - the build type is Prod, DbgServices RFC is enabled,
* DeviceType is "test", and LABSIGNED_ENABLED is set to true;
* false otherwise (including when the build type is eUNKNOWN).
*/
bool isSecureDbgSrvUnlocked(BUILDTYPE eBuildType);
#endif
2 changes: 0 additions & 2 deletions src/include/rfcinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ typedef struct rfcdetails {
#define RFC_FW_AUTO_EXCLUDE "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.FWUpdate.AutoExcluded.Enable"
#define RFC_DEBUGSRV "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Identity.DbgServices.Enable"
#define RFC_RED_RECV "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.RedRecovery.Status"
#define RFC_DEVICETYPE "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Identity.DeviceType"

#define RFC_XCONF_CHECK_NOW "Device.X_COMCAST-COM_Xcalibur.Client.xconfCheckNow"

Expand All @@ -103,6 +102,5 @@ int isIncremetalCDLEnable(const char *file_name);
bool isMmgbleNotifyEnabled(void);
bool isDebugServicesEnabled(void);
bool isDirectCDNEnabled(void);
void getDeviceTypeRFC(char *deviceType, size_t size);

#endif /* VIDEO_RFCINTERFACE_RFCINTERFACE_H_ */
33 changes: 0 additions & 33 deletions src/rfcInterface/rfcinterface.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "rdk_fwdl_utils.h"
#include "system_utils.h"
#endif
#include <strings.h>

/*
* Description: Get RFC data and store inside structure.
Expand Down Expand Up @@ -337,35 +336,3 @@ bool isDirectCDNEnabled(void)
return status;
}


/* Description: Reads the device type RFC value and copies it into the provided buffer.
* @param deviceType Output buffer that receives the device type string ("test", "prod", or "unknown").
* @param size Size of the deviceType buffer in bytes; must be greater than 0. The string is always NUL-terminated.
* @return void. On error or unrecognized RFC value, "unknown" is written to deviceType (if size > 0).
*/
void getDeviceTypeRFC(char *deviceType, size_t size ){

if (deviceType == NULL || size == 0){
SWLOG_ERROR("%s: Invalid Arguments Passed...\n", __FUNCTION__);
return;
}

const char* type = "unknown";
char rfc_data[RFC_VALUE_BUF_SIZE] = {0};
int ret = read_RFCProperty("DEVICETYPE", RFC_DEVICETYPE, rfc_data, sizeof(rfc_data));

if (ret == -1) {
SWLOG_ERROR("%s: Failed to read device type\n", __FUNCTION__);
}

SWLOG_INFO("%s: RFC device type = %s\n", __FUNCTION__, rfc_data);

if (strncasecmp(rfc_data, "prod", 4) == 0) {
type = "prod";
} else if (strncasecmp(rfc_data, "test", 4) == 0) {
type = "test";
}

strncpy(deviceType, type, size - 1);
deviceType[size - 1] = '\0';
}
Loading
Loading