Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b8ebbcc8 authored by Doug Zongker's avatar Doug Zongker Committed by Android Git Automerger
Browse files

am 90b06ac7: only use faster SHA-1 code on machines with good libc

Merge commit '90b06ac7' into eclair-plus-aosp

* commit '90b06ac7':
  only use faster SHA-1 code on machines with good libc
parents 70670ff0 90b06ac7
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@
#define _EMBEDDED_SHA_H_

#include <inttypes.h>
#include <endian.h>

#ifdef __cplusplus
extern "C" {
@@ -38,7 +37,7 @@ extern "C" {
typedef struct SHA_CTX {
    uint64_t count;
    uint32_t state[5];
#if __BYTE_ORDER == __LITTLE_ENDIAN
#if defined(HAVE_ENDIAN_H) && defined(HAVE_LITTLE_ENDIAN)
    union {
        uint8_t b[64];
        uint32_t w[16];
+8 −6
Original line number Diff line number Diff line
@@ -25,13 +25,15 @@
** ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include <byteswap.h>
#include <endian.h>
#include <memory.h>

#include "mincrypt/sha.h"

#if __BYTE_ORDER == __LITTLE_ENDIAN
// Some machines lack byteswap.h and endian.h.  These have to use the
// slower code, even if they're little-endian.

#if defined(HAVE_ENDIAN_H) && defined(HAVE_LITTLE_ENDIAN)

#include <byteswap.h>
#include <memory.h>

// This version is about 28% faster than the generic version below,
// but assumes little-endianness.
@@ -186,7 +188,7 @@ const uint8_t* SHA_final(SHA_CTX* ctx) {
    return ctx->buf.b;
}

#else   // __BYTE_ORDER == BIG_ENDIAN
#else   // #if defined(HAVE_ENDIAN_H) && defined(HAVE_LITTLE_ENDIAN)

#define rol(bits, value) (((value) << (bits)) | ((value) >> (32 - (bits))))