From 0c1d74fda7c0063eeca4d8d9fa8674e6ec2ef685 Mon Sep 17 00:00:00 2001 From: Andrew Duda Date: Tue, 8 Nov 2016 18:53:41 +0000 Subject: image: Add crypto_algo struct for RSA info Cut down on the repetition of algorithm information by defining separate checksum and crypto structs. image_sig_algos are now simply pairs of unique checksum and crypto algos. Signed-off-by: Andrew Duda Signed-off-by: aduda Reviewed-by: Simon Glass --- include/image.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'include/image.h') diff --git a/include/image.h b/include/image.h index de73a07..c3c9866 100644 --- a/include/image.h +++ b/include/image.h @@ -1072,7 +1072,6 @@ struct checksum_algo { const int checksum_len; const int der_len; const uint8_t *der_prefix; - const int key_len; #if IMAGE_ENABLE_SIGN const EVP_MD *(*calculate_sign)(void); #endif @@ -1081,8 +1080,9 @@ struct checksum_algo { int region_count, uint8_t *checksum); }; -struct image_sig_algo { +struct crypto_algo { const char *name; /* Name of algorithm */ + const int key_len; /** * sign() - calculate and return signature for given input data @@ -1131,7 +1131,12 @@ struct image_sig_algo { int (*verify)(struct image_sign_info *info, const struct image_region region[], int region_count, uint8_t *sig, uint sig_len); +}; +struct image_sig_algo { + const char *name; + /* pointer to cryptosystem algorithm */ + struct crypto_algo *crypto; /* pointer to checksum algorithm */ struct checksum_algo *checksum; }; -- cgit v1.1