const char *comment, int require_keys,
const char *engine_id, const char *cmdname);
+#define NODE_MAX_NAME_LEN 80
+
+/**
+ * struct image_summary - Provides information about signing info added
+ *
+ * @sig_offset: Offset of the node in the blob devicetree where the signature
+ * was wriiten
+ * @sig_path: Path to @sig_offset
+ * @keydest_offset: Offset of the node in the keydest devicetree where the
+ * public key was written (-1 if none)
+ * @keydest_path: Path to @keydest_offset
+ */
+struct image_summary {
+ int sig_offset;
+ char sig_path[NODE_MAX_NAME_LEN];
+ int keydest_offset;
+ char keydest_path[NODE_MAX_NAME_LEN];
+};
+
/**
* fit_add_verification_data() - add verification data to FIT image nodes
*
* @engine_id: Engine to use for signing
* @cmdname: Command name used when reporting errors
* @algo_name: Algorithm name, or NULL if to be read from FIT
+ * @summary: Returns information about what data was written
*
* Adds hash values for all component images in the FIT blob.
* Hashes are calculated for all component images which have hash subnodes
int fit_add_verification_data(const char *keydir, const char *keyfile,
void *keydest, void *fit, const char *comment,
int require_keys, const char *engine_id,
- const char *cmdname, const char *algo_name);
+ const char *cmdname, const char *algo_name,
+ struct image_summary *summary);
/**
* fit_image_verify_with_data() - Verify an image with given data
return ret;
}
+
+void summary_show(struct image_summary *summary, const char *imagefile,
+ const char *keydest)
+{
+ if (summary->sig_offset) {
+ printf("Signature written to '%s', node '%s'\n", imagefile,
+ summary->sig_path);
+ if (keydest) {
+ printf("Public key written to '%s', node '%s'\n",
+ keydest, summary->keydest_path);
+ }
+ }
+}
*/
int copyfile(const char *src, const char *dst);
+/**
+ * summary_show() - Show summary information about the signing process
+ *
+ * @summary: Summary info to show
+ * @imagefile: Filename of the output image
+ * @keydest: Filename where the key information is written (NULL if none)
+ */
+void summary_show(struct image_summary *summary, const char *imagefile,
+ const char *keydest);
+
#endif /* _FIT_COMMON_H_ */
params->require_keys,
params->engine_id,
params->cmdname,
- params->algo_name);
+ params->algo_name,
+ ¶ms->summary);
}
if (dest_blob) {
static int fit_config_add_verification_data(const char *keydir,
const char *keyfile, void *keydest, void *fit, int conf_noffset,
const char *comment, int require_keys, const char *engine_id,
- const char *cmdname, const char *algo_name)
+ const char *cmdname, const char *algo_name,
+ struct image_summary *summary)
{
const char *conf_name;
int noffset;
ret = fit_config_process_sig(keydir, keyfile, keydest,
fit, conf_name, conf_noffset, noffset, comment,
require_keys, engine_id, cmdname, algo_name);
+ if (ret < 0)
+ return ret;
+
+ summary->sig_offset = noffset;
+ fdt_get_path(fit, noffset, summary->sig_path,
+ sizeof(summary->sig_path));
+
+ if (keydest) {
+ summary->keydest_offset = ret;
+ fdt_get_path(keydest, ret,
+ summary->keydest_path,
+ sizeof(summary->keydest_path));
+ }
}
- if (ret < 0)
- return ret;
}
return 0;
int fit_add_verification_data(const char *keydir, const char *keyfile,
void *keydest, void *fit, const char *comment,
int require_keys, const char *engine_id,
- const char *cmdname, const char *algo_name)
+ const char *cmdname, const char *algo_name,
+ struct image_summary *summary)
{
int images_noffset, confs_noffset;
int noffset;
fit, noffset, comment,
require_keys,
engine_id, cmdname,
- algo_name);
+ algo_name, summary);
if (ret)
return ret;
}
#include <unistd.h>
#include <u-boot/sha1.h>
+#include <image.h>
+
#include "fdt_host.h"
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
int bl_len; /* Block length in byte for external data */
const char *engine_id; /* Engine to use for signing */
bool reset_timestamp; /* Reset the timestamp on an existing image */
+ struct image_summary summary; /* results of signing process */
};
/*
#include "imagetool.h"
#include "mkimage.h"
#include "imximage.h"
+#include <fit_common.h>
#include <image.h>
#include <version.h>
#ifdef __linux__
(void) munmap((void *)ptr, sbuf.st_size);
(void) close (ifd);
+ if (!retval)
+ summary_show(¶ms.summary, params.imagefile,
+ params.keydest);
exit (retval);
}