summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/en/weechat_plugin_api.en.adoc8
-rw-r--r--doc/fr/weechat_plugin_api.fr.adoc8
-rw-r--r--doc/it/weechat_plugin_api.it.adoc8
-rw-r--r--doc/ja/weechat_plugin_api.ja.adoc8
-rw-r--r--src/core/wee-crypto.c4
-rw-r--r--tests/unit/core/test-core-crypto.cpp2
6 files changed, 22 insertions, 16 deletions
diff --git a/doc/en/weechat_plugin_api.en.adoc b/doc/en/weechat_plugin_api.en.adoc
index ad284b573..0d72b7a5c 100644
--- a/doc/en/weechat_plugin_api.en.adoc
+++ b/doc/en/weechat_plugin_api.en.adoc
@@ -3368,10 +3368,10 @@ Supported hash algorithms:
| `+sha256+` | SHA-256 | 32 bytes (256 bits) |
| `+sha384+` | SHA-384 | 48 bytes (384 bits) |
| `+sha512+` | SHA-512 | 64 bytes (512 bits) |
-| `+sha3-224+` | SHA3-224 | 28 bytes (224 bits) |
-| `+sha3-256+` | SHA3-256 | 32 bytes (256 bits) |
-| `+sha3-384+` | SHA3-384 | 48 bytes (384 bits) |
-| `+sha3-512+` | SHA3-512 | 64 bytes (512 bits) |
+| `+sha3-224+` | SHA3-224 | 28 bytes (224 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
+| `+sha3-256+` | SHA3-256 | 32 bytes (256 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
+| `+sha3-384+` | SHA3-384 | 48 bytes (384 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
+| `+sha3-512+` | SHA3-512 | 64 bytes (512 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
|===
Return value:
diff --git a/doc/fr/weechat_plugin_api.fr.adoc b/doc/fr/weechat_plugin_api.fr.adoc
index d7e8e7a3d..83ca963db 100644
--- a/doc/fr/weechat_plugin_api.fr.adoc
+++ b/doc/fr/weechat_plugin_api.fr.adoc
@@ -3428,10 +3428,10 @@ Algorithmes de hachage supportés :
| `+sha256+` | SHA-256 | 32 octets (256 bits) |
| `+sha384+` | SHA-384 | 48 octets (384 bits) |
| `+sha512+` | SHA-512 | 64 octets (512 bits) |
-| `+sha3-224+` | SHA3-224 | 28 octets (224 bits) |
-| `+sha3-256+` | SHA3-256 | 32 octets (256 bits) |
-| `+sha3-384+` | SHA3-384 | 48 octets (384 bits) |
-| `+sha3-512+` | SHA3-512 | 64 octets (512 bits) |
+| `+sha3-224+` | SHA3-224 | 28 octets (224 bits) | Algorithme disponible avec libgcrypt ≥ 1.7.0.
+| `+sha3-256+` | SHA3-256 | 32 octets (256 bits) | Algorithme disponible avec libgcrypt ≥ 1.7.0.
+| `+sha3-384+` | SHA3-384 | 48 octets (384 bits) | Algorithme disponible avec libgcrypt ≥ 1.7.0.
+| `+sha3-512+` | SHA3-512 | 64 octets (512 bits) | Algorithme disponible avec libgcrypt ≥ 1.7.0.
|===
Valeur de retour :
diff --git a/doc/it/weechat_plugin_api.it.adoc b/doc/it/weechat_plugin_api.it.adoc
index dbd38850b..f7a221c70 100644
--- a/doc/it/weechat_plugin_api.it.adoc
+++ b/doc/it/weechat_plugin_api.it.adoc
@@ -3510,10 +3510,10 @@ Supported hash algorithms:
| `+sha256+` | SHA-256 | 32 bytes (256 bits) |
| `+sha384+` | SHA-384 | 48 bytes (384 bits) |
| `+sha512+` | SHA-512 | 64 bytes (512 bits) |
-| `+sha3-224+` | SHA3-224 | 28 bytes (224 bits) |
-| `+sha3-256+` | SHA3-256 | 32 bytes (256 bits) |
-| `+sha3-384+` | SHA3-384 | 48 bytes (384 bits) |
-| `+sha3-512+` | SHA3-512 | 64 bytes (512 bits) |
+| `+sha3-224+` | SHA3-224 | 28 bytes (224 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
+| `+sha3-256+` | SHA3-256 | 32 bytes (256 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
+| `+sha3-384+` | SHA3-384 | 48 bytes (384 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
+| `+sha3-512+` | SHA3-512 | 64 bytes (512 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
|===
Valore restituito:
diff --git a/doc/ja/weechat_plugin_api.ja.adoc b/doc/ja/weechat_plugin_api.ja.adoc
index a31f4b15c..fb738a897 100644
--- a/doc/ja/weechat_plugin_api.ja.adoc
+++ b/doc/ja/weechat_plugin_api.ja.adoc
@@ -3387,10 +3387,10 @@ Supported hash algorithms:
| `+sha256+` | SHA-256 | 32 bytes (256 bits) |
| `+sha384+` | SHA-384 | 48 bytes (384 bits) |
| `+sha512+` | SHA-512 | 64 bytes (512 bits) |
-| `+sha3-224+` | SHA3-224 | 28 bytes (224 bits) |
-| `+sha3-256+` | SHA3-256 | 32 bytes (256 bits) |
-| `+sha3-384+` | SHA3-384 | 48 bytes (384 bits) |
-| `+sha3-512+` | SHA3-512 | 64 bytes (512 bits) |
+| `+sha3-224+` | SHA3-224 | 28 bytes (224 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
+| `+sha3-256+` | SHA3-256 | 32 bytes (256 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
+| `+sha3-384+` | SHA3-384 | 48 bytes (384 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
+| `+sha3-512+` | SHA3-512 | 64 bytes (512 bits) | Algorithm available with libgcrypt ≥ 1.7.0.
|===
戻り値:
diff --git a/src/core/wee-crypto.c b/src/core/wee-crypto.c
index ea19c04d3..004ab26f2 100644
--- a/src/core/wee-crypto.c
+++ b/src/core/wee-crypto.c
@@ -42,7 +42,9 @@ char *weecrypto_hash_algo_string[] = {
"md5",
"sha1",
"sha224", "sha256", "sha384", "sha512",
+#if GCRYPT_VERSION_NUMBER >= 0x010700
"sha3-224", "sha3-256", "sha3-384", "sha3-512",
+#endif
NULL,
};
int weecrypto_hash_algo[] = {
@@ -50,7 +52,9 @@ int weecrypto_hash_algo[] = {
GCRY_MD_MD5,
GCRY_MD_SHA1,
GCRY_MD_SHA224, GCRY_MD_SHA256, GCRY_MD_SHA384, GCRY_MD_SHA512,
+#if GCRYPT_VERSION_NUMBER >= 0x010700
GCRY_MD_SHA3_224, GCRY_MD_SHA3_256, GCRY_MD_SHA3_384, GCRY_MD_SHA3_512,
+#endif
};
diff --git a/tests/unit/core/test-core-crypto.cpp b/tests/unit/core/test-core-crypto.cpp
index 9bab485e6..d8a387d63 100644
--- a/tests/unit/core/test-core-crypto.cpp
+++ b/tests/unit/core/test-core-crypto.cpp
@@ -161,10 +161,12 @@ TEST(CoreCrypto, Hash)
WEE_CHECK_HASH(1, DATA_HASH_SHA256, data, data_size, GCRY_MD_SHA256);
WEE_CHECK_HASH(1, DATA_HASH_SHA384, data, data_size, GCRY_MD_SHA384);
WEE_CHECK_HASH(1, DATA_HASH_SHA512, data, data_size, GCRY_MD_SHA512);
+#if GCRYPT_VERSION_NUMBER >= 0x010700
WEE_CHECK_HASH(1, DATA_HASH_SHA3_224, data, data_size, GCRY_MD_SHA3_224);
WEE_CHECK_HASH(1, DATA_HASH_SHA3_256, data, data_size, GCRY_MD_SHA3_256);
WEE_CHECK_HASH(1, DATA_HASH_SHA3_384, data, data_size, GCRY_MD_SHA3_384);
WEE_CHECK_HASH(1, DATA_HASH_SHA3_512, data, data_size, GCRY_MD_SHA3_512);
+#endif
}
/*