diff options
| author | Tom Rini <[email protected]> | 2020-07-08 20:20:24 -0400 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2020-07-08 20:20:24 -0400 |
| commit | 61608f395e7dcb2be6060407a72a1149b046430a (patch) | |
| tree | 387269e837a47126d5a7ccdef2b4d5af60598e16 /include | |
| parent | 186529953fd10a97e6343418095edd1c535aaeb2 (diff) | |
| parent | c89b41b4db4a746647c4f0e6d33c6f4edfe96e38 (diff) | |
Merge branch '2020-07-08-misc-features-and-fixes'
- mem cmd improvements
- TPM fixes
- SPL/NAND/FIT fixes
- RSA improvements
Diffstat (limited to 'include')
| -rw-r--r-- | include/compiler.h | 4 | ||||
| -rw-r--r-- | include/debug_uart.h | 2 | ||||
| -rw-r--r-- | include/nand.h | 1 | ||||
| -rw-r--r-- | include/spl.h | 2 | ||||
| -rw-r--r-- | include/tpm-v2.h | 13 | ||||
| -rw-r--r-- | include/u-boot/rsa.h | 21 |
6 files changed, 40 insertions, 3 deletions
diff --git a/include/compiler.h b/include/compiler.h index ed74c272b8c..90b7afae537 100644 --- a/include/compiler.h +++ b/include/compiler.h @@ -145,7 +145,9 @@ typedef unsigned long int uintptr_t; #define unlikely(x) __builtin_expect(!!(x), 0) #ifdef __LP64__ -#define MEM_SUPPORT_64BIT_DATA +#define MEM_SUPPORT_64BIT_DATA 1 +#else +#define MEM_SUPPORT_64BIT_DATA 0 #endif #endif diff --git a/include/debug_uart.h b/include/debug_uart.h index 4d1c58075cf..714b369e6fe 100644 --- a/include/debug_uart.h +++ b/include/debug_uart.h @@ -112,7 +112,7 @@ void printhex8(unsigned int value); void printdec(unsigned int value); #ifdef CONFIG_DEBUG_UART_ANNOUNCE -#define _DEBUG_UART_ANNOUNCE printascii("<debug_uart> "); +#define _DEBUG_UART_ANNOUNCE printascii("\n<debug_uart>\n"); #else #define _DEBUG_UART_ANNOUNCE #endif diff --git a/include/nand.h b/include/nand.h index 93cbe1e25db..80dd6469bc0 100644 --- a/include/nand.h +++ b/include/nand.h @@ -120,6 +120,7 @@ int nand_unlock(struct mtd_info *mtd, loff_t start, size_t length, int allexcept); int nand_get_lock_status(struct mtd_info *mtd, loff_t offset); +u32 nand_spl_adjust_offset(u32 sector, u32 offs); int nand_spl_load_image(uint32_t offs, unsigned int size, void *dst); int nand_spl_read_block(int block, int offset, int len, void *dst); void nand_deselect(void); diff --git a/include/spl.h b/include/spl.h index b31c9bb4ab2..580e4e024fd 100644 --- a/include/spl.h +++ b/include/spl.h @@ -155,7 +155,7 @@ struct spl_image_info { #endif }; -/* +/** * Information required to load data from a device * * @dev: Pointer to the device, e.g. struct mmc * diff --git a/include/tpm-v2.h b/include/tpm-v2.h index d53d2e40239..f6c045d3548 100644 --- a/include/tpm-v2.h +++ b/include/tpm-v2.h @@ -70,6 +70,7 @@ enum tpm2_handles { * @TPM2_CC_DAM_RESET: TPM2_DictionaryAttackLockReset(). * @TPM2_CC_DAM_PARAMETERS: TPM2_DictionaryAttackParameters(). * @TPM2_CC_GET_CAPABILITY: TPM2_GetCapibility(). + * @TPM2_CC_GET_RANDOM: TPM2_GetRandom(). * @TPM2_CC_PCR_READ: TPM2_PCR_Read(). * @TPM2_CC_PCR_EXTEND: TPM2_PCR_Extend(). * @TPM2_CC_PCR_SETAUTHVAL: TPM2_PCR_SetAuthValue(). @@ -85,6 +86,7 @@ enum tpm2_command_codes { TPM2_CC_DAM_PARAMETERS = 0x013A, TPM2_CC_NV_READ = 0x014E, TPM2_CC_GET_CAPABILITY = 0x017A, + TPM2_CC_GET_RANDOM = 0x017B, TPM2_CC_PCR_READ = 0x017E, TPM2_CC_PCR_EXTEND = 0x0182, TPM2_CC_PCR_SETAUTHVAL = 0x0183, @@ -339,4 +341,15 @@ u32 tpm2_pcr_setauthvalue(struct udevice *dev, const char *pw, const ssize_t pw_sz, u32 index, const char *key, const ssize_t key_sz); +/** + * Issue a TPM2_GetRandom command. + * + * @dev TPM device + * @param data output buffer for the random bytes + * @param count size of output buffer + * + * @return return code of the operation + */ +u32 tpm2_get_random(struct udevice *dev, void *data, u32 count); + #endif /* __TPM_V2_H */ diff --git a/include/u-boot/rsa.h b/include/u-boot/rsa.h index 2d3024d8b71..a0bae495f05 100644 --- a/include/u-boot/rsa.h +++ b/include/u-boot/rsa.h @@ -83,6 +83,20 @@ static inline int rsa_add_verify_data(struct image_sign_info *info, #if IMAGE_ENABLE_VERIFY /** + * rsa_verify_hash() - Verify a signature against a hash + * + * Verify a RSA PKCS1.5 signature against an expected hash. + * + * @info: Specifies key and FIT information + * @hash: Hash according to algorithm specified in @info + * @sig: Signature + * @sig_len: Number of bytes in signature + * @return 0 if verified, -ve on error + */ +int rsa_verify_hash(struct image_sign_info *info, + const uint8_t *hash, uint8_t *sig, uint sig_len); + +/** * rsa_verify() - Verify a signature against some data * * Verify a RSA PKCS1.5 signature against an expected hash. @@ -108,6 +122,13 @@ int padding_pss_verify(struct image_sign_info *info, const uint8_t *hash, int hash_len); #endif /* CONFIG_FIT_ENABLE_RSASSA_PSS_SUPPORT */ #else +static inline int rsa_verify_hash(struct image_sign_info *info, + const uint8_t *hash, + uint8_t *sig, uint sig_len) +{ + return -ENXIO; +} + static inline int rsa_verify(struct image_sign_info *info, const struct image_region region[], int region_count, uint8_t *sig, uint sig_len) |
