/**************************************************************************/ /* */ /* Copyright (c) Microsoft Corporation. All rights reserved. */ /* */ /* This software is licensed under the Microsoft Software License */ /* Terms for Microsoft Azure RTOS. Full text of the license can be */ /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ /* and in the root directory of this software. */ /* */ /**************************************************************************/ /**************************************************************************/ /* Copyright (C) The Internet Society (2001). All Rights Reserved. This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the Internet Society or other Internet organizations, except as needed for the purpose of developing Internet standards in which case the procedures for copyrights defined in the Internet Standards process must be followed, or as required to translate it into languages other than English. The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assigns. This document and the information contained herein is provided on an ""AS IS"" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. */ /**************************************************************************/ /**************************************************************************/ /**************************************************************************/ /** */ /** NetX Component */ /** */ /** SHA1 Digest Algorithm (SHA1) */ /** */ /**************************************************************************/ /**************************************************************************/ /**************************************************************************/ /* */ /* COMPONENT DEFINITION RELEASE */ /* */ /* nx_sha1.h PORTABLE C */ /* 6.1 */ /* AUTHOR */ /* */ /* Yuxin Zhou, Microsoft Corporation */ /* */ /* DESCRIPTION */ /* */ /* This file defines the NetX SHA1 algorithm, derived principally from */ /* RFC3174. From a user-specified number of input bytes, this routine */ /* produces a 20-byte (160-bit) digest or sometimes called a hash */ /* value. The resulting digest is returned in a 20-byte array supplied */ /* by the caller. */ /* */ /* It is assumed that nx_api.h and nx_port.h have already been */ /* included. */ /* */ /* RELEASE HISTORY */ /* */ /* DATE NAME DESCRIPTION */ /* */ /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ /* 09-30-2020 Yuxin Zhou Modified comment(s), */ /* resulting in version 6.1 */ /* */ /**************************************************************************/ #ifndef NX_SHA1_H #define NX_SHA1_H /* Define the SHA1 context structure. */ typedef struct NX_SHA1_STRUCT { ULONG nx_sha1_states[5]; /* Contains each state (A,B,C,D) */ ULONG nx_sha1_bit_count[2]; /* Contains the 64-bit total bit */ /* count, where index 0 holds the */ /* least significant bit count and*/ /* index 1 contains the most */ /* significant portion of the bit */ /* count */ UCHAR nx_sha1_buffer[64]; /* Working buffer for SHA1 algorithm*/ /* where partial buffers are */ /* accumulated until a full block */ /* can be processed */ ULONG nx_sha1_word_array[80]; /* Working 80 word array */ } NX_SHA1; /* Define the function prototypes for SHA1. */ UINT _nx_sha1_initialize(NX_SHA1 *context); UINT _nx_sha1_update(NX_SHA1 *context, UCHAR *input_ptr, UINT input_length); UINT _nx_sha1_digest_calculate(NX_SHA1 *context, UCHAR digest[20]); VOID _nx_sha1_process_buffer(NX_SHA1 *context, UCHAR buffer[64]); #endif