Update OpenSSL-1.1.1-pre9-dev
This commit is contained in:
@@ -76,6 +76,7 @@ extern const EVP_PKEY_ASN1_METHOD ecx25519_asn1_meth;
|
||||
extern const EVP_PKEY_ASN1_METHOD ecx448_asn1_meth;
|
||||
extern const EVP_PKEY_ASN1_METHOD ed25519_asn1_meth;
|
||||
extern const EVP_PKEY_ASN1_METHOD ed448_asn1_meth;
|
||||
extern const EVP_PKEY_ASN1_METHOD sm2_asn1_meth;
|
||||
extern const EVP_PKEY_ASN1_METHOD poly1305_asn1_meth;
|
||||
|
||||
extern const EVP_PKEY_ASN1_METHOD hmac_asn1_meth;
|
||||
|
||||
@@ -90,6 +90,7 @@ extern const EVP_PKEY_METHOD dh_pkey_meth;
|
||||
extern const EVP_PKEY_METHOD dhx_pkey_meth;
|
||||
extern const EVP_PKEY_METHOD dsa_pkey_meth;
|
||||
extern const EVP_PKEY_METHOD ec_pkey_meth;
|
||||
extern const EVP_PKEY_METHOD sm2_pkey_meth;
|
||||
extern const EVP_PKEY_METHOD ecx25519_pkey_meth;
|
||||
extern const EVP_PKEY_METHOD ecx448_pkey_meth;
|
||||
extern const EVP_PKEY_METHOD ed25519_pkey_meth;
|
||||
|
||||
@@ -93,149 +93,31 @@
|
||||
# error "HASH_BLOCK_DATA_ORDER must be defined!"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Engage compiler specific rotate intrinsic function if available.
|
||||
*/
|
||||
#undef ROTATE
|
||||
#ifndef PEDANTIC
|
||||
# if defined(_MSC_VER)
|
||||
# define ROTATE(a,n) _lrotl(a,n)
|
||||
# elif defined(__ICC)
|
||||
# define ROTATE(a,n) _rotl(a,n)
|
||||
# elif defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
|
||||
/*
|
||||
* Some GNU C inline assembler templates. Note that these are
|
||||
* rotates by *constant* number of bits! But that's exactly
|
||||
* what we need here...
|
||||
*/
|
||||
# if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__)
|
||||
# define ROTATE(a,n) ({ register unsigned int ret; \
|
||||
asm ( \
|
||||
"roll %1,%0" \
|
||||
: "=r"(ret) \
|
||||
: "I"(n), "0"((unsigned int)(a)) \
|
||||
: "cc"); \
|
||||
ret; \
|
||||
})
|
||||
# elif defined(_ARCH_PPC) || defined(_ARCH_PPC64) || \
|
||||
defined(__powerpc) || defined(__ppc__) || defined(__powerpc64__)
|
||||
# define ROTATE(a,n) ({ register unsigned int ret; \
|
||||
asm ( \
|
||||
"rlwinm %0,%1,%2,0,31" \
|
||||
: "=r"(ret) \
|
||||
: "r"(a), "I"(n)); \
|
||||
ret; \
|
||||
})
|
||||
# elif defined(__s390x__)
|
||||
# define ROTATE(a,n) ({ register unsigned int ret; \
|
||||
asm ("rll %0,%1,%2" \
|
||||
: "=r"(ret) \
|
||||
: "r"(a), "I"(n)); \
|
||||
ret; \
|
||||
})
|
||||
# endif
|
||||
# endif
|
||||
#endif /* PEDANTIC */
|
||||
|
||||
#ifndef ROTATE
|
||||
# define ROTATE(a,n) (((a)<<(n))|(((a)&0xffffffff)>>(32-(n))))
|
||||
#endif
|
||||
#define ROTATE(a,n) (((a)<<(n))|(((a)&0xffffffff)>>(32-(n))))
|
||||
|
||||
#if defined(DATA_ORDER_IS_BIG_ENDIAN)
|
||||
|
||||
# ifndef PEDANTIC
|
||||
# if defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
|
||||
# if ((defined(__i386) || defined(__i386__)) && !defined(I386_ONLY)) || \
|
||||
(defined(__x86_64) || defined(__x86_64__))
|
||||
# if !defined(B_ENDIAN)
|
||||
/*
|
||||
* This gives ~30-40% performance improvement in SHA-256 compiled
|
||||
* with gcc [on P4]. Well, first macro to be frank. We can pull
|
||||
* this trick on x86* platforms only, because these CPUs can fetch
|
||||
* unaligned data without raising an exception.
|
||||
*/
|
||||
# define HOST_c2l(c,l) ({ unsigned int r=*((const unsigned int *)(c)); \
|
||||
asm ("bswapl %0":"=r"(r):"0"(r)); \
|
||||
(c)+=4; (l)=r; })
|
||||
# define HOST_l2c(l,c) ({ unsigned int r=(l); \
|
||||
asm ("bswapl %0":"=r"(r):"0"(r)); \
|
||||
*((unsigned int *)(c))=r; (c)+=4; r; })
|
||||
# endif
|
||||
# elif defined(__aarch64__)
|
||||
# if defined(__BYTE_ORDER__)
|
||||
# if defined(__ORDER_LITTLE_ENDIAN__) && __BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__
|
||||
# define HOST_c2l(c,l) ({ unsigned int r; \
|
||||
asm ("rev %w0,%w1" \
|
||||
:"=r"(r) \
|
||||
:"r"(*((const unsigned int *)(c))));\
|
||||
(c)+=4; (l)=r; })
|
||||
# define HOST_l2c(l,c) ({ unsigned int r; \
|
||||
asm ("rev %w0,%w1" \
|
||||
:"=r"(r) \
|
||||
:"r"((unsigned int)(l)));\
|
||||
*((unsigned int *)(c))=r; (c)+=4; r; })
|
||||
# elif defined(__ORDER_BIG_ENDIAN__) && __BYTE_ORDER__==__ORDER_BIG_ENDIAN__
|
||||
# define HOST_c2l(c,l) ((l)=*((const unsigned int *)(c)), (c)+=4, (l))
|
||||
# define HOST_l2c(l,c) (*((unsigned int *)(c))=(l), (c)+=4, (l))
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# if defined(__s390__) || defined(__s390x__)
|
||||
# define HOST_c2l(c,l) ((l)=*((const unsigned int *)(c)), (c)+=4, (l))
|
||||
# define HOST_l2c(l,c) (*((unsigned int *)(c))=(l), (c)+=4, (l))
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifndef HOST_c2l
|
||||
# define HOST_c2l(c,l) (l =(((unsigned long)(*((c)++)))<<24), \
|
||||
# define HOST_c2l(c,l) (l =(((unsigned long)(*((c)++)))<<24), \
|
||||
l|=(((unsigned long)(*((c)++)))<<16), \
|
||||
l|=(((unsigned long)(*((c)++)))<< 8), \
|
||||
l|=(((unsigned long)(*((c)++))) ) )
|
||||
# endif
|
||||
# ifndef HOST_l2c
|
||||
# define HOST_l2c(l,c) (*((c)++)=(unsigned char)(((l)>>24)&0xff), \
|
||||
# define HOST_l2c(l,c) (*((c)++)=(unsigned char)(((l)>>24)&0xff), \
|
||||
*((c)++)=(unsigned char)(((l)>>16)&0xff), \
|
||||
*((c)++)=(unsigned char)(((l)>> 8)&0xff), \
|
||||
*((c)++)=(unsigned char)(((l) )&0xff), \
|
||||
l)
|
||||
# endif
|
||||
|
||||
#elif defined(DATA_ORDER_IS_LITTLE_ENDIAN)
|
||||
|
||||
# ifndef PEDANTIC
|
||||
# if defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM)
|
||||
# if defined(__s390x__)
|
||||
# define HOST_c2l(c,l) ({ asm ("lrv %0,%1" \
|
||||
:"=d"(l) :"m"(*(const unsigned int *)(c)));\
|
||||
(c)+=4; (l); })
|
||||
# define HOST_l2c(l,c) ({ asm ("strv %1,%0" \
|
||||
:"=m"(*(unsigned int *)(c)) :"d"(l));\
|
||||
(c)+=4; (l); })
|
||||
# endif
|
||||
# endif
|
||||
# if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__)
|
||||
# ifndef B_ENDIAN
|
||||
/* See comment in DATA_ORDER_IS_BIG_ENDIAN section. */
|
||||
# define HOST_c2l(c,l) ((l)=*((const unsigned int *)(c)), (c)+=4, l)
|
||||
# define HOST_l2c(l,c) (*((unsigned int *)(c))=(l), (c)+=4, l)
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifndef HOST_c2l
|
||||
# define HOST_c2l(c,l) (l =(((unsigned long)(*((c)++))) ), \
|
||||
# define HOST_c2l(c,l) (l =(((unsigned long)(*((c)++))) ), \
|
||||
l|=(((unsigned long)(*((c)++)))<< 8), \
|
||||
l|=(((unsigned long)(*((c)++)))<<16), \
|
||||
l|=(((unsigned long)(*((c)++)))<<24) )
|
||||
# endif
|
||||
# ifndef HOST_l2c
|
||||
# define HOST_l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \
|
||||
# define HOST_l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \
|
||||
*((c)++)=(unsigned char)(((l)>> 8)&0xff), \
|
||||
*((c)++)=(unsigned char)(((l)>>16)&0xff), \
|
||||
*((c)++)=(unsigned char)(((l)>>24)&0xff), \
|
||||
l)
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -42,15 +42,15 @@ int sm2_do_verify(const EC_KEY *key,
|
||||
const char *user_id, const uint8_t *msg, size_t msg_len);
|
||||
|
||||
/*
|
||||
* SM2 signature generation. Assumes input is an SM3 digest
|
||||
* SM2 signature generation.
|
||||
*/
|
||||
int sm2_sign(int type, const unsigned char *dgst, int dgstlen,
|
||||
int sm2_sign(const unsigned char *dgst, int dgstlen,
|
||||
unsigned char *sig, unsigned int *siglen, EC_KEY *eckey);
|
||||
|
||||
/*
|
||||
* SM2 signature verification. Assumes input is an SM3 digest
|
||||
* SM2 signature verification.
|
||||
*/
|
||||
int sm2_verify(int type, const unsigned char *dgst, int dgstlen,
|
||||
int sm2_verify(const unsigned char *dgst, int dgstlen,
|
||||
const unsigned char *sig, int siglen, EC_KEY *eckey);
|
||||
|
||||
|
||||
|
||||
@@ -23,6 +23,10 @@ int ERR_load_SM2_strings(void);
|
||||
/*
|
||||
* SM2 function codes.
|
||||
*/
|
||||
# define SM2_F_PKEY_SM2_CTRL 109
|
||||
# define SM2_F_PKEY_SM2_CTRL_STR 110
|
||||
# define SM2_F_PKEY_SM2_INIT 111
|
||||
# define SM2_F_PKEY_SM2_SIGN 112
|
||||
# define SM2_F_SM2_COMPUTE_MSG_HASH 100
|
||||
# define SM2_F_SM2_COMPUTE_USERID_DIGEST 101
|
||||
# define SM2_F_SM2_DECRYPT 102
|
||||
@@ -38,10 +42,13 @@ int ERR_load_SM2_strings(void);
|
||||
*/
|
||||
# define SM2_R_ASN1_ERROR 100
|
||||
# define SM2_R_BAD_SIGNATURE 101
|
||||
# define SM2_R_BUFFER_TOO_SMALL 107
|
||||
# define SM2_R_INVALID_CURVE 108
|
||||
# define SM2_R_INVALID_DIGEST 102
|
||||
# define SM2_R_INVALID_DIGEST_TYPE 103
|
||||
# define SM2_R_INVALID_ENCODING 104
|
||||
# define SM2_R_INVALID_FIELD 105
|
||||
# define SM2_R_NO_PARAMETERS_SET 109
|
||||
# define SM2_R_USER_ID_TOO_LARGE 106
|
||||
|
||||
# endif
|
||||
|
||||
Reference in New Issue
Block a user