crypto.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* Copyright (c) 2014, Google Inc.
  2. *
  3. * Permission to use, copy, modify, and/or distribute this software for any
  4. * purpose with or without fee is hereby granted, provided that the above
  5. * copyright notice and this permission notice appear in all copies.
  6. *
  7. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  8. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  9. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
  10. * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  11. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  12. * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
  13. * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
  14. #include <GFp/cpu.h>
  15. #include "internal.h"
  16. // Our assembly does not use the GOT to reference symbols, which means
  17. // references to visible symbols will often require a TEXTREL. This is
  18. // undesirable, so all assembly-referenced symbols should be hidden. CPU
  19. // capabilities are the only such symbols defined in C. Explicitly hide them,
  20. // rather than rely on being built with -fvisibility=hidden.
  21. #if defined(OPENSSL_WINDOWS)
  22. #define HIDDEN
  23. #else
  24. #define HIDDEN __attribute__((visibility("hidden")))
  25. #endif
  26. #if defined(OPENSSL_X86) || defined(OPENSSL_X86_64)
  27. // This value must be explicitly initialised to zero in order to work around a
  28. // bug in libtool or the linker on OS X.
  29. //
  30. // If not initialised then it becomes a "common symbol". When put into an
  31. // archive, linking on OS X will fail to resolve common symbols. By
  32. // initialising it to zero, it becomes a "data symbol", which isn't so
  33. // affected.
  34. HIDDEN uint32_t GFp_ia32cap_P[4] = {0};
  35. #endif