提交 1d9c46b5 编写于 作者: L LiFeng 提交者: lifeng68

tag: rename isula_tag to oci_tag

Signed-off-by: NLiFeng <lifeng68@huawei.com>
上级 c7d00c94
......@@ -104,7 +104,7 @@ static const struct bim_ops g_oci_ops = {
.pull_image = oci_pull_rf,
.login = oci_login,
.logout = oci_logout,
.tag_image = isula_tag,
.tag_image = oci_tag,
.import = isula_import,
};
#endif
......
......@@ -274,7 +274,7 @@ out:
return ret;
}
int isula_tag(const im_tag_request *request)
int oci_tag(const im_tag_request *request)
{
int ret = -1;
char *src_name = NULL;
......
......@@ -48,7 +48,7 @@ int oci_logout(const im_logout_request *request);
int oci_sync_images(void);
int oci_sync_containers(void);
int isula_tag(const im_tag_request *request);
int oci_tag(const im_tag_request *request);
#ifdef __cplusplus
}
#endif
......
......@@ -1349,32 +1349,6 @@ static void update_json_map_string_int64(json_map_string_int64 *map, const char
}
}
static char *calc_sha256_with_string(const char *val)
{
SHA256_CTX ctx;
unsigned char hash[SHA256_DIGEST_LENGTH] = { 0x00 };
char output_buffer[(SHA256_DIGEST_LENGTH * 2) + 1] = { 0x00 };
int i;
if (val == NULL) {
return NULL;
}
SHA256_Init(&ctx);
SHA256_Update(&ctx, val, strlen(val));
SHA256_Final(hash, &ctx);
for (i = 0; i < SHA256_DIGEST_LENGTH; i++) {
int ret = snprintf(output_buffer + (i * 2), 3, "%02x", (unsigned int)hash[i]);
if (ret >= 3 || ret < 0) {
return "";
}
}
output_buffer[SHA256_DIGEST_LENGTH * 2] = '\0';
return util_strdup_s(output_buffer);
}
static void update_json_map_string_string(json_map_string_string *map, const char *key, const char *value)
{
size_t i;
......@@ -1446,7 +1420,7 @@ static int update_image_with_big_data(storage_image *image, const char *key, con
}
old_digest = get_value_from_json_map_string_string(image->big_data_digests, key);
new_digest = calc_sha256_with_string(data);
new_digest = sha256_digest_str(data);
if (old_digest != NULL) {
update_json_map_string_string(image->big_data_digests, key, new_digest);
} else {
......
......@@ -24,6 +24,7 @@
#include <errno.h>
#include <sys/wait.h>
#include <libwebsockets.h>
#include <openssl/sha.h>
#include "sha256.h"
#include "isula_libutils/log.h"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册