PageRenderTime 35ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/llmessage/llcipher.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 56 lines | 11 code | 7 blank | 38 comment | 0 complexity | 513c6b1fd13e9cfb33a6cadf410e256b MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llcipher.h
  3. * @brief Abstract base class for encryption ciphers.
  4. *
  5. * $LicenseInfo:firstyear=2003&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LLCIPHER_H
  27. #define LLCIPHER_H
  28. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  29. // Class LLCipher
  30. //
  31. // Abstract base class for a cipher object.
  32. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  33. class LLCipher
  34. {
  35. public:
  36. virtual ~LLCipher() {}
  37. // encrypt src and place result into dst. returns TRUE if
  38. // Returns number of bytes written into dst, or 0 on error.
  39. virtual U32 encrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len) = 0;
  40. // decrypt src and place result into dst.
  41. // Returns number of bytes written into dst, or 0 on error.
  42. virtual U32 decrypt(const U8* src, U32 src_len, U8* dst, U32 dst_len) = 0;
  43. // returns the minimum amount of space required to encrypt for a
  44. // unencrypted source buffer of length len.
  45. // *NOTE: This is estimated space and you should check the return value
  46. // of the encrypt function.
  47. virtual U32 requiredEncryptionSpace(U32 src_len) const = 0 ;
  48. };
  49. #endif