|
|
|
@ -95,6 +95,7 @@ static int sign(const char *image, const char *name, const char *digest_name, |
|
|
|
|
unsigned char *sig; |
|
|
|
|
EVP_MD_CTX *ctx = NULL; |
|
|
|
|
size_t nbytes, size, sig_len = 0; |
|
|
|
|
int ret; |
|
|
|
|
|
|
|
|
|
if (!image || !digest_name || !key) |
|
|
|
|
return -1; |
|
|
|
@ -147,11 +148,15 @@ static int sign(const char *image, const char *name, const char *digest_name, |
|
|
|
|
if (fseek(fp, 0, SEEK_END) < 0) |
|
|
|
|
goto err_free_sig; |
|
|
|
|
|
|
|
|
|
sig_hdr.name = name; |
|
|
|
|
sig_hdr.digest = digest_name; |
|
|
|
|
sig_hdr.name = strdup(name); |
|
|
|
|
sig_hdr.digest = strdup(digest_name); |
|
|
|
|
sig_hdr.size = sig_len; |
|
|
|
|
|
|
|
|
|
if (rots_write_sig_hdr(fp, &sig_hdr) < 0) |
|
|
|
|
ret = rots_write_sig_hdr(fp, &sig_hdr); |
|
|
|
|
free(sig_hdr.digest); |
|
|
|
|
free(sig_hdr.name); |
|
|
|
|
|
|
|
|
|
if (ret < 0) |
|
|
|
|
goto err_free_sig; |
|
|
|
|
|
|
|
|
|
if (fwrite(sig, sizeof *sig, sig_len, fp) < sig_len) |
|
|
|
|