1 /**************************************************************************/ 2 /* */ 3 /* Copyright (c) Microsoft Corporation. All rights reserved. */ 4 /* */ 5 /* This software is licensed under the Microsoft Software License */ 6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */ 7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ 8 /* and in the root directory of this software. */ 9 /* */ 10 /**************************************************************************/ 11 12 13 /**************************************************************************/ 14 /**************************************************************************/ 15 /** */ 16 /** NetX Crypto Component */ 17 /** */ 18 /** Transport Layer Security (TLS) */ 19 /** */ 20 /**************************************************************************/ 21 /**************************************************************************/ 22 23 /* Determine if a C++ compiler is being used. If so, ensure that standard 24 C is used to process the API information. */ 25 #ifdef __cplusplus 26 27 /* Yes, C++ compiler is present. Use standard C. */ 28 extern "C" { 29 30 #endif 31 32 #include "nx_crypto_phash.h" 33 34 /**************************************************************************/ 35 /* */ 36 /* COMPONENT DEFINITION RELEASE */ 37 /* */ 38 /* nx_crypto_tls_prf_sha256.h PORTABLE C */ 39 /* 6.1 */ 40 /* AUTHOR */ 41 /* */ 42 /* Timothy Stapko, Microsoft Corporation */ 43 /* */ 44 /* DESCRIPTION */ 45 /* */ 46 /* This file defines the TLS Pseudo-Random Function (PRF) as described */ 47 /* in RFC 5246. This PRF is used for default key generation in TLS */ 48 /* version 1.2. Ciphersuites may choose their own PRF in TLS version */ 49 /* 1.2 as well. */ 50 /* */ 51 /* RELEASE HISTORY */ 52 /* */ 53 /* DATE NAME DESCRIPTION */ 54 /* */ 55 /* 05-19-2020 Timothy Stapko Initial Version 6.0 */ 56 /* 09-30-2020 Timothy Stapko Modified comment(s), */ 57 /* resulting in version 6.1 */ 58 /* */ 59 /**************************************************************************/ 60 61 typedef struct NX_CRYPTO_TLS_PRF_SHA384_STRUCT 62 { 63 NX_CRYPTO_PHASH nx_secure_tls_prf_phash_info; 64 UCHAR nx_secure_tls_prf_label_seed_buffer[80]; /* phash_seed = label(13 bytes) || prf_seed(64 bytes) */ 65 UCHAR nx_secure_tls_prf_temp_A_buffer[128]; /* The temp_A buffer needs to be large enough to holdthe lable(13 bytes) || prf_seed(64 bytes) || hash_size(48 bytes for SHA384) */ 66 UCHAR nx_secure_tls_prf_temp_hmac_output_buffer[48]; /* The temp buffer for the output buffer of hmac(secret, A(i) + seed) */ 67 UCHAR nx_secure_tls_prf_hmac_metadata_area[sizeof(NX_CRYPTO_SHA512_HMAC)]; /* metadata buffer for the hmac function */ 68 } NX_CRYPTO_TLS_PRF_SHA384; 69 70 UINT _nx_crypto_method_prf_sha384_init(struct NX_CRYPTO_METHOD_STRUCT *method, 71 UCHAR *key, NX_CRYPTO_KEY_SIZE key_size_in_bits, 72 VOID **handle, 73 VOID *crypto_metadata, 74 ULONG crypto_metadata_size); 75 76 UINT _nx_crypto_method_prf_sha384_cleanup(VOID *crypto_metadata); 77 78 UINT _nx_crypto_method_prf_sha384_operation(UINT op, /* Encrypt, Decrypt, Authenticate */ 79 VOID *handle, /* Crypto handler */ 80 struct NX_CRYPTO_METHOD_STRUCT *method, 81 UCHAR *key, NX_CRYPTO_KEY_SIZE key_size_in_bits, 82 UCHAR *input, ULONG input_length_in_byte, 83 UCHAR *iv_ptr, 84 UCHAR *output, ULONG output_length_in_byte, 85 VOID *crypto_metadata, ULONG crypto_metadata_size, 86 VOID *packet_ptr, 87 VOID (*nx_crypto_hw_process_callback)(VOID *packet_ptr, UINT status)); 88 89 #ifdef __cplusplus 90 } 91 #endif 92