diff --git a/CMakeLists.txt b/CMakeLists.txt index 23116d4..94b5d54 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -128,7 +128,6 @@ ELSE(WIN32) IF(NOT APPLE) # Linux or other unix - SET(SALSA_SRC vendor/salsa20/salsa20.s) SET(rt_library rt ) SET(pthread_library pthread) ENDIF(NOT APPLE) @@ -212,7 +211,6 @@ set( fc_sources ${ECC_REST} src/crypto/elliptic_${ECC_IMPL}.cpp src/crypto/rand.cpp - src/crypto/salsa20.cpp src/network/tcp_socket.cpp src/network/udp_socket.cpp src/network/udt_socket.cpp @@ -230,14 +228,8 @@ set( fc_sources src/compress/lzma.cpp vendor/cyoencode-1.0.2/src/CyoDecode.c vendor/cyoencode-1.0.2/src/CyoEncode.c - #vendor/salsa20/ecrypt.c - ${SALSA_SRC} ) - SET_PROPERTY( SOURCE - vendor/salsa20/salsa20.s - PROPERTY LANGUAGE C) - file( GLOB_RECURSE fc_headers ${CMAKE_CURRENT_SOURCE_DIR} *.hpp *.h ) set( sources @@ -309,7 +301,6 @@ target_include_directories(fc ${CMAKE_CURRENT_SOURCE_DIR}/vendor/boost_1.51/include ${CMAKE_CURRENT_SOURCE_DIR}/vendor/cyoencode-1.0.2/src ${CMAKE_CURRENT_SOURCE_DIR}/vendor/easylzma/src - ${CMAKE_CURRENT_SOURCE_DIR}/vendor/salsa20 ${CMAKE_CURRENT_SOURCE_DIR}/vendor/udt4/src ${CMAKE_CURRENT_SOURCE_DIR}/vendor/websocketpp ${CMAKE_CURRENT_SOURCE_DIR}/vendor/secp256k1-zkp diff --git a/include/fc/crypto/salsa20.hpp b/include/fc/crypto/salsa20.hpp deleted file mode 100644 index a6840a2..0000000 --- a/include/fc/crypto/salsa20.hpp +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once -#include - -namespace fc -{ - void salsa20_encrypt( const fc::sha256& key, uint64_t iv, const char* plain, char* cipher, uint64_t len ); - void salsa20_decrypt( const fc::sha256& key, uint64_t iv, const char* cipher, char* plain, uint64_t len ); -} diff --git a/src/crypto/salsa20.cpp b/src/crypto/salsa20.cpp deleted file mode 100644 index d9c7842..0000000 --- a/src/crypto/salsa20.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include -extern "C" { -#include -} - -namespace fc -{ - static bool salsa20_init = []() -> bool { ECRYPT_init(); return true; }(); - - void salsa20_encrypt( const fc::sha256& key, uint64_t iv, const char* plain, char* cipher, uint64_t len ) - { - ECRYPT_ctx ctx; - ECRYPT_keysetup( &ctx, (unsigned char*)&key, ECRYPT_MAXIVSIZE, ECRYPT_MAXKEYSIZE ); - ECRYPT_ivsetup( &ctx, (unsigned char*)&iv ); - - ECRYPT_encrypt_bytes( &ctx, (const unsigned char*)plain, (unsigned char*)cipher, len ); - } - void salsa20_decrypt( const fc::sha256& key, uint64_t iv, const char* cipher, char* plain, uint64_t len ) - { - } -} diff --git a/vendor/salsa20/ecrypt-config.h b/vendor/salsa20/ecrypt-config.h deleted file mode 100644 index a37e5e2..0000000 --- a/vendor/salsa20/ecrypt-config.h +++ /dev/null @@ -1,272 +0,0 @@ -/* ecrypt-config.h */ - -/* *** Normally, it should not be necessary to edit this file. *** */ - -#ifndef ECRYPT_CONFIG -#define ECRYPT_CONFIG - -/* ------------------------------------------------------------------------- */ - -/* Guess the endianness of the target architecture. */ - -/* - * The LITTLE endian machines: - */ -#if defined(__ultrix) /* Older MIPS */ -#define ECRYPT_LITTLE_ENDIAN -#elif defined(__alpha) /* Alpha */ -#define ECRYPT_LITTLE_ENDIAN -#elif defined(i386) /* x86 (gcc) */ -#define ECRYPT_LITTLE_ENDIAN -#elif defined(__i386) /* x86 (gcc) */ -#define ECRYPT_LITTLE_ENDIAN -#elif defined(_M_IX86) /* x86 (MSC, Borland) */ -#define ECRYPT_LITTLE_ENDIAN -#elif defined(_MSC_VER) /* x86 (surely MSC) */ -#define ECRYPT_LITTLE_ENDIAN -#elif defined(__INTEL_COMPILER) /* x86 (surely Intel compiler icl.exe) */ -#define ECRYPT_LITTLE_ENDIAN - -/* - * The BIG endian machines: - */ -#elif defined(sun) /* Newer Sparc's */ -#define ECRYPT_BIG_ENDIAN -#elif defined(__ppc__) /* PowerPC */ -#define ECRYPT_BIG_ENDIAN - -/* - * Finally machines with UNKNOWN endianness: - */ -#elif defined (_AIX) /* RS6000 */ -#define ECRYPT_UNKNOWN -#elif defined(__hpux) /* HP-PA */ -#define ECRYPT_UNKNOWN -#elif defined(__aux) /* 68K */ -#define ECRYPT_UNKNOWN -#elif defined(__dgux) /* 88K (but P6 in latest boxes) */ -#define ECRYPT_UNKNOWN -#elif defined(__sgi) /* Newer MIPS */ -#define ECRYPT_UNKNOWN -#else /* Any other processor */ -#define ECRYPT_UNKNOWN -#endif - -/* ------------------------------------------------------------------------- */ - -/* - * Find minimal-width types to store 8-bit, 16-bit, 32-bit, and 64-bit - * integers. - * - * Note: to enable 64-bit types on 32-bit compilers, it might be - * necessary to switch from ISO C90 mode to ISO C99 mode (e.g., gcc - * -std=c99). - */ - -#include - -/* --- check char --- */ - -#if (UCHAR_MAX / 0xFU > 0xFU) -#ifndef I8T -#define I8T char -#define U8C(v) (v##U) - -#if (UCHAR_MAX == 0xFFU) -#define ECRYPT_I8T_IS_BYTE -#endif - -#endif - -#if (UCHAR_MAX / 0xFFU > 0xFFU) -#ifndef I16T -#define I16T char -#define U16C(v) (v##U) -#endif - -#if (UCHAR_MAX / 0xFFFFU > 0xFFFFU) -#ifndef I32T -#define I32T char -#define U32C(v) (v##U) -#endif - -#if (UCHAR_MAX / 0xFFFFFFFFU > 0xFFFFFFFFU) -#ifndef I64T -#define I64T char -#define U64C(v) (v##U) -#define ECRYPT_NATIVE64 -#endif - -#endif -#endif -#endif -#endif - -/* --- check short --- */ - -#if (USHRT_MAX / 0xFU > 0xFU) -#ifndef I8T -#define I8T short -#define U8C(v) (v##U) - -#if (USHRT_MAX == 0xFFU) -#define ECRYPT_I8T_IS_BYTE -#endif - -#endif - -#if (USHRT_MAX / 0xFFU > 0xFFU) -#ifndef I16T -#define I16T short -#define U16C(v) (v##U) -#endif - -#if (USHRT_MAX / 0xFFFFU > 0xFFFFU) -#ifndef I32T -#define I32T short -#define U32C(v) (v##U) -#endif - -#if (USHRT_MAX / 0xFFFFFFFFU > 0xFFFFFFFFU) -#ifndef I64T -#define I64T short -#define U64C(v) (v##U) -#define ECRYPT_NATIVE64 -#endif - -#endif -#endif -#endif -#endif - -/* --- check int --- */ - -#if (UINT_MAX / 0xFU > 0xFU) -#ifndef I8T -#define I8T int -#define U8C(v) (v##U) - -#if (ULONG_MAX == 0xFFU) -#define ECRYPT_I8T_IS_BYTE -#endif - -#endif - -#if (UINT_MAX / 0xFFU > 0xFFU) -#ifndef I16T -#define I16T int -#define U16C(v) (v##U) -#endif - -#if (UINT_MAX / 0xFFFFU > 0xFFFFU) -#ifndef I32T -#define I32T int -#define U32C(v) (v##U) -#endif - -#if (UINT_MAX / 0xFFFFFFFFU > 0xFFFFFFFFU) -#ifndef I64T -#define I64T int -#define U64C(v) (v##U) -#define ECRYPT_NATIVE64 -#endif - -#endif -#endif -#endif -#endif - -/* --- check long --- */ - -#if (ULONG_MAX / 0xFUL > 0xFUL) -#ifndef I8T -#define I8T long -#define U8C(v) (v##UL) - -#if (ULONG_MAX == 0xFFUL) -#define ECRYPT_I8T_IS_BYTE -#endif - -#endif - -#if (ULONG_MAX / 0xFFUL > 0xFFUL) -#ifndef I16T -#define I16T long -#define U16C(v) (v##UL) -#endif - -#if (ULONG_MAX / 0xFFFFUL > 0xFFFFUL) -#ifndef I32T -#define I32T long -#define U32C(v) (v##UL) -#endif - -#if (ULONG_MAX / 0xFFFFFFFFUL > 0xFFFFFFFFUL) -#ifndef I64T -#define I64T long -#define U64C(v) (v##UL) -#define ECRYPT_NATIVE64 -#endif - -#endif -#endif -#endif -#endif - -/* --- check long long --- */ - -#ifdef ULLONG_MAX - -#if (ULLONG_MAX / 0xFULL > 0xFULL) -#ifndef I8T -#define I8T long long -#define U8C(v) (v##ULL) - -#if (ULLONG_MAX == 0xFFULL) -#define ECRYPT_I8T_IS_BYTE -#endif - -#endif - -#if (ULLONG_MAX / 0xFFULL > 0xFFULL) -#ifndef I16T -#define I16T long long -#define U16C(v) (v##ULL) -#endif - -#if (ULLONG_MAX / 0xFFFFULL > 0xFFFFULL) -#ifndef I32T -#define I32T long long -#define U32C(v) (v##ULL) -#endif - -#if (ULLONG_MAX / 0xFFFFFFFFULL > 0xFFFFFFFFULL) -#ifndef I64T -#define I64T long long -#define U64C(v) (v##ULL) -#endif - -#endif -#endif -#endif -#endif - -#endif - -/* --- check __int64 --- */ - -#ifdef _UI64_MAX - -#if (_UI64_MAX / 0xFFFFFFFFui64 > 0xFFFFFFFFui64) -#ifndef I64T -#define I64T __int64 -#define U64C(v) (v##ui64) -#endif - -#endif - -#endif - -/* ------------------------------------------------------------------------- */ - -#endif diff --git a/vendor/salsa20/ecrypt-machine.h b/vendor/salsa20/ecrypt-machine.h deleted file mode 100644 index 3e550d0..0000000 --- a/vendor/salsa20/ecrypt-machine.h +++ /dev/null @@ -1,46 +0,0 @@ -/* ecrypt-machine.h */ - -/* - * This file is included by 'ecrypt-portable.h'. It allows to override - * the default macros for specific platforms. Please carefully check - * the machine code generated by your compiler (with optimisations - * turned on) before deciding to edit this file. - */ - -/* ------------------------------------------------------------------------- */ - -#if (defined(ECRYPT_DEFAULT_ROT) && !defined(ECRYPT_MACHINE_ROT)) - -#define ECRYPT_MACHINE_ROT - -#if (defined(WIN32) && defined(_MSC_VER)) - -#undef ROTL32 -#undef ROTR32 -#undef ROTL64 -#undef ROTR64 - -#include - -#define ROTL32(v, n) _lrotl(v, n) -#define ROTR32(v, n) _lrotr(v, n) -#define ROTL64(v, n) _rotl64(v, n) -#define ROTR64(v, n) _rotr64(v, n) - -#endif - -#endif - -/* ------------------------------------------------------------------------- */ - -#if (defined(ECRYPT_DEFAULT_SWAP) && !defined(ECRYPT_MACHINE_SWAP)) - -#define ECRYPT_MACHINE_SWAP - -/* - * If you want to overwrite the default swap macros, put it here. And so on. - */ - -#endif - -/* ------------------------------------------------------------------------- */ diff --git a/vendor/salsa20/ecrypt-portable.h b/vendor/salsa20/ecrypt-portable.h deleted file mode 100644 index 72a9283..0000000 --- a/vendor/salsa20/ecrypt-portable.h +++ /dev/null @@ -1,303 +0,0 @@ -/* ecrypt-portable.h */ - -/* - * WARNING: the conversions defined below are implemented as macros, - * and should be used carefully. They should NOT be used with - * parameters which perform some action. E.g., the following two lines - * are not equivalent: - * - * 1) ++x; y = ROTL32(x, n); - * 2) y = ROTL32(++x, n); - */ - -/* - * *** Please do not edit this file. *** - * - * The default macros can be overridden for specific architectures by - * editing 'ecrypt-machine.h'. - */ - -#ifndef ECRYPT_PORTABLE -#define ECRYPT_PORTABLE - -#include "ecrypt-config.h" - -/* ------------------------------------------------------------------------- */ - -/* - * The following types are defined (if available): - * - * u8: unsigned integer type, at least 8 bits - * u16: unsigned integer type, at least 16 bits - * u32: unsigned integer type, at least 32 bits - * u64: unsigned integer type, at least 64 bits - * - * s8, s16, s32, s64 -> signed counterparts of u8, u16, u32, u64 - * - * The selection of minimum-width integer types is taken care of by - * 'ecrypt-config.h'. Note: to enable 64-bit types on 32-bit - * compilers, it might be necessary to switch from ISO C90 mode to ISO - * C99 mode (e.g., gcc -std=c99). - */ - -#ifdef I8T -typedef signed I8T s8; -typedef unsigned I8T u8; -#endif - -#ifdef I16T -typedef signed I16T s16; -typedef unsigned I16T u16; -#endif - -#ifdef I32T -typedef signed I32T s32; -typedef unsigned I32T u32; -#endif - -#ifdef I64T -typedef signed I64T s64; -typedef unsigned I64T u64; -#endif - -/* - * The following macros are used to obtain exact-width results. - */ - -#define U8V(v) ((u8)(v) & U8C(0xFF)) -#define U16V(v) ((u16)(v) & U16C(0xFFFF)) -#define U32V(v) ((u32)(v) & U32C(0xFFFFFFFF)) -#define U64V(v) ((u64)(v) & U64C(0xFFFFFFFFFFFFFFFF)) - -/* ------------------------------------------------------------------------- */ - -/* - * The following macros return words with their bits rotated over n - * positions to the left/right. - */ - -#define ECRYPT_DEFAULT_ROT - -#define ROTL8(v, n) \ - (U8V((v) << (n)) | ((v) >> (8 - (n)))) - -#define ROTL16(v, n) \ - (U16V((v) << (n)) | ((v) >> (16 - (n)))) - -#define ROTL32(v, n) \ - (U32V((v) << (n)) | ((v) >> (32 - (n)))) - -#define ROTL64(v, n) \ - (U64V((v) << (n)) | ((v) >> (64 - (n)))) - -#define ROTR8(v, n) ROTL8(v, 8 - (n)) -#define ROTR16(v, n) ROTL16(v, 16 - (n)) -#define ROTR32(v, n) ROTL32(v, 32 - (n)) -#define ROTR64(v, n) ROTL64(v, 64 - (n)) - -#include "ecrypt-machine.h" - -/* ------------------------------------------------------------------------- */ - -/* - * The following macros return a word with bytes in reverse order. - */ - -#define ECRYPT_DEFAULT_SWAP - -#define SWAP16(v) \ - ROTL16(v, 8) - -#define SWAP32(v) \ - ((ROTL32(v, 8) & U32C(0x00FF00FF)) | \ - (ROTL32(v, 24) & U32C(0xFF00FF00))) - -#ifdef ECRYPT_NATIVE64 -#define SWAP64(v) \ - ((ROTL64(v, 8) & U64C(0x000000FF000000FF)) | \ - (ROTL64(v, 24) & U64C(0x0000FF000000FF00)) | \ - (ROTL64(v, 40) & U64C(0x00FF000000FF0000)) | \ - (ROTL64(v, 56) & U64C(0xFF000000FF000000))) -#else -#define SWAP64(v) \ - (((u64)SWAP32(U32V(v)) << 32) | (u64)SWAP32(U32V(v >> 32))) -#endif - -#include "ecrypt-machine.h" - -#define ECRYPT_DEFAULT_WTOW - -#ifdef ECRYPT_LITTLE_ENDIAN -#define U16TO16_LITTLE(v) (v) -#define U32TO32_LITTLE(v) (v) -#define U64TO64_LITTLE(v) (v) - -#define U16TO16_BIG(v) SWAP16(v) -#define U32TO32_BIG(v) SWAP32(v) -#define U64TO64_BIG(v) SWAP64(v) -#endif - -#ifdef ECRYPT_BIG_ENDIAN -#define U16TO16_LITTLE(v) SWAP16(v) -#define U32TO32_LITTLE(v) SWAP32(v) -#define U64TO64_LITTLE(v) SWAP64(v) - -#define U16TO16_BIG(v) (v) -#define U32TO32_BIG(v) (v) -#define U64TO64_BIG(v) (v) -#endif - -#include "ecrypt-machine.h" - -/* - * The following macros load words from an array of bytes with - * different types of endianness, and vice versa. - */ - -#define ECRYPT_DEFAULT_BTOW - -#if (!defined(ECRYPT_UNKNOWN) && defined(ECRYPT_I8T_IS_BYTE)) - -#define U8TO16_LITTLE(p) U16TO16_LITTLE(((u16*)(p))[0]) -#define U8TO32_LITTLE(p) U32TO32_LITTLE(((u32*)(p))[0]) -#define U8TO64_LITTLE(p) U64TO64_LITTLE(((u64*)(p))[0]) - -#define U8TO16_BIG(p) U16TO16_BIG(((u16*)(p))[0]) -#define U8TO32_BIG(p) U32TO32_BIG(((u32*)(p))[0]) -#define U8TO64_BIG(p) U64TO64_BIG(((u64*)(p))[0]) - -#define U16TO8_LITTLE(p, v) (((u16*)(p))[0] = U16TO16_LITTLE(v)) -#define U32TO8_LITTLE(p, v) (((u32*)(p))[0] = U32TO32_LITTLE(v)) -#define U64TO8_LITTLE(p, v) (((u64*)(p))[0] = U64TO64_LITTLE(v)) - -#define U16TO8_BIG(p, v) (((u16*)(p))[0] = U16TO16_BIG(v)) -#define U32TO8_BIG(p, v) (((u32*)(p))[0] = U32TO32_BIG(v)) -#define U64TO8_BIG(p, v) (((u64*)(p))[0] = U64TO64_BIG(v)) - -#else - -#define U8TO16_LITTLE(p) \ - (((u16)((p)[0]) ) | \ - ((u16)((p)[1]) << 8)) - -#define U8TO32_LITTLE(p) \ - (((u32)((p)[0]) ) | \ - ((u32)((p)[1]) << 8) | \ - ((u32)((p)[2]) << 16) | \ - ((u32)((p)[3]) << 24)) - -#ifdef ECRYPT_NATIVE64 -#define U8TO64_LITTLE(p) \ - (((u64)((p)[0]) ) | \ - ((u64)((p)[1]) << 8) | \ - ((u64)((p)[2]) << 16) | \ - ((u64)((p)[3]) << 24) | \ - ((u64)((p)[4]) << 32) | \ - ((u64)((p)[5]) << 40) | \ - ((u64)((p)[6]) << 48) | \ - ((u64)((p)[7]) << 56)) -#else -#define U8TO64_LITTLE(p) \ - ((u64)U8TO32_LITTLE(p) | ((u64)U8TO32_LITTLE((p) + 4) << 32)) -#endif - -#define U8TO16_BIG(p) \ - (((u16)((p)[0]) << 8) | \ - ((u16)((p)[1]) )) - -#define U8TO32_BIG(p) \ - (((u32)((p)[0]) << 24) | \ - ((u32)((p)[1]) << 16) | \ - ((u32)((p)[2]) << 8) | \ - ((u32)((p)[3]) )) - -#ifdef ECRYPT_NATIVE64 -#define U8TO64_BIG(p) \ - (((u64)((p)[0]) << 56) | \ - ((u64)((p)[1]) << 48) | \ - ((u64)((p)[2]) << 40) | \ - ((u64)((p)[3]) << 32) | \ - ((u64)((p)[4]) << 24) | \ - ((u64)((p)[5]) << 16) | \ - ((u64)((p)[6]) << 8) | \ - ((u64)((p)[7]) )) -#else -#define U8TO64_BIG(p) \ - (((u64)U8TO32_BIG(p) << 32) | (u64)U8TO32_BIG((p) + 4)) -#endif - -#define U16TO8_LITTLE(p, v) \ - do { \ - (p)[0] = U8V((v) ); \ - (p)[1] = U8V((v) >> 8); \ - } while (0) - -#define U32TO8_LITTLE(p, v) \ - do { \ - (p)[0] = U8V((v) ); \ - (p)[1] = U8V((v) >> 8); \ - (p)[2] = U8V((v) >> 16); \ - (p)[3] = U8V((v) >> 24); \ - } while (0) - -#ifdef ECRYPT_NATIVE64 -#define U64TO8_LITTLE(p, v) \ - do { \ - (p)[0] = U8V((v) ); \ - (p)[1] = U8V((v) >> 8); \ - (p)[2] = U8V((v) >> 16); \ - (p)[3] = U8V((v) >> 24); \ - (p)[4] = U8V((v) >> 32); \ - (p)[5] = U8V((v) >> 40); \ - (p)[6] = U8V((v) >> 48); \ - (p)[7] = U8V((v) >> 56); \ - } while (0) -#else -#define U64TO8_LITTLE(p, v) \ - do { \ - U32TO8_LITTLE((p), U32V((v) )); \ - U32TO8_LITTLE((p) + 4, U32V((v) >> 32)); \ - } while (0) -#endif - -#define U16TO8_BIG(p, v) \ - do { \ - (p)[0] = U8V((v) ); \ - (p)[1] = U8V((v) >> 8); \ - } while (0) - -#define U32TO8_BIG(p, v) \ - do { \ - (p)[0] = U8V((v) >> 24); \ - (p)[1] = U8V((v) >> 16); \ - (p)[2] = U8V((v) >> 8); \ - (p)[3] = U8V((v) ); \ - } while (0) - -#ifdef ECRYPT_NATIVE64 -#define U64TO8_BIG(p, v) \ - do { \ - (p)[0] = U8V((v) >> 56); \ - (p)[1] = U8V((v) >> 48); \ - (p)[2] = U8V((v) >> 40); \ - (p)[3] = U8V((v) >> 32); \ - (p)[4] = U8V((v) >> 24); \ - (p)[5] = U8V((v) >> 16); \ - (p)[6] = U8V((v) >> 8); \ - (p)[7] = U8V((v) ); \ - } while (0) -#else -#define U64TO8_BIG(p, v) \ - do { \ - U32TO8_BIG((p), U32V((v) >> 32)); \ - U32TO8_BIG((p) + 4, U32V((v) )); \ - } while (0) -#endif - -#endif - -#include "ecrypt-machine.h" - -/* ------------------------------------------------------------------------- */ - -#endif diff --git a/vendor/salsa20/ecrypt-sync.h b/vendor/salsa20/ecrypt-sync.h deleted file mode 100644 index 7a837cb..0000000 --- a/vendor/salsa20/ecrypt-sync.h +++ /dev/null @@ -1,279 +0,0 @@ -/* ecrypt-sync.h */ - -/* - * Header file for synchronous stream ciphers without authentication - * mechanism. - * - * *** Please only edit parts marked with "[edit]". *** - */ - -#ifndef ECRYPT_SYNC -#define ECRYPT_SYNC - -#include "ecrypt-portable.h" - -/* ------------------------------------------------------------------------- */ - -/* Cipher parameters */ - -/* - * The name of your cipher. - */ -#define ECRYPT_NAME "Salsa20" /* [edit] */ -#define ECRYPT_PROFILE "S!_H." - -/* - * Specify which key and IV sizes are supported by your cipher. A user - * should be able to enumerate the supported sizes by running the - * following code: - * - * for (i = 0; ECRYPT_KEYSIZE(i) <= ECRYPT_MAXKEYSIZE; ++i) - * { - * keysize = ECRYPT_KEYSIZE(i); - * - * ... - * } - * - * All sizes are in bits. - */ - -#define ECRYPT_MAXKEYSIZE 256 /* [edit] */ -#define ECRYPT_KEYSIZE(i) (128 + (i)*128) /* [edit] */ - -#define ECRYPT_MAXIVSIZE 64 /* [edit] */ -#define ECRYPT_IVSIZE(i) (64 + (i)*64) /* [edit] */ - -/* ------------------------------------------------------------------------- */ - -/* Data structures */ - -/* - * ECRYPT_ctx is the structure containing the representation of the - * internal state of your cipher. - */ - -typedef struct -{ - u32 input[16]; /* could be compressed */ - /* - * [edit] - * - * Put here all state variable needed during the encryption process. - */ -} ECRYPT_ctx; - -/* ------------------------------------------------------------------------- */ - -/* Mandatory functions */ - -/* - * Key and message independent initialization. This function will be - * called once when the program starts (e.g., to build expanded S-box - * tables). - */ -void ECRYPT_init(); - -/* - * Key setup. It is the user's responsibility to select the values of - * keysize and ivsize from the set of supported values specified - * above. - */ -void ECRYPT_keysetup( - ECRYPT_ctx* ctx, - const u8* key, - u32 keysize, /* Key size in bits. */ - u32 ivsize); /* IV size in bits. */ - -/* - * IV setup. After having called ECRYPT_keysetup(), the user is - * allowed to call ECRYPT_ivsetup() different times in order to - * encrypt/decrypt different messages with the same key but different - * IV's. - */ -void ECRYPT_ivsetup( - ECRYPT_ctx* ctx, - const u8* iv); - -/* - * Encryption/decryption of arbitrary length messages. - * - * For efficiency reasons, the API provides two types of - * encrypt/decrypt functions. The ECRYPT_encrypt_bytes() function - * (declared here) encrypts byte strings of arbitrary length, while - * the ECRYPT_encrypt_blocks() function (defined later) only accepts - * lengths which are multiples of ECRYPT_BLOCKLENGTH. - * - * The user is allowed to make multiple calls to - * ECRYPT_encrypt_blocks() to incrementally encrypt a long message, - * but he is NOT allowed to make additional encryption calls once he - * has called ECRYPT_encrypt_bytes() (unless he starts a new message - * of course). For example, this sequence of calls is acceptable: - * - * ECRYPT_keysetup(); - * - * ECRYPT_ivsetup(); - * ECRYPT_encrypt_blocks(); - * ECRYPT_encrypt_blocks(); - * ECRYPT_encrypt_bytes(); - * - * ECRYPT_ivsetup(); - * ECRYPT_encrypt_blocks(); - * ECRYPT_encrypt_blocks(); - * - * ECRYPT_ivsetup(); - * ECRYPT_encrypt_bytes(); - * - * The following sequence is not: - * - * ECRYPT_keysetup(); - * ECRYPT_ivsetup(); - * ECRYPT_encrypt_blocks(); - * ECRYPT_encrypt_bytes(); - * ECRYPT_encrypt_blocks(); - */ - -void ECRYPT_encrypt_bytes( - ECRYPT_ctx* ctx, - const u8* plaintext, - u8* ciphertext, - u32 msglen); /* Message length in bytes. */ - -void ECRYPT_decrypt_bytes( - ECRYPT_ctx* ctx, - const u8* ciphertext, - u8* plaintext, - u32 msglen); /* Message length in bytes. */ - -/* ------------------------------------------------------------------------- */ - -/* Optional features */ - -/* - * For testing purposes it can sometimes be useful to have a function - * which immediately generates keystream without having to provide it - * with a zero plaintext. If your cipher cannot provide this function - * (e.g., because it is not strictly a synchronous cipher), please - * reset the ECRYPT_GENERATES_KEYSTREAM flag. - */ - -#define ECRYPT_GENERATES_KEYSTREAM -#ifdef ECRYPT_GENERATES_KEYSTREAM - -void ECRYPT_keystream_bytes( - ECRYPT_ctx* ctx, - u8* keystream, - u32 length); /* Length of keystream in bytes. */ - -#endif - -/* ------------------------------------------------------------------------- */ - -/* Optional optimizations */ - -/* - * By default, the functions in this section are implemented using - * calls to functions declared above. However, you might want to - * implement them differently for performance reasons. - */ - -/* - * All-in-one encryption/decryption of (short) packets. - * - * The default definitions of these functions can be found in - * "ecrypt-sync.c". If you want to implement them differently, please - * undef the ECRYPT_USES_DEFAULT_ALL_IN_ONE flag. - */ -#define ECRYPT_USES_DEFAULT_ALL_IN_ONE /* [edit] */ - -void ECRYPT_encrypt_packet( - ECRYPT_ctx* ctx, - const u8* iv, - const u8* plaintext, - u8* ciphertext, - u32 msglen); - -void ECRYPT_decrypt_packet( - ECRYPT_ctx* ctx, - const u8* iv, - const u8* ciphertext, - u8* plaintext, - u32 msglen); - -/* - * Encryption/decryption of blocks. - * - * By default, these functions are defined as macros. If you want to - * provide a different implementation, please undef the - * ECRYPT_USES_DEFAULT_BLOCK_MACROS flag and implement the functions - * declared below. - */ - -#define ECRYPT_BLOCKLENGTH 64 /* [edit] */ - -#define ECRYPT_USES_DEFAULT_BLOCK_MACROS /* [edit] */ -#ifdef ECRYPT_USES_DEFAULT_BLOCK_MACROS - -#define ECRYPT_encrypt_blocks(ctx, plaintext, ciphertext, blocks) \ - ECRYPT_encrypt_bytes(ctx, plaintext, ciphertext, \ - (blocks) * ECRYPT_BLOCKLENGTH) - -#define ECRYPT_decrypt_blocks(ctx, ciphertext, plaintext, blocks) \ - ECRYPT_decrypt_bytes(ctx, ciphertext, plaintext, \ - (blocks) * ECRYPT_BLOCKLENGTH) - -#ifdef ECRYPT_GENERATES_KEYSTREAM - -#define ECRYPT_keystream_blocks(ctx, keystream, blocks) \ - ECRYPT_keystream_bytes(ctx, keystream, \ - (blocks) * ECRYPT_BLOCKLENGTH) - -#endif - -#else - -void ECRYPT_encrypt_blocks( - ECRYPT_ctx* ctx, - const u8* plaintext, - u8* ciphertext, - u32 blocks); /* Message length in blocks. */ - -void ECRYPT_decrypt_blocks( - ECRYPT_ctx* ctx, - const u8* ciphertext, - u8* plaintext, - u32 blocks); /* Message length in blocks. */ - -#ifdef ECRYPT_GENERATES_KEYSTREAM - -void ECRYPT_keystream_blocks( - ECRYPT_ctx* ctx, - const u8* keystream, - u32 blocks); /* Keystream length in blocks. */ - -#endif - -#endif - -/* - * If your cipher can be implemented in different ways, you can use - * the ECRYPT_VARIANT parameter to allow the user to choose between - * them at compile time (e.g., gcc -DECRYPT_VARIANT=3 ...). Please - * only use this possibility if you really think it could make a - * significant difference and keep the number of variants - * (ECRYPT_MAXVARIANT) as small as possible (definitely not more than - * 10). Note also that all variants should have exactly the same - * external interface (i.e., the same ECRYPT_BLOCKLENGTH, etc.). - */ -#define ECRYPT_MAXVARIANT 1 /* [edit] */ - -#ifndef ECRYPT_VARIANT -#define ECRYPT_VARIANT 1 -#endif - -#if (ECRYPT_VARIANT > ECRYPT_MAXVARIANT) -#error this variant does not exist -#endif - -/* ------------------------------------------------------------------------- */ - -#endif diff --git a/vendor/salsa20/ecrypt.c b/vendor/salsa20/ecrypt.c deleted file mode 100644 index b6610df..0000000 --- a/vendor/salsa20/ecrypt.c +++ /dev/null @@ -1,127 +0,0 @@ -#include "ecrypt-sync.h" - -#define ROTATE(v,c) (ROTL32(v,c)) -#define XOR(v,w) ((v) ^ (w)) -#define PLUS(v,w) (U32V((v) + (w))) -#define PLUSONE(v) (PLUS((v),1)) - -static void salsa20_wordtobyte(u8 output[64],const u32 input[16]) -{ - u32 x[16]; - int i; - - for (i = 0;i < 16;++i) x[i] = input[i]; - for (i = 20;i > 0;i -= 2) { - x[ 4] = XOR(x[ 4],ROTATE(PLUS(x[ 0],x[12]), 7)); - x[ 8] = XOR(x[ 8],ROTATE(PLUS(x[ 4],x[ 0]), 9)); - x[12] = XOR(x[12],ROTATE(PLUS(x[ 8],x[ 4]),13)); - x[ 0] = XOR(x[ 0],ROTATE(PLUS(x[12],x[ 8]),18)); - x[ 9] = XOR(x[ 9],ROTATE(PLUS(x[ 5],x[ 1]), 7)); - x[13] = XOR(x[13],ROTATE(PLUS(x[ 9],x[ 5]), 9)); - x[ 1] = XOR(x[ 1],ROTATE(PLUS(x[13],x[ 9]),13)); - x[ 5] = XOR(x[ 5],ROTATE(PLUS(x[ 1],x[13]),18)); - x[14] = XOR(x[14],ROTATE(PLUS(x[10],x[ 6]), 7)); - x[ 2] = XOR(x[ 2],ROTATE(PLUS(x[14],x[10]), 9)); - x[ 6] = XOR(x[ 6],ROTATE(PLUS(x[ 2],x[14]),13)); - x[10] = XOR(x[10],ROTATE(PLUS(x[ 6],x[ 2]),18)); - x[ 3] = XOR(x[ 3],ROTATE(PLUS(x[15],x[11]), 7)); - x[ 7] = XOR(x[ 7],ROTATE(PLUS(x[ 3],x[15]), 9)); - x[11] = XOR(x[11],ROTATE(PLUS(x[ 7],x[ 3]),13)); - x[15] = XOR(x[15],ROTATE(PLUS(x[11],x[ 7]),18)); - x[ 1] = XOR(x[ 1],ROTATE(PLUS(x[ 0],x[ 3]), 7)); - x[ 2] = XOR(x[ 2],ROTATE(PLUS(x[ 1],x[ 0]), 9)); - x[ 3] = XOR(x[ 3],ROTATE(PLUS(x[ 2],x[ 1]),13)); - x[ 0] = XOR(x[ 0],ROTATE(PLUS(x[ 3],x[ 2]),18)); - x[ 6] = XOR(x[ 6],ROTATE(PLUS(x[ 5],x[ 4]), 7)); - x[ 7] = XOR(x[ 7],ROTATE(PLUS(x[ 6],x[ 5]), 9)); - x[ 4] = XOR(x[ 4],ROTATE(PLUS(x[ 7],x[ 6]),13)); - x[ 5] = XOR(x[ 5],ROTATE(PLUS(x[ 4],x[ 7]),18)); - x[11] = XOR(x[11],ROTATE(PLUS(x[10],x[ 9]), 7)); - x[ 8] = XOR(x[ 8],ROTATE(PLUS(x[11],x[10]), 9)); - x[ 9] = XOR(x[ 9],ROTATE(PLUS(x[ 8],x[11]),13)); - x[10] = XOR(x[10],ROTATE(PLUS(x[ 9],x[ 8]),18)); - x[12] = XOR(x[12],ROTATE(PLUS(x[15],x[14]), 7)); - x[13] = XOR(x[13],ROTATE(PLUS(x[12],x[15]), 9)); - x[14] = XOR(x[14],ROTATE(PLUS(x[13],x[12]),13)); - x[15] = XOR(x[15],ROTATE(PLUS(x[14],x[13]),18)); - } - for (i = 0;i < 16;++i) x[i] = PLUS(x[i],input[i]); - for (i = 0;i < 16;++i) U32TO8_LITTLE(output + 4 * i,x[i]); -} - -void ECRYPT_init(void) -{ - return; -} - -static const char sigma[16] = "expand 32-byte k"; -static const char tau[16] = "expand 16-byte k"; - -void ECRYPT_keysetup(ECRYPT_ctx *x,const u8 *k,u32 kbits,u32 ivbits) -{ - int i; - static const char *constants; - - x->input[1] = U8TO32_LITTLE(k + 0); - x->input[2] = U8TO32_LITTLE(k + 4); - x->input[3] = U8TO32_LITTLE(k + 8); - x->input[4] = U8TO32_LITTLE(k + 12); - if (kbits == 256) { /* recommended */ - k += 16; - constants = sigma; - } else { /* kbits == 128 */ - constants = tau; - } - x->input[11] = U8TO32_LITTLE(k + 0); - x->input[12] = U8TO32_LITTLE(k + 4); - x->input[13] = U8TO32_LITTLE(k + 8); - x->input[14] = U8TO32_LITTLE(k + 12); - x->input[0] = U8TO32_LITTLE(constants + 0); - x->input[5] = U8TO32_LITTLE(constants + 4); - x->input[10] = U8TO32_LITTLE(constants + 8); - x->input[15] = U8TO32_LITTLE(constants + 12); -} - -void ECRYPT_ivsetup(ECRYPT_ctx *x,const u8 *iv) -{ - x->input[6] = U8TO32_LITTLE(iv + 0); - x->input[7] = U8TO32_LITTLE(iv + 4); - x->input[8] = 0; - x->input[9] = 0; -} - -void ECRYPT_encrypt_bytes(ECRYPT_ctx *x,const u8 *m,u8 *c,u32 bytes) -{ - u8 output[64]; - int i; - - if (!bytes) return; - for (;;) { - salsa20_wordtobyte(output,x->input); - x->input[8] = PLUSONE(x->input[8]); - if (!x->input[8]) { - x->input[9] = PLUSONE(x->input[9]); - /* stopping at 2^70 bytes per nonce is user's responsibility */ - } - if (bytes <= 64) { - for (i = 0;i < bytes;++i) c[i] = m[i] ^ output[i]; - return; - } - for (i = 0;i < 64;++i) c[i] = m[i] ^ output[i]; - bytes -= 64; - c += 64; - m += 64; - } -} - -void ECRYPT_decrypt_bytes(ECRYPT_ctx *x,const u8 *c,u8 *m,u32 bytes) -{ - ECRYPT_encrypt_bytes(x,c,m,bytes); -} - -void ECRYPT_keystream_bytes(ECRYPT_ctx *x,u8 *stream,u32 bytes) -{ - u32 i; - for (i = 0;i < bytes;++i) stream[i] = 0; - ECRYPT_encrypt_bytes(x,stream,stream,bytes); -} diff --git a/vendor/salsa20/salsa20.s b/vendor/salsa20/salsa20.s deleted file mode 100644 index 4c09a99..0000000 --- a/vendor/salsa20/salsa20.s +++ /dev/null @@ -1,5371 +0,0 @@ - -# qhasm: int32 a - -# qhasm: stack32 arg1 - -# qhasm: stack32 arg2 - -# qhasm: stack32 arg3 - -# qhasm: stack32 arg4 - -# qhasm: input arg1 - -# qhasm: input arg2 - -# qhasm: input arg3 - -# qhasm: input arg4 - -# qhasm: int32 eax - -# qhasm: int32 ebx - -# qhasm: int32 esi - -# qhasm: int32 edi - -# qhasm: int32 ebp - -# qhasm: caller eax - -# qhasm: caller ebx - -# qhasm: caller esi - -# qhasm: caller edi - -# qhasm: caller ebp - -# qhasm: int32 k - -# qhasm: int32 kbits - -# qhasm: int32 iv - -# qhasm: int32 i - -# qhasm: int32 x - -# qhasm: int32 m - -# qhasm: int32 out - -# qhasm: stack32 bytes_backup - -# qhasm: int32 bytes - -# qhasm: stack32 eax_stack - -# qhasm: stack32 ebx_stack - -# qhasm: stack32 esi_stack - -# qhasm: stack32 edi_stack - -# qhasm: stack32 ebp_stack - -# qhasm: int6464 diag0 - -# qhasm: int6464 diag1 - -# qhasm: int6464 diag2 - -# qhasm: int6464 diag3 - -# qhasm: int6464 a0 - -# qhasm: int6464 a1 - -# qhasm: int6464 a2 - -# qhasm: int6464 a3 - -# qhasm: int6464 a4 - -# qhasm: int6464 a5 - -# qhasm: int6464 a6 - -# qhasm: int6464 a7 - -# qhasm: int6464 b0 - -# qhasm: int6464 b1 - -# qhasm: int6464 b2 - -# qhasm: int6464 b3 - -# qhasm: int6464 b4 - -# qhasm: int6464 b5 - -# qhasm: int6464 b6 - -# qhasm: int6464 b7 - -# qhasm: int6464 z0 - -# qhasm: int6464 z1 - -# qhasm: int6464 z2 - -# qhasm: int6464 z3 - -# qhasm: int6464 z4 - -# qhasm: int6464 z5 - -# qhasm: int6464 z6 - -# qhasm: int6464 z7 - -# qhasm: int6464 z8 - -# qhasm: int6464 z9 - -# qhasm: int6464 z10 - -# qhasm: int6464 z11 - -# qhasm: int6464 z12 - -# qhasm: int6464 z13 - -# qhasm: int6464 z14 - -# qhasm: int6464 z15 - -# qhasm: stack128 z0_stack - -# qhasm: stack128 z1_stack - -# qhasm: stack128 z2_stack - -# qhasm: stack128 z3_stack - -# qhasm: stack128 z4_stack - -# qhasm: stack128 z5_stack - -# qhasm: stack128 z6_stack - -# qhasm: stack128 z7_stack - -# qhasm: stack128 z8_stack - -# qhasm: stack128 z9_stack - -# qhasm: stack128 z10_stack - -# qhasm: stack128 z11_stack - -# qhasm: stack128 z12_stack - -# qhasm: stack128 z13_stack - -# qhasm: stack128 z14_stack - -# qhasm: stack128 z15_stack - -# qhasm: stack128 orig0 - -# qhasm: stack128 orig1 - -# qhasm: stack128 orig2 - -# qhasm: stack128 orig3 - -# qhasm: stack128 orig4 - -# qhasm: stack128 orig5 - -# qhasm: stack128 orig6 - -# qhasm: stack128 orig7 - -# qhasm: stack128 orig8 - -# qhasm: stack128 orig9 - -# qhasm: stack128 orig10 - -# qhasm: stack128 orig11 - -# qhasm: stack128 orig12 - -# qhasm: stack128 orig13 - -# qhasm: stack128 orig14 - -# qhasm: stack128 orig15 - -# qhasm: int6464 p - -# qhasm: int6464 q - -# qhasm: int6464 r - -# qhasm: int6464 s - -# qhasm: int6464 t - -# qhasm: int6464 u - -# qhasm: int6464 v - -# qhasm: int6464 w - -# qhasm: int6464 mp - -# qhasm: int6464 mq - -# qhasm: int6464 mr - -# qhasm: int6464 ms - -# qhasm: int6464 mt - -# qhasm: int6464 mu - -# qhasm: int6464 mv - -# qhasm: int6464 mw - -# qhasm: int32 in0 - -# qhasm: int32 in1 - -# qhasm: int32 in2 - -# qhasm: int32 in3 - -# qhasm: int32 in4 - -# qhasm: int32 in5 - -# qhasm: int32 in6 - -# qhasm: int32 in7 - -# qhasm: int32 in8 - -# qhasm: int32 in9 - -# qhasm: int32 in10 - -# qhasm: int32 in11 - -# qhasm: int32 in12 - -# qhasm: int32 in13 - -# qhasm: int32 in14 - -# qhasm: int32 in15 - -# qhasm: stack512 tmp - -# qhasm: stack32 ctarget - -# qhasm: enter ECRYPT_keystream_bytes -.text -.p2align 5 -.globl _ECRYPT_keystream_bytes -.globl ECRYPT_keystream_bytes -_ECRYPT_keystream_bytes: -ECRYPT_keystream_bytes: -mov %esp,%eax -and $31,%eax -add $640,%eax -sub %eax,%esp - -# qhasm: eax_stack = eax -# asm 1: movl eax_stack=stack32#1 -# asm 2: movl eax_stack=0(%esp) -movl %eax,0(%esp) - -# qhasm: ebx_stack = ebx -# asm 1: movl ebx_stack=stack32#2 -# asm 2: movl ebx_stack=4(%esp) -movl %ebx,4(%esp) - -# qhasm: esi_stack = esi -# asm 1: movl esi_stack=stack32#3 -# asm 2: movl esi_stack=8(%esp) -movl %esi,8(%esp) - -# qhasm: edi_stack = edi -# asm 1: movl edi_stack=stack32#4 -# asm 2: movl edi_stack=12(%esp) -movl %edi,12(%esp) - -# qhasm: ebp_stack = ebp -# asm 1: movl ebp_stack=stack32#5 -# asm 2: movl ebp_stack=16(%esp) -movl %ebp,16(%esp) - -# qhasm: x = arg1 -# asm 1: movl x=int32#3 -# asm 2: movl x=%edx -movl 4(%esp,%eax),%edx - -# qhasm: m = arg2 -# asm 1: movl m=int32#5 -# asm 2: movl m=%esi -movl 8(%esp,%eax),%esi - -# qhasm: out = m -# asm 1: mov out=int32#6 -# asm 2: mov out=%edi -mov %esi,%edi - -# qhasm: bytes = arg3 -# asm 1: movl bytes=int32#4 -# asm 2: movl bytes=%ebx -movl 12(%esp,%eax),%ebx - -# qhasm: unsigned>? bytes - 0 -# asm 1: cmp $0, -jbe ._done - -# qhasm: a = 0 -# asm 1: mov $0,>a=int32#1 -# asm 2: mov $0,>a=%eax -mov $0,%eax - -# qhasm: i = bytes -# asm 1: mov i=int32#2 -# asm 2: mov i=%ecx -mov %ebx,%ecx - -# qhasm: while (i) { *out++ = a; --i } -rep stosb - -# qhasm: out -= bytes -# asm 1: subl eax_stack=stack32#1 -# asm 2: movl eax_stack=0(%esp) -movl %eax,0(%esp) - -# qhasm: ebx_stack = ebx -# asm 1: movl ebx_stack=stack32#2 -# asm 2: movl ebx_stack=4(%esp) -movl %ebx,4(%esp) - -# qhasm: esi_stack = esi -# asm 1: movl esi_stack=stack32#3 -# asm 2: movl esi_stack=8(%esp) -movl %esi,8(%esp) - -# qhasm: edi_stack = edi -# asm 1: movl edi_stack=stack32#4 -# asm 2: movl edi_stack=12(%esp) -movl %edi,12(%esp) - -# qhasm: ebp_stack = ebp -# asm 1: movl ebp_stack=stack32#5 -# asm 2: movl ebp_stack=16(%esp) -movl %ebp,16(%esp) - -# qhasm: x = arg1 -# asm 1: movl x=int32#3 -# asm 2: movl x=%edx -movl 4(%esp,%eax),%edx - -# qhasm: m = arg2 -# asm 1: movl m=int32#5 -# asm 2: movl m=%esi -movl 8(%esp,%eax),%esi - -# qhasm: out = arg3 -# asm 1: movl out=int32#6 -# asm 2: movl out=%edi -movl 12(%esp,%eax),%edi - -# qhasm: bytes = arg4 -# asm 1: movl bytes=int32#4 -# asm 2: movl bytes=%ebx -movl 16(%esp,%eax),%ebx - -# qhasm: unsigned>? bytes - 0 -# asm 1: cmp $0, -jbe ._done -# comment:fp stack unchanged by jump - -# qhasm: goto start -jmp ._start - -# qhasm: enter ECRYPT_encrypt_bytes -.text -.p2align 5 -.globl _ECRYPT_encrypt_bytes -.globl ECRYPT_encrypt_bytes -_ECRYPT_encrypt_bytes: -ECRYPT_encrypt_bytes: -mov %esp,%eax -and $31,%eax -add $640,%eax -sub %eax,%esp - -# qhasm: eax_stack = eax -# asm 1: movl eax_stack=stack32#1 -# asm 2: movl eax_stack=0(%esp) -movl %eax,0(%esp) - -# qhasm: ebx_stack = ebx -# asm 1: movl ebx_stack=stack32#2 -# asm 2: movl ebx_stack=4(%esp) -movl %ebx,4(%esp) - -# qhasm: esi_stack = esi -# asm 1: movl esi_stack=stack32#3 -# asm 2: movl esi_stack=8(%esp) -movl %esi,8(%esp) - -# qhasm: edi_stack = edi -# asm 1: movl edi_stack=stack32#4 -# asm 2: movl edi_stack=12(%esp) -movl %edi,12(%esp) - -# qhasm: ebp_stack = ebp -# asm 1: movl ebp_stack=stack32#5 -# asm 2: movl ebp_stack=16(%esp) -movl %ebp,16(%esp) - -# qhasm: x = arg1 -# asm 1: movl x=int32#3 -# asm 2: movl x=%edx -movl 4(%esp,%eax),%edx - -# qhasm: m = arg2 -# asm 1: movl m=int32#5 -# asm 2: movl m=%esi -movl 8(%esp,%eax),%esi - -# qhasm: out = arg3 -# asm 1: movl out=int32#6 -# asm 2: movl out=%edi -movl 12(%esp,%eax),%edi - -# qhasm: bytes = arg4 -# asm 1: movl bytes=int32#4 -# asm 2: movl bytes=%ebx -movl 16(%esp,%eax),%ebx - -# qhasm: unsigned>? bytes - 0 -# asm 1: cmp $0, -jbe ._done -# comment:fp stack unchanged by fallthrough - -# qhasm: start: -._start: - -# qhasm: unsignedz0=int6464#1 -# asm 2: movdqa 0(z0=%xmm0 -movdqa 0(%edx),%xmm0 - -# qhasm: z5 = z0[1,1,1,1] -# asm 1: pshufd $0x55,z5=int6464#2 -# asm 2: pshufd $0x55,z5=%xmm1 -pshufd $0x55,%xmm0,%xmm1 - -# qhasm: z10 = z0[2,2,2,2] -# asm 1: pshufd $0xaa,z10=int6464#3 -# asm 2: pshufd $0xaa,z10=%xmm2 -pshufd $0xaa,%xmm0,%xmm2 - -# qhasm: z15 = z0[3,3,3,3] -# asm 1: pshufd $0xff,z15=int6464#4 -# asm 2: pshufd $0xff,z15=%xmm3 -pshufd $0xff,%xmm0,%xmm3 - -# qhasm: z0 = z0[0,0,0,0] -# asm 1: pshufd $0x00,z0=int6464#1 -# asm 2: pshufd $0x00,z0=%xmm0 -pshufd $0x00,%xmm0,%xmm0 - -# qhasm: orig5 = z5 -# asm 1: movdqa orig5=stack128#1 -# asm 2: movdqa orig5=32(%esp) -movdqa %xmm1,32(%esp) - -# qhasm: orig10 = z10 -# asm 1: movdqa orig10=stack128#2 -# asm 2: movdqa orig10=48(%esp) -movdqa %xmm2,48(%esp) - -# qhasm: orig15 = z15 -# asm 1: movdqa orig15=stack128#3 -# asm 2: movdqa orig15=64(%esp) -movdqa %xmm3,64(%esp) - -# qhasm: orig0 = z0 -# asm 1: movdqa orig0=stack128#4 -# asm 2: movdqa orig0=80(%esp) -movdqa %xmm0,80(%esp) - -# qhasm: z1 = *(int128 *) (x + 16) -# asm 1: movdqa 16(z1=int6464#1 -# asm 2: movdqa 16(z1=%xmm0 -movdqa 16(%edx),%xmm0 - -# qhasm: z6 = z1[2,2,2,2] -# asm 1: pshufd $0xaa,z6=int6464#2 -# asm 2: pshufd $0xaa,z6=%xmm1 -pshufd $0xaa,%xmm0,%xmm1 - -# qhasm: z11 = z1[3,3,3,3] -# asm 1: pshufd $0xff,z11=int6464#3 -# asm 2: pshufd $0xff,z11=%xmm2 -pshufd $0xff,%xmm0,%xmm2 - -# qhasm: z12 = z1[0,0,0,0] -# asm 1: pshufd $0x00,z12=int6464#4 -# asm 2: pshufd $0x00,z12=%xmm3 -pshufd $0x00,%xmm0,%xmm3 - -# qhasm: z1 = z1[1,1,1,1] -# asm 1: pshufd $0x55,z1=int6464#1 -# asm 2: pshufd $0x55,z1=%xmm0 -pshufd $0x55,%xmm0,%xmm0 - -# qhasm: orig6 = z6 -# asm 1: movdqa orig6=stack128#5 -# asm 2: movdqa orig6=96(%esp) -movdqa %xmm1,96(%esp) - -# qhasm: orig11 = z11 -# asm 1: movdqa orig11=stack128#6 -# asm 2: movdqa orig11=112(%esp) -movdqa %xmm2,112(%esp) - -# qhasm: orig12 = z12 -# asm 1: movdqa orig12=stack128#7 -# asm 2: movdqa orig12=128(%esp) -movdqa %xmm3,128(%esp) - -# qhasm: orig1 = z1 -# asm 1: movdqa orig1=stack128#8 -# asm 2: movdqa orig1=144(%esp) -movdqa %xmm0,144(%esp) - -# qhasm: z2 = *(int128 *) (x + 32) -# asm 1: movdqa 32(z2=int6464#1 -# asm 2: movdqa 32(z2=%xmm0 -movdqa 32(%edx),%xmm0 - -# qhasm: z7 = z2[3,3,3,3] -# asm 1: pshufd $0xff,z7=int6464#2 -# asm 2: pshufd $0xff,z7=%xmm1 -pshufd $0xff,%xmm0,%xmm1 - -# qhasm: z13 = z2[1,1,1,1] -# asm 1: pshufd $0x55,z13=int6464#3 -# asm 2: pshufd $0x55,z13=%xmm2 -pshufd $0x55,%xmm0,%xmm2 - -# qhasm: z2 = z2[2,2,2,2] -# asm 1: pshufd $0xaa,z2=int6464#1 -# asm 2: pshufd $0xaa,z2=%xmm0 -pshufd $0xaa,%xmm0,%xmm0 - -# qhasm: orig7 = z7 -# asm 1: movdqa orig7=stack128#9 -# asm 2: movdqa orig7=160(%esp) -movdqa %xmm1,160(%esp) - -# qhasm: orig13 = z13 -# asm 1: movdqa orig13=stack128#10 -# asm 2: movdqa orig13=176(%esp) -movdqa %xmm2,176(%esp) - -# qhasm: orig2 = z2 -# asm 1: movdqa orig2=stack128#11 -# asm 2: movdqa orig2=192(%esp) -movdqa %xmm0,192(%esp) - -# qhasm: z3 = *(int128 *) (x + 48) -# asm 1: movdqa 48(z3=int6464#1 -# asm 2: movdqa 48(z3=%xmm0 -movdqa 48(%edx),%xmm0 - -# qhasm: z4 = z3[0,0,0,0] -# asm 1: pshufd $0x00,z4=int6464#2 -# asm 2: pshufd $0x00,z4=%xmm1 -pshufd $0x00,%xmm0,%xmm1 - -# qhasm: z14 = z3[2,2,2,2] -# asm 1: pshufd $0xaa,z14=int6464#3 -# asm 2: pshufd $0xaa,z14=%xmm2 -pshufd $0xaa,%xmm0,%xmm2 - -# qhasm: z3 = z3[3,3,3,3] -# asm 1: pshufd $0xff,z3=int6464#1 -# asm 2: pshufd $0xff,z3=%xmm0 -pshufd $0xff,%xmm0,%xmm0 - -# qhasm: orig4 = z4 -# asm 1: movdqa orig4=stack128#12 -# asm 2: movdqa orig4=208(%esp) -movdqa %xmm1,208(%esp) - -# qhasm: orig14 = z14 -# asm 1: movdqa orig14=stack128#13 -# asm 2: movdqa orig14=224(%esp) -movdqa %xmm2,224(%esp) - -# qhasm: orig3 = z3 -# asm 1: movdqa orig3=stack128#14 -# asm 2: movdqa orig3=240(%esp) -movdqa %xmm0,240(%esp) - -# qhasm: bytesatleast256: -._bytesatleast256: - -# qhasm: in8 = *(uint32 *) (x + 32) -# asm 1: movl 32(in8=int32#1 -# asm 2: movl 32(in8=%eax -movl 32(%edx),%eax - -# qhasm: in9 = *(uint32 *) (x + 52) -# asm 1: movl 52(in9=int32#2 -# asm 2: movl 52(in9=%ecx -movl 52(%edx),%ecx - -# qhasm: ((uint32 *) &orig8)[0] = in8 -# asm 1: movl orig8=stack128#15 -# asm 2: movl orig8=256(%esp) -movl %eax,256(%esp) - -# qhasm: ((uint32 *) &orig9)[0] = in9 -# asm 1: movl orig9=stack128#16 -# asm 2: movl orig9=272(%esp) -movl %ecx,272(%esp) - -# qhasm: carry? in8 += 1 -# asm 1: add $1,bytes_backup=stack32#6 -# asm 2: movl bytes_backup=20(%esp) -movl %ebx,20(%esp) - -# qhasm: i = 20 -# asm 1: mov $20,>i=int32#1 -# asm 2: mov $20,>i=%eax -mov $20,%eax - -# qhasm: z5 = orig5 -# asm 1: movdqa z5=int6464#1 -# asm 2: movdqa z5=%xmm0 -movdqa 32(%esp),%xmm0 - -# qhasm: z10 = orig10 -# asm 1: movdqa z10=int6464#2 -# asm 2: movdqa z10=%xmm1 -movdqa 48(%esp),%xmm1 - -# qhasm: z15 = orig15 -# asm 1: movdqa z15=int6464#3 -# asm 2: movdqa z15=%xmm2 -movdqa 64(%esp),%xmm2 - -# qhasm: z14 = orig14 -# asm 1: movdqa z14=int6464#4 -# asm 2: movdqa z14=%xmm3 -movdqa 224(%esp),%xmm3 - -# qhasm: z3 = orig3 -# asm 1: movdqa z3=int6464#5 -# asm 2: movdqa z3=%xmm4 -movdqa 240(%esp),%xmm4 - -# qhasm: z6 = orig6 -# asm 1: movdqa z6=int6464#6 -# asm 2: movdqa z6=%xmm5 -movdqa 96(%esp),%xmm5 - -# qhasm: z11 = orig11 -# asm 1: movdqa z11=int6464#7 -# asm 2: movdqa z11=%xmm6 -movdqa 112(%esp),%xmm6 - -# qhasm: z1 = orig1 -# asm 1: movdqa z1=int6464#8 -# asm 2: movdqa z1=%xmm7 -movdqa 144(%esp),%xmm7 - -# qhasm: z5_stack = z5 -# asm 1: movdqa z5_stack=stack128#17 -# asm 2: movdqa z5_stack=288(%esp) -movdqa %xmm0,288(%esp) - -# qhasm: z10_stack = z10 -# asm 1: movdqa z10_stack=stack128#18 -# asm 2: movdqa z10_stack=304(%esp) -movdqa %xmm1,304(%esp) - -# qhasm: z15_stack = z15 -# asm 1: movdqa z15_stack=stack128#19 -# asm 2: movdqa z15_stack=320(%esp) -movdqa %xmm2,320(%esp) - -# qhasm: z14_stack = z14 -# asm 1: movdqa z14_stack=stack128#20 -# asm 2: movdqa z14_stack=336(%esp) -movdqa %xmm3,336(%esp) - -# qhasm: z3_stack = z3 -# asm 1: movdqa z3_stack=stack128#21 -# asm 2: movdqa z3_stack=352(%esp) -movdqa %xmm4,352(%esp) - -# qhasm: z6_stack = z6 -# asm 1: movdqa z6_stack=stack128#22 -# asm 2: movdqa z6_stack=368(%esp) -movdqa %xmm5,368(%esp) - -# qhasm: z11_stack = z11 -# asm 1: movdqa z11_stack=stack128#23 -# asm 2: movdqa z11_stack=384(%esp) -movdqa %xmm6,384(%esp) - -# qhasm: z1_stack = z1 -# asm 1: movdqa z1_stack=stack128#24 -# asm 2: movdqa z1_stack=400(%esp) -movdqa %xmm7,400(%esp) - -# qhasm: z7 = orig7 -# asm 1: movdqa z7=int6464#5 -# asm 2: movdqa z7=%xmm4 -movdqa 160(%esp),%xmm4 - -# qhasm: z13 = orig13 -# asm 1: movdqa z13=int6464#6 -# asm 2: movdqa z13=%xmm5 -movdqa 176(%esp),%xmm5 - -# qhasm: z2 = orig2 -# asm 1: movdqa z2=int6464#7 -# asm 2: movdqa z2=%xmm6 -movdqa 192(%esp),%xmm6 - -# qhasm: z9 = orig9 -# asm 1: movdqa z9=int6464#8 -# asm 2: movdqa z9=%xmm7 -movdqa 272(%esp),%xmm7 - -# qhasm: p = orig0 -# asm 1: movdqa p=int6464#1 -# asm 2: movdqa p=%xmm0 -movdqa 80(%esp),%xmm0 - -# qhasm: t = orig12 -# asm 1: movdqa t=int6464#3 -# asm 2: movdqa t=%xmm2 -movdqa 128(%esp),%xmm2 - -# qhasm: q = orig4 -# asm 1: movdqa q=int6464#4 -# asm 2: movdqa q=%xmm3 -movdqa 208(%esp),%xmm3 - -# qhasm: r = orig8 -# asm 1: movdqa r=int6464#2 -# asm 2: movdqa r=%xmm1 -movdqa 256(%esp),%xmm1 - -# qhasm: z7_stack = z7 -# asm 1: movdqa z7_stack=stack128#25 -# asm 2: movdqa z7_stack=416(%esp) -movdqa %xmm4,416(%esp) - -# qhasm: z13_stack = z13 -# asm 1: movdqa z13_stack=stack128#26 -# asm 2: movdqa z13_stack=432(%esp) -movdqa %xmm5,432(%esp) - -# qhasm: z2_stack = z2 -# asm 1: movdqa z2_stack=stack128#27 -# asm 2: movdqa z2_stack=448(%esp) -movdqa %xmm6,448(%esp) - -# qhasm: z9_stack = z9 -# asm 1: movdqa z9_stack=stack128#28 -# asm 2: movdqa z9_stack=464(%esp) -movdqa %xmm7,464(%esp) - -# qhasm: z0_stack = p -# asm 1: movdqa z0_stack=stack128#29 -# asm 2: movdqa z0_stack=480(%esp) -movdqa %xmm0,480(%esp) - -# qhasm: z12_stack = t -# asm 1: movdqa z12_stack=stack128#30 -# asm 2: movdqa z12_stack=496(%esp) -movdqa %xmm2,496(%esp) - -# qhasm: z4_stack = q -# asm 1: movdqa z4_stack=stack128#31 -# asm 2: movdqa z4_stack=512(%esp) -movdqa %xmm3,512(%esp) - -# qhasm: z8_stack = r -# asm 1: movdqa z8_stack=stack128#32 -# asm 2: movdqa z8_stack=528(%esp) -movdqa %xmm1,528(%esp) - -# qhasm: mainloop1: -._mainloop1: - -# qhasm: assign xmm0 to p - -# qhasm: assign xmm1 to r - -# qhasm: assign xmm2 to t - -# qhasm: assign xmm3 to q - -# qhasm: s = t -# asm 1: movdqa s=int6464#7 -# asm 2: movdqa s=%xmm6 -movdqa %xmm2,%xmm6 - -# qhasm: uint32323232 t += p -# asm 1: paddd u=int6464#5 -# asm 2: movdqa u=%xmm4 -movdqa %xmm2,%xmm4 - -# qhasm: uint32323232 t >>= 25 -# asm 1: psrld $25,z4_stack=stack128#29 -# asm 2: movdqa z4_stack=480(%esp) -movdqa %xmm3,480(%esp) - -# qhasm: t = p -# asm 1: movdqa t=int6464#3 -# asm 2: movdqa t=%xmm2 -movdqa %xmm0,%xmm2 - -# qhasm: uint32323232 t += q -# asm 1: paddd u=int6464#5 -# asm 2: movdqa u=%xmm4 -movdqa %xmm2,%xmm4 - -# qhasm: uint32323232 t >>= 23 -# asm 1: psrld $23,z8_stack=stack128#30 -# asm 2: movdqa z8_stack=496(%esp) -movdqa %xmm1,496(%esp) - -# qhasm: uint32323232 q += r -# asm 1: paddd u=int6464#3 -# asm 2: movdqa u=%xmm2 -movdqa %xmm3,%xmm2 - -# qhasm: uint32323232 q >>= 19 -# asm 1: psrld $19,mt=int6464#3 -# asm 2: movdqa mt=%xmm2 -movdqa 400(%esp),%xmm2 - -# qhasm: mp = z5_stack -# asm 1: movdqa mp=int6464#5 -# asm 2: movdqa mp=%xmm4 -movdqa 288(%esp),%xmm4 - -# qhasm: mq = z9_stack -# asm 1: movdqa mq=int6464#4 -# asm 2: movdqa mq=%xmm3 -movdqa 464(%esp),%xmm3 - -# qhasm: mr = z13_stack -# asm 1: movdqa mr=int6464#6 -# asm 2: movdqa mr=%xmm5 -movdqa 432(%esp),%xmm5 - -# qhasm: z12_stack = s -# asm 1: movdqa z12_stack=stack128#26 -# asm 2: movdqa z12_stack=432(%esp) -movdqa %xmm6,432(%esp) - -# qhasm: uint32323232 r += s -# asm 1: paddd u=int6464#7 -# asm 2: movdqa u=%xmm6 -movdqa %xmm1,%xmm6 - -# qhasm: uint32323232 r >>= 14 -# asm 1: psrld $14,z0_stack=stack128#17 -# asm 2: movdqa z0_stack=288(%esp) -movdqa %xmm0,288(%esp) - -# qhasm: assign xmm2 to mt - -# qhasm: assign xmm3 to mq - -# qhasm: assign xmm4 to mp - -# qhasm: assign xmm5 to mr - -# qhasm: ms = mt -# asm 1: movdqa ms=int6464#7 -# asm 2: movdqa ms=%xmm6 -movdqa %xmm2,%xmm6 - -# qhasm: uint32323232 mt += mp -# asm 1: paddd mu=int6464#1 -# asm 2: movdqa mu=%xmm0 -movdqa %xmm2,%xmm0 - -# qhasm: uint32323232 mt >>= 25 -# asm 1: psrld $25,z9_stack=stack128#28 -# asm 2: movdqa z9_stack=464(%esp) -movdqa %xmm3,464(%esp) - -# qhasm: mt = mp -# asm 1: movdqa mt=int6464#1 -# asm 2: movdqa mt=%xmm0 -movdqa %xmm4,%xmm0 - -# qhasm: uint32323232 mt += mq -# asm 1: paddd mu=int6464#2 -# asm 2: movdqa mu=%xmm1 -movdqa %xmm0,%xmm1 - -# qhasm: uint32323232 mt >>= 23 -# asm 1: psrld $23,z13_stack=stack128#31 -# asm 2: movdqa z13_stack=512(%esp) -movdqa %xmm5,512(%esp) - -# qhasm: uint32323232 mq += mr -# asm 1: paddd mu=int6464#1 -# asm 2: movdqa mu=%xmm0 -movdqa %xmm3,%xmm0 - -# qhasm: uint32323232 mq >>= 19 -# asm 1: psrld $19,t=int6464#3 -# asm 2: movdqa t=%xmm2 -movdqa 368(%esp),%xmm2 - -# qhasm: p = z10_stack -# asm 1: movdqa p=int6464#1 -# asm 2: movdqa p=%xmm0 -movdqa 304(%esp),%xmm0 - -# qhasm: q = z14_stack -# asm 1: movdqa q=int6464#4 -# asm 2: movdqa q=%xmm3 -movdqa 336(%esp),%xmm3 - -# qhasm: r = z2_stack -# asm 1: movdqa r=int6464#2 -# asm 2: movdqa r=%xmm1 -movdqa 448(%esp),%xmm1 - -# qhasm: z1_stack = ms -# asm 1: movdqa z1_stack=stack128#18 -# asm 2: movdqa z1_stack=304(%esp) -movdqa %xmm6,304(%esp) - -# qhasm: uint32323232 mr += ms -# asm 1: paddd mu=int6464#7 -# asm 2: movdqa mu=%xmm6 -movdqa %xmm5,%xmm6 - -# qhasm: uint32323232 mr >>= 14 -# asm 1: psrld $14,z5_stack=stack128#20 -# asm 2: movdqa z5_stack=336(%esp) -movdqa %xmm4,336(%esp) - -# qhasm: assign xmm0 to p - -# qhasm: assign xmm1 to r - -# qhasm: assign xmm2 to t - -# qhasm: assign xmm3 to q - -# qhasm: s = t -# asm 1: movdqa s=int6464#7 -# asm 2: movdqa s=%xmm6 -movdqa %xmm2,%xmm6 - -# qhasm: uint32323232 t += p -# asm 1: paddd u=int6464#5 -# asm 2: movdqa u=%xmm4 -movdqa %xmm2,%xmm4 - -# qhasm: uint32323232 t >>= 25 -# asm 1: psrld $25,z14_stack=stack128#32 -# asm 2: movdqa z14_stack=528(%esp) -movdqa %xmm3,528(%esp) - -# qhasm: t = p -# asm 1: movdqa t=int6464#3 -# asm 2: movdqa t=%xmm2 -movdqa %xmm0,%xmm2 - -# qhasm: uint32323232 t += q -# asm 1: paddd u=int6464#5 -# asm 2: movdqa u=%xmm4 -movdqa %xmm2,%xmm4 - -# qhasm: uint32323232 t >>= 23 -# asm 1: psrld $23,z2_stack=stack128#22 -# asm 2: movdqa z2_stack=368(%esp) -movdqa %xmm1,368(%esp) - -# qhasm: uint32323232 q += r -# asm 1: paddd u=int6464#3 -# asm 2: movdqa u=%xmm2 -movdqa %xmm3,%xmm2 - -# qhasm: uint32323232 q >>= 19 -# asm 1: psrld $19,mt=int6464#3 -# asm 2: movdqa mt=%xmm2 -movdqa 384(%esp),%xmm2 - -# qhasm: mp = z15_stack -# asm 1: movdqa mp=int6464#5 -# asm 2: movdqa mp=%xmm4 -movdqa 320(%esp),%xmm4 - -# qhasm: mq = z3_stack -# asm 1: movdqa mq=int6464#4 -# asm 2: movdqa mq=%xmm3 -movdqa 352(%esp),%xmm3 - -# qhasm: mr = z7_stack -# asm 1: movdqa mr=int6464#6 -# asm 2: movdqa mr=%xmm5 -movdqa 416(%esp),%xmm5 - -# qhasm: z6_stack = s -# asm 1: movdqa z6_stack=stack128#19 -# asm 2: movdqa z6_stack=320(%esp) -movdqa %xmm6,320(%esp) - -# qhasm: uint32323232 r += s -# asm 1: paddd u=int6464#7 -# asm 2: movdqa u=%xmm6 -movdqa %xmm1,%xmm6 - -# qhasm: uint32323232 r >>= 14 -# asm 1: psrld $14,z10_stack=stack128#23 -# asm 2: movdqa z10_stack=384(%esp) -movdqa %xmm0,384(%esp) - -# qhasm: assign xmm2 to mt - -# qhasm: assign xmm3 to mq - -# qhasm: assign xmm4 to mp - -# qhasm: assign xmm5 to mr - -# qhasm: ms = mt -# asm 1: movdqa ms=int6464#7 -# asm 2: movdqa ms=%xmm6 -movdqa %xmm2,%xmm6 - -# qhasm: uint32323232 mt += mp -# asm 1: paddd mu=int6464#1 -# asm 2: movdqa mu=%xmm0 -movdqa %xmm2,%xmm0 - -# qhasm: uint32323232 mt >>= 25 -# asm 1: psrld $25,z3_stack=stack128#21 -# asm 2: movdqa z3_stack=352(%esp) -movdqa %xmm3,352(%esp) - -# qhasm: mt = mp -# asm 1: movdqa mt=int6464#1 -# asm 2: movdqa mt=%xmm0 -movdqa %xmm4,%xmm0 - -# qhasm: uint32323232 mt += mq -# asm 1: paddd mu=int6464#2 -# asm 2: movdqa mu=%xmm1 -movdqa %xmm0,%xmm1 - -# qhasm: uint32323232 mt >>= 23 -# asm 1: psrld $23,z7_stack=stack128#25 -# asm 2: movdqa z7_stack=416(%esp) -movdqa %xmm5,416(%esp) - -# qhasm: uint32323232 mq += mr -# asm 1: paddd mu=int6464#1 -# asm 2: movdqa mu=%xmm0 -movdqa %xmm3,%xmm0 - -# qhasm: uint32323232 mq >>= 19 -# asm 1: psrld $19,t=int6464#3 -# asm 2: movdqa t=%xmm2 -movdqa 352(%esp),%xmm2 - -# qhasm: p = z0_stack -# asm 1: movdqa p=int6464#1 -# asm 2: movdqa p=%xmm0 -movdqa 288(%esp),%xmm0 - -# qhasm: q = z1_stack -# asm 1: movdqa q=int6464#4 -# asm 2: movdqa q=%xmm3 -movdqa 304(%esp),%xmm3 - -# qhasm: r = z2_stack -# asm 1: movdqa r=int6464#2 -# asm 2: movdqa r=%xmm1 -movdqa 368(%esp),%xmm1 - -# qhasm: z11_stack = ms -# asm 1: movdqa z11_stack=stack128#17 -# asm 2: movdqa z11_stack=288(%esp) -movdqa %xmm6,288(%esp) - -# qhasm: uint32323232 mr += ms -# asm 1: paddd mu=int6464#7 -# asm 2: movdqa mu=%xmm6 -movdqa %xmm5,%xmm6 - -# qhasm: uint32323232 mr >>= 14 -# asm 1: psrld $14,z15_stack=stack128#18 -# asm 2: movdqa z15_stack=304(%esp) -movdqa %xmm4,304(%esp) - -# qhasm: assign xmm0 to p - -# qhasm: assign xmm1 to r - -# qhasm: assign xmm2 to t - -# qhasm: assign xmm3 to q - -# qhasm: s = t -# asm 1: movdqa s=int6464#7 -# asm 2: movdqa s=%xmm6 -movdqa %xmm2,%xmm6 - -# qhasm: uint32323232 t += p -# asm 1: paddd u=int6464#5 -# asm 2: movdqa u=%xmm4 -movdqa %xmm2,%xmm4 - -# qhasm: uint32323232 t >>= 25 -# asm 1: psrld $25,z1_stack=stack128#24 -# asm 2: movdqa z1_stack=400(%esp) -movdqa %xmm3,400(%esp) - -# qhasm: t = p -# asm 1: movdqa t=int6464#3 -# asm 2: movdqa t=%xmm2 -movdqa %xmm0,%xmm2 - -# qhasm: uint32323232 t += q -# asm 1: paddd u=int6464#5 -# asm 2: movdqa u=%xmm4 -movdqa %xmm2,%xmm4 - -# qhasm: uint32323232 t >>= 23 -# asm 1: psrld $23,z2_stack=stack128#27 -# asm 2: movdqa z2_stack=448(%esp) -movdqa %xmm1,448(%esp) - -# qhasm: uint32323232 q += r -# asm 1: paddd u=int6464#3 -# asm 2: movdqa u=%xmm2 -movdqa %xmm3,%xmm2 - -# qhasm: uint32323232 q >>= 19 -# asm 1: psrld $19,mt=int6464#3 -# asm 2: movdqa mt=%xmm2 -movdqa 480(%esp),%xmm2 - -# qhasm: mp = z5_stack -# asm 1: movdqa mp=int6464#5 -# asm 2: movdqa mp=%xmm4 -movdqa 336(%esp),%xmm4 - -# qhasm: mq = z6_stack -# asm 1: movdqa mq=int6464#4 -# asm 2: movdqa mq=%xmm3 -movdqa 320(%esp),%xmm3 - -# qhasm: mr = z7_stack -# asm 1: movdqa mr=int6464#6 -# asm 2: movdqa mr=%xmm5 -movdqa 416(%esp),%xmm5 - -# qhasm: z3_stack = s -# asm 1: movdqa z3_stack=stack128#21 -# asm 2: movdqa z3_stack=352(%esp) -movdqa %xmm6,352(%esp) - -# qhasm: uint32323232 r += s -# asm 1: paddd u=int6464#7 -# asm 2: movdqa u=%xmm6 -movdqa %xmm1,%xmm6 - -# qhasm: uint32323232 r >>= 14 -# asm 1: psrld $14,z0_stack=stack128#29 -# asm 2: movdqa z0_stack=480(%esp) -movdqa %xmm0,480(%esp) - -# qhasm: assign xmm2 to mt - -# qhasm: assign xmm3 to mq - -# qhasm: assign xmm4 to mp - -# qhasm: assign xmm5 to mr - -# qhasm: ms = mt -# asm 1: movdqa ms=int6464#7 -# asm 2: movdqa ms=%xmm6 -movdqa %xmm2,%xmm6 - -# qhasm: uint32323232 mt += mp -# asm 1: paddd mu=int6464#1 -# asm 2: movdqa mu=%xmm0 -movdqa %xmm2,%xmm0 - -# qhasm: uint32323232 mt >>= 25 -# asm 1: psrld $25,z6_stack=stack128#22 -# asm 2: movdqa z6_stack=368(%esp) -movdqa %xmm3,368(%esp) - -# qhasm: mt = mp -# asm 1: movdqa mt=int6464#1 -# asm 2: movdqa mt=%xmm0 -movdqa %xmm4,%xmm0 - -# qhasm: uint32323232 mt += mq -# asm 1: paddd mu=int6464#2 -# asm 2: movdqa mu=%xmm1 -movdqa %xmm0,%xmm1 - -# qhasm: uint32323232 mt >>= 23 -# asm 1: psrld $23,z7_stack=stack128#25 -# asm 2: movdqa z7_stack=416(%esp) -movdqa %xmm5,416(%esp) - -# qhasm: uint32323232 mq += mr -# asm 1: paddd mu=int6464#1 -# asm 2: movdqa mu=%xmm0 -movdqa %xmm3,%xmm0 - -# qhasm: uint32323232 mq >>= 19 -# asm 1: psrld $19,t=int6464#3 -# asm 2: movdqa t=%xmm2 -movdqa 464(%esp),%xmm2 - -# qhasm: p = z10_stack -# asm 1: movdqa p=int6464#1 -# asm 2: movdqa p=%xmm0 -movdqa 384(%esp),%xmm0 - -# qhasm: q = z11_stack -# asm 1: movdqa q=int6464#4 -# asm 2: movdqa q=%xmm3 -movdqa 288(%esp),%xmm3 - -# qhasm: r = z8_stack -# asm 1: movdqa r=int6464#2 -# asm 2: movdqa r=%xmm1 -movdqa 496(%esp),%xmm1 - -# qhasm: z4_stack = ms -# asm 1: movdqa z4_stack=stack128#30 -# asm 2: movdqa z4_stack=496(%esp) -movdqa %xmm6,496(%esp) - -# qhasm: uint32323232 mr += ms -# asm 1: paddd mu=int6464#7 -# asm 2: movdqa mu=%xmm6 -movdqa %xmm5,%xmm6 - -# qhasm: uint32323232 mr >>= 14 -# asm 1: psrld $14,z5_stack=stack128#17 -# asm 2: movdqa z5_stack=288(%esp) -movdqa %xmm4,288(%esp) - -# qhasm: assign xmm0 to p - -# qhasm: assign xmm1 to r - -# qhasm: assign xmm2 to t - -# qhasm: assign xmm3 to q - -# qhasm: s = t -# asm 1: movdqa s=int6464#7 -# asm 2: movdqa s=%xmm6 -movdqa %xmm2,%xmm6 - -# qhasm: uint32323232 t += p -# asm 1: paddd u=int6464#5 -# asm 2: movdqa u=%xmm4 -movdqa %xmm2,%xmm4 - -# qhasm: uint32323232 t >>= 25 -# asm 1: psrld $25,z11_stack=stack128#23 -# asm 2: movdqa z11_stack=384(%esp) -movdqa %xmm3,384(%esp) - -# qhasm: t = p -# asm 1: movdqa t=int6464#3 -# asm 2: movdqa t=%xmm2 -movdqa %xmm0,%xmm2 - -# qhasm: uint32323232 t += q -# asm 1: paddd u=int6464#5 -# asm 2: movdqa u=%xmm4 -movdqa %xmm2,%xmm4 - -# qhasm: uint32323232 t >>= 23 -# asm 1: psrld $23,z8_stack=stack128#33 -# asm 2: movdqa z8_stack=544(%esp) -movdqa %xmm1,544(%esp) - -# qhasm: uint32323232 q += r -# asm 1: paddd u=int6464#3 -# asm 2: movdqa u=%xmm2 -movdqa %xmm3,%xmm2 - -# qhasm: uint32323232 q >>= 19 -# asm 1: psrld $19,mt=int6464#3 -# asm 2: movdqa mt=%xmm2 -movdqa 528(%esp),%xmm2 - -# qhasm: mp = z15_stack -# asm 1: movdqa mp=int6464#5 -# asm 2: movdqa mp=%xmm4 -movdqa 304(%esp),%xmm4 - -# qhasm: mq = z12_stack -# asm 1: movdqa mq=int6464#4 -# asm 2: movdqa mq=%xmm3 -movdqa 432(%esp),%xmm3 - -# qhasm: mr = z13_stack -# asm 1: movdqa mr=int6464#6 -# asm 2: movdqa mr=%xmm5 -movdqa 512(%esp),%xmm5 - -# qhasm: z9_stack = s -# asm 1: movdqa z9_stack=stack128#28 -# asm 2: movdqa z9_stack=464(%esp) -movdqa %xmm6,464(%esp) - -# qhasm: uint32323232 r += s -# asm 1: paddd u=int6464#7 -# asm 2: movdqa u=%xmm6 -movdqa %xmm1,%xmm6 - -# qhasm: uint32323232 r >>= 14 -# asm 1: psrld $14,z10_stack=stack128#18 -# asm 2: movdqa z10_stack=304(%esp) -movdqa %xmm0,304(%esp) - -# qhasm: assign xmm2 to mt - -# qhasm: assign xmm3 to mq - -# qhasm: assign xmm4 to mp - -# qhasm: assign xmm5 to mr - -# qhasm: ms = mt -# asm 1: movdqa ms=int6464#7 -# asm 2: movdqa ms=%xmm6 -movdqa %xmm2,%xmm6 - -# qhasm: uint32323232 mt += mp -# asm 1: paddd mu=int6464#1 -# asm 2: movdqa mu=%xmm0 -movdqa %xmm2,%xmm0 - -# qhasm: uint32323232 mt >>= 25 -# asm 1: psrld $25,z12_stack=stack128#31 -# asm 2: movdqa z12_stack=512(%esp) -movdqa %xmm3,512(%esp) - -# qhasm: mt = mp -# asm 1: movdqa mt=int6464#1 -# asm 2: movdqa mt=%xmm0 -movdqa %xmm4,%xmm0 - -# qhasm: uint32323232 mt += mq -# asm 1: paddd mu=int6464#2 -# asm 2: movdqa mu=%xmm1 -movdqa %xmm0,%xmm1 - -# qhasm: uint32323232 mt >>= 23 -# asm 1: psrld $23,z13_stack=stack128#26 -# asm 2: movdqa z13_stack=432(%esp) -movdqa %xmm5,432(%esp) - -# qhasm: uint32323232 mq += mr -# asm 1: paddd mu=int6464#1 -# asm 2: movdqa mu=%xmm0 -movdqa %xmm3,%xmm0 - -# qhasm: uint32323232 mq >>= 19 -# asm 1: psrld $19,t=int6464#3 -# asm 2: movdqa t=%xmm2 -movdqa 512(%esp),%xmm2 - -# qhasm: p = z0_stack -# asm 1: movdqa p=int6464#1 -# asm 2: movdqa p=%xmm0 -movdqa 480(%esp),%xmm0 - -# qhasm: q = z4_stack -# asm 1: movdqa q=int6464#4 -# asm 2: movdqa q=%xmm3 -movdqa 496(%esp),%xmm3 - -# qhasm: r = z8_stack -# asm 1: movdqa r=int6464#2 -# asm 2: movdqa r=%xmm1 -movdqa 544(%esp),%xmm1 - -# qhasm: z14_stack = ms -# asm 1: movdqa z14_stack=stack128#20 -# asm 2: movdqa z14_stack=336(%esp) -movdqa %xmm6,336(%esp) - -# qhasm: uint32323232 mr += ms -# asm 1: paddd mu=int6464#7 -# asm 2: movdqa mu=%xmm6 -movdqa %xmm5,%xmm6 - -# qhasm: uint32323232 mr >>= 14 -# asm 1: psrld $14,z15_stack=stack128#19 -# asm 2: movdqa z15_stack=320(%esp) -movdqa %xmm4,320(%esp) - -# qhasm: unsigned>? i -= 2 -# asm 1: sub $2, -ja ._mainloop1 - -# qhasm: z0 = z0_stack -# asm 1: movdqa z0=int6464#1 -# asm 2: movdqa z0=%xmm0 -movdqa 480(%esp),%xmm0 - -# qhasm: z1 = z1_stack -# asm 1: movdqa z1=int6464#2 -# asm 2: movdqa z1=%xmm1 -movdqa 400(%esp),%xmm1 - -# qhasm: z2 = z2_stack -# asm 1: movdqa z2=int6464#3 -# asm 2: movdqa z2=%xmm2 -movdqa 448(%esp),%xmm2 - -# qhasm: z3 = z3_stack -# asm 1: movdqa z3=int6464#4 -# asm 2: movdqa z3=%xmm3 -movdqa 352(%esp),%xmm3 - -# qhasm: uint32323232 z0 += orig0 -# asm 1: paddd in0=int32#1 -# asm 2: movd in0=%eax -movd %xmm0,%eax - -# qhasm: in1 = z1 -# asm 1: movd in1=int32#2 -# asm 2: movd in1=%ecx -movd %xmm1,%ecx - -# qhasm: in2 = z2 -# asm 1: movd in2=int32#4 -# asm 2: movd in2=%ebx -movd %xmm2,%ebx - -# qhasm: in3 = z3 -# asm 1: movd in3=int32#7 -# asm 2: movd in3=%ebp -movd %xmm3,%ebp - -# qhasm: z0 <<<= 96 -# asm 1: pshufd $0x39,in0=int32#1 -# asm 2: movd in0=%eax -movd %xmm0,%eax - -# qhasm: in1 = z1 -# asm 1: movd in1=int32#2 -# asm 2: movd in1=%ecx -movd %xmm1,%ecx - -# qhasm: in2 = z2 -# asm 1: movd in2=int32#4 -# asm 2: movd in2=%ebx -movd %xmm2,%ebx - -# qhasm: in3 = z3 -# asm 1: movd in3=int32#7 -# asm 2: movd in3=%ebp -movd %xmm3,%ebp - -# qhasm: z0 <<<= 96 -# asm 1: pshufd $0x39,in0=int32#1 -# asm 2: movd in0=%eax -movd %xmm0,%eax - -# qhasm: in1 = z1 -# asm 1: movd in1=int32#2 -# asm 2: movd in1=%ecx -movd %xmm1,%ecx - -# qhasm: in2 = z2 -# asm 1: movd in2=int32#4 -# asm 2: movd in2=%ebx -movd %xmm2,%ebx - -# qhasm: in3 = z3 -# asm 1: movd in3=int32#7 -# asm 2: movd in3=%ebp -movd %xmm3,%ebp - -# qhasm: z0 <<<= 96 -# asm 1: pshufd $0x39,in0=int32#1 -# asm 2: movd in0=%eax -movd %xmm0,%eax - -# qhasm: in1 = z1 -# asm 1: movd in1=int32#2 -# asm 2: movd in1=%ecx -movd %xmm1,%ecx - -# qhasm: in2 = z2 -# asm 1: movd in2=int32#4 -# asm 2: movd in2=%ebx -movd %xmm2,%ebx - -# qhasm: in3 = z3 -# asm 1: movd in3=int32#7 -# asm 2: movd in3=%ebp -movd %xmm3,%ebp - -# qhasm: in0 ^= *(uint32 *) (m + 192) -# asm 1: xorl 192(z4=int6464#1 -# asm 2: movdqa z4=%xmm0 -movdqa 496(%esp),%xmm0 - -# qhasm: z5 = z5_stack -# asm 1: movdqa z5=int6464#2 -# asm 2: movdqa z5=%xmm1 -movdqa 288(%esp),%xmm1 - -# qhasm: z6 = z6_stack -# asm 1: movdqa z6=int6464#3 -# asm 2: movdqa z6=%xmm2 -movdqa 368(%esp),%xmm2 - -# qhasm: z7 = z7_stack -# asm 1: movdqa z7=int6464#4 -# asm 2: movdqa z7=%xmm3 -movdqa 416(%esp),%xmm3 - -# qhasm: uint32323232 z4 += orig4 -# asm 1: paddd in4=int32#1 -# asm 2: movd in4=%eax -movd %xmm0,%eax - -# qhasm: in5 = z5 -# asm 1: movd in5=int32#2 -# asm 2: movd in5=%ecx -movd %xmm1,%ecx - -# qhasm: in6 = z6 -# asm 1: movd in6=int32#4 -# asm 2: movd in6=%ebx -movd %xmm2,%ebx - -# qhasm: in7 = z7 -# asm 1: movd in7=int32#7 -# asm 2: movd in7=%ebp -movd %xmm3,%ebp - -# qhasm: z4 <<<= 96 -# asm 1: pshufd $0x39,in4=int32#1 -# asm 2: movd in4=%eax -movd %xmm0,%eax - -# qhasm: in5 = z5 -# asm 1: movd in5=int32#2 -# asm 2: movd in5=%ecx -movd %xmm1,%ecx - -# qhasm: in6 = z6 -# asm 1: movd in6=int32#4 -# asm 2: movd in6=%ebx -movd %xmm2,%ebx - -# qhasm: in7 = z7 -# asm 1: movd in7=int32#7 -# asm 2: movd in7=%ebp -movd %xmm3,%ebp - -# qhasm: z4 <<<= 96 -# asm 1: pshufd $0x39,in4=int32#1 -# asm 2: movd in4=%eax -movd %xmm0,%eax - -# qhasm: in5 = z5 -# asm 1: movd in5=int32#2 -# asm 2: movd in5=%ecx -movd %xmm1,%ecx - -# qhasm: in6 = z6 -# asm 1: movd in6=int32#4 -# asm 2: movd in6=%ebx -movd %xmm2,%ebx - -# qhasm: in7 = z7 -# asm 1: movd in7=int32#7 -# asm 2: movd in7=%ebp -movd %xmm3,%ebp - -# qhasm: z4 <<<= 96 -# asm 1: pshufd $0x39,in4=int32#1 -# asm 2: movd in4=%eax -movd %xmm0,%eax - -# qhasm: in5 = z5 -# asm 1: movd in5=int32#2 -# asm 2: movd in5=%ecx -movd %xmm1,%ecx - -# qhasm: in6 = z6 -# asm 1: movd in6=int32#4 -# asm 2: movd in6=%ebx -movd %xmm2,%ebx - -# qhasm: in7 = z7 -# asm 1: movd in7=int32#7 -# asm 2: movd in7=%ebp -movd %xmm3,%ebp - -# qhasm: in4 ^= *(uint32 *) (m + 208) -# asm 1: xorl 208(z8=int6464#1 -# asm 2: movdqa z8=%xmm0 -movdqa 544(%esp),%xmm0 - -# qhasm: z9 = z9_stack -# asm 1: movdqa z9=int6464#2 -# asm 2: movdqa z9=%xmm1 -movdqa 464(%esp),%xmm1 - -# qhasm: z10 = z10_stack -# asm 1: movdqa z10=int6464#3 -# asm 2: movdqa z10=%xmm2 -movdqa 304(%esp),%xmm2 - -# qhasm: z11 = z11_stack -# asm 1: movdqa z11=int6464#4 -# asm 2: movdqa z11=%xmm3 -movdqa 384(%esp),%xmm3 - -# qhasm: uint32323232 z8 += orig8 -# asm 1: paddd in8=int32#1 -# asm 2: movd in8=%eax -movd %xmm0,%eax - -# qhasm: in9 = z9 -# asm 1: movd in9=int32#2 -# asm 2: movd in9=%ecx -movd %xmm1,%ecx - -# qhasm: in10 = z10 -# asm 1: movd in10=int32#4 -# asm 2: movd in10=%ebx -movd %xmm2,%ebx - -# qhasm: in11 = z11 -# asm 1: movd in11=int32#7 -# asm 2: movd in11=%ebp -movd %xmm3,%ebp - -# qhasm: z8 <<<= 96 -# asm 1: pshufd $0x39,in8=int32#1 -# asm 2: movd in8=%eax -movd %xmm0,%eax - -# qhasm: in9 = z9 -# asm 1: movd in9=int32#2 -# asm 2: movd in9=%ecx -movd %xmm1,%ecx - -# qhasm: in10 = z10 -# asm 1: movd in10=int32#4 -# asm 2: movd in10=%ebx -movd %xmm2,%ebx - -# qhasm: in11 = z11 -# asm 1: movd in11=int32#7 -# asm 2: movd in11=%ebp -movd %xmm3,%ebp - -# qhasm: z8 <<<= 96 -# asm 1: pshufd $0x39,in8=int32#1 -# asm 2: movd in8=%eax -movd %xmm0,%eax - -# qhasm: in9 = z9 -# asm 1: movd in9=int32#2 -# asm 2: movd in9=%ecx -movd %xmm1,%ecx - -# qhasm: in10 = z10 -# asm 1: movd in10=int32#4 -# asm 2: movd in10=%ebx -movd %xmm2,%ebx - -# qhasm: in11 = z11 -# asm 1: movd in11=int32#7 -# asm 2: movd in11=%ebp -movd %xmm3,%ebp - -# qhasm: z8 <<<= 96 -# asm 1: pshufd $0x39,in8=int32#1 -# asm 2: movd in8=%eax -movd %xmm0,%eax - -# qhasm: in9 = z9 -# asm 1: movd in9=int32#2 -# asm 2: movd in9=%ecx -movd %xmm1,%ecx - -# qhasm: in10 = z10 -# asm 1: movd in10=int32#4 -# asm 2: movd in10=%ebx -movd %xmm2,%ebx - -# qhasm: in11 = z11 -# asm 1: movd in11=int32#7 -# asm 2: movd in11=%ebp -movd %xmm3,%ebp - -# qhasm: in8 ^= *(uint32 *) (m + 224) -# asm 1: xorl 224(z12=int6464#1 -# asm 2: movdqa z12=%xmm0 -movdqa 512(%esp),%xmm0 - -# qhasm: z13 = z13_stack -# asm 1: movdqa z13=int6464#2 -# asm 2: movdqa z13=%xmm1 -movdqa 432(%esp),%xmm1 - -# qhasm: z14 = z14_stack -# asm 1: movdqa z14=int6464#3 -# asm 2: movdqa z14=%xmm2 -movdqa 336(%esp),%xmm2 - -# qhasm: z15 = z15_stack -# asm 1: movdqa z15=int6464#4 -# asm 2: movdqa z15=%xmm3 -movdqa 320(%esp),%xmm3 - -# qhasm: uint32323232 z12 += orig12 -# asm 1: paddd in12=int32#1 -# asm 2: movd in12=%eax -movd %xmm0,%eax - -# qhasm: in13 = z13 -# asm 1: movd in13=int32#2 -# asm 2: movd in13=%ecx -movd %xmm1,%ecx - -# qhasm: in14 = z14 -# asm 1: movd in14=int32#4 -# asm 2: movd in14=%ebx -movd %xmm2,%ebx - -# qhasm: in15 = z15 -# asm 1: movd in15=int32#7 -# asm 2: movd in15=%ebp -movd %xmm3,%ebp - -# qhasm: z12 <<<= 96 -# asm 1: pshufd $0x39,in12=int32#1 -# asm 2: movd in12=%eax -movd %xmm0,%eax - -# qhasm: in13 = z13 -# asm 1: movd in13=int32#2 -# asm 2: movd in13=%ecx -movd %xmm1,%ecx - -# qhasm: in14 = z14 -# asm 1: movd in14=int32#4 -# asm 2: movd in14=%ebx -movd %xmm2,%ebx - -# qhasm: in15 = z15 -# asm 1: movd in15=int32#7 -# asm 2: movd in15=%ebp -movd %xmm3,%ebp - -# qhasm: z12 <<<= 96 -# asm 1: pshufd $0x39,in12=int32#1 -# asm 2: movd in12=%eax -movd %xmm0,%eax - -# qhasm: in13 = z13 -# asm 1: movd in13=int32#2 -# asm 2: movd in13=%ecx -movd %xmm1,%ecx - -# qhasm: in14 = z14 -# asm 1: movd in14=int32#4 -# asm 2: movd in14=%ebx -movd %xmm2,%ebx - -# qhasm: in15 = z15 -# asm 1: movd in15=int32#7 -# asm 2: movd in15=%ebp -movd %xmm3,%ebp - -# qhasm: z12 <<<= 96 -# asm 1: pshufd $0x39,in12=int32#1 -# asm 2: movd in12=%eax -movd %xmm0,%eax - -# qhasm: in13 = z13 -# asm 1: movd in13=int32#2 -# asm 2: movd in13=%ecx -movd %xmm1,%ecx - -# qhasm: in14 = z14 -# asm 1: movd in14=int32#4 -# asm 2: movd in14=%ebx -movd %xmm2,%ebx - -# qhasm: in15 = z15 -# asm 1: movd in15=int32#7 -# asm 2: movd in15=%ebp -movd %xmm3,%ebp - -# qhasm: in12 ^= *(uint32 *) (m + 240) -# asm 1: xorl 240(bytes=int32#4 -# asm 2: movl bytes=%ebx -movl 20(%esp),%ebx - -# qhasm: bytes -= 256 -# asm 1: sub $256,? bytes - 0 -# asm 1: cmp $0, -jbe ._done -# comment:fp stack unchanged by fallthrough - -# qhasm: bytesbetween1and255: -._bytesbetween1and255: - -# qhasm: unsignedctarget=stack32#6 -# asm 2: movl ctarget=20(%esp) -movl %edi,20(%esp) - -# qhasm: out = &tmp -# asm 1: leal out=int32#6 -# asm 2: leal out=%edi -leal 576(%esp),%edi - -# qhasm: i = bytes -# asm 1: mov i=int32#2 -# asm 2: mov i=%ecx -mov %ebx,%ecx - -# qhasm: while (i) { *out++ = *m++; --i } -rep movsb - -# qhasm: out = &tmp -# asm 1: leal out=int32#6 -# asm 2: leal out=%edi -leal 576(%esp),%edi - -# qhasm: m = &tmp -# asm 1: leal m=int32#5 -# asm 2: leal m=%esi -leal 576(%esp),%esi -# comment:fp stack unchanged by fallthrough - -# qhasm: nocopy: -._nocopy: - -# qhasm: bytes_backup = bytes -# asm 1: movl bytes_backup=stack32#7 -# asm 2: movl bytes_backup=24(%esp) -movl %ebx,24(%esp) - -# qhasm: diag0 = *(int128 *) (x + 0) -# asm 1: movdqa 0(diag0=int6464#1 -# asm 2: movdqa 0(diag0=%xmm0 -movdqa 0(%edx),%xmm0 - -# qhasm: diag1 = *(int128 *) (x + 16) -# asm 1: movdqa 16(diag1=int6464#2 -# asm 2: movdqa 16(diag1=%xmm1 -movdqa 16(%edx),%xmm1 - -# qhasm: diag2 = *(int128 *) (x + 32) -# asm 1: movdqa 32(diag2=int6464#3 -# asm 2: movdqa 32(diag2=%xmm2 -movdqa 32(%edx),%xmm2 - -# qhasm: diag3 = *(int128 *) (x + 48) -# asm 1: movdqa 48(diag3=int6464#4 -# asm 2: movdqa 48(diag3=%xmm3 -movdqa 48(%edx),%xmm3 - -# qhasm: a0 = diag1 -# asm 1: movdqa a0=int6464#5 -# asm 2: movdqa a0=%xmm4 -movdqa %xmm1,%xmm4 - -# qhasm: i = 20 -# asm 1: mov $20,>i=int32#1 -# asm 2: mov $20,>i=%eax -mov $20,%eax - -# qhasm: mainloop2: -._mainloop2: - -# qhasm: uint32323232 a0 += diag0 -# asm 1: paddd a1=int6464#6 -# asm 2: movdqa a1=%xmm5 -movdqa %xmm0,%xmm5 - -# qhasm: b0 = a0 -# asm 1: movdqa b0=int6464#7 -# asm 2: movdqa b0=%xmm6 -movdqa %xmm4,%xmm6 - -# qhasm: uint32323232 a0 <<= 7 -# asm 1: pslld $7,>= 25 -# asm 1: psrld $25,a2=int6464#5 -# asm 2: movdqa a2=%xmm4 -movdqa %xmm3,%xmm4 - -# qhasm: b1 = a1 -# asm 1: movdqa b1=int6464#7 -# asm 2: movdqa b1=%xmm6 -movdqa %xmm5,%xmm6 - -# qhasm: uint32323232 a1 <<= 9 -# asm 1: pslld $9,>= 23 -# asm 1: psrld $23,a3=int6464#6 -# asm 2: movdqa a3=%xmm5 -movdqa %xmm2,%xmm5 - -# qhasm: b2 = a2 -# asm 1: movdqa b2=int6464#7 -# asm 2: movdqa b2=%xmm6 -movdqa %xmm4,%xmm6 - -# qhasm: uint32323232 a2 <<= 13 -# asm 1: pslld $13,>= 19 -# asm 1: psrld $19,a4=int6464#5 -# asm 2: movdqa a4=%xmm4 -movdqa %xmm3,%xmm4 - -# qhasm: b3 = a3 -# asm 1: movdqa b3=int6464#7 -# asm 2: movdqa b3=%xmm6 -movdqa %xmm5,%xmm6 - -# qhasm: uint32323232 a3 <<= 18 -# asm 1: pslld $18,>= 14 -# asm 1: psrld $14,a5=int6464#6 -# asm 2: movdqa a5=%xmm5 -movdqa %xmm0,%xmm5 - -# qhasm: b4 = a4 -# asm 1: movdqa b4=int6464#7 -# asm 2: movdqa b4=%xmm6 -movdqa %xmm4,%xmm6 - -# qhasm: uint32323232 a4 <<= 7 -# asm 1: pslld $7,>= 25 -# asm 1: psrld $25,a6=int6464#5 -# asm 2: movdqa a6=%xmm4 -movdqa %xmm1,%xmm4 - -# qhasm: b5 = a5 -# asm 1: movdqa b5=int6464#7 -# asm 2: movdqa b5=%xmm6 -movdqa %xmm5,%xmm6 - -# qhasm: uint32323232 a5 <<= 9 -# asm 1: pslld $9,>= 23 -# asm 1: psrld $23,a7=int6464#6 -# asm 2: movdqa a7=%xmm5 -movdqa %xmm2,%xmm5 - -# qhasm: b6 = a6 -# asm 1: movdqa b6=int6464#7 -# asm 2: movdqa b6=%xmm6 -movdqa %xmm4,%xmm6 - -# qhasm: uint32323232 a6 <<= 13 -# asm 1: pslld $13,>= 19 -# asm 1: psrld $19,a0=int6464#5 -# asm 2: movdqa a0=%xmm4 -movdqa %xmm1,%xmm4 - -# qhasm: b7 = a7 -# asm 1: movdqa b7=int6464#7 -# asm 2: movdqa b7=%xmm6 -movdqa %xmm5,%xmm6 - -# qhasm: uint32323232 a7 <<= 18 -# asm 1: pslld $18,>= 14 -# asm 1: psrld $14,a1=int6464#6 -# asm 2: movdqa a1=%xmm5 -movdqa %xmm0,%xmm5 - -# qhasm: b0 = a0 -# asm 1: movdqa b0=int6464#7 -# asm 2: movdqa b0=%xmm6 -movdqa %xmm4,%xmm6 - -# qhasm: uint32323232 a0 <<= 7 -# asm 1: pslld $7,>= 25 -# asm 1: psrld $25,a2=int6464#5 -# asm 2: movdqa a2=%xmm4 -movdqa %xmm3,%xmm4 - -# qhasm: b1 = a1 -# asm 1: movdqa b1=int6464#7 -# asm 2: movdqa b1=%xmm6 -movdqa %xmm5,%xmm6 - -# qhasm: uint32323232 a1 <<= 9 -# asm 1: pslld $9,>= 23 -# asm 1: psrld $23,a3=int6464#6 -# asm 2: movdqa a3=%xmm5 -movdqa %xmm2,%xmm5 - -# qhasm: b2 = a2 -# asm 1: movdqa b2=int6464#7 -# asm 2: movdqa b2=%xmm6 -movdqa %xmm4,%xmm6 - -# qhasm: uint32323232 a2 <<= 13 -# asm 1: pslld $13,>= 19 -# asm 1: psrld $19,a4=int6464#5 -# asm 2: movdqa a4=%xmm4 -movdqa %xmm3,%xmm4 - -# qhasm: b3 = a3 -# asm 1: movdqa b3=int6464#7 -# asm 2: movdqa b3=%xmm6 -movdqa %xmm5,%xmm6 - -# qhasm: uint32323232 a3 <<= 18 -# asm 1: pslld $18,>= 14 -# asm 1: psrld $14,a5=int6464#6 -# asm 2: movdqa a5=%xmm5 -movdqa %xmm0,%xmm5 - -# qhasm: b4 = a4 -# asm 1: movdqa b4=int6464#7 -# asm 2: movdqa b4=%xmm6 -movdqa %xmm4,%xmm6 - -# qhasm: uint32323232 a4 <<= 7 -# asm 1: pslld $7,>= 25 -# asm 1: psrld $25,a6=int6464#5 -# asm 2: movdqa a6=%xmm4 -movdqa %xmm1,%xmm4 - -# qhasm: b5 = a5 -# asm 1: movdqa b5=int6464#7 -# asm 2: movdqa b5=%xmm6 -movdqa %xmm5,%xmm6 - -# qhasm: uint32323232 a5 <<= 9 -# asm 1: pslld $9,>= 23 -# asm 1: psrld $23,a7=int6464#6 -# asm 2: movdqa a7=%xmm5 -movdqa %xmm2,%xmm5 - -# qhasm: b6 = a6 -# asm 1: movdqa b6=int6464#7 -# asm 2: movdqa b6=%xmm6 -movdqa %xmm4,%xmm6 - -# qhasm: uint32323232 a6 <<= 13 -# asm 1: pslld $13,>= 19 -# asm 1: psrld $19,? i -= 4 -# asm 1: sub $4,a0=int6464#5 -# asm 2: movdqa a0=%xmm4 -movdqa %xmm1,%xmm4 - -# qhasm: b7 = a7 -# asm 1: movdqa b7=int6464#7 -# asm 2: movdqa b7=%xmm6 -movdqa %xmm5,%xmm6 - -# qhasm: uint32323232 a7 <<= 18 -# asm 1: pslld $18,b0=int6464#8,>b0=int6464#8 -# asm 2: pxor >b0=%xmm7,>b0=%xmm7 -pxor %xmm7,%xmm7 - -# qhasm: uint32323232 b7 >>= 14 -# asm 1: psrld $14, -ja ._mainloop2 - -# qhasm: uint32323232 diag0 += *(int128 *) (x + 0) -# asm 1: paddd 0(in0=int32#1 -# asm 2: movd in0=%eax -movd %xmm0,%eax - -# qhasm: in12 = diag1 -# asm 1: movd in12=int32#2 -# asm 2: movd in12=%ecx -movd %xmm1,%ecx - -# qhasm: in8 = diag2 -# asm 1: movd in8=int32#4 -# asm 2: movd in8=%ebx -movd %xmm2,%ebx - -# qhasm: in4 = diag3 -# asm 1: movd in4=int32#7 -# asm 2: movd in4=%ebp -movd %xmm3,%ebp - -# qhasm: diag0 <<<= 96 -# asm 1: pshufd $0x39,in5=int32#1 -# asm 2: movd in5=%eax -movd %xmm0,%eax - -# qhasm: in1 = diag1 -# asm 1: movd in1=int32#2 -# asm 2: movd in1=%ecx -movd %xmm1,%ecx - -# qhasm: in13 = diag2 -# asm 1: movd in13=int32#4 -# asm 2: movd in13=%ebx -movd %xmm2,%ebx - -# qhasm: in9 = diag3 -# asm 1: movd in9=int32#7 -# asm 2: movd in9=%ebp -movd %xmm3,%ebp - -# qhasm: diag0 <<<= 96 -# asm 1: pshufd $0x39,in10=int32#1 -# asm 2: movd in10=%eax -movd %xmm0,%eax - -# qhasm: in6 = diag1 -# asm 1: movd in6=int32#2 -# asm 2: movd in6=%ecx -movd %xmm1,%ecx - -# qhasm: in2 = diag2 -# asm 1: movd in2=int32#4 -# asm 2: movd in2=%ebx -movd %xmm2,%ebx - -# qhasm: in14 = diag3 -# asm 1: movd in14=int32#7 -# asm 2: movd in14=%ebp -movd %xmm3,%ebp - -# qhasm: diag0 <<<= 96 -# asm 1: pshufd $0x39,in15=int32#1 -# asm 2: movd in15=%eax -movd %xmm0,%eax - -# qhasm: in11 = diag1 -# asm 1: movd in11=int32#2 -# asm 2: movd in11=%ecx -movd %xmm1,%ecx - -# qhasm: in7 = diag2 -# asm 1: movd in7=int32#4 -# asm 2: movd in7=%ebx -movd %xmm2,%ebx - -# qhasm: in3 = diag3 -# asm 1: movd in3=int32#7 -# asm 2: movd in3=%ebp -movd %xmm3,%ebp - -# qhasm: in15 ^= *(uint32 *) (m + 60) -# asm 1: xorl 60(bytes=int32#4 -# asm 2: movl bytes=%ebx -movl 24(%esp),%ebx - -# qhasm: in8 = *(uint32 *) (x + 32) -# asm 1: movl 32(in8=int32#1 -# asm 2: movl 32(in8=%eax -movl 32(%edx),%eax - -# qhasm: in9 = *(uint32 *) (x + 52) -# asm 1: movl 52(in9=int32#2 -# asm 2: movl 52(in9=%ecx -movl 52(%edx),%ecx - -# qhasm: carry? in8 += 1 -# asm 1: add $1,? unsigned -ja ._bytesatleast65 -# comment:fp stack unchanged by jump - -# qhasm: goto bytesatleast64 if !unsigned< -jae ._bytesatleast64 - -# qhasm: m = out -# asm 1: mov m=int32#5 -# asm 2: mov m=%esi -mov %edi,%esi - -# qhasm: out = ctarget -# asm 1: movl out=int32#6 -# asm 2: movl out=%edi -movl 20(%esp),%edi - -# qhasm: i = bytes -# asm 1: mov i=int32#2 -# asm 2: mov i=%ecx -mov %ebx,%ecx - -# qhasm: while (i) { *out++ = *m++; --i } -rep movsb -# comment:fp stack unchanged by fallthrough - -# qhasm: bytesatleast64: -._bytesatleast64: -# comment:fp stack unchanged by fallthrough - -# qhasm: done: -._done: - -# qhasm: eax = eax_stack -# asm 1: movl eax=int32#1 -# asm 2: movl eax=%eax -movl 0(%esp),%eax - -# qhasm: ebx = ebx_stack -# asm 1: movl ebx=int32#4 -# asm 2: movl ebx=%ebx -movl 4(%esp),%ebx - -# qhasm: esi = esi_stack -# asm 1: movl esi=int32#5 -# asm 2: movl esi=%esi -movl 8(%esp),%esi - -# qhasm: edi = edi_stack -# asm 1: movl edi=int32#6 -# asm 2: movl edi=%edi -movl 12(%esp),%edi - -# qhasm: ebp = ebp_stack -# asm 1: movl ebp=int32#7 -# asm 2: movl ebp=%ebp -movl 16(%esp),%ebp - -# qhasm: leave -add %eax,%esp -ret - -# qhasm: bytesatleast65: -._bytesatleast65: - -# qhasm: bytes -= 64 -# asm 1: sub $64,eax_stack=stack32#1 -# asm 2: movl eax_stack=0(%esp) -movl %eax,0(%esp) - -# qhasm: ebx_stack = ebx -# asm 1: movl ebx_stack=stack32#2 -# asm 2: movl ebx_stack=4(%esp) -movl %ebx,4(%esp) - -# qhasm: esi_stack = esi -# asm 1: movl esi_stack=stack32#3 -# asm 2: movl esi_stack=8(%esp) -movl %esi,8(%esp) - -# qhasm: edi_stack = edi -# asm 1: movl edi_stack=stack32#4 -# asm 2: movl edi_stack=12(%esp) -movl %edi,12(%esp) - -# qhasm: ebp_stack = ebp -# asm 1: movl ebp_stack=stack32#5 -# asm 2: movl ebp_stack=16(%esp) -movl %ebp,16(%esp) - -# qhasm: k = arg2 -# asm 1: movl k=int32#2 -# asm 2: movl k=%ecx -movl 8(%esp,%eax),%ecx - -# qhasm: kbits = arg3 -# asm 1: movl kbits=int32#3 -# asm 2: movl kbits=%edx -movl 12(%esp,%eax),%edx - -# qhasm: x = arg1 -# asm 1: movl x=int32#1 -# asm 2: movl x=%eax -movl 4(%esp,%eax),%eax - -# qhasm: in1 = *(uint32 *) (k + 0) -# asm 1: movl 0(in1=int32#4 -# asm 2: movl 0(in1=%ebx -movl 0(%ecx),%ebx - -# qhasm: in2 = *(uint32 *) (k + 4) -# asm 1: movl 4(in2=int32#5 -# asm 2: movl 4(in2=%esi -movl 4(%ecx),%esi - -# qhasm: in3 = *(uint32 *) (k + 8) -# asm 1: movl 8(in3=int32#6 -# asm 2: movl 8(in3=%edi -movl 8(%ecx),%edi - -# qhasm: in4 = *(uint32 *) (k + 12) -# asm 1: movl 12(in4=int32#7 -# asm 2: movl 12(in4=%ebp -movl 12(%ecx),%ebp - -# qhasm: *(uint32 *) (x + 20) = in1 -# asm 1: movl in11=int32#3 -# asm 2: movl 16(in11=%edx -movl 16(%ecx),%edx - -# qhasm: in12 = *(uint32 *) (k + 20) -# asm 1: movl 20(in12=int32#4 -# asm 2: movl 20(in12=%ebx -movl 20(%ecx),%ebx - -# qhasm: in13 = *(uint32 *) (k + 24) -# asm 1: movl 24(in13=int32#5 -# asm 2: movl 24(in13=%esi -movl 24(%ecx),%esi - -# qhasm: in14 = *(uint32 *) (k + 28) -# asm 1: movl 28(in14=int32#2 -# asm 2: movl 28(in14=%ecx -movl 28(%ecx),%ecx - -# qhasm: *(uint32 *) (x + 28) = in11 -# asm 1: movl in0=int32#2 -# asm 2: mov $1634760805,>in0=%ecx -mov $1634760805,%ecx - -# qhasm: in5 = 857760878 -# asm 1: mov $857760878,>in5=int32#3 -# asm 2: mov $857760878,>in5=%edx -mov $857760878,%edx - -# qhasm: in10 = 2036477234 -# asm 1: mov $2036477234,>in10=int32#4 -# asm 2: mov $2036477234,>in10=%ebx -mov $2036477234,%ebx - -# qhasm: in15 = 1797285236 -# asm 1: mov $1797285236,>in15=int32#5 -# asm 2: mov $1797285236,>in15=%esi -mov $1797285236,%esi - -# qhasm: *(uint32 *) (x + 0) = in0 -# asm 1: movl in11=int32#3 -# asm 2: movl 0(in11=%edx -movl 0(%ecx),%edx - -# qhasm: in12 = *(uint32 *) (k + 4) -# asm 1: movl 4(in12=int32#4 -# asm 2: movl 4(in12=%ebx -movl 4(%ecx),%ebx - -# qhasm: in13 = *(uint32 *) (k + 8) -# asm 1: movl 8(in13=int32#5 -# asm 2: movl 8(in13=%esi -movl 8(%ecx),%esi - -# qhasm: in14 = *(uint32 *) (k + 12) -# asm 1: movl 12(in14=int32#2 -# asm 2: movl 12(in14=%ecx -movl 12(%ecx),%ecx - -# qhasm: *(uint32 *) (x + 28) = in11 -# asm 1: movl in0=int32#2 -# asm 2: mov $1634760805,>in0=%ecx -mov $1634760805,%ecx - -# qhasm: in5 = 824206446 -# asm 1: mov $824206446,>in5=int32#3 -# asm 2: mov $824206446,>in5=%edx -mov $824206446,%edx - -# qhasm: in10 = 2036477238 -# asm 1: mov $2036477238,>in10=int32#4 -# asm 2: mov $2036477238,>in10=%ebx -mov $2036477238,%ebx - -# qhasm: in15 = 1797285236 -# asm 1: mov $1797285236,>in15=int32#5 -# asm 2: mov $1797285236,>in15=%esi -mov $1797285236,%esi - -# qhasm: *(uint32 *) (x + 0) = in0 -# asm 1: movl eax=int32#1 -# asm 2: movl eax=%eax -movl 0(%esp),%eax - -# qhasm: ebx = ebx_stack -# asm 1: movl ebx=int32#4 -# asm 2: movl ebx=%ebx -movl 4(%esp),%ebx - -# qhasm: esi = esi_stack -# asm 1: movl esi=int32#5 -# asm 2: movl esi=%esi -movl 8(%esp),%esi - -# qhasm: edi = edi_stack -# asm 1: movl edi=int32#6 -# asm 2: movl edi=%edi -movl 12(%esp),%edi - -# qhasm: ebp = ebp_stack -# asm 1: movl ebp=int32#7 -# asm 2: movl ebp=%ebp -movl 16(%esp),%ebp - -# qhasm: leave -add %eax,%esp -ret - -# qhasm: enter ECRYPT_ivsetup -.text -.p2align 5 -.globl _ECRYPT_ivsetup -.globl ECRYPT_ivsetup -_ECRYPT_ivsetup: -ECRYPT_ivsetup: -mov %esp,%eax -and $31,%eax -add $640,%eax -sub %eax,%esp - -# qhasm: eax_stack = eax -# asm 1: movl eax_stack=stack32#1 -# asm 2: movl eax_stack=0(%esp) -movl %eax,0(%esp) - -# qhasm: ebx_stack = ebx -# asm 1: movl ebx_stack=stack32#2 -# asm 2: movl ebx_stack=4(%esp) -movl %ebx,4(%esp) - -# qhasm: esi_stack = esi -# asm 1: movl esi_stack=stack32#3 -# asm 2: movl esi_stack=8(%esp) -movl %esi,8(%esp) - -# qhasm: edi_stack = edi -# asm 1: movl edi_stack=stack32#4 -# asm 2: movl edi_stack=12(%esp) -movl %edi,12(%esp) - -# qhasm: ebp_stack = ebp -# asm 1: movl ebp_stack=stack32#5 -# asm 2: movl ebp_stack=16(%esp) -movl %ebp,16(%esp) - -# qhasm: iv = arg2 -# asm 1: movl iv=int32#2 -# asm 2: movl iv=%ecx -movl 8(%esp,%eax),%ecx - -# qhasm: x = arg1 -# asm 1: movl x=int32#1 -# asm 2: movl x=%eax -movl 4(%esp,%eax),%eax - -# qhasm: in6 = *(uint32 *) (iv + 0) -# asm 1: movl 0(in6=int32#3 -# asm 2: movl 0(in6=%edx -movl 0(%ecx),%edx - -# qhasm: in7 = *(uint32 *) (iv + 4) -# asm 1: movl 4(in7=int32#2 -# asm 2: movl 4(in7=%ecx -movl 4(%ecx),%ecx - -# qhasm: in8 = 0 -# asm 1: mov $0,>in8=int32#4 -# asm 2: mov $0,>in8=%ebx -mov $0,%ebx - -# qhasm: in9 = 0 -# asm 1: mov $0,>in9=int32#5 -# asm 2: mov $0,>in9=%esi -mov $0,%esi - -# qhasm: *(uint32 *) (x + 24) = in6 -# asm 1: movl eax=int32#1 -# asm 2: movl eax=%eax -movl 0(%esp),%eax - -# qhasm: ebx = ebx_stack -# asm 1: movl ebx=int32#4 -# asm 2: movl ebx=%ebx -movl 4(%esp),%ebx - -# qhasm: esi = esi_stack -# asm 1: movl esi=int32#5 -# asm 2: movl esi=%esi -movl 8(%esp),%esi - -# qhasm: edi = edi_stack -# asm 1: movl edi=int32#6 -# asm 2: movl edi=%edi -movl 12(%esp),%edi - -# qhasm: ebp = ebp_stack -# asm 1: movl ebp=int32#7 -# asm 2: movl ebp=%ebp -movl 16(%esp),%ebp - -# qhasm: leave -add %eax,%esp -ret