Skip to content

Commit 6c47ec4

Browse files
smcmahonibmrobindubeyibm
authored andcommitted
more error message
Signed-off-by: Robin Dubey <[email protected]>
1 parent d4063cc commit 6c47ec4

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

icc/extsig.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ static long HashCore(FILE *fin, long pos, EVP_MD_CTX *md_ctx,
151151
const EVP_MD *md) {
152152
size_t len = 0;
153153
long amt = 0;
154+
int rc = 0;
154155

155156
if (NULL != fin) {
156157
if (0 == pos) {
@@ -159,7 +160,10 @@ static long HashCore(FILE *fin, long pos, EVP_MD_CTX *md_ctx,
159160
}
160161
fseek(fin, 0, SEEK_SET);
161162
EVP_MD_CTX_cleanup(md_ctx);
162-
EVP_DigestInit(md_ctx, md);
163+
rc = EVP_DigestInit(md_ctx, md);
164+
if (1 != rc) {
165+
printf("HashCore:EVP_DigestInit failed %d\n", rc);
166+
}
163167
/* Work out how much to read */
164168
while (pos > 0) {
165169
amt = sizeof(fbuf);
@@ -168,7 +172,10 @@ static long HashCore(FILE *fin, long pos, EVP_MD_CTX *md_ctx,
168172
}
169173
len = fread(fbuf, 1, amt, fin);
170174
if (len > 0) {
171-
EVP_DigestUpdate(md_ctx, fbuf, len);
175+
rc = EVP_DigestUpdate(md_ctx, fbuf, len);
176+
if (1 != rc) {
177+
printf("HashCore:EVP_DigestUpdate failed %d\n", rc);
178+
}
172179
pos -= (long)len;
173180
} else {
174181
printf("HashCore:fread failed\n");
@@ -623,16 +630,19 @@ static int GenSig(FILE *fin, unsigned char *sigout, EVP_PKEY *key, long pos) {
623630
HashCore(fin, pos, md_ctx, md);
624631
evpRC = EVP_SignFinal(md_ctx, sigout, &signL, key);
625632
if (1 != evpRC) {
626-
printf("EVP_SignFinal error %d\n", evpRC);
633+
printf("GenSig: EVP_SignFinal error %d\n", evpRC);
627634
signL = 0;
628635
}
629636
EVP_MD_CTX_free(md_ctx);
630637
}
631638
else {
632-
printf("EVP error\n");
639+
printf("GenSig: EVP error\n");
633640
}
634641
fseek(fin, pos, SEEK_SET);
635642
}
643+
else {
644+
printf("GenSig: fin error\n");
645+
}
636646
return (int)signL;
637647
}
638648
static void usage(char *pname, char *str) {

0 commit comments

Comments
 (0)