drv: sa: Add USE_DKEK flag support
[keystone-rtos/sa-lld.git] / src / proto / datamode / sallddm.c
index ad4e243433c2b367ee6bb8da0d7a72a84bc9d7f2..29a3a01970b328491a9eecc2ded43ff34eb41eb7 100644 (file)
@@ -91,6 +91,12 @@ uint16_t salld_data_mode_setup_key(salldDataModeInst_t *inst,
       memcpy(pComInfo->sessionSalt, pKeyParams->sessionSalt, pComInfo->config.sessionSaltSize);
   }
 
+  if(ctrlBitMap & sa_DATA_MODE_KEY_USE_DKEK)
+  {
+      /* Set USE_DKEK flag */
+      pComInfo->config.ctrlBitMap |= sa_DM_CONFIG_USE_DKEK;
+  }
+
   return TRUE;
 } 
 
@@ -681,6 +687,11 @@ int16_t salld_data_mode_set_sc(salldDataModeInst_t *inst)
                          pComInfo->sessionEncKey, (uint8_t) pConfig->aadSize, pConfig->enc, 
                          (tword *)pScInfo->scBuf + encScOffset);
     }               
+
+    if (pConfig->ctrlBitMap & sa_DM_CONFIG_USE_DKEK)
+    {
+        pktWrite8bits_m((tword *)pScInfo->scBuf, encScOffset, SA_ENC_MODE_USE_DKEK);
+    }
   }
   
   /* Prepare Security Context for the authentication Engine */