Keep aligned buffers around, instead of allocing on each packet

Fixes #238 github issue.
Also fixes armel "Bad alignment" problem.
This commit is contained in:
Keith Winstein
2012-04-24 17:22:54 -04:00
parent 3ccfe64bfb
commit 22e7cf60d3
4 changed files with 43 additions and 30 deletions
+10 -1
View File
@@ -73,8 +73,11 @@ namespace Crypto {
};
class Nonce {
public:
static const int NONCE_LEN = 12;
private:
char bytes[ 12 ] __attribute__((__aligned__ (16)));
char bytes[ NONCE_LEN ];
public:
Nonce( uint64_t val );
@@ -101,8 +104,14 @@ namespace Crypto {
AlignedBuffer ctx_buf;
ae_ctx *ctx;
uint64_t blocks_encrypted;
AlignedBuffer plaintext_buffer;
AlignedBuffer ciphertext_buffer;
AlignedBuffer nonce_buffer;
public:
static const int RECEIVE_MTU = 2048;
Session( Base64Key s_key );
~Session();