Skip to content

Commit 2592dbc

Browse files
committed
Normalize do_ecc and do_25519 exit codes like do_448 so an error is never masked to 0
1 parent 96f1fad commit 2592dbc

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

pk/ecdh_generate_secret/ecdh_gen_secret.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ int do_ecc(void)
162162
printf("Configure wolfSSL with --enable-ecc and try again\n");
163163
ret = -1;
164164
#endif
165-
return ret;
165+
/* not ret: an exit code is masked to 8 bits, so -256 would read as 0 */
166+
return (ret == 0) ? 0 : 1;
166167
}
167168

168169
int do_25519(void)
@@ -228,7 +229,8 @@ int do_25519(void)
228229
printf("Configure wolfssl with --enable-curve25519 and try again\n");
229230
ret = -1;
230231
#endif
231-
return ret;
232+
/* not ret: an exit code is masked to 8 bits, so -256 would read as 0 */
233+
return (ret == 0) ? 0 : 1;
232234
}
233235

234236
int do_448(void)

0 commit comments

Comments
 (0)