1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     crypto_ShaBlock512BitContext.h
4   Copyright (C)2009 Nintendo Co., Ltd.  All rights reserved.
5   These coded instructions, statements, and computer programs contain
6   proprietary information of Nintendo of America Inc. and/or Nintendo
7   Company Ltd., and are protected by Federal copyright law. They may
8   not be disclosed to third parties or copied or duplicated in any form,
9   in whole or in part, without the prior written consent of Nintendo.
10   $Rev: 34562 $
11  *---------------------------------------------------------------------------
12 
13 
14 */
15 
16 /*
17     Declarations of functions for SHA-X (Block size = 512 bit)
18 */
19 
20 #ifndef NN_CRYPTO_CRYPTO_SHABLOCK512BITCONTEXT_H_
21 #define NN_CRYPTO_CRYPTO_SHABLOCK512BITCONTEXT_H_
22 
23 #include <nn/crypto/crypto_HashContextBase.h>
24 
25 #ifdef __cplusplus
26 
27 namespace nn{ namespace crypto{
28 
29 /* Please see man pages for details
30 
31 
32 
33 
34 */
35 class ShaBlock512BitContext : public HashContextBase
36 {
37 public:
38     static const size_t BLOCK_SIZE = (512/8);  // 512 bit
39 
40     virtual void Update(const void* pData, size_t length);
41 
42 protected:
43     u8      m_Block[BLOCK_SIZE];
44     u32     m_Pool;
45     u32     m_BlocksLow;
46     u32     m_BlocksHigh;
47 
48     void    AddPadding();
ProcessBlock()49     virtual void ProcessBlock() {}
50 
51     // Prohibit independent instantiation
ShaBlock512BitContext()52     ShaBlock512BitContext() {}
~ShaBlock512BitContext()53     virtual ~ShaBlock512BitContext() {}
54 };
55 
56 }} // namespace nn::crypto
57 
58 #endif // __cplusplus
59 
60 
61 #endif /* NN_CRYPTO_CRYPTO_SHABLOCK512BITCONTEXT_H_ */
62