diff options
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), }; |