|
11 | 11 | *
|
12 | 12 | *
|
13 | 13 | * IDENTIFICATION
|
14 |
| - * $Header: /cvsroot/pgsql/src/backend/libpq/be-secure.c,v 1.10 2002/06/20 20:29:28 momjian Exp $ |
| 14 | + * $Header: /cvsroot/pgsql/src/backend/libpq/be-secure.c,v 1.11 2002/07/15 21:34:04 momjian Exp $ |
15 | 15 | *
|
16 | 16 | * Since the server static private key ($DataDir/server.key)
|
17 | 17 | * will normally be stored unencrypted so that the database
|
|
41 | 41 | *
|
42 | 42 | * ...
|
43 | 43 | *
|
44 |
| - * Because the risk of cryptanalysis increases as large |
| 44 | + * Because the risk of cryptanalysis increases as large |
45 | 45 | * amounts of data are sent with the same session key, the
|
46 | 46 | * session keys are periodically renegotiated.
|
47 | 47 | *
|
|
50 | 50 | * [*] existing SSL code pulled out of existing files.
|
51 | 51 | * [*] SSL_get_error() after SSL_read() and SSL_write(),
|
52 | 52 | * SSL_shutdown(), default to TLSv1.
|
53 |
| - * |
| 53 | + * |
54 | 54 | * milestone 2: provide endpoint authentication (server)
|
55 | 55 | * [*] client verifies server cert
|
56 | 56 | * [*] client verifies server hostname
|
|
100 | 100 | #include <arpa/inet.h>
|
101 | 101 | #endif
|
102 | 102 |
|
103 |
| - |
104 | 103 | #ifndef HAVE_STRDUP
|
105 | 104 | #include "strdup.h"
|
106 | 105 | #endif
|
@@ -153,20 +152,20 @@ static SSL_CTX *SSL_context = NULL;
|
153 | 152 | * As discussed above, EDH protects the confidentiality of
|
154 | 153 | * sessions even if the static private key is compromised,
|
155 | 154 | * so we are *highly* motivated to ensure that we can use
|
156 |
| - * EDH even if the DBA... or an attacker... deletes the |
| 155 | + * EDH even if the DBA... or an attacker... deletes the |
157 | 156 | * $DataDir/dh*.pem files.
|
158 | 157 | *
|
159 | 158 | * We could refuse SSL connections unless a good DH parameter
|
160 | 159 | * file exists, but some clients may quietly renegotiate an
|
161 | 160 | * unsecured connection without fully informing the user.
|
162 |
| - * Very uncool. |
| 161 | + * Very uncool. |
163 | 162 | *
|
164 | 163 | * Alternately, the backend could attempt to load these files
|
165 | 164 | * on startup if SSL is enabled - and refuse to start if any
|
166 | 165 | * do not exist - but this would tend to piss off DBAs.
|
167 | 166 | *
|
168 | 167 | * If you want to create your own hardcoded DH parameters
|
169 |
| - * for fun and profit, review "Assigned Number for SKIP |
| 168 | + * for fun and profit, review "Assigned Number for SKIP |
170 | 169 | * Protocols" (http://www.skip-vpn.org/spec/numbers.html)
|
171 | 170 | * for suggestions.
|
172 | 171 | */
|
@@ -241,7 +240,7 @@ secure_destroy (void)
|
241 | 240 | /*
|
242 | 241 | * Attempt to negotiate secure session.
|
243 | 242 | */
|
244 |
| -int |
| 243 | +int |
245 | 244 | secure_open_server (Port *port)
|
246 | 245 | {
|
247 | 246 | int r = 0;
|
@@ -373,7 +372,7 @@ secure_write (Port *port, const void *ptr, size_t len)
|
373 | 372 | * Load precomputed DH parameters.
|
374 | 373 | *
|
375 | 374 | * To prevent "downgrade" attacks, we perform a number of checks
|
376 |
| - * to verify that the DBA-generated DH parameters file contains |
| 375 | + * to verify that the DBA-generated DH parameters file contains |
377 | 376 | * what we expect it to contain.
|
378 | 377 | */
|
379 | 378 | static DH *
|
@@ -415,7 +414,7 @@ load_dh_file (int keylength)
|
415 | 414 | elog(LOG, "DH error (%s): p is not prime", fnbuf);
|
416 | 415 | return NULL;
|
417 | 416 | }
|
418 |
| - if ((codes & DH_NOT_SUITABLE_GENERATOR) && |
| 417 | + if ((codes & DH_NOT_SUITABLE_GENERATOR) && |
419 | 418 | (codes & DH_CHECK_P_NOT_SAFE_PRIME))
|
420 | 419 | {
|
421 | 420 | elog(LOG,
|
@@ -520,7 +519,7 @@ tmp_dh_cb (SSL *s, int is_export, int keylength)
|
520 | 519 | elog(DEBUG1, "DH: generating parameters (%d bits)....", keylength);
|
521 | 520 | r = DH_generate_parameters(keylength, DH_GENERATOR_2, NULL, NULL);
|
522 | 521 | }
|
523 |
| - |
| 522 | + |
524 | 523 | return r;
|
525 | 524 | }
|
526 | 525 |
|
@@ -585,7 +584,7 @@ initialize_SSL (void)
|
585 | 584 | {
|
586 | 585 | char fnbuf[2048];
|
587 | 586 | struct stat buf;
|
588 |
| - |
| 587 | + |
589 | 588 | if (!SSL_context)
|
590 | 589 | {
|
591 | 590 | SSL_library_init();
|
@@ -648,7 +647,7 @@ initialize_SSL (void)
|
648 | 647 | fnbuf, SSLerrmessage());
|
649 | 648 | ExitPostmaster(1);
|
650 | 649 | }
|
651 |
| - SSL_CTX_set_verify(SSL_context, |
| 650 | + SSL_CTX_set_verify(SSL_context, |
652 | 651 | SSL_VERIFY_PEER | SSL_VERIFY_CLIENT_ONCE, verify_cb);
|
653 | 652 |
|
654 | 653 | return 0;
|
|
0 commit comments