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

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

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

Parameters:
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 that the decrypted data shall be placed
byte_count Length of the message (bytes)
black_data Pointer to where the encrypted data is stored
IV IV to use for decryption
cypher_mode Cyphering mode to use, specified by type fsl_shw_cypher_mode_t
Returns:
status
Call the proper function to decrypt a region of encrypted secure memory

Parameters:
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 that the decrypted data shall be placed
byte_count Length of the message (bytes)
black_data Pointer to where the encrypted data is stored
owner_id 
Returns:
status

Definition at line 2021 of file shw_driver.c.

References FSL_RETURN_ERROR_S, FSL_RETURN_OK_S, os_cache_flush_range, scc_decrypt_region(), and SCC_RET_OK.

{
      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);

      LOG_KDIAG_ARGS
          ("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 */

      (void)user_ctx;

      /* The SCC2 DMA engine will be reading from the black ram, so we need to
       * make sure that the data is pushed out of the cache.  Note that the red
       * ram is not an issue because it is mapped with the cache disabled.
       */
      os_cache_flush_range(black_data, byte_count);

      scc_ret =
          scc_decrypt_region((uint32_t) partition_base, offset_bytes,
                         byte_count,
                         (uint8_t *) __virt_to_phys(black_data), IV,
                         cypher_mode);

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

#endif                        /* FSL_HAVE_SCC2 */

      return retval;
}


Generated by  Doxygen 1.6.0   Back to index