refactor: use AARU_ALIGN16 macro for 16-byte alignment in crc64_clmul.c and crc64_vmull.c

This commit is contained in:
2026-04-04 15:11:13 +01:00
parent 2aac1ce89c
commit 9c1d6d5e6f
2 changed files with 11 additions and 2 deletions

View File

@@ -28,6 +28,9 @@
#ifdef _MSC_VER
#include <intrin.h>
#define AARU_ALIGN16 __declspec(align(16))
#else
#define AARU_ALIGN16 __attribute__((aligned(16)))
#endif
#include <aaruformat.h>
@@ -196,7 +199,7 @@ AARU_EXPORT CLMUL uint64_t AARU_CALL aaruf_crc64_clmul(const uint64_t crc, const
// For the second block, safely handle the case where it extends past the actual data
// Always use safe copy approach to avoid ASan buffer overflow detection
uint8_t temp[16] __attribute__((aligned(16))) = {0};
AARU_ALIGN16 uint8_t temp[16] = {0};
const uint8_t *next_block_addr = (const uint8_t *)(aligned_data + 1);
// Only copy bytes that are actually within the original buffer

View File

@@ -23,6 +23,12 @@
#include <stdint.h>
#include <string.h>
#if defined(_MSC_VER)
#define AARU_ALIGN16 __declspec(align(16))
#else
#define AARU_ALIGN16 __attribute__((aligned(16)))
#endif
#include <aaruformat.h>
#include "arm_vmull.h"
@@ -170,7 +176,7 @@ AARU_EXPORT TARGET_WITH_SIMD uint64_t AARU_CALL aaruf_crc64_vmull(uint64_t previ
// For the second block, always use safe copy to avoid buffer overflow
// The algorithm expects to read up to alignedEnd, but ASan prevents over-reading
uint8_t temp[16] __attribute__((aligned(16))) = {0};
AARU_ALIGN16 uint8_t temp[16] = {0};
const uint8_t *nextBlockAddr = (const uint8_t *)(alignedData + 1);
// Only copy bytes that are actually within the original buffer