script: call function string_hash in script_repo_sha512sum_file to compute SHA512 hash

This removes dependency on libgcrypt in script plugin.
v2.8-utf8proc
Sébastien Helleu 2020-03-01 09:08:48 +01:00
parent bb363ab27f
commit 3472793d24
9 changed files with 11 additions and 29 deletions

View File

@ -108,7 +108,7 @@ zu kompilieren und welche Pakete optional genutzt werden können.
| libncursesw5-dev ^(2)^ | | *ja* | Ncurses Oberfläche.
| libcurl4-gnutls-dev | | *ja* | URL Transfer.
| zlib1g-dev | | *ja* | Kompression für Pakete, die mittels Relay- (WeeChat Protokoll), Script-Erweiterung übertragen werden.
| libgcrypt20-dev | | *ja* | Geschützte Daten, IRC SASL Authentifikation (DH-BLOWFISH/DH-AES), Skript-Erweiterung.
| libgcrypt20-dev | | *ja* | Geschützte Daten, IRC SASL Authentifikation (DH-BLOWFISH/DH-AES).
| libgnutls28-dev | ≥ 2.2.0 ^(3)^ | | SSL Verbindung zu einem IRC Server, Unterstützung von SSL in der Relay-Erweiterung, IRC SASL Authentifikation (ECDSA-NIST256P-CHALLENGE).
| gettext | | | Internationalisierung (Übersetzung der Mitteilungen; Hauptsprache ist englisch).
| ca-certificates | | | Zertifikate für SSL Verbindungen.

View File

@ -102,7 +102,7 @@ compile WeeChat.
| libncursesw5-dev ^(2)^ | | *yes* | Ncurses interface.
| libcurl4-gnutls-dev | | *yes* | URL transfer.
| zlib1g-dev | | *yes* | Compression of packets in relay plugin (weechat protocol), script plugin.
| libgcrypt20-dev | | *yes* | Secured data, IRC SASL authentication (DH-BLOWFISH/DH-AES), script plugin.
| libgcrypt20-dev | | *yes* | Secured data, IRC SASL authentication (DH-BLOWFISH/DH-AES).
| libgnutls28-dev | ≥ 2.2.0 ^(3)^ | | SSL connection to IRC server, support of SSL in relay plugin, IRC SASL authentication (ECDSA-NIST256P-CHALLENGE).
| gettext | | | Internationalization (translation of messages; base language is English).
| ca-certificates | | | Certificates for SSL connections.

View File

@ -105,7 +105,7 @@ compiler WeeChat.
| libncursesw5-dev ^(2)^ | | *oui* | Interface ncurses.
| libcurl4-gnutls-dev | | *oui* | Transfert d'URL.
| zlib1g-dev | | *oui* | Compression des paquets dans l'extension relay (protocole weechat), extension script.
| libgcrypt20-dev | | *oui* | Données sécurisées, authentification IRC SASL (DH-BLOWFISH/DH-AES), extension script.
| libgcrypt20-dev | | *oui* | Données sécurisées, authentification IRC SASL (DH-BLOWFISH/DH-AES).
| libgnutls28-dev | ≥ 2.2.0 ^(3)^ | | Connexion SSL au serveur IRC, support SSL dans l'extension relay, authentification IRC SASL (ECDSA-NIST256P-CHALLENGE).
| gettext | | | Internationalisation (traduction des messages; la langue de base est l'anglais).
| ca-certificates | | | Certificats pour les connexions SSL.

View File

@ -123,7 +123,7 @@ compilare WeeChat.
// TRANSLATION MISSING
| zlib1g-dev | | *sì* | Compression of packets in relay plugin (weechat protocol), script plugin.
// TRANSLATION MISSING
| libgcrypt20-dev | | *sì* | Secured data, IRC SASL authentication (DH-BLOWFISH/DH-AES), script plugin.
| libgcrypt20-dev | | *sì* | Secured data, IRC SASL authentication (DH-BLOWFISH/DH-AES).
// TRANSLATION MISSING
| libgnutls28-dev | ≥ 2.2.0 ^(3)^ | | Connessione SSL al server IRC, support of SSL in relay plugin, IRC SASL authentication (ECDSA-NIST256P-CHALLENGE).
| gettext | | | Internazionalizzazione (traduzione dei messaggi; la lingua base è l'inglese).

View File

@ -107,7 +107,7 @@ macOS では https://brew.sh/[Homebrew] を使ってください:
| libncursesw5-dev ^(2)^ | | *必須* | ncurses インターフェース
| libcurl4-gnutls-dev | | *必須* | URL 転送
| zlib1g-dev | | *必須* | relay プラグインでパケットを圧縮 (weechat プロトコル)、スクリプトプラグイン
| libgcrypt20-dev | | *必須* | 保護データ、IRC SASL 認証 (DH-BLOWFISH/DH-AES)、スクリプトプラグイン
| libgcrypt20-dev | | *必須* | 保護データ、IRC SASL 認証 (DH-BLOWFISH/DH-AES)
| libgnutls28-dev | 2.2.0 以上 ^(3)^ | | IRC サーバへの SSL 接続、IRC SASL 認証 (ECDSA-NIST256P-CHALLENGE)
| gettext | | | 国際化 (メッセージの翻訳; ベース言語は英語です)
| ca-certificates | | | SSL 接続に必要な証明書、relay プラグインで SSL サポート

View File

@ -108,7 +108,7 @@ WeeChat.
| libncursesw5-dev ^(2)^ | | *tak* | Interfejs ncurses.
| libcurl4-gnutls-dev | | *tak* | Transfer URL.
| zlib1g-dev | | *tak* | Kompresja pakietów we wtyczce relay (protokół weechat), wtyczka script.
| libgcrypt20-dev | | *tak* | Zabezpieczone dane, uwierzytelnianie IRC SASL (DH-BLOWFISH/DH-AES), wtyczka script.
| libgcrypt20-dev | | *tak* | Zabezpieczone dane, uwierzytelnianie IRC SASL (DH-BLOWFISH/DH-AES).
| libgnutls28-dev | ≥ 2.2.0 ^(3)^ | | Połączenia SSL z serwerami IRC, wsparcie dla SSL we wtyczce relay, uwierzytelnianie IRC SASL (ECDSA-NIST256P-CHALLENGE).
| gettext | | | Internacjonalizacja (tłumaczenie wiadomości; język bazowy to Angielski).
| ca-certificates | | | Certyfikaty dla połączeń SSL.

View File

@ -33,7 +33,6 @@ set_target_properties(script PROPERTIES PREFIX "")
set(LINK_LIBS)
list(APPEND LINK_LIBS ${ZLIB_LIBRARY})
list(APPEND LINK_LIBS ${GCRYPT_LDFLAGS})
target_link_libraries(script ${LINK_LIBS} coverage_config)

View File

@ -17,7 +17,7 @@
# along with WeeChat. If not, see <https://www.gnu.org/licenses/>.
#
AM_CPPFLAGS = -DLOCALEDIR=\"$(datadir)/locale\" $(ZLIB_CFLAGS) $(GCRYPT_CFLAGS)
AM_CPPFLAGS = -DLOCALEDIR=\"$(datadir)/locale\" $(ZLIB_CFLAGS)
libdir = ${weechat_libdir}/plugins
@ -43,6 +43,6 @@ script_la_SOURCES = script.c \
script-repo.h
script_la_LDFLAGS = -module -no-undefined
script_la_LIBADD = $(SCRIPT_LFLAGS) $(ZLIB_LFLAGS) $(GCRYPT_LFLAGS)
script_la_LIBADD = $(SCRIPT_LFLAGS) $(ZLIB_LFLAGS)
EXTRA_DIST = CMakeLists.txt

View File

@ -36,7 +36,6 @@
#include <stdio.h>
#include <time.h>
#include <zlib.h>
#include <gcrypt.h>
#include "../weechat-plugin.h"
#include "script.h"
@ -756,13 +755,7 @@ script_repo_sha512sum_file (const char *filename)
{
struct stat st;
FILE *file;
char sha512sum[512];
const char *hexa = "0123456789abcdef";
unsigned char *data, *result;
gcry_md_hd_t hd;
int mdlen, i;
sha512sum[0] = '\0';
char *data, *hash;
if (stat (filename, &st) == -1)
return NULL;
@ -780,21 +773,11 @@ script_repo_sha512sum_file (const char *filename)
}
fclose (file);
gcry_md_open (&hd, GCRY_MD_SHA512, 0);
mdlen = gcry_md_get_algo_dlen (GCRY_MD_SHA512);
gcry_md_write (hd, data, st.st_size);
result = gcry_md_read (hd, GCRY_MD_SHA512);
for (i = 0; i < mdlen; i++)
{
sha512sum[i * 2] = hexa[(result[i] & 0xFF) / 16];
sha512sum[(i * 2) + 1] = hexa[(result[i] & 0xFF) % 16];
}
sha512sum[((mdlen - 1) * 2) + 2] = '\0';
gcry_md_close (hd);
hash = weechat_string_hash (data, st.st_size, "sha512");
free (data);
return strdup (sha512sum);
return hash;
}
/*