WvStreams
wvcountermode.h
1 /* -*- Mode: C++ -*-
2  * Worldvisions Tunnel Vision Software:
3  * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4  *
5  * A 'counter mode' cryptography engine abstraction.
6  */
7 #ifndef __WVCOUNTERMODE_H
8 #define __WVCOUNTERMODE_H
9 
10 #include "wvencoder.h"
11 
14 {
15 public:
16  WvEncoder *keycrypt;
17 
26  const void *_counter, size_t _countersize);
27  virtual ~WvCounterModeEncoder();
28 
34  void setcounter(const void *counter, size_t countersize);
35 
40  void getcounter(void *counter) const;
41 
43  size_t getcountersize() const
44  { return countersize; }
45 
47  virtual void incrcounter();
48 
49 private:
50  WvConstInPlaceBuf counterbuf;
51 
52 protected:
53  unsigned char *counter; // auto-incrementing counter
54  size_t countersize; // counter size in bytes
55 
56  virtual bool _encode(WvBuf &inbuf, WvBuf &outbuf, bool flush);
57 };
58 
59 #endif // __WVCOUNTERMODE_H