Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For secure memory clearance, trying to use the native calls whenever #14

Merged
merged 1 commit into from Mar 27, 2018
Merged

For secure memory clearance, trying to use the native calls whenever #14

merged 1 commit into from Mar 27, 2018

Conversation

ghost
Copy link

@ghost ghost commented Jan 16, 2018

it is possible or a simple barrier.

@sneves
Copy link
Member

sneves commented Feb 15, 2018

Is the libtool.m4 change necessary, or would it suffice to take the configure.ac and blake2-impl.h changes?

@ghost
Copy link
Author

ghost commented Feb 15, 2018

I would not say necessary but better to cope with modern libtool but we can always discard it if you really wish.

@cemeyer
Copy link

cemeyer commented Mar 15, 2018

I would appreciate this patch, or something similar (to preferentially use explicit_bzero, at least).

In the FreeBSD kernel environment, memset() is implemented strangely. Additionally, we're stuck using old old 2007-era GPL2 binutils on some Tier 2 platforms. As a result, the existing secure_zero_memory construct creates a link error for PowerPC kernels:

ld: blake2s-ref.o(.text+0x2540): R_PPC_PLTREL24 reloc against local symbol
blake2s-ref.o: could not read symbols: Bad value
...
$ .../blake2s-ref.o
...
00002000 t memset
00000000 d memset_v.3522

(Yes, to some extent this is self-inflicted.)

This issue goes away when the following change is used:

static inline void secure_zero_memory(void *v, size_t n)
{
#ifdef __FreeBSD__
  explicit_bzero(v, n);
#else
  static void *(*const volatile memset_v)(void *, int, size_t) = &memset;
  memset_v(v, 0, n);
#endif
}

(This style was chosen to minimize diff without attempting to be fully general. I think David's patch is the better one to include here.)

Thanks!

@sneves sneves merged commit 620681a into BLAKE2:master Mar 27, 2018
@devnexen
Copy link

@cemeyer I saw earlier you commited your own changes on FreeBSD you can grab this version now if you wish.

@cemeyer
Copy link

cemeyer commented Mar 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants