We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8de74af commit a03ba01Copy full SHA for a03ba01
src/crypto/ocb.cc
@@ -630,7 +630,17 @@ ae_ctx* ae_allocate(void *misc)
630
#if (__SSE2__ && !_M_X64 && !_M_AMD64 && !__amd64__)
631
p = _mm_malloc(sizeof(ae_ctx),16);
632
#elif (__ALTIVEC__ && !__PPC64__)
633
- if (posix_memalign(&p,16,sizeof(ae_ctx)) != 0) p = NULL;
+ #if HAVE_POSIX_MEMALIGN
634
+ if (posix_memalign(&p,16,sizeof(ae_ctx)) != 0) p = NULL;
635
+ #else
636
+ // Probably building on OS X, which provides an aligned malloc()
637
+ if (!(p = malloc(sizeof(ae_ctx)))) p = NULL;
638
+ if ((uintptr_t)p & 0xF) {
639
+ // We didn't get an aligned pointer (should never happen)
640
+ free(p);
641
+ p = NULL;
642
+ }
643
+ #endif
644
#else
645
p = malloc(sizeof(ae_ctx));
646
#endif
0 commit comments