aboutsummaryrefslogtreecommitdiff
path: root/lib/curl_rand.h
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2013-06-24 22:24:35 +0200
committerDaniel Stenberg <daniel@haxx.se>2013-06-25 09:55:49 +0200
commit365c5ba39591fab2e60bf4f0e67d9dcf79ecc506 (patch)
tree6e02f6904f12fcd94b1036643bc5064c809e807b /lib/curl_rand.h
parentcb1aa8b0e32068ec4bbbc42d41267420b46a36e7 (diff)
formpost: better random boundaries
When doing multi-part formposts, libcurl used a pseudo-random value that was seeded with time(). This turns out to be bad for users who formpost data that is provided with users who then can guess how the boundary string will look like and then they can forge a different formpost part and trick the receiver. My advice to such implementors is (still even after this change) to not rely on the boundary strings being cryptographically strong. Fix your code and logic to not depend on them that much! I moved the Curl_rand() function into the sslgen.c source file now to be able to take advantage of the SSL library's random function if it provides one. If not, try to use the RANDOM_FILE for seeding and as a last resort keep the old logic, just modified to also add microseconds which makes it harder to properly guess the exact seed. The formboundary() function in formdata.c is now using 64 bit entropy for the boundary and therefore the string of dashes was reduced by 4 letters and there are 16 hex digits following it. The total length is thus still the same. Bug: http://curl.haxx.se/bug/view.cgi?id=1251 Reported-by: "Floris"
Diffstat (limited to 'lib/curl_rand.h')
-rw-r--r--lib/curl_rand.h29
1 files changed, 0 insertions, 29 deletions
diff --git a/lib/curl_rand.h b/lib/curl_rand.h
deleted file mode 100644
index 26cfb7f03..000000000
--- a/lib/curl_rand.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef HEADER_CURL_RAND_H
-#define HEADER_CURL_RAND_H
-/***************************************************************************
- * _ _ ____ _
- * Project ___| | | | _ \| |
- * / __| | | | |_) | |
- * | (__| |_| | _ <| |___
- * \___|\___/|_| \_\_____|
- *
- * Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
- *
- * This software is licensed as described in the file COPYING, which
- * you should have received as part of this distribution. The terms
- * are also available at http://curl.haxx.se/docs/copyright.html.
- *
- * You may opt to use, copy, modify, merge, publish, distribute and/or sell
- * copies of the Software, and permit persons to whom the Software is
- * furnished to do so, under the terms of the COPYING file.
- *
- * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
- * KIND, either express or implied.
- *
- ***************************************************************************/
-
-void Curl_srand(void);
-
-unsigned int Curl_rand(void);
-
-#endif /* HEADER_CURL_RAND_H */