diff options
author | George Hazan <george.hazan@gmail.com> | 2013-06-02 21:56:22 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-06-02 21:56:22 +0000 |
commit | f9944b07bb7623a9c27802c5e83d5f0e3f0e8597 (patch) | |
tree | ff8a2cf391c0545377e28f14a441259b3347d0d4 /protocols/WhatsApp/src/OpenSSL/m_sha1.c | |
parent | e1db6121679890cb4032144a8c1d05b5effcefc4 (diff) |
crash fix
git-svn-id: http://svn.miranda-ng.org/main/trunk@4868 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/WhatsApp/src/OpenSSL/m_sha1.c')
-rw-r--r-- | protocols/WhatsApp/src/OpenSSL/m_sha1.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/protocols/WhatsApp/src/OpenSSL/m_sha1.c b/protocols/WhatsApp/src/OpenSSL/m_sha1.c index e6fc768cc2..c78fe11a77 100644 --- a/protocols/WhatsApp/src/OpenSSL/m_sha1.c +++ b/protocols/WhatsApp/src/OpenSSL/m_sha1.c @@ -71,6 +71,8 @@ #define SHA_LAST_BLOCK (SHA_CBLOCK-8) #define SHA_DIGEST_LENGTH 20 +#define NID_rsaEncryption 6 +#define NID_rsa 19 #define NID_sha1 64 #define NID_sha1WithRSAEncryption 65 @@ -84,6 +86,17 @@ typedef struct SHAstate_st #include "sha_locl.h" +/* The following 2 functions sign and verify a X509_SIG ASN1 object + * inside PKCS#1 padded RSA encryption */ +int RSA_sign(int type, const unsigned char *m, unsigned int m_length, + unsigned char *sigret, unsigned int *siglen, void *rsa); +int RSA_verify(int type, const unsigned char *m, unsigned int m_length, + unsigned char *sigbuf, unsigned int siglen, void *rsa); + +#define EVP_PKEY_RSA_method (evp_sign_method *)RSA_sign, \ + (evp_verify_method *)RSA_verify, \ + {EVP_PKEY_RSA,EVP_PKEY_RSA2,0,0} + static int init(EVP_MD_CTX *ctx) { return SHA1_Init(ctx->md_data); } @@ -93,7 +106,7 @@ static int update(EVP_MD_CTX *ctx,const void *data,size_t count) static int final(EVP_MD_CTX *ctx,unsigned char *md) { return SHA1_Final(md,ctx->md_data); } -static const EVP_MD sha1_md= +static const EVP_MD sha1_md = { NID_sha1, NID_sha1WithRSAEncryption, @@ -104,7 +117,7 @@ static const EVP_MD sha1_md= final, NULL, NULL, - NULL, + EVP_PKEY_RSA_method, SHA_CBLOCK, sizeof(EVP_MD *)+sizeof(SHA_CTX), }; |