1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: crypto_Encryptor.h 4 5 Copyright (C)2009-2012 Nintendo Co., Ltd. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Rev: 46347 $ 14 *---------------------------------------------------------------------------*/ 15 16 #ifndef NN_CRYPTO_CRYPTO_ENCRYPTOR_H_ 17 #define NN_CRYPTO_CRYPTO_ENCRYPTOR_H_ 18 19 #include <nn/crypto/crypto_BlockCipher.h> 20 #include <nn/crypto/crypto_CipherMode.h> 21 22 23 namespace nn { 24 namespace crypto { 25 26 27 28 /* Please see man pages for details 29 30 31 32 33 34 35 36 37 38 39 */ 40 class Encryptor : public CipherMode 41 { 42 public: Encryptor()43 Encryptor(){} ~Encryptor()44 virtual ~Encryptor(){} 45 46 47 48 /* Please see man pages for details 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 */ 64 virtual void Initialize(const BlockCipher& c, const void* pIv, size_t ivSize) = 0; 65 66 /* Please see man pages for details 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 */ 105 virtual size_t Update(void* pDst, size_t dstSize, const void* pSrc, size_t srcSize) = 0; 106 107 /* Please see man pages for details 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 */ 129 virtual size_t UpdateFinal(void* pDst, size_t dstSize) = 0; 130 131 protected: 132 size_t Encrypt(void* pDst, size_t dstSize, const void* pSrc, size_t srcSize, 133 const void* pIv, size_t ivSize, const BlockCipher& c); 134 }; 135 136 137 138 } // namespace crypto 139 } // namespace nn 140 141 142 143 #endif /* NN_CRYPTO_CRYPTO_ENCRYPTOR_H_ */ 144