mirror of
				https://github.com/smaeul/u-boot.git
				synced 2025-10-31 20:18:18 +00:00 
			
		
		
		
	Freescale's SEC block has built-in Data Encryption
Key(DEK) Blob Protocol which provides a method for
protecting a DEK for non-secure memory storage.
SEC block protects data in a data structure called
a Secret Key Blob, which provides both confidentiality
and integrity protection.
Every time the blob encapsulation is executed,
a AES-256 key is randomly generated to encrypt the DEK.
This key is encrypted with the OTP Secret key
from SoC. The resulting blob consists of the encrypted
AES-256 key, the encrypted DEK, and a 16-bit MAC.
During decapsulation, the reverse process is performed
to get back the original DEK. A caveat to the blob
decapsulation process,  is that the DEK is decrypted
in secure-memory and can only be read by FSL SEC HW.
The DEK is used to decrypt data during encrypted boot.
Commands added
--------------
  dek_blob - encapsulating DEK as a cryptgraphic blob
Commands Syntax
---------------
  dek_blob src dst len
    Encapsulate and create blob of a len-bits DEK at
    address src and store the result at address dst.
Signed-off-by: Raul Cardenas <Ulises.Cardenas@freescale.com>
Signed-off-by: Nitin Garg <nitin.garg@freescale.com>
Signed-off-by: Ulises Cardenas <ulises.cardenas@freescale.com>
Signed-off-by: Ulises Cardenas-B45798 <Ulises.Cardenas@freescale.com>
		
	
			
		
			
				
	
	
		
			49 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /*
 | |
|  * Copyright 2014 Freescale Semiconductor, Inc.
 | |
|  *
 | |
|  * SPDX-License-Identifier:	GPL-2.0+
 | |
|  *
 | |
|  */
 | |
| 
 | |
| #ifndef __JOBDESC_H
 | |
| #define __JOBDESC_H
 | |
| 
 | |
| #include <common.h>
 | |
| #include <asm/io.h>
 | |
| #include "rsa_caam.h"
 | |
| 
 | |
| #define KEY_IDNFR_SZ_BYTES		16
 | |
| 
 | |
| #ifdef CONFIG_CMD_DEKBLOB
 | |
| /* inline_cnstr_jobdesc_blob_dek:
 | |
|  * Intializes and constructs the job descriptor for DEK encapsulation
 | |
|  * using the given parameters.
 | |
|  * @desc: reference to the job descriptor
 | |
|  * @plain_txt: reference to the DEK
 | |
|  * @enc_blob: reference where to store the blob
 | |
|  * @in_sz: size in bytes of the DEK
 | |
|  * @return: 0 on success, ECONSTRJDESC otherwise
 | |
|  */
 | |
| int inline_cnstr_jobdesc_blob_dek(uint32_t *desc, const uint8_t *plain_txt,
 | |
| 				uint8_t *enc_blob, uint32_t in_sz);
 | |
| #endif
 | |
| 
 | |
| void inline_cnstr_jobdesc_hash(uint32_t *desc,
 | |
| 			  const uint8_t *msg, uint32_t msgsz, uint8_t *digest,
 | |
| 			  u32 alg_type, uint32_t alg_size, int sg_tbl);
 | |
| 
 | |
| void inline_cnstr_jobdesc_blob_encap(uint32_t *desc, uint8_t *key_idnfr,
 | |
| 				     uint8_t *plain_txt, uint8_t *enc_blob,
 | |
| 				     uint32_t in_sz);
 | |
| 
 | |
| void inline_cnstr_jobdesc_blob_decap(uint32_t *desc, uint8_t *key_idnfr,
 | |
| 				     uint8_t *enc_blob, uint8_t *plain_txt,
 | |
| 				     uint32_t out_sz);
 | |
| 
 | |
| void inline_cnstr_jobdesc_rng_instantiation(uint32_t *desc);
 | |
| 
 | |
| void inline_cnstr_jobdesc_pkha_rsaexp(uint32_t *desc,
 | |
| 				      struct pk_in_params *pkin, uint8_t *out,
 | |
| 				      uint32_t out_siz);
 | |
| #endif
 |