Fix alignment problem under clang (per nelhage)

This commit is contained in:
Keith Winstein
2012-02-19 21:48:59 -05:00
parent 11a80b7032
commit b06204e72b
+4 -2
View File
@@ -178,12 +178,14 @@ string Session::encrypt( Message plaintext )
memcpy( pt, plaintext.text.data(), plaintext.text.size() );
if ( (uint64_t( plaintext.nonce.data() ) & 0xf) != 0 ) {
Nonce __attribute__((__aligned__ (16))) nonce( plaintext.nonce );
if ( (uint64_t( nonce.data() ) & 0xf) != 0 ) {
throw CryptoException( "Bad alignment." );
}
if ( ciphertext_len != ae_encrypt( ctx, /* ctx */
plaintext.nonce.data(), /* nonce */
nonce.data(), /* nonce */
pt, /* pt */
pt_len, /* pt_len */
NULL, /* ad */