Greetings.  This all pertains to OpenSSL 0.9.6c.

First, I wish to contribute some minor fixes to pod2man.pl, where <
denotes the present version and > my fixed version:

485c485
< '''   such as .IP and .SH, which do another additional levels of
---
> '''   such as .IP and .SH, which do other additional levels of
526c526
< .\"     in some meaninful fashion.
---
> .\"     in some meaningful fashion.

Second, the generated man pages have some systematic errors on this IRIX
6.5.14 system.  I have not attempted a comprehensive analysis, but I can
give a couple concrete examples.  All the problems I noticed appear to
stem from =item entries in the .pod sources; I suspect pod2man.pl is the
culprit rather than the .pod source itself, but I am not sufficiently
versed in perl/roff to assert this with much confidence.

Example A. doc/ssl/SSL_alert_type_string.pod

  =item "W"/"warning"     is rendered as     .Ip "\*(N"'/'arning\*(T"" 4

To me it appears that both W's around the "/" triple are being
inappropriately replaced by single quotes.  Additional examples follow
in the same doc:

  .Ip "\*(N"'/'atal\*(T"" 4
  .Ip "\*(N"'/'nknown\*(T"" 4

  .Ip "\*(N"\s-1CN\s'/'lose notify\*(T"" 4

etc.

Example B. doc/ssl/SSL_shutdown.pod

This page is rendered in a form that truncates our man page output
entirely: Although the man page source appears at least roughly
correct, the last sentence that actually displays when 'man' is
invoked is

  SSL_shutdown() supports both uni- and bidirectional shutdown by its 2
  step behaviour.

Some hint of man's "thinking" is given by a makewhatis diagnostic that
comes to me courtesy of cron:

  nroff: Macro argument too long; line 170, file /usr/local/man/man3/SSL_shutdown.3
  stack: N"

The N" invocation that causes the problem is presumedly the one right
after the last "visible" line:

  .Ip "When the application is the first party to send the \*(N"close notify\*(T" 
alert, SSL_shutdown() will only ...

That's line 221 rather than 170, however.

I've attached the 2 generated man pages for your inspection.  Sorry not
to be able to do any more than point out the problem.  Suggestions for a
cure would be greatly appreciated.

Thanks in advance,
-- 
Rick Troxel, Helix Systems Staff     [EMAIL PROTECTED]     301/435-2983
.rn '' }`
''' $RCSfile$$Revision$$Date$
'''
''' $Log$
'''
.de Sh
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp
.if t .sp .5v
.if n .sp
..
.de Ip
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.de Vb
.ft CW
.nf
.ne \\$1
..
.de Ve
.ft R

.fi
..
'''
'''
'''     Set up \*(-- to give an unbreakable dash;
'''     string Tr holds user defined translation string.
'''     Bell System Logo is used as a dummy character.
'''
.tr \(*W-|\(bv\*(Tr
.ie n \{\
.ds -- \(*W-
.ds PI pi
.if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
.ds L" ""
.ds R" ""
'''   \*(M", \*(S", \*(N" and \*(T" are the equivalent of
'''   \*(L" and \*(R", except that they are used on ".xx" lines,
'''   such as .IP and .SH, which do another additional levels of
'''   double-quote interpretation
.ds M" """
.ds S" """
.ds N" """""
.ds T" """""
.ds L' '
.ds R' '
.ds M' '
.ds S' '
.ds N' '
.ds T' '
'br\}
.el\{\
.ds -- \(em\|
.tr \*(Tr
.ds L" ``
.ds R" ''
.ds M" ``
.ds S" ''
.ds N" ``
.ds T" ''
.ds L' `
.ds R' '
.ds M' `
.ds S' '
.ds N' `
.ds T' '
.ds PI \(*p
'br\}
.\"     If the F register is turned on, we'll generate
.\"     index entries out stderr for the following things:
.\"             TH      Title 
.\"             SH      Header
.\"             Sh      Subsection 
.\"             Ip      Item
.\"             X<>     Xref  (embedded
.\"     Of course, you have to process the output yourself
.\"     in some meaninful fashion.
.if \nF \{
.de IX
.tm Index:\\$1\t\\n%\t"\\$2"
..
.nr % 0
.rr F
.\}
.TH SSL_alert_type_string 3 "0.9.6c" "13/Sep/2001" "OpenSSL"
.UC
.if n .hy 0
.if n .na
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.de CQ          \" put $1 in typewriter font
.ft CW
'if n "\c
'if t \\&\\$1\c
'if n \\&\\$1\c
'if n \&"
\\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7
'.ft R
..
.\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2
.       \" AM - accent mark definitions
.bd B 3
.       \" fudge factors for nroff and troff
.if n \{\
.       ds #H 0
.       ds #V .8m
.       ds #F .3m
.       ds #[ \f1
.       ds #] \fP
.\}
.if t \{\
.       ds #H ((1u-(\\\\n(.fu%2u))*.13m)
.       ds #V .6m
.       ds #F 0
.       ds #[ \&
.       ds #] \&
.\}
.       \" simple accents for nroff and troff
.if n \{\
.       ds ' \&
.       ds ` \&
.       ds ^ \&
.       ds , \&
.       ds ~ ~
.       ds ? ?
.       ds ! !
.       ds /
.       ds q
.\}
.if t \{\
.       ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
.       ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
.       ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
.       ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
.       ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
.       ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10'
.       ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m'
.       ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.       ds q o\h'-\w'o'u*8/10'\s-4\v'.4m'\z\(*i\v'-.4m'\s+4\h'\w'o'u*8/10'
.\}
.       \" troff and (daisy-wheel) nroff accents
.ds : 
\\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#]
.ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u'
.ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u'
.ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#]
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.ds oe o\h'-(\w'o'u*4/10)'e
.ds Oe O\h'-(\w'O'u*4/10)'E
.       \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.       \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
.       ds : e
.       ds 8 ss
.       ds v \h'-1'\o'\(aa\(ga'
.       ds _ \h'-1'^
.       ds . \h'-1'.
.       ds 3 3
.       ds o a
.       ds d- d\h'-1'\(ga
.       ds D- D\h'-1'\(hy
.       ds th \o'bp'
.       ds Th \o'LP'
.       ds ae ae
.       ds Ae AE
.       ds oe oe
.       ds Oe OE
.\}
.rm #[ #] #H #V #F C
.SH "NAME"
SSL_alert_type_string, SSL_alert_type_string_long, SSL_alert_desc_string, 
SSL_alert_desc_string_long \- get textual description of alert information
.SH "SYNOPSIS"
.PP
.Vb 1
\& #include <openssl/ssl.h>
.Ve
.Vb 2
\& char *SSL_alert_type_string(int value);
\& char *SSL_alert_type_string_long(int value);
.Ve
.Vb 2
\& char *SSL_alert_desc_string(int value);
\& char *SSL_alert_desc_string_long(int value);
.Ve
.SH "DESCRIPTION"
\fISSL_alert_type_string()\fR returns a one letter string indicating the
type of the alert specified by \fBvalue\fR.
.PP
\fISSL_alert_type_string_long()\fR returns a string indicating the type of the alert
specified by \fBvalue\fR.
.PP
\fISSL_alert_desc_string()\fR returns a two letter string as a short form
describing the reason of the alert specified by \fBvalue\fR.
.PP
\fISSL_alert_desc_string_long()\fR returns a string describing the reason
of the alert specified by \fBvalue\fR.
.SH "NOTES"
When one side of an SSL/TLS communication wants to inform the peer about
a special situation, it sends an alert. The alert is sent as a special message
and does not influence the normal data stream (unless its contents results
in the communication being canceled).
.PP
A warning alert is sent, when a non-fatal error condition occurs. The
\*(L"close notify\*(R" alert is sent as a warning alert. Other examples for
non-fatal errors are certificate errors ("certificate expired\*(R",
\*(L"unsupported certificate"), for which a warning alert may be sent.
(The sending party may however decide to send a fatal error.) The
receiving side may cancel the connection on reception of a warning
alert on it discretion.
.PP
Several alert messages must be sent as fatal alert messages as specified
by the TLS RFC. A fatal alert always leads to a connection abort.
.SH "RETURN VALUES"
The following strings can occur for \fISSL_alert_type_string()\fR or
\fISSL_alert_type_string_long()\fR:
.Ip "\*(N"'/'arning\*(T"" 4
.Ip "\*(N"'/'atal\*(T"" 4
.Ip "\*(N"'/'nknown\*(T"" 4
This indicates that no support is available for this alert type.
Probably \fBvalue\fR does not contain a correct alert message.
.PP
The following strings can occur for \fISSL_alert_desc_string()\fR or
\fISSL_alert_desc_string_long()\fR:
.Ip "\*(N"\s-1CN\s'/'lose notify\*(T"" 4
The connection shall be closed. This is a warning alert.
.Ip "\*(N"\s-1UM\s'/'nexpected message\*(T"" 4
An inappropriate message was received. This alert is always fatal
and should never be observed in communication between proper
implementations.
.Ip "\*(N"\s-1BM\s'/'ad record mac\*(T"" 4
This alert is returned if a record is received with an incorrect
\s-1MAC\s0. This message is always fatal.
.Ip "\*(N"\s-1DF\s'/'ecompression failure\*(T"" 4
The decompression function received improper input (e.g. data
that would expand to excessive length). This message is always
fatal.
.Ip "\*(N"\s-1HF\s'/'andshake failure\*(T"" 4
Reception of a handshake_failure alert message indicates that the
sender was unable to negotiate an acceptable set of security
parameters given the options available. This is a fatal error.
.Ip "\*(N"\s-1NC\s'/'o certificate\*(T"" 4
A client, that was asked to send a certificate, does not send a certificate
(SSLv3 only).
.Ip "\*(N"\s-1BC\s'/'ad certificate\*(T"" 4
A certificate was corrupt, contained signatures that did not
verify correctly, etc
.Ip "\*(N"\s-1UC\s'/'nsupported certificate\*(T"" 4
A certificate was of an unsupported type.
.Ip "\*(N"\s-1CR\s'/'ertificate revoked\*(T"" 4
A certificate was revoked by its signer.
.Ip "\*(N"\s-1CE\s'/'ertificate expired\*(T"" 4
A certificate has expired or is not currently valid.
.Ip "\*(N"\s-1CU\s'/'ertificate unknown\*(T"" 4
Some other (unspecified) issue arose in processing the
certificate, rendering it unacceptable.
.Ip "\*(N"\s-1IP\s'/'llegal parameter\*(T"" 4
A field in the handshake was out of range or inconsistent with
other fields. This is always fatal.
.Ip "\*(N"\s-1DC\s'/'ecryption failed\*(T"" 4
A TLSCiphertext decrypted in an invalid way: either it wasn't an
even multiple of the block length or its padding values, when
checked, weren't correct. This message is always fatal.
.Ip "\*(N"\s-1RO\s'/'ecord overflow\*(T"" 4
A TLSCiphertext record was received which had a length more than
2^14+2048 bytes, or a record decrypted to a TLSCompressed record
with more than 2^14+1024 bytes. This message is always fatal.
.Ip "\*(N"\s-1CA\s'/'nknown \s-1CA\s0\*(T"" 4
A valid certificate chain or partial chain was received, but the
certificate was not accepted because the \s-1CA\s0 certificate could not
be located or couldn't be matched with a known, trusted \s-1CA\s0.  This
message is always fatal.
.Ip "\*(N"\s-1AD\s'/'ccess denied\*(T"" 4
A valid certificate was received, but when access control was
applied, the sender decided not to proceed with negotiation.
This message is always fatal.
.Ip "\*(N"\s-1DE\s'/'ecode error\*(T"" 4
A message could not be decoded because some field was out of the
specified range or the length of the message was incorrect. This
message is always fatal.
.Ip "\*(N"\s-1CY\s'/'ecrypt error\*(T"" 4
A handshake cryptographic operation failed, including being
unable to correctly verify a signature, decrypt a key exchange,
or validate a finished message.
.Ip "\*(N"\s-1ER\s'/'xport restriction\*(T"" 4
A negotiation not in compliance with export restrictions was
detected; for example, attempting to transfer a 1024 bit
ephemeral \s-1RSA\s0 key for the \s-1RSA_EXPORT\s0 handshake method. This
message is always fatal.
.Ip "\*(N"\s-1PV\s'/'rotocol version\*(T"" 4
The protocol version the client has attempted to negotiate is
recognized, but not supported. (For example, old protocol
versions might be avoided for security reasons). This message is
always fatal.
.Ip "\*(N"\s-1IS\s'/'nsufficient security\*(T"" 4
Returned instead of handshake_failure when a negotiation has
failed specifically because the server requires ciphers more
secure than those supported by the client. This message is always
fatal.
.Ip "\*(N"\s-1IE\s'/'nternal error\*(T"" 4
An internal error unrelated to the peer or the correctness of the
protocol makes it impossible to continue (such as a memory
allocation failure). This message is always fatal.
.Ip "\*(N"\s-1US\s'/'ser canceled\*(T"" 4
This handshake is being canceled for some reason unrelated to a
protocol failure. If the user cancels an operation after the
handshake is complete, just closing the connection by sending a
close_notify is more appropriate. This alert should be followed
by a close_notify. This message is generally a warning.
.Ip "\*(N"\s-1NR\s'/'o renegotiation\*(T"" 4
Sent by the client in response to a hello request or by the
server in response to a client hello after initial handshaking.
Either of these would normally lead to renegotiation; when that
is not appropriate, the recipient should respond with this alert;
at that point, the original requester can decide whether to
proceed with the connection. One case where this would be
appropriate would be where a server has spawned a process to
satisfy a request; the process might receive security parameters
(key length, authentication, etc.) at startup and it might be
difficult to communicate changes to these parameters after that
point. This message is always a warning.
.Ip "\*(N"\s-1UK\s'/'nknown\*(T"" 4
This indicates that no description is available for this alert type.
Probably \fBvalue\fR does not contain a correct alert message.
.SH "SEE ALSO"
ssl(3), SSL_CTX_set_info_callback(3)

.rn }` ''
.IX Title "SSL_alert_type_string 3"
.IX Name "SSL_alert_type_string, SSL_alert_type_string_long, SSL_alert_desc_string, 
SSL_alert_desc_string_long - get textual description of alert information"

.IX Header "NAME"

.IX Header "SYNOPSIS"

.IX Header "DESCRIPTION"

.IX Header "NOTES"

.IX Header "RETURN VALUES"

.IX Item "\*(N"'/'arning\*(T""

.IX Item "\*(N"'/'atal\*(T""

.IX Item "\*(N"'/'nknown\*(T""

.IX Item "\*(N"\s-1CN\s'/'lose notify\*(T""

.IX Item "\*(N"\s-1UM\s'/'nexpected message\*(T""

.IX Item "\*(N"\s-1BM\s'/'ad record mac\*(T""

.IX Item "\*(N"\s-1DF\s'/'ecompression failure\*(T""

.IX Item "\*(N"\s-1HF\s'/'andshake failure\*(T""

.IX Item "\*(N"\s-1NC\s'/'o certificate\*(T""

.IX Item "\*(N"\s-1BC\s'/'ad certificate\*(T""

.IX Item "\*(N"\s-1UC\s'/'nsupported certificate\*(T""

.IX Item "\*(N"\s-1CR\s'/'ertificate revoked\*(T""

.IX Item "\*(N"\s-1CE\s'/'ertificate expired\*(T""

.IX Item "\*(N"\s-1CU\s'/'ertificate unknown\*(T""

.IX Item "\*(N"\s-1IP\s'/'llegal parameter\*(T""

.IX Item "\*(N"\s-1DC\s'/'ecryption failed\*(T""

.IX Item "\*(N"\s-1RO\s'/'ecord overflow\*(T""

.IX Item "\*(N"\s-1CA\s'/'nknown \s-1CA\s0\*(T""

.IX Item "\*(N"\s-1AD\s'/'ccess denied\*(T""

.IX Item "\*(N"\s-1DE\s'/'ecode error\*(T""

.IX Item "\*(N"\s-1CY\s'/'ecrypt error\*(T""

.IX Item "\*(N"\s-1ER\s'/'xport restriction\*(T""

.IX Item "\*(N"\s-1PV\s'/'rotocol version\*(T""

.IX Item "\*(N"\s-1IS\s'/'nsufficient security\*(T""

.IX Item "\*(N"\s-1IE\s'/'nternal error\*(T""

.IX Item "\*(N"\s-1US\s'/'ser canceled\*(T""

.IX Item "\*(N"\s-1NR\s'/'o renegotiation\*(T""

.IX Item "\*(N"\s-1UK\s'/'nknown\*(T""

.IX Header "SEE ALSO"

.rn '' }`
''' $RCSfile$$Revision$$Date$
'''
''' $Log$
'''
.de Sh
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp
.if t .sp .5v
.if n .sp
..
.de Ip
.br
.ie \\n(.$>=3 .ne \\$3
.el .ne 3
.IP "\\$1" \\$2
..
.de Vb
.ft CW
.nf
.ne \\$1
..
.de Ve
.ft R

.fi
..
'''
'''
'''     Set up \*(-- to give an unbreakable dash;
'''     string Tr holds user defined translation string.
'''     Bell System Logo is used as a dummy character.
'''
.tr \(*W-|\(bv\*(Tr
.ie n \{\
.ds -- \(*W-
.ds PI pi
.if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
.ds L" ""
.ds R" ""
'''   \*(M", \*(S", \*(N" and \*(T" are the equivalent of
'''   \*(L" and \*(R", except that they are used on ".xx" lines,
'''   such as .IP and .SH, which do another additional levels of
'''   double-quote interpretation
.ds M" """
.ds S" """
.ds N" """""
.ds T" """""
.ds L' '
.ds R' '
.ds M' '
.ds S' '
.ds N' '
.ds T' '
'br\}
.el\{\
.ds -- \(em\|
.tr \*(Tr
.ds L" ``
.ds R" ''
.ds M" ``
.ds S" ''
.ds N" ``
.ds T" ''
.ds L' `
.ds R' '
.ds M' `
.ds S' '
.ds N' `
.ds T' '
.ds PI \(*p
'br\}
.\"     If the F register is turned on, we'll generate
.\"     index entries out stderr for the following things:
.\"             TH      Title 
.\"             SH      Header
.\"             Sh      Subsection 
.\"             Ip      Item
.\"             X<>     Xref  (embedded
.\"     Of course, you have to process the output yourself
.\"     in some meaninful fashion.
.if \nF \{
.de IX
.tm Index:\\$1\t\\n%\t"\\$2"
..
.nr % 0
.rr F
.\}
.TH SSL_shutdown 3 "0.9.6c" "20/Aug/2001" "OpenSSL"
.UC
.if n .hy 0
.if n .na
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.de CQ          \" put $1 in typewriter font
.ft CW
'if n "\c
'if t \\&\\$1\c
'if n \\&\\$1\c
'if n \&"
\\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7
'.ft R
..
.\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2
.       \" AM - accent mark definitions
.bd B 3
.       \" fudge factors for nroff and troff
.if n \{\
.       ds #H 0
.       ds #V .8m
.       ds #F .3m
.       ds #[ \f1
.       ds #] \fP
.\}
.if t \{\
.       ds #H ((1u-(\\\\n(.fu%2u))*.13m)
.       ds #V .6m
.       ds #F 0
.       ds #[ \&
.       ds #] \&
.\}
.       \" simple accents for nroff and troff
.if n \{\
.       ds ' \&
.       ds ` \&
.       ds ^ \&
.       ds , \&
.       ds ~ ~
.       ds ? ?
.       ds ! !
.       ds /
.       ds q
.\}
.if t \{\
.       ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
.       ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
.       ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
.       ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
.       ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
.       ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10'
.       ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m'
.       ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.       ds q o\h'-\w'o'u*8/10'\s-4\v'.4m'\z\(*i\v'-.4m'\s+4\h'\w'o'u*8/10'
.\}
.       \" troff and (daisy-wheel) nroff accents
.ds : 
\\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#]
.ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u'
.ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u'
.ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#]
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.ds oe o\h'-(\w'o'u*4/10)'e
.ds Oe O\h'-(\w'O'u*4/10)'E
.       \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.       \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
.       ds : e
.       ds 8 ss
.       ds v \h'-1'\o'\(aa\(ga'
.       ds _ \h'-1'^
.       ds . \h'-1'.
.       ds 3 3
.       ds o a
.       ds d- d\h'-1'\(ga
.       ds D- D\h'-1'\(hy
.       ds th \o'bp'
.       ds Th \o'LP'
.       ds ae ae
.       ds Ae AE
.       ds oe oe
.       ds Oe OE
.\}
.rm #[ #] #H #V #F C
.SH "NAME"
SSL_shutdown \- shut down a TLS/SSL connection
.SH "SYNOPSIS"
.PP
.Vb 1
\& #include <openssl/ssl.h>
.Ve
.Vb 1
\& int SSL_shutdown(SSL *ssl);
.Ve
.SH "DESCRIPTION"
\fISSL_shutdown()\fR shuts down an active TLS/SSL connection. It sends the 
\*(L"close notify\*(R" shutdown alert to the peer.
.SH "NOTES"
\fISSL_shutdown()\fR tries to send the \*(L"close notify\*(R" shutdown alert to the 
peer.
Whether the operation succeeds or not, the SSL_SENT_SHUTDOWN flag is set and
a currently open session is considered closed and good and will be kept in the
session cache for further reuse.
.PP
The shutdown procedure consists of 2 steps: the sending of the \*(L"close notify\*(R"
shutdown alert and the reception of the peer's \*(L"close notify\*(R" shutdown
alert. According to the TLS standard, it is acceptable for an application
to only send its shutdown alert and then close the underlying connection
without waiting for the peer's response (this way resources can be saved,
as the process can already terminate or serve another connection).
When the underlying connection shall be used for more communications, the
complete shutdown procedure (bidirectional \*(L"close notify\*(R" alerts) must be
performed, so that the peers stay synchronized.
.PP
\fISSL_shutdown()\fR supports both uni- and bidirectional shutdown by its 2 step
behaviour.
.Ip "When the application is the first party to send the \*(N"close notify\*(T" alert, 
SSL_shutdown() will only send the alert and the set the \s-1SSL_SENT_SHUTDOWN\s0 flag 
(so that the session is considered good and will be kept in cache). SSL_shutdown() 
will then return with 0. If a unidirectional shutdown is enough (the underlying 
connection shall be closed anyway), this first call to SSL_shutdown() is sufficient. 
In order to complete the bidirectional shutdown handshake, SSL_shutdown() must be 
called again. The second call will make SSL_shutdown() wait for the peer's \*(N"close 
notify\*(T" shutdown alert. On success, the second call to SSL_shutdown() will return 
with 1." 4
.Ip "If the peer already sent the \*(N"close notify\*(T" alert \fBand\fR it was 
already processed implicitly inside another function (SSL_read(3)), the 
\s-1SSL_RECEIVED_SHUTDOWN\s0 flag is set. SSL_shutdown() will send the \*(N"close 
notify\*(T" alert, set the \s-1SSL_SENT_SHUTDOWN\s0 flag and will immediately return 
with 1. Whether \s-1SSL_RECEIVED_SHUTDOWN\s0 is already set can be checked using the 
SSL_get_shutdown() (see also SSL_set_shutdown(3) call." 4
.PP
It is therefore recommended, to check the return value of \fISSL_shutdown()\fR
and call \fISSL_shutdown()\fR again, if the bidirectional shutdown is not yet
complete (return value of the first call is 0). As the shutdown is not
specially handled in the SSLv2 protocol, \fISSL_shutdown()\fR will succeed on
the first call.
.PP
The behaviour of \fISSL_shutdown()\fR additionally depends on the underlying 
\s-1BIO\s0. 
.PP
If the underlying \s-1BIO\s0 is \fBblocking\fR, \fISSL_shutdown()\fR will only return 
once the
handshake step has been finished or an error occurred.
.PP
If the underlying \s-1BIO\s0 is \fBnon-blocking\fR, \fISSL_shutdown()\fR will also 
return
when the underlying \s-1BIO\s0 could not satisfy the needs of \fISSL_shutdown()\fR
to continue the handshake. In this case a call to \fISSL_get_error()\fR with the
return value of \fISSL_shutdown()\fR will yield \fB\s-1SSL_ERROR_WANT_READ\s0\fR or
\fB\s-1SSL_ERROR_WANT_WRITE\s0\fR. The calling process then must repeat the call after
taking appropriate action to satisfy the needs of \fISSL_shutdown()\fR.
The action depends on the underlying \s-1BIO\s0. When using a non-blocking socket,
nothing is to be done, but \fIselect()\fR can be used to check for the required
condition. When using a buffering \s-1BIO\s0, like a \s-1BIO\s0 pair, data must be 
written
into or retrieved out of the \s-1BIO\s0 before being able to continue.
.PP
\fISSL_shutdown()\fR can be modified to only set the connection to \*(L"shutdown\*(R"
state but not actually send the \*(L"close notify\*(R" alert messages,
see SSL_CTX_set_quiet_shutdown(3).
When \*(L"quiet shutdown\*(R" is enabled, \fISSL_shutdown()\fR will always succeed
and return 1.
.SH "RETURN VALUES"
The following return values can occur:
.Ip "1" 4
The shutdown was successfully completed. The \*(L"close notify\*(R" alert was sent
and the peer's \*(L"close notify\*(R" alert was received.
.Ip "0" 4
The shutdown is not yet finished. Call \fISSL_shutdown()\fR for a second time,
if a bidirectional shutdown shall be performed.
The output of SSL_get_error(3) may be misleading, as an
erroneous \s-1SSL_ERROR_SYSCALL\s0 may be flagged even though no error occurred.
.Ip "-1" 4
The shutdown was not successful because a fatal error occurred either
at the protocol level or a connection failure occurred. It can also occur if
action is need to continue the operation for non-blocking BIOs.
Call SSL_get_error(3) with the return value \fBret\fR
to find out the reason.
.SH "SEE ALSO"
SSL_get_error(3), SSL_connect(3),
SSL_accept(3), SSL_set_shutdown(3),
SSL_CTX_set_quiet_shutdown(3),
SSL_clear(3), SSL_free(3),
ssl(3), bio(3)

.rn }` ''
.IX Title "SSL_shutdown 3"
.IX Name "SSL_shutdown - shut down a TLS/SSL connection"

.IX Header "NAME"

.IX Header "SYNOPSIS"

.IX Header "DESCRIPTION"

.IX Header "NOTES"

.IX Item "When the application is the first party to send the \*(N"close notify\*(T" 
alert, SSL_shutdown() will only send the alert and the set the 
\s-1SSL_SENT_SHUTDOWN\s0 flag (so that the session is considered good and will be kept 
in cache). SSL_shutdown() will then return with 0. If a unidirectional shutdown is 
enough (the underlying connection shall be closed anyway), this first call to 
SSL_shutdown() is sufficient. In order to complete the bidirectional shutdown 
handshake, SSL_shutdown() must be called again. The second call will make 
SSL_shutdown() wait for the peer's \*(N"close notify\*(T" shutdown alert. On success, 
the second call to SSL_shutdown() will return with 1."

.IX Item "If the peer already sent the \*(N"close notify\*(T" alert \fBand\fR it was 
already processed implicitly inside another function (SSL_read(3)), the 
\s-1SSL_RECEIVED_SHUTDOWN\s0 flag is set. SSL_shutdown() will send the \*(N"close 
notify\*(T" alert, set the \s-1SSL_SENT_SHUTDOWN\s0 flag and will immediately return 
with 1. Whether \s-1SSL_RECEIVED_SHUTDOWN\s0 is already set can be checked using the 
SSL_get_shutdown() (see also SSL_set_shutdown(3) call."

.IX Header "RETURN VALUES"

.IX Item "1"

.IX Item "0"

.IX Item "-1"

.IX Header "SEE ALSO"

Reply via email to