fix: tools: Correct the RSA length calculation
- Correct the wrong index used in RSA key length calculation
in hdrparset utility
- Advance the hdrparser version to 2.01
Change-Id: Ie208cbe8dc46e11b31724e78c5b2845a3d7f17a8
Signed-off-by: Konstantin Porotchkin <kostap@marvell.com>
Reviewed-on: http://vgitil04.il.marvell.com:8080/23588
Reviewed-by: Haim Boot <hayim@marvell.com>
Tested-by: Star_Automation <star@marvell.com>
Reviewed-by: Omri Itach <omrii@marvell.com>
diff --git a/tools/marvell/doimage_mv/hdrparser.c b/tools/marvell/doimage_mv/hdrparser.c
index b7c230f..5b38539 100755
--- a/tools/marvell/doimage_mv/hdrparser.c
+++ b/tools/marvell/doimage_mv/hdrparser.c
@@ -79,7 +79,7 @@
#include "polarssl/rsa.h"
//#include "polarssl/aes.h"
-#define VERSION_NUMBER "2.0"
+#define VERSION_NUMBER "2.01"
/* Security context */
typedef struct secCtx_t {
@@ -481,7 +481,7 @@
secCtx.rsa.len = (mpi_msb(&secCtx.rsa.N) + 7) >> 3; /* key length in bytes */
/* Key length should include 4 bytes of the data block header */
- rsaKeyLen = (((pSecHdr->cskArray[csk_idx]).Key)[csk_idx] << 8) + ((pSecHdr->cskArray[csk_idx]).Key)[3] + 4;
+ rsaKeyLen = (((pSecHdr->cskArray[csk_idx]).Key)[2] << 8) + ((pSecHdr->cskArray[csk_idx]).Key)[3] + 4;
sha2((unsigned char *)((pSecHdr->cskArray[csk_idx]).Key), rsaKeyLen, buf32, 0);
fprintf(stdout, "----------------------------------------------------------\n");
fprintf(stdout,"RSA key SHA256 digest for eFuse (CSK-%d):\n BE FULL: ", csk_idx);