From 01163f2e40b1a5d87e1c4953ad0dcdea26caa407 Mon Sep 17 00:00:00 2001 From: Egok4wryu <15806957625@163.com> Date: Thu, 20 Oct 2022 11:31:29 +0800 Subject: [PATCH] add the annotation in the function of GsSm3Encrypt --- src/common/backend/libpq/sha2.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/common/backend/libpq/sha2.cpp b/src/common/backend/libpq/sha2.cpp index 3b996ffe2..484b55c18 100644 --- a/src/common/backend/libpq/sha2.cpp +++ b/src/common/backend/libpq/sha2.cpp @@ -772,6 +772,15 @@ bool pg_sha256_encrypt_for_md5(const char* password, const char* salt, size_t sa return true; } +/* + * @Description: calculate the encrypted password for GsSm3. + * @const char* password : the password need be encrypted. + * @const char* salt_s : the content fo the slat. + * @size_t salt_len : the length fo the slat. + * @char* buf : the buffer to store the encrypted key with GsSm3. + * @char* client_key_buf : the buffer to store the key of client. + * @int iteration_count : to record the number of the iteration. + */ bool GsSm3Encrypt( const char* password, const char* salt_s, size_t salt_len, char* buf, char* client_key_buf, int iteration_count) { @@ -799,6 +808,7 @@ bool GsSm3Encrypt( } password_len = strlen(password); + /* Tranform string(64Bytes) to binary(32Bytes) */ sha_hex_to_bytes32(salt, (char*)salt_s); /* calculate k */ pkcs_ret = PKCS5_PBKDF2_HMAC((char*)password,