Anchor AES and SHA-256/-512 assembler from C.
This commit is contained in:
parent
22edcae7fa
commit
859ceeeb51
@ -873,6 +873,7 @@ int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef AES_ASM
|
||||||
/*
|
/*
|
||||||
* Encrypt a single block
|
* Encrypt a single block
|
||||||
* in and out can overlap
|
* in and out can overlap
|
||||||
@ -1255,3 +1256,4 @@ void AES_decrypt(const unsigned char *in, unsigned char *out,
|
|||||||
PUTU32(out + 12, s3);
|
PUTU32(out + 12, s3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif /* AES_ASM */
|
||||||
|
@ -5,7 +5,8 @@ require "x86asm.pl";
|
|||||||
|
|
||||||
&asm_init($ARGV[0],$0);
|
&asm_init($ARGV[0],$0);
|
||||||
|
|
||||||
$sse2=0; # SSE2 is temporarily disabled...
|
$sse2=0;
|
||||||
|
for (@ARGV) { $sse2=1 if (/-DOPENSSL_IA32_SSE2/); }
|
||||||
|
|
||||||
&bn_mul_add_words("bn_mul_add_words");
|
&bn_mul_add_words("bn_mul_add_words");
|
||||||
&bn_mul_words("bn_mul_words");
|
&bn_mul_words("bn_mul_words");
|
||||||
|
@ -117,6 +117,9 @@ void sha256_block_data_order (SHA256_CTX *ctx, const void *in, size_t num);
|
|||||||
|
|
||||||
#include "md32_common.h"
|
#include "md32_common.h"
|
||||||
|
|
||||||
|
#ifdef SHA256_ASM
|
||||||
|
void sha256_block (SHA256_CTX *ctx, const void *in, size_t num, int host);
|
||||||
|
#else
|
||||||
static const SHA_LONG K256[64] = {
|
static const SHA_LONG K256[64] = {
|
||||||
0x428a2f98UL,0x71374491UL,0xb5c0fbcfUL,0xe9b5dba5UL,
|
0x428a2f98UL,0x71374491UL,0xb5c0fbcfUL,0xe9b5dba5UL,
|
||||||
0x3956c25bUL,0x59f111f1UL,0x923f82a4UL,0xab1c5ed5UL,
|
0x3956c25bUL,0x59f111f1UL,0x923f82a4UL,0xab1c5ed5UL,
|
||||||
@ -296,6 +299,7 @@ static void sha256_block (SHA256_CTX *ctx, const void *in, size_t num, int host)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* SHA256_ASM */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Idea is to trade couple of cycles for some space. On IA-32 we save
|
* Idea is to trade couple of cycles for some space. On IA-32 we save
|
||||||
|
@ -83,7 +83,10 @@ int SHA512_Init (SHA512_CTX *c)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sha512_block (SHA512_CTX *ctx, const void *in, size_t num);
|
#ifndef SHA512_ASM
|
||||||
|
static
|
||||||
|
#endif
|
||||||
|
void sha512_block (SHA512_CTX *ctx, const void *in, size_t num);
|
||||||
|
|
||||||
int SHA512_Final (unsigned char *md, SHA512_CTX *c)
|
int SHA512_Final (unsigned char *md, SHA512_CTX *c)
|
||||||
{
|
{
|
||||||
@ -241,6 +244,7 @@ unsigned char *SHA512(const unsigned char *d, size_t n, unsigned char *md)
|
|||||||
return(md);
|
return(md);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef SHA512_ASM
|
||||||
static const SHA_LONG64 K512[80] = {
|
static const SHA_LONG64 K512[80] = {
|
||||||
U64(0x428a2f98d728ae22),U64(0x7137449123ef65cd),
|
U64(0x428a2f98d728ae22),U64(0x7137449123ef65cd),
|
||||||
U64(0xb5c0fbcfec4d3b2f),U64(0xe9b5dba58189dbbc),
|
U64(0xb5c0fbcfec4d3b2f),U64(0xe9b5dba58189dbbc),
|
||||||
@ -476,3 +480,5 @@ static void sha512_block (SHA512_CTX *ctx, const void *in, size_t num)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endif /* SHA512_ASM */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user