From a056a5f9321e4e7d039f49d894e59dff155713aa Mon Sep 17 00:00:00 2001 From: jsing <> Date: Thu, 10 Jul 2014 07:41:54 +0000 Subject: Use a while loop instead of an ifdowhile loop. ok miod@ tedu@ --- src/lib/libcrypto/rsa/rsa_pk1.c | 11 +++++------ src/lib/libcrypto/rsa/rsa_ssl.c | 11 +++++------ src/lib/libssl/src/crypto/rsa/rsa_pk1.c | 11 +++++------ src/lib/libssl/src/crypto/rsa/rsa_ssl.c | 11 +++++------ 4 files changed, 20 insertions(+), 24 deletions(-) diff --git a/src/lib/libcrypto/rsa/rsa_pk1.c b/src/lib/libcrypto/rsa/rsa_pk1.c index d394b300c6..1d6d688d6b 100644 --- a/src/lib/libcrypto/rsa/rsa_pk1.c +++ b/src/lib/libcrypto/rsa/rsa_pk1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_pk1.c,v 1.9 2014/07/09 19:51:38 jsing Exp $ */ +/* $OpenBSD: rsa_pk1.c,v 1.10 2014/07/10 07:41:54 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -168,11 +168,10 @@ RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen, if (RAND_bytes(p, j) <= 0) return 0; for (i = 0; i < j; i++) { - if (*p == '\0') - do { - if (RAND_bytes(p, 1) <= 0) - return 0; - } while (*p == '\0'); + while (*p == '\0') { + if (RAND_bytes(p, 1) <= 0) + return 0; + } p++; } diff --git a/src/lib/libcrypto/rsa/rsa_ssl.c b/src/lib/libcrypto/rsa/rsa_ssl.c index 09deb08985..fb2e228454 100644 --- a/src/lib/libcrypto/rsa/rsa_ssl.c +++ b/src/lib/libcrypto/rsa/rsa_ssl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_ssl.c,v 1.9 2014/07/09 19:51:38 jsing Exp $ */ +/* $OpenBSD: rsa_ssl.c,v 1.10 2014/07/10 07:41:54 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -86,11 +86,10 @@ RSA_padding_add_SSLv23(unsigned char *to, int tlen, const unsigned char *from, if (RAND_bytes(p, j) <= 0) return 0; for (i = 0; i < j; i++) { - if (*p == '\0') - do { - if (RAND_bytes(p, 1) <= 0) - return 0; - } while (*p == '\0'); + while (*p == '\0') { + if (RAND_bytes(p, 1) <= 0) + return 0; + } p++; } diff --git a/src/lib/libssl/src/crypto/rsa/rsa_pk1.c b/src/lib/libssl/src/crypto/rsa/rsa_pk1.c index d394b300c6..1d6d688d6b 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_pk1.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_pk1.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_pk1.c,v 1.9 2014/07/09 19:51:38 jsing Exp $ */ +/* $OpenBSD: rsa_pk1.c,v 1.10 2014/07/10 07:41:54 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -168,11 +168,10 @@ RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen, if (RAND_bytes(p, j) <= 0) return 0; for (i = 0; i < j; i++) { - if (*p == '\0') - do { - if (RAND_bytes(p, 1) <= 0) - return 0; - } while (*p == '\0'); + while (*p == '\0') { + if (RAND_bytes(p, 1) <= 0) + return 0; + } p++; } diff --git a/src/lib/libssl/src/crypto/rsa/rsa_ssl.c b/src/lib/libssl/src/crypto/rsa/rsa_ssl.c index 09deb08985..fb2e228454 100644 --- a/src/lib/libssl/src/crypto/rsa/rsa_ssl.c +++ b/src/lib/libssl/src/crypto/rsa/rsa_ssl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_ssl.c,v 1.9 2014/07/09 19:51:38 jsing Exp $ */ +/* $OpenBSD: rsa_ssl.c,v 1.10 2014/07/10 07:41:54 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -86,11 +86,10 @@ RSA_padding_add_SSLv23(unsigned char *to, int tlen, const unsigned char *from, if (RAND_bytes(p, j) <= 0) return 0; for (i = 0; i < j; i++) { - if (*p == '\0') - do { - if (RAND_bytes(p, 1) <= 0) - return 0; - } while (*p == '\0'); + while (*p == '\0') { + if (RAND_bytes(p, 1) <= 0) + return 0; + } p++; } -- cgit v1.2.3-55-g6feb