BLAKE2 / libb2

C library providing BLAKE2b, BLAKE2s, BLAKE2bp, BLAKE2sp
Creative Commons Zero v1.0 Universal
132 stars 47 forks source link

Use memcpy for possibly-unaligned loads and stores. #21

Closed benjaminp closed 6 years ago

benjaminp commented 6 years ago

The core change is ported from https://github.com/BLAKE2/BLAKE2/commit/b8024d53e77374d4a5b7868aa17cac3f11c33581.

This let's us remove the ALIGNED_ACCESS_REQUIRED configure check. This isn't a very good thing to check through configure because it requires running an executable. That doesn't work for cross compiles.

divinity76 commented 5 years ago

otoh, changing from a simple mov instruction or 2 into actual function calls probably isn't all that good for performance?

BurningEnlightenment commented 5 years ago

@divinity76 the compiler should be able to optimize these memcpy calls into simple mov instructions (e.g. godbolt). Do you have any examples where the compiler does not produce optimal code?

divinity76 commented 5 years ago

@BurningEnlightenment no, and i'm probably worrying about nothing, nevermind ^^