summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Sing <jsing@cvs.openbsd.org>2014-07-10 07:41:55 +0000
committerJoel Sing <jsing@cvs.openbsd.org>2014-07-10 07:41:55 +0000
commit3a602a7fb8596fb1d403e5c779881b92e88c9f45 (patch)
treeba077f629aa1e4012a4b05d5efb9ebb79a01ae67
parent291160bf26271c9fa21698428d19f336f9197aab (diff)
Use a while loop instead of an ifdowhile loop.
ok miod@ tedu@
-rw-r--r--lib/libcrypto/rsa/rsa_pk1.c11
-rw-r--r--lib/libcrypto/rsa/rsa_ssl.c11
2 files changed, 10 insertions, 12 deletions
diff --git a/lib/libcrypto/rsa/rsa_pk1.c b/lib/libcrypto/rsa/rsa_pk1.c
index d394b300c60..1d6d688d6b5 100644
--- a/lib/libcrypto/rsa/rsa_pk1.c
+++ b/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/lib/libcrypto/rsa/rsa_ssl.c b/lib/libcrypto/rsa/rsa_ssl.c
index 09deb08985b..fb2e2284545 100644
--- a/lib/libcrypto/rsa/rsa_ssl.c
+++ b/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++;
}