Просмотр исходного кода

Revert "Use uint128_t and __asm__ in clang-cl."

This reverts commit f6942f0d22.

Reason for revert: This doesn't actually work in clang-cl. I
forgot we didn't have the clang-cl try bots enabled! :-( I
believe __asm__ is still okay, but I'll try it by hand
tomorrow.

Original change's description:
> Use uint128_t and __asm__ in clang-cl.
> 
> clang-cl does not define __GNUC__ but is still a functioning clang. We
> should be able to use our uint128_t and __asm__ code in it on Windows.
> 
> Change-Id: I67310ee68baa0c0c947b2441c265b019ef12af7e
> Reviewed-on: https://boringssl-review.googlesource.com/22184
> Commit-Queue: Adam Langley <agl@google.com>
> Reviewed-by: Adam Langley <agl@google.com>
> CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>

TBR=agl@google.com,davidben@google.com

Change-Id: I5c7e0391cd9c2e8cc0dfde37e174edaf5d17db22
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://boringssl-review.googlesource.com/22224
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
kris/onging/CECPQ3_patch15
David Benjamin 7 лет назад
committed by CQ bot account: commit-bot@chromium.org
Родитель
Сommit
cba7987978
7 измененных файлов: 26 добавлений и 28 удалений
  1. +2
    -3
      crypto/fipsmodule/bn/asm/x86_64-gcc.c
  2. +12
    -12
      crypto/fipsmodule/bn/div.c
  3. +1
    -2
      crypto/fipsmodule/bn/generic.c
  4. +1
    -1
      crypto/fipsmodule/bn/internal.h
  5. +7
    -0
      crypto/fipsmodule/ec/ec.c
  6. +0
    -7
      crypto/fipsmodule/ec/internal.h
  7. +3
    -3
      crypto/fipsmodule/ec/p256-64.c

+ 2
- 3
crypto/fipsmodule/bn/asm/x86_64-gcc.c Просмотреть файл

@@ -53,8 +53,7 @@
#include <openssl/bn.h>

// TODO(davidben): Get this file working on Windows x64.
#if !defined(OPENSSL_NO_ASM) && defined(OPENSSL_X86_64) && \
(defined(__GNUC__) || defined(__clang__))
#if !defined(OPENSSL_NO_ASM) && defined(OPENSSL_X86_64) && defined(__GNUC__)

#include "../internal.h"

@@ -535,4 +534,4 @@ void bn_sqr_comba4(BN_ULONG *r, const BN_ULONG *a) {
#undef mul_add_c2
#undef sqr_add_c2

#endif // !NO_ASM && X86_64 && (__GNUC__ || __clang__)
#endif // !NO_ASM && X86_64 && __GNUC__

+ 12
- 12
crypto/fipsmodule/bn/div.c Просмотреть файл

@@ -155,18 +155,18 @@ static inline void bn_div_rem_words(BN_ULONG *quotient_out, BN_ULONG *rem_out,
//
// These issues aren't specific to x86 and x86_64, so it might be worthwhile
// to add more assembly language implementations.
#if !defined(OPENSSL_NO_ASM) && defined(OPENSSL_X86) && \
(defined(__GNUC__) || defined(__clang__))
__asm__ volatile("divl %4"
: "=a"(*quotient_out), "=d"(*rem_out)
: "a"(n1), "d"(n0), "rm"(d0)
: "cc");
#elif !defined(OPENSSL_NO_ASM) && defined(OPENSSL_X86_64) && \
(defined(__GNUC__) || defined(__clang__))
__asm__ volatile("divq %4"
: "=a"(*quotient_out), "=d"(*rem_out)
: "a"(n1), "d"(n0), "rm"(d0)
: "cc");
#if !defined(OPENSSL_NO_ASM) && defined(OPENSSL_X86) && defined(__GNUC__)
__asm__ volatile (
"divl %4"
: "=a"(*quotient_out), "=d"(*rem_out)
: "a"(n1), "d"(n0), "rm"(d0)
: "cc" );
#elif !defined(OPENSSL_NO_ASM) && defined(OPENSSL_X86_64) && defined(__GNUC__)
__asm__ volatile (
"divq %4"
: "=a"(*quotient_out), "=d"(*rem_out)
: "a"(n1), "d"(n0), "rm"(d0)
: "cc" );
#else
#if defined(BN_ULLONG)
BN_ULLONG n = (((BN_ULLONG)n0) << BN_BITS2) | n1;


+ 1
- 2
crypto/fipsmodule/bn/generic.c Просмотреть файл

@@ -64,8 +64,7 @@
// This file has two other implementations: x86 assembly language in
// asm/bn-586.pl and x86_64 inline assembly in asm/x86_64-gcc.c.
#if defined(OPENSSL_NO_ASM) || \
!(defined(OPENSSL_X86) || \
(defined(OPENSSL_X86_64) && (defined(__GNUC__) || defined(__clang__))))
!(defined(OPENSSL_X86) || (defined(OPENSSL_X86_64) && defined(__GNUC__)))

#ifdef BN_ULLONG
#define mul_add(r, a, w, c) \


+ 1
- 1
crypto/fipsmodule/bn/internal.h Просмотреть файл

@@ -140,7 +140,7 @@ extern "C" {

#if defined(OPENSSL_64_BIT)

#if !defined(_MSC_VER) || defined(__clang__)
#if !defined(_MSC_VER)
// MSVC doesn't support two-word integers on 64-bit.
#define BN_ULLONG uint128_t
#endif


+ 7
- 0
crypto/fipsmodule/ec/ec.c Просмотреть файл

@@ -212,6 +212,13 @@ static const uint8_t kP521Params[6 * 66] = {
0xB7, 0x1E, 0x91, 0x38, 0x64, 0x09,
};

// MSan appears to have a bug that causes code to be miscompiled in opt mode.
// While that is being looked at, don't run the uint128_t code under MSan.
#if defined(OPENSSL_64_BIT) && !defined(OPENSSL_WINDOWS) && \
!defined(MEMORY_SANITIZER)
#define BORINGSSL_USE_INT128_CODE
#endif

DEFINE_METHOD_FUNCTION(struct built_in_curves, OPENSSL_built_in_curves) {
// 1.3.132.0.35
static const uint8_t kOIDP521[] = {0x2b, 0x81, 0x04, 0x00, 0x23};


+ 0
- 7
crypto/fipsmodule/ec/internal.h Просмотреть файл

@@ -79,13 +79,6 @@ extern "C" {
#endif


// MSan appears to have a bug that causes code to be miscompiled in opt mode.
// While that is being looked at, don't run the uint128_t code under MSan.
#if defined(OPENSSL_64_BIT) && (!defined(_MSC_VER) || defined(__clang__)) && \
!defined(MEMORY_SANITIZER)
#define BORINGSSL_USE_INT128_CODE
#endif

struct ec_method_st {
int (*group_init)(EC_GROUP *);
void (*group_finish)(EC_GROUP *);


+ 3
- 3
crypto/fipsmodule/ec/p256-64.c Просмотреть файл

@@ -21,6 +21,8 @@

#include <openssl/base.h>

#if defined(OPENSSL_64_BIT) && !defined(OPENSSL_WINDOWS)

#include <openssl/bn.h>
#include <openssl/ec.h>
#include <openssl/err.h>
@@ -33,8 +35,6 @@
#include "internal.h"


#if defined(BORINGSSL_USE_INT128_CODE)

// The underlying field. P256 operates over GF(2^256-2^224+2^192+2^96-1). We
// can serialise an element of this field into 32 bytes. We call this an
// felem_bytearray.
@@ -1705,4 +1705,4 @@ DEFINE_METHOD_FUNCTION(EC_METHOD, EC_GFp_nistp256_method) {
out->field_decode = NULL;
};

#endif // BORINGSSL_USE_INT128_CODE
#endif // 64_BIT && !WINDOWS

Загрузка…
Отмена
Сохранить