[rsaenh] Move type-check before len-check (Coverity)
Paul Vriens
paul.vriens.wine at gmail.com
Sun Nov 12 10:55:09 CST 2006
Hi,
makes the deadcode not dead anymore. This change is also present in latest
libtomcrypt (1.14) on which this file is based.
Should fix Coverity-36.
Changelog
Move type-check before len-check
Cheers,
Paul.
---
dlls/rsaenh/rsa.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/dlls/rsaenh/rsa.c b/dlls/rsaenh/rsa.c
index 4d6cd03..ce61022 100644
--- a/dlls/rsaenh/rsa.c
+++ b/dlls/rsaenh/rsa.c
@@ -62,12 +62,6 @@ int rand_prime(mp_int *N, long len)
{
int type;
- /* allow sizes between 2 and 256 bytes for a prime size */
- if (len < 16 || len > 8192) {
- printf("Invalid prime size!\n");
- return CRYPT_INVALID_PRIME_SIZE;
- }
-
/* get type */
if (len < 0) {
type = LTM_PRIME_BBS;
@@ -78,6 +72,12 @@ int rand_prime(mp_int *N, long len)
/* Original LibTomCrypt: type = 0; */
}
+ /* allow sizes between 2 and 256 bytes for a prime size */
+ if (len < 16 || len > 8192) {
+ printf("Invalid prime size!\n");
+ return CRYPT_INVALID_PRIME_SIZE;
+ }
+
/* New prime generation makes the code even more cryptoish-insane. Do you know what this means!!!
-- Gir: Yeah, oh wait, er, no.
*/
--
1.4.3.5
More information about the wine-patches
mailing list