|
Packit |
c4476c |
Adding new libraries
|
|
Packit |
c4476c |
--------------------
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
When adding a new sub-library to OpenSSL, assign it a library number
|
|
Packit |
c4476c |
ERR_LIB_XXX, define a macro XXXerr() (both in err.h), add its
|
|
Packit |
c4476c |
name to ERR_str_libraries[] (in crypto/err/err.c), and add
|
|
Packit |
c4476c |
ERR_load_XXX_strings() to the ERR_load_crypto_strings() function
|
|
Packit |
c4476c |
(in crypto/err/err_all.c). Finally, add an entry:
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
L XXX xxx.h xxx_err.c
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
to crypto/err/openssl.ec, and add xxx_err.c to the Makefile.
|
|
Packit |
c4476c |
Running make errors will then generate a file xxx_err.c, and
|
|
Packit |
c4476c |
add all error codes used in the library to xxx.h.
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
Additionally the library include file must have a certain form.
|
|
Packit |
c4476c |
Typically it will initially look like this:
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
#ifndef HEADER_XXX_H
|
|
Packit |
c4476c |
#define HEADER_XXX_H
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
#ifdef __cplusplus
|
|
Packit |
c4476c |
extern "C" {
|
|
Packit |
c4476c |
#endif
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
/* Include files */
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
#include <openssl/bio.h>
|
|
Packit |
c4476c |
#include <openssl/x509.h>
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
/* Macros, structures and function prototypes */
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
/* BEGIN ERROR CODES */
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
The BEGIN ERROR CODES sequence is used by the error code
|
|
Packit |
c4476c |
generation script as the point to place new error codes, any text
|
|
Packit |
c4476c |
after this point will be overwritten when make errors is run.
|
|
Packit |
c4476c |
The closing #endif etc will be automatically added by the script.
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
The generated C error code file xxx_err.c will load the header
|
|
Packit |
c4476c |
files stdio.h, openssl/err.h and openssl/xxx.h so the
|
|
Packit |
c4476c |
header file must load any additional header files containing any
|
|
Packit |
c4476c |
definitions it uses.
|