swt2c / rpms / pgadmin3

Forked from rpms/pgadmin3 5 years ago
Clone
Blob Blame History Raw
diff -up ./pgadmin/include/libssh2/openssl.h.ssh2 ./pgadmin/include/libssh2/openssl.h
--- ./pgadmin/include/libssh2/openssl.h.ssh2	2017-03-02 21:15:31.459941589 -0500
+++ ./pgadmin/include/libssh2/openssl.h	2017-03-02 21:16:49.728878602 -0500
@@ -119,8 +119,8 @@
 /* returns 0 in case of failure */
 int _libssh2_sha1_init(libssh2_sha1_ctx *ctx);
 #define libssh2_sha1_init(x) _libssh2_sha1_init(x)
-#define libssh2_sha1_update(ctx, data, len) EVP_DigestUpdate(&(ctx), data, len)
-#define libssh2_sha1_final(ctx, out) EVP_DigestFinal(&(ctx), out, NULL)
+#define libssh2_sha1_update(ctx, data, len) EVP_DigestUpdate(ctx, data, len)
+#define libssh2_sha1_final(ctx, out) EVP_DigestFinal(ctx, out, NULL)
 int _libssh2_sha1(const unsigned char *message, unsigned long len,
                   unsigned char *out);
 #define libssh2_sha1(x,y,z) _libssh2_sha1(x,y,z)
@@ -130,8 +130,8 @@ int _libssh2_sha1(const unsigned char *m
 /* returns 0 in case of failure */
 int _libssh2_sha256_init(libssh2_sha256_ctx *ctx);
 #define libssh2_sha256_init(x) _libssh2_sha256_init(x)
-#define libssh2_sha256_update(ctx, data, len) EVP_DigestUpdate(&(ctx), data, len)
-#define libssh2_sha256_final(ctx, out) EVP_DigestFinal(&(ctx), out, NULL)
+#define libssh2_sha256_update(ctx, data, len) EVP_DigestUpdate(ctx, data, len)
+#define libssh2_sha256_final(ctx, out) EVP_DigestFinal(ctx, out, NULL)
 int _libssh2_sha256(const unsigned char *message, unsigned long len,
                   unsigned char *out);
 #define libssh2_sha256(x,y,z) _libssh2_sha256(x,y,z)
@@ -141,8 +141,8 @@ int _libssh2_sha256(const unsigned char
 /* returns 0 in case of failure */
 int _libssh2_md5_init(libssh2_md5_ctx *);
 #define libssh2_md5_init(x) _libssh2_md5_init(x)
-#define libssh2_md5_update(ctx, data, len) EVP_DigestUpdate(&(ctx), data, len)
-#define libssh2_md5_final(ctx, out) EVP_DigestFinal(&(ctx), out, NULL)
+#define libssh2_md5_update(ctx, data, len) EVP_DigestUpdate(ctx, data, len)
+#define libssh2_md5_final(ctx, out) EVP_DigestFinal(ctx, out, NULL)
 
 #define libssh2_hmac_ctx HMAC_CTX
 #define libssh2_hmac_ctx_init(ctx) \
diff -up ./pgadmin/libssh2/crypt.c.ssh2 ./pgadmin/libssh2/crypt.c
--- ./pgadmin/libssh2/crypt.c.ssh2	2015-02-25 05:44:26.000000000 -0500
+++ ./pgadmin/libssh2/crypt.c	2017-03-02 02:20:40.392304773 -0500
@@ -67,7 +67,7 @@ struct crypt_ctx
 {
     int encrypt;
     _libssh2_cipher_type(algo);
-    _libssh2_cipher_ctx h;
+    _libssh2_cipher_ctx *h;
 };
 
 static int
@@ -84,7 +84,8 @@ crypt_init(LIBSSH2_SESSION * session,
 
     ctx->encrypt = encrypt;
     ctx->algo = method->algo;
-    if (_libssh2_cipher_init(&ctx->h, ctx->algo, iv, secret, encrypt)) {
+    ctx->h = EVP_CIPHER_CTX_new();
+    if (_libssh2_cipher_init(ctx->h, ctx->algo, iv, secret, encrypt)) {
         LIBSSH2_FREE(session, ctx);
         return -1;
     }
@@ -100,7 +101,7 @@ crypt_encrypt(LIBSSH2_SESSION * session,
 {
     struct crypt_ctx *cctx = *(struct crypt_ctx **) abstract;
     (void) session;
-    return _libssh2_cipher_crypt(&cctx->h, cctx->algo, cctx->encrypt, block,
+    return _libssh2_cipher_crypt(cctx->h, cctx->algo, cctx->encrypt, block,
                                  blocksize);
 }
 
@@ -109,7 +110,8 @@ crypt_dtor(LIBSSH2_SESSION * session, vo
 {
     struct crypt_ctx **cctx = (struct crypt_ctx **) abstract;
     if (cctx && *cctx) {
-        _libssh2_cipher_dtor(&(*cctx)->h);
+        _libssh2_cipher_dtor((*cctx)->h);
+        EVP_CIPHER_CTX_free((*cctx)->h);
         LIBSSH2_FREE(session, *cctx);
         *abstract = NULL;
     }
@@ -249,7 +251,7 @@ crypt_init_arcfour128(LIBSSH2_SESSION *
         unsigned char block[8];
         size_t discard = 1536;
         for (; discard; discard -= 8)
-            _libssh2_cipher_crypt(&cctx->h, cctx->algo, cctx->encrypt, block,
+            _libssh2_cipher_crypt(cctx->h, cctx->algo, cctx->encrypt, block,
                                   method->blocksize);
     }
 
diff -up ./pgadmin/libssh2/hostkey.c.ssh2 ./pgadmin/libssh2/hostkey.c
--- ./pgadmin/libssh2/hostkey.c.ssh2	2017-03-02 21:04:33.173036660 -0500
+++ ./pgadmin/libssh2/hostkey.c	2017-03-02 21:17:51.096613091 -0500
@@ -203,13 +203,14 @@ hostkey_method_ssh_rsa_signv(LIBSSH2_SES
     int ret;
     int i;
     unsigned char hash[SHA_DIGEST_LENGTH];
-    libssh2_sha1_ctx ctx;
+    libssh2_sha1_ctx *ctx = EVP_MD_CTX_new();
 
-    libssh2_sha1_init(&ctx);
+    libssh2_sha1_init(ctx);
     for(i = 0; i < veccount; i++) {
         libssh2_sha1_update(ctx, datavec[i].iov_base, datavec[i].iov_len);
     }
     libssh2_sha1_final(ctx, hash);
+    EVP_MD_CTX_free(ctx);
 
     ret = _libssh2_rsa_sha1_sign(session, rsactx, hash, SHA_DIGEST_LENGTH,
                                  signature, signature_len);
@@ -421,7 +422,7 @@ hostkey_method_ssh_dss_signv(LIBSSH2_SES
 {
     libssh2_dsa_ctx *dsactx = (libssh2_dsa_ctx *) (*abstract);
     unsigned char hash[SHA_DIGEST_LENGTH];
-    libssh2_sha1_ctx ctx;
+    libssh2_sha1_ctx *ctx;
     int i;
 
     *signature = LIBSSH2_CALLOC(session, 2 * SHA_DIGEST_LENGTH);
@@ -431,11 +432,13 @@ hostkey_method_ssh_dss_signv(LIBSSH2_SES
 
     *signature_len = 2 * SHA_DIGEST_LENGTH;
 
-    libssh2_sha1_init(&ctx);
+    ctx = EVP_MD_CTX_new();
+    libssh2_sha1_init(ctx);
     for(i = 0; i < veccount; i++) {
         libssh2_sha1_update(ctx, datavec[i].iov_base, datavec[i].iov_len);
     }
     libssh2_sha1_final(ctx, hash);
+    EVP_MD_CTX_free(ctx);
 
     if (_libssh2_dsa_sha1_sign(dsactx, hash, SHA_DIGEST_LENGTH, *signature)) {
         LIBSSH2_FREE(session, *signature);
diff -up ./pgadmin/libssh2/openssl.c.ssh2 ./pgadmin/libssh2/openssl.c
--- ./pgadmin/libssh2/openssl.c.ssh2	2017-03-02 21:21:10.939003021 -0500
+++ ./pgadmin/libssh2/openssl.c	2017-03-02 21:20:55.233816040 -0500
@@ -577,14 +577,16 @@ int
 _libssh2_sha1(const unsigned char *message, unsigned long len,
               unsigned char *out)
 {
-    EVP_MD_CTX ctx;
+    EVP_MD_CTX *ctx = EVP_MD_CTX_new();
 
-    EVP_MD_CTX_init(&ctx);
-    if (EVP_DigestInit(&ctx, EVP_get_digestbyname("sha1"))) {
-        EVP_DigestUpdate(&ctx, message, len);
-        EVP_DigestFinal(&ctx, out, NULL);
+    EVP_MD_CTX_init(ctx);
+    if (EVP_DigestInit(ctx, EVP_get_digestbyname("sha1"))) {
+        EVP_DigestUpdate(ctx, message, len);
+        EVP_DigestFinal(ctx, out, NULL);
+	EVP_MD_CTX_free(ctx);
         return 0; /* success */
     }
+    EVP_MD_CTX_free(ctx);
     return 1; /* error */
 }
 
@@ -599,14 +601,16 @@ int
 _libssh2_sha256(const unsigned char *message, unsigned long len,
                 unsigned char *out)
 {
-    EVP_MD_CTX ctx;
+    EVP_MD_CTX *ctx = EVP_MD_CTX_new();
 
-    EVP_MD_CTX_init(&ctx);
-    if(EVP_DigestInit(&ctx, EVP_get_digestbyname("sha256"))) {
-        EVP_DigestUpdate(&ctx, message, len);
-        EVP_DigestFinal(&ctx, out, NULL);
+    EVP_MD_CTX_init(ctx);
+    if(EVP_DigestInit(ctx, EVP_get_digestbyname("sha256"))) {
+        EVP_DigestUpdate(ctx, message, len);
+        EVP_DigestFinal(ctx, out, NULL);
+	EVP_MD_CTX_free(ctx);
         return 0; /* success */
     }
+    EVP_MD_CTX_free(ctx);
     return 1; /* error */
 }