Page MenuHomeFreeBSD

D41211.id125253.diff
No OneTemporary

D41211.id125253.diff

diff --git a/sys/opencrypto/cbc_mac.c b/sys/opencrypto/cbc_mac.c
--- a/sys/opencrypto/cbc_mac.c
+++ b/sys/opencrypto/cbc_mac.c
@@ -40,19 +40,16 @@
xor_and_encrypt(struct aes_cbc_mac_ctx *ctx,
const uint8_t *src, uint8_t *dst)
{
- const uint64_t *b1;
- uint64_t *b2;
- uint64_t temp_block[CCM_CBC_BLOCK_LEN/sizeof(uint64_t)];
+#define NWORDS (CCM_CBC_BLOCK_LEN / sizeof(uint64_t))
+ uint64_t b1[NWORDS], b2[NWORDS], temp[NWORDS];
- b1 = (const uint64_t*)src;
- b2 = (uint64_t*)dst;
+ memcpy(b1, src, CCM_CBC_BLOCK_LEN);
+ memcpy(b2, dst, CCM_CBC_BLOCK_LEN);
- for (size_t count = 0;
- count < CCM_CBC_BLOCK_LEN/sizeof(uint64_t);
- count++) {
- temp_block[count] = b1[count] ^ b2[count];
- }
- rijndaelEncrypt(ctx->keysched, ctx->rounds, (void*)temp_block, dst);
+ for (size_t count = 0; count < NWORDS; count++)
+ temp[count] = b1[count] ^ b2[count];
+ rijndaelEncrypt(ctx->keysched, ctx->rounds, (void *)temp, dst);
+#undef NWORDS
}
void

File Metadata

Mime Type
text/plain
Expires
Mon, Feb 9, 3:05 AM (8 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28528953
Default Alt Text
D41211.id125253.diff (964 B)

Event Timeline