X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=doc%2Fcrypto%2Ferr.pod;h=b824c92b57c3172c1b42c3791bc5408e8f6d9ab0;hb=bace21247493eb38870d2585f0e643bdc550f60a;hp=029899769e79b819c2afb8946adabb88a99976aa;hpb=1c8337abe3ad5fb066d50dc8933b1733a8b6fe3e;p=oweals%2Fopenssl.git diff --git a/doc/crypto/err.pod b/doc/crypto/err.pod index 029899769e..b824c92b57 100644 --- a/doc/crypto/err.pod +++ b/doc/crypto/err.pod @@ -2,7 +2,7 @@ =head1 NAME -err - Error codes +err - error codes =head1 SYNOPSIS @@ -71,7 +71,7 @@ See L if you want to record error codes in the OpenSSL error system from within your application. The remainder of this section is of interest only if you want to add -new functionality to OpenSSL. +new error codes to OpenSSL or add error codes from external libraries. =head2 Reporting errors @@ -84,10 +84,24 @@ descriptions. For example, the function ssl23_read() reports a SSLerr(SSL_F_SSL23_READ, SSL_R_SSL_HANDSHAKE_FAILURE); +Function and reason codes should consist of upper case characters, +numbers and underscores only. The error file generation script translates +function codes into function names by looking in the header files +for an appropriate function name, if none is found it just uses +the capitalized form such as "SSL23_READ" in the above example. + +The trailing section of a reason code (after the "_R_") is translated +into lower case and underscores changed to spaces. + When you are using new function or reason codes, run B. The necessary B<#define>s will then automatically be added to the sub-library's header file. +Although a library will normally report errors using its own specific +XXXerr macro, another library's macro can be used. This is normally +only done when a library wants to include ASN1 code which must use +the ASN1err() macro. + =head2 Adding new libraries When adding a new sub-library to OpenSSL, assign it a library number @@ -102,6 +116,47 @@ to B, and add B to the Makefile. Running B will then generate a file B, and add all error codes used in the library to B. +Additionally the library include file must have a certain form. +Typically it will initially look like this: + + #ifndef HEADER_XXX_H + #define HEADER_XXX_H + + #ifdef __cplusplus + extern "C" { + #endif + + /* Include files */ + + #include + #include + + /* Macros, structures and function prototypes */ + + + /* BEGIN ERROR CODES */ + +The B sequence is used by the error code +generation script as the point to place new error codes, any text +after this point will be overwritten when B is run. +The closing #endif etc will be automatically added by the script. + +The generated C error code file B will load the header +files B, B and B so the +header file must load any additional header files containg any +definitions it uses. + +=head1 USING ERROR CODES IN EXTERNAL LIBRARIES + +It is also possible to use OpenSSL's error code scheme in external +libraries. The library needs to load its own codes and call the OpenSSL +error code insertion script B explicitly to add codes to +the header file and generate the C error code file. This will normally +be done if the external library needs to generate new ASN1 structures +but it can also be used to add more general purpose error code handling. + +TBA more details + =head1 INTERNALS The error queues are stored in a hash table with one B