diff options
author | FdaSilvaYY <fdasilvayy@gmail.com> | 2016-06-29 00:19:46 +0200 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2016-07-20 07:21:53 -0400 |
commit | 2f8e53d7944b3d659c8ae678163eb0f096a6d992 (patch) | |
tree | c924c32dfcf70ab0ecf83b823c3f9001e2c992ce /doc/ssl | |
parent | e8aa8b6c8f6d4e2b2bbd5e5721d977b0a6aa3cee (diff) | |
download | openssl-2f8e53d7944b3d659c8ae678163eb0f096a6d992.tar.gz |
Fix if/for/while( in docs
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1292)
Diffstat (limited to 'doc/ssl')
-rw-r--r-- | doc/ssl/SSL_CTX_set_generate_session_id.pod | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/doc/ssl/SSL_CTX_set_generate_session_id.pod b/doc/ssl/SSL_CTX_set_generate_session_id.pod index 95b7e9e1ca..515fd251d2 100644 --- a/doc/ssl/SSL_CTX_set_generate_session_id.pod +++ b/doc/ssl/SSL_CTX_set_generate_session_id.pod @@ -90,25 +90,27 @@ server id given, and will fill the rest with pseudo random bytes: #define MAX_SESSION_ID_ATTEMPTS 10 static int generate_session_id(const SSL *ssl, unsigned char *id, unsigned int *id_len) - { + { unsigned int count = 0; - do { - RAND_pseudo_bytes(id, *id_len); - /* Prefix the session_id with the required prefix. NB: If our - * prefix is too long, clip it - but there will be worse effects - * anyway, eg. the server could only possibly create 1 session - * ID (ie. the prefix!) so all future session negotiations will - * fail due to conflicts. */ - memcpy(id, session_id_prefix, - (strlen(session_id_prefix) < *id_len) ? - strlen(session_id_prefix) : *id_len); - } - while(SSL_has_matching_session_id(ssl, id, *id_len) && + do { + RAND_pseudo_bytes(id, *id_len); + /* + * Prefix the session_id with the required prefix. NB: If our + * prefix is too long, clip it - but there will be worse effects + * anyway, eg. the server could only possibly create 1 session + * ID (ie. the prefix!) so all future session negotiations will + * fail due to conflicts. + */ + memcpy(id, session_id_prefix, + (strlen(session_id_prefix) < *id_len) ? + strlen(session_id_prefix) : *id_len); + } + while (SSL_has_matching_session_id(ssl, id, *id_len) && (++count < MAX_SESSION_ID_ATTEMPTS)); - if(count >= MAX_SESSION_ID_ATTEMPTS) + if (count >= MAX_SESSION_ID_ATTEMPTS) return 0; return 1; - } + } =head1 RETURN VALUES |