Logo Search packages:      
Sourcecode: linux-fsl-imx51 version File versions  Download package

fsl_shw_return_t do_scc_encrypt_region ( fsl_shw_uco_t user_ctx,
void *  partition_base,
uint32_t  offset_bytes,
uint32_t  byte_count,
uint8_t *  black_data,
uint32_t *  IV,
fsl_shw_cypher_mode_t  cypher_mode 

Call the proper function to encrypt a region of encrypted secure memory

user_ctx User context of the partition owner (NULL in kernel)
partition_base Base address (physical) of the partition
offset_bytes Offset from base address of the data to be encrypted
byte_count Length of the message (bytes)
black_data Pointer to where the encrypted data is stored
IV IV to use for encryption
cypher_mode Cyphering mode to use, specified by type fsl_shw_cypher_mode_t

Definition at line 1959 of file shw_driver.c.

      fsl_shw_return_t retval = FSL_RETURN_ERROR_S;
#ifdef FSL_HAVE_SCC2

      scc_return_t scc_ret;

#ifdef SHW_DEBUG
      uint32_t *owner_32 = (uint32_t *) & (owner_id);

          ("partition base: %p, offset: %i, count: %i, black data: %p\n",
           partition_base, offset_bytes, byte_count, (void *)black_data);

      LOG_KDIAG_ARGS("Owner ID: %08x%08x\n", owner_32[1], owner_32[0]);
#endif                        /* SHW_DEBUG */

      os_cache_flush_range(black_data, byte_count);

      scc_ret =
          scc_encrypt_region((uint32_t) partition_base, offset_bytes,
                         byte_count, __virt_to_phys(black_data), IV,

      if (scc_ret == SCC_RET_OK) {
            retval = FSL_RETURN_OK_S;
      } else {
            retval = FSL_RETURN_ERROR_S;

      /* The SCC2 DMA engine should have written to the black ram, so we need to
       * invalidate that region of memory.  Note that the red ram is not an
       * because it is mapped with the cache disabled.
      os_cache_inv_range(black_data, byte_count);

#endif                        /* FSL_HAVE_SCC2 */
      return retval;

Generated by  Doxygen 1.6.0   Back to index