diff options
author | qrort <qrort@yandex-team.com> | 2022-11-30 23:47:12 +0300 |
---|---|---|
committer | qrort <qrort@yandex-team.com> | 2022-11-30 23:47:12 +0300 |
commit | 22f8ae0e3f5d68b92aecccdf96c1d841a0334311 (patch) | |
tree | bffa27765faf54126ad44bcafa89fadecb7a73d7 /contrib/libs/matrixssl/matrixCommon.h | |
parent | 332b99e2173f0425444abb759eebcb2fafaa9209 (diff) | |
download | ydb-22f8ae0e3f5d68b92aecccdf96c1d841a0334311.tar.gz |
validate canons without yatest_common
Diffstat (limited to 'contrib/libs/matrixssl/matrixCommon.h')
-rw-r--r-- | contrib/libs/matrixssl/matrixCommon.h | 178 |
1 files changed, 178 insertions, 0 deletions
diff --git a/contrib/libs/matrixssl/matrixCommon.h b/contrib/libs/matrixssl/matrixCommon.h new file mode 100644 index 00000000000..1388b9e7ec6 --- /dev/null +++ b/contrib/libs/matrixssl/matrixCommon.h @@ -0,0 +1,178 @@ +/* + * matrixCommon.h + * Release $Name: MATRIXSSL_1_8_7_OPEN $ + * + * Public common header file + */ +/* + * Copyright (c) PeerSec Networks, 2002-2009. All Rights Reserved. + * The latest version of this code is available at http://www.matrixssl.org + * + * This software is open source; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This General Public License does NOT permit incorporating this software + * into proprietary programs. If you are unable to comply with the GPL, a + * commercial license for this software may be purchased from PeerSec Networks + * at http://www.peersec.com + * + * This program is distributed in WITHOUT ANY WARRANTY; without even the + * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * http://www.gnu.org/copyleft/gpl.html + */ +/******************************************************************************/ + +#ifndef _h_MATRIXCOMMON +#define _h_MATRIXCOMMON + +#include <util/system/defaults.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#include "src/matrixConfig.h" + +/******************************************************************************/ +/* + Platform integer sizes +*/ +typedef i32 int32; +typedef ui32 uint32; + +/******************************************************************************/ +/* + Flags for matrixSslNewSession +*/ +#define SSL_FLAGS_SERVER 0x1 +#define SSL_FLAGS_CLIENT_AUTH 0x200 + +/******************************************************************************/ +/* + matrixSslSetSessionOption defines +*/ +#define SSL_OPTION_DELETE_SESSION 0 + + +/******************************************************************************/ +/* + Typdefs required for public apis. From an end user perspective, the + sslBuf_t and sslCertInfo_t types have internal fields that are public, + but ssl_t, sslKeys_t, sslCert_t,and sslSessionId_t do not. Defining + those as 'int32' requires it to be treated as an opaque data type to be + passed to public apis +*/ +#ifndef _h_EXPORT_SYMBOLS + +typedef int32 ssl_t; +typedef int32 sslKeys_t; +typedef int32 sslSessionId_t; +typedef int32 sslCert_t; + +/******************************************************************************/ +/* + Explicitly import MATRIXPUBLIC apis on Windows. If we're being included + from an internal header, we export them instead! +*/ +#if defined(_win_) && defined(MATRIXSSL_DLL) +#define MATRIXPUBLIC extern __declspec(dllimport) +#endif /* win dll */ +#else /* h_EXPORT_SYMOBOLS */ +#if defined(_win_) && defined(MATRIXSSL_DLL) +#define MATRIXPUBLIC extern __declspec(dllexport) +#endif /* win dll */ +#endif /* h_EXPORT_SYMOBOLS */ + +#ifndef MATRIXPUBLIC +#define MATRIXPUBLIC extern +#endif + +/******************************************************************************/ +/* + Public structures + + sslBuf_t + Empty buffer: + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 + |.|.|.|.|.|.|.|.|.|.|.|.|.|.|.|.| + ^ + \end + \start + \buf + size = 16 + len = (end - start) = 0 + + Buffer with data: + + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 + |.|.|a|b|c|d|e|f|g|h|i|j|.|.|.|.| + ^ ^ ^ + | | \end + | \start + \buf + size = 16 + len = (end - start) = 10 + + Read from start pointer + Write to end pointer +*/ +typedef struct { + unsigned char *buf; /* Pointer to the start of the buffer */ + unsigned char *start; /* Pointer to start of valid data */ + unsigned char *end; /* Pointer to first byte of invalid data */ + int32 size; /* Size of buffer in bytes */ +} sslBuf_t; + + +/******************************************************************************/ +/* + Information provided to user callback for validating certificates. + Register callback with call to matrixSslSetCertValidator +*/ +typedef struct { + char *country; + char *state; + char *locality; + char *organization; + char *orgUnit; + char *commonName; +} sslDistinguishedName_t; + +typedef struct sslSubjectAltNameEntry { + int32 id; + unsigned char name[16]; + unsigned char *data; + int32 dataLen; + struct sslSubjectAltNameEntry *next; +} sslSubjectAltName_t; + +typedef struct sslCertInfo { + int32 verified; + unsigned char *serialNumber; + int32 serialNumberLen; + char *notBefore; + char *notAfter; + char *sigHash; + int32 sigHashLen; + sslSubjectAltName_t *subjectAltName; + sslDistinguishedName_t subject; + sslDistinguishedName_t issuer; + struct sslCertInfo *next; +} sslCertInfo_t; + +/******************************************************************************/ + +#ifdef __cplusplus +} +#endif + +#endif /* _h_MATRIXCOMMON */ + +/******************************************************************************/ |