mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-10-21 15:32:02 +08:00

1. Add libssc.a, simple serial console lib. 2. Add libspiffs.a, SPI file system. 3. Add libwps.a to support WPS. 4. Add libespconn.a, Espressif connection lib. 5. Add libespnow.a to support Espressif ESP-NOW. 6. Add libmesh.a, Espressif mesh. 7. Add libnopoll.a, websocket. 8. Add make_lib.sh in "third_party" folder. 9. Add modem-sleep & light-sleep supported. 10. Update libcirom.a to support float IO. 11. Update gen_misc.sh & gen_misc.bat. 12. Update header files, add comments in doxygen style. 13. Update libsmartconfig.a to version 2.5.2. 14. Update libssl.a. 15. Updates driver (PWM/UART/GPIO/SPI/Hardware timer). 16. Update open source codes of third_party. 17. Modify "ld" files, "dram0 len" should be 0x18000 in RTOS SDK. 18. Remove header files in extra_include, which are already in compile folder. 19. Other APIs sync from non-OS SDK, more details in documentation "20B-ESP8266__RTOS_SDK_API Reference". 20. Other optimization to make the SDK more stable.
81 lines
2.9 KiB
C
81 lines
2.9 KiB
C
/*
|
|
* Copyright (c) 2015, Cameron Rich
|
|
*
|
|
* All rights reserved.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions are met:
|
|
*
|
|
* * Redistributions of source code must retain the above copyright notice,
|
|
* this list of conditions and the following disclaimer.
|
|
* * Redistributions in binary form must reproduce the above copyright notice,
|
|
* this list of conditions and the following disclaimer in the documentation
|
|
* and/or other materials provided with the distribution.
|
|
* * Neither the name of the axTLS project nor the names of its contributors
|
|
* may be used to endorse or promote products derived from this software
|
|
* without specific prior written permission.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
*/
|
|
|
|
//#include <string.h>
|
|
//#include "os_port.h"
|
|
#include "ssl/ssl_os_port.h"
|
|
#include "ssl/ssl_crypto.h"
|
|
//#include "crypto.h"
|
|
#include "lwip/mem.h"
|
|
|
|
/**
|
|
* Initialize the SHA384 context
|
|
*/
|
|
void ICACHE_FLASH_ATTR SHA384_Init(SHA384_CTX *ctx)
|
|
{
|
|
//Set initial hash value
|
|
ctx->h_dig.h[0] = 0xCBBB9D5DC1059ED8ULL;
|
|
ctx->h_dig.h[1] = 0x629A292A367CD507ULL;
|
|
ctx->h_dig.h[2] = 0x9159015A3070DD17ULL;
|
|
ctx->h_dig.h[3] = 0x152FECD8F70E5939ULL;
|
|
ctx->h_dig.h[4] = 0x67332667FFC00B31ULL;
|
|
ctx->h_dig.h[5] = 0x8EB44A8768581511ULL;
|
|
ctx->h_dig.h[6] = 0xDB0C2E0D64F98FA7ULL;
|
|
ctx->h_dig.h[7] = 0x47B5481DBEFA4FA4ULL;
|
|
|
|
// Number of bytes in the buffer
|
|
ctx->size = 0;
|
|
// Total length of the message
|
|
ctx->totalSize = 0;
|
|
}
|
|
|
|
/**
|
|
* Accepts an array of octets as the next portion of the message.
|
|
*/
|
|
void ICACHE_FLASH_ATTR SHA384_Update(SHA384_CTX *ctx, const uint8_t * msg, int len)
|
|
{
|
|
// The function is defined in the exact same manner as SHA-512
|
|
SHA512_Update(ctx, msg, len);
|
|
}
|
|
|
|
/**
|
|
* Return the 384-bit message digest into the user's array
|
|
*/
|
|
void ICACHE_FLASH_ATTR SHA384_Final(uint8_t *digest, SHA384_CTX *ctx)
|
|
{
|
|
// The function is defined in the exact same manner as SHA-512
|
|
SHA512_Final(NULL, ctx);
|
|
|
|
// Copy the resulting digest
|
|
if (digest != NULL)
|
|
memcpy(digest, ctx->h_dig.digest, SHA384_SIZE);
|
|
}
|
|
|