mirror of
https://github.com/pocoproject/poco.git
synced 2025-04-02 17:50:53 +02:00
Bugfix for gcc and add copyright text
This commit is contained in:
parent
43cff0fb14
commit
bbce66e2de
@ -13,6 +13,11 @@
|
|||||||
// Based on the implementation of mbed TLS (Apache 2.0)
|
// Based on the implementation of mbed TLS (Apache 2.0)
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
|
// Copyright (c) 2017, Applied Informatics Software Engineering GmbH
|
||||||
|
// and Contributors.
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
|
//
|
||||||
|
|
||||||
#ifndef Foundation_SHA2Engine_INCLUDED
|
#ifndef Foundation_SHA2Engine_INCLUDED
|
||||||
#define Foundation_SHA2Engine_INCLUDED
|
#define Foundation_SHA2Engine_INCLUDED
|
||||||
|
@ -13,16 +13,14 @@
|
|||||||
// Based on the implementation of mbed TLS (Apache 2.0)
|
// Based on the implementation of mbed TLS (Apache 2.0)
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
|
// Copyright (c) 2017, Applied Informatics Software Engineering GmbH
|
||||||
|
// and Contributors.
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
|
//
|
||||||
|
|
||||||
#include "Poco/SHA2Engine.h"
|
#include "Poco/SHA2Engine.h"
|
||||||
#include <cstring>
|
#include <string.h>
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
#ifdef POCO_ARCH_LITTLE_ENDIAN
|
|
||||||
#define SHA2_BYTE_REVERSE(x, y) byteReverse(x, y)
|
|
||||||
#else
|
|
||||||
#define SHA2_BYTE_REVERSE(x, y)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace Poco {
|
namespace Poco {
|
||||||
|
|
||||||
@ -247,7 +245,7 @@ SHA2Engine::~SHA2Engine()
|
|||||||
void _sha256_process(HASHCONTEXT* pContext, const unsigned char data[64])
|
void _sha256_process(HASHCONTEXT* pContext, const unsigned char data[64])
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
uint32_t temp1, temp2, temp3[8], W[64];
|
Poco::UInt32 temp1, temp2, temp3[8], W[64];
|
||||||
for (i = 0; i < 8; i++) temp3[i] = pContext->state.state32[i];
|
for (i = 0; i < 8; i++) temp3[i] = pContext->state.state32[i];
|
||||||
for (i = 0; i < 16; i++) { GET_UINT32(W[i], data, 4 * i); }
|
for (i = 0; i < 16; i++) { GET_UINT32(W[i], data, 4 * i); }
|
||||||
for (i = 0; i < 16; i += 8)
|
for (i = 0; i < 16; i += 8)
|
||||||
@ -278,7 +276,7 @@ void _sha256_process(HASHCONTEXT* pContext, const unsigned char data[64])
|
|||||||
void _sha512_process(HASHCONTEXT* pContext, const unsigned char data[128])
|
void _sha512_process(HASHCONTEXT* pContext, const unsigned char data[128])
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
uint64_t temp1, temp2, temp3[8], W[80];
|
Poco::UInt64 temp1, temp2, temp3[8], W[80];
|
||||||
for (i = 0; i < 16; i++) { GET_UINT64(W[i], data, i << 3); }
|
for (i = 0; i < 16; i++) { GET_UINT64(W[i], data, i << 3); }
|
||||||
for (; i < 80; i++) { W[i] = S641(W[i - 2]) + W[i - 7] + S640(W[i - 15]) + W[i - 16]; }
|
for (; i < 80; i++) { W[i] = S641(W[i - 2]) + W[i - 7] + S640(W[i - 15]) + W[i - 16]; }
|
||||||
for (i = 0; i < 8; i++) temp3[i] = pContext->state.state64[i];
|
for (i = 0; i < 8; i++) temp3[i] = pContext->state.state64[i];
|
||||||
|
@ -7,6 +7,11 @@
|
|||||||
//
|
//
|
||||||
// test vectors from FIPS 180-1
|
// test vectors from FIPS 180-1
|
||||||
//
|
//
|
||||||
|
// Copyright (c) 2017, Applied Informatics Software Engineering GmbH
|
||||||
|
// and Contributors.
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
|
//
|
||||||
|
|
||||||
#include "SHA2EngineTest.h"
|
#include "SHA2EngineTest.h"
|
||||||
#include "Poco/CppUnit/TestCaller.h"
|
#include "Poco/CppUnit/TestCaller.h"
|
||||||
|
@ -5,6 +5,11 @@
|
|||||||
//
|
//
|
||||||
// Definition of the SHA2EngineTest class.
|
// Definition of the SHA2EngineTest class.
|
||||||
//
|
//
|
||||||
|
// Copyright (c) 2017, Applied Informatics Software Engineering GmbH
|
||||||
|
// and Contributors.
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
|
//
|
||||||
|
|
||||||
#ifndef SHA2EngineTest_INCLUDED
|
#ifndef SHA2EngineTest_INCLUDED
|
||||||
#define SHA2EngineTest_INCLUDED
|
#define SHA2EngineTest_INCLUDED
|
||||||
|
Loading…
x
Reference in New Issue
Block a user