new openssl headers
This commit is contained in:
parent
021dbc99b7
commit
dc84a2bfca
16
src/dep/include/openssl/__DECC_INCLUDE_EPILOGUE.H
Normal file
16
src/dep/include/openssl/__DECC_INCLUDE_EPILOGUE.H
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is only used by HP C on VMS, and is included automatically
|
||||
* after each header file from this directory
|
||||
*/
|
||||
|
||||
/* restore state. Must correspond to the save in __decc_include_prologue.h */
|
||||
#pragma names restore
|
||||
20
src/dep/include/openssl/__DECC_INCLUDE_PROLOGUE.H
Normal file
20
src/dep/include/openssl/__DECC_INCLUDE_PROLOGUE.H
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is only used by HP C on VMS, and is included automatically
|
||||
* after each header file from this directory
|
||||
*/
|
||||
|
||||
/* save state */
|
||||
#pragma names save
|
||||
/* have the compiler shorten symbols larger than 31 chars to 23 chars
|
||||
* followed by a 8 hex char CRC
|
||||
*/
|
||||
#pragma names as_is,shortened
|
||||
@ -1,82 +1,39 @@
|
||||
/* crypto/aes/aes.h -*- mode:C; c-file-style: "eay" -*- */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* openssl-core@openssl.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
/*
|
||||
* Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_AES_H
|
||||
#define HEADER_AES_H
|
||||
# define HEADER_AES_H
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
#ifdef OPENSSL_NO_AES
|
||||
#error AES is disabled.
|
||||
#endif
|
||||
|
||||
#define AES_ENCRYPT 1
|
||||
#define AES_DECRYPT 0
|
||||
|
||||
/* Because array size can't be a const in C, the following two are macros.
|
||||
Both sizes are in bytes. */
|
||||
#define AES_MAXNR 14
|
||||
#define AES_BLOCK_SIZE 16
|
||||
|
||||
#ifdef __cplusplus
|
||||
# include <stddef.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
# endif
|
||||
|
||||
# define AES_ENCRYPT 1
|
||||
# define AES_DECRYPT 0
|
||||
|
||||
/*
|
||||
* Because array size can't be a const in C, the following two are macros.
|
||||
* Both sizes are in bytes.
|
||||
*/
|
||||
# define AES_MAXNR 14
|
||||
# define AES_BLOCK_SIZE 16
|
||||
|
||||
/* This should be a hidden type, but EVP requires that the size be known */
|
||||
struct aes_key_st {
|
||||
#ifdef AES_LONG
|
||||
unsigned long rd_key[4 *(AES_MAXNR + 1)];
|
||||
#else
|
||||
unsigned int rd_key[4 *(AES_MAXNR + 1)];
|
||||
#endif
|
||||
# ifdef AES_LONG
|
||||
unsigned long rd_key[4 * (AES_MAXNR + 1)];
|
||||
# else
|
||||
unsigned int rd_key[4 * (AES_MAXNR + 1)];
|
||||
# endif
|
||||
int rounds;
|
||||
};
|
||||
typedef struct aes_key_st AES_KEY;
|
||||
@ -84,44 +41,52 @@ typedef struct aes_key_st AES_KEY;
|
||||
const char *AES_options(void);
|
||||
|
||||
int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key);
|
||||
AES_KEY *key);
|
||||
int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key);
|
||||
AES_KEY *key);
|
||||
|
||||
void AES_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const AES_KEY *key);
|
||||
const AES_KEY *key);
|
||||
void AES_decrypt(const unsigned char *in, unsigned char *out,
|
||||
const AES_KEY *key);
|
||||
const AES_KEY *key);
|
||||
|
||||
void AES_ecb_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const AES_KEY *key, const int enc);
|
||||
const AES_KEY *key, const int enc);
|
||||
void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const unsigned long length, const AES_KEY *key,
|
||||
unsigned char *ivec, const int enc);
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char *ivec, const int enc);
|
||||
void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const unsigned long length, const AES_KEY *key,
|
||||
unsigned char *ivec, int *num, const int enc);
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char *ivec, int *num, const int enc);
|
||||
void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const unsigned long length, const AES_KEY *key,
|
||||
unsigned char *ivec, int *num, const int enc);
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char *ivec, int *num, const int enc);
|
||||
void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const unsigned long length, const AES_KEY *key,
|
||||
unsigned char *ivec, int *num, const int enc);
|
||||
void AES_cfbr_encrypt_block(const unsigned char *in,unsigned char *out,
|
||||
const int nbits,const AES_KEY *key,
|
||||
unsigned char *ivec,const int enc);
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char *ivec, int *num, const int enc);
|
||||
void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const unsigned long length, const AES_KEY *key,
|
||||
unsigned char *ivec, int *num);
|
||||
void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const unsigned long length, const AES_KEY *key,
|
||||
unsigned char ivec[AES_BLOCK_SIZE],
|
||||
unsigned char ecount_buf[AES_BLOCK_SIZE],
|
||||
unsigned int *num);
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char *ivec, int *num);
|
||||
/* NB: the IV is _two_ blocks long */
|
||||
void AES_ige_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const AES_KEY *key,
|
||||
unsigned char *ivec, const int enc);
|
||||
/* NB: the IV is _four_ blocks long */
|
||||
void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const AES_KEY *key,
|
||||
const AES_KEY *key2, const unsigned char *ivec,
|
||||
const int enc);
|
||||
|
||||
int AES_wrap_key(AES_KEY *key, const unsigned char *iv,
|
||||
unsigned char *out,
|
||||
const unsigned char *in, unsigned int inlen);
|
||||
int AES_unwrap_key(AES_KEY *key, const unsigned char *iv,
|
||||
unsigned char *out,
|
||||
const unsigned char *in, unsigned int inlen);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#endif /* !HEADER_AES_H */
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,571 +1,10 @@
|
||||
/* crypto/asn1/asn1_mac.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_ASN1_MAC_H
|
||||
#define HEADER_ASN1_MAC_H
|
||||
|
||||
#include <openssl/asn1.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef ASN1_MAC_ERR_LIB
|
||||
#define ASN1_MAC_ERR_LIB ERR_LIB_ASN1
|
||||
#endif
|
||||
|
||||
#define ASN1_MAC_H_err(f,r,line) \
|
||||
ERR_PUT_error(ASN1_MAC_ERR_LIB,(f),(r),__FILE__,(line))
|
||||
|
||||
#define M_ASN1_D2I_vars(a,type,func) \
|
||||
ASN1_const_CTX c; \
|
||||
type ret=NULL; \
|
||||
\
|
||||
c.pp=(const unsigned char **)pp; \
|
||||
c.q= *(const unsigned char **)pp; \
|
||||
c.error=ERR_R_NESTED_ASN1_ERROR; \
|
||||
if ((a == NULL) || ((*a) == NULL)) \
|
||||
{ if ((ret=(type)func()) == NULL) \
|
||||
{ c.line=__LINE__; goto err; } } \
|
||||
else ret=(*a);
|
||||
|
||||
#define M_ASN1_D2I_Init() \
|
||||
c.p= *(const unsigned char **)pp; \
|
||||
c.max=(length == 0)?0:(c.p+length);
|
||||
|
||||
#define M_ASN1_D2I_Finish_2(a) \
|
||||
if (!asn1_const_Finish(&c)) \
|
||||
{ c.line=__LINE__; goto err; } \
|
||||
*(const unsigned char **)pp=c.p; \
|
||||
if (a != NULL) (*a)=ret; \
|
||||
return(ret);
|
||||
|
||||
#define M_ASN1_D2I_Finish(a,func,e) \
|
||||
M_ASN1_D2I_Finish_2(a); \
|
||||
err:\
|
||||
ASN1_MAC_H_err((e),c.error,c.line); \
|
||||
asn1_add_error(*(const unsigned char **)pp,(int)(c.q- *pp)); \
|
||||
if ((ret != NULL) && ((a == NULL) || (*a != ret))) func(ret); \
|
||||
return(NULL)
|
||||
|
||||
#define M_ASN1_D2I_start_sequence() \
|
||||
if (!asn1_GetSequence(&c,&length)) \
|
||||
{ c.line=__LINE__; goto err; }
|
||||
/* Begin reading ASN1 without a surrounding sequence */
|
||||
#define M_ASN1_D2I_begin() \
|
||||
c.slen = length;
|
||||
|
||||
/* End reading ASN1 with no check on length */
|
||||
#define M_ASN1_D2I_Finish_nolen(a, func, e) \
|
||||
*pp=c.p; \
|
||||
if (a != NULL) (*a)=ret; \
|
||||
return(ret); \
|
||||
err:\
|
||||
ASN1_MAC_H_err((e),c.error,c.line); \
|
||||
asn1_add_error(*pp,(int)(c.q- *pp)); \
|
||||
if ((ret != NULL) && ((a == NULL) || (*a != ret))) func(ret); \
|
||||
return(NULL)
|
||||
|
||||
#define M_ASN1_D2I_end_sequence() \
|
||||
(((c.inf&1) == 0)?(c.slen <= 0): \
|
||||
(c.eos=ASN1_const_check_infinite_end(&c.p,c.slen)))
|
||||
|
||||
/* Don't use this with d2i_ASN1_BOOLEAN() */
|
||||
#define M_ASN1_D2I_get(b, func) \
|
||||
c.q=c.p; \
|
||||
if (func(&(b),&c.p,c.slen) == NULL) \
|
||||
{c.line=__LINE__; goto err; } \
|
||||
c.slen-=(c.p-c.q);
|
||||
|
||||
/* Don't use this with d2i_ASN1_BOOLEAN() */
|
||||
#define M_ASN1_D2I_get_x(type,b,func) \
|
||||
c.q=c.p; \
|
||||
if (((D2I_OF(type))func)(&(b),&c.p,c.slen) == NULL) \
|
||||
{c.line=__LINE__; goto err; } \
|
||||
c.slen-=(c.p-c.q);
|
||||
|
||||
/* use this instead () */
|
||||
#define M_ASN1_D2I_get_int(b,func) \
|
||||
c.q=c.p; \
|
||||
if (func(&(b),&c.p,c.slen) < 0) \
|
||||
{c.line=__LINE__; goto err; } \
|
||||
c.slen-=(c.p-c.q);
|
||||
|
||||
#define M_ASN1_D2I_get_opt(b,func,type) \
|
||||
if ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) \
|
||||
== (V_ASN1_UNIVERSAL|(type)))) \
|
||||
{ \
|
||||
M_ASN1_D2I_get(b,func); \
|
||||
}
|
||||
|
||||
#define M_ASN1_D2I_get_imp(b,func, type) \
|
||||
M_ASN1_next=(_tmp& V_ASN1_CONSTRUCTED)|type; \
|
||||
c.q=c.p; \
|
||||
if (func(&(b),&c.p,c.slen) == NULL) \
|
||||
{c.line=__LINE__; M_ASN1_next_prev = _tmp; goto err; } \
|
||||
c.slen-=(c.p-c.q);\
|
||||
M_ASN1_next_prev=_tmp;
|
||||
|
||||
#define M_ASN1_D2I_get_IMP_opt(b,func,tag,type) \
|
||||
if ((c.slen != 0) && ((M_ASN1_next & (~V_ASN1_CONSTRUCTED)) == \
|
||||
(V_ASN1_CONTEXT_SPECIFIC|(tag)))) \
|
||||
{ \
|
||||
unsigned char _tmp = M_ASN1_next; \
|
||||
M_ASN1_D2I_get_imp(b,func, type);\
|
||||
}
|
||||
|
||||
#define M_ASN1_D2I_get_set(r,func,free_func) \
|
||||
M_ASN1_D2I_get_imp_set(r,func,free_func, \
|
||||
V_ASN1_SET,V_ASN1_UNIVERSAL);
|
||||
|
||||
#define M_ASN1_D2I_get_set_type(type,r,func,free_func) \
|
||||
M_ASN1_D2I_get_imp_set_type(type,r,func,free_func, \
|
||||
V_ASN1_SET,V_ASN1_UNIVERSAL);
|
||||
|
||||
#define M_ASN1_D2I_get_set_opt(r,func,free_func) \
|
||||
if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \
|
||||
V_ASN1_CONSTRUCTED|V_ASN1_SET)))\
|
||||
{ M_ASN1_D2I_get_set(r,func,free_func); }
|
||||
|
||||
#define M_ASN1_D2I_get_set_opt_type(type,r,func,free_func) \
|
||||
if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \
|
||||
V_ASN1_CONSTRUCTED|V_ASN1_SET)))\
|
||||
{ M_ASN1_D2I_get_set_type(type,r,func,free_func); }
|
||||
|
||||
#define M_ASN1_I2D_len_SET_opt(a,f) \
|
||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
||||
M_ASN1_I2D_len_SET(a,f);
|
||||
|
||||
#define M_ASN1_I2D_put_SET_opt(a,f) \
|
||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
||||
M_ASN1_I2D_put_SET(a,f);
|
||||
|
||||
#define M_ASN1_I2D_put_SEQUENCE_opt(a,f) \
|
||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
||||
M_ASN1_I2D_put_SEQUENCE(a,f);
|
||||
|
||||
#define M_ASN1_I2D_put_SEQUENCE_opt_type(type,a,f) \
|
||||
if ((a != NULL) && (sk_##type##_num(a) != 0)) \
|
||||
M_ASN1_I2D_put_SEQUENCE_type(type,a,f);
|
||||
|
||||
#define M_ASN1_D2I_get_IMP_set_opt(b,func,free_func,tag) \
|
||||
if ((c.slen != 0) && \
|
||||
(M_ASN1_next == \
|
||||
(V_ASN1_CONTEXT_SPECIFIC|V_ASN1_CONSTRUCTED|(tag))))\
|
||||
{ \
|
||||
M_ASN1_D2I_get_imp_set(b,func,free_func,\
|
||||
tag,V_ASN1_CONTEXT_SPECIFIC); \
|
||||
}
|
||||
|
||||
#define M_ASN1_D2I_get_IMP_set_opt_type(type,b,func,free_func,tag) \
|
||||
if ((c.slen != 0) && \
|
||||
(M_ASN1_next == \
|
||||
(V_ASN1_CONTEXT_SPECIFIC|V_ASN1_CONSTRUCTED|(tag))))\
|
||||
{ \
|
||||
M_ASN1_D2I_get_imp_set_type(type,b,func,free_func,\
|
||||
tag,V_ASN1_CONTEXT_SPECIFIC); \
|
||||
}
|
||||
|
||||
#define M_ASN1_D2I_get_seq(r,func,free_func) \
|
||||
M_ASN1_D2I_get_imp_set(r,func,free_func,\
|
||||
V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL);
|
||||
|
||||
#define M_ASN1_D2I_get_seq_type(type,r,func,free_func) \
|
||||
M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,\
|
||||
V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL)
|
||||
|
||||
#define M_ASN1_D2I_get_seq_opt(r,func,free_func) \
|
||||
if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \
|
||||
V_ASN1_CONSTRUCTED|V_ASN1_SEQUENCE)))\
|
||||
{ M_ASN1_D2I_get_seq(r,func,free_func); }
|
||||
|
||||
#define M_ASN1_D2I_get_seq_opt_type(type,r,func,free_func) \
|
||||
if ((c.slen != 0) && (M_ASN1_next == (V_ASN1_UNIVERSAL| \
|
||||
V_ASN1_CONSTRUCTED|V_ASN1_SEQUENCE)))\
|
||||
{ M_ASN1_D2I_get_seq_type(type,r,func,free_func); }
|
||||
|
||||
#define M_ASN1_D2I_get_IMP_set(r,func,free_func,x) \
|
||||
M_ASN1_D2I_get_imp_set(r,func,free_func,\
|
||||
x,V_ASN1_CONTEXT_SPECIFIC);
|
||||
|
||||
#define M_ASN1_D2I_get_IMP_set_type(type,r,func,free_func,x) \
|
||||
M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,\
|
||||
x,V_ASN1_CONTEXT_SPECIFIC);
|
||||
|
||||
#define M_ASN1_D2I_get_imp_set(r,func,free_func,a,b) \
|
||||
c.q=c.p; \
|
||||
if (d2i_ASN1_SET(&(r),&c.p,c.slen,(char *(*)())func,\
|
||||
(void (*)())free_func,a,b) == NULL) \
|
||||
{ c.line=__LINE__; goto err; } \
|
||||
c.slen-=(c.p-c.q);
|
||||
|
||||
#define M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,a,b) \
|
||||
c.q=c.p; \
|
||||
if (d2i_ASN1_SET_OF_##type(&(r),&c.p,c.slen,func,\
|
||||
free_func,a,b) == NULL) \
|
||||
{ c.line=__LINE__; goto err; } \
|
||||
c.slen-=(c.p-c.q);
|
||||
|
||||
#define M_ASN1_D2I_get_set_strings(r,func,a,b) \
|
||||
c.q=c.p; \
|
||||
if (d2i_ASN1_STRING_SET(&(r),&c.p,c.slen,a,b) == NULL) \
|
||||
{ c.line=__LINE__; goto err; } \
|
||||
c.slen-=(c.p-c.q);
|
||||
|
||||
#define M_ASN1_D2I_get_EXP_opt(r,func,tag) \
|
||||
if ((c.slen != 0L) && (M_ASN1_next == \
|
||||
(V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \
|
||||
{ \
|
||||
int Tinf,Ttag,Tclass; \
|
||||
long Tlen; \
|
||||
\
|
||||
c.q=c.p; \
|
||||
Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
|
||||
if (Tinf & 0x80) \
|
||||
{ c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \
|
||||
c.line=__LINE__; goto err; } \
|
||||
if (Tinf == (V_ASN1_CONSTRUCTED+1)) \
|
||||
Tlen = c.slen - (c.p - c.q) - 2; \
|
||||
if (func(&(r),&c.p,Tlen) == NULL) \
|
||||
{ c.line=__LINE__; goto err; } \
|
||||
if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
|
||||
Tlen = c.slen - (c.p - c.q); \
|
||||
if(!ASN1_const_check_infinite_end(&c.p, Tlen)) \
|
||||
{ c.error=ERR_R_MISSING_ASN1_EOS; \
|
||||
c.line=__LINE__; goto err; } \
|
||||
}\
|
||||
c.slen-=(c.p-c.q); \
|
||||
}
|
||||
|
||||
#define M_ASN1_D2I_get_EXP_set_opt(r,func,free_func,tag,b) \
|
||||
if ((c.slen != 0) && (M_ASN1_next == \
|
||||
(V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \
|
||||
{ \
|
||||
int Tinf,Ttag,Tclass; \
|
||||
long Tlen; \
|
||||
\
|
||||
c.q=c.p; \
|
||||
Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
|
||||
if (Tinf & 0x80) \
|
||||
{ c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \
|
||||
c.line=__LINE__; goto err; } \
|
||||
if (Tinf == (V_ASN1_CONSTRUCTED+1)) \
|
||||
Tlen = c.slen - (c.p - c.q) - 2; \
|
||||
if (d2i_ASN1_SET(&(r),&c.p,Tlen,(char *(*)())func, \
|
||||
(void (*)())free_func, \
|
||||
b,V_ASN1_UNIVERSAL) == NULL) \
|
||||
{ c.line=__LINE__; goto err; } \
|
||||
if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
|
||||
Tlen = c.slen - (c.p - c.q); \
|
||||
if(!ASN1_check_infinite_end(&c.p, Tlen)) \
|
||||
{ c.error=ERR_R_MISSING_ASN1_EOS; \
|
||||
c.line=__LINE__; goto err; } \
|
||||
}\
|
||||
c.slen-=(c.p-c.q); \
|
||||
}
|
||||
|
||||
#define M_ASN1_D2I_get_EXP_set_opt_type(type,r,func,free_func,tag,b) \
|
||||
if ((c.slen != 0) && (M_ASN1_next == \
|
||||
(V_ASN1_CONSTRUCTED|V_ASN1_CONTEXT_SPECIFIC|tag))) \
|
||||
{ \
|
||||
int Tinf,Ttag,Tclass; \
|
||||
long Tlen; \
|
||||
\
|
||||
c.q=c.p; \
|
||||
Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
|
||||
if (Tinf & 0x80) \
|
||||
{ c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \
|
||||
c.line=__LINE__; goto err; } \
|
||||
if (Tinf == (V_ASN1_CONSTRUCTED+1)) \
|
||||
Tlen = c.slen - (c.p - c.q) - 2; \
|
||||
if (d2i_ASN1_SET_OF_##type(&(r),&c.p,Tlen,func, \
|
||||
free_func,b,V_ASN1_UNIVERSAL) == NULL) \
|
||||
{ c.line=__LINE__; goto err; } \
|
||||
if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
|
||||
Tlen = c.slen - (c.p - c.q); \
|
||||
if(!ASN1_check_infinite_end(&c.p, Tlen)) \
|
||||
{ c.error=ERR_R_MISSING_ASN1_EOS; \
|
||||
c.line=__LINE__; goto err; } \
|
||||
}\
|
||||
c.slen-=(c.p-c.q); \
|
||||
}
|
||||
|
||||
/* New macros */
|
||||
#define M_ASN1_New_Malloc(ret,type) \
|
||||
if ((ret=(type *)OPENSSL_malloc(sizeof(type))) == NULL) \
|
||||
{ c.line=__LINE__; goto err2; }
|
||||
|
||||
#define M_ASN1_New(arg,func) \
|
||||
if (((arg)=func()) == NULL) return(NULL)
|
||||
|
||||
#define M_ASN1_New_Error(a) \
|
||||
/* err: ASN1_MAC_H_err((a),ERR_R_NESTED_ASN1_ERROR,c.line); \
|
||||
return(NULL);*/ \
|
||||
err2: ASN1_MAC_H_err((a),ERR_R_MALLOC_FAILURE,c.line); \
|
||||
return(NULL)
|
||||
|
||||
|
||||
/* BIG UGLY WARNING! This is so damn ugly I wanna puke. Unfortunately,
|
||||
some macros that use ASN1_const_CTX still insist on writing in the input
|
||||
stream. ARGH! ARGH! ARGH! Let's get rid of this macro package.
|
||||
Please? -- Richard Levitte */
|
||||
#define M_ASN1_next (*((unsigned char *)(c.p)))
|
||||
#define M_ASN1_next_prev (*((unsigned char *)(c.q)))
|
||||
|
||||
/*************************************************/
|
||||
|
||||
#define M_ASN1_I2D_vars(a) int r=0,ret=0; \
|
||||
unsigned char *p; \
|
||||
if (a == NULL) return(0)
|
||||
|
||||
/* Length Macros */
|
||||
#define M_ASN1_I2D_len(a,f) ret+=f(a,NULL)
|
||||
#define M_ASN1_I2D_len_IMP_opt(a,f) if (a != NULL) M_ASN1_I2D_len(a,f)
|
||||
|
||||
#define M_ASN1_I2D_len_SET(a,f) \
|
||||
ret+=i2d_ASN1_SET(a,NULL,f,V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET);
|
||||
|
||||
#define M_ASN1_I2D_len_SET_type(type,a,f) \
|
||||
ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,V_ASN1_SET, \
|
||||
V_ASN1_UNIVERSAL,IS_SET);
|
||||
|
||||
#define M_ASN1_I2D_len_SEQUENCE(a,f) \
|
||||
ret+=i2d_ASN1_SET(a,NULL,f,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL, \
|
||||
IS_SEQUENCE);
|
||||
|
||||
#define M_ASN1_I2D_len_SEQUENCE_type(type,a,f) \
|
||||
ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,V_ASN1_SEQUENCE, \
|
||||
V_ASN1_UNIVERSAL,IS_SEQUENCE)
|
||||
|
||||
#define M_ASN1_I2D_len_SEQUENCE_opt(a,f) \
|
||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
||||
M_ASN1_I2D_len_SEQUENCE(a,f);
|
||||
|
||||
#define M_ASN1_I2D_len_SEQUENCE_opt_type(type,a,f) \
|
||||
if ((a != NULL) && (sk_##type##_num(a) != 0)) \
|
||||
M_ASN1_I2D_len_SEQUENCE_type(type,a,f);
|
||||
|
||||
#define M_ASN1_I2D_len_IMP_SET(a,f,x) \
|
||||
ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC,IS_SET);
|
||||
|
||||
#define M_ASN1_I2D_len_IMP_SET_type(type,a,f,x) \
|
||||
ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \
|
||||
V_ASN1_CONTEXT_SPECIFIC,IS_SET);
|
||||
|
||||
#define M_ASN1_I2D_len_IMP_SET_opt(a,f,x) \
|
||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
||||
ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \
|
||||
IS_SET);
|
||||
|
||||
#define M_ASN1_I2D_len_IMP_SET_opt_type(type,a,f,x) \
|
||||
if ((a != NULL) && (sk_##type##_num(a) != 0)) \
|
||||
ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \
|
||||
V_ASN1_CONTEXT_SPECIFIC,IS_SET);
|
||||
|
||||
#define M_ASN1_I2D_len_IMP_SEQUENCE(a,f,x) \
|
||||
ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \
|
||||
IS_SEQUENCE);
|
||||
|
||||
#define M_ASN1_I2D_len_IMP_SEQUENCE_opt(a,f,x) \
|
||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
||||
ret+=i2d_ASN1_SET(a,NULL,f,x,V_ASN1_CONTEXT_SPECIFIC, \
|
||||
IS_SEQUENCE);
|
||||
|
||||
#define M_ASN1_I2D_len_IMP_SEQUENCE_opt_type(type,a,f,x) \
|
||||
if ((a != NULL) && (sk_##type##_num(a) != 0)) \
|
||||
ret+=i2d_ASN1_SET_OF_##type(a,NULL,f,x, \
|
||||
V_ASN1_CONTEXT_SPECIFIC, \
|
||||
IS_SEQUENCE);
|
||||
|
||||
#define M_ASN1_I2D_len_EXP_opt(a,f,mtag,v) \
|
||||
if (a != NULL)\
|
||||
{ \
|
||||
v=f(a,NULL); \
|
||||
ret+=ASN1_object_size(1,v,mtag); \
|
||||
}
|
||||
|
||||
#define M_ASN1_I2D_len_EXP_SET_opt(a,f,mtag,tag,v) \
|
||||
if ((a != NULL) && (sk_num(a) != 0))\
|
||||
{ \
|
||||
v=i2d_ASN1_SET(a,NULL,f,tag,V_ASN1_UNIVERSAL,IS_SET); \
|
||||
ret+=ASN1_object_size(1,v,mtag); \
|
||||
}
|
||||
|
||||
#define M_ASN1_I2D_len_EXP_SEQUENCE_opt(a,f,mtag,tag,v) \
|
||||
if ((a != NULL) && (sk_num(a) != 0))\
|
||||
{ \
|
||||
v=i2d_ASN1_SET(a,NULL,f,tag,V_ASN1_UNIVERSAL, \
|
||||
IS_SEQUENCE); \
|
||||
ret+=ASN1_object_size(1,v,mtag); \
|
||||
}
|
||||
|
||||
#define M_ASN1_I2D_len_EXP_SEQUENCE_opt_type(type,a,f,mtag,tag,v) \
|
||||
if ((a != NULL) && (sk_##type##_num(a) != 0))\
|
||||
{ \
|
||||
v=i2d_ASN1_SET_OF_##type(a,NULL,f,tag, \
|
||||
V_ASN1_UNIVERSAL, \
|
||||
IS_SEQUENCE); \
|
||||
ret+=ASN1_object_size(1,v,mtag); \
|
||||
}
|
||||
|
||||
/* Put Macros */
|
||||
#define M_ASN1_I2D_put(a,f) f(a,&p)
|
||||
|
||||
#define M_ASN1_I2D_put_IMP_opt(a,f,t) \
|
||||
if (a != NULL) \
|
||||
{ \
|
||||
unsigned char *q=p; \
|
||||
f(a,&p); \
|
||||
*q=(V_ASN1_CONTEXT_SPECIFIC|t|(*q&V_ASN1_CONSTRUCTED));\
|
||||
}
|
||||
|
||||
#define M_ASN1_I2D_put_SET(a,f) i2d_ASN1_SET(a,&p,f,V_ASN1_SET,\
|
||||
V_ASN1_UNIVERSAL,IS_SET)
|
||||
#define M_ASN1_I2D_put_SET_type(type,a,f) \
|
||||
i2d_ASN1_SET_OF_##type(a,&p,f,V_ASN1_SET,V_ASN1_UNIVERSAL,IS_SET)
|
||||
#define M_ASN1_I2D_put_IMP_SET(a,f,x) i2d_ASN1_SET(a,&p,f,x,\
|
||||
V_ASN1_CONTEXT_SPECIFIC,IS_SET)
|
||||
#define M_ASN1_I2D_put_IMP_SET_type(type,a,f,x) \
|
||||
i2d_ASN1_SET_OF_##type(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC,IS_SET)
|
||||
#define M_ASN1_I2D_put_IMP_SEQUENCE(a,f,x) i2d_ASN1_SET(a,&p,f,x,\
|
||||
V_ASN1_CONTEXT_SPECIFIC,IS_SEQUENCE)
|
||||
|
||||
#define M_ASN1_I2D_put_SEQUENCE(a,f) i2d_ASN1_SET(a,&p,f,V_ASN1_SEQUENCE,\
|
||||
V_ASN1_UNIVERSAL,IS_SEQUENCE)
|
||||
|
||||
#define M_ASN1_I2D_put_SEQUENCE_type(type,a,f) \
|
||||
i2d_ASN1_SET_OF_##type(a,&p,f,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL, \
|
||||
IS_SEQUENCE)
|
||||
|
||||
#define M_ASN1_I2D_put_SEQUENCE_opt(a,f) \
|
||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
||||
M_ASN1_I2D_put_SEQUENCE(a,f);
|
||||
|
||||
#define M_ASN1_I2D_put_IMP_SET_opt(a,f,x) \
|
||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
||||
{ i2d_ASN1_SET(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC, \
|
||||
IS_SET); }
|
||||
|
||||
#define M_ASN1_I2D_put_IMP_SET_opt_type(type,a,f,x) \
|
||||
if ((a != NULL) && (sk_##type##_num(a) != 0)) \
|
||||
{ i2d_ASN1_SET_OF_##type(a,&p,f,x, \
|
||||
V_ASN1_CONTEXT_SPECIFIC, \
|
||||
IS_SET); }
|
||||
|
||||
#define M_ASN1_I2D_put_IMP_SEQUENCE_opt(a,f,x) \
|
||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
||||
{ i2d_ASN1_SET(a,&p,f,x,V_ASN1_CONTEXT_SPECIFIC, \
|
||||
IS_SEQUENCE); }
|
||||
|
||||
#define M_ASN1_I2D_put_IMP_SEQUENCE_opt_type(type,a,f,x) \
|
||||
if ((a != NULL) && (sk_##type##_num(a) != 0)) \
|
||||
{ i2d_ASN1_SET_OF_##type(a,&p,f,x, \
|
||||
V_ASN1_CONTEXT_SPECIFIC, \
|
||||
IS_SEQUENCE); }
|
||||
|
||||
#define M_ASN1_I2D_put_EXP_opt(a,f,tag,v) \
|
||||
if (a != NULL) \
|
||||
{ \
|
||||
ASN1_put_object(&p,1,v,tag,V_ASN1_CONTEXT_SPECIFIC); \
|
||||
f(a,&p); \
|
||||
}
|
||||
|
||||
#define M_ASN1_I2D_put_EXP_SET_opt(a,f,mtag,tag,v) \
|
||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
||||
{ \
|
||||
ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \
|
||||
i2d_ASN1_SET(a,&p,f,tag,V_ASN1_UNIVERSAL,IS_SET); \
|
||||
}
|
||||
|
||||
#define M_ASN1_I2D_put_EXP_SEQUENCE_opt(a,f,mtag,tag,v) \
|
||||
if ((a != NULL) && (sk_num(a) != 0)) \
|
||||
{ \
|
||||
ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \
|
||||
i2d_ASN1_SET(a,&p,f,tag,V_ASN1_UNIVERSAL,IS_SEQUENCE); \
|
||||
}
|
||||
|
||||
#define M_ASN1_I2D_put_EXP_SEQUENCE_opt_type(type,a,f,mtag,tag,v) \
|
||||
if ((a != NULL) && (sk_##type##_num(a) != 0)) \
|
||||
{ \
|
||||
ASN1_put_object(&p,1,v,mtag,V_ASN1_CONTEXT_SPECIFIC); \
|
||||
i2d_ASN1_SET_OF_##type(a,&p,f,tag,V_ASN1_UNIVERSAL, \
|
||||
IS_SEQUENCE); \
|
||||
}
|
||||
|
||||
#define M_ASN1_I2D_seq_total() \
|
||||
r=ASN1_object_size(1,ret,V_ASN1_SEQUENCE); \
|
||||
if (pp == NULL) return(r); \
|
||||
p= *pp; \
|
||||
ASN1_put_object(&p,1,ret,V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL)
|
||||
|
||||
#define M_ASN1_I2D_INF_seq_start(tag,ctx) \
|
||||
*(p++)=(V_ASN1_CONSTRUCTED|(tag)|(ctx)); \
|
||||
*(p++)=0x80
|
||||
|
||||
#define M_ASN1_I2D_INF_seq_end() *(p++)=0x00; *(p++)=0x00
|
||||
|
||||
#define M_ASN1_I2D_finish() *pp=p; \
|
||||
return(r);
|
||||
|
||||
int asn1_GetSequence(ASN1_const_CTX *c, long *length);
|
||||
void asn1_add_error(const unsigned char *address,int offset);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#error "This file is obsolete; please update your software."
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
98
src/dep/include/openssl/async.h
Normal file
98
src/dep/include/openssl/async.h
Normal file
@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef HEADER_ASYNC_H
|
||||
# define HEADER_ASYNC_H
|
||||
|
||||
#if defined(_WIN32)
|
||||
# if defined(BASETYPES) || defined(_WINDEF_H)
|
||||
/* application has to include <windows.h> to use this */
|
||||
#define OSSL_ASYNC_FD HANDLE
|
||||
#define OSSL_BAD_ASYNC_FD INVALID_HANDLE_VALUE
|
||||
# endif
|
||||
#else
|
||||
#define OSSL_ASYNC_FD int
|
||||
#define OSSL_BAD_ASYNC_FD -1
|
||||
#endif
|
||||
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
typedef struct async_job_st ASYNC_JOB;
|
||||
typedef struct async_wait_ctx_st ASYNC_WAIT_CTX;
|
||||
|
||||
#define ASYNC_ERR 0
|
||||
#define ASYNC_NO_JOBS 1
|
||||
#define ASYNC_PAUSE 2
|
||||
#define ASYNC_FINISH 3
|
||||
|
||||
int ASYNC_init_thread(size_t max_size, size_t init_size);
|
||||
void ASYNC_cleanup_thread(void);
|
||||
|
||||
#ifdef OSSL_ASYNC_FD
|
||||
ASYNC_WAIT_CTX *ASYNC_WAIT_CTX_new(void);
|
||||
void ASYNC_WAIT_CTX_free(ASYNC_WAIT_CTX *ctx);
|
||||
int ASYNC_WAIT_CTX_set_wait_fd(ASYNC_WAIT_CTX *ctx, const void *key,
|
||||
OSSL_ASYNC_FD fd,
|
||||
void *custom_data,
|
||||
void (*cleanup)(ASYNC_WAIT_CTX *, const void *,
|
||||
OSSL_ASYNC_FD, void *));
|
||||
int ASYNC_WAIT_CTX_get_fd(ASYNC_WAIT_CTX *ctx, const void *key,
|
||||
OSSL_ASYNC_FD *fd, void **custom_data);
|
||||
int ASYNC_WAIT_CTX_get_all_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *fd,
|
||||
size_t *numfds);
|
||||
int ASYNC_WAIT_CTX_get_changed_fds(ASYNC_WAIT_CTX *ctx, OSSL_ASYNC_FD *addfd,
|
||||
size_t *numaddfds, OSSL_ASYNC_FD *delfd,
|
||||
size_t *numdelfds);
|
||||
int ASYNC_WAIT_CTX_clear_fd(ASYNC_WAIT_CTX *ctx, const void *key);
|
||||
#endif
|
||||
|
||||
int ASYNC_is_capable(void);
|
||||
|
||||
int ASYNC_start_job(ASYNC_JOB **job, ASYNC_WAIT_CTX *ctx, int *ret,
|
||||
int (*func)(void *), void *args, size_t size);
|
||||
int ASYNC_pause_job(void);
|
||||
|
||||
ASYNC_JOB *ASYNC_get_current_job(void);
|
||||
ASYNC_WAIT_CTX *ASYNC_get_wait_ctx(ASYNC_JOB *job);
|
||||
void ASYNC_block_pause(void);
|
||||
void ASYNC_unblock_pause(void);
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/*
|
||||
* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
|
||||
int ERR_load_ASYNC_strings(void);
|
||||
|
||||
/* Error codes for the ASYNC functions. */
|
||||
|
||||
/* Function codes. */
|
||||
# define ASYNC_F_ASYNC_CTX_NEW 100
|
||||
# define ASYNC_F_ASYNC_INIT_THREAD 101
|
||||
# define ASYNC_F_ASYNC_JOB_NEW 102
|
||||
# define ASYNC_F_ASYNC_PAUSE_JOB 103
|
||||
# define ASYNC_F_ASYNC_START_FUNC 104
|
||||
# define ASYNC_F_ASYNC_START_JOB 105
|
||||
|
||||
/* Reason codes. */
|
||||
# define ASYNC_R_FAILED_TO_SET_POOL 101
|
||||
# define ASYNC_R_FAILED_TO_SWAP_CONTEXT 102
|
||||
# define ASYNC_R_INIT_FAILED 105
|
||||
# define ASYNC_R_INVALID_POOL_SIZE 103
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,127 +1,61 @@
|
||||
/* crypto/bf/blowfish.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_BLOWFISH_H
|
||||
#define HEADER_BLOWFISH_H
|
||||
# define HEADER_BLOWFISH_H
|
||||
|
||||
#include <openssl/e_os2.h>
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifndef OPENSSL_NO_BF
|
||||
# include <openssl/e_os2.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#ifdef OPENSSL_NO_BF
|
||||
#error BF is disabled.
|
||||
#endif
|
||||
# define BF_ENCRYPT 1
|
||||
# define BF_DECRYPT 0
|
||||
|
||||
#define BF_ENCRYPT 1
|
||||
#define BF_DECRYPT 0
|
||||
|
||||
/*
|
||||
/*-
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
* ! BF_LONG has to be at least 32 bits wide. If it's wider, then !
|
||||
* ! BF_LONG_LOG2 has to be defined along. !
|
||||
* ! BF_LONG has to be at least 32 bits wide. !
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
*/
|
||||
# define BF_LONG unsigned int
|
||||
|
||||
#if defined(OPENSSL_SYS_WIN16) || defined(__LP32__)
|
||||
#define BF_LONG unsigned long
|
||||
#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)
|
||||
#define BF_LONG unsigned long
|
||||
#define BF_LONG_LOG2 3
|
||||
/*
|
||||
* _CRAY note. I could declare short, but I have no idea what impact
|
||||
* does it have on performance on none-T3E machines. I could declare
|
||||
* int, but at least on C90 sizeof(int) can be chosen at compile time.
|
||||
* So I've chosen long...
|
||||
* <appro@fy.chalmers.se>
|
||||
*/
|
||||
#else
|
||||
#define BF_LONG unsigned int
|
||||
#endif
|
||||
|
||||
#define BF_ROUNDS 16
|
||||
#define BF_BLOCK 8
|
||||
|
||||
typedef struct bf_key_st
|
||||
{
|
||||
BF_LONG P[BF_ROUNDS+2];
|
||||
BF_LONG S[4*256];
|
||||
} BF_KEY;
|
||||
# define BF_ROUNDS 16
|
||||
# define BF_BLOCK 8
|
||||
|
||||
typedef struct bf_key_st {
|
||||
BF_LONG P[BF_ROUNDS + 2];
|
||||
BF_LONG S[4 * 256];
|
||||
} BF_KEY;
|
||||
|
||||
void BF_set_key(BF_KEY *key, int len, const unsigned char *data);
|
||||
|
||||
void BF_encrypt(BF_LONG *data,const BF_KEY *key);
|
||||
void BF_decrypt(BF_LONG *data,const BF_KEY *key);
|
||||
void BF_encrypt(BF_LONG *data, const BF_KEY *key);
|
||||
void BF_decrypt(BF_LONG *data, const BF_KEY *key);
|
||||
|
||||
void BF_ecb_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const BF_KEY *key, int enc);
|
||||
const BF_KEY *key, int enc);
|
||||
void BF_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,
|
||||
const BF_KEY *schedule, unsigned char *ivec, int enc);
|
||||
void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out, long length,
|
||||
const BF_KEY *schedule, unsigned char *ivec, int *num, int enc);
|
||||
void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out, long length,
|
||||
const BF_KEY *schedule, unsigned char *ivec, int *num);
|
||||
const BF_KEY *schedule, unsigned char *ivec, int enc);
|
||||
void BF_cfb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, const BF_KEY *schedule,
|
||||
unsigned char *ivec, int *num, int enc);
|
||||
void BF_ofb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, const BF_KEY *schedule,
|
||||
unsigned char *ivec, int *num);
|
||||
const char *BF_options(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,118 +1,76 @@
|
||||
/* crypto/buffer/buffer.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_BUFFER_H
|
||||
#define HEADER_BUFFER_H
|
||||
# define HEADER_BUFFER_H
|
||||
|
||||
# include <openssl/ossl_typ.h>
|
||||
# ifndef HEADER_CRYPTO_H
|
||||
# include <openssl/crypto.h>
|
||||
# endif
|
||||
|
||||
#include <openssl/ossl_typ.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
# include <stddef.h>
|
||||
|
||||
#if !defined(NO_SYS_TYPES_H)
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
# if !defined(NO_SYS_TYPES_H)
|
||||
# include <sys/types.h>
|
||||
# endif
|
||||
|
||||
/* Already declared in ossl_typ.h */
|
||||
/* typedef struct buf_mem_st BUF_MEM; */
|
||||
/*
|
||||
* These names are outdated as of OpenSSL 1.1; a future release
|
||||
* will move them to be deprecated.
|
||||
*/
|
||||
# define BUF_strdup(s) OPENSSL_strdup(s)
|
||||
# define BUF_strndup(s, size) OPENSSL_strndup(s, size)
|
||||
# define BUF_memdup(data, size) OPENSSL_memdup(data, size)
|
||||
# define BUF_strlcpy(dst, src, size) OPENSSL_strlcpy(dst, src, size)
|
||||
# define BUF_strlcat(dst, src, size) OPENSSL_strlcat(dst, src, size)
|
||||
# define BUF_strnlen(str, maxlen) OPENSSL_strnlen(str, maxlen)
|
||||
|
||||
struct buf_mem_st
|
||||
{
|
||||
int length; /* current number of bytes */
|
||||
char *data;
|
||||
int max; /* size of buffer */
|
||||
};
|
||||
struct buf_mem_st {
|
||||
size_t length; /* current number of bytes */
|
||||
char *data;
|
||||
size_t max; /* size of buffer */
|
||||
unsigned long flags;
|
||||
};
|
||||
|
||||
# define BUF_MEM_FLAG_SECURE 0x01
|
||||
|
||||
BUF_MEM *BUF_MEM_new(void);
|
||||
void BUF_MEM_free(BUF_MEM *a);
|
||||
int BUF_MEM_grow(BUF_MEM *str, int len);
|
||||
int BUF_MEM_grow_clean(BUF_MEM *str, int len);
|
||||
char * BUF_strdup(const char *str);
|
||||
char * BUF_strndup(const char *str, size_t siz);
|
||||
void * BUF_memdup(const void *data, size_t siz);
|
||||
|
||||
/* safe string functions */
|
||||
size_t BUF_strlcpy(char *dst,const char *src,size_t siz);
|
||||
size_t BUF_strlcat(char *dst,const char *src,size_t siz);
|
||||
|
||||
BUF_MEM *BUF_MEM_new_ex(unsigned long flags);
|
||||
void BUF_MEM_free(BUF_MEM *a);
|
||||
size_t BUF_MEM_grow(BUF_MEM *str, size_t len);
|
||||
size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len);
|
||||
void BUF_reverse(unsigned char *out, const unsigned char *in, size_t siz);
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
/*
|
||||
* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
void ERR_load_BUF_strings(void);
|
||||
|
||||
int ERR_load_BUF_strings(void);
|
||||
|
||||
/* Error codes for the BUF functions. */
|
||||
|
||||
/* Function codes. */
|
||||
#define BUF_F_BUF_MEMDUP 103
|
||||
#define BUF_F_BUF_MEM_GROW 100
|
||||
#define BUF_F_BUF_MEM_GROW_CLEAN 105
|
||||
#define BUF_F_BUF_MEM_NEW 101
|
||||
#define BUF_F_BUF_STRDUP 102
|
||||
#define BUF_F_BUF_STRNDUP 104
|
||||
# define BUF_F_BUF_MEM_GROW 100
|
||||
# define BUF_F_BUF_MEM_GROW_CLEAN 105
|
||||
# define BUF_F_BUF_MEM_NEW 101
|
||||
|
||||
/* Reason codes. */
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
83
src/dep/include/openssl/camellia.h
Normal file
83
src/dep/include/openssl/camellia.h
Normal file
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CAMELLIA_H
|
||||
# define HEADER_CAMELLIA_H
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_CAMELLIA
|
||||
# include <stddef.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
# define CAMELLIA_ENCRYPT 1
|
||||
# define CAMELLIA_DECRYPT 0
|
||||
|
||||
/*
|
||||
* Because array size can't be a const in C, the following two are macros.
|
||||
* Both sizes are in bytes.
|
||||
*/
|
||||
|
||||
/* This should be a hidden type, but EVP requires that the size be known */
|
||||
|
||||
# define CAMELLIA_BLOCK_SIZE 16
|
||||
# define CAMELLIA_TABLE_BYTE_LEN 272
|
||||
# define CAMELLIA_TABLE_WORD_LEN (CAMELLIA_TABLE_BYTE_LEN / 4)
|
||||
|
||||
typedef unsigned int KEY_TABLE_TYPE[CAMELLIA_TABLE_WORD_LEN]; /* to match
|
||||
* with WORD */
|
||||
|
||||
struct camellia_key_st {
|
||||
union {
|
||||
double d; /* ensures 64-bit align */
|
||||
KEY_TABLE_TYPE rd_key;
|
||||
} u;
|
||||
int grand_rounds;
|
||||
};
|
||||
typedef struct camellia_key_st CAMELLIA_KEY;
|
||||
|
||||
int Camellia_set_key(const unsigned char *userKey, const int bits,
|
||||
CAMELLIA_KEY *key);
|
||||
|
||||
void Camellia_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const CAMELLIA_KEY *key);
|
||||
void Camellia_decrypt(const unsigned char *in, unsigned char *out,
|
||||
const CAMELLIA_KEY *key);
|
||||
|
||||
void Camellia_ecb_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const CAMELLIA_KEY *key, const int enc);
|
||||
void Camellia_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const CAMELLIA_KEY *key,
|
||||
unsigned char *ivec, const int enc);
|
||||
void Camellia_cfb128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const CAMELLIA_KEY *key,
|
||||
unsigned char *ivec, int *num, const int enc);
|
||||
void Camellia_cfb1_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const CAMELLIA_KEY *key,
|
||||
unsigned char *ivec, int *num, const int enc);
|
||||
void Camellia_cfb8_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const CAMELLIA_KEY *key,
|
||||
unsigned char *ivec, int *num, const int enc);
|
||||
void Camellia_ofb128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const CAMELLIA_KEY *key,
|
||||
unsigned char *ivec, int *num);
|
||||
void Camellia_ctr128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const CAMELLIA_KEY *key,
|
||||
unsigned char ivec[CAMELLIA_BLOCK_SIZE],
|
||||
unsigned char ecount_buf[CAMELLIA_BLOCK_SIZE],
|
||||
unsigned int *num);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
@ -1,105 +1,53 @@
|
||||
/* crypto/cast/cast.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CAST_H
|
||||
#define HEADER_CAST_H
|
||||
# define HEADER_CAST_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_CAST
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
# define CAST_ENCRYPT 1
|
||||
# define CAST_DECRYPT 0
|
||||
|
||||
#ifdef OPENSSL_NO_CAST
|
||||
#error CAST is disabled.
|
||||
#endif
|
||||
# define CAST_LONG unsigned int
|
||||
|
||||
#define CAST_ENCRYPT 1
|
||||
#define CAST_DECRYPT 0
|
||||
|
||||
#define CAST_LONG unsigned long
|
||||
|
||||
#define CAST_BLOCK 8
|
||||
#define CAST_KEY_LENGTH 16
|
||||
|
||||
typedef struct cast_key_st
|
||||
{
|
||||
CAST_LONG data[32];
|
||||
int short_key; /* Use reduced rounds for short key */
|
||||
} CAST_KEY;
|
||||
# define CAST_BLOCK 8
|
||||
# define CAST_KEY_LENGTH 16
|
||||
|
||||
typedef struct cast_key_st {
|
||||
CAST_LONG data[32];
|
||||
int short_key; /* Use reduced rounds for short key */
|
||||
} CAST_KEY;
|
||||
|
||||
void CAST_set_key(CAST_KEY *key, int len, const unsigned char *data);
|
||||
void CAST_ecb_encrypt(const unsigned char *in,unsigned char *out,CAST_KEY *key,
|
||||
int enc);
|
||||
void CAST_encrypt(CAST_LONG *data,CAST_KEY *key);
|
||||
void CAST_decrypt(CAST_LONG *data,CAST_KEY *key);
|
||||
void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,
|
||||
CAST_KEY *ks, unsigned char *iv, int enc);
|
||||
void CAST_ecb_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const CAST_KEY *key, int enc);
|
||||
void CAST_encrypt(CAST_LONG *data, const CAST_KEY *key);
|
||||
void CAST_decrypt(CAST_LONG *data, const CAST_KEY *key);
|
||||
void CAST_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, const CAST_KEY *ks, unsigned char *iv,
|
||||
int enc);
|
||||
void CAST_cfb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, CAST_KEY *schedule, unsigned char *ivec,
|
||||
int *num, int enc);
|
||||
long length, const CAST_KEY *schedule,
|
||||
unsigned char *ivec, int *num, int enc);
|
||||
void CAST_ofb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, CAST_KEY *schedule, unsigned char *ivec,
|
||||
int *num);
|
||||
long length, const CAST_KEY *schedule,
|
||||
unsigned char *ivec, int *num);
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
41
src/dep/include/openssl/cmac.h
Normal file
41
src/dep/include/openssl/cmac.h
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright 2010-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CMAC_H
|
||||
# define HEADER_CMAC_H
|
||||
|
||||
# ifndef OPENSSL_NO_CMAC
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
# include <openssl/evp.h>
|
||||
|
||||
/* Opaque */
|
||||
typedef struct CMAC_CTX_st CMAC_CTX;
|
||||
|
||||
CMAC_CTX *CMAC_CTX_new(void);
|
||||
void CMAC_CTX_cleanup(CMAC_CTX *ctx);
|
||||
void CMAC_CTX_free(CMAC_CTX *ctx);
|
||||
EVP_CIPHER_CTX *CMAC_CTX_get0_cipher_ctx(CMAC_CTX *ctx);
|
||||
int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in);
|
||||
|
||||
int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen,
|
||||
const EVP_CIPHER *cipher, ENGINE *impl);
|
||||
int CMAC_Update(CMAC_CTX *ctx, const void *data, size_t dlen);
|
||||
int CMAC_Final(CMAC_CTX *ctx, unsigned char *out, size_t *poutlen);
|
||||
int CMAC_resume(CMAC_CTX *ctx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
# endif
|
||||
#endif
|
||||
512
src/dep/include/openssl/cms.h
Normal file
512
src/dep/include/openssl/cms.h
Normal file
@ -0,0 +1,512 @@
|
||||
/*
|
||||
* Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CMS_H
|
||||
# define HEADER_CMS_H
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_CMS
|
||||
# include <openssl/x509.h>
|
||||
# include <openssl/x509v3.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
typedef struct CMS_ContentInfo_st CMS_ContentInfo;
|
||||
typedef struct CMS_SignerInfo_st CMS_SignerInfo;
|
||||
typedef struct CMS_CertificateChoices CMS_CertificateChoices;
|
||||
typedef struct CMS_RevocationInfoChoice_st CMS_RevocationInfoChoice;
|
||||
typedef struct CMS_RecipientInfo_st CMS_RecipientInfo;
|
||||
typedef struct CMS_ReceiptRequest_st CMS_ReceiptRequest;
|
||||
typedef struct CMS_Receipt_st CMS_Receipt;
|
||||
typedef struct CMS_RecipientEncryptedKey_st CMS_RecipientEncryptedKey;
|
||||
typedef struct CMS_OtherKeyAttribute_st CMS_OtherKeyAttribute;
|
||||
|
||||
DEFINE_STACK_OF(CMS_SignerInfo)
|
||||
DEFINE_STACK_OF(CMS_RecipientEncryptedKey)
|
||||
DEFINE_STACK_OF(CMS_RecipientInfo)
|
||||
DEFINE_STACK_OF(CMS_RevocationInfoChoice)
|
||||
DECLARE_ASN1_FUNCTIONS(CMS_ContentInfo)
|
||||
DECLARE_ASN1_FUNCTIONS(CMS_ReceiptRequest)
|
||||
DECLARE_ASN1_PRINT_FUNCTION(CMS_ContentInfo)
|
||||
|
||||
# define CMS_SIGNERINFO_ISSUER_SERIAL 0
|
||||
# define CMS_SIGNERINFO_KEYIDENTIFIER 1
|
||||
|
||||
# define CMS_RECIPINFO_NONE -1
|
||||
# define CMS_RECIPINFO_TRANS 0
|
||||
# define CMS_RECIPINFO_AGREE 1
|
||||
# define CMS_RECIPINFO_KEK 2
|
||||
# define CMS_RECIPINFO_PASS 3
|
||||
# define CMS_RECIPINFO_OTHER 4
|
||||
|
||||
/* S/MIME related flags */
|
||||
|
||||
# define CMS_TEXT 0x1
|
||||
# define CMS_NOCERTS 0x2
|
||||
# define CMS_NO_CONTENT_VERIFY 0x4
|
||||
# define CMS_NO_ATTR_VERIFY 0x8
|
||||
# define CMS_NOSIGS \
|
||||
(CMS_NO_CONTENT_VERIFY|CMS_NO_ATTR_VERIFY)
|
||||
# define CMS_NOINTERN 0x10
|
||||
# define CMS_NO_SIGNER_CERT_VERIFY 0x20
|
||||
# define CMS_NOVERIFY 0x20
|
||||
# define CMS_DETACHED 0x40
|
||||
# define CMS_BINARY 0x80
|
||||
# define CMS_NOATTR 0x100
|
||||
# define CMS_NOSMIMECAP 0x200
|
||||
# define CMS_NOOLDMIMETYPE 0x400
|
||||
# define CMS_CRLFEOL 0x800
|
||||
# define CMS_STREAM 0x1000
|
||||
# define CMS_NOCRL 0x2000
|
||||
# define CMS_PARTIAL 0x4000
|
||||
# define CMS_REUSE_DIGEST 0x8000
|
||||
# define CMS_USE_KEYID 0x10000
|
||||
# define CMS_DEBUG_DECRYPT 0x20000
|
||||
# define CMS_KEY_PARAM 0x40000
|
||||
# define CMS_ASCIICRLF 0x80000
|
||||
|
||||
const ASN1_OBJECT *CMS_get0_type(const CMS_ContentInfo *cms);
|
||||
|
||||
BIO *CMS_dataInit(CMS_ContentInfo *cms, BIO *icont);
|
||||
int CMS_dataFinal(CMS_ContentInfo *cms, BIO *bio);
|
||||
|
||||
ASN1_OCTET_STRING **CMS_get0_content(CMS_ContentInfo *cms);
|
||||
int CMS_is_detached(CMS_ContentInfo *cms);
|
||||
int CMS_set_detached(CMS_ContentInfo *cms, int detached);
|
||||
|
||||
# ifdef HEADER_PEM_H
|
||||
DECLARE_PEM_rw_const(CMS, CMS_ContentInfo)
|
||||
# endif
|
||||
int CMS_stream(unsigned char ***boundary, CMS_ContentInfo *cms);
|
||||
CMS_ContentInfo *d2i_CMS_bio(BIO *bp, CMS_ContentInfo **cms);
|
||||
int i2d_CMS_bio(BIO *bp, CMS_ContentInfo *cms);
|
||||
|
||||
BIO *BIO_new_CMS(BIO *out, CMS_ContentInfo *cms);
|
||||
int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *in, int flags);
|
||||
int PEM_write_bio_CMS_stream(BIO *out, CMS_ContentInfo *cms, BIO *in,
|
||||
int flags);
|
||||
CMS_ContentInfo *SMIME_read_CMS(BIO *bio, BIO **bcont);
|
||||
int SMIME_write_CMS(BIO *bio, CMS_ContentInfo *cms, BIO *data, int flags);
|
||||
|
||||
int CMS_final(CMS_ContentInfo *cms, BIO *data, BIO *dcont,
|
||||
unsigned int flags);
|
||||
|
||||
CMS_ContentInfo *CMS_sign(X509 *signcert, EVP_PKEY *pkey,
|
||||
STACK_OF(X509) *certs, BIO *data,
|
||||
unsigned int flags);
|
||||
|
||||
CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si,
|
||||
X509 *signcert, EVP_PKEY *pkey,
|
||||
STACK_OF(X509) *certs, unsigned int flags);
|
||||
|
||||
int CMS_data(CMS_ContentInfo *cms, BIO *out, unsigned int flags);
|
||||
CMS_ContentInfo *CMS_data_create(BIO *in, unsigned int flags);
|
||||
|
||||
int CMS_digest_verify(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
|
||||
unsigned int flags);
|
||||
CMS_ContentInfo *CMS_digest_create(BIO *in, const EVP_MD *md,
|
||||
unsigned int flags);
|
||||
|
||||
int CMS_EncryptedData_decrypt(CMS_ContentInfo *cms,
|
||||
const unsigned char *key, size_t keylen,
|
||||
BIO *dcont, BIO *out, unsigned int flags);
|
||||
|
||||
CMS_ContentInfo *CMS_EncryptedData_encrypt(BIO *in, const EVP_CIPHER *cipher,
|
||||
const unsigned char *key,
|
||||
size_t keylen, unsigned int flags);
|
||||
|
||||
int CMS_EncryptedData_set1_key(CMS_ContentInfo *cms, const EVP_CIPHER *ciph,
|
||||
const unsigned char *key, size_t keylen);
|
||||
|
||||
int CMS_verify(CMS_ContentInfo *cms, STACK_OF(X509) *certs,
|
||||
X509_STORE *store, BIO *dcont, BIO *out, unsigned int flags);
|
||||
|
||||
int CMS_verify_receipt(CMS_ContentInfo *rcms, CMS_ContentInfo *ocms,
|
||||
STACK_OF(X509) *certs,
|
||||
X509_STORE *store, unsigned int flags);
|
||||
|
||||
STACK_OF(X509) *CMS_get0_signers(CMS_ContentInfo *cms);
|
||||
|
||||
CMS_ContentInfo *CMS_encrypt(STACK_OF(X509) *certs, BIO *in,
|
||||
const EVP_CIPHER *cipher, unsigned int flags);
|
||||
|
||||
int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pkey, X509 *cert,
|
||||
BIO *dcont, BIO *out, unsigned int flags);
|
||||
|
||||
int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert);
|
||||
int CMS_decrypt_set1_key(CMS_ContentInfo *cms,
|
||||
unsigned char *key, size_t keylen,
|
||||
const unsigned char *id, size_t idlen);
|
||||
int CMS_decrypt_set1_password(CMS_ContentInfo *cms,
|
||||
unsigned char *pass, ossl_ssize_t passlen);
|
||||
|
||||
STACK_OF(CMS_RecipientInfo) *CMS_get0_RecipientInfos(CMS_ContentInfo *cms);
|
||||
int CMS_RecipientInfo_type(CMS_RecipientInfo *ri);
|
||||
EVP_PKEY_CTX *CMS_RecipientInfo_get0_pkey_ctx(CMS_RecipientInfo *ri);
|
||||
CMS_ContentInfo *CMS_EnvelopedData_create(const EVP_CIPHER *cipher);
|
||||
CMS_RecipientInfo *CMS_add1_recipient_cert(CMS_ContentInfo *cms,
|
||||
X509 *recip, unsigned int flags);
|
||||
int CMS_RecipientInfo_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pkey);
|
||||
int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert);
|
||||
int CMS_RecipientInfo_ktri_get0_algs(CMS_RecipientInfo *ri,
|
||||
EVP_PKEY **pk, X509 **recip,
|
||||
X509_ALGOR **palg);
|
||||
int CMS_RecipientInfo_ktri_get0_signer_id(CMS_RecipientInfo *ri,
|
||||
ASN1_OCTET_STRING **keyid,
|
||||
X509_NAME **issuer,
|
||||
ASN1_INTEGER **sno);
|
||||
|
||||
CMS_RecipientInfo *CMS_add0_recipient_key(CMS_ContentInfo *cms, int nid,
|
||||
unsigned char *key, size_t keylen,
|
||||
unsigned char *id, size_t idlen,
|
||||
ASN1_GENERALIZEDTIME *date,
|
||||
ASN1_OBJECT *otherTypeId,
|
||||
ASN1_TYPE *otherType);
|
||||
|
||||
int CMS_RecipientInfo_kekri_get0_id(CMS_RecipientInfo *ri,
|
||||
X509_ALGOR **palg,
|
||||
ASN1_OCTET_STRING **pid,
|
||||
ASN1_GENERALIZEDTIME **pdate,
|
||||
ASN1_OBJECT **potherid,
|
||||
ASN1_TYPE **pothertype);
|
||||
|
||||
int CMS_RecipientInfo_set0_key(CMS_RecipientInfo *ri,
|
||||
unsigned char *key, size_t keylen);
|
||||
|
||||
int CMS_RecipientInfo_kekri_id_cmp(CMS_RecipientInfo *ri,
|
||||
const unsigned char *id, size_t idlen);
|
||||
|
||||
int CMS_RecipientInfo_set0_password(CMS_RecipientInfo *ri,
|
||||
unsigned char *pass,
|
||||
ossl_ssize_t passlen);
|
||||
|
||||
CMS_RecipientInfo *CMS_add0_recipient_password(CMS_ContentInfo *cms,
|
||||
int iter, int wrap_nid,
|
||||
int pbe_nid,
|
||||
unsigned char *pass,
|
||||
ossl_ssize_t passlen,
|
||||
const EVP_CIPHER *kekciph);
|
||||
|
||||
int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri);
|
||||
int CMS_RecipientInfo_encrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri);
|
||||
|
||||
int CMS_uncompress(CMS_ContentInfo *cms, BIO *dcont, BIO *out,
|
||||
unsigned int flags);
|
||||
CMS_ContentInfo *CMS_compress(BIO *in, int comp_nid, unsigned int flags);
|
||||
|
||||
int CMS_set1_eContentType(CMS_ContentInfo *cms, const ASN1_OBJECT *oid);
|
||||
const ASN1_OBJECT *CMS_get0_eContentType(CMS_ContentInfo *cms);
|
||||
|
||||
CMS_CertificateChoices *CMS_add0_CertificateChoices(CMS_ContentInfo *cms);
|
||||
int CMS_add0_cert(CMS_ContentInfo *cms, X509 *cert);
|
||||
int CMS_add1_cert(CMS_ContentInfo *cms, X509 *cert);
|
||||
STACK_OF(X509) *CMS_get1_certs(CMS_ContentInfo *cms);
|
||||
|
||||
CMS_RevocationInfoChoice *CMS_add0_RevocationInfoChoice(CMS_ContentInfo *cms);
|
||||
int CMS_add0_crl(CMS_ContentInfo *cms, X509_CRL *crl);
|
||||
int CMS_add1_crl(CMS_ContentInfo *cms, X509_CRL *crl);
|
||||
STACK_OF(X509_CRL) *CMS_get1_crls(CMS_ContentInfo *cms);
|
||||
|
||||
int CMS_SignedData_init(CMS_ContentInfo *cms);
|
||||
CMS_SignerInfo *CMS_add1_signer(CMS_ContentInfo *cms,
|
||||
X509 *signer, EVP_PKEY *pk, const EVP_MD *md,
|
||||
unsigned int flags);
|
||||
EVP_PKEY_CTX *CMS_SignerInfo_get0_pkey_ctx(CMS_SignerInfo *si);
|
||||
EVP_MD_CTX *CMS_SignerInfo_get0_md_ctx(CMS_SignerInfo *si);
|
||||
STACK_OF(CMS_SignerInfo) *CMS_get0_SignerInfos(CMS_ContentInfo *cms);
|
||||
|
||||
void CMS_SignerInfo_set1_signer_cert(CMS_SignerInfo *si, X509 *signer);
|
||||
int CMS_SignerInfo_get0_signer_id(CMS_SignerInfo *si,
|
||||
ASN1_OCTET_STRING **keyid,
|
||||
X509_NAME **issuer, ASN1_INTEGER **sno);
|
||||
int CMS_SignerInfo_cert_cmp(CMS_SignerInfo *si, X509 *cert);
|
||||
int CMS_set1_signers_certs(CMS_ContentInfo *cms, STACK_OF(X509) *certs,
|
||||
unsigned int flags);
|
||||
void CMS_SignerInfo_get0_algs(CMS_SignerInfo *si, EVP_PKEY **pk,
|
||||
X509 **signer, X509_ALGOR **pdig,
|
||||
X509_ALGOR **psig);
|
||||
ASN1_OCTET_STRING *CMS_SignerInfo_get0_signature(CMS_SignerInfo *si);
|
||||
int CMS_SignerInfo_sign(CMS_SignerInfo *si);
|
||||
int CMS_SignerInfo_verify(CMS_SignerInfo *si);
|
||||
int CMS_SignerInfo_verify_content(CMS_SignerInfo *si, BIO *chain);
|
||||
|
||||
int CMS_add_smimecap(CMS_SignerInfo *si, STACK_OF(X509_ALGOR) *algs);
|
||||
int CMS_add_simple_smimecap(STACK_OF(X509_ALGOR) **algs,
|
||||
int algnid, int keysize);
|
||||
int CMS_add_standard_smimecap(STACK_OF(X509_ALGOR) **smcap);
|
||||
|
||||
int CMS_signed_get_attr_count(const CMS_SignerInfo *si);
|
||||
int CMS_signed_get_attr_by_NID(const CMS_SignerInfo *si, int nid,
|
||||
int lastpos);
|
||||
int CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si, const ASN1_OBJECT *obj,
|
||||
int lastpos);
|
||||
X509_ATTRIBUTE *CMS_signed_get_attr(const CMS_SignerInfo *si, int loc);
|
||||
X509_ATTRIBUTE *CMS_signed_delete_attr(CMS_SignerInfo *si, int loc);
|
||||
int CMS_signed_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr);
|
||||
int CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si,
|
||||
const ASN1_OBJECT *obj, int type,
|
||||
const void *bytes, int len);
|
||||
int CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si,
|
||||
int nid, int type,
|
||||
const void *bytes, int len);
|
||||
int CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si,
|
||||
const char *attrname, int type,
|
||||
const void *bytes, int len);
|
||||
void *CMS_signed_get0_data_by_OBJ(CMS_SignerInfo *si, const ASN1_OBJECT *oid,
|
||||
int lastpos, int type);
|
||||
|
||||
int CMS_unsigned_get_attr_count(const CMS_SignerInfo *si);
|
||||
int CMS_unsigned_get_attr_by_NID(const CMS_SignerInfo *si, int nid,
|
||||
int lastpos);
|
||||
int CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si,
|
||||
const ASN1_OBJECT *obj, int lastpos);
|
||||
X509_ATTRIBUTE *CMS_unsigned_get_attr(const CMS_SignerInfo *si, int loc);
|
||||
X509_ATTRIBUTE *CMS_unsigned_delete_attr(CMS_SignerInfo *si, int loc);
|
||||
int CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr);
|
||||
int CMS_unsigned_add1_attr_by_OBJ(CMS_SignerInfo *si,
|
||||
const ASN1_OBJECT *obj, int type,
|
||||
const void *bytes, int len);
|
||||
int CMS_unsigned_add1_attr_by_NID(CMS_SignerInfo *si,
|
||||
int nid, int type,
|
||||
const void *bytes, int len);
|
||||
int CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si,
|
||||
const char *attrname, int type,
|
||||
const void *bytes, int len);
|
||||
void *CMS_unsigned_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid,
|
||||
int lastpos, int type);
|
||||
|
||||
# ifdef HEADER_X509V3_H
|
||||
|
||||
int CMS_get1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest **prr);
|
||||
CMS_ReceiptRequest *CMS_ReceiptRequest_create0(unsigned char *id, int idlen,
|
||||
int allorfirst,
|
||||
STACK_OF(GENERAL_NAMES)
|
||||
*receiptList, STACK_OF(GENERAL_NAMES)
|
||||
*receiptsTo);
|
||||
int CMS_add1_ReceiptRequest(CMS_SignerInfo *si, CMS_ReceiptRequest *rr);
|
||||
void CMS_ReceiptRequest_get0_values(CMS_ReceiptRequest *rr,
|
||||
ASN1_STRING **pcid,
|
||||
int *pallorfirst,
|
||||
STACK_OF(GENERAL_NAMES) **plist,
|
||||
STACK_OF(GENERAL_NAMES) **prto);
|
||||
# endif
|
||||
int CMS_RecipientInfo_kari_get0_alg(CMS_RecipientInfo *ri,
|
||||
X509_ALGOR **palg,
|
||||
ASN1_OCTET_STRING **pukm);
|
||||
STACK_OF(CMS_RecipientEncryptedKey)
|
||||
*CMS_RecipientInfo_kari_get0_reks(CMS_RecipientInfo *ri);
|
||||
|
||||
int CMS_RecipientInfo_kari_get0_orig_id(CMS_RecipientInfo *ri,
|
||||
X509_ALGOR **pubalg,
|
||||
ASN1_BIT_STRING **pubkey,
|
||||
ASN1_OCTET_STRING **keyid,
|
||||
X509_NAME **issuer,
|
||||
ASN1_INTEGER **sno);
|
||||
|
||||
int CMS_RecipientInfo_kari_orig_id_cmp(CMS_RecipientInfo *ri, X509 *cert);
|
||||
|
||||
int CMS_RecipientEncryptedKey_get0_id(CMS_RecipientEncryptedKey *rek,
|
||||
ASN1_OCTET_STRING **keyid,
|
||||
ASN1_GENERALIZEDTIME **tm,
|
||||
CMS_OtherKeyAttribute **other,
|
||||
X509_NAME **issuer, ASN1_INTEGER **sno);
|
||||
int CMS_RecipientEncryptedKey_cert_cmp(CMS_RecipientEncryptedKey *rek,
|
||||
X509 *cert);
|
||||
int CMS_RecipientInfo_kari_set0_pkey(CMS_RecipientInfo *ri, EVP_PKEY *pk);
|
||||
EVP_CIPHER_CTX *CMS_RecipientInfo_kari_get0_ctx(CMS_RecipientInfo *ri);
|
||||
int CMS_RecipientInfo_kari_decrypt(CMS_ContentInfo *cms,
|
||||
CMS_RecipientInfo *ri,
|
||||
CMS_RecipientEncryptedKey *rek);
|
||||
|
||||
int CMS_SharedInfo_encode(unsigned char **pder, X509_ALGOR *kekalg,
|
||||
ASN1_OCTET_STRING *ukm, int keylen);
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/*
|
||||
* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
|
||||
int ERR_load_CMS_strings(void);
|
||||
|
||||
/* Error codes for the CMS functions. */
|
||||
|
||||
/* Function codes. */
|
||||
# define CMS_F_CHECK_CONTENT 99
|
||||
# define CMS_F_CMS_ADD0_CERT 164
|
||||
# define CMS_F_CMS_ADD0_RECIPIENT_KEY 100
|
||||
# define CMS_F_CMS_ADD0_RECIPIENT_PASSWORD 165
|
||||
# define CMS_F_CMS_ADD1_RECEIPTREQUEST 158
|
||||
# define CMS_F_CMS_ADD1_RECIPIENT_CERT 101
|
||||
# define CMS_F_CMS_ADD1_SIGNER 102
|
||||
# define CMS_F_CMS_ADD1_SIGNINGTIME 103
|
||||
# define CMS_F_CMS_COMPRESS 104
|
||||
# define CMS_F_CMS_COMPRESSEDDATA_CREATE 105
|
||||
# define CMS_F_CMS_COMPRESSEDDATA_INIT_BIO 106
|
||||
# define CMS_F_CMS_COPY_CONTENT 107
|
||||
# define CMS_F_CMS_COPY_MESSAGEDIGEST 108
|
||||
# define CMS_F_CMS_DATA 109
|
||||
# define CMS_F_CMS_DATAFINAL 110
|
||||
# define CMS_F_CMS_DATAINIT 111
|
||||
# define CMS_F_CMS_DECRYPT 112
|
||||
# define CMS_F_CMS_DECRYPT_SET1_KEY 113
|
||||
# define CMS_F_CMS_DECRYPT_SET1_PASSWORD 166
|
||||
# define CMS_F_CMS_DECRYPT_SET1_PKEY 114
|
||||
# define CMS_F_CMS_DIGESTALGORITHM_FIND_CTX 115
|
||||
# define CMS_F_CMS_DIGESTALGORITHM_INIT_BIO 116
|
||||
# define CMS_F_CMS_DIGESTEDDATA_DO_FINAL 117
|
||||
# define CMS_F_CMS_DIGEST_VERIFY 118
|
||||
# define CMS_F_CMS_ENCODE_RECEIPT 161
|
||||
# define CMS_F_CMS_ENCRYPT 119
|
||||
# define CMS_F_CMS_ENCRYPTEDCONTENT_INIT_BIO 120
|
||||
# define CMS_F_CMS_ENCRYPTEDDATA_DECRYPT 121
|
||||
# define CMS_F_CMS_ENCRYPTEDDATA_ENCRYPT 122
|
||||
# define CMS_F_CMS_ENCRYPTEDDATA_SET1_KEY 123
|
||||
# define CMS_F_CMS_ENVELOPEDDATA_CREATE 124
|
||||
# define CMS_F_CMS_ENVELOPEDDATA_INIT_BIO 125
|
||||
# define CMS_F_CMS_ENVELOPED_DATA_INIT 126
|
||||
# define CMS_F_CMS_ENV_ASN1_CTRL 171
|
||||
# define CMS_F_CMS_FINAL 127
|
||||
# define CMS_F_CMS_GET0_CERTIFICATE_CHOICES 128
|
||||
# define CMS_F_CMS_GET0_CONTENT 129
|
||||
# define CMS_F_CMS_GET0_ECONTENT_TYPE 130
|
||||
# define CMS_F_CMS_GET0_ENVELOPED 131
|
||||
# define CMS_F_CMS_GET0_REVOCATION_CHOICES 132
|
||||
# define CMS_F_CMS_GET0_SIGNED 133
|
||||
# define CMS_F_CMS_MSGSIGDIGEST_ADD1 162
|
||||
# define CMS_F_CMS_RECEIPTREQUEST_CREATE0 159
|
||||
# define CMS_F_CMS_RECEIPT_VERIFY 160
|
||||
# define CMS_F_CMS_RECIPIENTINFO_DECRYPT 134
|
||||
# define CMS_F_CMS_RECIPIENTINFO_ENCRYPT 169
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KARI_ENCRYPT 178
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_ALG 175
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_ORIG_ID 173
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KARI_GET0_REKS 172
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KARI_ORIG_ID_CMP 174
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KEKRI_DECRYPT 135
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KEKRI_ENCRYPT 136
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KEKRI_GET0_ID 137
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KEKRI_ID_CMP 138
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KTRI_CERT_CMP 139
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KTRI_DECRYPT 140
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KTRI_ENCRYPT 141
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_ALGS 142
|
||||
# define CMS_F_CMS_RECIPIENTINFO_KTRI_GET0_SIGNER_ID 143
|
||||
# define CMS_F_CMS_RECIPIENTINFO_PWRI_CRYPT 167
|
||||
# define CMS_F_CMS_RECIPIENTINFO_SET0_KEY 144
|
||||
# define CMS_F_CMS_RECIPIENTINFO_SET0_PASSWORD 168
|
||||
# define CMS_F_CMS_RECIPIENTINFO_SET0_PKEY 145
|
||||
# define CMS_F_CMS_SD_ASN1_CTRL 170
|
||||
# define CMS_F_CMS_SET1_IAS 176
|
||||
# define CMS_F_CMS_SET1_KEYID 177
|
||||
# define CMS_F_CMS_SET1_SIGNERIDENTIFIER 146
|
||||
# define CMS_F_CMS_SET_DETACHED 147
|
||||
# define CMS_F_CMS_SIGN 148
|
||||
# define CMS_F_CMS_SIGNED_DATA_INIT 149
|
||||
# define CMS_F_CMS_SIGNERINFO_CONTENT_SIGN 150
|
||||
# define CMS_F_CMS_SIGNERINFO_SIGN 151
|
||||
# define CMS_F_CMS_SIGNERINFO_VERIFY 152
|
||||
# define CMS_F_CMS_SIGNERINFO_VERIFY_CERT 153
|
||||
# define CMS_F_CMS_SIGNERINFO_VERIFY_CONTENT 154
|
||||
# define CMS_F_CMS_SIGN_RECEIPT 163
|
||||
# define CMS_F_CMS_STREAM 155
|
||||
# define CMS_F_CMS_UNCOMPRESS 156
|
||||
# define CMS_F_CMS_VERIFY 157
|
||||
|
||||
/* Reason codes. */
|
||||
# define CMS_R_ADD_SIGNER_ERROR 99
|
||||
# define CMS_R_CERTIFICATE_ALREADY_PRESENT 175
|
||||
# define CMS_R_CERTIFICATE_HAS_NO_KEYID 160
|
||||
# define CMS_R_CERTIFICATE_VERIFY_ERROR 100
|
||||
# define CMS_R_CIPHER_INITIALISATION_ERROR 101
|
||||
# define CMS_R_CIPHER_PARAMETER_INITIALISATION_ERROR 102
|
||||
# define CMS_R_CMS_DATAFINAL_ERROR 103
|
||||
# define CMS_R_CMS_LIB 104
|
||||
# define CMS_R_CONTENTIDENTIFIER_MISMATCH 170
|
||||
# define CMS_R_CONTENT_NOT_FOUND 105
|
||||
# define CMS_R_CONTENT_TYPE_MISMATCH 171
|
||||
# define CMS_R_CONTENT_TYPE_NOT_COMPRESSED_DATA 106
|
||||
# define CMS_R_CONTENT_TYPE_NOT_ENVELOPED_DATA 107
|
||||
# define CMS_R_CONTENT_TYPE_NOT_SIGNED_DATA 108
|
||||
# define CMS_R_CONTENT_VERIFY_ERROR 109
|
||||
# define CMS_R_CTRL_ERROR 110
|
||||
# define CMS_R_CTRL_FAILURE 111
|
||||
# define CMS_R_DECRYPT_ERROR 112
|
||||
# define CMS_R_ERROR_GETTING_PUBLIC_KEY 113
|
||||
# define CMS_R_ERROR_READING_MESSAGEDIGEST_ATTRIBUTE 114
|
||||
# define CMS_R_ERROR_SETTING_KEY 115
|
||||
# define CMS_R_ERROR_SETTING_RECIPIENTINFO 116
|
||||
# define CMS_R_INVALID_ENCRYPTED_KEY_LENGTH 117
|
||||
# define CMS_R_INVALID_KEY_ENCRYPTION_PARAMETER 176
|
||||
# define CMS_R_INVALID_KEY_LENGTH 118
|
||||
# define CMS_R_MD_BIO_INIT_ERROR 119
|
||||
# define CMS_R_MESSAGEDIGEST_ATTRIBUTE_WRONG_LENGTH 120
|
||||
# define CMS_R_MESSAGEDIGEST_WRONG_LENGTH 121
|
||||
# define CMS_R_MSGSIGDIGEST_ERROR 172
|
||||
# define CMS_R_MSGSIGDIGEST_VERIFICATION_FAILURE 162
|
||||
# define CMS_R_MSGSIGDIGEST_WRONG_LENGTH 163
|
||||
# define CMS_R_NEED_ONE_SIGNER 164
|
||||
# define CMS_R_NOT_A_SIGNED_RECEIPT 165
|
||||
# define CMS_R_NOT_ENCRYPTED_DATA 122
|
||||
# define CMS_R_NOT_KEK 123
|
||||
# define CMS_R_NOT_KEY_AGREEMENT 181
|
||||
# define CMS_R_NOT_KEY_TRANSPORT 124
|
||||
# define CMS_R_NOT_PWRI 177
|
||||
# define CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 125
|
||||
# define CMS_R_NO_CIPHER 126
|
||||
# define CMS_R_NO_CONTENT 127
|
||||
# define CMS_R_NO_CONTENT_TYPE 173
|
||||
# define CMS_R_NO_DEFAULT_DIGEST 128
|
||||
# define CMS_R_NO_DIGEST_SET 129
|
||||
# define CMS_R_NO_KEY 130
|
||||
# define CMS_R_NO_KEY_OR_CERT 174
|
||||
# define CMS_R_NO_MATCHING_DIGEST 131
|
||||
# define CMS_R_NO_MATCHING_RECIPIENT 132
|
||||
# define CMS_R_NO_MATCHING_SIGNATURE 166
|
||||
# define CMS_R_NO_MSGSIGDIGEST 167
|
||||
# define CMS_R_NO_PASSWORD 178
|
||||
# define CMS_R_NO_PRIVATE_KEY 133
|
||||
# define CMS_R_NO_PUBLIC_KEY 134
|
||||
# define CMS_R_NO_RECEIPT_REQUEST 168
|
||||
# define CMS_R_NO_SIGNERS 135
|
||||
# define CMS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 136
|
||||
# define CMS_R_RECEIPT_DECODE_ERROR 169
|
||||
# define CMS_R_RECIPIENT_ERROR 137
|
||||
# define CMS_R_SIGNER_CERTIFICATE_NOT_FOUND 138
|
||||
# define CMS_R_SIGNFINAL_ERROR 139
|
||||
# define CMS_R_SMIME_TEXT_ERROR 140
|
||||
# define CMS_R_STORE_INIT_ERROR 141
|
||||
# define CMS_R_TYPE_NOT_COMPRESSED_DATA 142
|
||||
# define CMS_R_TYPE_NOT_DATA 143
|
||||
# define CMS_R_TYPE_NOT_DIGESTED_DATA 144
|
||||
# define CMS_R_TYPE_NOT_ENCRYPTED_DATA 145
|
||||
# define CMS_R_TYPE_NOT_ENVELOPED_DATA 146
|
||||
# define CMS_R_UNABLE_TO_FINALIZE_CONTEXT 147
|
||||
# define CMS_R_UNKNOWN_CIPHER 148
|
||||
# define CMS_R_UNKNOWN_DIGEST_ALGORIHM 149
|
||||
# define CMS_R_UNKNOWN_ID 150
|
||||
# define CMS_R_UNSUPPORTED_COMPRESSION_ALGORITHM 151
|
||||
# define CMS_R_UNSUPPORTED_CONTENT_TYPE 152
|
||||
# define CMS_R_UNSUPPORTED_KEK_ALGORITHM 153
|
||||
# define CMS_R_UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM 179
|
||||
# define CMS_R_UNSUPPORTED_RECIPIENT_TYPE 154
|
||||
# define CMS_R_UNSUPPORTED_RECPIENTINFO_TYPE 155
|
||||
# define CMS_R_UNSUPPORTED_TYPE 156
|
||||
# define CMS_R_UNWRAP_ERROR 157
|
||||
# define CMS_R_UNWRAP_FAILURE 180
|
||||
# define CMS_R_VERIFICATION_FAILURE 158
|
||||
# define CMS_R_WRAP_ERROR 159
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
@ -1,66 +1,72 @@
|
||||
/*
|
||||
* Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_COMP_H
|
||||
#define HEADER_COMP_H
|
||||
# define HEADER_COMP_H
|
||||
|
||||
#include <openssl/crypto.h>
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifndef OPENSSL_NO_COMP
|
||||
# include <openssl/crypto.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
# endif
|
||||
|
||||
typedef struct comp_ctx_st COMP_CTX;
|
||||
|
||||
typedef struct comp_method_st
|
||||
{
|
||||
int type; /* NID for compression library */
|
||||
const char *name; /* A text string to identify the library */
|
||||
int (*init)(COMP_CTX *ctx);
|
||||
void (*finish)(COMP_CTX *ctx);
|
||||
int (*compress)(COMP_CTX *ctx,
|
||||
unsigned char *out, unsigned int olen,
|
||||
unsigned char *in, unsigned int ilen);
|
||||
int (*expand)(COMP_CTX *ctx,
|
||||
unsigned char *out, unsigned int olen,
|
||||
unsigned char *in, unsigned int ilen);
|
||||
/* The following two do NOTHING, but are kept for backward compatibility */
|
||||
long (*ctrl)(void);
|
||||
long (*callback_ctrl)(void);
|
||||
} COMP_METHOD;
|
||||
|
||||
struct comp_ctx_st
|
||||
{
|
||||
COMP_METHOD *meth;
|
||||
unsigned long compress_in;
|
||||
unsigned long compress_out;
|
||||
unsigned long expand_in;
|
||||
unsigned long expand_out;
|
||||
|
||||
CRYPTO_EX_DATA ex_data;
|
||||
};
|
||||
|
||||
|
||||
COMP_CTX *COMP_CTX_new(COMP_METHOD *meth);
|
||||
const COMP_METHOD *COMP_CTX_get_method(const COMP_CTX *ctx);
|
||||
int COMP_CTX_get_type(const COMP_CTX* comp);
|
||||
int COMP_get_type(const COMP_METHOD *meth);
|
||||
const char *COMP_get_name(const COMP_METHOD *meth);
|
||||
void COMP_CTX_free(COMP_CTX *ctx);
|
||||
|
||||
int COMP_compress_block(COMP_CTX *ctx, unsigned char *out, int olen,
|
||||
unsigned char *in, int ilen);
|
||||
unsigned char *in, int ilen);
|
||||
int COMP_expand_block(COMP_CTX *ctx, unsigned char *out, int olen,
|
||||
unsigned char *in, int ilen);
|
||||
COMP_METHOD *COMP_rle(void );
|
||||
COMP_METHOD *COMP_zlib(void );
|
||||
unsigned char *in, int ilen);
|
||||
|
||||
COMP_METHOD *COMP_zlib(void);
|
||||
|
||||
#if OPENSSL_API_COMPAT < 0x10100000L
|
||||
#define COMP_zlib_cleanup() while(0) continue
|
||||
#endif
|
||||
|
||||
# ifdef HEADER_BIO_H
|
||||
# ifdef ZLIB
|
||||
const BIO_METHOD *BIO_f_zlib(void);
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
/*
|
||||
* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
void ERR_load_COMP_strings(void);
|
||||
|
||||
int ERR_load_COMP_strings(void);
|
||||
|
||||
/* Error codes for the COMP functions. */
|
||||
|
||||
/* Function codes. */
|
||||
# define COMP_F_BIO_ZLIB_FLUSH 99
|
||||
# define COMP_F_BIO_ZLIB_NEW 100
|
||||
# define COMP_F_BIO_ZLIB_READ 101
|
||||
# define COMP_F_BIO_ZLIB_WRITE 102
|
||||
|
||||
/* Reason codes. */
|
||||
# define COMP_R_ZLIB_DEFLATE_ERROR 99
|
||||
# define COMP_R_ZLIB_INFLATE_ERROR 100
|
||||
# define COMP_R_ZLIB_NOT_SUPPORTED 101
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@ -1,186 +1,148 @@
|
||||
/* crypto/conf/conf.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CONF_H
|
||||
#define HEADER_CONF_H
|
||||
# define HEADER_CONF_H
|
||||
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/lhash.h>
|
||||
#include <openssl/stack.h>
|
||||
#include <openssl/safestack.h>
|
||||
#include <openssl/e_os2.h>
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/lhash.h>
|
||||
# include <openssl/stack.h>
|
||||
# include <openssl/safestack.h>
|
||||
# include <openssl/e_os2.h>
|
||||
|
||||
#include <openssl/ossl_typ.h>
|
||||
# include <openssl/ossl_typ.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char *section;
|
||||
char *name;
|
||||
char *value;
|
||||
} CONF_VALUE;
|
||||
typedef struct {
|
||||
char *section;
|
||||
char *name;
|
||||
char *value;
|
||||
} CONF_VALUE;
|
||||
|
||||
DECLARE_STACK_OF(CONF_VALUE)
|
||||
DECLARE_STACK_OF(CONF_MODULE)
|
||||
DECLARE_STACK_OF(CONF_IMODULE)
|
||||
DEFINE_STACK_OF(CONF_VALUE)
|
||||
DEFINE_LHASH_OF(CONF_VALUE);
|
||||
|
||||
struct conf_st;
|
||||
struct conf_method_st;
|
||||
typedef struct conf_method_st CONF_METHOD;
|
||||
|
||||
struct conf_method_st
|
||||
{
|
||||
const char *name;
|
||||
CONF *(*create)(CONF_METHOD *meth);
|
||||
int (*init)(CONF *conf);
|
||||
int (*destroy)(CONF *conf);
|
||||
int (*destroy_data)(CONF *conf);
|
||||
int (*load_bio)(CONF *conf, BIO *bp, long *eline);
|
||||
int (*dump)(const CONF *conf, BIO *bp);
|
||||
int (*is_number)(const CONF *conf, char c);
|
||||
int (*to_int)(const CONF *conf, char c);
|
||||
int (*load)(CONF *conf, const char *name, long *eline);
|
||||
};
|
||||
struct conf_method_st {
|
||||
const char *name;
|
||||
CONF *(*create) (CONF_METHOD *meth);
|
||||
int (*init) (CONF *conf);
|
||||
int (*destroy) (CONF *conf);
|
||||
int (*destroy_data) (CONF *conf);
|
||||
int (*load_bio) (CONF *conf, BIO *bp, long *eline);
|
||||
int (*dump) (const CONF *conf, BIO *bp);
|
||||
int (*is_number) (const CONF *conf, char c);
|
||||
int (*to_int) (const CONF *conf, char c);
|
||||
int (*load) (CONF *conf, const char *name, long *eline);
|
||||
};
|
||||
|
||||
/* Module definitions */
|
||||
|
||||
typedef struct conf_imodule_st CONF_IMODULE;
|
||||
typedef struct conf_module_st CONF_MODULE;
|
||||
|
||||
/* DSO module function typedefs */
|
||||
typedef int conf_init_func(CONF_IMODULE *md, const CONF *cnf);
|
||||
typedef void conf_finish_func(CONF_IMODULE *md);
|
||||
DEFINE_STACK_OF(CONF_MODULE)
|
||||
DEFINE_STACK_OF(CONF_IMODULE)
|
||||
|
||||
#define CONF_MFLAGS_IGNORE_ERRORS 0x1
|
||||
#define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2
|
||||
#define CONF_MFLAGS_SILENT 0x4
|
||||
#define CONF_MFLAGS_NO_DSO 0x8
|
||||
#define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10
|
||||
/* DSO module function typedefs */
|
||||
typedef int conf_init_func (CONF_IMODULE *md, const CONF *cnf);
|
||||
typedef void conf_finish_func (CONF_IMODULE *md);
|
||||
|
||||
# define CONF_MFLAGS_IGNORE_ERRORS 0x1
|
||||
# define CONF_MFLAGS_IGNORE_RETURN_CODES 0x2
|
||||
# define CONF_MFLAGS_SILENT 0x4
|
||||
# define CONF_MFLAGS_NO_DSO 0x8
|
||||
# define CONF_MFLAGS_IGNORE_MISSING_FILE 0x10
|
||||
# define CONF_MFLAGS_DEFAULT_SECTION 0x20
|
||||
|
||||
int CONF_set_default_method(CONF_METHOD *meth);
|
||||
void CONF_set_nconf(CONF *conf,LHASH *hash);
|
||||
LHASH *CONF_load(LHASH *conf,const char *file,long *eline);
|
||||
#ifndef OPENSSL_NO_FP_API
|
||||
LHASH *CONF_load_fp(LHASH *conf, FILE *fp,long *eline);
|
||||
void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash);
|
||||
LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file,
|
||||
long *eline);
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp,
|
||||
long *eline);
|
||||
# endif
|
||||
LHASH_OF(CONF_VALUE) *CONF_load_bio(LHASH_OF(CONF_VALUE) *conf, BIO *bp,
|
||||
long *eline);
|
||||
STACK_OF(CONF_VALUE) *CONF_get_section(LHASH_OF(CONF_VALUE) *conf,
|
||||
const char *section);
|
||||
char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group,
|
||||
const char *name);
|
||||
long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group,
|
||||
const char *name);
|
||||
void CONF_free(LHASH_OF(CONF_VALUE) *conf);
|
||||
#ifndef OPENSSL_NO_STDIO
|
||||
int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out);
|
||||
#endif
|
||||
LHASH *CONF_load_bio(LHASH *conf, BIO *bp,long *eline);
|
||||
STACK_OF(CONF_VALUE) *CONF_get_section(LHASH *conf,const char *section);
|
||||
char *CONF_get_string(LHASH *conf,const char *group,const char *name);
|
||||
long CONF_get_number(LHASH *conf,const char *group,const char *name);
|
||||
void CONF_free(LHASH *conf);
|
||||
int CONF_dump_fp(LHASH *conf, FILE *out);
|
||||
int CONF_dump_bio(LHASH *conf, BIO *out);
|
||||
int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out);
|
||||
|
||||
void OPENSSL_config(const char *config_name);
|
||||
void OPENSSL_no_config(void);
|
||||
DEPRECATEDIN_1_1_0(void OPENSSL_config(const char *config_name))
|
||||
|
||||
/* New conf code. The semantics are different from the functions above.
|
||||
If that wasn't the case, the above functions would have been replaced */
|
||||
#if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# define OPENSSL_no_config() \
|
||||
OPENSSL_init_crypto(OPENSSL_INIT_NO_LOAD_CONFIG, NULL)
|
||||
#endif
|
||||
|
||||
struct conf_st
|
||||
{
|
||||
CONF_METHOD *meth;
|
||||
void *meth_data;
|
||||
LHASH *data;
|
||||
};
|
||||
/*
|
||||
* New conf code. The semantics are different from the functions above. If
|
||||
* that wasn't the case, the above functions would have been replaced
|
||||
*/
|
||||
|
||||
struct conf_st {
|
||||
CONF_METHOD *meth;
|
||||
void *meth_data;
|
||||
LHASH_OF(CONF_VALUE) *data;
|
||||
};
|
||||
|
||||
CONF *NCONF_new(CONF_METHOD *meth);
|
||||
CONF_METHOD *NCONF_default(void);
|
||||
CONF_METHOD *NCONF_WIN32(void);
|
||||
#if 0 /* Just to give you an idea of what I have in mind */
|
||||
CONF_METHOD *NCONF_XML(void);
|
||||
#endif
|
||||
void NCONF_free(CONF *conf);
|
||||
void NCONF_free_data(CONF *conf);
|
||||
|
||||
int NCONF_load(CONF *conf,const char *file,long *eline);
|
||||
#ifndef OPENSSL_NO_FP_API
|
||||
int NCONF_load_fp(CONF *conf, FILE *fp,long *eline);
|
||||
#endif
|
||||
int NCONF_load_bio(CONF *conf, BIO *bp,long *eline);
|
||||
STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,const char *section);
|
||||
char *NCONF_get_string(const CONF *conf,const char *group,const char *name);
|
||||
int NCONF_get_number_e(const CONF *conf,const char *group,const char *name,
|
||||
long *result);
|
||||
int NCONF_load(CONF *conf, const char *file, long *eline);
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
int NCONF_load_fp(CONF *conf, FILE *fp, long *eline);
|
||||
# endif
|
||||
int NCONF_load_bio(CONF *conf, BIO *bp, long *eline);
|
||||
STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,
|
||||
const char *section);
|
||||
char *NCONF_get_string(const CONF *conf, const char *group, const char *name);
|
||||
int NCONF_get_number_e(const CONF *conf, const char *group, const char *name,
|
||||
long *result);
|
||||
#ifndef OPENSSL_NO_STDIO
|
||||
int NCONF_dump_fp(const CONF *conf, FILE *out);
|
||||
#endif
|
||||
int NCONF_dump_bio(const CONF *conf, BIO *out);
|
||||
|
||||
#if 0 /* The following function has no error checking,
|
||||
and should therefore be avoided */
|
||||
long NCONF_get_number(CONF *conf,char *group,char *name);
|
||||
#else
|
||||
#define NCONF_get_number(c,g,n,r) NCONF_get_number_e(c,g,n,r)
|
||||
#endif
|
||||
|
||||
/* Module functions */
|
||||
|
||||
int CONF_modules_load(const CONF *cnf, const char *appname,
|
||||
unsigned long flags);
|
||||
unsigned long flags);
|
||||
int CONF_modules_load_file(const char *filename, const char *appname,
|
||||
unsigned long flags);
|
||||
unsigned long flags);
|
||||
void CONF_modules_unload(int all);
|
||||
void CONF_modules_finish(void);
|
||||
void CONF_modules_free(void);
|
||||
#if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# define CONF_modules_free() while(0) continue
|
||||
#endif
|
||||
int CONF_module_add(const char *name, conf_init_func *ifunc,
|
||||
conf_finish_func *ffunc);
|
||||
conf_finish_func *ffunc);
|
||||
|
||||
const char *CONF_imodule_get_name(const CONF_IMODULE *md);
|
||||
const char *CONF_imodule_get_value(const CONF_IMODULE *md);
|
||||
@ -195,59 +157,61 @@ void CONF_module_set_usr_data(CONF_MODULE *pmod, void *usr_data);
|
||||
char *CONF_get1_default_config_file(void);
|
||||
|
||||
int CONF_parse_list(const char *list, int sep, int nospc,
|
||||
int (*list_cb)(const char *elem, int len, void *usr), void *arg);
|
||||
int (*list_cb) (const char *elem, int len, void *usr),
|
||||
void *arg);
|
||||
|
||||
void OPENSSL_load_builtin_modules(void);
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
/*
|
||||
* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
void ERR_load_CONF_strings(void);
|
||||
|
||||
int ERR_load_CONF_strings(void);
|
||||
|
||||
/* Error codes for the CONF functions. */
|
||||
|
||||
/* Function codes. */
|
||||
#define CONF_F_CONF_DUMP_FP 104
|
||||
#define CONF_F_CONF_LOAD 100
|
||||
#define CONF_F_CONF_LOAD_BIO 102
|
||||
#define CONF_F_CONF_LOAD_FP 103
|
||||
#define CONF_F_CONF_MODULES_LOAD 116
|
||||
#define CONF_F_DEF_LOAD 120
|
||||
#define CONF_F_DEF_LOAD_BIO 121
|
||||
#define CONF_F_MODULE_INIT 115
|
||||
#define CONF_F_MODULE_LOAD_DSO 117
|
||||
#define CONF_F_MODULE_RUN 118
|
||||
#define CONF_F_NCONF_DUMP_BIO 105
|
||||
#define CONF_F_NCONF_DUMP_FP 106
|
||||
#define CONF_F_NCONF_GET_NUMBER 107
|
||||
#define CONF_F_NCONF_GET_NUMBER_E 112
|
||||
#define CONF_F_NCONF_GET_SECTION 108
|
||||
#define CONF_F_NCONF_GET_STRING 109
|
||||
#define CONF_F_NCONF_LOAD 113
|
||||
#define CONF_F_NCONF_LOAD_BIO 110
|
||||
#define CONF_F_NCONF_LOAD_FP 114
|
||||
#define CONF_F_NCONF_NEW 111
|
||||
#define CONF_F_STR_COPY 101
|
||||
# define CONF_F_CONF_DUMP_FP 104
|
||||
# define CONF_F_CONF_LOAD 100
|
||||
# define CONF_F_CONF_LOAD_FP 103
|
||||
# define CONF_F_CONF_PARSE_LIST 119
|
||||
# define CONF_F_DEF_LOAD 120
|
||||
# define CONF_F_DEF_LOAD_BIO 121
|
||||
# define CONF_F_MODULE_INIT 115
|
||||
# define CONF_F_MODULE_LOAD_DSO 117
|
||||
# define CONF_F_MODULE_RUN 118
|
||||
# define CONF_F_NCONF_DUMP_BIO 105
|
||||
# define CONF_F_NCONF_DUMP_FP 106
|
||||
# define CONF_F_NCONF_GET_NUMBER_E 112
|
||||
# define CONF_F_NCONF_GET_SECTION 108
|
||||
# define CONF_F_NCONF_GET_STRING 109
|
||||
# define CONF_F_NCONF_LOAD 113
|
||||
# define CONF_F_NCONF_LOAD_BIO 110
|
||||
# define CONF_F_NCONF_LOAD_FP 114
|
||||
# define CONF_F_NCONF_NEW 111
|
||||
# define CONF_F_STR_COPY 101
|
||||
|
||||
/* Reason codes. */
|
||||
#define CONF_R_ERROR_LOADING_DSO 110
|
||||
#define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100
|
||||
#define CONF_R_MISSING_EQUAL_SIGN 101
|
||||
#define CONF_R_MISSING_FINISH_FUNCTION 111
|
||||
#define CONF_R_MISSING_INIT_FUNCTION 112
|
||||
#define CONF_R_MODULE_INITIALIZATION_ERROR 109
|
||||
#define CONF_R_NO_CLOSE_BRACE 102
|
||||
#define CONF_R_NO_CONF 105
|
||||
#define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE 106
|
||||
#define CONF_R_NO_SECTION 107
|
||||
#define CONF_R_NO_SUCH_FILE 114
|
||||
#define CONF_R_NO_VALUE 108
|
||||
#define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103
|
||||
#define CONF_R_UNKNOWN_MODULE_NAME 113
|
||||
#define CONF_R_VARIABLE_HAS_NO_VALUE 104
|
||||
# define CONF_R_ERROR_LOADING_DSO 110
|
||||
# define CONF_R_LIST_CANNOT_BE_NULL 115
|
||||
# define CONF_R_MISSING_CLOSE_SQUARE_BRACKET 100
|
||||
# define CONF_R_MISSING_EQUAL_SIGN 101
|
||||
# define CONF_R_MISSING_INIT_FUNCTION 112
|
||||
# define CONF_R_MODULE_INITIALIZATION_ERROR 109
|
||||
# define CONF_R_NO_CLOSE_BRACE 102
|
||||
# define CONF_R_NO_CONF 105
|
||||
# define CONF_R_NO_CONF_OR_ENVIRONMENT_VARIABLE 106
|
||||
# define CONF_R_NO_SECTION 107
|
||||
# define CONF_R_NO_SUCH_FILE 114
|
||||
# define CONF_R_NO_VALUE 108
|
||||
# define CONF_R_UNABLE_TO_CREATE_NEW_SECTION 103
|
||||
# define CONF_R_UNKNOWN_MODULE_NAME 113
|
||||
# define CONF_R_VARIABLE_EXPANSION_TOO_LONG 116
|
||||
# define CONF_R_VARIABLE_HAS_NO_VALUE 104
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@ -1,66 +1,17 @@
|
||||
/* conf_api.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CONF_API_H
|
||||
#define HEADER_CONF_API_H
|
||||
# define HEADER_CONF_API_H
|
||||
|
||||
#include <openssl/lhash.h>
|
||||
#include <openssl/conf.h>
|
||||
# include <openssl/lhash.h>
|
||||
# include <openssl/conf.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -72,12 +23,13 @@ CONF_VALUE *_CONF_new_section(CONF *conf, const char *section);
|
||||
CONF_VALUE *_CONF_get_section(const CONF *conf, const char *section);
|
||||
/* Up until OpenSSL 0.9.5a, this was CONF_get_section */
|
||||
STACK_OF(CONF_VALUE) *_CONF_get_section_values(const CONF *conf,
|
||||
const char *section);
|
||||
const char *section);
|
||||
|
||||
int _CONF_add_string(CONF *conf, CONF_VALUE *section, CONF_VALUE *value);
|
||||
char *_CONF_get_string(const CONF *conf, const char *section,
|
||||
const char *name);
|
||||
long _CONF_get_number(const CONF *conf, const char *section, const char *name);
|
||||
const char *name);
|
||||
long _CONF_get_number(const CONF *conf, const char *section,
|
||||
const char *name);
|
||||
|
||||
int _CONF_new_data(CONF *conf);
|
||||
void _CONF_free_data(CONF *conf);
|
||||
@ -86,4 +38,3 @@ void _CONF_free_data(CONF *conf);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@ -1,113 +1,12 @@
|
||||
/* crypto/crypto.h */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* openssl-core@openssl.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||
* Hudson (tjh@cryptsoft.com).
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
|
||||
/* ====================================================================
|
||||
* Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
|
||||
* ECDH support in OpenSSL originally developed by
|
||||
@ -115,436 +14,450 @@
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CRYPTO_H
|
||||
#define HEADER_CRYPTO_H
|
||||
# define HEADER_CRYPTO_H
|
||||
|
||||
#include <stdlib.h>
|
||||
# include <stdlib.h>
|
||||
# include <time.h>
|
||||
|
||||
#include <openssl/e_os2.h>
|
||||
# include <openssl/e_os2.h>
|
||||
|
||||
#ifndef OPENSSL_NO_FP_API
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
# include <stdio.h>
|
||||
# endif
|
||||
|
||||
#include <openssl/stack.h>
|
||||
#include <openssl/safestack.h>
|
||||
#include <openssl/opensslv.h>
|
||||
#include <openssl/ossl_typ.h>
|
||||
# include <openssl/stack.h>
|
||||
# include <openssl/safestack.h>
|
||||
# include <openssl/opensslv.h>
|
||||
# include <openssl/ossl_typ.h>
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
#ifdef CHARSET_EBCDIC
|
||||
#include <openssl/ebcdic.h>
|
||||
#endif
|
||||
# ifdef CHARSET_EBCDIC
|
||||
# include <openssl/ebcdic.h>
|
||||
# endif
|
||||
|
||||
/* Resolve problems on some operating systems with symbol names that clash
|
||||
one way or another */
|
||||
#include <openssl/symhacks.h>
|
||||
/*
|
||||
* Resolve problems on some operating systems with symbol names that clash
|
||||
* one way or another
|
||||
*/
|
||||
# include <openssl/symhacks.h>
|
||||
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# include <openssl/opensslv.h>
|
||||
# endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Backward compatibility to SSLeay */
|
||||
/* This is more to be used to check the correct DLL is being used
|
||||
* in the MS world. */
|
||||
#define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER
|
||||
#define SSLEAY_VERSION 0
|
||||
/* #define SSLEAY_OPTIONS 1 no longer supported */
|
||||
#define SSLEAY_CFLAGS 2
|
||||
#define SSLEAY_BUILT_ON 3
|
||||
#define SSLEAY_PLATFORM 4
|
||||
#define SSLEAY_DIR 5
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# define SSLeay OpenSSL_version_num
|
||||
# define SSLeay_version OpenSSL_version
|
||||
# define SSLEAY_VERSION_NUMBER OPENSSL_VERSION_NUMBER
|
||||
# define SSLEAY_VERSION OPENSSL_VERSION
|
||||
# define SSLEAY_CFLAGS OPENSSL_CFLAGS
|
||||
# define SSLEAY_BUILT_ON OPENSSL_BUILT_ON
|
||||
# define SSLEAY_PLATFORM OPENSSL_PLATFORM
|
||||
# define SSLEAY_DIR OPENSSL_DIR
|
||||
|
||||
/* Already declared in ossl_typ.h */
|
||||
#if 0
|
||||
typedef struct crypto_ex_data_st CRYPTO_EX_DATA;
|
||||
/* Called when a new object is created */
|
||||
typedef int CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad,
|
||||
int idx, long argl, void *argp);
|
||||
/* Called when an object is free()ed */
|
||||
typedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad,
|
||||
int idx, long argl, void *argp);
|
||||
/* Called when we need to dup an object */
|
||||
typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d,
|
||||
int idx, long argl, void *argp);
|
||||
#endif
|
||||
|
||||
/* A generic structure to pass assorted data in a expandable way */
|
||||
typedef struct openssl_item_st
|
||||
{
|
||||
int code;
|
||||
void *value; /* Not used for flag attributes */
|
||||
size_t value_size; /* Max size of value for output, length for input */
|
||||
size_t *value_length; /* Returned length of value for output */
|
||||
} OPENSSL_ITEM;
|
||||
|
||||
|
||||
/* When changing the CRYPTO_LOCK_* list, be sure to maintin the text lock
|
||||
* names in cryptlib.c
|
||||
/*
|
||||
* Old type for allocating dynamic locks. No longer used. Use the new thread
|
||||
* API instead.
|
||||
*/
|
||||
typedef struct {
|
||||
int dummy;
|
||||
} CRYPTO_dynlock;
|
||||
|
||||
#define CRYPTO_LOCK_ERR 1
|
||||
#define CRYPTO_LOCK_EX_DATA 2
|
||||
#define CRYPTO_LOCK_X509 3
|
||||
#define CRYPTO_LOCK_X509_INFO 4
|
||||
#define CRYPTO_LOCK_X509_PKEY 5
|
||||
#define CRYPTO_LOCK_X509_CRL 6
|
||||
#define CRYPTO_LOCK_X509_REQ 7
|
||||
#define CRYPTO_LOCK_DSA 8
|
||||
#define CRYPTO_LOCK_RSA 9
|
||||
#define CRYPTO_LOCK_EVP_PKEY 10
|
||||
#define CRYPTO_LOCK_X509_STORE 11
|
||||
#define CRYPTO_LOCK_SSL_CTX 12
|
||||
#define CRYPTO_LOCK_SSL_CERT 13
|
||||
#define CRYPTO_LOCK_SSL_SESSION 14
|
||||
#define CRYPTO_LOCK_SSL_SESS_CERT 15
|
||||
#define CRYPTO_LOCK_SSL 16
|
||||
#define CRYPTO_LOCK_SSL_METHOD 17
|
||||
#define CRYPTO_LOCK_RAND 18
|
||||
#define CRYPTO_LOCK_RAND2 19
|
||||
#define CRYPTO_LOCK_MALLOC 20
|
||||
#define CRYPTO_LOCK_BIO 21
|
||||
#define CRYPTO_LOCK_GETHOSTBYNAME 22
|
||||
#define CRYPTO_LOCK_GETSERVBYNAME 23
|
||||
#define CRYPTO_LOCK_READDIR 24
|
||||
#define CRYPTO_LOCK_RSA_BLINDING 25
|
||||
#define CRYPTO_LOCK_DH 26
|
||||
#define CRYPTO_LOCK_MALLOC2 27
|
||||
#define CRYPTO_LOCK_DSO 28
|
||||
#define CRYPTO_LOCK_DYNLOCK 29
|
||||
#define CRYPTO_LOCK_ENGINE 30
|
||||
#define CRYPTO_LOCK_UI 31
|
||||
#define CRYPTO_LOCK_ECDSA 32
|
||||
#define CRYPTO_LOCK_EC 33
|
||||
#define CRYPTO_LOCK_ECDH 34
|
||||
#define CRYPTO_LOCK_BN 35
|
||||
#define CRYPTO_LOCK_EC_PRE_COMP 36
|
||||
#define CRYPTO_LOCK_STORE 37
|
||||
#define CRYPTO_LOCK_COMP 38
|
||||
#define CRYPTO_NUM_LOCKS 39
|
||||
# endif /* OPENSSL_API_COMPAT */
|
||||
|
||||
#define CRYPTO_LOCK 1
|
||||
#define CRYPTO_UNLOCK 2
|
||||
#define CRYPTO_READ 4
|
||||
#define CRYPTO_WRITE 8
|
||||
typedef void CRYPTO_RWLOCK;
|
||||
|
||||
#ifndef OPENSSL_NO_LOCKING
|
||||
#ifndef CRYPTO_w_lock
|
||||
#define CRYPTO_w_lock(type) \
|
||||
CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
|
||||
#define CRYPTO_w_unlock(type) \
|
||||
CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
|
||||
#define CRYPTO_r_lock(type) \
|
||||
CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,__FILE__,__LINE__)
|
||||
#define CRYPTO_r_unlock(type) \
|
||||
CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__)
|
||||
#define CRYPTO_add(addr,amount,type) \
|
||||
CRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__)
|
||||
#endif
|
||||
#else
|
||||
#define CRYPTO_w_lock(a)
|
||||
#define CRYPTO_w_unlock(a)
|
||||
#define CRYPTO_r_lock(a)
|
||||
#define CRYPTO_r_unlock(a)
|
||||
#define CRYPTO_add(a,b,c) ((*(a))+=(b))
|
||||
#endif
|
||||
CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void);
|
||||
int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock);
|
||||
int CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock);
|
||||
int CRYPTO_THREAD_unlock(CRYPTO_RWLOCK *lock);
|
||||
void CRYPTO_THREAD_lock_free(CRYPTO_RWLOCK *lock);
|
||||
|
||||
/* Some applications as well as some parts of OpenSSL need to allocate
|
||||
and deallocate locks in a dynamic fashion. The following typedef
|
||||
makes this possible in a type-safe manner. */
|
||||
/* struct CRYPTO_dynlock_value has to be defined by the application. */
|
||||
typedef struct
|
||||
{
|
||||
int references;
|
||||
struct CRYPTO_dynlock_value *data;
|
||||
} CRYPTO_dynlock;
|
||||
int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock);
|
||||
|
||||
|
||||
/* The following can be used to detect memory leaks in the SSLeay library.
|
||||
* It used, it turns on malloc checking */
|
||||
|
||||
#define CRYPTO_MEM_CHECK_OFF 0x0 /* an enume */
|
||||
#define CRYPTO_MEM_CHECK_ON 0x1 /* a bit */
|
||||
#define CRYPTO_MEM_CHECK_ENABLE 0x2 /* a bit */
|
||||
#define CRYPTO_MEM_CHECK_DISABLE 0x3 /* an enume */
|
||||
|
||||
/* The following are bit values to turn on or off options connected to the
|
||||
* malloc checking functionality */
|
||||
|
||||
/* Adds time to the memory checking information */
|
||||
#define V_CRYPTO_MDEBUG_TIME 0x1 /* a bit */
|
||||
/* Adds thread number to the memory checking information */
|
||||
#define V_CRYPTO_MDEBUG_THREAD 0x2 /* a bit */
|
||||
|
||||
#define V_CRYPTO_MDEBUG_ALL (V_CRYPTO_MDEBUG_TIME | V_CRYPTO_MDEBUG_THREAD)
|
||||
|
||||
|
||||
/* predec of the BIO type */
|
||||
typedef struct bio_st BIO_dummy;
|
||||
|
||||
struct crypto_ex_data_st
|
||||
{
|
||||
STACK *sk;
|
||||
int dummy; /* gcc is screwing up this data structure :-( */
|
||||
};
|
||||
|
||||
/* This stuff is basically class callback functions
|
||||
* The current classes are SSL_CTX, SSL, SSL_SESSION, and a few more */
|
||||
|
||||
typedef struct crypto_ex_data_func_st
|
||||
{
|
||||
long argl; /* Arbitary long */
|
||||
void *argp; /* Arbitary void * */
|
||||
CRYPTO_EX_new *new_func;
|
||||
CRYPTO_EX_free *free_func;
|
||||
CRYPTO_EX_dup *dup_func;
|
||||
} CRYPTO_EX_DATA_FUNCS;
|
||||
|
||||
DECLARE_STACK_OF(CRYPTO_EX_DATA_FUNCS)
|
||||
|
||||
/* Per class, we have a STACK of CRYPTO_EX_DATA_FUNCS for each CRYPTO_EX_DATA
|
||||
* entry.
|
||||
/*
|
||||
* The following can be used to detect memory leaks in the library. If
|
||||
* used, it turns on malloc checking
|
||||
*/
|
||||
# define CRYPTO_MEM_CHECK_OFF 0x0 /* Control only */
|
||||
# define CRYPTO_MEM_CHECK_ON 0x1 /* Control and mode bit */
|
||||
# define CRYPTO_MEM_CHECK_ENABLE 0x2 /* Control and mode bit */
|
||||
# define CRYPTO_MEM_CHECK_DISABLE 0x3 /* Control only */
|
||||
|
||||
#define CRYPTO_EX_INDEX_BIO 0
|
||||
#define CRYPTO_EX_INDEX_SSL 1
|
||||
#define CRYPTO_EX_INDEX_SSL_CTX 2
|
||||
#define CRYPTO_EX_INDEX_SSL_SESSION 3
|
||||
#define CRYPTO_EX_INDEX_X509_STORE 4
|
||||
#define CRYPTO_EX_INDEX_X509_STORE_CTX 5
|
||||
#define CRYPTO_EX_INDEX_RSA 6
|
||||
#define CRYPTO_EX_INDEX_DSA 7
|
||||
#define CRYPTO_EX_INDEX_DH 8
|
||||
#define CRYPTO_EX_INDEX_ENGINE 9
|
||||
#define CRYPTO_EX_INDEX_X509 10
|
||||
#define CRYPTO_EX_INDEX_UI 11
|
||||
#define CRYPTO_EX_INDEX_ECDSA 12
|
||||
#define CRYPTO_EX_INDEX_ECDH 13
|
||||
#define CRYPTO_EX_INDEX_COMP 14
|
||||
#define CRYPTO_EX_INDEX_STORE 15
|
||||
struct crypto_ex_data_st {
|
||||
STACK_OF(void) *sk;
|
||||
};
|
||||
DEFINE_STACK_OF(void)
|
||||
|
||||
/* Dynamically assigned indexes start from this value (don't use directly, use
|
||||
* via CRYPTO_ex_data_new_class). */
|
||||
#define CRYPTO_EX_INDEX_USER 100
|
||||
|
||||
|
||||
/* This is the default callbacks, but we can have others as well:
|
||||
* this is needed in Win32 where the application malloc and the
|
||||
* library malloc may not be the same.
|
||||
/*
|
||||
* Per class, we have a STACK of function pointers.
|
||||
*/
|
||||
#define CRYPTO_malloc_init() CRYPTO_set_mem_functions(\
|
||||
malloc, realloc, free)
|
||||
# define CRYPTO_EX_INDEX_SSL 0
|
||||
# define CRYPTO_EX_INDEX_SSL_CTX 1
|
||||
# define CRYPTO_EX_INDEX_SSL_SESSION 2
|
||||
# define CRYPTO_EX_INDEX_X509 3
|
||||
# define CRYPTO_EX_INDEX_X509_STORE 4
|
||||
# define CRYPTO_EX_INDEX_X509_STORE_CTX 5
|
||||
# define CRYPTO_EX_INDEX_DH 6
|
||||
# define CRYPTO_EX_INDEX_DSA 7
|
||||
# define CRYPTO_EX_INDEX_EC_KEY 8
|
||||
# define CRYPTO_EX_INDEX_RSA 9
|
||||
# define CRYPTO_EX_INDEX_ENGINE 10
|
||||
# define CRYPTO_EX_INDEX_UI 11
|
||||
# define CRYPTO_EX_INDEX_BIO 12
|
||||
# define CRYPTO_EX_INDEX_APP 13
|
||||
# define CRYPTO_EX_INDEX__COUNT 14
|
||||
|
||||
#if defined CRYPTO_MDEBUG_ALL || defined CRYPTO_MDEBUG_TIME || defined CRYPTO_MDEBUG_THREAD
|
||||
# ifndef CRYPTO_MDEBUG /* avoid duplicate #define */
|
||||
# define CRYPTO_MDEBUG
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Set standard debugging functions (not done by default
|
||||
* unless CRYPTO_MDEBUG is defined) */
|
||||
#define CRYPTO_malloc_debug_init() do {\
|
||||
CRYPTO_set_mem_debug_functions(\
|
||||
CRYPTO_dbg_malloc,\
|
||||
CRYPTO_dbg_realloc,\
|
||||
CRYPTO_dbg_free,\
|
||||
CRYPTO_dbg_set_options,\
|
||||
CRYPTO_dbg_get_options);\
|
||||
} while(0)
|
||||
/*
|
||||
* This is the default callbacks, but we can have others as well: this is
|
||||
* needed in Win32 where the application malloc and the library malloc may
|
||||
* not be the same.
|
||||
*/
|
||||
#define OPENSSL_malloc_init() \
|
||||
CRYPTO_set_mem_functions(CRYPTO_malloc, CRYPTO_realloc, CRYPTO_free)
|
||||
|
||||
int CRYPTO_mem_ctrl(int mode);
|
||||
int CRYPTO_is_mem_check_on(void);
|
||||
|
||||
/* for applications */
|
||||
#define MemCheck_start() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON)
|
||||
#define MemCheck_stop() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_OFF)
|
||||
# define OPENSSL_malloc(num) \
|
||||
CRYPTO_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_zalloc(num) \
|
||||
CRYPTO_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_realloc(addr, num) \
|
||||
CRYPTO_realloc(addr, num, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_clear_realloc(addr, old_num, num) \
|
||||
CRYPTO_clear_realloc(addr, old_num, num, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_clear_free(addr, num) \
|
||||
CRYPTO_clear_free(addr, num, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_free(addr) \
|
||||
CRYPTO_free(addr, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_memdup(str, s) \
|
||||
CRYPTO_memdup((str), s, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_strdup(str) \
|
||||
CRYPTO_strdup(str, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_strndup(str, n) \
|
||||
CRYPTO_strndup(str, n, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_secure_malloc(num) \
|
||||
CRYPTO_secure_malloc(num, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_secure_zalloc(num) \
|
||||
CRYPTO_secure_zalloc(num, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_secure_free(addr) \
|
||||
CRYPTO_secure_free(addr, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_secure_actual_size(ptr) \
|
||||
CRYPTO_secure_actual_size(ptr)
|
||||
|
||||
/* for library-internal use */
|
||||
#define MemCheck_on() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ENABLE)
|
||||
#define MemCheck_off() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE)
|
||||
#define is_MemCheck_on() CRYPTO_is_mem_check_on()
|
||||
size_t OPENSSL_strlcpy(char *dst, const char *src, size_t siz);
|
||||
size_t OPENSSL_strlcat(char *dst, const char *src, size_t siz);
|
||||
size_t OPENSSL_strnlen(const char *str, size_t maxlen);
|
||||
char *OPENSSL_buf2hexstr(const unsigned char *buffer, long len);
|
||||
unsigned char *OPENSSL_hexstr2buf(const char *str, long *len);
|
||||
int OPENSSL_hexchar2int(unsigned char c);
|
||||
|
||||
#define OPENSSL_malloc(num) CRYPTO_malloc((int)num,__FILE__,__LINE__)
|
||||
#define OPENSSL_realloc(addr,num) \
|
||||
CRYPTO_realloc((char *)addr,(int)num,__FILE__,__LINE__)
|
||||
#define OPENSSL_realloc_clean(addr,old_num,num) \
|
||||
CRYPTO_realloc_clean(addr,old_num,num,__FILE__,__LINE__)
|
||||
#define OPENSSL_remalloc(addr,num) \
|
||||
CRYPTO_remalloc((char **)addr,(int)num,__FILE__,__LINE__)
|
||||
#define OPENSSL_freeFunc CRYPTO_free
|
||||
#define OPENSSL_free(addr) CRYPTO_free(addr)
|
||||
# define OPENSSL_MALLOC_MAX_NELEMS(type) (((1U<<(sizeof(int)*8-1))-1)/sizeof(type))
|
||||
|
||||
#define OPENSSL_malloc_locked(num) \
|
||||
CRYPTO_malloc_locked((int)num,__FILE__,__LINE__)
|
||||
#define OPENSSL_free_locked(addr) CRYPTO_free_locked(addr)
|
||||
|
||||
|
||||
const char *SSLeay_version(int type);
|
||||
unsigned long SSLeay(void);
|
||||
unsigned long OpenSSL_version_num(void);
|
||||
const char *OpenSSL_version(int type);
|
||||
# define OPENSSL_VERSION 0
|
||||
# define OPENSSL_CFLAGS 1
|
||||
# define OPENSSL_BUILT_ON 2
|
||||
# define OPENSSL_PLATFORM 3
|
||||
# define OPENSSL_DIR 4
|
||||
# define OPENSSL_ENGINES_DIR 5
|
||||
|
||||
int OPENSSL_issetugid(void);
|
||||
|
||||
/* An opaque type representing an implementation of "ex_data" support */
|
||||
typedef struct st_CRYPTO_EX_DATA_IMPL CRYPTO_EX_DATA_IMPL;
|
||||
/* Return an opaque pointer to the current "ex_data" implementation */
|
||||
const CRYPTO_EX_DATA_IMPL *CRYPTO_get_ex_data_implementation(void);
|
||||
/* Sets the "ex_data" implementation to be used (if it's not too late) */
|
||||
int CRYPTO_set_ex_data_implementation(const CRYPTO_EX_DATA_IMPL *i);
|
||||
/* Get a new "ex_data" class, and return the corresponding "class_index" */
|
||||
int CRYPTO_ex_data_new_class(void);
|
||||
/* Within a given class, get/register a new index */
|
||||
int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp,
|
||||
CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func,
|
||||
CRYPTO_EX_free *free_func);
|
||||
/* Initialise/duplicate/free CRYPTO_EX_DATA variables corresponding to a given
|
||||
* class (invokes whatever per-class callbacks are applicable) */
|
||||
typedef void CRYPTO_EX_new (void *parent, void *ptr, CRYPTO_EX_DATA *ad,
|
||||
int idx, long argl, void *argp);
|
||||
typedef void CRYPTO_EX_free (void *parent, void *ptr, CRYPTO_EX_DATA *ad,
|
||||
int idx, long argl, void *argp);
|
||||
typedef int CRYPTO_EX_dup (CRYPTO_EX_DATA *to, const CRYPTO_EX_DATA *from,
|
||||
void *from_d, int idx, long argl, void *argp);
|
||||
__owur int CRYPTO_get_ex_new_index(int class_index, long argl, void *argp,
|
||||
CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func,
|
||||
CRYPTO_EX_free *free_func);
|
||||
/* No longer use an index. */
|
||||
int CRYPTO_free_ex_index(int class_index, int idx);
|
||||
|
||||
/*
|
||||
* Initialise/duplicate/free CRYPTO_EX_DATA variables corresponding to a
|
||||
* given class (invokes whatever per-class callbacks are applicable)
|
||||
*/
|
||||
int CRYPTO_new_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);
|
||||
int CRYPTO_dup_ex_data(int class_index, CRYPTO_EX_DATA *to,
|
||||
CRYPTO_EX_DATA *from);
|
||||
const CRYPTO_EX_DATA *from);
|
||||
|
||||
void CRYPTO_free_ex_data(int class_index, void *obj, CRYPTO_EX_DATA *ad);
|
||||
/* Get/set data in a CRYPTO_EX_DATA variable corresponding to a particular index
|
||||
* (relative to the class type involved) */
|
||||
|
||||
/*
|
||||
* Get/set data in a CRYPTO_EX_DATA variable corresponding to a particular
|
||||
* index (relative to the class type involved)
|
||||
*/
|
||||
int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, void *val);
|
||||
void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad,int idx);
|
||||
/* This function cleans up all "ex_data" state. It mustn't be called under
|
||||
* potential race-conditions. */
|
||||
void CRYPTO_cleanup_all_ex_data(void);
|
||||
void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx);
|
||||
|
||||
int CRYPTO_get_new_lockid(char *name);
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
/*
|
||||
* This function cleans up all "ex_data" state. It mustn't be called under
|
||||
* potential race-conditions.
|
||||
*/
|
||||
# define CRYPTO_cleanup_all_ex_data() while(0) continue
|
||||
|
||||
int CRYPTO_num_locks(void); /* return CRYPTO_NUM_LOCKS (shared libs!) */
|
||||
void CRYPTO_lock(int mode, int type,const char *file,int line);
|
||||
void CRYPTO_set_locking_callback(void (*func)(int mode,int type,
|
||||
const char *file,int line));
|
||||
void (*CRYPTO_get_locking_callback(void))(int mode,int type,const char *file,
|
||||
int line);
|
||||
void CRYPTO_set_add_lock_callback(int (*func)(int *num,int mount,int type,
|
||||
const char *file, int line));
|
||||
int (*CRYPTO_get_add_lock_callback(void))(int *num,int mount,int type,
|
||||
const char *file,int line);
|
||||
void CRYPTO_set_id_callback(unsigned long (*func)(void));
|
||||
unsigned long (*CRYPTO_get_id_callback(void))(void);
|
||||
unsigned long CRYPTO_thread_id(void);
|
||||
const char *CRYPTO_get_lock_name(int type);
|
||||
int CRYPTO_add_lock(int *pointer,int amount,int type, const char *file,
|
||||
int line);
|
||||
/*
|
||||
* The old locking functions have been removed completely without compatibility
|
||||
* macros. This is because the old functions either could not properly report
|
||||
* errors, or the returned error values were not clearly documented.
|
||||
* Replacing the locking functions with with no-ops would cause race condition
|
||||
* issues in the affected applications. It is far better for them to fail at
|
||||
* compile time.
|
||||
* On the other hand, the locking callbacks are no longer used. Consequently,
|
||||
* the callback management functions can be safely replaced with no-op macros.
|
||||
*/
|
||||
# define CRYPTO_num_locks() (1)
|
||||
# define CRYPTO_set_locking_callback(func)
|
||||
# define CRYPTO_get_locking_callback() (NULL)
|
||||
# define CRYPTO_set_add_lock_callback(func)
|
||||
# define CRYPTO_get_add_lock_callback() (NULL)
|
||||
|
||||
int CRYPTO_get_new_dynlockid(void);
|
||||
void CRYPTO_destroy_dynlockid(int i);
|
||||
struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i);
|
||||
void CRYPTO_set_dynlock_create_callback(struct CRYPTO_dynlock_value *(*dyn_create_function)(const char *file, int line));
|
||||
void CRYPTO_set_dynlock_lock_callback(void (*dyn_lock_function)(int mode, struct CRYPTO_dynlock_value *l, const char *file, int line));
|
||||
void CRYPTO_set_dynlock_destroy_callback(void (*dyn_destroy_function)(struct CRYPTO_dynlock_value *l, const char *file, int line));
|
||||
struct CRYPTO_dynlock_value *(*CRYPTO_get_dynlock_create_callback(void))(const char *file,int line);
|
||||
void (*CRYPTO_get_dynlock_lock_callback(void))(int mode, struct CRYPTO_dynlock_value *l, const char *file,int line);
|
||||
void (*CRYPTO_get_dynlock_destroy_callback(void))(struct CRYPTO_dynlock_value *l, const char *file,int line);
|
||||
/*
|
||||
* These defines where used in combination with the old locking callbacks,
|
||||
* they are not called anymore, but old code that's not called might still
|
||||
* use them.
|
||||
*/
|
||||
# define CRYPTO_LOCK 1
|
||||
# define CRYPTO_UNLOCK 2
|
||||
# define CRYPTO_READ 4
|
||||
# define CRYPTO_WRITE 8
|
||||
|
||||
/* CRYPTO_set_mem_functions includes CRYPTO_set_locked_mem_functions --
|
||||
* call the latter last if you need different functions */
|
||||
int CRYPTO_set_mem_functions(void *(*m)(size_t),void *(*r)(void *,size_t), void (*f)(void *));
|
||||
int CRYPTO_set_locked_mem_functions(void *(*m)(size_t), void (*free_func)(void *));
|
||||
int CRYPTO_set_mem_ex_functions(void *(*m)(size_t,const char *,int),
|
||||
void *(*r)(void *,size_t,const char *,int),
|
||||
void (*f)(void *));
|
||||
int CRYPTO_set_locked_mem_ex_functions(void *(*m)(size_t,const char *,int),
|
||||
void (*free_func)(void *));
|
||||
int CRYPTO_set_mem_debug_functions(void (*m)(void *,int,const char *,int,int),
|
||||
void (*r)(void *,void *,int,const char *,int,int),
|
||||
void (*f)(void *,int),
|
||||
void (*so)(long),
|
||||
long (*go)(void));
|
||||
void CRYPTO_get_mem_functions(void *(**m)(size_t),void *(**r)(void *, size_t), void (**f)(void *));
|
||||
void CRYPTO_get_locked_mem_functions(void *(**m)(size_t), void (**f)(void *));
|
||||
void CRYPTO_get_mem_ex_functions(void *(**m)(size_t,const char *,int),
|
||||
void *(**r)(void *, size_t,const char *,int),
|
||||
void (**f)(void *));
|
||||
void CRYPTO_get_locked_mem_ex_functions(void *(**m)(size_t,const char *,int),
|
||||
void (**f)(void *));
|
||||
void CRYPTO_get_mem_debug_functions(void (**m)(void *,int,const char *,int,int),
|
||||
void (**r)(void *,void *,int,const char *,int,int),
|
||||
void (**f)(void *,int),
|
||||
void (**so)(long),
|
||||
long (**go)(void));
|
||||
/* This structure is no longer used */
|
||||
typedef struct crypto_threadid_st {
|
||||
int dummy;
|
||||
} CRYPTO_THREADID;
|
||||
/* Only use CRYPTO_THREADID_set_[numeric|pointer]() within callbacks */
|
||||
# define CRYPTO_THREADID_set_numeric(id, val)
|
||||
# define CRYPTO_THREADID_set_pointer(id, ptr)
|
||||
# define CRYPTO_THREADID_set_callback(threadid_func) (0)
|
||||
# define CRYPTO_THREADID_get_callback() (NULL)
|
||||
# define CRYPTO_THREADID_current(id)
|
||||
# define CRYPTO_THREADID_cmp(a, b) (-1)
|
||||
# define CRYPTO_THREADID_cpy(dest, src)
|
||||
# define CRYPTO_THREADID_hash(id) (0UL)
|
||||
|
||||
void *CRYPTO_malloc_locked(int num, const char *file, int line);
|
||||
void CRYPTO_free_locked(void *);
|
||||
void *CRYPTO_malloc(int num, const char *file, int line);
|
||||
void CRYPTO_free(void *);
|
||||
void *CRYPTO_realloc(void *addr,int num, const char *file, int line);
|
||||
void *CRYPTO_realloc_clean(void *addr,int old_num,int num,const char *file,
|
||||
int line);
|
||||
void *CRYPTO_remalloc(void *addr,int num, const char *file, int line);
|
||||
# if OPENSSL_API_COMPAT < 0x10000000L
|
||||
# define CRYPTO_set_id_callback(func)
|
||||
# define CRYPTO_get_id_callback() (NULL)
|
||||
# define CRYPTO_thread_id() (0UL)
|
||||
# endif /* OPENSSL_API_COMPAT < 0x10000000L */
|
||||
|
||||
# define CRYPTO_set_dynlock_create_callback(dyn_create_function)
|
||||
# define CRYPTO_set_dynlock_lock_callback(dyn_lock_function)
|
||||
# define CRYPTO_set_dynlock_destroy_callback(dyn_destroy_function)
|
||||
# define CRYPTO_get_dynlock_create_callback() (NULL)
|
||||
# define CRYPTO_get_dynlock_lock_callback() (NULL)
|
||||
# define CRYPTO_get_dynlock_destroy_callback() (NULL)
|
||||
# endif /* OPENSSL_API_COMPAT < 0x10100000L */
|
||||
|
||||
int CRYPTO_set_mem_functions(
|
||||
void *(*m) (size_t, const char *, int),
|
||||
void *(*r) (void *, size_t, const char *, int),
|
||||
void (*f) (void *, const char *, int));
|
||||
int CRYPTO_set_mem_debug(int flag);
|
||||
void CRYPTO_get_mem_functions(
|
||||
void *(**m) (size_t, const char *, int),
|
||||
void *(**r) (void *, size_t, const char *, int),
|
||||
void (**f) (void *, const char *, int));
|
||||
|
||||
void *CRYPTO_malloc(size_t num, const char *file, int line);
|
||||
void *CRYPTO_zalloc(size_t num, const char *file, int line);
|
||||
void *CRYPTO_memdup(const void *str, size_t siz, const char *file, int line);
|
||||
char *CRYPTO_strdup(const char *str, const char *file, int line);
|
||||
char *CRYPTO_strndup(const char *str, size_t s, const char *file, int line);
|
||||
void CRYPTO_free(void *ptr, const char *file, int line);
|
||||
void CRYPTO_clear_free(void *ptr, size_t num, const char *file, int line);
|
||||
void *CRYPTO_realloc(void *addr, size_t num, const char *file, int line);
|
||||
void *CRYPTO_clear_realloc(void *addr, size_t old_num, size_t num,
|
||||
const char *file, int line);
|
||||
|
||||
int CRYPTO_secure_malloc_init(size_t sz, int minsize);
|
||||
int CRYPTO_secure_malloc_done(void);
|
||||
void *CRYPTO_secure_malloc(size_t num, const char *file, int line);
|
||||
void *CRYPTO_secure_zalloc(size_t num, const char *file, int line);
|
||||
void CRYPTO_secure_free(void *ptr, const char *file, int line);
|
||||
int CRYPTO_secure_allocated(const void *ptr);
|
||||
int CRYPTO_secure_malloc_initialized(void);
|
||||
size_t CRYPTO_secure_actual_size(void *ptr);
|
||||
size_t CRYPTO_secure_used(void);
|
||||
|
||||
void OPENSSL_cleanse(void *ptr, size_t len);
|
||||
|
||||
void CRYPTO_set_mem_debug_options(long bits);
|
||||
long CRYPTO_get_mem_debug_options(void);
|
||||
# ifndef OPENSSL_NO_CRYPTO_MDEBUG
|
||||
# define OPENSSL_mem_debug_push(info) \
|
||||
CRYPTO_mem_debug_push(info, OPENSSL_FILE, OPENSSL_LINE)
|
||||
# define OPENSSL_mem_debug_pop() \
|
||||
CRYPTO_mem_debug_pop()
|
||||
int CRYPTO_mem_debug_push(const char *info, const char *file, int line);
|
||||
int CRYPTO_mem_debug_pop(void);
|
||||
|
||||
#define CRYPTO_push_info(info) \
|
||||
CRYPTO_push_info_(info, __FILE__, __LINE__);
|
||||
int CRYPTO_push_info_(const char *info, const char *file, int line);
|
||||
int CRYPTO_pop_info(void);
|
||||
int CRYPTO_remove_all_info(void);
|
||||
|
||||
|
||||
/* Default debugging functions (enabled by CRYPTO_malloc_debug_init() macro;
|
||||
* used as default in CRYPTO_MDEBUG compilations): */
|
||||
/* The last argument has the following significance:
|
||||
*
|
||||
* 0: called before the actual memory allocation has taken place
|
||||
* 1: called after the actual memory allocation has taken place
|
||||
/*-
|
||||
* Debugging functions (enabled by CRYPTO_set_mem_debug(1))
|
||||
* The flag argument has the following significance:
|
||||
* 0: called before the actual memory allocation has taken place
|
||||
* 1: called after the actual memory allocation has taken place
|
||||
*/
|
||||
void CRYPTO_dbg_malloc(void *addr,int num,const char *file,int line,int before_p);
|
||||
void CRYPTO_dbg_realloc(void *addr1,void *addr2,int num,const char *file,int line,int before_p);
|
||||
void CRYPTO_dbg_free(void *addr,int before_p);
|
||||
/* Tell the debugging code about options. By default, the following values
|
||||
* apply:
|
||||
*
|
||||
* 0: Clear all options.
|
||||
* V_CRYPTO_MDEBUG_TIME (1): Set the "Show Time" option.
|
||||
* V_CRYPTO_MDEBUG_THREAD (2): Set the "Show Thread Number" option.
|
||||
* V_CRYPTO_MDEBUG_ALL (3): 1 + 2
|
||||
*/
|
||||
void CRYPTO_dbg_set_options(long bits);
|
||||
long CRYPTO_dbg_get_options(void);
|
||||
void CRYPTO_mem_debug_malloc(void *addr, size_t num, int flag,
|
||||
const char *file, int line);
|
||||
void CRYPTO_mem_debug_realloc(void *addr1, void *addr2, size_t num, int flag,
|
||||
const char *file, int line);
|
||||
void CRYPTO_mem_debug_free(void *addr, int flag,
|
||||
const char *file, int line);
|
||||
|
||||
|
||||
#ifndef OPENSSL_NO_FP_API
|
||||
void CRYPTO_mem_leaks_fp(FILE *);
|
||||
#endif
|
||||
void CRYPTO_mem_leaks(struct bio_st *bio);
|
||||
/* unsigned long order, char *file, int line, int num_bytes, char *addr */
|
||||
typedef void *CRYPTO_MEM_LEAK_CB(unsigned long, const char *, int, int, void *);
|
||||
void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb);
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
int CRYPTO_mem_leaks_fp(FILE *);
|
||||
# endif
|
||||
int CRYPTO_mem_leaks(BIO *bio);
|
||||
# endif
|
||||
|
||||
/* die if we have to */
|
||||
void OpenSSLDie(const char *file,int line,const char *assertion);
|
||||
#define OPENSSL_assert(e) (void)((e) ? 0 : (OpenSSLDie(__FILE__, __LINE__, #e),1))
|
||||
ossl_noreturn void OPENSSL_die(const char *assertion, const char *file, int line);
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# define OpenSSLDie(f,l,a) OPENSSL_die((a),(f),(l))
|
||||
# endif
|
||||
# define OPENSSL_assert(e) \
|
||||
(void)((e) ? 0 : (OPENSSL_die("assertion failed: " #e, OPENSSL_FILE, OPENSSL_LINE), 1))
|
||||
|
||||
unsigned long *OPENSSL_ia32cap_loc(void);
|
||||
#define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc()))
|
||||
int OPENSSL_isservice(void);
|
||||
|
||||
int FIPS_mode(void);
|
||||
int FIPS_mode_set(int r);
|
||||
|
||||
void OPENSSL_init(void);
|
||||
|
||||
struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result);
|
||||
int OPENSSL_gmtime_adj(struct tm *tm, int offset_day, long offset_sec);
|
||||
int OPENSSL_gmtime_diff(int *pday, int *psec,
|
||||
const struct tm *from, const struct tm *to);
|
||||
|
||||
/*
|
||||
* CRYPTO_memcmp returns zero iff the |len| bytes at |a| and |b| are equal.
|
||||
* It takes an amount of time dependent on |len|, but independent of the
|
||||
* contents of |a| and |b|. Unlike memcmp, it cannot be used to put elements
|
||||
* into a defined order as the return value when a != b is undefined, other
|
||||
* than to be non-zero.
|
||||
*/
|
||||
int CRYPTO_memcmp(const volatile void * volatile in_a,
|
||||
const volatile void * volatile in_b,
|
||||
size_t len);
|
||||
|
||||
/* Standard initialisation options */
|
||||
# define OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS 0x00000001L
|
||||
# define OPENSSL_INIT_LOAD_CRYPTO_STRINGS 0x00000002L
|
||||
# define OPENSSL_INIT_ADD_ALL_CIPHERS 0x00000004L
|
||||
# define OPENSSL_INIT_ADD_ALL_DIGESTS 0x00000008L
|
||||
# define OPENSSL_INIT_NO_ADD_ALL_CIPHERS 0x00000010L
|
||||
# define OPENSSL_INIT_NO_ADD_ALL_DIGESTS 0x00000020L
|
||||
# define OPENSSL_INIT_LOAD_CONFIG 0x00000040L
|
||||
# define OPENSSL_INIT_NO_LOAD_CONFIG 0x00000080L
|
||||
# define OPENSSL_INIT_ASYNC 0x00000100L
|
||||
# define OPENSSL_INIT_ENGINE_RDRAND 0x00000200L
|
||||
# define OPENSSL_INIT_ENGINE_DYNAMIC 0x00000400L
|
||||
# define OPENSSL_INIT_ENGINE_OPENSSL 0x00000800L
|
||||
# define OPENSSL_INIT_ENGINE_CRYPTODEV 0x00001000L
|
||||
# define OPENSSL_INIT_ENGINE_CAPI 0x00002000L
|
||||
# define OPENSSL_INIT_ENGINE_PADLOCK 0x00004000L
|
||||
# define OPENSSL_INIT_ENGINE_AFALG 0x00008000L
|
||||
/* OPENSSL_INIT flag 0x00010000 reserved for internal use */
|
||||
/* OPENSSL_INIT flag range 0xfff00000 reserved for OPENSSL_init_ssl() */
|
||||
/* Max OPENSSL_INIT flag value is 0x80000000 */
|
||||
|
||||
/* openssl and dasync not counted as builtin */
|
||||
# define OPENSSL_INIT_ENGINE_ALL_BUILTIN \
|
||||
(OPENSSL_INIT_ENGINE_RDRAND | OPENSSL_INIT_ENGINE_DYNAMIC \
|
||||
| OPENSSL_INIT_ENGINE_CRYPTODEV | OPENSSL_INIT_ENGINE_CAPI | \
|
||||
OPENSSL_INIT_ENGINE_PADLOCK)
|
||||
|
||||
|
||||
/* Library initialisation functions */
|
||||
void OPENSSL_cleanup(void);
|
||||
int OPENSSL_init_crypto(uint64_t opts, const OPENSSL_INIT_SETTINGS *settings);
|
||||
int OPENSSL_atexit(void (*handler)(void));
|
||||
void OPENSSL_thread_stop(void);
|
||||
|
||||
/* Low-level control of initialization */
|
||||
OPENSSL_INIT_SETTINGS *OPENSSL_INIT_new(void);
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
int OPENSSL_INIT_set_config_appname(OPENSSL_INIT_SETTINGS *settings,
|
||||
const char *config_file);
|
||||
# endif
|
||||
void OPENSSL_INIT_free(OPENSSL_INIT_SETTINGS *settings);
|
||||
|
||||
# if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG)
|
||||
# if defined(_WIN32)
|
||||
# if defined(BASETYPES) || defined(_WINDEF_H)
|
||||
/* application has to include <windows.h> in order to use this */
|
||||
typedef DWORD CRYPTO_THREAD_LOCAL;
|
||||
typedef DWORD CRYPTO_THREAD_ID;
|
||||
|
||||
typedef LONG CRYPTO_ONCE;
|
||||
# define CRYPTO_ONCE_STATIC_INIT 0
|
||||
# endif
|
||||
# else
|
||||
# include <pthread.h>
|
||||
typedef pthread_once_t CRYPTO_ONCE;
|
||||
typedef pthread_key_t CRYPTO_THREAD_LOCAL;
|
||||
typedef pthread_t CRYPTO_THREAD_ID;
|
||||
|
||||
# define CRYPTO_ONCE_STATIC_INIT PTHREAD_ONCE_INIT
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if !defined(CRYPTO_ONCE_STATIC_INIT)
|
||||
typedef unsigned int CRYPTO_ONCE;
|
||||
typedef unsigned int CRYPTO_THREAD_LOCAL;
|
||||
typedef unsigned int CRYPTO_THREAD_ID;
|
||||
# define CRYPTO_ONCE_STATIC_INIT 0
|
||||
# endif
|
||||
|
||||
int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void));
|
||||
|
||||
int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *));
|
||||
void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key);
|
||||
int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val);
|
||||
int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key);
|
||||
|
||||
CRYPTO_THREAD_ID CRYPTO_THREAD_get_current_id(void);
|
||||
int CRYPTO_THREAD_compare_id(CRYPTO_THREAD_ID a, CRYPTO_THREAD_ID b);
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
/*
|
||||
* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
void ERR_load_CRYPTO_strings(void);
|
||||
|
||||
int ERR_load_CRYPTO_strings(void);
|
||||
|
||||
/* Error codes for the CRYPTO functions. */
|
||||
|
||||
/* Function codes. */
|
||||
#define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX 100
|
||||
#define CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID 103
|
||||
#define CRYPTO_F_CRYPTO_GET_NEW_LOCKID 101
|
||||
#define CRYPTO_F_CRYPTO_SET_EX_DATA 102
|
||||
#define CRYPTO_F_DEF_ADD_INDEX 104
|
||||
#define CRYPTO_F_DEF_GET_CLASS 105
|
||||
#define CRYPTO_F_INT_DUP_EX_DATA 106
|
||||
#define CRYPTO_F_INT_FREE_EX_DATA 107
|
||||
#define CRYPTO_F_INT_NEW_EX_DATA 108
|
||||
# define CRYPTO_F_CRYPTO_DUP_EX_DATA 110
|
||||
# define CRYPTO_F_CRYPTO_FREE_EX_DATA 111
|
||||
# define CRYPTO_F_CRYPTO_GET_EX_NEW_INDEX 100
|
||||
# define CRYPTO_F_CRYPTO_MEMDUP 115
|
||||
# define CRYPTO_F_CRYPTO_NEW_EX_DATA 112
|
||||
# define CRYPTO_F_CRYPTO_SET_EX_DATA 102
|
||||
# define CRYPTO_F_FIPS_MODE_SET 109
|
||||
# define CRYPTO_F_GET_AND_LOCK 113
|
||||
# define CRYPTO_F_OPENSSL_BUF2HEXSTR 117
|
||||
# define CRYPTO_F_OPENSSL_HEXSTR2BUF 118
|
||||
# define CRYPTO_F_OPENSSL_INIT_CRYPTO 116
|
||||
|
||||
/* Reason codes. */
|
||||
#define CRYPTO_R_NO_DYNLOCK_CREATE_CALLBACK 100
|
||||
# define CRYPTO_R_FIPS_MODE_NOT_SUPPORTED 101
|
||||
# define CRYPTO_R_ILLEGAL_HEX_DIGIT 102
|
||||
# define CRYPTO_R_ODD_NUMBER_OF_DIGITS 103
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
533
src/dep/include/openssl/ct.h
Normal file
533
src/dep/include/openssl/ct.h
Normal file
@ -0,0 +1,533 @@
|
||||
/*
|
||||
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_CT_H
|
||||
# define HEADER_CT_H
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_CT
|
||||
# include <openssl/ossl_typ.h>
|
||||
# include <openssl/safestack.h>
|
||||
# include <openssl/x509.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
|
||||
/* Minimum RSA key size, from RFC6962 */
|
||||
# define SCT_MIN_RSA_BITS 2048
|
||||
|
||||
/* All hashes are SHA256 in v1 of Certificate Transparency */
|
||||
# define CT_V1_HASHLEN SHA256_DIGEST_LENGTH
|
||||
|
||||
typedef enum {
|
||||
CT_LOG_ENTRY_TYPE_NOT_SET = -1,
|
||||
CT_LOG_ENTRY_TYPE_X509 = 0,
|
||||
CT_LOG_ENTRY_TYPE_PRECERT = 1
|
||||
} ct_log_entry_type_t;
|
||||
|
||||
typedef enum {
|
||||
SCT_VERSION_NOT_SET = -1,
|
||||
SCT_VERSION_V1 = 0
|
||||
} sct_version_t;
|
||||
|
||||
typedef enum {
|
||||
SCT_SOURCE_UNKNOWN,
|
||||
SCT_SOURCE_TLS_EXTENSION,
|
||||
SCT_SOURCE_X509V3_EXTENSION,
|
||||
SCT_SOURCE_OCSP_STAPLED_RESPONSE
|
||||
} sct_source_t;
|
||||
|
||||
typedef enum {
|
||||
SCT_VALIDATION_STATUS_NOT_SET,
|
||||
SCT_VALIDATION_STATUS_UNKNOWN_LOG,
|
||||
SCT_VALIDATION_STATUS_VALID,
|
||||
SCT_VALIDATION_STATUS_INVALID,
|
||||
SCT_VALIDATION_STATUS_UNVERIFIED,
|
||||
SCT_VALIDATION_STATUS_UNKNOWN_VERSION
|
||||
} sct_validation_status_t;
|
||||
|
||||
DEFINE_STACK_OF(SCT)
|
||||
DEFINE_STACK_OF(CTLOG)
|
||||
|
||||
/******************************************
|
||||
* CT policy evaluation context functions *
|
||||
******************************************/
|
||||
|
||||
/*
|
||||
* Creates a new, empty policy evaluation context.
|
||||
* The caller is responsible for calling CT_POLICY_EVAL_CTX_free when finished
|
||||
* with the CT_POLICY_EVAL_CTX.
|
||||
*/
|
||||
CT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new(void);
|
||||
|
||||
/* Deletes a policy evaluation context and anything it owns. */
|
||||
void CT_POLICY_EVAL_CTX_free(CT_POLICY_EVAL_CTX *ctx);
|
||||
|
||||
/* Gets the peer certificate that the SCTs are for */
|
||||
X509* CT_POLICY_EVAL_CTX_get0_cert(const CT_POLICY_EVAL_CTX *ctx);
|
||||
|
||||
/*
|
||||
* Sets the certificate associated with the received SCTs.
|
||||
* Increments the reference count of cert.
|
||||
* Returns 1 on success, 0 otherwise.
|
||||
*/
|
||||
int CT_POLICY_EVAL_CTX_set1_cert(CT_POLICY_EVAL_CTX *ctx, X509 *cert);
|
||||
|
||||
/* Gets the issuer of the aforementioned certificate */
|
||||
X509* CT_POLICY_EVAL_CTX_get0_issuer(const CT_POLICY_EVAL_CTX *ctx);
|
||||
|
||||
/*
|
||||
* Sets the issuer of the certificate associated with the received SCTs.
|
||||
* Increments the reference count of issuer.
|
||||
* Returns 1 on success, 0 otherwise.
|
||||
*/
|
||||
int CT_POLICY_EVAL_CTX_set1_issuer(CT_POLICY_EVAL_CTX *ctx, X509 *issuer);
|
||||
|
||||
/* Gets the CT logs that are trusted sources of SCTs */
|
||||
const CTLOG_STORE *CT_POLICY_EVAL_CTX_get0_log_store(const CT_POLICY_EVAL_CTX *ctx);
|
||||
|
||||
/* Sets the log store that is in use. It must outlive the CT_POLICY_EVAL_CTX. */
|
||||
void CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE(CT_POLICY_EVAL_CTX *ctx,
|
||||
CTLOG_STORE *log_store);
|
||||
|
||||
/*
|
||||
* Gets the time, in milliseconds since the Unix epoch, that will be used as the
|
||||
* current time when checking whether an SCT was issued in the future.
|
||||
* Such SCTs will fail validation, as required by RFC6962.
|
||||
*/
|
||||
uint64_t CT_POLICY_EVAL_CTX_get_time(const CT_POLICY_EVAL_CTX *ctx);
|
||||
|
||||
/*
|
||||
* Sets the time to evaluate SCTs against, in milliseconds since the Unix epoch.
|
||||
* If an SCT's timestamp is after this time, it will be interpreted as having
|
||||
* been issued in the future. RFC6962 states that "TLS clients MUST reject SCTs
|
||||
* whose timestamp is in the future", so an SCT will not validate in this case.
|
||||
*/
|
||||
void CT_POLICY_EVAL_CTX_set_time(CT_POLICY_EVAL_CTX *ctx, uint64_t time_in_ms);
|
||||
|
||||
/*****************
|
||||
* SCT functions *
|
||||
*****************/
|
||||
|
||||
/*
|
||||
* Creates a new, blank SCT.
|
||||
* The caller is responsible for calling SCT_free when finished with the SCT.
|
||||
*/
|
||||
SCT *SCT_new(void);
|
||||
|
||||
/*
|
||||
* Creates a new SCT from some base64-encoded strings.
|
||||
* The caller is responsible for calling SCT_free when finished with the SCT.
|
||||
*/
|
||||
SCT *SCT_new_from_base64(unsigned char version,
|
||||
const char *logid_base64,
|
||||
ct_log_entry_type_t entry_type,
|
||||
uint64_t timestamp,
|
||||
const char *extensions_base64,
|
||||
const char *signature_base64);
|
||||
|
||||
/*
|
||||
* Frees the SCT and the underlying data structures.
|
||||
*/
|
||||
void SCT_free(SCT *sct);
|
||||
|
||||
/*
|
||||
* Free a stack of SCTs, and the underlying SCTs themselves.
|
||||
* Intended to be compatible with X509V3_EXT_FREE.
|
||||
*/
|
||||
void SCT_LIST_free(STACK_OF(SCT) *a);
|
||||
|
||||
/*
|
||||
* Returns the version of the SCT.
|
||||
*/
|
||||
sct_version_t SCT_get_version(const SCT *sct);
|
||||
|
||||
/*
|
||||
* Set the version of an SCT.
|
||||
* Returns 1 on success, 0 if the version is unrecognized.
|
||||
*/
|
||||
__owur int SCT_set_version(SCT *sct, sct_version_t version);
|
||||
|
||||
/*
|
||||
* Returns the log entry type of the SCT.
|
||||
*/
|
||||
ct_log_entry_type_t SCT_get_log_entry_type(const SCT *sct);
|
||||
|
||||
/*
|
||||
* Set the log entry type of an SCT.
|
||||
* Returns 1 on success, 0 otherwise.
|
||||
*/
|
||||
__owur int SCT_set_log_entry_type(SCT *sct, ct_log_entry_type_t entry_type);
|
||||
|
||||
/*
|
||||
* Gets the ID of the log that an SCT came from.
|
||||
* Ownership of the log ID remains with the SCT.
|
||||
* Returns the length of the log ID.
|
||||
*/
|
||||
size_t SCT_get0_log_id(const SCT *sct, unsigned char **log_id);
|
||||
|
||||
/*
|
||||
* Set the log ID of an SCT to point directly to the *log_id specified.
|
||||
* The SCT takes ownership of the specified pointer.
|
||||
* Returns 1 on success, 0 otherwise.
|
||||
*/
|
||||
__owur int SCT_set0_log_id(SCT *sct, unsigned char *log_id, size_t log_id_len);
|
||||
|
||||
/*
|
||||
* Set the log ID of an SCT.
|
||||
* This makes a copy of the log_id.
|
||||
* Returns 1 on success, 0 otherwise.
|
||||
*/
|
||||
__owur int SCT_set1_log_id(SCT *sct, const unsigned char *log_id,
|
||||
size_t log_id_len);
|
||||
|
||||
/*
|
||||
* Returns the timestamp for the SCT (epoch time in milliseconds).
|
||||
*/
|
||||
uint64_t SCT_get_timestamp(const SCT *sct);
|
||||
|
||||
/*
|
||||
* Set the timestamp of an SCT (epoch time in milliseconds).
|
||||
*/
|
||||
void SCT_set_timestamp(SCT *sct, uint64_t timestamp);
|
||||
|
||||
/*
|
||||
* Return the NID for the signature used by the SCT.
|
||||
* For CT v1, this will be either NID_sha256WithRSAEncryption or
|
||||
* NID_ecdsa_with_SHA256 (or NID_undef if incorrect/unset).
|
||||
*/
|
||||
int SCT_get_signature_nid(const SCT *sct);
|
||||
|
||||
/*
|
||||
* Set the signature type of an SCT
|
||||
* For CT v1, this should be either NID_sha256WithRSAEncryption or
|
||||
* NID_ecdsa_with_SHA256.
|
||||
* Returns 1 on success, 0 otherwise.
|
||||
*/
|
||||
__owur int SCT_set_signature_nid(SCT *sct, int nid);
|
||||
|
||||
/*
|
||||
* Set *ext to point to the extension data for the SCT. ext must not be NULL.
|
||||
* The SCT retains ownership of this pointer.
|
||||
* Returns length of the data pointed to.
|
||||
*/
|
||||
size_t SCT_get0_extensions(const SCT *sct, unsigned char **ext);
|
||||
|
||||
/*
|
||||
* Set the extensions of an SCT to point directly to the *ext specified.
|
||||
* The SCT takes ownership of the specified pointer.
|
||||
*/
|
||||
void SCT_set0_extensions(SCT *sct, unsigned char *ext, size_t ext_len);
|
||||
|
||||
/*
|
||||
* Set the extensions of an SCT.
|
||||
* This takes a copy of the ext.
|
||||
* Returns 1 on success, 0 otherwise.
|
||||
*/
|
||||
__owur int SCT_set1_extensions(SCT *sct, const unsigned char *ext,
|
||||
size_t ext_len);
|
||||
|
||||
/*
|
||||
* Set *sig to point to the signature for the SCT. sig must not be NULL.
|
||||
* The SCT retains ownership of this pointer.
|
||||
* Returns length of the data pointed to.
|
||||
*/
|
||||
size_t SCT_get0_signature(const SCT *sct, unsigned char **sig);
|
||||
|
||||
/*
|
||||
* Set the signature of an SCT to point directly to the *sig specified.
|
||||
* The SCT takes ownership of the specified pointer.
|
||||
*/
|
||||
void SCT_set0_signature(SCT *sct, unsigned char *sig, size_t sig_len);
|
||||
|
||||
/*
|
||||
* Set the signature of an SCT to be a copy of the *sig specified.
|
||||
* Returns 1 on success, 0 otherwise.
|
||||
*/
|
||||
__owur int SCT_set1_signature(SCT *sct, const unsigned char *sig,
|
||||
size_t sig_len);
|
||||
|
||||
/*
|
||||
* The origin of this SCT, e.g. TLS extension, OCSP response, etc.
|
||||
*/
|
||||
sct_source_t SCT_get_source(const SCT *sct);
|
||||
|
||||
/*
|
||||
* Set the origin of this SCT, e.g. TLS extension, OCSP response, etc.
|
||||
* Returns 1 on success, 0 otherwise.
|
||||
*/
|
||||
__owur int SCT_set_source(SCT *sct, sct_source_t source);
|
||||
|
||||
/*
|
||||
* Returns a text string describing the validation status of |sct|.
|
||||
*/
|
||||
const char *SCT_validation_status_string(const SCT *sct);
|
||||
|
||||
/*
|
||||
* Pretty-prints an |sct| to |out|.
|
||||
* It will be indented by the number of spaces specified by |indent|.
|
||||
* If |logs| is not NULL, it will be used to lookup the CT log that the SCT came
|
||||
* from, so that the log name can be printed.
|
||||
*/
|
||||
void SCT_print(const SCT *sct, BIO *out, int indent, const CTLOG_STORE *logs);
|
||||
|
||||
/*
|
||||
* Pretty-prints an |sct_list| to |out|.
|
||||
* It will be indented by the number of spaces specified by |indent|.
|
||||
* SCTs will be delimited by |separator|.
|
||||
* If |logs| is not NULL, it will be used to lookup the CT log that each SCT
|
||||
* came from, so that the log names can be printed.
|
||||
*/
|
||||
void SCT_LIST_print(const STACK_OF(SCT) *sct_list, BIO *out, int indent,
|
||||
const char *separator, const CTLOG_STORE *logs);
|
||||
|
||||
/*
|
||||
* Gets the last result of validating this SCT.
|
||||
* If it has not been validated yet, returns SCT_VALIDATION_STATUS_NOT_SET.
|
||||
*/
|
||||
sct_validation_status_t SCT_get_validation_status(const SCT *sct);
|
||||
|
||||
/*
|
||||
* Validates the given SCT with the provided context.
|
||||
* Sets the "validation_status" field of the SCT.
|
||||
* Returns 1 if the SCT is valid and the signature verifies.
|
||||
* Returns 0 if the SCT is invalid or could not be verified.
|
||||
* Returns -1 if an error occurs.
|
||||
*/
|
||||
__owur int SCT_validate(SCT *sct, const CT_POLICY_EVAL_CTX *ctx);
|
||||
|
||||
/*
|
||||
* Validates the given list of SCTs with the provided context.
|
||||
* Sets the "validation_status" field of each SCT.
|
||||
* Returns 1 if there are no invalid SCTs and all signatures verify.
|
||||
* Returns 0 if at least one SCT is invalid or could not be verified.
|
||||
* Returns a negative integer if an error occurs.
|
||||
*/
|
||||
__owur int SCT_LIST_validate(const STACK_OF(SCT) *scts,
|
||||
CT_POLICY_EVAL_CTX *ctx);
|
||||
|
||||
|
||||
/*********************************
|
||||
* SCT parsing and serialisation *
|
||||
*********************************/
|
||||
|
||||
/*
|
||||
* Serialize (to TLS format) a stack of SCTs and return the length.
|
||||
* "a" must not be NULL.
|
||||
* If "pp" is NULL, just return the length of what would have been serialized.
|
||||
* If "pp" is not NULL and "*pp" is null, function will allocate a new pointer
|
||||
* for data that caller is responsible for freeing (only if function returns
|
||||
* successfully).
|
||||
* If "pp" is NULL and "*pp" is not NULL, caller is responsible for ensuring
|
||||
* that "*pp" is large enough to accept all of the serialized data.
|
||||
* Returns < 0 on error, >= 0 indicating bytes written (or would have been)
|
||||
* on success.
|
||||
*/
|
||||
__owur int i2o_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **pp);
|
||||
|
||||
/*
|
||||
* Convert TLS format SCT list to a stack of SCTs.
|
||||
* If "a" or "*a" is NULL, a new stack will be created that the caller is
|
||||
* responsible for freeing (by calling SCT_LIST_free).
|
||||
* "**pp" and "*pp" must not be NULL.
|
||||
* Upon success, "*pp" will point to after the last bytes read, and a stack
|
||||
* will be returned.
|
||||
* Upon failure, a NULL pointer will be returned, and the position of "*pp" is
|
||||
* not defined.
|
||||
*/
|
||||
STACK_OF(SCT) *o2i_SCT_LIST(STACK_OF(SCT) **a, const unsigned char **pp,
|
||||
size_t len);
|
||||
|
||||
/*
|
||||
* Serialize (to DER format) a stack of SCTs and return the length.
|
||||
* "a" must not be NULL.
|
||||
* If "pp" is NULL, just returns the length of what would have been serialized.
|
||||
* If "pp" is not NULL and "*pp" is null, function will allocate a new pointer
|
||||
* for data that caller is responsible for freeing (only if function returns
|
||||
* successfully).
|
||||
* If "pp" is NULL and "*pp" is not NULL, caller is responsible for ensuring
|
||||
* that "*pp" is large enough to accept all of the serialized data.
|
||||
* Returns < 0 on error, >= 0 indicating bytes written (or would have been)
|
||||
* on success.
|
||||
*/
|
||||
__owur int i2d_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **pp);
|
||||
|
||||
/*
|
||||
* Parses an SCT list in DER format and returns it.
|
||||
* If "a" or "*a" is NULL, a new stack will be created that the caller is
|
||||
* responsible for freeing (by calling SCT_LIST_free).
|
||||
* "**pp" and "*pp" must not be NULL.
|
||||
* Upon success, "*pp" will point to after the last bytes read, and a stack
|
||||
* will be returned.
|
||||
* Upon failure, a NULL pointer will be returned, and the position of "*pp" is
|
||||
* not defined.
|
||||
*/
|
||||
STACK_OF(SCT) *d2i_SCT_LIST(STACK_OF(SCT) **a, const unsigned char **pp,
|
||||
long len);
|
||||
|
||||
/*
|
||||
* Serialize (to TLS format) an |sct| and write it to |out|.
|
||||
* If |out| is null, no SCT will be output but the length will still be returned.
|
||||
* If |out| points to a null pointer, a string will be allocated to hold the
|
||||
* TLS-format SCT. It is the responsibility of the caller to free it.
|
||||
* If |out| points to an allocated string, the TLS-format SCT will be written
|
||||
* to it.
|
||||
* The length of the SCT in TLS format will be returned.
|
||||
*/
|
||||
__owur int i2o_SCT(const SCT *sct, unsigned char **out);
|
||||
|
||||
/*
|
||||
* Parses an SCT in TLS format and returns it.
|
||||
* If |psct| is not null, it will end up pointing to the parsed SCT. If it
|
||||
* already points to a non-null pointer, the pointer will be free'd.
|
||||
* |in| should be a pointer to a string containing the TLS-format SCT.
|
||||
* |in| will be advanced to the end of the SCT if parsing succeeds.
|
||||
* |len| should be the length of the SCT in |in|.
|
||||
* Returns NULL if an error occurs.
|
||||
* If the SCT is an unsupported version, only the SCT's 'sct' and 'sct_len'
|
||||
* fields will be populated (with |in| and |len| respectively).
|
||||
*/
|
||||
SCT *o2i_SCT(SCT **psct, const unsigned char **in, size_t len);
|
||||
|
||||
/********************
|
||||
* CT log functions *
|
||||
********************/
|
||||
|
||||
/*
|
||||
* Creates a new CT log instance with the given |public_key| and |name|.
|
||||
* Takes ownership of |public_key| but copies |name|.
|
||||
* Returns NULL if malloc fails or if |public_key| cannot be converted to DER.
|
||||
* Should be deleted by the caller using CTLOG_free when no longer needed.
|
||||
*/
|
||||
CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name);
|
||||
|
||||
/*
|
||||
* Creates a new CTLOG instance with the base64-encoded SubjectPublicKeyInfo DER
|
||||
* in |pkey_base64|. The |name| is a string to help users identify this log.
|
||||
* Returns 1 on success, 0 on failure.
|
||||
* Should be deleted by the caller using CTLOG_free when no longer needed.
|
||||
*/
|
||||
int CTLOG_new_from_base64(CTLOG ** ct_log,
|
||||
const char *pkey_base64, const char *name);
|
||||
|
||||
/*
|
||||
* Deletes a CT log instance and its fields.
|
||||
*/
|
||||
void CTLOG_free(CTLOG *log);
|
||||
|
||||
/* Gets the name of the CT log */
|
||||
const char *CTLOG_get0_name(const CTLOG *log);
|
||||
/* Gets the ID of the CT log */
|
||||
void CTLOG_get0_log_id(const CTLOG *log, const uint8_t **log_id,
|
||||
size_t *log_id_len);
|
||||
/* Gets the public key of the CT log */
|
||||
EVP_PKEY *CTLOG_get0_public_key(const CTLOG *log);
|
||||
|
||||
/**************************
|
||||
* CT log store functions *
|
||||
**************************/
|
||||
|
||||
/*
|
||||
* Creates a new CT log store.
|
||||
* Should be deleted by the caller using CTLOG_STORE_free when no longer needed.
|
||||
*/
|
||||
CTLOG_STORE *CTLOG_STORE_new(void);
|
||||
|
||||
/*
|
||||
* Deletes a CT log store and all of the CT log instances held within.
|
||||
*/
|
||||
void CTLOG_STORE_free(CTLOG_STORE *store);
|
||||
|
||||
/*
|
||||
* Finds a CT log in the store based on its log ID.
|
||||
* Returns the CT log, or NULL if no match is found.
|
||||
*/
|
||||
const CTLOG *CTLOG_STORE_get0_log_by_id(const CTLOG_STORE *store,
|
||||
const uint8_t *log_id,
|
||||
size_t log_id_len);
|
||||
|
||||
/*
|
||||
* Loads a CT log list into a |store| from a |file|.
|
||||
* Returns 1 if loading is successful, or 0 otherwise.
|
||||
*/
|
||||
__owur int CTLOG_STORE_load_file(CTLOG_STORE *store, const char *file);
|
||||
|
||||
/*
|
||||
* Loads the default CT log list into a |store|.
|
||||
* See internal/cryptlib.h for the environment variable and file path that are
|
||||
* consulted to find the default file.
|
||||
* Returns 1 if loading is successful, or 0 otherwise.
|
||||
*/
|
||||
__owur int CTLOG_STORE_load_default_file(CTLOG_STORE *store);
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/*
|
||||
* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
|
||||
int ERR_load_CT_strings(void);
|
||||
|
||||
/* Error codes for the CT functions. */
|
||||
|
||||
/* Function codes. */
|
||||
# define CT_F_CTLOG_NEW 117
|
||||
# define CT_F_CTLOG_NEW_FROM_BASE64 118
|
||||
# define CT_F_CTLOG_NEW_FROM_CONF 119
|
||||
# define CT_F_CTLOG_STORE_LOAD_CTX_NEW 122
|
||||
# define CT_F_CTLOG_STORE_LOAD_FILE 123
|
||||
# define CT_F_CTLOG_STORE_LOAD_LOG 130
|
||||
# define CT_F_CTLOG_STORE_NEW 131
|
||||
# define CT_F_CT_BASE64_DECODE 124
|
||||
# define CT_F_CT_POLICY_EVAL_CTX_NEW 133
|
||||
# define CT_F_CT_V1_LOG_ID_FROM_PKEY 125
|
||||
# define CT_F_I2O_SCT 107
|
||||
# define CT_F_I2O_SCT_LIST 108
|
||||
# define CT_F_I2O_SCT_SIGNATURE 109
|
||||
# define CT_F_O2I_SCT 110
|
||||
# define CT_F_O2I_SCT_LIST 111
|
||||
# define CT_F_O2I_SCT_SIGNATURE 112
|
||||
# define CT_F_SCT_CTX_NEW 126
|
||||
# define CT_F_SCT_CTX_VERIFY 128
|
||||
# define CT_F_SCT_NEW 100
|
||||
# define CT_F_SCT_NEW_FROM_BASE64 127
|
||||
# define CT_F_SCT_SET0_LOG_ID 101
|
||||
# define CT_F_SCT_SET1_EXTENSIONS 114
|
||||
# define CT_F_SCT_SET1_LOG_ID 115
|
||||
# define CT_F_SCT_SET1_SIGNATURE 116
|
||||
# define CT_F_SCT_SET_LOG_ENTRY_TYPE 102
|
||||
# define CT_F_SCT_SET_SIGNATURE_NID 103
|
||||
# define CT_F_SCT_SET_VERSION 104
|
||||
|
||||
/* Reason codes. */
|
||||
# define CT_R_BASE64_DECODE_ERROR 108
|
||||
# define CT_R_INVALID_LOG_ID_LENGTH 100
|
||||
# define CT_R_LOG_CONF_INVALID 109
|
||||
# define CT_R_LOG_CONF_INVALID_KEY 110
|
||||
# define CT_R_LOG_CONF_MISSING_DESCRIPTION 111
|
||||
# define CT_R_LOG_CONF_MISSING_KEY 112
|
||||
# define CT_R_LOG_KEY_INVALID 113
|
||||
# define CT_R_SCT_FUTURE_TIMESTAMP 116
|
||||
# define CT_R_SCT_INVALID 104
|
||||
# define CT_R_SCT_INVALID_SIGNATURE 107
|
||||
# define CT_R_SCT_LIST_INVALID 105
|
||||
# define CT_R_SCT_LOG_ID_MISMATCH 114
|
||||
# define CT_R_SCT_NOT_SET 106
|
||||
# define CT_R_SCT_UNSUPPORTED_VERSION 115
|
||||
# define CT_R_UNRECOGNIZED_SIGNATURE_NID 101
|
||||
# define CT_R_UNSUPPORTED_ENTRY_TYPE 102
|
||||
# define CT_R_UNSUPPORTED_VERSION 103
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
@ -1,244 +1,174 @@
|
||||
/* crypto/des/des.h */
|
||||
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_NEW_DES_H
|
||||
#define HEADER_NEW_DES_H
|
||||
#ifndef HEADER_DES_H
|
||||
# define HEADER_DES_H
|
||||
|
||||
#include <openssl/e_os2.h> /* OPENSSL_EXTERN, OPENSSL_NO_DES,
|
||||
DES_LONG (via openssl/opensslconf.h */
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
#ifdef OPENSSL_NO_DES
|
||||
#error DES is disabled.
|
||||
#endif
|
||||
|
||||
#ifdef OPENSSL_BUILD_SHLIBCRYPTO
|
||||
# undef OPENSSL_EXTERN
|
||||
# define OPENSSL_EXTERN OPENSSL_EXPORT
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifndef OPENSSL_NO_DES
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
# endif
|
||||
# include <openssl/e_os2.h>
|
||||
|
||||
typedef unsigned int DES_LONG;
|
||||
|
||||
# ifdef OPENSSL_BUILD_SHLIBCRYPTO
|
||||
# undef OPENSSL_EXTERN
|
||||
# define OPENSSL_EXTERN OPENSSL_EXPORT
|
||||
# endif
|
||||
|
||||
typedef unsigned char DES_cblock[8];
|
||||
typedef /* const */ unsigned char const_DES_cblock[8];
|
||||
/* With "const", gcc 2.8.1 on Solaris thinks that DES_cblock *
|
||||
* and const_DES_cblock * are incompatible pointer types. */
|
||||
/*
|
||||
* With "const", gcc 2.8.1 on Solaris thinks that DES_cblock * and
|
||||
* const_DES_cblock * are incompatible pointer types.
|
||||
*/
|
||||
|
||||
typedef struct DES_ks
|
||||
{
|
||||
union
|
||||
{
|
||||
DES_cblock cblock;
|
||||
/* make sure things are correct size on machines with
|
||||
* 8 byte longs */
|
||||
DES_LONG deslong[2];
|
||||
} ks[16];
|
||||
} DES_key_schedule;
|
||||
typedef struct DES_ks {
|
||||
union {
|
||||
DES_cblock cblock;
|
||||
/*
|
||||
* make sure things are correct size on machines with 8 byte longs
|
||||
*/
|
||||
DES_LONG deslong[2];
|
||||
} ks[16];
|
||||
} DES_key_schedule;
|
||||
|
||||
#ifndef OPENSSL_DISABLE_OLD_DES_SUPPORT
|
||||
# ifndef OPENSSL_ENABLE_OLD_DES_SUPPORT
|
||||
# define OPENSSL_ENABLE_OLD_DES_SUPPORT
|
||||
# endif
|
||||
#endif
|
||||
# define DES_KEY_SZ (sizeof(DES_cblock))
|
||||
# define DES_SCHEDULE_SZ (sizeof(DES_key_schedule))
|
||||
|
||||
#ifdef OPENSSL_ENABLE_OLD_DES_SUPPORT
|
||||
# include <openssl/des_old.h>
|
||||
#endif
|
||||
# define DES_ENCRYPT 1
|
||||
# define DES_DECRYPT 0
|
||||
|
||||
#define DES_KEY_SZ (sizeof(DES_cblock))
|
||||
#define DES_SCHEDULE_SZ (sizeof(DES_key_schedule))
|
||||
# define DES_CBC_MODE 0
|
||||
# define DES_PCBC_MODE 1
|
||||
|
||||
#define DES_ENCRYPT 1
|
||||
#define DES_DECRYPT 0
|
||||
# define DES_ecb2_encrypt(i,o,k1,k2,e) \
|
||||
DES_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))
|
||||
|
||||
#define DES_CBC_MODE 0
|
||||
#define DES_PCBC_MODE 1
|
||||
# define DES_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \
|
||||
DES_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))
|
||||
|
||||
#define DES_ecb2_encrypt(i,o,k1,k2,e) \
|
||||
DES_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e))
|
||||
# define DES_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \
|
||||
DES_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))
|
||||
|
||||
#define DES_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \
|
||||
DES_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e))
|
||||
# define DES_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \
|
||||
DES_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))
|
||||
|
||||
#define DES_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \
|
||||
DES_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e))
|
||||
|
||||
#define DES_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \
|
||||
DES_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n))
|
||||
|
||||
OPENSSL_DECLARE_GLOBAL(int,DES_check_key); /* defaults to false */
|
||||
#define DES_check_key OPENSSL_GLOBAL_REF(DES_check_key)
|
||||
OPENSSL_DECLARE_GLOBAL(int,DES_rw_mode); /* defaults to DES_PCBC_MODE */
|
||||
#define DES_rw_mode OPENSSL_GLOBAL_REF(DES_rw_mode)
|
||||
OPENSSL_DECLARE_GLOBAL(int, DES_check_key); /* defaults to false */
|
||||
# define DES_check_key OPENSSL_GLOBAL_REF(DES_check_key)
|
||||
|
||||
const char *DES_options(void);
|
||||
void DES_ecb3_encrypt(const_DES_cblock *input, DES_cblock *output,
|
||||
DES_key_schedule *ks1,DES_key_schedule *ks2,
|
||||
DES_key_schedule *ks3, int enc);
|
||||
DES_LONG DES_cbc_cksum(const unsigned char *input,DES_cblock *output,
|
||||
long length,DES_key_schedule *schedule,
|
||||
const_DES_cblock *ivec);
|
||||
DES_key_schedule *ks1, DES_key_schedule *ks2,
|
||||
DES_key_schedule *ks3, int enc);
|
||||
DES_LONG DES_cbc_cksum(const unsigned char *input, DES_cblock *output,
|
||||
long length, DES_key_schedule *schedule,
|
||||
const_DES_cblock *ivec);
|
||||
/* DES_cbc_encrypt does not update the IV! Use DES_ncbc_encrypt instead. */
|
||||
void DES_cbc_encrypt(const unsigned char *input,unsigned char *output,
|
||||
long length,DES_key_schedule *schedule,DES_cblock *ivec,
|
||||
int enc);
|
||||
void DES_ncbc_encrypt(const unsigned char *input,unsigned char *output,
|
||||
long length,DES_key_schedule *schedule,DES_cblock *ivec,
|
||||
int enc);
|
||||
void DES_xcbc_encrypt(const unsigned char *input,unsigned char *output,
|
||||
long length,DES_key_schedule *schedule,DES_cblock *ivec,
|
||||
const_DES_cblock *inw,const_DES_cblock *outw,int enc);
|
||||
void DES_cfb_encrypt(const unsigned char *in,unsigned char *out,int numbits,
|
||||
long length,DES_key_schedule *schedule,DES_cblock *ivec,
|
||||
int enc);
|
||||
void DES_ecb_encrypt(const_DES_cblock *input,DES_cblock *output,
|
||||
DES_key_schedule *ks,int enc);
|
||||
void DES_cbc_encrypt(const unsigned char *input, unsigned char *output,
|
||||
long length, DES_key_schedule *schedule,
|
||||
DES_cblock *ivec, int enc);
|
||||
void DES_ncbc_encrypt(const unsigned char *input, unsigned char *output,
|
||||
long length, DES_key_schedule *schedule,
|
||||
DES_cblock *ivec, int enc);
|
||||
void DES_xcbc_encrypt(const unsigned char *input, unsigned char *output,
|
||||
long length, DES_key_schedule *schedule,
|
||||
DES_cblock *ivec, const_DES_cblock *inw,
|
||||
const_DES_cblock *outw, int enc);
|
||||
void DES_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits,
|
||||
long length, DES_key_schedule *schedule,
|
||||
DES_cblock *ivec, int enc);
|
||||
void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output,
|
||||
DES_key_schedule *ks, int enc);
|
||||
|
||||
/* This is the DES encryption function that gets called by just about
|
||||
every other DES routine in the library. You should not use this
|
||||
function except to implement 'modes' of DES. I say this because the
|
||||
functions that call this routine do the conversion from 'char *' to
|
||||
long, and this needs to be done to make sure 'non-aligned' memory
|
||||
access do not occur. The characters are loaded 'little endian'.
|
||||
Data is a pointer to 2 unsigned long's and ks is the
|
||||
DES_key_schedule to use. enc, is non zero specifies encryption,
|
||||
zero if decryption. */
|
||||
void DES_encrypt1(DES_LONG *data,DES_key_schedule *ks, int enc);
|
||||
/*
|
||||
* This is the DES encryption function that gets called by just about every
|
||||
* other DES routine in the library. You should not use this function except
|
||||
* to implement 'modes' of DES. I say this because the functions that call
|
||||
* this routine do the conversion from 'char *' to long, and this needs to be
|
||||
* done to make sure 'non-aligned' memory access do not occur. The
|
||||
* characters are loaded 'little endian'. Data is a pointer to 2 unsigned
|
||||
* long's and ks is the DES_key_schedule to use. enc, is non zero specifies
|
||||
* encryption, zero if decryption.
|
||||
*/
|
||||
void DES_encrypt1(DES_LONG *data, DES_key_schedule *ks, int enc);
|
||||
|
||||
/* This functions is the same as DES_encrypt1() except that the DES
|
||||
initial permutation (IP) and final permutation (FP) have been left
|
||||
out. As for DES_encrypt1(), you should not use this function.
|
||||
It is used by the routines in the library that implement triple DES.
|
||||
IP() DES_encrypt2() DES_encrypt2() DES_encrypt2() FP() is the same
|
||||
as DES_encrypt1() DES_encrypt1() DES_encrypt1() except faster :-). */
|
||||
void DES_encrypt2(DES_LONG *data,DES_key_schedule *ks, int enc);
|
||||
/*
|
||||
* This functions is the same as DES_encrypt1() except that the DES initial
|
||||
* permutation (IP) and final permutation (FP) have been left out. As for
|
||||
* DES_encrypt1(), you should not use this function. It is used by the
|
||||
* routines in the library that implement triple DES. IP() DES_encrypt2()
|
||||
* DES_encrypt2() DES_encrypt2() FP() is the same as DES_encrypt1()
|
||||
* DES_encrypt1() DES_encrypt1() except faster :-).
|
||||
*/
|
||||
void DES_encrypt2(DES_LONG *data, DES_key_schedule *ks, int enc);
|
||||
|
||||
void DES_encrypt3(DES_LONG *data, DES_key_schedule *ks1,
|
||||
DES_key_schedule *ks2, DES_key_schedule *ks3);
|
||||
DES_key_schedule *ks2, DES_key_schedule *ks3);
|
||||
void DES_decrypt3(DES_LONG *data, DES_key_schedule *ks1,
|
||||
DES_key_schedule *ks2, DES_key_schedule *ks3);
|
||||
void DES_ede3_cbc_encrypt(const unsigned char *input,unsigned char *output,
|
||||
long length,
|
||||
DES_key_schedule *ks1,DES_key_schedule *ks2,
|
||||
DES_key_schedule *ks3,DES_cblock *ivec,int enc);
|
||||
void DES_ede3_cbcm_encrypt(const unsigned char *in,unsigned char *out,
|
||||
long length,
|
||||
DES_key_schedule *ks1,DES_key_schedule *ks2,
|
||||
DES_key_schedule *ks3,
|
||||
DES_cblock *ivec1,DES_cblock *ivec2,
|
||||
int enc);
|
||||
void DES_ede3_cfb64_encrypt(const unsigned char *in,unsigned char *out,
|
||||
long length,DES_key_schedule *ks1,
|
||||
DES_key_schedule *ks2,DES_key_schedule *ks3,
|
||||
DES_cblock *ivec,int *num,int enc);
|
||||
void DES_ede3_cfb_encrypt(const unsigned char *in,unsigned char *out,
|
||||
int numbits,long length,DES_key_schedule *ks1,
|
||||
DES_key_schedule *ks2,DES_key_schedule *ks3,
|
||||
DES_cblock *ivec,int enc);
|
||||
void DES_ede3_ofb64_encrypt(const unsigned char *in,unsigned char *out,
|
||||
long length,DES_key_schedule *ks1,
|
||||
DES_key_schedule *ks2,DES_key_schedule *ks3,
|
||||
DES_cblock *ivec,int *num);
|
||||
|
||||
void DES_xwhite_in2out(const_DES_cblock *DES_key,const_DES_cblock *in_white,
|
||||
DES_cblock *out_white);
|
||||
|
||||
int DES_enc_read(int fd,void *buf,int len,DES_key_schedule *sched,
|
||||
DES_cblock *iv);
|
||||
int DES_enc_write(int fd,const void *buf,int len,DES_key_schedule *sched,
|
||||
DES_cblock *iv);
|
||||
char *DES_fcrypt(const char *buf,const char *salt, char *ret);
|
||||
char *DES_crypt(const char *buf,const char *salt);
|
||||
void DES_ofb_encrypt(const unsigned char *in,unsigned char *out,int numbits,
|
||||
long length,DES_key_schedule *schedule,DES_cblock *ivec);
|
||||
void DES_pcbc_encrypt(const unsigned char *input,unsigned char *output,
|
||||
long length,DES_key_schedule *schedule,DES_cblock *ivec,
|
||||
int enc);
|
||||
DES_LONG DES_quad_cksum(const unsigned char *input,DES_cblock output[],
|
||||
long length,int out_count,DES_cblock *seed);
|
||||
DES_key_schedule *ks2, DES_key_schedule *ks3);
|
||||
void DES_ede3_cbc_encrypt(const unsigned char *input, unsigned char *output,
|
||||
long length,
|
||||
DES_key_schedule *ks1, DES_key_schedule *ks2,
|
||||
DES_key_schedule *ks3, DES_cblock *ivec, int enc);
|
||||
void DES_ede3_cfb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, DES_key_schedule *ks1,
|
||||
DES_key_schedule *ks2, DES_key_schedule *ks3,
|
||||
DES_cblock *ivec, int *num, int enc);
|
||||
void DES_ede3_cfb_encrypt(const unsigned char *in, unsigned char *out,
|
||||
int numbits, long length, DES_key_schedule *ks1,
|
||||
DES_key_schedule *ks2, DES_key_schedule *ks3,
|
||||
DES_cblock *ivec, int enc);
|
||||
void DES_ede3_ofb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, DES_key_schedule *ks1,
|
||||
DES_key_schedule *ks2, DES_key_schedule *ks3,
|
||||
DES_cblock *ivec, int *num);
|
||||
char *DES_fcrypt(const char *buf, const char *salt, char *ret);
|
||||
char *DES_crypt(const char *buf, const char *salt);
|
||||
void DES_ofb_encrypt(const unsigned char *in, unsigned char *out, int numbits,
|
||||
long length, DES_key_schedule *schedule,
|
||||
DES_cblock *ivec);
|
||||
void DES_pcbc_encrypt(const unsigned char *input, unsigned char *output,
|
||||
long length, DES_key_schedule *schedule,
|
||||
DES_cblock *ivec, int enc);
|
||||
DES_LONG DES_quad_cksum(const unsigned char *input, DES_cblock output[],
|
||||
long length, int out_count, DES_cblock *seed);
|
||||
int DES_random_key(DES_cblock *ret);
|
||||
void DES_set_odd_parity(DES_cblock *key);
|
||||
int DES_check_key_parity(const_DES_cblock *key);
|
||||
int DES_is_weak_key(const_DES_cblock *key);
|
||||
/* DES_set_key (= set_key = DES_key_sched = key_sched) calls
|
||||
/*
|
||||
* DES_set_key (= set_key = DES_key_sched = key_sched) calls
|
||||
* DES_set_key_checked if global variable DES_check_key is set,
|
||||
* DES_set_key_unchecked otherwise. */
|
||||
int DES_set_key(const_DES_cblock *key,DES_key_schedule *schedule);
|
||||
int DES_key_sched(const_DES_cblock *key,DES_key_schedule *schedule);
|
||||
int DES_set_key_checked(const_DES_cblock *key,DES_key_schedule *schedule);
|
||||
void DES_set_key_unchecked(const_DES_cblock *key,DES_key_schedule *schedule);
|
||||
void DES_string_to_key(const char *str,DES_cblock *key);
|
||||
void DES_string_to_2keys(const char *str,DES_cblock *key1,DES_cblock *key2);
|
||||
void DES_cfb64_encrypt(const unsigned char *in,unsigned char *out,long length,
|
||||
DES_key_schedule *schedule,DES_cblock *ivec,int *num,
|
||||
int enc);
|
||||
void DES_ofb64_encrypt(const unsigned char *in,unsigned char *out,long length,
|
||||
DES_key_schedule *schedule,DES_cblock *ivec,int *num);
|
||||
* DES_set_key_unchecked otherwise.
|
||||
*/
|
||||
int DES_set_key(const_DES_cblock *key, DES_key_schedule *schedule);
|
||||
int DES_key_sched(const_DES_cblock *key, DES_key_schedule *schedule);
|
||||
int DES_set_key_checked(const_DES_cblock *key, DES_key_schedule *schedule);
|
||||
void DES_set_key_unchecked(const_DES_cblock *key, DES_key_schedule *schedule);
|
||||
void DES_string_to_key(const char *str, DES_cblock *key);
|
||||
void DES_string_to_2keys(const char *str, DES_cblock *key1, DES_cblock *key2);
|
||||
void DES_cfb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, DES_key_schedule *schedule,
|
||||
DES_cblock *ivec, int *num, int enc);
|
||||
void DES_ofb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, DES_key_schedule *schedule,
|
||||
DES_cblock *ivec, int *num);
|
||||
|
||||
int DES_read_password(DES_cblock *key, const char *prompt, int verify);
|
||||
int DES_read_2passwords(DES_cblock *key1, DES_cblock *key2, const char *prompt,
|
||||
int verify);
|
||||
# define DES_fixup_key_parity DES_set_odd_parity
|
||||
|
||||
#define DES_fixup_key_parity DES_set_odd_parity
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
@ -1,165 +1,117 @@
|
||||
/* crypto/dh/dh.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_DH_H
|
||||
#define HEADER_DH_H
|
||||
# define HEADER_DH_H
|
||||
|
||||
#include <openssl/e_os2.h>
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
#ifdef OPENSSL_NO_DH
|
||||
#error DH is disabled.
|
||||
#endif
|
||||
# ifndef OPENSSL_NO_DH
|
||||
# include <openssl/e_os2.h>
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/asn1.h>
|
||||
# include <openssl/ossl_typ.h>
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# include <openssl/bn.h>
|
||||
# endif
|
||||
|
||||
#ifndef OPENSSL_NO_BIO
|
||||
#include <openssl/bio.h>
|
||||
#endif
|
||||
#include <openssl/ossl_typ.h>
|
||||
#ifndef OPENSSL_NO_DEPRECATED
|
||||
#include <openssl/bn.h>
|
||||
#endif
|
||||
|
||||
#define DH_FLAG_CACHE_MONT_P 0x01
|
||||
#define DH_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DH
|
||||
* implementation now uses constant time
|
||||
* modular exponentiation for secret exponents
|
||||
* by default. This flag causes the
|
||||
* faster variable sliding window method to
|
||||
* be used for all exponents.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
# endif
|
||||
|
||||
# ifndef OPENSSL_DH_MAX_MODULUS_BITS
|
||||
# define OPENSSL_DH_MAX_MODULUS_BITS 10000
|
||||
# endif
|
||||
|
||||
# define OPENSSL_DH_FIPS_MIN_MODULUS_BITS 1024
|
||||
|
||||
# define DH_FLAG_CACHE_MONT_P 0x01
|
||||
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
/*
|
||||
* Does nothing. Previously this switched off constant time behaviour.
|
||||
*/
|
||||
# define DH_FLAG_NO_EXP_CONSTTIME 0x00
|
||||
# endif
|
||||
|
||||
/*
|
||||
* If this flag is set the DH method is FIPS compliant and can be used in
|
||||
* FIPS mode. This is set in the validated module method. If an application
|
||||
* sets this flag in its own methods it is its responsibility to ensure the
|
||||
* result is compliant.
|
||||
*/
|
||||
|
||||
# define DH_FLAG_FIPS_METHOD 0x0400
|
||||
|
||||
/*
|
||||
* If this flag is set the operations normally disabled in FIPS mode are
|
||||
* permitted it is then the applications responsibility to ensure that the
|
||||
* usage is compliant.
|
||||
*/
|
||||
|
||||
# define DH_FLAG_NON_FIPS_ALLOW 0x0400
|
||||
|
||||
/* Already defined in ossl_typ.h */
|
||||
/* typedef struct dh_st DH; */
|
||||
/* typedef struct dh_method DH_METHOD; */
|
||||
|
||||
struct dh_method
|
||||
{
|
||||
const char *name;
|
||||
/* Methods here */
|
||||
int (*generate_key)(DH *dh);
|
||||
int (*compute_key)(unsigned char *key,const BIGNUM *pub_key,DH *dh);
|
||||
int (*bn_mod_exp)(const DH *dh, BIGNUM *r, const BIGNUM *a,
|
||||
const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
|
||||
BN_MONT_CTX *m_ctx); /* Can be null */
|
||||
DECLARE_ASN1_ITEM(DHparams)
|
||||
|
||||
int (*init)(DH *dh);
|
||||
int (*finish)(DH *dh);
|
||||
int flags;
|
||||
char *app_data;
|
||||
/* If this is non-NULL, it will be used to generate parameters */
|
||||
int (*generate_params)(DH *dh, int prime_len, int generator, BN_GENCB *cb);
|
||||
};
|
||||
|
||||
struct dh_st
|
||||
{
|
||||
/* This first argument is used to pick up errors when
|
||||
* a DH is passed instead of a EVP_PKEY */
|
||||
int pad;
|
||||
int version;
|
||||
BIGNUM *p;
|
||||
BIGNUM *g;
|
||||
long length; /* optional */
|
||||
BIGNUM *pub_key; /* g^x */
|
||||
BIGNUM *priv_key; /* x */
|
||||
|
||||
int flags;
|
||||
BN_MONT_CTX *method_mont_p;
|
||||
/* Place holders if we want to do X9.42 DH */
|
||||
BIGNUM *q;
|
||||
BIGNUM *j;
|
||||
unsigned char *seed;
|
||||
int seedlen;
|
||||
BIGNUM *counter;
|
||||
|
||||
int references;
|
||||
CRYPTO_EX_DATA ex_data;
|
||||
const DH_METHOD *meth;
|
||||
ENGINE *engine;
|
||||
};
|
||||
|
||||
#define DH_GENERATOR_2 2
|
||||
/* #define DH_GENERATOR_3 3 */
|
||||
#define DH_GENERATOR_5 5
|
||||
# define DH_GENERATOR_2 2
|
||||
/* #define DH_GENERATOR_3 3 */
|
||||
# define DH_GENERATOR_5 5
|
||||
|
||||
/* DH_check error codes */
|
||||
#define DH_CHECK_P_NOT_PRIME 0x01
|
||||
#define DH_CHECK_P_NOT_SAFE_PRIME 0x02
|
||||
#define DH_UNABLE_TO_CHECK_GENERATOR 0x04
|
||||
#define DH_NOT_SUITABLE_GENERATOR 0x08
|
||||
# define DH_CHECK_P_NOT_PRIME 0x01
|
||||
# define DH_CHECK_P_NOT_SAFE_PRIME 0x02
|
||||
# define DH_UNABLE_TO_CHECK_GENERATOR 0x04
|
||||
# define DH_NOT_SUITABLE_GENERATOR 0x08
|
||||
# define DH_CHECK_Q_NOT_PRIME 0x10
|
||||
# define DH_CHECK_INVALID_Q_VALUE 0x20
|
||||
# define DH_CHECK_INVALID_J_VALUE 0x40
|
||||
|
||||
/* DH_check_pub_key error codes */
|
||||
#define DH_CHECK_PUBKEY_TOO_SMALL 0x01
|
||||
#define DH_CHECK_PUBKEY_TOO_LARGE 0x02
|
||||
# define DH_CHECK_PUBKEY_TOO_SMALL 0x01
|
||||
# define DH_CHECK_PUBKEY_TOO_LARGE 0x02
|
||||
# define DH_CHECK_PUBKEY_INVALID 0x04
|
||||
|
||||
/* primes p where (p-1)/2 is prime too are called "safe"; we define
|
||||
this for backward compatibility: */
|
||||
#define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME
|
||||
/*
|
||||
* primes p where (p-1)/2 is prime too are called "safe"; we define this for
|
||||
* backward compatibility:
|
||||
*/
|
||||
# define DH_CHECK_P_NOT_STRONG_PRIME DH_CHECK_P_NOT_SAFE_PRIME
|
||||
|
||||
#define DHparams_dup(x) ASN1_dup_of_const(DH,i2d_DHparams,d2i_DHparams,x)
|
||||
#define d2i_DHparams_fp(fp,x) (DH *)ASN1_d2i_fp((char *(*)())DH_new, \
|
||||
(char *(*)())d2i_DHparams,(fp),(unsigned char **)(x))
|
||||
#define i2d_DHparams_fp(fp,x) ASN1_i2d_fp(i2d_DHparams,(fp), \
|
||||
(unsigned char *)(x))
|
||||
#define d2i_DHparams_bio(bp,x) ASN1_d2i_bio_of(DH,DH_new,d2i_DHparams,bp,x)
|
||||
#define i2d_DHparams_bio(bp,x) ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x)
|
||||
# define d2i_DHparams_fp(fp,x) \
|
||||
(DH *)ASN1_d2i_fp((char *(*)())DH_new, \
|
||||
(char *(*)())d2i_DHparams, \
|
||||
(fp), \
|
||||
(unsigned char **)(x))
|
||||
# define i2d_DHparams_fp(fp,x) \
|
||||
ASN1_i2d_fp(i2d_DHparams,(fp), (unsigned char *)(x))
|
||||
# define d2i_DHparams_bio(bp,x) \
|
||||
ASN1_d2i_bio_of(DH, DH_new, d2i_DHparams, bp, x)
|
||||
# define i2d_DHparams_bio(bp,x) \
|
||||
ASN1_i2d_bio_of_const(DH,i2d_DHparams,bp,x)
|
||||
|
||||
# define d2i_DHxparams_fp(fp,x) \
|
||||
(DH *)ASN1_d2i_fp((char *(*)())DH_new, \
|
||||
(char *(*)())d2i_DHxparams, \
|
||||
(fp), \
|
||||
(unsigned char **)(x))
|
||||
# define i2d_DHxparams_fp(fp,x) \
|
||||
ASN1_i2d_fp(i2d_DHxparams,(fp), (unsigned char *)(x))
|
||||
# define d2i_DHxparams_bio(bp,x) \
|
||||
ASN1_d2i_bio_of(DH, DH_new, d2i_DHxparams, bp, x)
|
||||
# define i2d_DHxparams_bio(bp,x) \
|
||||
ASN1_i2d_bio_of_const(DH, i2d_DHxparams, bp, x)
|
||||
|
||||
DH *DHparams_dup(DH *);
|
||||
|
||||
const DH_METHOD *DH_OpenSSL(void);
|
||||
|
||||
@ -168,62 +120,242 @@ const DH_METHOD *DH_get_default_method(void);
|
||||
int DH_set_method(DH *dh, const DH_METHOD *meth);
|
||||
DH *DH_new_method(ENGINE *engine);
|
||||
|
||||
DH * DH_new(void);
|
||||
void DH_free(DH *dh);
|
||||
int DH_up_ref(DH *dh);
|
||||
int DH_size(const DH *dh);
|
||||
int DH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
|
||||
CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
|
||||
DH *DH_new(void);
|
||||
void DH_free(DH *dh);
|
||||
int DH_up_ref(DH *dh);
|
||||
int DH_bits(const DH *dh);
|
||||
int DH_size(const DH *dh);
|
||||
int DH_security_bits(const DH *dh);
|
||||
#define DH_get_ex_new_index(l, p, newf, dupf, freef) \
|
||||
CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DH, l, p, newf, dupf, freef)
|
||||
int DH_set_ex_data(DH *d, int idx, void *arg);
|
||||
void *DH_get_ex_data(DH *d, int idx);
|
||||
|
||||
/* Deprecated version */
|
||||
#ifndef OPENSSL_NO_DEPRECATED
|
||||
DH * DH_generate_parameters(int prime_len,int generator,
|
||||
void (*callback)(int,int,void *),void *cb_arg);
|
||||
#endif /* !defined(OPENSSL_NO_DEPRECATED) */
|
||||
DEPRECATEDIN_0_9_8(DH *DH_generate_parameters(int prime_len, int generator,
|
||||
void (*callback) (int, int,
|
||||
void *),
|
||||
void *cb_arg))
|
||||
|
||||
/* New version */
|
||||
int DH_generate_parameters_ex(DH *dh, int prime_len,int generator, BN_GENCB *cb);
|
||||
int DH_generate_parameters_ex(DH *dh, int prime_len, int generator,
|
||||
BN_GENCB *cb);
|
||||
|
||||
int DH_check(const DH *dh,int *codes);
|
||||
int DH_check_pub_key(const DH *dh,const BIGNUM *pub_key, int *codes);
|
||||
int DH_generate_key(DH *dh);
|
||||
int DH_compute_key(unsigned char *key,const BIGNUM *pub_key,DH *dh);
|
||||
DH * d2i_DHparams(DH **a,const unsigned char **pp, long length);
|
||||
int i2d_DHparams(const DH *a,unsigned char **pp);
|
||||
#ifndef OPENSSL_NO_FP_API
|
||||
int DHparams_print_fp(FILE *fp, const DH *x);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_BIO
|
||||
int DHparams_print(BIO *bp, const DH *x);
|
||||
#else
|
||||
int DHparams_print(char *bp, const DH *x);
|
||||
#endif
|
||||
int DH_check_params(const DH *dh, int *ret);
|
||||
int DH_check(const DH *dh, int *codes);
|
||||
int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *codes);
|
||||
int DH_generate_key(DH *dh);
|
||||
int DH_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh);
|
||||
int DH_compute_key_padded(unsigned char *key, const BIGNUM *pub_key, DH *dh);
|
||||
DH *d2i_DHparams(DH **a, const unsigned char **pp, long length);
|
||||
int i2d_DHparams(const DH *a, unsigned char **pp);
|
||||
DH *d2i_DHxparams(DH **a, const unsigned char **pp, long length);
|
||||
int i2d_DHxparams(const DH *a, unsigned char **pp);
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
int DHparams_print_fp(FILE *fp, const DH *x);
|
||||
# endif
|
||||
int DHparams_print(BIO *bp, const DH *x);
|
||||
|
||||
/* RFC 5114 parameters */
|
||||
DH *DH_get_1024_160(void);
|
||||
DH *DH_get_2048_224(void);
|
||||
DH *DH_get_2048_256(void);
|
||||
|
||||
# ifndef OPENSSL_NO_CMS
|
||||
/* RFC2631 KDF */
|
||||
int DH_KDF_X9_42(unsigned char *out, size_t outlen,
|
||||
const unsigned char *Z, size_t Zlen,
|
||||
ASN1_OBJECT *key_oid,
|
||||
const unsigned char *ukm, size_t ukmlen, const EVP_MD *md);
|
||||
# endif
|
||||
|
||||
void DH_get0_pqg(const DH *dh,
|
||||
const BIGNUM **p, const BIGNUM **q, const BIGNUM **g);
|
||||
int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g);
|
||||
void DH_get0_key(const DH *dh,
|
||||
const BIGNUM **pub_key, const BIGNUM **priv_key);
|
||||
int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key);
|
||||
void DH_clear_flags(DH *dh, int flags);
|
||||
int DH_test_flags(const DH *dh, int flags);
|
||||
void DH_set_flags(DH *dh, int flags);
|
||||
ENGINE *DH_get0_engine(DH *d);
|
||||
long DH_get_length(const DH *dh);
|
||||
int DH_set_length(DH *dh, long length);
|
||||
|
||||
DH_METHOD *DH_meth_new(const char *name, int flags);
|
||||
void DH_meth_free(DH_METHOD *dhm);
|
||||
DH_METHOD *DH_meth_dup(const DH_METHOD *dhm);
|
||||
const char *DH_meth_get0_name(const DH_METHOD *dhm);
|
||||
int DH_meth_set1_name(DH_METHOD *dhm, const char *name);
|
||||
int DH_meth_get_flags(DH_METHOD *dhm);
|
||||
int DH_meth_set_flags(DH_METHOD *dhm, int flags);
|
||||
void *DH_meth_get0_app_data(const DH_METHOD *dhm);
|
||||
int DH_meth_set0_app_data(DH_METHOD *dhm, void *app_data);
|
||||
int (*DH_meth_get_generate_key(const DH_METHOD *dhm)) (DH *);
|
||||
int DH_meth_set_generate_key(DH_METHOD *dhm, int (*generate_key) (DH *));
|
||||
int (*DH_meth_get_compute_key(const DH_METHOD *dhm))
|
||||
(unsigned char *key, const BIGNUM *pub_key, DH *dh);
|
||||
int DH_meth_set_compute_key(DH_METHOD *dhm,
|
||||
int (*compute_key) (unsigned char *key, const BIGNUM *pub_key, DH *dh));
|
||||
int (*DH_meth_get_bn_mod_exp(const DH_METHOD *dhm))
|
||||
(const DH *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *,
|
||||
BN_CTX *, BN_MONT_CTX *);
|
||||
int DH_meth_set_bn_mod_exp(DH_METHOD *dhm,
|
||||
int (*bn_mod_exp) (const DH *, BIGNUM *, const BIGNUM *, const BIGNUM *,
|
||||
const BIGNUM *, BN_CTX *, BN_MONT_CTX *));
|
||||
int (*DH_meth_get_init(const DH_METHOD *dhm))(DH *);
|
||||
int DH_meth_set_init(DH_METHOD *dhm, int (*init)(DH *));
|
||||
int (*DH_meth_get_finish(const DH_METHOD *dhm)) (DH *);
|
||||
int DH_meth_set_finish(DH_METHOD *dhm, int (*finish) (DH *));
|
||||
int (*DH_meth_get_generate_params(const DH_METHOD *dhm))
|
||||
(DH *, int, int, BN_GENCB *);
|
||||
int DH_meth_set_generate_params(DH_METHOD *dhm,
|
||||
int (*generate_params) (DH *, int, int, BN_GENCB *));
|
||||
|
||||
|
||||
# define EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, len) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \
|
||||
EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN, len, NULL)
|
||||
|
||||
# define EVP_PKEY_CTX_set_dh_paramgen_subprime_len(ctx, len) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \
|
||||
EVP_PKEY_CTRL_DH_PARAMGEN_SUBPRIME_LEN, len, NULL)
|
||||
|
||||
# define EVP_PKEY_CTX_set_dh_paramgen_type(ctx, typ) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \
|
||||
EVP_PKEY_CTRL_DH_PARAMGEN_TYPE, typ, NULL)
|
||||
|
||||
# define EVP_PKEY_CTX_set_dh_paramgen_generator(ctx, gen) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \
|
||||
EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR, gen, NULL)
|
||||
|
||||
# define EVP_PKEY_CTX_set_dh_rfc5114(ctx, gen) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, EVP_PKEY_OP_PARAMGEN, \
|
||||
EVP_PKEY_CTRL_DH_RFC5114, gen, NULL)
|
||||
|
||||
# define EVP_PKEY_CTX_set_dhx_rfc5114(ctx, gen) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, EVP_PKEY_OP_PARAMGEN, \
|
||||
EVP_PKEY_CTRL_DH_RFC5114, gen, NULL)
|
||||
|
||||
# define EVP_PKEY_CTX_set_dh_kdf_type(ctx, kdf) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \
|
||||
EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_DH_KDF_TYPE, kdf, NULL)
|
||||
|
||||
# define EVP_PKEY_CTX_get_dh_kdf_type(ctx) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \
|
||||
EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_DH_KDF_TYPE, -2, NULL)
|
||||
|
||||
# define EVP_PKEY_CTX_set0_dh_kdf_oid(ctx, oid) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \
|
||||
EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_DH_KDF_OID, 0, (void *)oid)
|
||||
|
||||
# define EVP_PKEY_CTX_get0_dh_kdf_oid(ctx, poid) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \
|
||||
EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_GET_DH_KDF_OID, 0, (void *)poid)
|
||||
|
||||
# define EVP_PKEY_CTX_set_dh_kdf_md(ctx, md) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \
|
||||
EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_DH_KDF_MD, 0, (void *)md)
|
||||
|
||||
# define EVP_PKEY_CTX_get_dh_kdf_md(ctx, pmd) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \
|
||||
EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_GET_DH_KDF_MD, 0, (void *)pmd)
|
||||
|
||||
# define EVP_PKEY_CTX_set_dh_kdf_outlen(ctx, len) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \
|
||||
EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_DH_KDF_OUTLEN, len, NULL)
|
||||
|
||||
# define EVP_PKEY_CTX_get_dh_kdf_outlen(ctx, plen) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \
|
||||
EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_GET_DH_KDF_OUTLEN, 0, (void *)plen)
|
||||
|
||||
# define EVP_PKEY_CTX_set0_dh_kdf_ukm(ctx, p, plen) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \
|
||||
EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_DH_KDF_UKM, plen, (void *)p)
|
||||
|
||||
# define EVP_PKEY_CTX_get0_dh_kdf_ukm(ctx, p) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DHX, \
|
||||
EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_GET_DH_KDF_UKM, 0, (void *)p)
|
||||
|
||||
# define EVP_PKEY_CTRL_DH_PARAMGEN_PRIME_LEN (EVP_PKEY_ALG_CTRL + 1)
|
||||
# define EVP_PKEY_CTRL_DH_PARAMGEN_GENERATOR (EVP_PKEY_ALG_CTRL + 2)
|
||||
# define EVP_PKEY_CTRL_DH_RFC5114 (EVP_PKEY_ALG_CTRL + 3)
|
||||
# define EVP_PKEY_CTRL_DH_PARAMGEN_SUBPRIME_LEN (EVP_PKEY_ALG_CTRL + 4)
|
||||
# define EVP_PKEY_CTRL_DH_PARAMGEN_TYPE (EVP_PKEY_ALG_CTRL + 5)
|
||||
# define EVP_PKEY_CTRL_DH_KDF_TYPE (EVP_PKEY_ALG_CTRL + 6)
|
||||
# define EVP_PKEY_CTRL_DH_KDF_MD (EVP_PKEY_ALG_CTRL + 7)
|
||||
# define EVP_PKEY_CTRL_GET_DH_KDF_MD (EVP_PKEY_ALG_CTRL + 8)
|
||||
# define EVP_PKEY_CTRL_DH_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 9)
|
||||
# define EVP_PKEY_CTRL_GET_DH_KDF_OUTLEN (EVP_PKEY_ALG_CTRL + 10)
|
||||
# define EVP_PKEY_CTRL_DH_KDF_UKM (EVP_PKEY_ALG_CTRL + 11)
|
||||
# define EVP_PKEY_CTRL_GET_DH_KDF_UKM (EVP_PKEY_ALG_CTRL + 12)
|
||||
# define EVP_PKEY_CTRL_DH_KDF_OID (EVP_PKEY_ALG_CTRL + 13)
|
||||
# define EVP_PKEY_CTRL_GET_DH_KDF_OID (EVP_PKEY_ALG_CTRL + 14)
|
||||
|
||||
/* KDF types */
|
||||
# define EVP_PKEY_DH_KDF_NONE 1
|
||||
# ifndef OPENSSL_NO_CMS
|
||||
# define EVP_PKEY_DH_KDF_X9_42 2
|
||||
# endif
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
/*
|
||||
* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
void ERR_load_DH_strings(void);
|
||||
|
||||
int ERR_load_DH_strings(void);
|
||||
|
||||
/* Error codes for the DH functions. */
|
||||
|
||||
/* Function codes. */
|
||||
#define DH_F_COMPUTE_KEY 102
|
||||
#define DH_F_DHPARAMS_PRINT 100
|
||||
#define DH_F_DHPARAMS_PRINT_FP 101
|
||||
#define DH_F_DH_BUILTIN_GENPARAMS 106
|
||||
#define DH_F_DH_NEW_METHOD 105
|
||||
#define DH_F_GENERATE_KEY 103
|
||||
#define DH_F_GENERATE_PARAMETERS 104
|
||||
# define DH_F_COMPUTE_KEY 102
|
||||
# define DH_F_DHPARAMS_PRINT_FP 101
|
||||
# define DH_F_DH_BUILTIN_GENPARAMS 106
|
||||
# define DH_F_DH_CMS_DECRYPT 114
|
||||
# define DH_F_DH_CMS_SET_PEERKEY 115
|
||||
# define DH_F_DH_CMS_SET_SHARED_INFO 116
|
||||
# define DH_F_DH_METH_DUP 117
|
||||
# define DH_F_DH_METH_NEW 118
|
||||
# define DH_F_DH_METH_SET1_NAME 119
|
||||
# define DH_F_DH_NEW_METHOD 105
|
||||
# define DH_F_DH_PARAM_DECODE 107
|
||||
# define DH_F_DH_PRIV_DECODE 110
|
||||
# define DH_F_DH_PRIV_ENCODE 111
|
||||
# define DH_F_DH_PUB_DECODE 108
|
||||
# define DH_F_DH_PUB_ENCODE 109
|
||||
# define DH_F_DO_DH_PRINT 100
|
||||
# define DH_F_GENERATE_KEY 103
|
||||
# define DH_F_PKEY_DH_DERIVE 112
|
||||
# define DH_F_PKEY_DH_KEYGEN 113
|
||||
|
||||
/* Reason codes. */
|
||||
#define DH_R_BAD_GENERATOR 101
|
||||
#define DH_R_INVALID_PUBKEY 102
|
||||
#define DH_R_NO_PRIVATE_VALUE 100
|
||||
# define DH_R_BAD_GENERATOR 101
|
||||
# define DH_R_BN_DECODE_ERROR 109
|
||||
# define DH_R_BN_ERROR 106
|
||||
# define DH_R_DECODE_ERROR 104
|
||||
# define DH_R_INVALID_PUBKEY 102
|
||||
# define DH_R_KDF_PARAMETER_ERROR 112
|
||||
# define DH_R_KEYS_NOT_SET 108
|
||||
# define DH_R_MODULUS_TOO_LARGE 103
|
||||
# define DH_R_NO_PARAMETERS_SET 107
|
||||
# define DH_R_NO_PRIVATE_VALUE 100
|
||||
# define DH_R_PARAMETER_ENCODING_ERROR 105
|
||||
# define DH_R_PEER_KEY_ERROR 111
|
||||
# define DH_R_SHARED_INFO_ERROR 113
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@ -1,279 +1,283 @@
|
||||
/* crypto/dsa/dsa.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/*
|
||||
* The DSS routines are based on patches supplied by
|
||||
* Steven Schoch <schoch@sheba.arc.nasa.gov>. He basically did the
|
||||
* work and I have just tweaked them a little to fit into my
|
||||
* stylistic vision for SSLeay :-) */
|
||||
* Steven Schoch <schoch@sheba.arc.nasa.gov>.
|
||||
*/
|
||||
|
||||
#ifndef HEADER_DSA_H
|
||||
#define HEADER_DSA_H
|
||||
# define HEADER_DSA_H
|
||||
|
||||
#include <openssl/e_os2.h>
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
#ifdef OPENSSL_NO_DSA
|
||||
#error DSA is disabled.
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_BIO
|
||||
#include <openssl/bio.h>
|
||||
#endif
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/ossl_typ.h>
|
||||
|
||||
#ifndef OPENSSL_NO_DEPRECATED
|
||||
#include <openssl/bn.h>
|
||||
#ifndef OPENSSL_NO_DH
|
||||
# include <openssl/dh.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define DSA_FLAG_CACHE_MONT_P 0x01
|
||||
#define DSA_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DSA
|
||||
* implementation now uses constant time
|
||||
* modular exponentiation for secret exponents
|
||||
* by default. This flag causes the
|
||||
* faster variable sliding window method to
|
||||
* be used for all exponents.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifndef OPENSSL_NO_DSA
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
# endif
|
||||
# include <openssl/e_os2.h>
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/crypto.h>
|
||||
# include <openssl/ossl_typ.h>
|
||||
# include <openssl/opensslconf.h>
|
||||
# include <openssl/bn.h>
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# include <openssl/dh.h>
|
||||
# endif
|
||||
|
||||
# ifndef OPENSSL_DSA_MAX_MODULUS_BITS
|
||||
# define OPENSSL_DSA_MAX_MODULUS_BITS 10000
|
||||
# endif
|
||||
|
||||
# define OPENSSL_DSA_FIPS_MIN_MODULUS_BITS 1024
|
||||
|
||||
# define DSA_FLAG_CACHE_MONT_P 0x01
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
/*
|
||||
* Does nothing. Previously this switched off constant time behaviour.
|
||||
*/
|
||||
# define DSA_FLAG_NO_EXP_CONSTTIME 0x00
|
||||
# endif
|
||||
|
||||
/*
|
||||
* If this flag is set the DSA method is FIPS compliant and can be used in
|
||||
* FIPS mode. This is set in the validated module method. If an application
|
||||
* sets this flag in its own methods it is its responsibility to ensure the
|
||||
* result is compliant.
|
||||
*/
|
||||
|
||||
# define DSA_FLAG_FIPS_METHOD 0x0400
|
||||
|
||||
/*
|
||||
* If this flag is set the operations normally disabled in FIPS mode are
|
||||
* permitted it is then the applications responsibility to ensure that the
|
||||
* usage is compliant.
|
||||
*/
|
||||
|
||||
# define DSA_FLAG_NON_FIPS_ALLOW 0x0400
|
||||
# define DSA_FLAG_FIPS_CHECKED 0x0800
|
||||
|
||||
/* Already defined in ossl_typ.h */
|
||||
/* typedef struct dsa_st DSA; */
|
||||
/* typedef struct dsa_method DSA_METHOD; */
|
||||
|
||||
typedef struct DSA_SIG_st
|
||||
{
|
||||
BIGNUM *r;
|
||||
BIGNUM *s;
|
||||
} DSA_SIG;
|
||||
typedef struct DSA_SIG_st DSA_SIG;
|
||||
|
||||
struct dsa_method
|
||||
{
|
||||
const char *name;
|
||||
DSA_SIG * (*dsa_do_sign)(const unsigned char *dgst, int dlen, DSA *dsa);
|
||||
int (*dsa_sign_setup)(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp,
|
||||
BIGNUM **rp);
|
||||
int (*dsa_do_verify)(const unsigned char *dgst, int dgst_len,
|
||||
DSA_SIG *sig, DSA *dsa);
|
||||
int (*dsa_mod_exp)(DSA *dsa, BIGNUM *rr, BIGNUM *a1, BIGNUM *p1,
|
||||
BIGNUM *a2, BIGNUM *p2, BIGNUM *m, BN_CTX *ctx,
|
||||
BN_MONT_CTX *in_mont);
|
||||
int (*bn_mod_exp)(DSA *dsa, BIGNUM *r, BIGNUM *a, const BIGNUM *p,
|
||||
const BIGNUM *m, BN_CTX *ctx,
|
||||
BN_MONT_CTX *m_ctx); /* Can be null */
|
||||
int (*init)(DSA *dsa);
|
||||
int (*finish)(DSA *dsa);
|
||||
int flags;
|
||||
char *app_data;
|
||||
/* If this is non-NULL, it is used to generate DSA parameters */
|
||||
int (*dsa_paramgen)(DSA *dsa, int bits,
|
||||
unsigned char *seed, int seed_len,
|
||||
int *counter_ret, unsigned long *h_ret,
|
||||
BN_GENCB *cb);
|
||||
/* If this is non-NULL, it is used to generate DSA keys */
|
||||
int (*dsa_keygen)(DSA *dsa);
|
||||
};
|
||||
# define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \
|
||||
(char *(*)())d2i_DSAparams,(fp),(unsigned char **)(x))
|
||||
# define i2d_DSAparams_fp(fp,x) ASN1_i2d_fp(i2d_DSAparams,(fp), \
|
||||
(unsigned char *)(x))
|
||||
# define d2i_DSAparams_bio(bp,x) ASN1_d2i_bio_of(DSA,DSA_new,d2i_DSAparams,bp,x)
|
||||
# define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio_of_const(DSA,i2d_DSAparams,bp,x)
|
||||
|
||||
struct dsa_st
|
||||
{
|
||||
/* This first variable is used to pick up errors where
|
||||
* a DSA is passed instead of of a EVP_PKEY */
|
||||
int pad;
|
||||
long version;
|
||||
int write_params;
|
||||
BIGNUM *p;
|
||||
BIGNUM *q; /* == 20 */
|
||||
BIGNUM *g;
|
||||
DSA *DSAparams_dup(DSA *x);
|
||||
DSA_SIG *DSA_SIG_new(void);
|
||||
void DSA_SIG_free(DSA_SIG *a);
|
||||
int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp);
|
||||
DSA_SIG *d2i_DSA_SIG(DSA_SIG **v, const unsigned char **pp, long length);
|
||||
void DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps);
|
||||
int DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s);
|
||||
|
||||
BIGNUM *pub_key; /* y public key */
|
||||
BIGNUM *priv_key; /* x private key */
|
||||
|
||||
BIGNUM *kinv; /* Signing pre-calc */
|
||||
BIGNUM *r; /* Signing pre-calc */
|
||||
|
||||
int flags;
|
||||
/* Normally used to cache montgomery values */
|
||||
BN_MONT_CTX *method_mont_p;
|
||||
int references;
|
||||
CRYPTO_EX_DATA ex_data;
|
||||
const DSA_METHOD *meth;
|
||||
/* functional reference if 'meth' is ENGINE-provided */
|
||||
ENGINE *engine;
|
||||
};
|
||||
|
||||
#define DSAparams_dup(x) ASN1_dup_of_const(DSA,i2d_DSAparams,d2i_DSAparams,x)
|
||||
#define d2i_DSAparams_fp(fp,x) (DSA *)ASN1_d2i_fp((char *(*)())DSA_new, \
|
||||
(char *(*)())d2i_DSAparams,(fp),(unsigned char **)(x))
|
||||
#define i2d_DSAparams_fp(fp,x) ASN1_i2d_fp(i2d_DSAparams,(fp), \
|
||||
(unsigned char *)(x))
|
||||
#define d2i_DSAparams_bio(bp,x) ASN1_d2i_bio_of(DSA,DSA_new,d2i_DSAparams,bp,x)
|
||||
#define i2d_DSAparams_bio(bp,x) ASN1_i2d_bio_of_const(DSA,i2d_DSAparams,bp,x)
|
||||
|
||||
|
||||
DSA_SIG * DSA_SIG_new(void);
|
||||
void DSA_SIG_free(DSA_SIG *a);
|
||||
int i2d_DSA_SIG(const DSA_SIG *a, unsigned char **pp);
|
||||
DSA_SIG * d2i_DSA_SIG(DSA_SIG **v, const unsigned char **pp, long length);
|
||||
|
||||
DSA_SIG * DSA_do_sign(const unsigned char *dgst,int dlen,DSA *dsa);
|
||||
int DSA_do_verify(const unsigned char *dgst,int dgst_len,
|
||||
DSA_SIG *sig,DSA *dsa);
|
||||
DSA_SIG *DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa);
|
||||
int DSA_do_verify(const unsigned char *dgst, int dgst_len,
|
||||
DSA_SIG *sig, DSA *dsa);
|
||||
|
||||
const DSA_METHOD *DSA_OpenSSL(void);
|
||||
|
||||
void DSA_set_default_method(const DSA_METHOD *);
|
||||
void DSA_set_default_method(const DSA_METHOD *);
|
||||
const DSA_METHOD *DSA_get_default_method(void);
|
||||
int DSA_set_method(DSA *dsa, const DSA_METHOD *);
|
||||
int DSA_set_method(DSA *dsa, const DSA_METHOD *);
|
||||
const DSA_METHOD *DSA_get_method(DSA *d);
|
||||
|
||||
DSA * DSA_new(void);
|
||||
DSA * DSA_new_method(ENGINE *engine);
|
||||
void DSA_free (DSA *r);
|
||||
DSA *DSA_new(void);
|
||||
DSA *DSA_new_method(ENGINE *engine);
|
||||
void DSA_free(DSA *r);
|
||||
/* "up" the DSA object's reference count */
|
||||
int DSA_up_ref(DSA *r);
|
||||
int DSA_size(const DSA *);
|
||||
/* next 4 return -1 on error */
|
||||
int DSA_sign_setup( DSA *dsa,BN_CTX *ctx_in,BIGNUM **kinvp,BIGNUM **rp);
|
||||
int DSA_sign(int type,const unsigned char *dgst,int dlen,
|
||||
unsigned char *sig, unsigned int *siglen, DSA *dsa);
|
||||
int DSA_verify(int type,const unsigned char *dgst,int dgst_len,
|
||||
const unsigned char *sigbuf, int siglen, DSA *dsa);
|
||||
int DSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
|
||||
CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
|
||||
int DSA_up_ref(DSA *r);
|
||||
int DSA_size(const DSA *);
|
||||
int DSA_bits(const DSA *d);
|
||||
int DSA_security_bits(const DSA *d);
|
||||
/* next 4 return -1 on error */
|
||||
int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp);
|
||||
int DSA_sign(int type, const unsigned char *dgst, int dlen,
|
||||
unsigned char *sig, unsigned int *siglen, DSA *dsa);
|
||||
int DSA_verify(int type, const unsigned char *dgst, int dgst_len,
|
||||
const unsigned char *sigbuf, int siglen, DSA *dsa);
|
||||
#define DSA_get_ex_new_index(l, p, newf, dupf, freef) \
|
||||
CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_DSA, l, p, newf, dupf, freef)
|
||||
int DSA_set_ex_data(DSA *d, int idx, void *arg);
|
||||
void *DSA_get_ex_data(DSA *d, int idx);
|
||||
|
||||
DSA * d2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length);
|
||||
DSA * d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length);
|
||||
DSA * d2i_DSAparams(DSA **a, const unsigned char **pp, long length);
|
||||
DSA *d2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length);
|
||||
DSA *d2i_DSAPrivateKey(DSA **a, const unsigned char **pp, long length);
|
||||
DSA *d2i_DSAparams(DSA **a, const unsigned char **pp, long length);
|
||||
|
||||
/* Deprecated version */
|
||||
#ifndef OPENSSL_NO_DEPRECATED
|
||||
DSA * DSA_generate_parameters(int bits,
|
||||
unsigned char *seed,int seed_len,
|
||||
int *counter_ret, unsigned long *h_ret,void
|
||||
(*callback)(int, int, void *),void *cb_arg);
|
||||
#endif /* !defined(OPENSSL_NO_DEPRECATED) */
|
||||
DEPRECATEDIN_0_9_8(DSA *DSA_generate_parameters(int bits,
|
||||
unsigned char *seed,
|
||||
int seed_len,
|
||||
int *counter_ret,
|
||||
unsigned long *h_ret, void
|
||||
(*callback) (int, int,
|
||||
void *),
|
||||
void *cb_arg))
|
||||
|
||||
/* New version */
|
||||
int DSA_generate_parameters_ex(DSA *dsa, int bits,
|
||||
unsigned char *seed,int seed_len,
|
||||
int *counter_ret, unsigned long *h_ret, BN_GENCB *cb);
|
||||
int DSA_generate_parameters_ex(DSA *dsa, int bits,
|
||||
const unsigned char *seed, int seed_len,
|
||||
int *counter_ret, unsigned long *h_ret,
|
||||
BN_GENCB *cb);
|
||||
|
||||
int DSA_generate_key(DSA *a);
|
||||
int i2d_DSAPublicKey(const DSA *a, unsigned char **pp);
|
||||
int i2d_DSAPrivateKey(const DSA *a, unsigned char **pp);
|
||||
int i2d_DSAparams(const DSA *a,unsigned char **pp);
|
||||
int DSA_generate_key(DSA *a);
|
||||
int i2d_DSAPublicKey(const DSA *a, unsigned char **pp);
|
||||
int i2d_DSAPrivateKey(const DSA *a, unsigned char **pp);
|
||||
int i2d_DSAparams(const DSA *a, unsigned char **pp);
|
||||
|
||||
#ifndef OPENSSL_NO_BIO
|
||||
int DSAparams_print(BIO *bp, const DSA *x);
|
||||
int DSA_print(BIO *bp, const DSA *x, int off);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_FP_API
|
||||
int DSAparams_print_fp(FILE *fp, const DSA *x);
|
||||
int DSA_print_fp(FILE *bp, const DSA *x, int off);
|
||||
#endif
|
||||
int DSAparams_print(BIO *bp, const DSA *x);
|
||||
int DSA_print(BIO *bp, const DSA *x, int off);
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
int DSAparams_print_fp(FILE *fp, const DSA *x);
|
||||
int DSA_print_fp(FILE *bp, const DSA *x, int off);
|
||||
# endif
|
||||
|
||||
#define DSS_prime_checks 50
|
||||
/* Primality test according to FIPS PUB 186[-1], Appendix 2.1:
|
||||
* 50 rounds of Rabin-Miller */
|
||||
#define DSA_is_prime(n, callback, cb_arg) \
|
||||
BN_is_prime(n, DSS_prime_checks, callback, NULL, cb_arg)
|
||||
# define DSS_prime_checks 50
|
||||
/*
|
||||
* Primality test according to FIPS PUB 186[-1], Appendix 2.1: 50 rounds of
|
||||
* Rabin-Miller
|
||||
*/
|
||||
# define DSA_is_prime(n, callback, cb_arg) \
|
||||
BN_is_prime(n, DSS_prime_checks, callback, NULL, cb_arg)
|
||||
|
||||
#ifndef OPENSSL_NO_DH
|
||||
/* Convert DSA structure (key or just parameters) into DH structure
|
||||
* (be careful to avoid small subgroup attacks when using this!) */
|
||||
# ifndef OPENSSL_NO_DH
|
||||
/*
|
||||
* Convert DSA structure (key or just parameters) into DH structure (be
|
||||
* careful to avoid small subgroup attacks when using this!)
|
||||
*/
|
||||
DH *DSA_dup_DH(const DSA *r);
|
||||
#endif
|
||||
# endif
|
||||
|
||||
# define EVP_PKEY_CTX_set_dsa_paramgen_bits(ctx, nbits) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DSA, EVP_PKEY_OP_PARAMGEN, \
|
||||
EVP_PKEY_CTRL_DSA_PARAMGEN_BITS, nbits, NULL)
|
||||
|
||||
# define EVP_PKEY_CTRL_DSA_PARAMGEN_BITS (EVP_PKEY_ALG_CTRL + 1)
|
||||
# define EVP_PKEY_CTRL_DSA_PARAMGEN_Q_BITS (EVP_PKEY_ALG_CTRL + 2)
|
||||
# define EVP_PKEY_CTRL_DSA_PARAMGEN_MD (EVP_PKEY_ALG_CTRL + 3)
|
||||
|
||||
void DSA_get0_pqg(const DSA *d,
|
||||
const BIGNUM **p, const BIGNUM **q, const BIGNUM **g);
|
||||
int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g);
|
||||
void DSA_get0_key(const DSA *d,
|
||||
const BIGNUM **pub_key, const BIGNUM **priv_key);
|
||||
int DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key);
|
||||
void DSA_clear_flags(DSA *d, int flags);
|
||||
int DSA_test_flags(const DSA *d, int flags);
|
||||
void DSA_set_flags(DSA *d, int flags);
|
||||
ENGINE *DSA_get0_engine(DSA *d);
|
||||
|
||||
DSA_METHOD *DSA_meth_new(const char *name, int flags);
|
||||
void DSA_meth_free(DSA_METHOD *dsam);
|
||||
DSA_METHOD *DSA_meth_dup(const DSA_METHOD *dsam);
|
||||
const char *DSA_meth_get0_name(const DSA_METHOD *dsam);
|
||||
int DSA_meth_set1_name(DSA_METHOD *dsam, const char *name);
|
||||
int DSA_meth_get_flags(DSA_METHOD *dsam);
|
||||
int DSA_meth_set_flags(DSA_METHOD *dsam, int flags);
|
||||
void *DSA_meth_get0_app_data(const DSA_METHOD *dsam);
|
||||
int DSA_meth_set0_app_data(DSA_METHOD *dsam, void *app_data);
|
||||
DSA_SIG *(*DSA_meth_get_sign(const DSA_METHOD *dsam))
|
||||
(const unsigned char *, int, DSA *);
|
||||
int DSA_meth_set_sign(DSA_METHOD *dsam,
|
||||
DSA_SIG *(*sign) (const unsigned char *, int, DSA *));
|
||||
int (*DSA_meth_get_sign_setup(const DSA_METHOD *dsam))
|
||||
(DSA *, BN_CTX *, BIGNUM **, BIGNUM **);
|
||||
int DSA_meth_set_sign_setup(DSA_METHOD *dsam,
|
||||
int (*sign_setup) (DSA *, BN_CTX *, BIGNUM **, BIGNUM **));
|
||||
int (*DSA_meth_get_verify(const DSA_METHOD *dsam))
|
||||
(const unsigned char *, int , DSA_SIG *, DSA *);
|
||||
int DSA_meth_set_verify(DSA_METHOD *dsam,
|
||||
int (*verify) (const unsigned char *, int, DSA_SIG *, DSA *));
|
||||
int (*DSA_meth_get_mod_exp(const DSA_METHOD *dsam))
|
||||
(DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *,
|
||||
const BIGNUM *, const BIGNUM *, BN_CTX *, BN_MONT_CTX *);
|
||||
int DSA_meth_set_mod_exp(DSA_METHOD *dsam,
|
||||
int (*mod_exp) (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *,
|
||||
const BIGNUM *, const BIGNUM *, const BIGNUM *, BN_CTX *,
|
||||
BN_MONT_CTX *));
|
||||
int (*DSA_meth_get_bn_mod_exp(const DSA_METHOD *dsam))
|
||||
(DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *, const BIGNUM *,
|
||||
BN_CTX *, BN_MONT_CTX *);
|
||||
int DSA_meth_set_bn_mod_exp(DSA_METHOD *dsam,
|
||||
int (*bn_mod_exp) (DSA *, BIGNUM *, const BIGNUM *, const BIGNUM *,
|
||||
const BIGNUM *, BN_CTX *, BN_MONT_CTX *));
|
||||
int (*DSA_meth_get_init(const DSA_METHOD *dsam))(DSA *);
|
||||
int DSA_meth_set_init(DSA_METHOD *dsam, int (*init)(DSA *));
|
||||
int (*DSA_meth_get_finish(const DSA_METHOD *dsam)) (DSA *);
|
||||
int DSA_meth_set_finish(DSA_METHOD *dsam, int (*finish) (DSA *));
|
||||
int (*DSA_meth_get_paramgen(const DSA_METHOD *dsam))
|
||||
(DSA *, int, const unsigned char *, int, int *, unsigned long *,
|
||||
BN_GENCB *);
|
||||
int DSA_meth_set_paramgen(DSA_METHOD *dsam,
|
||||
int (*paramgen) (DSA *, int, const unsigned char *, int, int *,
|
||||
unsigned long *, BN_GENCB *));
|
||||
int (*DSA_meth_get_keygen(const DSA_METHOD *dsam)) (DSA *);
|
||||
int DSA_meth_set_keygen(DSA_METHOD *dsam, int (*keygen) (DSA *));
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
/*
|
||||
* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
void ERR_load_DSA_strings(void);
|
||||
|
||||
int ERR_load_DSA_strings(void);
|
||||
|
||||
/* Error codes for the DSA functions. */
|
||||
|
||||
/* Function codes. */
|
||||
#define DSA_F_D2I_DSA_SIG 110
|
||||
#define DSA_F_DSAPARAMS_PRINT 100
|
||||
#define DSA_F_DSAPARAMS_PRINT_FP 101
|
||||
#define DSA_F_DSA_DO_SIGN 112
|
||||
#define DSA_F_DSA_DO_VERIFY 113
|
||||
#define DSA_F_DSA_NEW_METHOD 103
|
||||
#define DSA_F_DSA_PRINT 104
|
||||
#define DSA_F_DSA_PRINT_FP 105
|
||||
#define DSA_F_DSA_SIGN 106
|
||||
#define DSA_F_DSA_SIGN_SETUP 107
|
||||
#define DSA_F_DSA_SIG_NEW 109
|
||||
#define DSA_F_DSA_VERIFY 108
|
||||
#define DSA_F_I2D_DSA_SIG 111
|
||||
#define DSA_F_SIG_CB 114
|
||||
# define DSA_F_DSAPARAMS_PRINT 100
|
||||
# define DSA_F_DSAPARAMS_PRINT_FP 101
|
||||
# define DSA_F_DSA_BUILTIN_PARAMGEN 125
|
||||
# define DSA_F_DSA_BUILTIN_PARAMGEN2 126
|
||||
# define DSA_F_DSA_DO_SIGN 112
|
||||
# define DSA_F_DSA_DO_VERIFY 113
|
||||
# define DSA_F_DSA_METH_DUP 127
|
||||
# define DSA_F_DSA_METH_NEW 128
|
||||
# define DSA_F_DSA_METH_SET1_NAME 129
|
||||
# define DSA_F_DSA_NEW_METHOD 103
|
||||
# define DSA_F_DSA_PARAM_DECODE 119
|
||||
# define DSA_F_DSA_PRINT_FP 105
|
||||
# define DSA_F_DSA_PRIV_DECODE 115
|
||||
# define DSA_F_DSA_PRIV_ENCODE 116
|
||||
# define DSA_F_DSA_PUB_DECODE 117
|
||||
# define DSA_F_DSA_PUB_ENCODE 118
|
||||
# define DSA_F_DSA_SIGN 106
|
||||
# define DSA_F_DSA_SIGN_SETUP 107
|
||||
# define DSA_F_DSA_SIG_NEW 102
|
||||
# define DSA_F_OLD_DSA_PRIV_DECODE 122
|
||||
# define DSA_F_PKEY_DSA_CTRL 120
|
||||
# define DSA_F_PKEY_DSA_KEYGEN 121
|
||||
|
||||
/* Reason codes. */
|
||||
#define DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 100
|
||||
#define DSA_R_MISSING_PARAMETERS 101
|
||||
# define DSA_R_BAD_Q_VALUE 102
|
||||
# define DSA_R_BN_DECODE_ERROR 108
|
||||
# define DSA_R_BN_ERROR 109
|
||||
# define DSA_R_DECODE_ERROR 104
|
||||
# define DSA_R_INVALID_DIGEST_TYPE 106
|
||||
# define DSA_R_INVALID_PARAMETERS 112
|
||||
# define DSA_R_MISSING_PARAMETERS 101
|
||||
# define DSA_R_MODULUS_TOO_LARGE 103
|
||||
# define DSA_R_NO_PARAMETERS_SET 107
|
||||
# define DSA_R_PARAMETER_ENCODING_ERROR 105
|
||||
# define DSA_R_Q_NOT_PRIME 113
|
||||
# define DSA_R_SEED_LEN_SMALL 110
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@ -1,212 +1,56 @@
|
||||
/* ssl/dtls1.h */
|
||||
/*
|
||||
* DTLS implementation written by Nagendra Modadugu
|
||||
* (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* openssl-core@OpenSSL.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||
* Hudson (tjh@cryptsoft.com).
|
||||
* Copyright 2005-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_DTLS1_H
|
||||
#define HEADER_DTLS1_H
|
||||
|
||||
#include <openssl/buffer.h>
|
||||
#include <openssl/pqueue.h>
|
||||
# define HEADER_DTLS1_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define DTLS1_VERSION 0x0100
|
||||
#define DTLS1_VERSION_MAJOR 0x01
|
||||
#define DTLS1_VERSION_MINOR 0x00
|
||||
# define DTLS1_VERSION 0xFEFF
|
||||
# define DTLS1_2_VERSION 0xFEFD
|
||||
# define DTLS_MIN_VERSION DTLS1_VERSION
|
||||
# define DTLS_MAX_VERSION DTLS1_2_VERSION
|
||||
# define DTLS1_VERSION_MAJOR 0xFE
|
||||
|
||||
#define DTLS1_AD_MISSING_HANDSHAKE_MESSAGE 110
|
||||
# define DTLS1_BAD_VER 0x0100
|
||||
|
||||
/* Special value for method supporting multiple versions */
|
||||
# define DTLS_ANY_VERSION 0x1FFFF
|
||||
|
||||
/* lengths of messages */
|
||||
#define DTLS1_COOKIE_LENGTH 32
|
||||
# define DTLS1_COOKIE_LENGTH 256
|
||||
|
||||
#define DTLS1_RT_HEADER_LENGTH 13
|
||||
# define DTLS1_RT_HEADER_LENGTH 13
|
||||
|
||||
#define DTLS1_HM_HEADER_LENGTH 12
|
||||
# define DTLS1_HM_HEADER_LENGTH 12
|
||||
|
||||
#define DTLS1_HM_BAD_FRAGMENT -2
|
||||
#define DTLS1_HM_FRAGMENT_RETRY -3
|
||||
# define DTLS1_HM_BAD_FRAGMENT -2
|
||||
# define DTLS1_HM_FRAGMENT_RETRY -3
|
||||
|
||||
#define DTLS1_CCS_HEADER_LENGTH 3
|
||||
# define DTLS1_CCS_HEADER_LENGTH 1
|
||||
|
||||
#define DTLS1_AL_HEADER_LENGTH 7
|
||||
|
||||
|
||||
typedef struct dtls1_bitmap_st
|
||||
{
|
||||
PQ_64BIT map;
|
||||
unsigned long length; /* sizeof the bitmap in bits */
|
||||
PQ_64BIT max_seq_num; /* max record number seen so far */
|
||||
} DTLS1_BITMAP;
|
||||
|
||||
struct hm_header_st
|
||||
{
|
||||
unsigned char type;
|
||||
unsigned long msg_len;
|
||||
unsigned short seq;
|
||||
unsigned long frag_off;
|
||||
unsigned long frag_len;
|
||||
unsigned int is_ccs;
|
||||
};
|
||||
|
||||
struct ccs_header_st
|
||||
{
|
||||
unsigned char type;
|
||||
unsigned short seq;
|
||||
};
|
||||
|
||||
struct dtls1_timeout_st
|
||||
{
|
||||
/* Number of read timeouts so far */
|
||||
unsigned int read_timeouts;
|
||||
|
||||
/* Number of write timeouts so far */
|
||||
unsigned int write_timeouts;
|
||||
|
||||
/* Number of alerts received so far */
|
||||
unsigned int num_alerts;
|
||||
};
|
||||
|
||||
typedef struct record_pqueue_st
|
||||
{
|
||||
unsigned short epoch;
|
||||
pqueue q;
|
||||
} record_pqueue;
|
||||
|
||||
typedef struct hm_fragment_st
|
||||
{
|
||||
struct hm_header_st msg_header;
|
||||
unsigned char *fragment;
|
||||
} hm_fragment;
|
||||
|
||||
typedef struct dtls1_state_st
|
||||
{
|
||||
unsigned int send_cookie;
|
||||
unsigned char cookie[DTLS1_COOKIE_LENGTH];
|
||||
unsigned char rcvd_cookie[DTLS1_COOKIE_LENGTH];
|
||||
unsigned int cookie_len;
|
||||
|
||||
/*
|
||||
* The current data and handshake epoch. This is initially
|
||||
* undefined, and starts at zero once the initial handshake is
|
||||
* completed
|
||||
*/
|
||||
unsigned short r_epoch;
|
||||
unsigned short w_epoch;
|
||||
|
||||
/* records being received in the current epoch */
|
||||
DTLS1_BITMAP bitmap;
|
||||
|
||||
/* renegotiation starts a new set of sequence numbers */
|
||||
DTLS1_BITMAP next_bitmap;
|
||||
|
||||
/* handshake message numbers */
|
||||
unsigned short handshake_write_seq;
|
||||
unsigned short next_handshake_write_seq;
|
||||
|
||||
unsigned short handshake_read_seq;
|
||||
|
||||
/* Received handshake records (processed and unprocessed) */
|
||||
record_pqueue unprocessed_rcds;
|
||||
record_pqueue processed_rcds;
|
||||
|
||||
/* Buffered handshake messages */
|
||||
pqueue buffered_messages;
|
||||
|
||||
/* Buffered (sent) handshake records */
|
||||
pqueue sent_messages;
|
||||
|
||||
unsigned int mtu; /* max wire packet size */
|
||||
|
||||
struct hm_header_st w_msg_hdr;
|
||||
struct hm_header_st r_msg_hdr;
|
||||
|
||||
struct dtls1_timeout_st timeout;
|
||||
|
||||
/* storage for Alert/Handshake protocol data received but not
|
||||
* yet processed by ssl3_read_bytes: */
|
||||
unsigned char alert_fragment[DTLS1_AL_HEADER_LENGTH];
|
||||
unsigned int alert_fragment_len;
|
||||
unsigned char handshake_fragment[DTLS1_HM_HEADER_LENGTH];
|
||||
unsigned int handshake_fragment_len;
|
||||
|
||||
unsigned int retransmitting;
|
||||
|
||||
} DTLS1_STATE;
|
||||
|
||||
typedef struct dtls1_record_data_st
|
||||
{
|
||||
unsigned char *packet;
|
||||
unsigned int packet_length;
|
||||
SSL3_BUFFER rbuf;
|
||||
SSL3_RECORD rrec;
|
||||
} DTLS1_RECORD_DATA;
|
||||
# ifdef DTLS1_AD_MISSING_HANDSHAKE_MESSAGE
|
||||
# define DTLS1_AL_HEADER_LENGTH 7
|
||||
# else
|
||||
# define DTLS1_AL_HEADER_LENGTH 2
|
||||
# endif
|
||||
|
||||
|
||||
/* Timeout multipliers (timeout slice is defined in apps/timeouts.h */
|
||||
#define DTLS1_TMO_READ_COUNT 2
|
||||
#define DTLS1_TMO_WRITE_COUNT 2
|
||||
# define DTLS1_TMO_READ_COUNT 2
|
||||
# define DTLS1_TMO_WRITE_COUNT 2
|
||||
|
||||
#define DTLS1_TMO_ALERT_COUNT 12
|
||||
# define DTLS1_TMO_ALERT_COUNT 12
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@ -1,62 +1,16 @@
|
||||
/* e_os2.h */
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* openssl-core@openssl.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||
* Hudson (tjh@cryptsoft.com).
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
|
||||
#ifndef HEADER_E_OS2_H
|
||||
#define HEADER_E_OS2_H
|
||||
# define HEADER_E_OS2_H
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -68,210 +22,275 @@ extern "C" {
|
||||
* However, if none is defined, Unix is assumed.
|
||||
**/
|
||||
|
||||
#define OPENSSL_SYS_UNIX
|
||||
# define OPENSSL_SYS_UNIX
|
||||
|
||||
/* ----------------------- Macintosh, before MacOS X ----------------------- */
|
||||
#if defined(__MWERKS__) && defined(macintosh) || defined(OPENSSL_SYSNAME_MAC)
|
||||
# undef OPENSSL_SYS_UNIX
|
||||
# define OPENSSL_SYS_MACINTOSH_CLASSIC
|
||||
#endif
|
||||
/* --------------------- Microsoft operating systems ---------------------- */
|
||||
|
||||
/* ----------------------- NetWare ----------------------------------------- */
|
||||
#if defined(NETWARE) || defined(OPENSSL_SYSNAME_NETWARE)
|
||||
# undef OPENSSL_SYS_UNIX
|
||||
# define OPENSSL_SYS_NETWARE
|
||||
#endif
|
||||
|
||||
/* ---------------------- Microsoft operating systems ---------------------- */
|
||||
|
||||
/* Note that MSDOS actually denotes 32-bit environments running on top of
|
||||
MS-DOS, such as DJGPP one. */
|
||||
#if defined(OPENSSL_SYSNAME_MSDOS)
|
||||
# undef OPENSSL_SYS_UNIX
|
||||
# define OPENSSL_SYS_MSDOS
|
||||
#endif
|
||||
|
||||
/* For 32 bit environment, there seems to be the CygWin environment and then
|
||||
all the others that try to do the same thing Microsoft does... */
|
||||
#if defined(OPENSSL_SYSNAME_UWIN)
|
||||
# undef OPENSSL_SYS_UNIX
|
||||
# define OPENSSL_SYS_WIN32_UWIN
|
||||
#else
|
||||
# if defined(__CYGWIN32__) || defined(OPENSSL_SYSNAME_CYGWIN32)
|
||||
/*
|
||||
* Note that MSDOS actually denotes 32-bit environments running on top of
|
||||
* MS-DOS, such as DJGPP one.
|
||||
*/
|
||||
# if defined(OPENSSL_SYS_MSDOS)
|
||||
# undef OPENSSL_SYS_UNIX
|
||||
# define OPENSSL_SYS_WIN32_CYGWIN
|
||||
# endif
|
||||
|
||||
/*
|
||||
* For 32 bit environment, there seems to be the CygWin environment and then
|
||||
* all the others that try to do the same thing Microsoft does...
|
||||
*/
|
||||
/*
|
||||
* UEFI lives here because it might be built with a Microsoft toolchain and
|
||||
* we need to avoid the false positive match on Windows.
|
||||
*/
|
||||
# if defined(OPENSSL_SYS_UEFI)
|
||||
# undef OPENSSL_SYS_UNIX
|
||||
# elif defined(OPENSSL_SYS_UWIN)
|
||||
# undef OPENSSL_SYS_UNIX
|
||||
# define OPENSSL_SYS_WIN32_UWIN
|
||||
# else
|
||||
# if defined(_WIN32) || defined(OPENSSL_SYSNAME_WIN32)
|
||||
# if defined(__CYGWIN__) || defined(OPENSSL_SYS_CYGWIN)
|
||||
# undef OPENSSL_SYS_UNIX
|
||||
# define OPENSSL_SYS_WIN32
|
||||
# endif
|
||||
# if defined(OPENSSL_SYSNAME_WINNT)
|
||||
# undef OPENSSL_SYS_UNIX
|
||||
# define OPENSSL_SYS_WINNT
|
||||
# endif
|
||||
# if defined(OPENSSL_SYSNAME_WINCE)
|
||||
# undef OPENSSL_SYS_UNIX
|
||||
# define OPENSSL_SYS_WINCE
|
||||
# define OPENSSL_SYS_WIN32_CYGWIN
|
||||
# else
|
||||
# if defined(_WIN32) || defined(OPENSSL_SYS_WIN32)
|
||||
# undef OPENSSL_SYS_UNIX
|
||||
# if !defined(OPENSSL_SYS_WIN32)
|
||||
# define OPENSSL_SYS_WIN32
|
||||
# endif
|
||||
# endif
|
||||
# if defined(_WIN64) || defined(OPENSSL_SYS_WIN64)
|
||||
# undef OPENSSL_SYS_UNIX
|
||||
# if !defined(OPENSSL_SYS_WIN64)
|
||||
# define OPENSSL_SYS_WIN64
|
||||
# endif
|
||||
# endif
|
||||
# if defined(OPENSSL_SYS_WINNT)
|
||||
# undef OPENSSL_SYS_UNIX
|
||||
# endif
|
||||
# if defined(OPENSSL_SYS_WINCE)
|
||||
# undef OPENSSL_SYS_UNIX
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Anything that tries to look like Microsoft is "Windows" */
|
||||
#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE)
|
||||
# undef OPENSSL_SYS_UNIX
|
||||
# define OPENSSL_SYS_WINDOWS
|
||||
# ifndef OPENSSL_SYS_MSDOS
|
||||
# define OPENSSL_SYS_MSDOS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* DLL settings. This part is a bit tough, because it's up to the application
|
||||
implementor how he or she will link the application, so it requires some
|
||||
macro to be used. */
|
||||
#ifdef OPENSSL_SYS_WINDOWS
|
||||
# ifndef OPENSSL_OPT_WINDLL
|
||||
# if defined(_WINDLL) /* This is used when building OpenSSL to indicate that
|
||||
DLL linkage should be used */
|
||||
# define OPENSSL_OPT_WINDLL
|
||||
# if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN64) || defined(OPENSSL_SYS_WINNT) || defined(OPENSSL_SYS_WINCE)
|
||||
# undef OPENSSL_SYS_UNIX
|
||||
# define OPENSSL_SYS_WINDOWS
|
||||
# ifndef OPENSSL_SYS_MSDOS
|
||||
# define OPENSSL_SYS_MSDOS
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* -------------------------------- OpenVMS -------------------------------- */
|
||||
#if defined(__VMS) || defined(VMS) || defined(OPENSSL_SYSNAME_VMS)
|
||||
# undef OPENSSL_SYS_UNIX
|
||||
# define OPENSSL_SYS_VMS
|
||||
# if defined(__DECC)
|
||||
# define OPENSSL_SYS_VMS_DECC
|
||||
# elif defined(__DECCXX)
|
||||
# define OPENSSL_SYS_VMS_DECC
|
||||
# define OPENSSL_SYS_VMS_DECCXX
|
||||
# else
|
||||
# define OPENSSL_SYS_VMS_NODECC
|
||||
/*
|
||||
* DLL settings. This part is a bit tough, because it's up to the
|
||||
* application implementor how he or she will link the application, so it
|
||||
* requires some macro to be used.
|
||||
*/
|
||||
# ifdef OPENSSL_SYS_WINDOWS
|
||||
# ifndef OPENSSL_OPT_WINDLL
|
||||
# if defined(_WINDLL) /* This is used when building OpenSSL to
|
||||
* indicate that DLL linkage should be used */
|
||||
# define OPENSSL_OPT_WINDLL
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* --------------------------------- OS/2 ---------------------------------- */
|
||||
#if defined(__EMX__) || defined(__OS2__)
|
||||
# undef OPENSSL_SYS_UNIX
|
||||
# define OPENSSL_SYS_OS2
|
||||
#endif
|
||||
/* ------------------------------- OpenVMS -------------------------------- */
|
||||
# if defined(__VMS) || defined(VMS) || defined(OPENSSL_SYS_VMS)
|
||||
# if !defined(OPENSSL_SYS_VMS)
|
||||
# undef OPENSSL_SYS_UNIX
|
||||
# endif
|
||||
# define OPENSSL_SYS_VMS
|
||||
# if defined(__DECC)
|
||||
# define OPENSSL_SYS_VMS_DECC
|
||||
# elif defined(__DECCXX)
|
||||
# define OPENSSL_SYS_VMS_DECC
|
||||
# define OPENSSL_SYS_VMS_DECCXX
|
||||
# else
|
||||
# define OPENSSL_SYS_VMS_NODECC
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* --------------------------------- Unix ---------------------------------- */
|
||||
#ifdef OPENSSL_SYS_UNIX
|
||||
# if defined(linux) || defined(__linux__) || defined(OPENSSL_SYSNAME_LINUX)
|
||||
# define OPENSSL_SYS_LINUX
|
||||
/* -------------------------------- Unix ---------------------------------- */
|
||||
# ifdef OPENSSL_SYS_UNIX
|
||||
# if defined(linux) || defined(__linux__) && !defined(OPENSSL_SYS_LINUX)
|
||||
# define OPENSSL_SYS_LINUX
|
||||
# endif
|
||||
# if defined(_AIX) && !defined(OPENSSL_SYS_AIX)
|
||||
# define OPENSSL_SYS_AIX
|
||||
# endif
|
||||
# endif
|
||||
# ifdef OPENSSL_SYSNAME_MPE
|
||||
# define OPENSSL_SYS_MPE
|
||||
# endif
|
||||
# ifdef OPENSSL_SYSNAME_SNI
|
||||
# define OPENSSL_SYS_SNI
|
||||
# endif
|
||||
# ifdef OPENSSL_SYSNAME_ULTRASPARC
|
||||
# define OPENSSL_SYS_ULTRASPARC
|
||||
# endif
|
||||
# ifdef OPENSSL_SYSNAME_NEWS4
|
||||
# define OPENSSL_SYS_NEWS4
|
||||
# endif
|
||||
# ifdef OPENSSL_SYSNAME_MACOSX
|
||||
# define OPENSSL_SYS_MACOSX
|
||||
# endif
|
||||
# ifdef OPENSSL_SYSNAME_MACOSX_RHAPSODY
|
||||
# define OPENSSL_SYS_MACOSX_RHAPSODY
|
||||
# define OPENSSL_SYS_MACOSX
|
||||
# endif
|
||||
# ifdef OPENSSL_SYSNAME_SUNOS
|
||||
# define OPENSSL_SYS_SUNOS
|
||||
#endif
|
||||
# if defined(_CRAY) || defined(OPENSSL_SYSNAME_CRAY)
|
||||
# define OPENSSL_SYS_CRAY
|
||||
# endif
|
||||
# if defined(_AIX) || defined(OPENSSL_SYSNAME_AIX)
|
||||
# define OPENSSL_SYS_AIX
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* --------------------------------- VOS ----------------------------------- */
|
||||
#ifdef OPENSSL_SYSNAME_VOS
|
||||
# define OPENSSL_SYS_VOS
|
||||
#endif
|
||||
|
||||
/* ------------------------------- VxWorks --------------------------------- */
|
||||
#ifdef OPENSSL_SYSNAME_VXWORKS
|
||||
# define OPENSSL_SYS_VXWORKS
|
||||
#endif
|
||||
/* -------------------------------- VOS ----------------------------------- */
|
||||
# if defined(__VOS__) && !defined(OPENSSL_SYS_VOS)
|
||||
# define OPENSSL_SYS_VOS
|
||||
# ifdef __HPPA__
|
||||
# define OPENSSL_SYS_VOS_HPPA
|
||||
# endif
|
||||
# ifdef __IA32__
|
||||
# define OPENSSL_SYS_VOS_IA32
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/**
|
||||
* That's it for OS-specific stuff
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
/* Specials for I/O an exit */
|
||||
#ifdef OPENSSL_SYS_MSDOS
|
||||
# define OPENSSL_UNISTD_IO <io.h>
|
||||
# define OPENSSL_DECLARE_EXIT extern void exit(int);
|
||||
#else
|
||||
# define OPENSSL_UNISTD_IO OPENSSL_UNISTD
|
||||
# define OPENSSL_DECLARE_EXIT /* declared in unistd.h */
|
||||
#endif
|
||||
# ifdef OPENSSL_SYS_MSDOS
|
||||
# define OPENSSL_UNISTD_IO <io.h>
|
||||
# define OPENSSL_DECLARE_EXIT extern void exit(int);
|
||||
# else
|
||||
# define OPENSSL_UNISTD_IO OPENSSL_UNISTD
|
||||
# define OPENSSL_DECLARE_EXIT /* declared in unistd.h */
|
||||
# endif
|
||||
|
||||
/* Definitions of OPENSSL_GLOBAL and OPENSSL_EXTERN, to define and declare
|
||||
certain global symbols that, with some compilers under VMS, have to be
|
||||
defined and declared explicitely with globaldef and globalref.
|
||||
Definitions of OPENSSL_EXPORT and OPENSSL_IMPORT, to define and declare
|
||||
DLL exports and imports for compilers under Win32. These are a little
|
||||
more complicated to use. Basically, for any library that exports some
|
||||
global variables, the following code must be present in the header file
|
||||
that declares them, before OPENSSL_EXTERN is used:
|
||||
/*-
|
||||
* Definitions of OPENSSL_GLOBAL and OPENSSL_EXTERN, to define and declare
|
||||
* certain global symbols that, with some compilers under VMS, have to be
|
||||
* defined and declared explicitly with globaldef and globalref.
|
||||
* Definitions of OPENSSL_EXPORT and OPENSSL_IMPORT, to define and declare
|
||||
* DLL exports and imports for compilers under Win32. These are a little
|
||||
* more complicated to use. Basically, for any library that exports some
|
||||
* global variables, the following code must be present in the header file
|
||||
* that declares them, before OPENSSL_EXTERN is used:
|
||||
*
|
||||
* #ifdef SOME_BUILD_FLAG_MACRO
|
||||
* # undef OPENSSL_EXTERN
|
||||
* # define OPENSSL_EXTERN OPENSSL_EXPORT
|
||||
* #endif
|
||||
*
|
||||
* The default is to have OPENSSL_EXPORT, OPENSSL_EXTERN and OPENSSL_GLOBAL
|
||||
* have some generally sensible values.
|
||||
*/
|
||||
|
||||
#ifdef SOME_BUILD_FLAG_MACRO
|
||||
# undef OPENSSL_EXTERN
|
||||
# define OPENSSL_EXTERN OPENSSL_EXPORT
|
||||
#endif
|
||||
# if defined(OPENSSL_SYS_VMS_NODECC)
|
||||
# define OPENSSL_EXPORT globalref
|
||||
# define OPENSSL_EXTERN globalref
|
||||
# define OPENSSL_GLOBAL globaldef
|
||||
# elif defined(OPENSSL_SYS_WINDOWS) && defined(OPENSSL_OPT_WINDLL)
|
||||
# define OPENSSL_EXPORT extern __declspec(dllexport)
|
||||
# define OPENSSL_EXTERN extern __declspec(dllimport)
|
||||
# define OPENSSL_GLOBAL
|
||||
# else
|
||||
# define OPENSSL_EXPORT extern
|
||||
# define OPENSSL_EXTERN extern
|
||||
# define OPENSSL_GLOBAL
|
||||
# endif
|
||||
|
||||
The default is to have OPENSSL_EXPORT, OPENSSL_IMPORT and OPENSSL_GLOBAL
|
||||
have some generally sensible values, and for OPENSSL_EXTERN to have the
|
||||
value OPENSSL_IMPORT.
|
||||
*/
|
||||
/*-
|
||||
* Macros to allow global variables to be reached through function calls when
|
||||
* required (if a shared library version requires it, for example.
|
||||
* The way it's done allows definitions like this:
|
||||
*
|
||||
* // in foobar.c
|
||||
* OPENSSL_IMPLEMENT_GLOBAL(int,foobar,0)
|
||||
* // in foobar.h
|
||||
* OPENSSL_DECLARE_GLOBAL(int,foobar);
|
||||
* #define foobar OPENSSL_GLOBAL_REF(foobar)
|
||||
*/
|
||||
# ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION
|
||||
# define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) \
|
||||
type *_shadow_##name(void) \
|
||||
{ static type _hide_##name=value; return &_hide_##name; }
|
||||
# define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void)
|
||||
# define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name()))
|
||||
# else
|
||||
# define OPENSSL_IMPLEMENT_GLOBAL(type,name,value) OPENSSL_GLOBAL type _shadow_##name=value;
|
||||
# define OPENSSL_DECLARE_GLOBAL(type,name) OPENSSL_EXPORT type _shadow_##name
|
||||
# define OPENSSL_GLOBAL_REF(name) _shadow_##name
|
||||
# endif
|
||||
|
||||
#if defined(OPENSSL_SYS_VMS_NODECC)
|
||||
# define OPENSSL_EXPORT globalref
|
||||
# define OPENSSL_IMPORT globalref
|
||||
# define OPENSSL_GLOBAL globaldef
|
||||
#elif defined(OPENSSL_SYS_WINDOWS) && defined(OPENSSL_OPT_WINDLL)
|
||||
# define OPENSSL_EXPORT extern __declspec(dllexport)
|
||||
# define OPENSSL_IMPORT extern __declspec(dllimport)
|
||||
# define OPENSSL_GLOBAL
|
||||
#else
|
||||
# define OPENSSL_EXPORT extern
|
||||
# define OPENSSL_IMPORT extern
|
||||
# define OPENSSL_GLOBAL
|
||||
#endif
|
||||
#define OPENSSL_EXTERN OPENSSL_IMPORT
|
||||
# ifdef _WIN32
|
||||
# ifdef _WIN64
|
||||
# define ossl_ssize_t __int64
|
||||
# define OSSL_SSIZE_MAX _I64_MAX
|
||||
# else
|
||||
# define ossl_ssize_t int
|
||||
# define OSSL_SSIZE_MAX INT_MAX
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/* Macros to allow global variables to be reached through function calls when
|
||||
required (if a shared library version requvres it, for example.
|
||||
The way it's done allows definitions like this:
|
||||
# if defined(OPENSSL_SYS_UEFI) && !defined(ossl_ssize_t)
|
||||
# define ossl_ssize_t INTN
|
||||
# define OSSL_SSIZE_MAX MAX_INTN
|
||||
# endif
|
||||
|
||||
// in foobar.c
|
||||
OPENSSL_IMPLEMENT_GLOBAL(int,foobar) = 0;
|
||||
// in foobar.h
|
||||
OPENSSL_DECLARE_GLOBAL(int,foobar);
|
||||
#define foobar OPENSSL_GLOBAL_REF(foobar)
|
||||
*/
|
||||
#ifdef OPENSSL_EXPORT_VAR_AS_FUNCTION
|
||||
# define OPENSSL_IMPLEMENT_GLOBAL(type,name) \
|
||||
extern type _hide_##name; \
|
||||
type *_shadow_##name(void) { return &_hide_##name; } \
|
||||
static type _hide_##name
|
||||
# define OPENSSL_DECLARE_GLOBAL(type,name) type *_shadow_##name(void)
|
||||
# define OPENSSL_GLOBAL_REF(name) (*(_shadow_##name()))
|
||||
#else
|
||||
# define OPENSSL_IMPLEMENT_GLOBAL(type,name) OPENSSL_GLOBAL type _shadow_##name
|
||||
# define OPENSSL_DECLARE_GLOBAL(type,name) OPENSSL_EXPORT type _shadow_##name
|
||||
# define OPENSSL_GLOBAL_REF(name) _shadow_##name
|
||||
#endif
|
||||
# ifndef ossl_ssize_t
|
||||
# define ossl_ssize_t ssize_t
|
||||
# if defined(SSIZE_MAX)
|
||||
# define OSSL_SSIZE_MAX SSIZE_MAX
|
||||
# elif defined(_POSIX_SSIZE_MAX)
|
||||
# define OSSL_SSIZE_MAX _POSIX_SSIZE_MAX
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# ifdef DEBUG_UNUSED
|
||||
# define __owur __attribute__((__warn_unused_result__))
|
||||
# else
|
||||
# define __owur
|
||||
# endif
|
||||
|
||||
/* Standard integer types */
|
||||
# if defined(OPENSSL_SYS_UEFI)
|
||||
typedef INT8 int8_t;
|
||||
typedef UINT8 uint8_t;
|
||||
typedef INT16 int16_t;
|
||||
typedef UINT16 uint16_t;
|
||||
typedef INT32 int32_t;
|
||||
typedef UINT32 uint32_t;
|
||||
typedef INT64 int64_t;
|
||||
typedef UINT64 uint64_t;
|
||||
# elif (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \
|
||||
defined(__osf__) || defined(__sgi) || defined(__hpux) || \
|
||||
defined(OPENSSL_SYS_VMS) || defined (__OpenBSD__)
|
||||
# include <inttypes.h>
|
||||
# elif defined(_MSC_VER) && _MSC_VER<=1500
|
||||
/*
|
||||
* minimally required typdefs for systems not supporting inttypes.h or
|
||||
* stdint.h: currently just older VC++
|
||||
*/
|
||||
typedef signed char int8_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef short int16_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef int int32_t;
|
||||
typedef unsigned int uint32_t;
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
# else
|
||||
# include <stdint.h>
|
||||
# endif
|
||||
|
||||
/* ossl_inline: portable inline definition usable in public headers */
|
||||
# if !defined(inline) && !defined(__cplusplus)
|
||||
# if defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L
|
||||
/* just use inline */
|
||||
# define ossl_inline inline
|
||||
# elif defined(__GNUC__) && __GNUC__>=2
|
||||
# define ossl_inline __inline__
|
||||
# elif defined(_MSC_VER)
|
||||
/*
|
||||
* Visual Studio: inline is available in C++ only, however
|
||||
* __inline is available for C, see
|
||||
* http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx
|
||||
*/
|
||||
# define ossl_inline __inline
|
||||
# else
|
||||
# define ossl_inline
|
||||
# endif
|
||||
# else
|
||||
# define ossl_inline inline
|
||||
# endif
|
||||
|
||||
# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
|
||||
# define ossl_noreturn _Noreturn
|
||||
# elif defined(__GNUC__) && __GNUC__ >= 2
|
||||
# define ossl_noreturn __attribute__((noreturn))
|
||||
# else
|
||||
# define ossl_noreturn
|
||||
# endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@ -1,19 +1,33 @@
|
||||
/* crypto/ebcdic.h */
|
||||
/*
|
||||
* Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_EBCDIC_H
|
||||
#define HEADER_EBCDIC_H
|
||||
# define HEADER_EBCDIC_H
|
||||
|
||||
#include <sys/types.h>
|
||||
# include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Avoid name clashes with other applications */
|
||||
#define os_toascii _openssl_os_toascii
|
||||
#define os_toebcdic _openssl_os_toebcdic
|
||||
#define ebcdic2ascii _openssl_ebcdic2ascii
|
||||
#define ascii2ebcdic _openssl_ascii2ebcdic
|
||||
# define os_toascii _openssl_os_toascii
|
||||
# define os_toebcdic _openssl_os_toebcdic
|
||||
# define ebcdic2ascii _openssl_ebcdic2ascii
|
||||
# define ascii2ebcdic _openssl_ascii2ebcdic
|
||||
|
||||
extern const unsigned char os_toascii[256];
|
||||
extern const unsigned char os_toebcdic[256];
|
||||
void *ebcdic2ascii(void *dest, const void *srce, size_t count);
|
||||
void *ascii2ebcdic(void *dest, const void *srce, size_t count);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,123 +1,10 @@
|
||||
/* crypto/ecdh/ecdh.h */
|
||||
/* ====================================================================
|
||||
* Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
|
||||
*
|
||||
* The Elliptic Curve Public-Key Crypto Library (ECC Code) included
|
||||
* herein is developed by SUN MICROSYSTEMS, INC., and is contributed
|
||||
* to the OpenSSL project.
|
||||
*
|
||||
* The ECC Code is licensed pursuant to the OpenSSL open source
|
||||
* license provided below.
|
||||
*
|
||||
* The ECDH software is originally written by Douglas Stebila of
|
||||
* Sun Microsystems Laboratories.
|
||||
/*
|
||||
* Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 2000-2002 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* licensing@OpenSSL.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||
* Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
*/
|
||||
#ifndef HEADER_ECDH_H
|
||||
#define HEADER_ECDH_H
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
|
||||
#ifdef OPENSSL_NO_ECDH
|
||||
#error ECDH is disabled.
|
||||
#endif
|
||||
|
||||
#include <openssl/ec.h>
|
||||
#include <openssl/ossl_typ.h>
|
||||
#ifndef OPENSSL_NO_DEPRECATED
|
||||
#include <openssl/bn.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
const ECDH_METHOD *ECDH_OpenSSL(void);
|
||||
|
||||
void ECDH_set_default_method(const ECDH_METHOD *);
|
||||
const ECDH_METHOD *ECDH_get_default_method(void);
|
||||
int ECDH_set_method(EC_KEY *, const ECDH_METHOD *);
|
||||
|
||||
int ECDH_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, EC_KEY *ecdh,
|
||||
void *(*KDF)(const void *in, size_t inlen, void *out, size_t *outlen));
|
||||
|
||||
int ECDH_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new
|
||||
*new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
|
||||
int ECDH_set_ex_data(EC_KEY *d, int idx, void *arg);
|
||||
void *ECDH_get_ex_data(EC_KEY *d, int idx);
|
||||
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
void ERR_load_ECDH_strings(void);
|
||||
|
||||
/* Error codes for the ECDH functions. */
|
||||
|
||||
/* Function codes. */
|
||||
#define ECDH_F_ECDH_COMPUTE_KEY 100
|
||||
#define ECDH_F_ECDH_DATA_NEW_METHOD 101
|
||||
|
||||
/* Reason codes. */
|
||||
#define ECDH_R_KDF_FAILED 102
|
||||
#define ECDH_R_NO_PRIVATE_VALUE 100
|
||||
#define ECDH_R_POINT_ARITHMETIC_FAILURE 101
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -1,270 +1,10 @@
|
||||
/* crypto/ecdsa/ecdsa.h */
|
||||
/**
|
||||
* \file crypto/ecdsa/ecdsa.h Include file for the OpenSSL ECDSA functions
|
||||
* \author Written by Nils Larsch for the OpenSSL project
|
||||
/*
|
||||
* Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 2000-2003 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* licensing@OpenSSL.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||
* Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
*/
|
||||
#ifndef HEADER_ECDSA_H
|
||||
#define HEADER_ECDSA_H
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
|
||||
#ifdef OPENSSL_NO_ECDSA
|
||||
#error ECDSA is disabled.
|
||||
#endif
|
||||
|
||||
#include <openssl/ec.h>
|
||||
#include <openssl/ossl_typ.h>
|
||||
#ifndef OPENSSL_NO_DEPRECATED
|
||||
#include <openssl/bn.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct ECDSA_SIG_st
|
||||
{
|
||||
BIGNUM *r;
|
||||
BIGNUM *s;
|
||||
} ECDSA_SIG;
|
||||
|
||||
/** ECDSA_SIG *ECDSA_SIG_new(void)
|
||||
* allocates and initialize a ECDSA_SIG structure
|
||||
* \return pointer to a ECDSA_SIG structure or NULL if an error occurred
|
||||
*/
|
||||
ECDSA_SIG *ECDSA_SIG_new(void);
|
||||
|
||||
/** ECDSA_SIG_free
|
||||
* frees a ECDSA_SIG structure
|
||||
* \param a pointer to the ECDSA_SIG structure
|
||||
*/
|
||||
void ECDSA_SIG_free(ECDSA_SIG *a);
|
||||
|
||||
/** i2d_ECDSA_SIG
|
||||
* DER encode content of ECDSA_SIG object (note: this function modifies *pp
|
||||
* (*pp += length of the DER encoded signature)).
|
||||
* \param a pointer to the ECDSA_SIG object
|
||||
* \param pp pointer to a unsigned char pointer for the output or NULL
|
||||
* \return the length of the DER encoded ECDSA_SIG object or 0
|
||||
*/
|
||||
int i2d_ECDSA_SIG(const ECDSA_SIG *a, unsigned char **pp);
|
||||
|
||||
/** d2i_ECDSA_SIG
|
||||
* decodes a DER encoded ECDSA signature (note: this function changes *pp
|
||||
* (*pp += len)).
|
||||
* \param v pointer to ECDSA_SIG pointer (may be NULL)
|
||||
* \param pp buffer with the DER encoded signature
|
||||
* \param len bufferlength
|
||||
* \return pointer to the decoded ECDSA_SIG structure (or NULL)
|
||||
*/
|
||||
ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **v, const unsigned char **pp, long len);
|
||||
|
||||
/** ECDSA_do_sign
|
||||
* computes the ECDSA signature of the given hash value using
|
||||
* the supplied private key and returns the created signature.
|
||||
* \param dgst pointer to the hash value
|
||||
* \param dgst_len length of the hash value
|
||||
* \param eckey pointer to the EC_KEY object containing a private EC key
|
||||
* \return pointer to a ECDSA_SIG structure or NULL
|
||||
*/
|
||||
ECDSA_SIG *ECDSA_do_sign(const unsigned char *dgst,int dgst_len,EC_KEY *eckey);
|
||||
|
||||
/** ECDSA_do_sign_ex
|
||||
* computes ECDSA signature of a given hash value using the supplied
|
||||
* private key (note: sig must point to ECDSA_size(eckey) bytes of memory).
|
||||
* \param dgst pointer to the hash value to sign
|
||||
* \param dgstlen length of the hash value
|
||||
* \param kinv optional pointer to a pre-computed inverse k
|
||||
* \param rp optional pointer to the pre-computed rp value (see
|
||||
* ECDSA_sign_setup
|
||||
* \param eckey pointer to the EC_KEY object containing a private EC key
|
||||
* \return pointer to a ECDSA_SIG structure or NULL
|
||||
*/
|
||||
ECDSA_SIG *ECDSA_do_sign_ex(const unsigned char *dgst, int dgstlen,
|
||||
const BIGNUM *kinv, const BIGNUM *rp, EC_KEY *eckey);
|
||||
|
||||
/** ECDSA_do_verify
|
||||
* verifies that the supplied signature is a valid ECDSA
|
||||
* signature of the supplied hash value using the supplied public key.
|
||||
* \param dgst pointer to the hash value
|
||||
* \param dgst_len length of the hash value
|
||||
* \param sig pointer to the ECDSA_SIG structure
|
||||
* \param eckey pointer to the EC_KEY object containing a public EC key
|
||||
* \return 1 if the signature is valid, 0 if the signature is invalid and -1 on error
|
||||
*/
|
||||
int ECDSA_do_verify(const unsigned char *dgst, int dgst_len,
|
||||
const ECDSA_SIG *sig, EC_KEY* eckey);
|
||||
|
||||
const ECDSA_METHOD *ECDSA_OpenSSL(void);
|
||||
|
||||
/** ECDSA_set_default_method
|
||||
* sets the default ECDSA method
|
||||
* \param meth the new default ECDSA_METHOD
|
||||
*/
|
||||
void ECDSA_set_default_method(const ECDSA_METHOD *meth);
|
||||
|
||||
/** ECDSA_get_default_method
|
||||
* returns the default ECDSA method
|
||||
* \return pointer to ECDSA_METHOD structure containing the default method
|
||||
*/
|
||||
const ECDSA_METHOD *ECDSA_get_default_method(void);
|
||||
|
||||
/** ECDSA_set_method
|
||||
* sets method to be used for the ECDSA operations
|
||||
* \param eckey pointer to the EC_KEY object
|
||||
* \param meth pointer to the new method
|
||||
* \return 1 on success and 0 otherwise
|
||||
*/
|
||||
int ECDSA_set_method(EC_KEY *eckey, const ECDSA_METHOD *meth);
|
||||
|
||||
/** ECDSA_size
|
||||
* returns the maximum length of the DER encoded signature
|
||||
* \param eckey pointer to a EC_KEY object
|
||||
* \return numbers of bytes required for the DER encoded signature
|
||||
*/
|
||||
int ECDSA_size(const EC_KEY *eckey);
|
||||
|
||||
/** ECDSA_sign_setup
|
||||
* precompute parts of the signing operation.
|
||||
* \param eckey pointer to the EC_KEY object containing a private EC key
|
||||
* \param ctx pointer to a BN_CTX object (may be NULL)
|
||||
* \param kinv pointer to a BIGNUM pointer for the inverse of k
|
||||
* \param rp pointer to a BIGNUM pointer for x coordinate of k * generator
|
||||
* \return 1 on success and 0 otherwise
|
||||
*/
|
||||
int ECDSA_sign_setup(EC_KEY *eckey, BN_CTX *ctx, BIGNUM **kinv,
|
||||
BIGNUM **rp);
|
||||
|
||||
/** ECDSA_sign
|
||||
* computes ECDSA signature of a given hash value using the supplied
|
||||
* private key (note: sig must point to ECDSA_size(eckey) bytes of memory).
|
||||
* \param type this parameter is ignored
|
||||
* \param dgst pointer to the hash value to sign
|
||||
* \param dgstlen length of the hash value
|
||||
* \param sig buffer to hold the DER encoded signature
|
||||
* \param siglen pointer to the length of the returned signature
|
||||
* \param eckey pointer to the EC_KEY object containing a private EC key
|
||||
* \return 1 on success and 0 otherwise
|
||||
*/
|
||||
int ECDSA_sign(int type, const unsigned char *dgst, int dgstlen,
|
||||
unsigned char *sig, unsigned int *siglen, EC_KEY *eckey);
|
||||
|
||||
|
||||
/** ECDSA_sign_ex
|
||||
* computes ECDSA signature of a given hash value using the supplied
|
||||
* private key (note: sig must point to ECDSA_size(eckey) bytes of memory).
|
||||
* \param type this parameter is ignored
|
||||
* \param dgst pointer to the hash value to sign
|
||||
* \param dgstlen length of the hash value
|
||||
* \param sig buffer to hold the DER encoded signature
|
||||
* \param siglen pointer to the length of the returned signature
|
||||
* \param kinv optional pointer to a pre-computed inverse k
|
||||
* \param rp optional pointer to the pre-computed rp value (see
|
||||
* ECDSA_sign_setup
|
||||
* \param eckey pointer to the EC_KEY object containing a private EC key
|
||||
* \return 1 on success and 0 otherwise
|
||||
*/
|
||||
int ECDSA_sign_ex(int type, const unsigned char *dgst, int dgstlen,
|
||||
unsigned char *sig, unsigned int *siglen, const BIGNUM *kinv,
|
||||
const BIGNUM *rp, EC_KEY *eckey);
|
||||
|
||||
/** ECDSA_verify
|
||||
* verifies that the given signature is valid ECDSA signature
|
||||
* of the supplied hash value using the specified public key.
|
||||
* \param type this parameter is ignored
|
||||
* \param dgst pointer to the hash value
|
||||
* \param dgstlen length of the hash value
|
||||
* \param sig pointer to the DER encoded signature
|
||||
* \param siglen length of the DER encoded signature
|
||||
* \param eckey pointer to the EC_KEY object containing a public EC key
|
||||
* \return 1 if the signature is valid, 0 if the signature is invalid and -1 on error
|
||||
*/
|
||||
int ECDSA_verify(int type, const unsigned char *dgst, int dgstlen,
|
||||
const unsigned char *sig, int siglen, EC_KEY *eckey);
|
||||
|
||||
/* the standard ex_data functions */
|
||||
int ECDSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new
|
||||
*new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
|
||||
int ECDSA_set_ex_data(EC_KEY *d, int idx, void *arg);
|
||||
void *ECDSA_get_ex_data(EC_KEY *d, int idx);
|
||||
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
void ERR_load_ECDSA_strings(void);
|
||||
|
||||
/* Error codes for the ECDSA functions. */
|
||||
|
||||
/* Function codes. */
|
||||
#define ECDSA_F_ECDSA_DATA_NEW_METHOD 100
|
||||
#define ECDSA_F_ECDSA_DO_SIGN 101
|
||||
#define ECDSA_F_ECDSA_DO_VERIFY 102
|
||||
#define ECDSA_F_ECDSA_SIGN_SETUP 103
|
||||
|
||||
/* Reason codes. */
|
||||
#define ECDSA_R_BAD_SIGNATURE 100
|
||||
#define ECDSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 101
|
||||
#define ECDSA_R_ERR_EC_LIB 102
|
||||
#define ECDSA_R_MISSING_PARAMETERS 103
|
||||
#define ECDSA_R_RANDOM_NUMBER_GENERATION_FAILED 104
|
||||
#define ECDSA_R_SIGNATURE_MALLOC_FAILED 105
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,317 +1,259 @@
|
||||
/* crypto/err/err.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_ERR_H
|
||||
#define HEADER_ERR_H
|
||||
# define HEADER_ERR_H
|
||||
|
||||
#include <openssl/e_os2.h>
|
||||
# include <openssl/e_os2.h>
|
||||
|
||||
#ifndef OPENSSL_NO_FP_API
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#endif
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
# include <stdio.h>
|
||||
# include <stdlib.h>
|
||||
# endif
|
||||
|
||||
#include <openssl/ossl_typ.h>
|
||||
#ifndef OPENSSL_NO_BIO
|
||||
#include <openssl/bio.h>
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_LHASH
|
||||
#include <openssl/lhash.h>
|
||||
#endif
|
||||
# include <openssl/ossl_typ.h>
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/lhash.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_ERR
|
||||
#define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,d,e)
|
||||
#else
|
||||
#define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,NULL,0)
|
||||
#endif
|
||||
# ifndef OPENSSL_NO_ERR
|
||||
# define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,d,e)
|
||||
# else
|
||||
# define ERR_PUT_error(a,b,c,d,e) ERR_put_error(a,b,c,NULL,0)
|
||||
# endif
|
||||
|
||||
#include <errno.h>
|
||||
# include <errno.h>
|
||||
|
||||
#define ERR_TXT_MALLOCED 0x01
|
||||
#define ERR_TXT_STRING 0x02
|
||||
# define ERR_TXT_MALLOCED 0x01
|
||||
# define ERR_TXT_STRING 0x02
|
||||
|
||||
#define ERR_FLAG_MARK 0x01
|
||||
# define ERR_FLAG_MARK 0x01
|
||||
|
||||
#define ERR_NUM_ERRORS 16
|
||||
typedef struct err_state_st
|
||||
{
|
||||
unsigned long pid;
|
||||
int err_flags[ERR_NUM_ERRORS];
|
||||
unsigned long err_buffer[ERR_NUM_ERRORS];
|
||||
char *err_data[ERR_NUM_ERRORS];
|
||||
int err_data_flags[ERR_NUM_ERRORS];
|
||||
const char *err_file[ERR_NUM_ERRORS];
|
||||
int err_line[ERR_NUM_ERRORS];
|
||||
int top,bottom;
|
||||
} ERR_STATE;
|
||||
# define ERR_NUM_ERRORS 16
|
||||
typedef struct err_state_st {
|
||||
int err_flags[ERR_NUM_ERRORS];
|
||||
unsigned long err_buffer[ERR_NUM_ERRORS];
|
||||
char *err_data[ERR_NUM_ERRORS];
|
||||
int err_data_flags[ERR_NUM_ERRORS];
|
||||
const char *err_file[ERR_NUM_ERRORS];
|
||||
int err_line[ERR_NUM_ERRORS];
|
||||
int top, bottom;
|
||||
} ERR_STATE;
|
||||
|
||||
/* library */
|
||||
#define ERR_LIB_NONE 1
|
||||
#define ERR_LIB_SYS 2
|
||||
#define ERR_LIB_BN 3
|
||||
#define ERR_LIB_RSA 4
|
||||
#define ERR_LIB_DH 5
|
||||
#define ERR_LIB_EVP 6
|
||||
#define ERR_LIB_BUF 7
|
||||
#define ERR_LIB_OBJ 8
|
||||
#define ERR_LIB_PEM 9
|
||||
#define ERR_LIB_DSA 10
|
||||
#define ERR_LIB_X509 11
|
||||
# define ERR_LIB_NONE 1
|
||||
# define ERR_LIB_SYS 2
|
||||
# define ERR_LIB_BN 3
|
||||
# define ERR_LIB_RSA 4
|
||||
# define ERR_LIB_DH 5
|
||||
# define ERR_LIB_EVP 6
|
||||
# define ERR_LIB_BUF 7
|
||||
# define ERR_LIB_OBJ 8
|
||||
# define ERR_LIB_PEM 9
|
||||
# define ERR_LIB_DSA 10
|
||||
# define ERR_LIB_X509 11
|
||||
/* #define ERR_LIB_METH 12 */
|
||||
#define ERR_LIB_ASN1 13
|
||||
#define ERR_LIB_CONF 14
|
||||
#define ERR_LIB_CRYPTO 15
|
||||
#define ERR_LIB_EC 16
|
||||
#define ERR_LIB_SSL 20
|
||||
# define ERR_LIB_ASN1 13
|
||||
# define ERR_LIB_CONF 14
|
||||
# define ERR_LIB_CRYPTO 15
|
||||
# define ERR_LIB_EC 16
|
||||
# define ERR_LIB_SSL 20
|
||||
/* #define ERR_LIB_SSL23 21 */
|
||||
/* #define ERR_LIB_SSL2 22 */
|
||||
/* #define ERR_LIB_SSL3 23 */
|
||||
/* #define ERR_LIB_RSAREF 30 */
|
||||
/* #define ERR_LIB_PROXY 31 */
|
||||
#define ERR_LIB_BIO 32
|
||||
#define ERR_LIB_PKCS7 33
|
||||
#define ERR_LIB_X509V3 34
|
||||
#define ERR_LIB_PKCS12 35
|
||||
#define ERR_LIB_RAND 36
|
||||
#define ERR_LIB_DSO 37
|
||||
#define ERR_LIB_ENGINE 38
|
||||
#define ERR_LIB_OCSP 39
|
||||
#define ERR_LIB_UI 40
|
||||
#define ERR_LIB_COMP 41
|
||||
#define ERR_LIB_ECDSA 42
|
||||
#define ERR_LIB_ECDH 43
|
||||
#define ERR_LIB_STORE 44
|
||||
# define ERR_LIB_BIO 32
|
||||
# define ERR_LIB_PKCS7 33
|
||||
# define ERR_LIB_X509V3 34
|
||||
# define ERR_LIB_PKCS12 35
|
||||
# define ERR_LIB_RAND 36
|
||||
# define ERR_LIB_DSO 37
|
||||
# define ERR_LIB_ENGINE 38
|
||||
# define ERR_LIB_OCSP 39
|
||||
# define ERR_LIB_UI 40
|
||||
# define ERR_LIB_COMP 41
|
||||
# define ERR_LIB_ECDSA 42
|
||||
# define ERR_LIB_ECDH 43
|
||||
# define ERR_LIB_STORE 44
|
||||
# define ERR_LIB_FIPS 45
|
||||
# define ERR_LIB_CMS 46
|
||||
# define ERR_LIB_TS 47
|
||||
# define ERR_LIB_HMAC 48
|
||||
/* # define ERR_LIB_JPAKE 49 */
|
||||
# define ERR_LIB_CT 50
|
||||
# define ERR_LIB_ASYNC 51
|
||||
# define ERR_LIB_KDF 52
|
||||
|
||||
#define ERR_LIB_USER 128
|
||||
# define ERR_LIB_USER 128
|
||||
|
||||
#define SYSerr(f,r) ERR_PUT_error(ERR_LIB_SYS,(f),(r),__FILE__,__LINE__)
|
||||
#define BNerr(f,r) ERR_PUT_error(ERR_LIB_BN,(f),(r),__FILE__,__LINE__)
|
||||
#define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,(f),(r),__FILE__,__LINE__)
|
||||
#define DHerr(f,r) ERR_PUT_error(ERR_LIB_DH,(f),(r),__FILE__,__LINE__)
|
||||
#define EVPerr(f,r) ERR_PUT_error(ERR_LIB_EVP,(f),(r),__FILE__,__LINE__)
|
||||
#define BUFerr(f,r) ERR_PUT_error(ERR_LIB_BUF,(f),(r),__FILE__,__LINE__)
|
||||
#define OBJerr(f,r) ERR_PUT_error(ERR_LIB_OBJ,(f),(r),__FILE__,__LINE__)
|
||||
#define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,(f),(r),__FILE__,__LINE__)
|
||||
#define DSAerr(f,r) ERR_PUT_error(ERR_LIB_DSA,(f),(r),__FILE__,__LINE__)
|
||||
#define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),__FILE__,__LINE__)
|
||||
#define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),__FILE__,__LINE__)
|
||||
#define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),__FILE__,__LINE__)
|
||||
#define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),__FILE__,__LINE__)
|
||||
#define ECerr(f,r) ERR_PUT_error(ERR_LIB_EC,(f),(r),__FILE__,__LINE__)
|
||||
#define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),__FILE__,__LINE__)
|
||||
#define BIOerr(f,r) ERR_PUT_error(ERR_LIB_BIO,(f),(r),__FILE__,__LINE__)
|
||||
#define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),__FILE__,__LINE__)
|
||||
#define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),__FILE__,__LINE__)
|
||||
#define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),__FILE__,__LINE__)
|
||||
#define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),__FILE__,__LINE__)
|
||||
#define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),__FILE__,__LINE__)
|
||||
#define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),__FILE__,__LINE__)
|
||||
#define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),__FILE__,__LINE__)
|
||||
#define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),__FILE__,__LINE__)
|
||||
#define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),__FILE__,__LINE__)
|
||||
#define ECDSAerr(f,r) ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),__FILE__,__LINE__)
|
||||
#define ECDHerr(f,r) ERR_PUT_error(ERR_LIB_ECDH,(f),(r),__FILE__,__LINE__)
|
||||
#define STOREerr(f,r) ERR_PUT_error(ERR_LIB_STORE,(f),(r),__FILE__,__LINE__)
|
||||
|
||||
/* Borland C seems too stupid to be able to shift and do longs in
|
||||
* the pre-processor :-( */
|
||||
#define ERR_PACK(l,f,r) (((((unsigned long)l)&0xffL)*0x1000000)| \
|
||||
((((unsigned long)f)&0xfffL)*0x1000)| \
|
||||
((((unsigned long)r)&0xfffL)))
|
||||
#define ERR_GET_LIB(l) (int)((((unsigned long)l)>>24L)&0xffL)
|
||||
#define ERR_GET_FUNC(l) (int)((((unsigned long)l)>>12L)&0xfffL)
|
||||
#define ERR_GET_REASON(l) (int)((l)&0xfffL)
|
||||
#define ERR_FATAL_ERROR(l) (int)((l)&ERR_R_FATAL)
|
||||
# define SYSerr(f,r) ERR_PUT_error(ERR_LIB_SYS,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define BNerr(f,r) ERR_PUT_error(ERR_LIB_BN,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define DHerr(f,r) ERR_PUT_error(ERR_LIB_DH,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define EVPerr(f,r) ERR_PUT_error(ERR_LIB_EVP,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define BUFerr(f,r) ERR_PUT_error(ERR_LIB_BUF,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define OBJerr(f,r) ERR_PUT_error(ERR_LIB_OBJ,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define DSAerr(f,r) ERR_PUT_error(ERR_LIB_DSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define ECerr(f,r) ERR_PUT_error(ERR_LIB_EC,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define BIOerr(f,r) ERR_PUT_error(ERR_LIB_BIO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define ECDSAerr(f,r) ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define ECDHerr(f,r) ERR_PUT_error(ERR_LIB_ECDH,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define STOREerr(f,r) ERR_PUT_error(ERR_LIB_STORE,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define ASYNCerr(f,r) ERR_PUT_error(ERR_LIB_ASYNC,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
# define KDFerr(f,r) ERR_PUT_error(ERR_LIB_KDF,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
|
||||
|
||||
# define ERR_PACK(l,f,r) ( \
|
||||
(((unsigned int)(l) & 0x0FF) << 24L) | \
|
||||
(((unsigned int)(f) & 0xFFF) << 12L) | \
|
||||
(((unsigned int)(r) & 0xFFF) ) )
|
||||
# define ERR_GET_LIB(l) (int)(((l) >> 24L) & 0x0FFL)
|
||||
# define ERR_GET_FUNC(l) (int)(((l) >> 12L) & 0xFFFL)
|
||||
# define ERR_GET_REASON(l) (int)( (l) & 0xFFFL)
|
||||
# define ERR_FATAL_ERROR(l) (int)( (l) & ERR_R_FATAL)
|
||||
|
||||
/* OS functions */
|
||||
#define SYS_F_FOPEN 1
|
||||
#define SYS_F_CONNECT 2
|
||||
#define SYS_F_GETSERVBYNAME 3
|
||||
#define SYS_F_SOCKET 4
|
||||
#define SYS_F_IOCTLSOCKET 5
|
||||
#define SYS_F_BIND 6
|
||||
#define SYS_F_LISTEN 7
|
||||
#define SYS_F_ACCEPT 8
|
||||
#define SYS_F_WSASTARTUP 9 /* Winsock stuff */
|
||||
#define SYS_F_OPENDIR 10
|
||||
#define SYS_F_FREAD 11
|
||||
|
||||
# define SYS_F_FOPEN 1
|
||||
# define SYS_F_CONNECT 2
|
||||
# define SYS_F_GETSERVBYNAME 3
|
||||
# define SYS_F_SOCKET 4
|
||||
# define SYS_F_IOCTLSOCKET 5
|
||||
# define SYS_F_BIND 6
|
||||
# define SYS_F_LISTEN 7
|
||||
# define SYS_F_ACCEPT 8
|
||||
# define SYS_F_WSASTARTUP 9/* Winsock stuff */
|
||||
# define SYS_F_OPENDIR 10
|
||||
# define SYS_F_FREAD 11
|
||||
# define SYS_F_GETADDRINFO 12
|
||||
# define SYS_F_GETNAMEINFO 13
|
||||
# define SYS_F_SETSOCKOPT 14
|
||||
# define SYS_F_GETSOCKOPT 15
|
||||
# define SYS_F_GETSOCKNAME 16
|
||||
# define SYS_F_GETHOSTBYNAME 17
|
||||
# define SYS_F_FFLUSH 18
|
||||
|
||||
/* reasons */
|
||||
#define ERR_R_SYS_LIB ERR_LIB_SYS /* 2 */
|
||||
#define ERR_R_BN_LIB ERR_LIB_BN /* 3 */
|
||||
#define ERR_R_RSA_LIB ERR_LIB_RSA /* 4 */
|
||||
#define ERR_R_DH_LIB ERR_LIB_DH /* 5 */
|
||||
#define ERR_R_EVP_LIB ERR_LIB_EVP /* 6 */
|
||||
#define ERR_R_BUF_LIB ERR_LIB_BUF /* 7 */
|
||||
#define ERR_R_OBJ_LIB ERR_LIB_OBJ /* 8 */
|
||||
#define ERR_R_PEM_LIB ERR_LIB_PEM /* 9 */
|
||||
#define ERR_R_DSA_LIB ERR_LIB_DSA /* 10 */
|
||||
#define ERR_R_X509_LIB ERR_LIB_X509 /* 11 */
|
||||
#define ERR_R_ASN1_LIB ERR_LIB_ASN1 /* 13 */
|
||||
#define ERR_R_CONF_LIB ERR_LIB_CONF /* 14 */
|
||||
#define ERR_R_CRYPTO_LIB ERR_LIB_CRYPTO /* 15 */
|
||||
#define ERR_R_EC_LIB ERR_LIB_EC /* 16 */
|
||||
#define ERR_R_SSL_LIB ERR_LIB_SSL /* 20 */
|
||||
#define ERR_R_BIO_LIB ERR_LIB_BIO /* 32 */
|
||||
#define ERR_R_PKCS7_LIB ERR_LIB_PKCS7 /* 33 */
|
||||
#define ERR_R_X509V3_LIB ERR_LIB_X509V3 /* 34 */
|
||||
#define ERR_R_PKCS12_LIB ERR_LIB_PKCS12 /* 35 */
|
||||
#define ERR_R_RAND_LIB ERR_LIB_RAND /* 36 */
|
||||
#define ERR_R_DSO_LIB ERR_LIB_DSO /* 37 */
|
||||
#define ERR_R_ENGINE_LIB ERR_LIB_ENGINE /* 38 */
|
||||
#define ERR_R_OCSP_LIB ERR_LIB_OCSP /* 39 */
|
||||
#define ERR_R_UI_LIB ERR_LIB_UI /* 40 */
|
||||
#define ERR_R_COMP_LIB ERR_LIB_COMP /* 41 */
|
||||
#define ERR_R_ECDSA_LIB ERR_LIB_ECDSA /* 42 */
|
||||
#define ERR_R_ECDH_LIB ERR_LIB_ECDH /* 43 */
|
||||
#define ERR_R_STORE_LIB ERR_LIB_STORE /* 44 */
|
||||
# define ERR_R_SYS_LIB ERR_LIB_SYS/* 2 */
|
||||
# define ERR_R_BN_LIB ERR_LIB_BN/* 3 */
|
||||
# define ERR_R_RSA_LIB ERR_LIB_RSA/* 4 */
|
||||
# define ERR_R_DH_LIB ERR_LIB_DH/* 5 */
|
||||
# define ERR_R_EVP_LIB ERR_LIB_EVP/* 6 */
|
||||
# define ERR_R_BUF_LIB ERR_LIB_BUF/* 7 */
|
||||
# define ERR_R_OBJ_LIB ERR_LIB_OBJ/* 8 */
|
||||
# define ERR_R_PEM_LIB ERR_LIB_PEM/* 9 */
|
||||
# define ERR_R_DSA_LIB ERR_LIB_DSA/* 10 */
|
||||
# define ERR_R_X509_LIB ERR_LIB_X509/* 11 */
|
||||
# define ERR_R_ASN1_LIB ERR_LIB_ASN1/* 13 */
|
||||
# define ERR_R_EC_LIB ERR_LIB_EC/* 16 */
|
||||
# define ERR_R_BIO_LIB ERR_LIB_BIO/* 32 */
|
||||
# define ERR_R_PKCS7_LIB ERR_LIB_PKCS7/* 33 */
|
||||
# define ERR_R_X509V3_LIB ERR_LIB_X509V3/* 34 */
|
||||
# define ERR_R_ENGINE_LIB ERR_LIB_ENGINE/* 38 */
|
||||
# define ERR_R_ECDSA_LIB ERR_LIB_ECDSA/* 42 */
|
||||
|
||||
#define ERR_R_NESTED_ASN1_ERROR 58
|
||||
#define ERR_R_BAD_ASN1_OBJECT_HEADER 59
|
||||
#define ERR_R_BAD_GET_ASN1_OBJECT_CALL 60
|
||||
#define ERR_R_EXPECTING_AN_ASN1_SEQUENCE 61
|
||||
#define ERR_R_ASN1_LENGTH_MISMATCH 62
|
||||
#define ERR_R_MISSING_ASN1_EOS 63
|
||||
# define ERR_R_NESTED_ASN1_ERROR 58
|
||||
# define ERR_R_MISSING_ASN1_EOS 63
|
||||
|
||||
/* fatal error */
|
||||
#define ERR_R_FATAL 64
|
||||
#define ERR_R_MALLOC_FAILURE (1|ERR_R_FATAL)
|
||||
#define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED (2|ERR_R_FATAL)
|
||||
#define ERR_R_PASSED_NULL_PARAMETER (3|ERR_R_FATAL)
|
||||
#define ERR_R_INTERNAL_ERROR (4|ERR_R_FATAL)
|
||||
#define ERR_R_DISABLED (5|ERR_R_FATAL)
|
||||
# define ERR_R_FATAL 64
|
||||
# define ERR_R_MALLOC_FAILURE (1|ERR_R_FATAL)
|
||||
# define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED (2|ERR_R_FATAL)
|
||||
# define ERR_R_PASSED_NULL_PARAMETER (3|ERR_R_FATAL)
|
||||
# define ERR_R_INTERNAL_ERROR (4|ERR_R_FATAL)
|
||||
# define ERR_R_DISABLED (5|ERR_R_FATAL)
|
||||
# define ERR_R_INIT_FAIL (6|ERR_R_FATAL)
|
||||
# define ERR_R_PASSED_INVALID_ARGUMENT (7)
|
||||
|
||||
/* 99 is the maximum possible ERR_R_... code, higher values
|
||||
* are reserved for the individual libraries */
|
||||
/*
|
||||
* 99 is the maximum possible ERR_R_... code, higher values are reserved for
|
||||
* the individual libraries
|
||||
*/
|
||||
|
||||
typedef struct ERR_string_data_st {
|
||||
unsigned long error;
|
||||
const char *string;
|
||||
} ERR_STRING_DATA;
|
||||
|
||||
typedef struct ERR_string_data_st
|
||||
{
|
||||
unsigned long error;
|
||||
const char *string;
|
||||
} ERR_STRING_DATA;
|
||||
DEFINE_LHASH_OF(ERR_STRING_DATA);
|
||||
|
||||
void ERR_put_error(int lib, int func,int reason,const char *file,int line);
|
||||
void ERR_set_error_data(char *data,int flags);
|
||||
void ERR_put_error(int lib, int func, int reason, const char *file, int line);
|
||||
void ERR_set_error_data(char *data, int flags);
|
||||
|
||||
unsigned long ERR_get_error(void);
|
||||
unsigned long ERR_get_error_line(const char **file,int *line);
|
||||
unsigned long ERR_get_error_line_data(const char **file,int *line,
|
||||
const char **data, int *flags);
|
||||
unsigned long ERR_get_error_line(const char **file, int *line);
|
||||
unsigned long ERR_get_error_line_data(const char **file, int *line,
|
||||
const char **data, int *flags);
|
||||
unsigned long ERR_peek_error(void);
|
||||
unsigned long ERR_peek_error_line(const char **file,int *line);
|
||||
unsigned long ERR_peek_error_line_data(const char **file,int *line,
|
||||
const char **data,int *flags);
|
||||
unsigned long ERR_peek_error_line(const char **file, int *line);
|
||||
unsigned long ERR_peek_error_line_data(const char **file, int *line,
|
||||
const char **data, int *flags);
|
||||
unsigned long ERR_peek_last_error(void);
|
||||
unsigned long ERR_peek_last_error_line(const char **file,int *line);
|
||||
unsigned long ERR_peek_last_error_line_data(const char **file,int *line,
|
||||
const char **data,int *flags);
|
||||
void ERR_clear_error(void );
|
||||
char *ERR_error_string(unsigned long e,char *buf);
|
||||
unsigned long ERR_peek_last_error_line(const char **file, int *line);
|
||||
unsigned long ERR_peek_last_error_line_data(const char **file, int *line,
|
||||
const char **data, int *flags);
|
||||
void ERR_clear_error(void);
|
||||
char *ERR_error_string(unsigned long e, char *buf);
|
||||
void ERR_error_string_n(unsigned long e, char *buf, size_t len);
|
||||
const char *ERR_lib_error_string(unsigned long e);
|
||||
const char *ERR_func_error_string(unsigned long e);
|
||||
const char *ERR_reason_error_string(unsigned long e);
|
||||
void ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u),
|
||||
void *u);
|
||||
#ifndef OPENSSL_NO_FP_API
|
||||
void ERR_print_errors_cb(int (*cb) (const char *str, size_t len, void *u),
|
||||
void *u);
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
void ERR_print_errors_fp(FILE *fp);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_BIO
|
||||
# endif
|
||||
void ERR_print_errors(BIO *bp);
|
||||
void ERR_add_error_data(int num, ...);
|
||||
#endif
|
||||
void ERR_load_strings(int lib,ERR_STRING_DATA str[]);
|
||||
void ERR_unload_strings(int lib,ERR_STRING_DATA str[]);
|
||||
void ERR_load_ERR_strings(void);
|
||||
void ERR_load_crypto_strings(void);
|
||||
void ERR_free_strings(void);
|
||||
void ERR_add_error_vdata(int num, va_list args);
|
||||
int ERR_load_strings(int lib, ERR_STRING_DATA str[]);
|
||||
int ERR_unload_strings(int lib, ERR_STRING_DATA str[]);
|
||||
int ERR_load_ERR_strings(void);
|
||||
|
||||
void ERR_remove_state(unsigned long pid); /* if zero we look it up */
|
||||
#if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# define ERR_load_crypto_strings() \
|
||||
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL)
|
||||
# define ERR_free_strings() while(0) continue
|
||||
#endif
|
||||
|
||||
DEPRECATEDIN_1_1_0(void ERR_remove_thread_state(void *))
|
||||
DEPRECATEDIN_1_0_0(void ERR_remove_state(unsigned long pid))
|
||||
ERR_STATE *ERR_get_state(void);
|
||||
|
||||
#ifndef OPENSSL_NO_LHASH
|
||||
LHASH *ERR_get_string_table(void);
|
||||
LHASH *ERR_get_err_state_table(void);
|
||||
void ERR_release_err_state_table(LHASH **hash);
|
||||
#endif
|
||||
|
||||
int ERR_get_next_error_library(void);
|
||||
|
||||
int ERR_set_mark(void);
|
||||
int ERR_pop_to_mark(void);
|
||||
|
||||
/* Already defined in ossl_typ.h */
|
||||
/* typedef struct st_ERR_FNS ERR_FNS; */
|
||||
/* An application can use this function and provide the return value to loaded
|
||||
* modules that should use the application's ERR state/functionality */
|
||||
const ERR_FNS *ERR_get_implementation(void);
|
||||
/* A loaded module should call this function prior to any ERR operations using
|
||||
* the application's "ERR_FNS". */
|
||||
int ERR_set_implementation(const ERR_FNS *fns);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,105 +1,46 @@
|
||||
/* crypto/hmac/hmac.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_HMAC_H
|
||||
#define HEADER_HMAC_H
|
||||
# define HEADER_HMAC_H
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
#ifdef OPENSSL_NO_HMAC
|
||||
#error HMAC is disabled.
|
||||
#endif
|
||||
# include <openssl/evp.h>
|
||||
|
||||
#include <openssl/evp.h>
|
||||
|
||||
#define HMAC_MAX_MD_CBLOCK 128 /* largest known is SHA512 */
|
||||
# define HMAC_MAX_MD_CBLOCK 128/* largest known is SHA512 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct hmac_ctx_st
|
||||
{
|
||||
const EVP_MD *md;
|
||||
EVP_MD_CTX md_ctx;
|
||||
EVP_MD_CTX i_ctx;
|
||||
EVP_MD_CTX o_ctx;
|
||||
unsigned int key_length;
|
||||
unsigned char key[HMAC_MAX_MD_CBLOCK];
|
||||
} HMAC_CTX;
|
||||
size_t HMAC_size(const HMAC_CTX *e);
|
||||
HMAC_CTX *HMAC_CTX_new(void);
|
||||
int HMAC_CTX_reset(HMAC_CTX *ctx);
|
||||
void HMAC_CTX_free(HMAC_CTX *ctx);
|
||||
|
||||
#define HMAC_size(e) (EVP_MD_size((e)->md))
|
||||
DEPRECATEDIN_1_1_0(__owur int HMAC_Init(HMAC_CTX *ctx, const void *key, int len,
|
||||
const EVP_MD *md))
|
||||
|
||||
|
||||
void HMAC_CTX_init(HMAC_CTX *ctx);
|
||||
void HMAC_CTX_cleanup(HMAC_CTX *ctx);
|
||||
|
||||
#define HMAC_cleanup(ctx) HMAC_CTX_cleanup(ctx) /* deprecated */
|
||||
|
||||
void HMAC_Init(HMAC_CTX *ctx, const void *key, int len,
|
||||
const EVP_MD *md); /* deprecated */
|
||||
void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
|
||||
const EVP_MD *md, ENGINE *impl);
|
||||
void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len);
|
||||
void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len);
|
||||
/*__owur*/ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
|
||||
const EVP_MD *md, ENGINE *impl);
|
||||
/*__owur*/ int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data,
|
||||
size_t len);
|
||||
/*__owur*/ int HMAC_Final(HMAC_CTX *ctx, unsigned char *md,
|
||||
unsigned int *len);
|
||||
unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len,
|
||||
const unsigned char *d, size_t n, unsigned char *md,
|
||||
unsigned int *md_len);
|
||||
const unsigned char *d, size_t n, unsigned char *md,
|
||||
unsigned int *md_len);
|
||||
__owur int HMAC_CTX_copy(HMAC_CTX *dctx, HMAC_CTX *sctx);
|
||||
|
||||
void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags);
|
||||
const EVP_MD *HMAC_CTX_get_md(const HMAC_CTX *ctx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@ -1,100 +1,64 @@
|
||||
/* crypto/idea/idea.h */
|
||||
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_IDEA_H
|
||||
#define HEADER_IDEA_H
|
||||
# define HEADER_IDEA_H
|
||||
|
||||
#include <openssl/opensslconf.h> /* IDEA_INT, OPENSSL_NO_IDEA */
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
#ifdef OPENSSL_NO_IDEA
|
||||
#error IDEA is disabled.
|
||||
#endif
|
||||
|
||||
#define IDEA_ENCRYPT 1
|
||||
#define IDEA_DECRYPT 0
|
||||
|
||||
#define IDEA_BLOCK 8
|
||||
#define IDEA_KEY_LENGTH 16
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifndef OPENSSL_NO_IDEA
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
# endif
|
||||
|
||||
typedef struct idea_key_st
|
||||
{
|
||||
IDEA_INT data[9][6];
|
||||
} IDEA_KEY_SCHEDULE;
|
||||
typedef unsigned int IDEA_INT;
|
||||
|
||||
const char *idea_options(void);
|
||||
void idea_ecb_encrypt(const unsigned char *in, unsigned char *out,
|
||||
IDEA_KEY_SCHEDULE *ks);
|
||||
void idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks);
|
||||
void idea_set_decrypt_key(const IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk);
|
||||
void idea_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,int enc);
|
||||
void idea_cfb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,
|
||||
int *num,int enc);
|
||||
void idea_ofb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv, int *num);
|
||||
void idea_encrypt(unsigned long *in, IDEA_KEY_SCHEDULE *ks);
|
||||
#ifdef __cplusplus
|
||||
# define IDEA_ENCRYPT 1
|
||||
# define IDEA_DECRYPT 0
|
||||
|
||||
# define IDEA_BLOCK 8
|
||||
# define IDEA_KEY_LENGTH 16
|
||||
|
||||
typedef struct idea_key_st {
|
||||
IDEA_INT data[9][6];
|
||||
} IDEA_KEY_SCHEDULE;
|
||||
|
||||
const char *IDEA_options(void);
|
||||
void IDEA_ecb_encrypt(const unsigned char *in, unsigned char *out,
|
||||
IDEA_KEY_SCHEDULE *ks);
|
||||
void IDEA_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks);
|
||||
void IDEA_set_decrypt_key(IDEA_KEY_SCHEDULE *ek, IDEA_KEY_SCHEDULE *dk);
|
||||
void IDEA_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,
|
||||
int enc);
|
||||
void IDEA_cfb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,
|
||||
int *num, int enc);
|
||||
void IDEA_ofb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, IDEA_KEY_SCHEDULE *ks, unsigned char *iv,
|
||||
int *num);
|
||||
void IDEA_encrypt(unsigned long *in, IDEA_KEY_SCHEDULE *ks);
|
||||
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# define idea_options IDEA_options
|
||||
# define idea_ecb_encrypt IDEA_ecb_encrypt
|
||||
# define idea_set_encrypt_key IDEA_set_encrypt_key
|
||||
# define idea_set_decrypt_key IDEA_set_decrypt_key
|
||||
# define idea_cbc_encrypt IDEA_cbc_encrypt
|
||||
# define idea_cfb64_encrypt IDEA_cfb64_encrypt
|
||||
# define idea_ofb64_encrypt IDEA_ofb64_encrypt
|
||||
# define idea_encrypt IDEA_encrypt
|
||||
# endif
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
75
src/dep/include/openssl/kdf.h
Normal file
75
src/dep/include/openssl/kdf.h
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_KDF_H
|
||||
# define HEADER_KDF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
# define EVP_PKEY_CTRL_TLS_MD (EVP_PKEY_ALG_CTRL)
|
||||
# define EVP_PKEY_CTRL_TLS_SECRET (EVP_PKEY_ALG_CTRL + 1)
|
||||
# define EVP_PKEY_CTRL_TLS_SEED (EVP_PKEY_ALG_CTRL + 2)
|
||||
# define EVP_PKEY_CTRL_HKDF_MD (EVP_PKEY_ALG_CTRL + 3)
|
||||
# define EVP_PKEY_CTRL_HKDF_SALT (EVP_PKEY_ALG_CTRL + 4)
|
||||
# define EVP_PKEY_CTRL_HKDF_KEY (EVP_PKEY_ALG_CTRL + 5)
|
||||
# define EVP_PKEY_CTRL_HKDF_INFO (EVP_PKEY_ALG_CTRL + 6)
|
||||
|
||||
# define EVP_PKEY_CTX_set_tls1_prf_md(pctx, md) \
|
||||
EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_TLS_MD, 0, (void *)md)
|
||||
|
||||
# define EVP_PKEY_CTX_set1_tls1_prf_secret(pctx, sec, seclen) \
|
||||
EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_TLS_SECRET, seclen, (void *)sec)
|
||||
|
||||
# define EVP_PKEY_CTX_add1_tls1_prf_seed(pctx, seed, seedlen) \
|
||||
EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_TLS_SEED, seedlen, (void *)seed)
|
||||
|
||||
# define EVP_PKEY_CTX_set_hkdf_md(pctx, md) \
|
||||
EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_HKDF_MD, 0, (void *)md)
|
||||
|
||||
# define EVP_PKEY_CTX_set1_hkdf_salt(pctx, salt, saltlen) \
|
||||
EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_HKDF_SALT, saltlen, (void *)salt)
|
||||
|
||||
# define EVP_PKEY_CTX_set1_hkdf_key(pctx, key, keylen) \
|
||||
EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_HKDF_KEY, keylen, (void *)key)
|
||||
|
||||
# define EVP_PKEY_CTX_add1_hkdf_info(pctx, info, infolen) \
|
||||
EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_DERIVE, \
|
||||
EVP_PKEY_CTRL_HKDF_INFO, infolen, (void *)info)
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/*
|
||||
* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
|
||||
int ERR_load_KDF_strings(void);
|
||||
|
||||
/* Error codes for the KDF functions. */
|
||||
|
||||
/* Function codes. */
|
||||
# define KDF_F_PKEY_TLS1_PRF_CTRL_STR 100
|
||||
# define KDF_F_PKEY_TLS1_PRF_DERIVE 101
|
||||
|
||||
/* Reason codes. */
|
||||
# define KDF_R_INVALID_DIGEST 100
|
||||
# define KDF_R_MISSING_PARAMETER 101
|
||||
# define KDF_R_VALUE_MISSING 102
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
@ -1,200 +1,217 @@
|
||||
/* crypto/lhash/lhash.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/* Header for dynamic hash table routines
|
||||
* Author - Eric Young
|
||||
/*
|
||||
* Header for dynamic hash table routines Author - Eric Young
|
||||
*/
|
||||
|
||||
#ifndef HEADER_LHASH_H
|
||||
#define HEADER_LHASH_H
|
||||
# define HEADER_LHASH_H
|
||||
|
||||
#include <openssl/e_os2.h>
|
||||
#ifndef OPENSSL_NO_FP_API
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_BIO
|
||||
#include <openssl/bio.h>
|
||||
#endif
|
||||
# include <openssl/e_os2.h>
|
||||
# include <openssl/bio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct lhash_node_st
|
||||
{
|
||||
void *data;
|
||||
struct lhash_node_st *next;
|
||||
#ifndef OPENSSL_NO_HASH_COMP
|
||||
unsigned long hash;
|
||||
#endif
|
||||
} LHASH_NODE;
|
||||
typedef struct lhash_node_st OPENSSL_LH_NODE;
|
||||
typedef int (*OPENSSL_LH_COMPFUNC) (const void *, const void *);
|
||||
typedef unsigned long (*OPENSSL_LH_HASHFUNC) (const void *);
|
||||
typedef void (*OPENSSL_LH_DOALL_FUNC) (void *);
|
||||
typedef void (*OPENSSL_LH_DOALL_FUNCARG) (void *, void *);
|
||||
typedef struct lhash_st OPENSSL_LHASH;
|
||||
|
||||
typedef int (*LHASH_COMP_FN_TYPE)(const void *, const void *);
|
||||
typedef unsigned long (*LHASH_HASH_FN_TYPE)(const void *);
|
||||
typedef void (*LHASH_DOALL_FN_TYPE)(void *);
|
||||
typedef void (*LHASH_DOALL_ARG_FN_TYPE)(void *, void *);
|
||||
|
||||
/* Macros for declaring and implementing type-safe wrappers for LHASH callbacks.
|
||||
* This way, callbacks can be provided to LHASH structures without function
|
||||
* pointer casting and the macro-defined callbacks provide per-variable casting
|
||||
* before deferring to the underlying type-specific callbacks. NB: It is
|
||||
* possible to place a "static" in front of both the DECLARE and IMPLEMENT
|
||||
* macros if the functions are strictly internal. */
|
||||
/*
|
||||
* Macros for declaring and implementing type-safe wrappers for LHASH
|
||||
* callbacks. This way, callbacks can be provided to LHASH structures without
|
||||
* function pointer casting and the macro-defined callbacks provide
|
||||
* per-variable casting before deferring to the underlying type-specific
|
||||
* callbacks. NB: It is possible to place a "static" in front of both the
|
||||
* DECLARE and IMPLEMENT macros if the functions are strictly internal.
|
||||
*/
|
||||
|
||||
/* First: "hash" functions */
|
||||
#define DECLARE_LHASH_HASH_FN(f_name,o_type) \
|
||||
unsigned long f_name##_LHASH_HASH(const void *);
|
||||
#define IMPLEMENT_LHASH_HASH_FN(f_name,o_type) \
|
||||
unsigned long f_name##_LHASH_HASH(const void *arg) { \
|
||||
o_type a = (o_type)arg; \
|
||||
return f_name(a); }
|
||||
#define LHASH_HASH_FN(f_name) f_name##_LHASH_HASH
|
||||
# define DECLARE_LHASH_HASH_FN(name, o_type) \
|
||||
unsigned long name##_LHASH_HASH(const void *);
|
||||
# define IMPLEMENT_LHASH_HASH_FN(name, o_type) \
|
||||
unsigned long name##_LHASH_HASH(const void *arg) { \
|
||||
const o_type *a = arg; \
|
||||
return name##_hash(a); }
|
||||
# define LHASH_HASH_FN(name) name##_LHASH_HASH
|
||||
|
||||
/* Second: "compare" functions */
|
||||
#define DECLARE_LHASH_COMP_FN(f_name,o_type) \
|
||||
int f_name##_LHASH_COMP(const void *, const void *);
|
||||
#define IMPLEMENT_LHASH_COMP_FN(f_name,o_type) \
|
||||
int f_name##_LHASH_COMP(const void *arg1, const void *arg2) { \
|
||||
o_type a = (o_type)arg1; \
|
||||
o_type b = (o_type)arg2; \
|
||||
return f_name(a,b); }
|
||||
#define LHASH_COMP_FN(f_name) f_name##_LHASH_COMP
|
||||
|
||||
/* Third: "doall" functions */
|
||||
#define DECLARE_LHASH_DOALL_FN(f_name,o_type) \
|
||||
void f_name##_LHASH_DOALL(void *);
|
||||
#define IMPLEMENT_LHASH_DOALL_FN(f_name,o_type) \
|
||||
void f_name##_LHASH_DOALL(void *arg) { \
|
||||
o_type a = (o_type)arg; \
|
||||
f_name(a); }
|
||||
#define LHASH_DOALL_FN(f_name) f_name##_LHASH_DOALL
|
||||
# define DECLARE_LHASH_COMP_FN(name, o_type) \
|
||||
int name##_LHASH_COMP(const void *, const void *);
|
||||
# define IMPLEMENT_LHASH_COMP_FN(name, o_type) \
|
||||
int name##_LHASH_COMP(const void *arg1, const void *arg2) { \
|
||||
const o_type *a = arg1; \
|
||||
const o_type *b = arg2; \
|
||||
return name##_cmp(a,b); }
|
||||
# define LHASH_COMP_FN(name) name##_LHASH_COMP
|
||||
|
||||
/* Fourth: "doall_arg" functions */
|
||||
#define DECLARE_LHASH_DOALL_ARG_FN(f_name,o_type,a_type) \
|
||||
void f_name##_LHASH_DOALL_ARG(void *, void *);
|
||||
#define IMPLEMENT_LHASH_DOALL_ARG_FN(f_name,o_type,a_type) \
|
||||
void f_name##_LHASH_DOALL_ARG(void *arg1, void *arg2) { \
|
||||
o_type a = (o_type)arg1; \
|
||||
a_type b = (a_type)arg2; \
|
||||
f_name(a,b); }
|
||||
#define LHASH_DOALL_ARG_FN(f_name) f_name##_LHASH_DOALL_ARG
|
||||
# define DECLARE_LHASH_DOALL_ARG_FN(name, o_type, a_type) \
|
||||
void name##_LHASH_DOALL_ARG(void *, void *);
|
||||
# define IMPLEMENT_LHASH_DOALL_ARG_FN(name, o_type, a_type) \
|
||||
void name##_LHASH_DOALL_ARG(void *arg1, void *arg2) { \
|
||||
o_type *a = arg1; \
|
||||
a_type *b = arg2; \
|
||||
name##_doall_arg(a, b); }
|
||||
# define LHASH_DOALL_ARG_FN(name) name##_LHASH_DOALL_ARG
|
||||
|
||||
typedef struct lhash_st
|
||||
{
|
||||
LHASH_NODE **b;
|
||||
LHASH_COMP_FN_TYPE comp;
|
||||
LHASH_HASH_FN_TYPE hash;
|
||||
unsigned int num_nodes;
|
||||
unsigned int num_alloc_nodes;
|
||||
unsigned int p;
|
||||
unsigned int pmax;
|
||||
unsigned long up_load; /* load times 256 */
|
||||
unsigned long down_load; /* load times 256 */
|
||||
unsigned long num_items;
|
||||
|
||||
unsigned long num_expands;
|
||||
unsigned long num_expand_reallocs;
|
||||
unsigned long num_contracts;
|
||||
unsigned long num_contract_reallocs;
|
||||
unsigned long num_hash_calls;
|
||||
unsigned long num_comp_calls;
|
||||
unsigned long num_insert;
|
||||
unsigned long num_replace;
|
||||
unsigned long num_delete;
|
||||
unsigned long num_no_delete;
|
||||
unsigned long num_retrieve;
|
||||
unsigned long num_retrieve_miss;
|
||||
unsigned long num_hash_comps;
|
||||
# define LH_LOAD_MULT 256
|
||||
|
||||
int error;
|
||||
} LHASH;
|
||||
int OPENSSL_LH_error(OPENSSL_LHASH *lh);
|
||||
OPENSSL_LHASH *OPENSSL_LH_new(OPENSSL_LH_HASHFUNC h, OPENSSL_LH_COMPFUNC c);
|
||||
void OPENSSL_LH_free(OPENSSL_LHASH *lh);
|
||||
void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data);
|
||||
void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data);
|
||||
void *OPENSSL_LH_retrieve(OPENSSL_LHASH *lh, const void *data);
|
||||
void OPENSSL_LH_doall(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNC func);
|
||||
void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg);
|
||||
unsigned long OPENSSL_LH_strhash(const char *c);
|
||||
unsigned long OPENSSL_LH_num_items(const OPENSSL_LHASH *lh);
|
||||
unsigned long OPENSSL_LH_get_down_load(const OPENSSL_LHASH *lh);
|
||||
void OPENSSL_LH_set_down_load(OPENSSL_LHASH *lh, unsigned long down_load);
|
||||
|
||||
#define LH_LOAD_MULT 256
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
void OPENSSL_LH_stats(const OPENSSL_LHASH *lh, FILE *fp);
|
||||
void OPENSSL_LH_node_stats(const OPENSSL_LHASH *lh, FILE *fp);
|
||||
void OPENSSL_LH_node_usage_stats(const OPENSSL_LHASH *lh, FILE *fp);
|
||||
# endif
|
||||
void OPENSSL_LH_stats_bio(const OPENSSL_LHASH *lh, BIO *out);
|
||||
void OPENSSL_LH_node_stats_bio(const OPENSSL_LHASH *lh, BIO *out);
|
||||
void OPENSSL_LH_node_usage_stats_bio(const OPENSSL_LHASH *lh, BIO *out);
|
||||
|
||||
/* Indicates a malloc() error in the last call, this is only bad
|
||||
* in lh_insert(). */
|
||||
#define lh_error(lh) ((lh)->error)
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# define _LHASH OPENSSL_LHASH
|
||||
# define LHASH_NODE OPENSSL_LH_NODE
|
||||
# define lh_error OPENSSL_LH_error
|
||||
# define lh_new OPENSSL_lh_new
|
||||
# define lh_free OPENSSL_LH_free
|
||||
# define lh_insert OPENSSL_LH_insert
|
||||
# define lh_delete OPENSSL_LH_delete
|
||||
# define lh_retrieve OPENSSL_LH_retrieve
|
||||
# define lh_doall OPENSSL_LH_doall
|
||||
# define lh_doall_arg OPENSSL_LH_doall_arg
|
||||
# define lh_strhash OPENSSL_LH_strhash
|
||||
# define lh_num_items OPENSSL_LH_num_items
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
# define lh_stats OPENSSL_LH_stats
|
||||
# define lh_node_stats OPENSSL_LH_node_stats
|
||||
# define lh_node_usage_stats OPENSSL_LH_node_usage_stats
|
||||
# endif
|
||||
# define lh_stats_bio OPENSSL_LH_stats_bio
|
||||
# define lh_node_stats_bio OPENSSL_LH_node_stats_bio
|
||||
# define lh_node_usage_stats_bio OPENSSL_LH_node_usage_stats_bio
|
||||
# endif
|
||||
|
||||
LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c);
|
||||
void lh_free(LHASH *lh);
|
||||
void *lh_insert(LHASH *lh, void *data);
|
||||
void *lh_delete(LHASH *lh, const void *data);
|
||||
void *lh_retrieve(LHASH *lh, const void *data);
|
||||
void lh_doall(LHASH *lh, LHASH_DOALL_FN_TYPE func);
|
||||
void lh_doall_arg(LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg);
|
||||
unsigned long lh_strhash(const char *c);
|
||||
unsigned long lh_num_items(const LHASH *lh);
|
||||
/* Type checking... */
|
||||
|
||||
#ifndef OPENSSL_NO_FP_API
|
||||
void lh_stats(const LHASH *lh, FILE *out);
|
||||
void lh_node_stats(const LHASH *lh, FILE *out);
|
||||
void lh_node_usage_stats(const LHASH *lh, FILE *out);
|
||||
#endif
|
||||
# define LHASH_OF(type) struct lhash_st_##type
|
||||
|
||||
# define DEFINE_LHASH_OF(type) \
|
||||
LHASH_OF(type) { union lh_##type##_dummy { void* d1; unsigned long d2; int d3; } dummy; }; \
|
||||
static ossl_inline LHASH_OF(type) * \
|
||||
lh_##type##_new(unsigned long (*hfn)(const type *), \
|
||||
int (*cfn)(const type *, const type *)) \
|
||||
{ \
|
||||
return (LHASH_OF(type) *) \
|
||||
OPENSSL_LH_new((OPENSSL_LH_HASHFUNC)hfn, (OPENSSL_LH_COMPFUNC)cfn); \
|
||||
} \
|
||||
static ossl_inline void lh_##type##_free(LHASH_OF(type) *lh) \
|
||||
{ \
|
||||
OPENSSL_LH_free((OPENSSL_LHASH *)lh); \
|
||||
} \
|
||||
static ossl_inline type *lh_##type##_insert(LHASH_OF(type) *lh, type *d) \
|
||||
{ \
|
||||
return (type *)OPENSSL_LH_insert((OPENSSL_LHASH *)lh, d); \
|
||||
} \
|
||||
static ossl_inline type *lh_##type##_delete(LHASH_OF(type) *lh, const type *d) \
|
||||
{ \
|
||||
return (type *)OPENSSL_LH_delete((OPENSSL_LHASH *)lh, d); \
|
||||
} \
|
||||
static ossl_inline type *lh_##type##_retrieve(LHASH_OF(type) *lh, const type *d) \
|
||||
{ \
|
||||
return (type *)OPENSSL_LH_retrieve((OPENSSL_LHASH *)lh, d); \
|
||||
} \
|
||||
static ossl_inline int lh_##type##_error(LHASH_OF(type) *lh) \
|
||||
{ \
|
||||
return OPENSSL_LH_error((OPENSSL_LHASH *)lh); \
|
||||
} \
|
||||
static ossl_inline unsigned long lh_##type##_num_items(LHASH_OF(type) *lh) \
|
||||
{ \
|
||||
return OPENSSL_LH_num_items((OPENSSL_LHASH *)lh); \
|
||||
} \
|
||||
static ossl_inline void lh_##type##_node_stats_bio(const LHASH_OF(type) *lh, BIO *out) \
|
||||
{ \
|
||||
OPENSSL_LH_node_stats_bio((const OPENSSL_LHASH *)lh, out); \
|
||||
} \
|
||||
static ossl_inline void lh_##type##_node_usage_stats_bio(const LHASH_OF(type) *lh, BIO *out) \
|
||||
{ \
|
||||
OPENSSL_LH_node_usage_stats_bio((const OPENSSL_LHASH *)lh, out); \
|
||||
} \
|
||||
static ossl_inline void lh_##type##_stats_bio(const LHASH_OF(type) *lh, BIO *out) \
|
||||
{ \
|
||||
OPENSSL_LH_stats_bio((const OPENSSL_LHASH *)lh, out); \
|
||||
} \
|
||||
static ossl_inline unsigned long lh_##type##_get_down_load(LHASH_OF(type) *lh) \
|
||||
{ \
|
||||
return OPENSSL_LH_get_down_load((OPENSSL_LHASH *)lh); \
|
||||
} \
|
||||
static ossl_inline void lh_##type##_set_down_load(LHASH_OF(type) *lh, unsigned long dl) \
|
||||
{ \
|
||||
OPENSSL_LH_set_down_load((OPENSSL_LHASH *)lh, dl); \
|
||||
} \
|
||||
static ossl_inline void lh_##type##_doall(LHASH_OF(type) *lh, \
|
||||
void (*doall)(type *)) \
|
||||
{ \
|
||||
OPENSSL_LH_doall((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNC)doall); \
|
||||
} \
|
||||
LHASH_OF(type)
|
||||
|
||||
#define IMPLEMENT_LHASH_DOALL_ARG_CONST(type, argtype) \
|
||||
int_implement_lhash_doall(type, argtype, const type)
|
||||
|
||||
#define IMPLEMENT_LHASH_DOALL_ARG(type, argtype) \
|
||||
int_implement_lhash_doall(type, argtype, type)
|
||||
|
||||
#define int_implement_lhash_doall(type, argtype, cbargtype) \
|
||||
static ossl_inline void \
|
||||
lh_##type##_doall_##argtype(LHASH_OF(type) *lh, \
|
||||
void (*fn)(cbargtype *, argtype *), \
|
||||
argtype *arg) \
|
||||
{ \
|
||||
OPENSSL_LH_doall_arg((OPENSSL_LHASH *)lh, (OPENSSL_LH_DOALL_FUNCARG)fn, (void *)arg); \
|
||||
} \
|
||||
LHASH_OF(type)
|
||||
|
||||
DEFINE_LHASH_OF(OPENSSL_STRING);
|
||||
# ifdef _MSC_VER
|
||||
/*
|
||||
* push and pop this warning:
|
||||
* warning C4090: 'function': different 'const' qualifiers
|
||||
*/
|
||||
# pragma warning (push)
|
||||
# pragma warning (disable: 4090)
|
||||
# endif
|
||||
|
||||
DEFINE_LHASH_OF(OPENSSL_CSTRING);
|
||||
|
||||
# ifdef _MSC_VER
|
||||
# pragma warning (pop)
|
||||
# endif
|
||||
|
||||
#ifndef OPENSSL_NO_BIO
|
||||
void lh_stats_bio(const LHASH *lh, BIO *out);
|
||||
void lh_node_stats_bio(const LHASH *lh, BIO *out);
|
||||
void lh_node_usage_stats_bio(const LHASH *lh, BIO *out);
|
||||
#endif
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -1,91 +1,44 @@
|
||||
/* crypto/md/md2.h */
|
||||
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_MD2_H
|
||||
#define HEADER_MD2_H
|
||||
# define HEADER_MD2_H
|
||||
|
||||
#include <openssl/opensslconf.h> /* OPENSSL_NO_MD2, MD2_INT */
|
||||
#ifdef OPENSSL_NO_MD2
|
||||
#error MD2 is disabled.
|
||||
#endif
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
#define MD2_DIGEST_LENGTH 16
|
||||
#define MD2_BLOCK 16
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifndef OPENSSL_NO_MD2
|
||||
# include <stddef.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
# endif
|
||||
|
||||
typedef struct MD2state_st
|
||||
{
|
||||
unsigned int num;
|
||||
unsigned char data[MD2_BLOCK];
|
||||
MD2_INT cksm[MD2_BLOCK];
|
||||
MD2_INT state[MD2_BLOCK];
|
||||
} MD2_CTX;
|
||||
typedef unsigned char MD2_INT;
|
||||
|
||||
# define MD2_DIGEST_LENGTH 16
|
||||
# define MD2_BLOCK 16
|
||||
|
||||
typedef struct MD2state_st {
|
||||
unsigned int num;
|
||||
unsigned char data[MD2_BLOCK];
|
||||
MD2_INT cksm[MD2_BLOCK];
|
||||
MD2_INT state[MD2_BLOCK];
|
||||
} MD2_CTX;
|
||||
|
||||
const char *MD2_options(void);
|
||||
int MD2_Init(MD2_CTX *c);
|
||||
int MD2_Update(MD2_CTX *c, const unsigned char *data, size_t len);
|
||||
int MD2_Final(unsigned char *md, MD2_CTX *c);
|
||||
unsigned char *MD2(const unsigned char *d, size_t n,unsigned char *md);
|
||||
#ifdef __cplusplus
|
||||
unsigned char *MD2(const unsigned char *d, size_t n, unsigned char *md);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
@ -1,116 +1,51 @@
|
||||
/* crypto/md4/md4.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_MD4_H
|
||||
#define HEADER_MD4_H
|
||||
# define HEADER_MD4_H
|
||||
|
||||
#include <openssl/e_os2.h>
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifndef OPENSSL_NO_MD4
|
||||
# include <openssl/e_os2.h>
|
||||
# include <stddef.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#ifdef OPENSSL_NO_MD4
|
||||
#error MD4 is disabled.
|
||||
#endif
|
||||
|
||||
/*
|
||||
/*-
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
* ! MD4_LONG has to be at least 32 bits wide. If it's wider, then !
|
||||
* ! MD4_LONG_LOG2 has to be defined along. !
|
||||
* ! MD4_LONG has to be at least 32 bits wide. !
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
*/
|
||||
# define MD4_LONG unsigned int
|
||||
|
||||
#if defined(OPENSSL_SYS_WIN16) || defined(__LP32__)
|
||||
#define MD4_LONG unsigned long
|
||||
#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)
|
||||
#define MD4_LONG unsigned long
|
||||
#define MD4_LONG_LOG2 3
|
||||
/*
|
||||
* _CRAY note. I could declare short, but I have no idea what impact
|
||||
* does it have on performance on none-T3E machines. I could declare
|
||||
* int, but at least on C90 sizeof(int) can be chosen at compile time.
|
||||
* So I've chosen long...
|
||||
* <appro@fy.chalmers.se>
|
||||
*/
|
||||
#else
|
||||
#define MD4_LONG unsigned int
|
||||
#endif
|
||||
# define MD4_CBLOCK 64
|
||||
# define MD4_LBLOCK (MD4_CBLOCK/4)
|
||||
# define MD4_DIGEST_LENGTH 16
|
||||
|
||||
#define MD4_CBLOCK 64
|
||||
#define MD4_LBLOCK (MD4_CBLOCK/4)
|
||||
#define MD4_DIGEST_LENGTH 16
|
||||
|
||||
typedef struct MD4state_st
|
||||
{
|
||||
MD4_LONG A,B,C,D;
|
||||
MD4_LONG Nl,Nh;
|
||||
MD4_LONG data[MD4_LBLOCK];
|
||||
unsigned int num;
|
||||
} MD4_CTX;
|
||||
typedef struct MD4state_st {
|
||||
MD4_LONG A, B, C, D;
|
||||
MD4_LONG Nl, Nh;
|
||||
MD4_LONG data[MD4_LBLOCK];
|
||||
unsigned int num;
|
||||
} MD4_CTX;
|
||||
|
||||
int MD4_Init(MD4_CTX *c);
|
||||
int MD4_Update(MD4_CTX *c, const void *data, size_t len);
|
||||
int MD4_Final(unsigned char *md, MD4_CTX *c);
|
||||
unsigned char *MD4(const unsigned char *d, size_t n, unsigned char *md);
|
||||
void MD4_Transform(MD4_CTX *c, const unsigned char *b);
|
||||
#ifdef __cplusplus
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
@ -1,116 +1,50 @@
|
||||
/* crypto/md5/md5.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_MD5_H
|
||||
#define HEADER_MD5_H
|
||||
# define HEADER_MD5_H
|
||||
|
||||
#include <openssl/e_os2.h>
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifndef OPENSSL_NO_MD5
|
||||
# include <openssl/e_os2.h>
|
||||
# include <stddef.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef OPENSSL_NO_MD5
|
||||
#error MD5 is disabled.
|
||||
#endif
|
||||
# endif
|
||||
|
||||
/*
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
* ! MD5_LONG has to be at least 32 bits wide. If it's wider, then !
|
||||
* ! MD5_LONG_LOG2 has to be defined along. !
|
||||
* ! MD5_LONG has to be at least 32 bits wide. !
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
*/
|
||||
# define MD5_LONG unsigned int
|
||||
|
||||
#if defined(OPENSSL_SYS_WIN16) || defined(__LP32__)
|
||||
#define MD5_LONG unsigned long
|
||||
#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)
|
||||
#define MD5_LONG unsigned long
|
||||
#define MD5_LONG_LOG2 3
|
||||
/*
|
||||
* _CRAY note. I could declare short, but I have no idea what impact
|
||||
* does it have on performance on none-T3E machines. I could declare
|
||||
* int, but at least on C90 sizeof(int) can be chosen at compile time.
|
||||
* So I've chosen long...
|
||||
* <appro@fy.chalmers.se>
|
||||
*/
|
||||
#else
|
||||
#define MD5_LONG unsigned int
|
||||
#endif
|
||||
# define MD5_CBLOCK 64
|
||||
# define MD5_LBLOCK (MD5_CBLOCK/4)
|
||||
# define MD5_DIGEST_LENGTH 16
|
||||
|
||||
#define MD5_CBLOCK 64
|
||||
#define MD5_LBLOCK (MD5_CBLOCK/4)
|
||||
#define MD5_DIGEST_LENGTH 16
|
||||
|
||||
typedef struct MD5state_st
|
||||
{
|
||||
MD5_LONG A,B,C,D;
|
||||
MD5_LONG Nl,Nh;
|
||||
MD5_LONG data[MD5_LBLOCK];
|
||||
unsigned int num;
|
||||
} MD5_CTX;
|
||||
typedef struct MD5state_st {
|
||||
MD5_LONG A, B, C, D;
|
||||
MD5_LONG Nl, Nh;
|
||||
MD5_LONG data[MD5_LBLOCK];
|
||||
unsigned int num;
|
||||
} MD5_CTX;
|
||||
|
||||
int MD5_Init(MD5_CTX *c);
|
||||
int MD5_Update(MD5_CTX *c, const void *data, size_t len);
|
||||
int MD5_Final(unsigned char *md, MD5_CTX *c);
|
||||
unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md);
|
||||
void MD5_Transform(MD5_CTX *c, const unsigned char *b);
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
42
src/dep/include/openssl/mdc2.h
Normal file
42
src/dep/include/openssl/mdc2.h
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_MDC2_H
|
||||
# define HEADER_MDC2_H
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
#ifndef OPENSSL_NO_MDC2
|
||||
# include <stdlib.h>
|
||||
# include <openssl/des.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
# define MDC2_BLOCK 8
|
||||
# define MDC2_DIGEST_LENGTH 16
|
||||
|
||||
typedef struct mdc2_ctx_st {
|
||||
unsigned int num;
|
||||
unsigned char data[MDC2_BLOCK];
|
||||
DES_cblock h, hh;
|
||||
int pad_type; /* either 1 or 2, default 1 */
|
||||
} MDC2_CTX;
|
||||
|
||||
int MDC2_Init(MDC2_CTX *c);
|
||||
int MDC2_Update(MDC2_CTX *c, const unsigned char *data, size_t len);
|
||||
int MDC2_Final(unsigned char *md, MDC2_CTX *c);
|
||||
unsigned char *MDC2(const unsigned char *d, size_t n, unsigned char *md);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
203
src/dep/include/openssl/modes.h
Normal file
203
src/dep/include/openssl/modes.h
Normal file
@ -0,0 +1,203 @@
|
||||
/*
|
||||
* Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
typedef void (*block128_f) (const unsigned char in[16],
|
||||
unsigned char out[16], const void *key);
|
||||
|
||||
typedef void (*cbc128_f) (const unsigned char *in, unsigned char *out,
|
||||
size_t len, const void *key,
|
||||
unsigned char ivec[16], int enc);
|
||||
|
||||
typedef void (*ctr128_f) (const unsigned char *in, unsigned char *out,
|
||||
size_t blocks, const void *key,
|
||||
const unsigned char ivec[16]);
|
||||
|
||||
typedef void (*ccm128_f) (const unsigned char *in, unsigned char *out,
|
||||
size_t blocks, const void *key,
|
||||
const unsigned char ivec[16],
|
||||
unsigned char cmac[16]);
|
||||
|
||||
void CRYPTO_cbc128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const void *key,
|
||||
unsigned char ivec[16], block128_f block);
|
||||
void CRYPTO_cbc128_decrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const void *key,
|
||||
unsigned char ivec[16], block128_f block);
|
||||
|
||||
void CRYPTO_ctr128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const void *key,
|
||||
unsigned char ivec[16],
|
||||
unsigned char ecount_buf[16], unsigned int *num,
|
||||
block128_f block);
|
||||
|
||||
void CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const void *key,
|
||||
unsigned char ivec[16],
|
||||
unsigned char ecount_buf[16],
|
||||
unsigned int *num, ctr128_f ctr);
|
||||
|
||||
void CRYPTO_ofb128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const void *key,
|
||||
unsigned char ivec[16], int *num,
|
||||
block128_f block);
|
||||
|
||||
void CRYPTO_cfb128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const void *key,
|
||||
unsigned char ivec[16], int *num,
|
||||
int enc, block128_f block);
|
||||
void CRYPTO_cfb128_8_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t length, const void *key,
|
||||
unsigned char ivec[16], int *num,
|
||||
int enc, block128_f block);
|
||||
void CRYPTO_cfb128_1_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t bits, const void *key,
|
||||
unsigned char ivec[16], int *num,
|
||||
int enc, block128_f block);
|
||||
|
||||
size_t CRYPTO_cts128_encrypt_block(const unsigned char *in,
|
||||
unsigned char *out, size_t len,
|
||||
const void *key, unsigned char ivec[16],
|
||||
block128_f block);
|
||||
size_t CRYPTO_cts128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const void *key,
|
||||
unsigned char ivec[16], cbc128_f cbc);
|
||||
size_t CRYPTO_cts128_decrypt_block(const unsigned char *in,
|
||||
unsigned char *out, size_t len,
|
||||
const void *key, unsigned char ivec[16],
|
||||
block128_f block);
|
||||
size_t CRYPTO_cts128_decrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const void *key,
|
||||
unsigned char ivec[16], cbc128_f cbc);
|
||||
|
||||
size_t CRYPTO_nistcts128_encrypt_block(const unsigned char *in,
|
||||
unsigned char *out, size_t len,
|
||||
const void *key,
|
||||
unsigned char ivec[16],
|
||||
block128_f block);
|
||||
size_t CRYPTO_nistcts128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const void *key,
|
||||
unsigned char ivec[16], cbc128_f cbc);
|
||||
size_t CRYPTO_nistcts128_decrypt_block(const unsigned char *in,
|
||||
unsigned char *out, size_t len,
|
||||
const void *key,
|
||||
unsigned char ivec[16],
|
||||
block128_f block);
|
||||
size_t CRYPTO_nistcts128_decrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const void *key,
|
||||
unsigned char ivec[16], cbc128_f cbc);
|
||||
|
||||
typedef struct gcm128_context GCM128_CONTEXT;
|
||||
|
||||
GCM128_CONTEXT *CRYPTO_gcm128_new(void *key, block128_f block);
|
||||
void CRYPTO_gcm128_init(GCM128_CONTEXT *ctx, void *key, block128_f block);
|
||||
void CRYPTO_gcm128_setiv(GCM128_CONTEXT *ctx, const unsigned char *iv,
|
||||
size_t len);
|
||||
int CRYPTO_gcm128_aad(GCM128_CONTEXT *ctx, const unsigned char *aad,
|
||||
size_t len);
|
||||
int CRYPTO_gcm128_encrypt(GCM128_CONTEXT *ctx,
|
||||
const unsigned char *in, unsigned char *out,
|
||||
size_t len);
|
||||
int CRYPTO_gcm128_decrypt(GCM128_CONTEXT *ctx,
|
||||
const unsigned char *in, unsigned char *out,
|
||||
size_t len);
|
||||
int CRYPTO_gcm128_encrypt_ctr32(GCM128_CONTEXT *ctx,
|
||||
const unsigned char *in, unsigned char *out,
|
||||
size_t len, ctr128_f stream);
|
||||
int CRYPTO_gcm128_decrypt_ctr32(GCM128_CONTEXT *ctx,
|
||||
const unsigned char *in, unsigned char *out,
|
||||
size_t len, ctr128_f stream);
|
||||
int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx, const unsigned char *tag,
|
||||
size_t len);
|
||||
void CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len);
|
||||
void CRYPTO_gcm128_release(GCM128_CONTEXT *ctx);
|
||||
|
||||
typedef struct ccm128_context CCM128_CONTEXT;
|
||||
|
||||
void CRYPTO_ccm128_init(CCM128_CONTEXT *ctx,
|
||||
unsigned int M, unsigned int L, void *key,
|
||||
block128_f block);
|
||||
int CRYPTO_ccm128_setiv(CCM128_CONTEXT *ctx, const unsigned char *nonce,
|
||||
size_t nlen, size_t mlen);
|
||||
void CRYPTO_ccm128_aad(CCM128_CONTEXT *ctx, const unsigned char *aad,
|
||||
size_t alen);
|
||||
int CRYPTO_ccm128_encrypt(CCM128_CONTEXT *ctx, const unsigned char *inp,
|
||||
unsigned char *out, size_t len);
|
||||
int CRYPTO_ccm128_decrypt(CCM128_CONTEXT *ctx, const unsigned char *inp,
|
||||
unsigned char *out, size_t len);
|
||||
int CRYPTO_ccm128_encrypt_ccm64(CCM128_CONTEXT *ctx, const unsigned char *inp,
|
||||
unsigned char *out, size_t len,
|
||||
ccm128_f stream);
|
||||
int CRYPTO_ccm128_decrypt_ccm64(CCM128_CONTEXT *ctx, const unsigned char *inp,
|
||||
unsigned char *out, size_t len,
|
||||
ccm128_f stream);
|
||||
size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len);
|
||||
|
||||
typedef struct xts128_context XTS128_CONTEXT;
|
||||
|
||||
int CRYPTO_xts128_encrypt(const XTS128_CONTEXT *ctx,
|
||||
const unsigned char iv[16],
|
||||
const unsigned char *inp, unsigned char *out,
|
||||
size_t len, int enc);
|
||||
|
||||
size_t CRYPTO_128_wrap(void *key, const unsigned char *iv,
|
||||
unsigned char *out,
|
||||
const unsigned char *in, size_t inlen,
|
||||
block128_f block);
|
||||
|
||||
size_t CRYPTO_128_unwrap(void *key, const unsigned char *iv,
|
||||
unsigned char *out,
|
||||
const unsigned char *in, size_t inlen,
|
||||
block128_f block);
|
||||
size_t CRYPTO_128_wrap_pad(void *key, const unsigned char *icv,
|
||||
unsigned char *out, const unsigned char *in,
|
||||
size_t inlen, block128_f block);
|
||||
size_t CRYPTO_128_unwrap_pad(void *key, const unsigned char *icv,
|
||||
unsigned char *out, const unsigned char *in,
|
||||
size_t inlen, block128_f block);
|
||||
|
||||
#ifndef OPENSSL_NO_OCB
|
||||
typedef struct ocb128_context OCB128_CONTEXT;
|
||||
|
||||
typedef void (*ocb128_f) (const unsigned char *in, unsigned char *out,
|
||||
size_t blocks, const void *key,
|
||||
size_t start_block_num,
|
||||
unsigned char offset_i[16],
|
||||
const unsigned char L_[][16],
|
||||
unsigned char checksum[16]);
|
||||
|
||||
OCB128_CONTEXT *CRYPTO_ocb128_new(void *keyenc, void *keydec,
|
||||
block128_f encrypt, block128_f decrypt,
|
||||
ocb128_f stream);
|
||||
int CRYPTO_ocb128_init(OCB128_CONTEXT *ctx, void *keyenc, void *keydec,
|
||||
block128_f encrypt, block128_f decrypt,
|
||||
ocb128_f stream);
|
||||
int CRYPTO_ocb128_copy_ctx(OCB128_CONTEXT *dest, OCB128_CONTEXT *src,
|
||||
void *keyenc, void *keydec);
|
||||
int CRYPTO_ocb128_setiv(OCB128_CONTEXT *ctx, const unsigned char *iv,
|
||||
size_t len, size_t taglen);
|
||||
int CRYPTO_ocb128_aad(OCB128_CONTEXT *ctx, const unsigned char *aad,
|
||||
size_t len);
|
||||
int CRYPTO_ocb128_encrypt(OCB128_CONTEXT *ctx, const unsigned char *in,
|
||||
unsigned char *out, size_t len);
|
||||
int CRYPTO_ocb128_decrypt(OCB128_CONTEXT *ctx, const unsigned char *in,
|
||||
unsigned char *out, size_t len);
|
||||
int CRYPTO_ocb128_finish(OCB128_CONTEXT *ctx, const unsigned char *tag,
|
||||
size_t len);
|
||||
int CRYPTO_ocb128_tag(OCB128_CONTEXT *ctx, unsigned char *tag, size_t len);
|
||||
void CRYPTO_ocb128_cleanup(OCB128_CONTEXT *ctx);
|
||||
#endif /* OPENSSL_NO_OCB */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,309 +1,23 @@
|
||||
/* ocsp.h */
|
||||
/* Written by Tom Titchener <Tom_Titchener@groove.net> for the OpenSSL
|
||||
* project. */
|
||||
|
||||
/* History:
|
||||
This file was transfered to Richard Levitte from CertCo by Kathy
|
||||
Weinhold in mid-spring 2000 to be included in OpenSSL or released
|
||||
as a patch kit. */
|
||||
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* openssl-core@openssl.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||
* Hudson (tjh@cryptsoft.com).
|
||||
/*
|
||||
* Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_OCSP_H
|
||||
#define HEADER_OCSP_H
|
||||
# define HEADER_OCSP_H
|
||||
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/x509v3.h>
|
||||
#include <openssl/safestack.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Various flags and values */
|
||||
|
||||
#define OCSP_DEFAULT_NONCE_LENGTH 16
|
||||
|
||||
#define OCSP_NOCERTS 0x1
|
||||
#define OCSP_NOINTERN 0x2
|
||||
#define OCSP_NOSIGS 0x4
|
||||
#define OCSP_NOCHAIN 0x8
|
||||
#define OCSP_NOVERIFY 0x10
|
||||
#define OCSP_NOEXPLICIT 0x20
|
||||
#define OCSP_NOCASIGN 0x40
|
||||
#define OCSP_NODELEGATED 0x80
|
||||
#define OCSP_NOCHECKS 0x100
|
||||
#define OCSP_TRUSTOTHER 0x200
|
||||
#define OCSP_RESPID_KEY 0x400
|
||||
#define OCSP_NOTIME 0x800
|
||||
|
||||
/* CertID ::= SEQUENCE {
|
||||
* hashAlgorithm AlgorithmIdentifier,
|
||||
* issuerNameHash OCTET STRING, -- Hash of Issuer's DN
|
||||
* issuerKeyHash OCTET STRING, -- Hash of Issuers public key (excluding the tag & length fields)
|
||||
* serialNumber CertificateSerialNumber }
|
||||
*/
|
||||
typedef struct ocsp_cert_id_st
|
||||
{
|
||||
X509_ALGOR *hashAlgorithm;
|
||||
ASN1_OCTET_STRING *issuerNameHash;
|
||||
ASN1_OCTET_STRING *issuerKeyHash;
|
||||
ASN1_INTEGER *serialNumber;
|
||||
} OCSP_CERTID;
|
||||
|
||||
DECLARE_STACK_OF(OCSP_CERTID)
|
||||
|
||||
/* Request ::= SEQUENCE {
|
||||
* reqCert CertID,
|
||||
* singleRequestExtensions [0] EXPLICIT Extensions OPTIONAL }
|
||||
*/
|
||||
typedef struct ocsp_one_request_st
|
||||
{
|
||||
OCSP_CERTID *reqCert;
|
||||
STACK_OF(X509_EXTENSION) *singleRequestExtensions;
|
||||
} OCSP_ONEREQ;
|
||||
|
||||
DECLARE_STACK_OF(OCSP_ONEREQ)
|
||||
DECLARE_ASN1_SET_OF(OCSP_ONEREQ)
|
||||
|
||||
|
||||
/* TBSRequest ::= SEQUENCE {
|
||||
* version [0] EXPLICIT Version DEFAULT v1,
|
||||
* requestorName [1] EXPLICIT GeneralName OPTIONAL,
|
||||
* requestList SEQUENCE OF Request,
|
||||
* requestExtensions [2] EXPLICIT Extensions OPTIONAL }
|
||||
*/
|
||||
typedef struct ocsp_req_info_st
|
||||
{
|
||||
ASN1_INTEGER *version;
|
||||
GENERAL_NAME *requestorName;
|
||||
STACK_OF(OCSP_ONEREQ) *requestList;
|
||||
STACK_OF(X509_EXTENSION) *requestExtensions;
|
||||
} OCSP_REQINFO;
|
||||
|
||||
/* Signature ::= SEQUENCE {
|
||||
* signatureAlgorithm AlgorithmIdentifier,
|
||||
* signature BIT STRING,
|
||||
* certs [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL }
|
||||
*/
|
||||
typedef struct ocsp_signature_st
|
||||
{
|
||||
X509_ALGOR *signatureAlgorithm;
|
||||
ASN1_BIT_STRING *signature;
|
||||
STACK_OF(X509) *certs;
|
||||
} OCSP_SIGNATURE;
|
||||
|
||||
/* OCSPRequest ::= SEQUENCE {
|
||||
* tbsRequest TBSRequest,
|
||||
* optionalSignature [0] EXPLICIT Signature OPTIONAL }
|
||||
*/
|
||||
typedef struct ocsp_request_st
|
||||
{
|
||||
OCSP_REQINFO *tbsRequest;
|
||||
OCSP_SIGNATURE *optionalSignature; /* OPTIONAL */
|
||||
} OCSP_REQUEST;
|
||||
|
||||
/* OCSPResponseStatus ::= ENUMERATED {
|
||||
* successful (0), --Response has valid confirmations
|
||||
* malformedRequest (1), --Illegal confirmation request
|
||||
* internalError (2), --Internal error in issuer
|
||||
* tryLater (3), --Try again later
|
||||
* --(4) is not used
|
||||
* sigRequired (5), --Must sign the request
|
||||
* unauthorized (6) --Request unauthorized
|
||||
* }
|
||||
*/
|
||||
#define OCSP_RESPONSE_STATUS_SUCCESSFUL 0
|
||||
#define OCSP_RESPONSE_STATUS_MALFORMEDREQUEST 1
|
||||
#define OCSP_RESPONSE_STATUS_INTERNALERROR 2
|
||||
#define OCSP_RESPONSE_STATUS_TRYLATER 3
|
||||
#define OCSP_RESPONSE_STATUS_SIGREQUIRED 5
|
||||
#define OCSP_RESPONSE_STATUS_UNAUTHORIZED 6
|
||||
|
||||
/* ResponseBytes ::= SEQUENCE {
|
||||
* responseType OBJECT IDENTIFIER,
|
||||
* response OCTET STRING }
|
||||
*/
|
||||
typedef struct ocsp_resp_bytes_st
|
||||
{
|
||||
ASN1_OBJECT *responseType;
|
||||
ASN1_OCTET_STRING *response;
|
||||
} OCSP_RESPBYTES;
|
||||
|
||||
/* OCSPResponse ::= SEQUENCE {
|
||||
* responseStatus OCSPResponseStatus,
|
||||
* responseBytes [0] EXPLICIT ResponseBytes OPTIONAL }
|
||||
*/
|
||||
typedef struct ocsp_response_st
|
||||
{
|
||||
ASN1_ENUMERATED *responseStatus;
|
||||
OCSP_RESPBYTES *responseBytes;
|
||||
} OCSP_RESPONSE;
|
||||
|
||||
/* ResponderID ::= CHOICE {
|
||||
* byName [1] Name,
|
||||
* byKey [2] KeyHash }
|
||||
*/
|
||||
#define V_OCSP_RESPID_NAME 0
|
||||
#define V_OCSP_RESPID_KEY 1
|
||||
typedef struct ocsp_responder_id_st
|
||||
{
|
||||
int type;
|
||||
union {
|
||||
X509_NAME* byName;
|
||||
ASN1_OCTET_STRING *byKey;
|
||||
} value;
|
||||
} OCSP_RESPID;
|
||||
/* KeyHash ::= OCTET STRING --SHA-1 hash of responder's public key
|
||||
* --(excluding the tag and length fields)
|
||||
*/
|
||||
|
||||
/* RevokedInfo ::= SEQUENCE {
|
||||
* revocationTime GeneralizedTime,
|
||||
* revocationReason [0] EXPLICIT CRLReason OPTIONAL }
|
||||
*/
|
||||
typedef struct ocsp_revoked_info_st
|
||||
{
|
||||
ASN1_GENERALIZEDTIME *revocationTime;
|
||||
ASN1_ENUMERATED *revocationReason;
|
||||
} OCSP_REVOKEDINFO;
|
||||
|
||||
/* CertStatus ::= CHOICE {
|
||||
* good [0] IMPLICIT NULL,
|
||||
* revoked [1] IMPLICIT RevokedInfo,
|
||||
* unknown [2] IMPLICIT UnknownInfo }
|
||||
*/
|
||||
#define V_OCSP_CERTSTATUS_GOOD 0
|
||||
#define V_OCSP_CERTSTATUS_REVOKED 1
|
||||
#define V_OCSP_CERTSTATUS_UNKNOWN 2
|
||||
typedef struct ocsp_cert_status_st
|
||||
{
|
||||
int type;
|
||||
union {
|
||||
ASN1_NULL *good;
|
||||
OCSP_REVOKEDINFO *revoked;
|
||||
ASN1_NULL *unknown;
|
||||
} value;
|
||||
} OCSP_CERTSTATUS;
|
||||
|
||||
/* SingleResponse ::= SEQUENCE {
|
||||
* certID CertID,
|
||||
* certStatus CertStatus,
|
||||
* thisUpdate GeneralizedTime,
|
||||
* nextUpdate [0] EXPLICIT GeneralizedTime OPTIONAL,
|
||||
* singleExtensions [1] EXPLICIT Extensions OPTIONAL }
|
||||
*/
|
||||
typedef struct ocsp_single_response_st
|
||||
{
|
||||
OCSP_CERTID *certId;
|
||||
OCSP_CERTSTATUS *certStatus;
|
||||
ASN1_GENERALIZEDTIME *thisUpdate;
|
||||
ASN1_GENERALIZEDTIME *nextUpdate;
|
||||
STACK_OF(X509_EXTENSION) *singleExtensions;
|
||||
} OCSP_SINGLERESP;
|
||||
|
||||
DECLARE_STACK_OF(OCSP_SINGLERESP)
|
||||
DECLARE_ASN1_SET_OF(OCSP_SINGLERESP)
|
||||
|
||||
/* ResponseData ::= SEQUENCE {
|
||||
* version [0] EXPLICIT Version DEFAULT v1,
|
||||
* responderID ResponderID,
|
||||
* producedAt GeneralizedTime,
|
||||
* responses SEQUENCE OF SingleResponse,
|
||||
* responseExtensions [1] EXPLICIT Extensions OPTIONAL }
|
||||
*/
|
||||
typedef struct ocsp_response_data_st
|
||||
{
|
||||
ASN1_INTEGER *version;
|
||||
OCSP_RESPID *responderId;
|
||||
ASN1_GENERALIZEDTIME *producedAt;
|
||||
STACK_OF(OCSP_SINGLERESP) *responses;
|
||||
STACK_OF(X509_EXTENSION) *responseExtensions;
|
||||
} OCSP_RESPDATA;
|
||||
|
||||
/* BasicOCSPResponse ::= SEQUENCE {
|
||||
* tbsResponseData ResponseData,
|
||||
* signatureAlgorithm AlgorithmIdentifier,
|
||||
* signature BIT STRING,
|
||||
* certs [0] EXPLICIT SEQUENCE OF Certificate OPTIONAL }
|
||||
*/
|
||||
/* Note 1:
|
||||
The value for "signature" is specified in the OCSP rfc2560 as follows:
|
||||
"The value for the signature SHALL be computed on the hash of the DER
|
||||
encoding ResponseData." This means that you must hash the DER-encoded
|
||||
tbsResponseData, and then run it through a crypto-signing function, which
|
||||
will (at least w/RSA) do a hash-'n'-private-encrypt operation. This seems
|
||||
a bit odd, but that's the spec. Also note that the data structures do not
|
||||
leave anywhere to independently specify the algorithm used for the initial
|
||||
hash. So, we look at the signature-specification algorithm, and try to do
|
||||
something intelligent. -- Kathy Weinhold, CertCo */
|
||||
/* Note 2:
|
||||
It seems that the mentioned passage from RFC 2560 (section 4.2.1) is open
|
||||
for interpretation. I've done tests against another responder, and found
|
||||
that it doesn't do the double hashing that the RFC seems to say one
|
||||
should. Therefore, all relevant functions take a flag saying which
|
||||
variant should be used. -- Richard Levitte, OpenSSL team and CeloCom */
|
||||
typedef struct ocsp_basic_response_st
|
||||
{
|
||||
OCSP_RESPDATA *tbsResponseData;
|
||||
X509_ALGOR *signatureAlgorithm;
|
||||
ASN1_BIT_STRING *signature;
|
||||
STACK_OF(X509) *certs;
|
||||
} OCSP_BASICRESP;
|
||||
#include <openssl/opensslconf.h>
|
||||
|
||||
/*
|
||||
* These definitions are outside the OPENSSL_NO_OCSP guard because although for
|
||||
* historical reasons they have OCSP_* names, they can actually be used
|
||||
* independently of OCSP. E.g. see RFC5280
|
||||
*/
|
||||
/*-
|
||||
* CRLReason ::= ENUMERATED {
|
||||
* unspecified (0),
|
||||
* keyCompromise (1),
|
||||
@ -314,96 +28,167 @@ typedef struct ocsp_basic_response_st
|
||||
* certificateHold (6),
|
||||
* removeFromCRL (8) }
|
||||
*/
|
||||
#define OCSP_REVOKED_STATUS_NOSTATUS -1
|
||||
#define OCSP_REVOKED_STATUS_UNSPECIFIED 0
|
||||
#define OCSP_REVOKED_STATUS_KEYCOMPROMISE 1
|
||||
#define OCSP_REVOKED_STATUS_CACOMPROMISE 2
|
||||
#define OCSP_REVOKED_STATUS_AFFILIATIONCHANGED 3
|
||||
#define OCSP_REVOKED_STATUS_SUPERSEDED 4
|
||||
#define OCSP_REVOKED_STATUS_CESSATIONOFOPERATION 5
|
||||
#define OCSP_REVOKED_STATUS_CERTIFICATEHOLD 6
|
||||
#define OCSP_REVOKED_STATUS_REMOVEFROMCRL 8
|
||||
# define OCSP_REVOKED_STATUS_NOSTATUS -1
|
||||
# define OCSP_REVOKED_STATUS_UNSPECIFIED 0
|
||||
# define OCSP_REVOKED_STATUS_KEYCOMPROMISE 1
|
||||
# define OCSP_REVOKED_STATUS_CACOMPROMISE 2
|
||||
# define OCSP_REVOKED_STATUS_AFFILIATIONCHANGED 3
|
||||
# define OCSP_REVOKED_STATUS_SUPERSEDED 4
|
||||
# define OCSP_REVOKED_STATUS_CESSATIONOFOPERATION 5
|
||||
# define OCSP_REVOKED_STATUS_CERTIFICATEHOLD 6
|
||||
# define OCSP_REVOKED_STATUS_REMOVEFROMCRL 8
|
||||
|
||||
/* CrlID ::= SEQUENCE {
|
||||
* crlUrl [0] EXPLICIT IA5String OPTIONAL,
|
||||
* crlNum [1] EXPLICIT INTEGER OPTIONAL,
|
||||
* crlTime [2] EXPLICIT GeneralizedTime OPTIONAL }
|
||||
*/
|
||||
typedef struct ocsp_crl_id_st
|
||||
{
|
||||
ASN1_IA5STRING *crlUrl;
|
||||
ASN1_INTEGER *crlNum;
|
||||
ASN1_GENERALIZEDTIME *crlTime;
|
||||
} OCSP_CRLID;
|
||||
|
||||
/* ServiceLocator ::= SEQUENCE {
|
||||
* issuer Name,
|
||||
* locator AuthorityInfoAccessSyntax OPTIONAL }
|
||||
*/
|
||||
typedef struct ocsp_service_locator_st
|
||||
{
|
||||
X509_NAME* issuer;
|
||||
STACK_OF(ACCESS_DESCRIPTION) *locator;
|
||||
} OCSP_SERVICELOC;
|
||||
# ifndef OPENSSL_NO_OCSP
|
||||
|
||||
#define PEM_STRING_OCSP_REQUEST "OCSP REQUEST"
|
||||
#define PEM_STRING_OCSP_RESPONSE "OCSP RESPONSE"
|
||||
# include <openssl/ossl_typ.h>
|
||||
# include <openssl/x509.h>
|
||||
# include <openssl/x509v3.h>
|
||||
# include <openssl/safestack.h>
|
||||
|
||||
#define d2i_OCSP_REQUEST_bio(bp,p) ASN1_d2i_bio_of(OCSP_REQUEST,OCSP_REQUEST_new,d2i_OCSP_REQUEST,bp,p)
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define d2i_OCSP_RESPONSE_bio(bp,p) ASN1_d2i_bio_of(OCSP_RESPONSE,OCSP_RESPONSE_new,d2i_OCSP_RESPONSE,bp,p)
|
||||
/* Various flags and values */
|
||||
|
||||
#define PEM_read_bio_OCSP_REQUEST(bp,x,cb) (OCSP_REQUEST *)PEM_ASN1_read_bio( \
|
||||
# define OCSP_DEFAULT_NONCE_LENGTH 16
|
||||
|
||||
# define OCSP_NOCERTS 0x1
|
||||
# define OCSP_NOINTERN 0x2
|
||||
# define OCSP_NOSIGS 0x4
|
||||
# define OCSP_NOCHAIN 0x8
|
||||
# define OCSP_NOVERIFY 0x10
|
||||
# define OCSP_NOEXPLICIT 0x20
|
||||
# define OCSP_NOCASIGN 0x40
|
||||
# define OCSP_NODELEGATED 0x80
|
||||
# define OCSP_NOCHECKS 0x100
|
||||
# define OCSP_TRUSTOTHER 0x200
|
||||
# define OCSP_RESPID_KEY 0x400
|
||||
# define OCSP_NOTIME 0x800
|
||||
|
||||
typedef struct ocsp_cert_id_st OCSP_CERTID;
|
||||
|
||||
DEFINE_STACK_OF(OCSP_CERTID)
|
||||
|
||||
typedef struct ocsp_one_request_st OCSP_ONEREQ;
|
||||
|
||||
DEFINE_STACK_OF(OCSP_ONEREQ)
|
||||
|
||||
typedef struct ocsp_req_info_st OCSP_REQINFO;
|
||||
typedef struct ocsp_signature_st OCSP_SIGNATURE;
|
||||
typedef struct ocsp_request_st OCSP_REQUEST;
|
||||
|
||||
# define OCSP_RESPONSE_STATUS_SUCCESSFUL 0
|
||||
# define OCSP_RESPONSE_STATUS_MALFORMEDREQUEST 1
|
||||
# define OCSP_RESPONSE_STATUS_INTERNALERROR 2
|
||||
# define OCSP_RESPONSE_STATUS_TRYLATER 3
|
||||
# define OCSP_RESPONSE_STATUS_SIGREQUIRED 5
|
||||
# define OCSP_RESPONSE_STATUS_UNAUTHORIZED 6
|
||||
|
||||
typedef struct ocsp_resp_bytes_st OCSP_RESPBYTES;
|
||||
|
||||
# define V_OCSP_RESPID_NAME 0
|
||||
# define V_OCSP_RESPID_KEY 1
|
||||
|
||||
DEFINE_STACK_OF(OCSP_RESPID)
|
||||
DECLARE_ASN1_FUNCTIONS(OCSP_RESPID)
|
||||
|
||||
typedef struct ocsp_revoked_info_st OCSP_REVOKEDINFO;
|
||||
|
||||
# define V_OCSP_CERTSTATUS_GOOD 0
|
||||
# define V_OCSP_CERTSTATUS_REVOKED 1
|
||||
# define V_OCSP_CERTSTATUS_UNKNOWN 2
|
||||
|
||||
typedef struct ocsp_cert_status_st OCSP_CERTSTATUS;
|
||||
typedef struct ocsp_single_response_st OCSP_SINGLERESP;
|
||||
|
||||
DEFINE_STACK_OF(OCSP_SINGLERESP)
|
||||
|
||||
typedef struct ocsp_response_data_st OCSP_RESPDATA;
|
||||
|
||||
typedef struct ocsp_basic_response_st OCSP_BASICRESP;
|
||||
|
||||
typedef struct ocsp_crl_id_st OCSP_CRLID;
|
||||
typedef struct ocsp_service_locator_st OCSP_SERVICELOC;
|
||||
|
||||
# define PEM_STRING_OCSP_REQUEST "OCSP REQUEST"
|
||||
# define PEM_STRING_OCSP_RESPONSE "OCSP RESPONSE"
|
||||
|
||||
# define d2i_OCSP_REQUEST_bio(bp,p) ASN1_d2i_bio_of(OCSP_REQUEST,OCSP_REQUEST_new,d2i_OCSP_REQUEST,bp,p)
|
||||
|
||||
# define d2i_OCSP_RESPONSE_bio(bp,p) ASN1_d2i_bio_of(OCSP_RESPONSE,OCSP_RESPONSE_new,d2i_OCSP_RESPONSE,bp,p)
|
||||
|
||||
# define PEM_read_bio_OCSP_REQUEST(bp,x,cb) (OCSP_REQUEST *)PEM_ASN1_read_bio( \
|
||||
(char *(*)())d2i_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,bp,(char **)x,cb,NULL)
|
||||
|
||||
#define PEM_read_bio_OCSP_RESPONSE(bp,x,cb)(OCSP_RESPONSE *)PEM_ASN1_read_bio(\
|
||||
# define PEM_read_bio_OCSP_RESPONSE(bp,x,cb)(OCSP_RESPONSE *)PEM_ASN1_read_bio(\
|
||||
(char *(*)())d2i_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,bp,(char **)x,cb,NULL)
|
||||
|
||||
#define PEM_write_bio_OCSP_REQUEST(bp,o) \
|
||||
# define PEM_write_bio_OCSP_REQUEST(bp,o) \
|
||||
PEM_ASN1_write_bio((int (*)())i2d_OCSP_REQUEST,PEM_STRING_OCSP_REQUEST,\
|
||||
bp,(char *)o, NULL,NULL,0,NULL,NULL)
|
||||
bp,(char *)o, NULL,NULL,0,NULL,NULL)
|
||||
|
||||
#define PEM_write_bio_OCSP_RESPONSE(bp,o) \
|
||||
# define PEM_write_bio_OCSP_RESPONSE(bp,o) \
|
||||
PEM_ASN1_write_bio((int (*)())i2d_OCSP_RESPONSE,PEM_STRING_OCSP_RESPONSE,\
|
||||
bp,(char *)o, NULL,NULL,0,NULL,NULL)
|
||||
bp,(char *)o, NULL,NULL,0,NULL,NULL)
|
||||
|
||||
#define i2d_OCSP_RESPONSE_bio(bp,o) ASN1_i2d_bio_of(OCSP_RESPONSE,i2d_OCSP_RESPONSE,bp,o)
|
||||
# define i2d_OCSP_RESPONSE_bio(bp,o) ASN1_i2d_bio_of(OCSP_RESPONSE,i2d_OCSP_RESPONSE,bp,o)
|
||||
|
||||
#define i2d_OCSP_REQUEST_bio(bp,o) ASN1_i2d_bio_of(OCSP_REQUEST,i2d_OCSP_REQUEST,bp,o)
|
||||
# define i2d_OCSP_REQUEST_bio(bp,o) ASN1_i2d_bio_of(OCSP_REQUEST,i2d_OCSP_REQUEST,bp,o)
|
||||
|
||||
#define OCSP_REQUEST_sign(o,pkey,md) \
|
||||
ASN1_item_sign(ASN1_ITEM_rptr(OCSP_REQINFO),\
|
||||
o->optionalSignature->signatureAlgorithm,NULL,\
|
||||
o->optionalSignature->signature,o->tbsRequest,pkey,md)
|
||||
# define OCSP_REQUEST_sign(o,pkey,md) \
|
||||
ASN1_item_sign(ASN1_ITEM_rptr(OCSP_REQINFO),\
|
||||
&o->optionalSignature->signatureAlgorithm,NULL,\
|
||||
o->optionalSignature->signature,&o->tbsRequest,pkey,md)
|
||||
|
||||
#define OCSP_BASICRESP_sign(o,pkey,md,d) \
|
||||
ASN1_item_sign(ASN1_ITEM_rptr(OCSP_RESPDATA),o->signatureAlgorithm,NULL,\
|
||||
o->signature,o->tbsResponseData,pkey,md)
|
||||
# define OCSP_BASICRESP_sign(o,pkey,md,d) \
|
||||
ASN1_item_sign(ASN1_ITEM_rptr(OCSP_RESPDATA),&o->signatureAlgorithm,NULL,\
|
||||
o->signature,&o->tbsResponseData,pkey,md)
|
||||
|
||||
#define OCSP_REQUEST_verify(a,r) ASN1_item_verify(ASN1_ITEM_rptr(OCSP_REQINFO),\
|
||||
a->optionalSignature->signatureAlgorithm,\
|
||||
a->optionalSignature->signature,a->tbsRequest,r)
|
||||
# define OCSP_REQUEST_verify(a,r) ASN1_item_verify(ASN1_ITEM_rptr(OCSP_REQINFO),\
|
||||
&a->optionalSignature->signatureAlgorithm,\
|
||||
a->optionalSignature->signature,&a->tbsRequest,r)
|
||||
|
||||
#define OCSP_BASICRESP_verify(a,r,d) ASN1_item_verify(ASN1_ITEM_rptr(OCSP_RESPDATA),\
|
||||
a->signatureAlgorithm,a->signature,a->tbsResponseData,r)
|
||||
# define OCSP_BASICRESP_verify(a,r,d) ASN1_item_verify(ASN1_ITEM_rptr(OCSP_RESPDATA),\
|
||||
&a->signatureAlgorithm,a->signature,&a->tbsResponseData,r)
|
||||
|
||||
#define ASN1_BIT_STRING_digest(data,type,md,len) \
|
||||
ASN1_item_digest(ASN1_ITEM_rptr(ASN1_BIT_STRING),type,data,md,len)
|
||||
# define ASN1_BIT_STRING_digest(data,type,md,len) \
|
||||
ASN1_item_digest(ASN1_ITEM_rptr(ASN1_BIT_STRING),type,data,md,len)
|
||||
|
||||
#define OCSP_CERTID_dup(cid) ASN1_dup_of(OCSP_CERTID,i2d_OCSP_CERTID,d2i_OCSP_CERTID,cid)
|
||||
|
||||
#define OCSP_CERTSTATUS_dup(cs)\
|
||||
# define OCSP_CERTSTATUS_dup(cs)\
|
||||
(OCSP_CERTSTATUS*)ASN1_dup((int(*)())i2d_OCSP_CERTSTATUS,\
|
||||
(char *(*)())d2i_OCSP_CERTSTATUS,(char *)(cs))
|
||||
(char *(*)())d2i_OCSP_CERTSTATUS,(char *)(cs))
|
||||
|
||||
OCSP_RESPONSE *OCSP_sendreq_bio(BIO *b, char *path, OCSP_REQUEST *req);
|
||||
OCSP_CERTID *OCSP_CERTID_dup(OCSP_CERTID *id);
|
||||
|
||||
OCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst, X509 *subject, X509 *issuer);
|
||||
OCSP_RESPONSE *OCSP_sendreq_bio(BIO *b, const char *path, OCSP_REQUEST *req);
|
||||
OCSP_REQ_CTX *OCSP_sendreq_new(BIO *io, const char *path, OCSP_REQUEST *req,
|
||||
int maxline);
|
||||
int OCSP_REQ_CTX_nbio(OCSP_REQ_CTX *rctx);
|
||||
int OCSP_sendreq_nbio(OCSP_RESPONSE **presp, OCSP_REQ_CTX *rctx);
|
||||
OCSP_REQ_CTX *OCSP_REQ_CTX_new(BIO *io, int maxline);
|
||||
void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx);
|
||||
void OCSP_set_max_response_length(OCSP_REQ_CTX *rctx, unsigned long len);
|
||||
int OCSP_REQ_CTX_i2d(OCSP_REQ_CTX *rctx, const ASN1_ITEM *it,
|
||||
ASN1_VALUE *val);
|
||||
int OCSP_REQ_CTX_nbio_d2i(OCSP_REQ_CTX *rctx, ASN1_VALUE **pval,
|
||||
const ASN1_ITEM *it);
|
||||
BIO *OCSP_REQ_CTX_get0_mem_bio(OCSP_REQ_CTX *rctx);
|
||||
int OCSP_REQ_CTX_i2d(OCSP_REQ_CTX *rctx, const ASN1_ITEM *it,
|
||||
ASN1_VALUE *val);
|
||||
int OCSP_REQ_CTX_http(OCSP_REQ_CTX *rctx, const char *op, const char *path);
|
||||
int OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req);
|
||||
int OCSP_REQ_CTX_add1_header(OCSP_REQ_CTX *rctx,
|
||||
const char *name, const char *value);
|
||||
|
||||
OCSP_CERTID *OCSP_cert_to_id(const EVP_MD *dgst, const X509 *subject,
|
||||
const X509 *issuer);
|
||||
|
||||
OCSP_CERTID *OCSP_cert_id_new(const EVP_MD *dgst,
|
||||
X509_NAME *issuerName,
|
||||
ASN1_BIT_STRING* issuerKey,
|
||||
ASN1_INTEGER *serialNumber);
|
||||
const X509_NAME *issuerName,
|
||||
const ASN1_BIT_STRING *issuerKey,
|
||||
const ASN1_INTEGER *serialNumber);
|
||||
|
||||
OCSP_ONEREQ *OCSP_request_add0_id(OCSP_REQUEST *req, OCSP_CERTID *cid);
|
||||
|
||||
@ -415,35 +200,43 @@ int OCSP_copy_nonce(OCSP_BASICRESP *resp, OCSP_REQUEST *req);
|
||||
int OCSP_request_set1_name(OCSP_REQUEST *req, X509_NAME *nm);
|
||||
int OCSP_request_add1_cert(OCSP_REQUEST *req, X509 *cert);
|
||||
|
||||
int OCSP_request_sign(OCSP_REQUEST *req,
|
||||
X509 *signer,
|
||||
EVP_PKEY *key,
|
||||
const EVP_MD *dgst,
|
||||
STACK_OF(X509) *certs,
|
||||
unsigned long flags);
|
||||
int OCSP_request_sign(OCSP_REQUEST *req,
|
||||
X509 *signer,
|
||||
EVP_PKEY *key,
|
||||
const EVP_MD *dgst,
|
||||
STACK_OF(X509) *certs, unsigned long flags);
|
||||
|
||||
int OCSP_response_status(OCSP_RESPONSE *resp);
|
||||
OCSP_BASICRESP *OCSP_response_get1_basic(OCSP_RESPONSE *resp);
|
||||
|
||||
const ASN1_OCTET_STRING *OCSP_resp_get0_signature(const OCSP_BASICRESP *bs);
|
||||
|
||||
int OCSP_resp_count(OCSP_BASICRESP *bs);
|
||||
OCSP_SINGLERESP *OCSP_resp_get0(OCSP_BASICRESP *bs, int idx);
|
||||
const ASN1_GENERALIZEDTIME *OCSP_resp_get0_produced_at(const OCSP_BASICRESP* bs);
|
||||
const STACK_OF(X509) *OCSP_resp_get0_certs(const OCSP_BASICRESP *bs);
|
||||
int OCSP_resp_get0_id(const OCSP_BASICRESP *bs,
|
||||
const ASN1_OCTET_STRING **pid,
|
||||
const X509_NAME **pname);
|
||||
|
||||
int OCSP_resp_find(OCSP_BASICRESP *bs, OCSP_CERTID *id, int last);
|
||||
int OCSP_single_get0_status(OCSP_SINGLERESP *single, int *reason,
|
||||
ASN1_GENERALIZEDTIME **revtime,
|
||||
ASN1_GENERALIZEDTIME **thisupd,
|
||||
ASN1_GENERALIZEDTIME **nextupd);
|
||||
ASN1_GENERALIZEDTIME **revtime,
|
||||
ASN1_GENERALIZEDTIME **thisupd,
|
||||
ASN1_GENERALIZEDTIME **nextupd);
|
||||
int OCSP_resp_find_status(OCSP_BASICRESP *bs, OCSP_CERTID *id, int *status,
|
||||
int *reason,
|
||||
ASN1_GENERALIZEDTIME **revtime,
|
||||
ASN1_GENERALIZEDTIME **thisupd,
|
||||
ASN1_GENERALIZEDTIME **nextupd);
|
||||
int *reason,
|
||||
ASN1_GENERALIZEDTIME **revtime,
|
||||
ASN1_GENERALIZEDTIME **thisupd,
|
||||
ASN1_GENERALIZEDTIME **nextupd);
|
||||
int OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd,
|
||||
ASN1_GENERALIZEDTIME *nextupd,
|
||||
long sec, long maxsec);
|
||||
ASN1_GENERALIZEDTIME *nextupd, long sec, long maxsec);
|
||||
|
||||
int OCSP_request_verify(OCSP_REQUEST *req, STACK_OF(X509) *certs, X509_STORE *store, unsigned long flags);
|
||||
int OCSP_request_verify(OCSP_REQUEST *req, STACK_OF(X509) *certs,
|
||||
X509_STORE *store, unsigned long flags);
|
||||
|
||||
int OCSP_parse_url(char *url, char **phost, char **pport, char **ppath, int *pssl);
|
||||
int OCSP_parse_url(const char *url, char **phost, char **pport, char **ppath,
|
||||
int *pssl);
|
||||
|
||||
int OCSP_id_issuer_cmp(OCSP_CERTID *a, OCSP_CERTID *b);
|
||||
int OCSP_id_cmp(OCSP_CERTID *a, OCSP_CERTID *b);
|
||||
@ -452,76 +245,84 @@ int OCSP_request_onereq_count(OCSP_REQUEST *req);
|
||||
OCSP_ONEREQ *OCSP_request_onereq_get0(OCSP_REQUEST *req, int i);
|
||||
OCSP_CERTID *OCSP_onereq_get0_id(OCSP_ONEREQ *one);
|
||||
int OCSP_id_get0_info(ASN1_OCTET_STRING **piNameHash, ASN1_OBJECT **pmd,
|
||||
ASN1_OCTET_STRING **pikeyHash,
|
||||
ASN1_INTEGER **pserial, OCSP_CERTID *cid);
|
||||
ASN1_OCTET_STRING **pikeyHash,
|
||||
ASN1_INTEGER **pserial, OCSP_CERTID *cid);
|
||||
int OCSP_request_is_signed(OCSP_REQUEST *req);
|
||||
OCSP_RESPONSE *OCSP_response_create(int status, OCSP_BASICRESP *bs);
|
||||
OCSP_SINGLERESP *OCSP_basic_add1_status(OCSP_BASICRESP *rsp,
|
||||
OCSP_CERTID *cid,
|
||||
int status, int reason,
|
||||
ASN1_TIME *revtime,
|
||||
ASN1_TIME *thisupd, ASN1_TIME *nextupd);
|
||||
OCSP_CERTID *cid,
|
||||
int status, int reason,
|
||||
ASN1_TIME *revtime,
|
||||
ASN1_TIME *thisupd,
|
||||
ASN1_TIME *nextupd);
|
||||
int OCSP_basic_add1_cert(OCSP_BASICRESP *resp, X509 *cert);
|
||||
int OCSP_basic_sign(OCSP_BASICRESP *brsp,
|
||||
X509 *signer, EVP_PKEY *key, const EVP_MD *dgst,
|
||||
STACK_OF(X509) *certs, unsigned long flags);
|
||||
X509 *signer, EVP_PKEY *key, const EVP_MD *dgst,
|
||||
STACK_OF(X509) *certs, unsigned long flags);
|
||||
int OCSP_RESPID_set_by_name(OCSP_RESPID *respid, X509 *cert);
|
||||
int OCSP_RESPID_set_by_key(OCSP_RESPID *respid, X509 *cert);
|
||||
int OCSP_RESPID_match(OCSP_RESPID *respid, X509 *cert);
|
||||
|
||||
ASN1_STRING *ASN1_STRING_encode(ASN1_STRING *s, i2d_of_void *i2d,
|
||||
void *data, STACK_OF(ASN1_OBJECT) *sk);
|
||||
#define ASN1_STRING_encode_of(type,s,i2d,data,sk) \
|
||||
((ASN1_STRING *(*)(ASN1_STRING *,I2D_OF(type),type *,STACK_OF(ASN1_OBJECT) *))openssl_fcast(ASN1_STRING_encode))(s,i2d,data,sk)
|
||||
|
||||
X509_EXTENSION *OCSP_crlID_new(char *url, long *n, char *tim);
|
||||
X509_EXTENSION *OCSP_crlID_new(const char *url, long *n, char *tim);
|
||||
|
||||
X509_EXTENSION *OCSP_accept_responses_new(char **oids);
|
||||
|
||||
X509_EXTENSION *OCSP_archive_cutoff_new(char* tim);
|
||||
X509_EXTENSION *OCSP_archive_cutoff_new(char *tim);
|
||||
|
||||
X509_EXTENSION *OCSP_url_svcloc_new(X509_NAME* issuer, char **urls);
|
||||
X509_EXTENSION *OCSP_url_svcloc_new(X509_NAME *issuer, const char **urls);
|
||||
|
||||
int OCSP_REQUEST_get_ext_count(OCSP_REQUEST *x);
|
||||
int OCSP_REQUEST_get_ext_by_NID(OCSP_REQUEST *x, int nid, int lastpos);
|
||||
int OCSP_REQUEST_get_ext_by_OBJ(OCSP_REQUEST *x, ASN1_OBJECT *obj, int lastpos);
|
||||
int OCSP_REQUEST_get_ext_by_OBJ(OCSP_REQUEST *x, const ASN1_OBJECT *obj,
|
||||
int lastpos);
|
||||
int OCSP_REQUEST_get_ext_by_critical(OCSP_REQUEST *x, int crit, int lastpos);
|
||||
X509_EXTENSION *OCSP_REQUEST_get_ext(OCSP_REQUEST *x, int loc);
|
||||
X509_EXTENSION *OCSP_REQUEST_delete_ext(OCSP_REQUEST *x, int loc);
|
||||
void *OCSP_REQUEST_get1_ext_d2i(OCSP_REQUEST *x, int nid, int *crit, int *idx);
|
||||
void *OCSP_REQUEST_get1_ext_d2i(OCSP_REQUEST *x, int nid, int *crit,
|
||||
int *idx);
|
||||
int OCSP_REQUEST_add1_ext_i2d(OCSP_REQUEST *x, int nid, void *value, int crit,
|
||||
unsigned long flags);
|
||||
unsigned long flags);
|
||||
int OCSP_REQUEST_add_ext(OCSP_REQUEST *x, X509_EXTENSION *ex, int loc);
|
||||
|
||||
int OCSP_ONEREQ_get_ext_count(OCSP_ONEREQ *x);
|
||||
int OCSP_ONEREQ_get_ext_by_NID(OCSP_ONEREQ *x, int nid, int lastpos);
|
||||
int OCSP_ONEREQ_get_ext_by_OBJ(OCSP_ONEREQ *x, ASN1_OBJECT *obj, int lastpos);
|
||||
int OCSP_ONEREQ_get_ext_by_OBJ(OCSP_ONEREQ *x, const ASN1_OBJECT *obj, int lastpos);
|
||||
int OCSP_ONEREQ_get_ext_by_critical(OCSP_ONEREQ *x, int crit, int lastpos);
|
||||
X509_EXTENSION *OCSP_ONEREQ_get_ext(OCSP_ONEREQ *x, int loc);
|
||||
X509_EXTENSION *OCSP_ONEREQ_delete_ext(OCSP_ONEREQ *x, int loc);
|
||||
void *OCSP_ONEREQ_get1_ext_d2i(OCSP_ONEREQ *x, int nid, int *crit, int *idx);
|
||||
int OCSP_ONEREQ_add1_ext_i2d(OCSP_ONEREQ *x, int nid, void *value, int crit,
|
||||
unsigned long flags);
|
||||
unsigned long flags);
|
||||
int OCSP_ONEREQ_add_ext(OCSP_ONEREQ *x, X509_EXTENSION *ex, int loc);
|
||||
|
||||
int OCSP_BASICRESP_get_ext_count(OCSP_BASICRESP *x);
|
||||
int OCSP_BASICRESP_get_ext_by_NID(OCSP_BASICRESP *x, int nid, int lastpos);
|
||||
int OCSP_BASICRESP_get_ext_by_OBJ(OCSP_BASICRESP *x, ASN1_OBJECT *obj, int lastpos);
|
||||
int OCSP_BASICRESP_get_ext_by_critical(OCSP_BASICRESP *x, int crit, int lastpos);
|
||||
int OCSP_BASICRESP_get_ext_by_OBJ(OCSP_BASICRESP *x, const ASN1_OBJECT *obj,
|
||||
int lastpos);
|
||||
int OCSP_BASICRESP_get_ext_by_critical(OCSP_BASICRESP *x, int crit,
|
||||
int lastpos);
|
||||
X509_EXTENSION *OCSP_BASICRESP_get_ext(OCSP_BASICRESP *x, int loc);
|
||||
X509_EXTENSION *OCSP_BASICRESP_delete_ext(OCSP_BASICRESP *x, int loc);
|
||||
void *OCSP_BASICRESP_get1_ext_d2i(OCSP_BASICRESP *x, int nid, int *crit, int *idx);
|
||||
int OCSP_BASICRESP_add1_ext_i2d(OCSP_BASICRESP *x, int nid, void *value, int crit,
|
||||
unsigned long flags);
|
||||
void *OCSP_BASICRESP_get1_ext_d2i(OCSP_BASICRESP *x, int nid, int *crit,
|
||||
int *idx);
|
||||
int OCSP_BASICRESP_add1_ext_i2d(OCSP_BASICRESP *x, int nid, void *value,
|
||||
int crit, unsigned long flags);
|
||||
int OCSP_BASICRESP_add_ext(OCSP_BASICRESP *x, X509_EXTENSION *ex, int loc);
|
||||
|
||||
int OCSP_SINGLERESP_get_ext_count(OCSP_SINGLERESP *x);
|
||||
int OCSP_SINGLERESP_get_ext_by_NID(OCSP_SINGLERESP *x, int nid, int lastpos);
|
||||
int OCSP_SINGLERESP_get_ext_by_OBJ(OCSP_SINGLERESP *x, ASN1_OBJECT *obj, int lastpos);
|
||||
int OCSP_SINGLERESP_get_ext_by_critical(OCSP_SINGLERESP *x, int crit, int lastpos);
|
||||
int OCSP_SINGLERESP_get_ext_by_OBJ(OCSP_SINGLERESP *x, const ASN1_OBJECT *obj,
|
||||
int lastpos);
|
||||
int OCSP_SINGLERESP_get_ext_by_critical(OCSP_SINGLERESP *x, int crit,
|
||||
int lastpos);
|
||||
X509_EXTENSION *OCSP_SINGLERESP_get_ext(OCSP_SINGLERESP *x, int loc);
|
||||
X509_EXTENSION *OCSP_SINGLERESP_delete_ext(OCSP_SINGLERESP *x, int loc);
|
||||
void *OCSP_SINGLERESP_get1_ext_d2i(OCSP_SINGLERESP *x, int nid, int *crit, int *idx);
|
||||
int OCSP_SINGLERESP_add1_ext_i2d(OCSP_SINGLERESP *x, int nid, void *value, int crit,
|
||||
unsigned long flags);
|
||||
void *OCSP_SINGLERESP_get1_ext_d2i(OCSP_SINGLERESP *x, int nid, int *crit,
|
||||
int *idx);
|
||||
int OCSP_SINGLERESP_add1_ext_i2d(OCSP_SINGLERESP *x, int nid, void *value,
|
||||
int crit, unsigned long flags);
|
||||
int OCSP_SINGLERESP_add_ext(OCSP_SINGLERESP *x, X509_EXTENSION *ex, int loc);
|
||||
const OCSP_CERTID *OCSP_SINGLERESP_get0_id(const OCSP_SINGLERESP *x);
|
||||
|
||||
DECLARE_ASN1_FUNCTIONS(OCSP_SINGLERESP)
|
||||
DECLARE_ASN1_FUNCTIONS(OCSP_CERTSTATUS)
|
||||
@ -539,76 +340,73 @@ DECLARE_ASN1_FUNCTIONS(OCSP_REQINFO)
|
||||
DECLARE_ASN1_FUNCTIONS(OCSP_CRLID)
|
||||
DECLARE_ASN1_FUNCTIONS(OCSP_SERVICELOC)
|
||||
|
||||
char *OCSP_response_status_str(long s);
|
||||
char *OCSP_cert_status_str(long s);
|
||||
char *OCSP_crl_reason_str(long s);
|
||||
const char *OCSP_response_status_str(long s);
|
||||
const char *OCSP_cert_status_str(long s);
|
||||
const char *OCSP_crl_reason_str(long s);
|
||||
|
||||
int OCSP_REQUEST_print(BIO *bp, OCSP_REQUEST* a, unsigned long flags);
|
||||
int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE* o, unsigned long flags);
|
||||
int OCSP_REQUEST_print(BIO *bp, OCSP_REQUEST *a, unsigned long flags);
|
||||
int OCSP_RESPONSE_print(BIO *bp, OCSP_RESPONSE *o, unsigned long flags);
|
||||
|
||||
int OCSP_basic_verify(OCSP_BASICRESP *bs, STACK_OF(X509) *certs,
|
||||
X509_STORE *st, unsigned long flags);
|
||||
X509_STORE *st, unsigned long flags);
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
/*
|
||||
* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
void ERR_load_OCSP_strings(void);
|
||||
|
||||
int ERR_load_OCSP_strings(void);
|
||||
|
||||
/* Error codes for the OCSP functions. */
|
||||
|
||||
/* Function codes. */
|
||||
#define OCSP_F_ASN1_STRING_ENCODE 100
|
||||
#define OCSP_F_D2I_OCSP_NONCE 102
|
||||
#define OCSP_F_OCSP_BASIC_ADD1_STATUS 103
|
||||
#define OCSP_F_OCSP_BASIC_SIGN 104
|
||||
#define OCSP_F_OCSP_BASIC_VERIFY 105
|
||||
#define OCSP_F_OCSP_CERT_ID_NEW 101
|
||||
#define OCSP_F_OCSP_CHECK_DELEGATED 106
|
||||
#define OCSP_F_OCSP_CHECK_IDS 107
|
||||
#define OCSP_F_OCSP_CHECK_ISSUER 108
|
||||
#define OCSP_F_OCSP_CHECK_VALIDITY 115
|
||||
#define OCSP_F_OCSP_MATCH_ISSUERID 109
|
||||
#define OCSP_F_OCSP_PARSE_URL 114
|
||||
#define OCSP_F_OCSP_REQUEST_SIGN 110
|
||||
#define OCSP_F_OCSP_REQUEST_VERIFY 116
|
||||
#define OCSP_F_OCSP_RESPONSE_GET1_BASIC 111
|
||||
#define OCSP_F_OCSP_SENDREQ_BIO 112
|
||||
#define OCSP_F_REQUEST_VERIFY 113
|
||||
# define OCSP_F_D2I_OCSP_NONCE 102
|
||||
# define OCSP_F_OCSP_BASIC_ADD1_STATUS 103
|
||||
# define OCSP_F_OCSP_BASIC_SIGN 104
|
||||
# define OCSP_F_OCSP_BASIC_VERIFY 105
|
||||
# define OCSP_F_OCSP_CERT_ID_NEW 101
|
||||
# define OCSP_F_OCSP_CHECK_DELEGATED 106
|
||||
# define OCSP_F_OCSP_CHECK_IDS 107
|
||||
# define OCSP_F_OCSP_CHECK_ISSUER 108
|
||||
# define OCSP_F_OCSP_CHECK_VALIDITY 115
|
||||
# define OCSP_F_OCSP_MATCH_ISSUERID 109
|
||||
# define OCSP_F_OCSP_PARSE_URL 114
|
||||
# define OCSP_F_OCSP_REQUEST_SIGN 110
|
||||
# define OCSP_F_OCSP_REQUEST_VERIFY 116
|
||||
# define OCSP_F_OCSP_RESPONSE_GET1_BASIC 111
|
||||
# define OCSP_F_PARSE_HTTP_LINE1 118
|
||||
|
||||
/* Reason codes. */
|
||||
#define OCSP_R_BAD_DATA 100
|
||||
#define OCSP_R_CERTIFICATE_VERIFY_ERROR 101
|
||||
#define OCSP_R_DIGEST_ERR 102
|
||||
#define OCSP_R_ERROR_IN_NEXTUPDATE_FIELD 122
|
||||
#define OCSP_R_ERROR_IN_THISUPDATE_FIELD 123
|
||||
#define OCSP_R_ERROR_PARSING_URL 121
|
||||
#define OCSP_R_MISSING_OCSPSIGNING_USAGE 103
|
||||
#define OCSP_R_NEXTUPDATE_BEFORE_THISUPDATE 124
|
||||
#define OCSP_R_NOT_BASIC_RESPONSE 104
|
||||
#define OCSP_R_NO_CERTIFICATES_IN_CHAIN 105
|
||||
#define OCSP_R_NO_CONTENT 106
|
||||
#define OCSP_R_NO_PUBLIC_KEY 107
|
||||
#define OCSP_R_NO_RESPONSE_DATA 108
|
||||
#define OCSP_R_NO_REVOKED_TIME 109
|
||||
#define OCSP_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 110
|
||||
#define OCSP_R_REQUEST_NOT_SIGNED 128
|
||||
#define OCSP_R_RESPONSE_CONTAINS_NO_REVOCATION_DATA 111
|
||||
#define OCSP_R_ROOT_CA_NOT_TRUSTED 112
|
||||
#define OCSP_R_SERVER_READ_ERROR 113
|
||||
#define OCSP_R_SERVER_RESPONSE_ERROR 114
|
||||
#define OCSP_R_SERVER_RESPONSE_PARSE_ERROR 115
|
||||
#define OCSP_R_SERVER_WRITE_ERROR 116
|
||||
#define OCSP_R_SIGNATURE_FAILURE 117
|
||||
#define OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND 118
|
||||
#define OCSP_R_STATUS_EXPIRED 125
|
||||
#define OCSP_R_STATUS_NOT_YET_VALID 126
|
||||
#define OCSP_R_STATUS_TOO_OLD 127
|
||||
#define OCSP_R_UNKNOWN_MESSAGE_DIGEST 119
|
||||
#define OCSP_R_UNKNOWN_NID 120
|
||||
#define OCSP_R_UNSUPPORTED_REQUESTORNAME_TYPE 129
|
||||
# define OCSP_R_CERTIFICATE_VERIFY_ERROR 101
|
||||
# define OCSP_R_DIGEST_ERR 102
|
||||
# define OCSP_R_ERROR_IN_NEXTUPDATE_FIELD 122
|
||||
# define OCSP_R_ERROR_IN_THISUPDATE_FIELD 123
|
||||
# define OCSP_R_ERROR_PARSING_URL 121
|
||||
# define OCSP_R_MISSING_OCSPSIGNING_USAGE 103
|
||||
# define OCSP_R_NEXTUPDATE_BEFORE_THISUPDATE 124
|
||||
# define OCSP_R_NOT_BASIC_RESPONSE 104
|
||||
# define OCSP_R_NO_CERTIFICATES_IN_CHAIN 105
|
||||
# define OCSP_R_NO_RESPONSE_DATA 108
|
||||
# define OCSP_R_NO_REVOKED_TIME 109
|
||||
# define OCSP_R_NO_SIGNER_KEY 130
|
||||
# define OCSP_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 110
|
||||
# define OCSP_R_REQUEST_NOT_SIGNED 128
|
||||
# define OCSP_R_RESPONSE_CONTAINS_NO_REVOCATION_DATA 111
|
||||
# define OCSP_R_ROOT_CA_NOT_TRUSTED 112
|
||||
# define OCSP_R_SERVER_RESPONSE_ERROR 114
|
||||
# define OCSP_R_SERVER_RESPONSE_PARSE_ERROR 115
|
||||
# define OCSP_R_SIGNATURE_FAILURE 117
|
||||
# define OCSP_R_SIGNER_CERTIFICATE_NOT_FOUND 118
|
||||
# define OCSP_R_STATUS_EXPIRED 125
|
||||
# define OCSP_R_STATUS_NOT_YET_VALID 126
|
||||
# define OCSP_R_STATUS_TOO_OLD 127
|
||||
# define OCSP_R_UNKNOWN_MESSAGE_DIGEST 119
|
||||
# define OCSP_R_UNKNOWN_NID 120
|
||||
# define OCSP_R_UNSUPPORTED_REQUESTORNAME_TYPE 129
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@ -1,207 +1,172 @@
|
||||
/* opensslconf.h */
|
||||
/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
|
||||
/*
|
||||
* WARNING: do not edit!
|
||||
* Generated by makefile from include\openssl\opensslconf.h.in
|
||||
*
|
||||
* Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/* OpenSSL was configured with the following options: */
|
||||
// #ifndef OPENSSL_SYSNAME_WIN32
|
||||
#if defined( __WIN32__ ) || defined( WIN32 ) || defined( _WIN32 )
|
||||
# define OPENSSL_SYSNAME_WIN32
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#ifndef OPENSSL_DOING_MAKEDEPEND
|
||||
|
||||
#ifndef OPENSSL_NO_GMP
|
||||
# define OPENSSL_NO_GMP
|
||||
#ifdef OPENSSL_ALGORITHM_DEFINES
|
||||
# error OPENSSL_ALGORITHM_DEFINES no longer supported
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_KRB5
|
||||
# define OPENSSL_NO_KRB5
|
||||
|
||||
/*
|
||||
* OpenSSL was configured with the following options:
|
||||
*/
|
||||
|
||||
#ifndef OPENSSL_SYS_WIN32
|
||||
# define OPENSSL_SYS_WIN32 1
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_MDC2
|
||||
# define OPENSSL_NO_MDC2
|
||||
#ifndef OPENSSL_NO_MD2
|
||||
# define OPENSSL_NO_MD2
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_RC5
|
||||
# define OPENSSL_NO_RC5
|
||||
#endif
|
||||
|
||||
#endif /* OPENSSL_DOING_MAKEDEPEND */
|
||||
#ifndef OPENSSL_THREADS
|
||||
# define OPENSSL_THREADS
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_ASAN
|
||||
# define OPENSSL_NO_ASAN
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CRYPTO_MDEBUG
|
||||
# define OPENSSL_NO_CRYPTO_MDEBUG
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE
|
||||
# define OPENSSL_NO_CRYPTO_MDEBUG_BACKTRACE
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
|
||||
# define OPENSSL_NO_EC_NISTP_64_GCC_128
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_EGD
|
||||
# define OPENSSL_NO_EGD
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_FUZZ_AFL
|
||||
# define OPENSSL_NO_FUZZ_AFL
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_FUZZ_LIBFUZZER
|
||||
# define OPENSSL_NO_FUZZ_LIBFUZZER
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_HEARTBEATS
|
||||
# define OPENSSL_NO_HEARTBEATS
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_MSAN
|
||||
# define OPENSSL_NO_MSAN
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SCTP
|
||||
# define OPENSSL_NO_SCTP
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SSL_TRACE
|
||||
# define OPENSSL_NO_SSL_TRACE
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SSL3
|
||||
# define OPENSSL_NO_SSL3
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SSL3_METHOD
|
||||
# define OPENSSL_NO_SSL3_METHOD
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_UBSAN
|
||||
# define OPENSSL_NO_UBSAN
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_UNIT_TEST
|
||||
# define OPENSSL_NO_UNIT_TEST
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_WEAK_SSL_CIPHERS
|
||||
# define OPENSSL_NO_WEAK_SSL_CIPHERS
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_AFALGENG
|
||||
# define OPENSSL_NO_AFALGENG
|
||||
#endif
|
||||
|
||||
/* The OPENSSL_NO_* macros are also defined as NO_* if the application
|
||||
asks for it. This is a transient feature that is provided for those
|
||||
who haven't had the time to do the appropriate changes in their
|
||||
applications. */
|
||||
#ifdef OPENSSL_ALGORITHM_DEFINES
|
||||
# if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
|
||||
# define NO_GMP
|
||||
# endif
|
||||
# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
|
||||
# define NO_KRB5
|
||||
# endif
|
||||
# if defined(OPENSSL_NO_MDC2) && !defined(NO_MDC2)
|
||||
# define NO_MDC2
|
||||
# endif
|
||||
# if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
|
||||
# define NO_RC5
|
||||
|
||||
/*
|
||||
* Sometimes OPENSSSL_NO_xxx ends up with an empty file and some compilers
|
||||
* don't like that. This will hopefully silence them.
|
||||
*/
|
||||
#define NON_EMPTY_TRANSLATION_UNIT static void *dummy = &dummy;
|
||||
|
||||
/*
|
||||
* Applications should use -DOPENSSL_API_COMPAT=<version> to suppress the
|
||||
* declarations of functions deprecated in or before <version>. Otherwise, they
|
||||
* still won't see them if the library has been built to disable deprecated
|
||||
* functions.
|
||||
*/
|
||||
#if defined(OPENSSL_NO_DEPRECATED)
|
||||
# define DECLARE_DEPRECATED(f)
|
||||
#elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0)
|
||||
# define DECLARE_DEPRECATED(f) f __attribute__ ((deprecated));
|
||||
#else
|
||||
# define DECLARE_DEPRECATED(f) f;
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_FILE
|
||||
# ifdef OPENSSL_NO_FILENAMES
|
||||
# define OPENSSL_FILE ""
|
||||
# define OPENSSL_LINE 0
|
||||
# else
|
||||
# define OPENSSL_FILE __FILE__
|
||||
# define OPENSSL_LINE __LINE__
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* crypto/opensslconf.h.in */
|
||||
#ifndef OPENSSL_MIN_API
|
||||
# define OPENSSL_MIN_API 0
|
||||
#endif
|
||||
|
||||
#if !defined(OPENSSL_API_COMPAT) || OPENSSL_API_COMPAT < OPENSSL_MIN_API
|
||||
# undef OPENSSL_API_COMPAT
|
||||
# define OPENSSL_API_COMPAT OPENSSL_MIN_API
|
||||
#endif
|
||||
|
||||
#if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# define DEPRECATEDIN_1_1_0(f) DECLARE_DEPRECATED(f)
|
||||
#else
|
||||
# define DEPRECATEDIN_1_1_0(f)
|
||||
#endif
|
||||
|
||||
#if OPENSSL_API_COMPAT < 0x10000000L
|
||||
# define DEPRECATEDIN_1_0_0(f) DECLARE_DEPRECATED(f)
|
||||
#else
|
||||
# define DEPRECATEDIN_1_0_0(f)
|
||||
#endif
|
||||
|
||||
#if OPENSSL_API_COMPAT < 0x00908000L
|
||||
# define DEPRECATEDIN_0_9_8(f) DECLARE_DEPRECATED(f)
|
||||
#else
|
||||
# define DEPRECATEDIN_0_9_8(f)
|
||||
#endif
|
||||
|
||||
#define OPENSSL_CPUID_OBJ
|
||||
|
||||
/* Generate 80386 code? */
|
||||
#undef I386_ONLY
|
||||
|
||||
#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
|
||||
#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
|
||||
#define ENGINESDIR "/usr/local/ssl/lib/engines"
|
||||
#define OPENSSLDIR "/usr/local/ssl"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#undef OPENSSL_UNISTD
|
||||
#define OPENSSL_UNISTD <unistd.h>
|
||||
|
||||
#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
|
||||
#define OPENSSL_EXPORT_VAR_AS_FUNCTION
|
||||
|
||||
#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
|
||||
#define IDEA_INT unsigned int
|
||||
#endif
|
||||
|
||||
#if defined(HEADER_MD2_H) && !defined(MD2_INT)
|
||||
#define MD2_INT unsigned int
|
||||
#endif
|
||||
|
||||
#if defined(HEADER_RC2_H) && !defined(RC2_INT)
|
||||
/* I need to put in a mod for the alpha - eay */
|
||||
#define RC2_INT unsigned int
|
||||
#endif
|
||||
|
||||
#if defined(HEADER_RC4_H)
|
||||
#if !defined(RC4_INT)
|
||||
/* using int types make the structure larger but make the code faster
|
||||
* on most boxes I have tested - up to %20 faster. */
|
||||
/*
|
||||
* I don't know what does "most" mean, but declaring "int" is a must on:
|
||||
* - Intel P6 because partial register stalls are very expensive;
|
||||
* - elder Alpha because it lacks byte load/store instructions;
|
||||
* The following are cipher-specific, but are part of the public API.
|
||||
*/
|
||||
#define RC4_INT unsigned int
|
||||
#endif
|
||||
#if !defined(RC4_CHUNK)
|
||||
/*
|
||||
* This enables code handling data aligned at natural CPU word
|
||||
* boundary. See crypto/rc4/rc4_enc.c for further details.
|
||||
*/
|
||||
#undef RC4_CHUNK
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) && !defined(DES_LONG)
|
||||
/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
|
||||
* %20 speed up (longs are 8 bytes, int's are 4). */
|
||||
#ifndef DES_LONG
|
||||
#define DES_LONG unsigned long
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
|
||||
#define CONFIG_HEADER_BN_H
|
||||
#define BN_LLONG
|
||||
|
||||
/* Should we define BN_DIV2W here? */
|
||||
|
||||
#if !defined(OPENSSL_SYS_UEFI)
|
||||
# define BN_LLONG
|
||||
/* Only one for the following should be defined */
|
||||
/* The prime number generation stuff may not work when
|
||||
* EIGHT_BIT but I don't care since I've only used this mode
|
||||
* for debuging the bignum libraries */
|
||||
#undef SIXTY_FOUR_BIT_LONG
|
||||
#undef SIXTY_FOUR_BIT
|
||||
#define THIRTY_TWO_BIT
|
||||
#undef SIXTEEN_BIT
|
||||
#undef EIGHT_BIT
|
||||
# undef SIXTY_FOUR_BIT_LONG
|
||||
# undef SIXTY_FOUR_BIT
|
||||
# define THIRTY_TWO_BIT
|
||||
#endif
|
||||
|
||||
#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
|
||||
#define CONFIG_HEADER_RC4_LOCL_H
|
||||
/* if this is defined data[i] is used instead of *data, this is a %20
|
||||
* speedup on x86 */
|
||||
#define RC4_INDEX
|
||||
#define RC4_INT unsigned int
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
|
||||
#define CONFIG_HEADER_BF_LOCL_H
|
||||
#undef BF_PTR
|
||||
#endif /* HEADER_BF_LOCL_H */
|
||||
|
||||
#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
|
||||
#define CONFIG_HEADER_DES_LOCL_H
|
||||
#ifndef DES_DEFAULT_OPTIONS
|
||||
/* the following is tweaked from a config script, that is why it is a
|
||||
* protected undef/define */
|
||||
#ifndef DES_PTR
|
||||
#undef DES_PTR
|
||||
#endif
|
||||
|
||||
/* This helps C compiler generate the correct code for multiple functional
|
||||
* units. It reduces register dependancies at the expense of 2 more
|
||||
* registers */
|
||||
#ifndef DES_RISC1
|
||||
#undef DES_RISC1
|
||||
#endif
|
||||
|
||||
#ifndef DES_RISC2
|
||||
#undef DES_RISC2
|
||||
#endif
|
||||
|
||||
#if defined(DES_RISC1) && defined(DES_RISC2)
|
||||
YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
|
||||
#endif
|
||||
|
||||
/* Unroll the inner loop, this sometimes helps, sometimes hinders.
|
||||
* Very mucy CPU dependant */
|
||||
#ifndef DES_UNROLL
|
||||
#undef DES_UNROLL
|
||||
#endif
|
||||
|
||||
/* These default values were supplied by
|
||||
* Peter Gutman <pgut001@cs.auckland.ac.nz>
|
||||
* They are only used if nothing else has been defined */
|
||||
#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL)
|
||||
/* Special defines which change the way the code is built depending on the
|
||||
CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find
|
||||
even newer MIPS CPU's, but at the moment one size fits all for
|
||||
optimization options. Older Sparc's work better with only UNROLL, but
|
||||
there's no way to tell at compile time what it is you're running on */
|
||||
|
||||
#if defined( sun ) /* Newer Sparc's */
|
||||
# define DES_PTR
|
||||
# define DES_RISC1
|
||||
# define DES_UNROLL
|
||||
#elif defined( __ultrix ) /* Older MIPS */
|
||||
# define DES_PTR
|
||||
# define DES_RISC2
|
||||
# define DES_UNROLL
|
||||
#elif defined( __osf1__ ) /* Alpha */
|
||||
# define DES_PTR
|
||||
# define DES_RISC2
|
||||
#elif defined ( _AIX ) /* RS6000 */
|
||||
/* Unknown */
|
||||
#elif defined( __hpux ) /* HP-PA */
|
||||
/* Unknown */
|
||||
#elif defined( __aux ) /* 68K */
|
||||
/* Unknown */
|
||||
#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */
|
||||
# define DES_UNROLL
|
||||
#elif defined( __sgi ) /* Newer MIPS */
|
||||
# define DES_PTR
|
||||
# define DES_RISC2
|
||||
# define DES_UNROLL
|
||||
#elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */
|
||||
# define DES_PTR
|
||||
# define DES_RISC1
|
||||
# define DES_UNROLL
|
||||
#endif /* Systems-specific speed defines */
|
||||
#endif
|
||||
|
||||
#endif /* DES_DEFAULT_OPTIONS */
|
||||
#endif /* HEADER_DES_LOCL_H */
|
||||
|
||||
@ -1,19 +1,33 @@
|
||||
#ifndef HEADER_OPENSSLV_H
|
||||
#define HEADER_OPENSSLV_H
|
||||
/*
|
||||
* Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/* Numeric release version identifier:
|
||||
#ifndef HEADER_OPENSSLV_H
|
||||
# define HEADER_OPENSSLV_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*-
|
||||
* Numeric release version identifier:
|
||||
* MNNFFPPS: major minor fix patch status
|
||||
* The status nibble has one of the values 0 for development, 1 to e for betas
|
||||
* 1 to 14, and f for release. The patch level is exactly that.
|
||||
* For example:
|
||||
* 0.9.3-dev 0x00903000
|
||||
* 0.9.3-beta1 0x00903001
|
||||
* 0.9.3-dev 0x00903000
|
||||
* 0.9.3-beta1 0x00903001
|
||||
* 0.9.3-beta2-dev 0x00903002
|
||||
* 0.9.3-beta2 0x00903002 (same as ...beta2-dev)
|
||||
* 0.9.3 0x0090300f
|
||||
* 0.9.3a 0x0090301f
|
||||
* 0.9.4 0x0090400f
|
||||
* 1.2.3z 0x102031af
|
||||
* 0.9.3 0x0090300f
|
||||
* 0.9.3a 0x0090301f
|
||||
* 0.9.4 0x0090400f
|
||||
* 1.2.3z 0x102031af
|
||||
*
|
||||
* For continuity reasons (because 0.9.5 is already out, and is coded
|
||||
* 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level
|
||||
@ -25,16 +39,15 @@
|
||||
* (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for
|
||||
* major minor fix final patch/beta)
|
||||
*/
|
||||
#define OPENSSL_VERSION_NUMBER 0x0090802fL
|
||||
#ifdef OPENSSL_FIPS
|
||||
#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.8b-fips 04 May 2006"
|
||||
#else
|
||||
#define OPENSSL_VERSION_TEXT "OpenSSL 0.9.8b 04 May 2006"
|
||||
#endif
|
||||
#define OPENSSL_VERSION_PTEXT " part of " OPENSSL_VERSION_TEXT
|
||||
# define OPENSSL_VERSION_NUMBER 0x1010006fL
|
||||
# ifdef OPENSSL_FIPS
|
||||
# define OPENSSL_VERSION_TEXT "OpenSSL 1.1.0f-fips 25 May 2017"
|
||||
# else
|
||||
# define OPENSSL_VERSION_TEXT "OpenSSL 1.1.0f 25 May 2017"
|
||||
# endif
|
||||
|
||||
|
||||
/* The macros below are to be used for shared library (.so, .dll, ...)
|
||||
/*-
|
||||
* The macros below are to be used for shared library (.so, .dll, ...)
|
||||
* versioning. That kind of versioning works a bit differently between
|
||||
* operating systems. The most usual scheme is to set a major and a minor
|
||||
* number, and have the runtime loader check that the major number is equal
|
||||
@ -42,11 +55,11 @@
|
||||
* be greater or equal to what it was at application link time. With this
|
||||
* scheme, the version number is usually part of the file name, like this:
|
||||
*
|
||||
* libcrypto.so.0.9
|
||||
* libcrypto.so.0.9
|
||||
*
|
||||
* Some unixen also make a softlink with the major verson number only:
|
||||
* Some unixen also make a softlink with the major version number only:
|
||||
*
|
||||
* libcrypto.so.0
|
||||
* libcrypto.so.0
|
||||
*
|
||||
* On Tru64 and IRIX 6.x it works a little bit differently. There, the
|
||||
* shared library version is stored in the file, and is actually a series
|
||||
@ -61,11 +74,11 @@
|
||||
* to highest, should be part of the string. Consecutive builds would
|
||||
* give the following versions strings:
|
||||
*
|
||||
* 3.0
|
||||
* 3.0:3.1
|
||||
* 3.0:3.1:3.2
|
||||
* 4.0
|
||||
* 4.0:4.1
|
||||
* 3.0
|
||||
* 3.0:3.1
|
||||
* 3.0:3.1:3.2
|
||||
* 4.0
|
||||
* 4.0:4.1
|
||||
*
|
||||
* Notice how version 4 is completely incompatible with version, and
|
||||
* therefore give the breach you can see.
|
||||
@ -82,8 +95,11 @@
|
||||
* macro SHLIB_VERSION_HISTORY. The numbers are separated by colons and
|
||||
* should only keep the versions that are binary compatible with the current.
|
||||
*/
|
||||
#define SHLIB_VERSION_HISTORY ""
|
||||
#define SHLIB_VERSION_NUMBER "0.9.8"
|
||||
# define SHLIB_VERSION_HISTORY ""
|
||||
# define SHLIB_VERSION_NUMBER "1.1"
|
||||
|
||||
|
||||
#endif /* HEADER_OPENSSLV_H */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* HEADER_OPENSSLV_H */
|
||||
|
||||
@ -1,81 +1,42 @@
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* openssl-core@openssl.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||
* Hudson (tjh@cryptsoft.com).
|
||||
/*
|
||||
* Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_OPENSSL_TYPES_H
|
||||
#define HEADER_OPENSSL_TYPES_H
|
||||
# define HEADER_OPENSSL_TYPES_H
|
||||
|
||||
#include <openssl/e_os2.h>
|
||||
#include <limits.h>
|
||||
|
||||
#ifdef NO_ASN1_TYPEDEFS
|
||||
#define ASN1_INTEGER ASN1_STRING
|
||||
#define ASN1_ENUMERATED ASN1_STRING
|
||||
#define ASN1_BIT_STRING ASN1_STRING
|
||||
#define ASN1_OCTET_STRING ASN1_STRING
|
||||
#define ASN1_PRINTABLESTRING ASN1_STRING
|
||||
#define ASN1_T61STRING ASN1_STRING
|
||||
#define ASN1_IA5STRING ASN1_STRING
|
||||
#define ASN1_UTCTIME ASN1_STRING
|
||||
#define ASN1_GENERALIZEDTIME ASN1_STRING
|
||||
#define ASN1_TIME ASN1_STRING
|
||||
#define ASN1_GENERALSTRING ASN1_STRING
|
||||
#define ASN1_UNIVERSALSTRING ASN1_STRING
|
||||
#define ASN1_BMPSTRING ASN1_STRING
|
||||
#define ASN1_VISIBLESTRING ASN1_STRING
|
||||
#define ASN1_UTF8STRING ASN1_STRING
|
||||
#define ASN1_BOOLEAN int
|
||||
#define ASN1_NULL int
|
||||
#else
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
# include <openssl/e_os2.h>
|
||||
|
||||
# ifdef NO_ASN1_TYPEDEFS
|
||||
# define ASN1_INTEGER ASN1_STRING
|
||||
# define ASN1_ENUMERATED ASN1_STRING
|
||||
# define ASN1_BIT_STRING ASN1_STRING
|
||||
# define ASN1_OCTET_STRING ASN1_STRING
|
||||
# define ASN1_PRINTABLESTRING ASN1_STRING
|
||||
# define ASN1_T61STRING ASN1_STRING
|
||||
# define ASN1_IA5STRING ASN1_STRING
|
||||
# define ASN1_UTCTIME ASN1_STRING
|
||||
# define ASN1_GENERALIZEDTIME ASN1_STRING
|
||||
# define ASN1_TIME ASN1_STRING
|
||||
# define ASN1_GENERALSTRING ASN1_STRING
|
||||
# define ASN1_UNIVERSALSTRING ASN1_STRING
|
||||
# define ASN1_BMPSTRING ASN1_STRING
|
||||
# define ASN1_VISIBLESTRING ASN1_STRING
|
||||
# define ASN1_UTF8STRING ASN1_STRING
|
||||
# define ASN1_BOOLEAN int
|
||||
# define ASN1_NULL int
|
||||
# else
|
||||
typedef struct asn1_string_st ASN1_INTEGER;
|
||||
typedef struct asn1_string_st ASN1_ENUMERATED;
|
||||
typedef struct asn1_string_st ASN1_BIT_STRING;
|
||||
@ -91,19 +52,31 @@ typedef struct asn1_string_st ASN1_TIME;
|
||||
typedef struct asn1_string_st ASN1_GENERALIZEDTIME;
|
||||
typedef struct asn1_string_st ASN1_VISIBLESTRING;
|
||||
typedef struct asn1_string_st ASN1_UTF8STRING;
|
||||
typedef struct asn1_string_st ASN1_STRING;
|
||||
typedef int ASN1_BOOLEAN;
|
||||
typedef int ASN1_NULL;
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#ifdef OPENSSL_SYS_WIN32
|
||||
#undef X509_NAME
|
||||
#undef X509_CERT_PAIR
|
||||
#undef PKCS7_ISSUER_AND_SERIAL
|
||||
#endif
|
||||
typedef struct asn1_object_st ASN1_OBJECT;
|
||||
|
||||
#ifdef BIGNUM
|
||||
#undef BIGNUM
|
||||
#endif
|
||||
typedef struct ASN1_ITEM_st ASN1_ITEM;
|
||||
typedef struct asn1_pctx_st ASN1_PCTX;
|
||||
typedef struct asn1_sctx_st ASN1_SCTX;
|
||||
|
||||
# ifdef _WIN32
|
||||
# undef X509_NAME
|
||||
# undef X509_EXTENSIONS
|
||||
# undef PKCS7_ISSUER_AND_SERIAL
|
||||
# undef PKCS7_SIGNER_INFO
|
||||
# undef OCSP_REQUEST
|
||||
# undef OCSP_RESPONSE
|
||||
# endif
|
||||
|
||||
# ifdef BIGNUM
|
||||
# undef BIGNUM
|
||||
# endif
|
||||
struct dane_st;
|
||||
typedef struct bio_st BIO;
|
||||
typedef struct bignum_st BIGNUM;
|
||||
typedef struct bignum_ctx BN_CTX;
|
||||
typedef struct bn_blinding_st BN_BLINDING;
|
||||
@ -115,10 +88,19 @@ typedef struct buf_mem_st BUF_MEM;
|
||||
|
||||
typedef struct evp_cipher_st EVP_CIPHER;
|
||||
typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX;
|
||||
typedef struct env_md_st EVP_MD;
|
||||
typedef struct env_md_ctx_st EVP_MD_CTX;
|
||||
typedef struct evp_md_st EVP_MD;
|
||||
typedef struct evp_md_ctx_st EVP_MD_CTX;
|
||||
typedef struct evp_pkey_st EVP_PKEY;
|
||||
|
||||
typedef struct evp_pkey_asn1_method_st EVP_PKEY_ASN1_METHOD;
|
||||
|
||||
typedef struct evp_pkey_method_st EVP_PKEY_METHOD;
|
||||
typedef struct evp_pkey_ctx_st EVP_PKEY_CTX;
|
||||
|
||||
typedef struct evp_Encode_Ctx_st EVP_ENCODE_CTX;
|
||||
|
||||
typedef struct hmac_ctx_st HMAC_CTX;
|
||||
|
||||
typedef struct dh_st DH;
|
||||
typedef struct dh_method DH_METHOD;
|
||||
|
||||
@ -128,47 +110,81 @@ typedef struct dsa_method DSA_METHOD;
|
||||
typedef struct rsa_st RSA;
|
||||
typedef struct rsa_meth_st RSA_METHOD;
|
||||
|
||||
typedef struct ec_key_st EC_KEY;
|
||||
typedef struct ec_key_method_st EC_KEY_METHOD;
|
||||
|
||||
typedef struct rand_meth_st RAND_METHOD;
|
||||
|
||||
typedef struct ecdh_method ECDH_METHOD;
|
||||
typedef struct ecdsa_method ECDSA_METHOD;
|
||||
|
||||
typedef struct ssl_dane_st SSL_DANE;
|
||||
typedef struct x509_st X509;
|
||||
typedef struct X509_algor_st X509_ALGOR;
|
||||
typedef struct X509_crl_st X509_CRL;
|
||||
typedef struct x509_crl_method_st X509_CRL_METHOD;
|
||||
typedef struct x509_revoked_st X509_REVOKED;
|
||||
typedef struct X509_name_st X509_NAME;
|
||||
typedef struct X509_pubkey_st X509_PUBKEY;
|
||||
typedef struct x509_store_st X509_STORE;
|
||||
typedef struct x509_store_ctx_st X509_STORE_CTX;
|
||||
|
||||
typedef struct x509_object_st X509_OBJECT;
|
||||
typedef struct x509_lookup_st X509_LOOKUP;
|
||||
typedef struct x509_lookup_method_st X509_LOOKUP_METHOD;
|
||||
typedef struct X509_VERIFY_PARAM_st X509_VERIFY_PARAM;
|
||||
|
||||
typedef struct pkcs8_priv_key_info_st PKCS8_PRIV_KEY_INFO;
|
||||
|
||||
typedef struct v3_ext_ctx X509V3_CTX;
|
||||
typedef struct conf_st CONF;
|
||||
|
||||
typedef struct store_st STORE;
|
||||
typedef struct store_method_st STORE_METHOD;
|
||||
typedef struct ossl_init_settings_st OPENSSL_INIT_SETTINGS;
|
||||
|
||||
typedef struct ui_st UI;
|
||||
typedef struct ui_method_st UI_METHOD;
|
||||
|
||||
typedef struct st_ERR_FNS ERR_FNS;
|
||||
|
||||
typedef struct engine_st ENGINE;
|
||||
typedef struct ssl_st SSL;
|
||||
typedef struct ssl_ctx_st SSL_CTX;
|
||||
|
||||
typedef struct comp_ctx_st COMP_CTX;
|
||||
typedef struct comp_method_st COMP_METHOD;
|
||||
|
||||
typedef struct X509_POLICY_NODE_st X509_POLICY_NODE;
|
||||
typedef struct X509_POLICY_LEVEL_st X509_POLICY_LEVEL;
|
||||
typedef struct X509_POLICY_TREE_st X509_POLICY_TREE;
|
||||
typedef struct X509_POLICY_CACHE_st X509_POLICY_CACHE;
|
||||
|
||||
/* If placed in pkcs12.h, we end up with a circular depency with pkcs7.h */
|
||||
#define DECLARE_PKCS12_STACK_OF(type) /* Nothing */
|
||||
#define IMPLEMENT_PKCS12_STACK_OF(type) /* Nothing */
|
||||
typedef struct AUTHORITY_KEYID_st AUTHORITY_KEYID;
|
||||
typedef struct DIST_POINT_st DIST_POINT;
|
||||
typedef struct ISSUING_DIST_POINT_st ISSUING_DIST_POINT;
|
||||
typedef struct NAME_CONSTRAINTS_st NAME_CONSTRAINTS;
|
||||
|
||||
typedef struct crypto_ex_data_st CRYPTO_EX_DATA;
|
||||
/* Callback types for crypto.h */
|
||||
typedef int CRYPTO_EX_new(void *parent, void *ptr, CRYPTO_EX_DATA *ad,
|
||||
int idx, long argl, void *argp);
|
||||
typedef void CRYPTO_EX_free(void *parent, void *ptr, CRYPTO_EX_DATA *ad,
|
||||
int idx, long argl, void *argp);
|
||||
typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d,
|
||||
int idx, long argl, void *argp);
|
||||
|
||||
#endif /* def HEADER_OPENSSL_TYPES_H */
|
||||
typedef struct ocsp_req_ctx_st OCSP_REQ_CTX;
|
||||
typedef struct ocsp_response_st OCSP_RESPONSE;
|
||||
typedef struct ocsp_responder_id_st OCSP_RESPID;
|
||||
|
||||
typedef struct sct_st SCT;
|
||||
typedef struct sct_ctx_st SCT_CTX;
|
||||
typedef struct ctlog_st CTLOG;
|
||||
typedef struct ctlog_store_st CTLOG_STORE;
|
||||
typedef struct ct_policy_eval_ctx_st CT_POLICY_EVAL_CTX;
|
||||
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L && \
|
||||
defined(INTMAX_MAX) && defined(UINTMAX_MAX)
|
||||
typedef intmax_t ossl_intmax_t;
|
||||
typedef uintmax_t ossl_uintmax_t;
|
||||
#else
|
||||
/*
|
||||
* Not long long, because the C-library can only be expected to provide
|
||||
* strtoll(), strtoull() at the same time as intmax_t and strtoimax(),
|
||||
* strtoumax(). Since we use these for parsing arguments, we need the
|
||||
* conversion functions, not just the sizes.
|
||||
*/
|
||||
typedef long ossl_intmax_t;
|
||||
typedef unsigned long ossl_uintmax_t;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* def HEADER_OPENSSL_TYPES_H */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,60 +1,10 @@
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* licensing@OpenSSL.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||
* Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* This header only exists to break a circular dependency between pem and err
|
||||
* Ben 30 Jan 1999.
|
||||
* Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
@ -62,7 +12,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef HEADER_PEM_H
|
||||
void ERR_load_PEM_strings(void);
|
||||
int ERR_load_PEM_strings(void);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@ -1,239 +1,187 @@
|
||||
/* pkcs12.h */
|
||||
/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL
|
||||
* project 1999.
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* licensing@OpenSSL.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||
* Hudson (tjh@cryptsoft.com).
|
||||
/*
|
||||
* Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_PKCS12_H
|
||||
#define HEADER_PKCS12_H
|
||||
# define HEADER_PKCS12_H
|
||||
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/x509.h>
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/x509.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define PKCS12_KEY_ID 1
|
||||
#define PKCS12_IV_ID 2
|
||||
#define PKCS12_MAC_ID 3
|
||||
# define PKCS12_KEY_ID 1
|
||||
# define PKCS12_IV_ID 2
|
||||
# define PKCS12_MAC_ID 3
|
||||
|
||||
/* Default iteration count */
|
||||
#ifndef PKCS12_DEFAULT_ITER
|
||||
#define PKCS12_DEFAULT_ITER PKCS5_DEFAULT_ITER
|
||||
#endif
|
||||
# ifndef PKCS12_DEFAULT_ITER
|
||||
# define PKCS12_DEFAULT_ITER PKCS5_DEFAULT_ITER
|
||||
# endif
|
||||
|
||||
#define PKCS12_MAC_KEY_LENGTH 20
|
||||
# define PKCS12_MAC_KEY_LENGTH 20
|
||||
|
||||
#define PKCS12_SALT_LEN 8
|
||||
# define PKCS12_SALT_LEN 8
|
||||
|
||||
/* Uncomment out next line for unicode password and names, otherwise ASCII */
|
||||
|
||||
/*#define PBE_UNICODE*/
|
||||
|
||||
#ifdef PBE_UNICODE
|
||||
#define PKCS12_key_gen PKCS12_key_gen_uni
|
||||
#define PKCS12_add_friendlyname PKCS12_add_friendlyname_uni
|
||||
#else
|
||||
#define PKCS12_key_gen PKCS12_key_gen_asc
|
||||
#define PKCS12_add_friendlyname PKCS12_add_friendlyname_asc
|
||||
#endif
|
||||
/* It's not clear if these are actually needed... */
|
||||
# define PKCS12_key_gen PKCS12_key_gen_utf8
|
||||
# define PKCS12_add_friendlyname PKCS12_add_friendlyname_utf8
|
||||
|
||||
/* MS key usage constants */
|
||||
|
||||
#define KEY_EX 0x10
|
||||
#define KEY_SIG 0x80
|
||||
# define KEY_EX 0x10
|
||||
# define KEY_SIG 0x80
|
||||
|
||||
typedef struct {
|
||||
X509_SIG *dinfo;
|
||||
ASN1_OCTET_STRING *salt;
|
||||
ASN1_INTEGER *iter; /* defaults to 1 */
|
||||
} PKCS12_MAC_DATA;
|
||||
typedef struct PKCS12_MAC_DATA_st PKCS12_MAC_DATA;
|
||||
|
||||
typedef struct {
|
||||
ASN1_INTEGER *version;
|
||||
PKCS12_MAC_DATA *mac;
|
||||
PKCS7 *authsafes;
|
||||
} PKCS12;
|
||||
typedef struct PKCS12_st PKCS12;
|
||||
|
||||
PREDECLARE_STACK_OF(PKCS12_SAFEBAG)
|
||||
typedef struct PKCS12_SAFEBAG_st PKCS12_SAFEBAG;
|
||||
|
||||
typedef struct {
|
||||
ASN1_OBJECT *type;
|
||||
union {
|
||||
struct pkcs12_bag_st *bag; /* secret, crl and certbag */
|
||||
struct pkcs8_priv_key_info_st *keybag; /* keybag */
|
||||
X509_SIG *shkeybag; /* shrouded key bag */
|
||||
STACK_OF(PKCS12_SAFEBAG) *safes;
|
||||
ASN1_TYPE *other;
|
||||
}value;
|
||||
STACK_OF(X509_ATTRIBUTE) *attrib;
|
||||
} PKCS12_SAFEBAG;
|
||||
DEFINE_STACK_OF(PKCS12_SAFEBAG)
|
||||
|
||||
DECLARE_STACK_OF(PKCS12_SAFEBAG)
|
||||
DECLARE_ASN1_SET_OF(PKCS12_SAFEBAG)
|
||||
DECLARE_PKCS12_STACK_OF(PKCS12_SAFEBAG)
|
||||
typedef struct pkcs12_bag_st PKCS12_BAGS;
|
||||
|
||||
typedef struct pkcs12_bag_st {
|
||||
ASN1_OBJECT *type;
|
||||
union {
|
||||
ASN1_OCTET_STRING *x509cert;
|
||||
ASN1_OCTET_STRING *x509crl;
|
||||
ASN1_OCTET_STRING *octet;
|
||||
ASN1_IA5STRING *sdsicert;
|
||||
ASN1_TYPE *other; /* Secret or other bag */
|
||||
}value;
|
||||
} PKCS12_BAGS;
|
||||
|
||||
#define PKCS12_ERROR 0
|
||||
#define PKCS12_OK 1
|
||||
# define PKCS12_ERROR 0
|
||||
# define PKCS12_OK 1
|
||||
|
||||
/* Compatibility macros */
|
||||
|
||||
#define M_PKCS12_x5092certbag PKCS12_x5092certbag
|
||||
#define M_PKCS12_x509crl2certbag PKCS12_x509crl2certbag
|
||||
#if OPENSSL_API_COMPAT < 0x10100000L
|
||||
|
||||
#define M_PKCS12_certbag2x509 PKCS12_certbag2x509
|
||||
#define M_PKCS12_certbag2x509crl PKCS12_certbag2x509crl
|
||||
# define M_PKCS12_bag_type PKCS12_bag_type
|
||||
# define M_PKCS12_cert_bag_type PKCS12_cert_bag_type
|
||||
# define M_PKCS12_crl_bag_type PKCS12_cert_bag_type
|
||||
|
||||
#define M_PKCS12_unpack_p7data PKCS12_unpack_p7data
|
||||
#define M_PKCS12_pack_authsafes PKCS12_pack_authsafes
|
||||
#define M_PKCS12_unpack_authsafes PKCS12_unpack_authsafes
|
||||
#define M_PKCS12_unpack_p7encdata PKCS12_unpack_p7encdata
|
||||
# define PKCS12_certbag2x509 PKCS12_SAFEBAG_get1_cert
|
||||
# define PKCS12_certbag2scrl PKCS12_SAFEBAG_get1_crl
|
||||
# define PKCS12_bag_type PKCS12_SAFEBAG_get_nid
|
||||
# define PKCS12_cert_bag_type PKCS12_SAFEBAG_get_bag_nid
|
||||
# define PKCS12_x5092certbag PKCS12_SAFEBAG_create_cert
|
||||
# define PKCS12_x509crl2certbag PKCS12_SAFEBAG_create_crl
|
||||
# define PKCS12_MAKE_KEYBAG PKCS12_SAFEBAG_create0_p8inf
|
||||
# define PKCS12_MAKE_SHKEYBAG PKCS12_SAFEBAG_create_pkcs8_encrypt
|
||||
|
||||
#define M_PKCS12_decrypt_skey PKCS12_decrypt_skey
|
||||
#define M_PKCS8_decrypt PKCS8_decrypt
|
||||
#endif
|
||||
|
||||
#define M_PKCS12_bag_type(bg) OBJ_obj2nid((bg)->type)
|
||||
#define M_PKCS12_cert_bag_type(bg) OBJ_obj2nid((bg)->value.bag->type)
|
||||
#define M_PKCS12_crl_bag_type M_PKCS12_cert_bag_type
|
||||
DEPRECATEDIN_1_1_0(ASN1_TYPE *PKCS12_get_attr(const PKCS12_SAFEBAG *bag, int attr_nid))
|
||||
|
||||
#define PKCS12_get_attr(bag, attr_nid) \
|
||||
PKCS12_get_attr_gen(bag->attrib, attr_nid)
|
||||
ASN1_TYPE *PKCS8_get_attr(PKCS8_PRIV_KEY_INFO *p8, int attr_nid);
|
||||
int PKCS12_mac_present(const PKCS12 *p12);
|
||||
void PKCS12_get0_mac(const ASN1_OCTET_STRING **pmac,
|
||||
const X509_ALGOR **pmacalg,
|
||||
const ASN1_OCTET_STRING **psalt,
|
||||
const ASN1_INTEGER **piter,
|
||||
const PKCS12 *p12);
|
||||
|
||||
#define PKCS8_get_attr(p8, attr_nid) \
|
||||
PKCS12_get_attr_gen(p8->attributes, attr_nid)
|
||||
const ASN1_TYPE *PKCS12_SAFEBAG_get0_attr(const PKCS12_SAFEBAG *bag,
|
||||
int attr_nid);
|
||||
const ASN1_OBJECT *PKCS12_SAFEBAG_get0_type(const PKCS12_SAFEBAG *bag);
|
||||
int PKCS12_SAFEBAG_get_nid(const PKCS12_SAFEBAG *bag);
|
||||
int PKCS12_SAFEBAG_get_bag_nid(const PKCS12_SAFEBAG *bag);
|
||||
|
||||
#define PKCS12_mac_present(p12) ((p12)->mac ? 1 : 0)
|
||||
X509 *PKCS12_SAFEBAG_get1_cert(const PKCS12_SAFEBAG *bag);
|
||||
X509_CRL *PKCS12_SAFEBAG_get1_crl(const PKCS12_SAFEBAG *bag);
|
||||
const STACK_OF(PKCS12_SAFEBAG) *
|
||||
PKCS12_SAFEBAG_get0_safes(const PKCS12_SAFEBAG *bag);
|
||||
const PKCS8_PRIV_KEY_INFO *PKCS12_SAFEBAG_get0_p8inf(const PKCS12_SAFEBAG *bag);
|
||||
const X509_SIG *PKCS12_SAFEBAG_get0_pkcs8(const PKCS12_SAFEBAG *bag);
|
||||
|
||||
PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_cert(X509 *x509);
|
||||
PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_crl(X509_CRL *crl);
|
||||
PKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_p8inf(PKCS8_PRIV_KEY_INFO *p8);
|
||||
PKCS12_SAFEBAG *PKCS12_SAFEBAG_create0_pkcs8(X509_SIG *p8);
|
||||
PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_pkcs8_encrypt(int pbe_nid,
|
||||
const char *pass,
|
||||
int passlen,
|
||||
unsigned char *salt,
|
||||
int saltlen, int iter,
|
||||
PKCS8_PRIV_KEY_INFO *p8inf);
|
||||
|
||||
PKCS12_SAFEBAG *PKCS12_x5092certbag(X509 *x509);
|
||||
PKCS12_SAFEBAG *PKCS12_x509crl2certbag(X509_CRL *crl);
|
||||
X509 *PKCS12_certbag2x509(PKCS12_SAFEBAG *bag);
|
||||
X509_CRL *PKCS12_certbag2x509crl(PKCS12_SAFEBAG *bag);
|
||||
|
||||
PKCS12_SAFEBAG *PKCS12_item_pack_safebag(void *obj, const ASN1_ITEM *it, int nid1,
|
||||
int nid2);
|
||||
PKCS12_SAFEBAG *PKCS12_MAKE_KEYBAG(PKCS8_PRIV_KEY_INFO *p8);
|
||||
PKCS8_PRIV_KEY_INFO *PKCS8_decrypt(X509_SIG *p8, const char *pass, int passlen);
|
||||
PKCS8_PRIV_KEY_INFO *PKCS12_decrypt_skey(PKCS12_SAFEBAG *bag, const char *pass,
|
||||
int passlen);
|
||||
PKCS12_SAFEBAG *PKCS12_item_pack_safebag(void *obj, const ASN1_ITEM *it,
|
||||
int nid1, int nid2);
|
||||
PKCS8_PRIV_KEY_INFO *PKCS8_decrypt(const X509_SIG *p8, const char *pass,
|
||||
int passlen);
|
||||
PKCS8_PRIV_KEY_INFO *PKCS12_decrypt_skey(const PKCS12_SAFEBAG *bag,
|
||||
const char *pass, int passlen);
|
||||
X509_SIG *PKCS8_encrypt(int pbe_nid, const EVP_CIPHER *cipher,
|
||||
const char *pass, int passlen,
|
||||
unsigned char *salt, int saltlen, int iter,
|
||||
PKCS8_PRIV_KEY_INFO *p8);
|
||||
PKCS12_SAFEBAG *PKCS12_MAKE_SHKEYBAG(int pbe_nid, const char *pass,
|
||||
int passlen, unsigned char *salt,
|
||||
int saltlen, int iter,
|
||||
PKCS8_PRIV_KEY_INFO *p8);
|
||||
const char *pass, int passlen, unsigned char *salt,
|
||||
int saltlen, int iter, PKCS8_PRIV_KEY_INFO *p8);
|
||||
X509_SIG *PKCS8_set0_pbe(const char *pass, int passlen,
|
||||
PKCS8_PRIV_KEY_INFO *p8inf, X509_ALGOR *pbe);
|
||||
PKCS7 *PKCS12_pack_p7data(STACK_OF(PKCS12_SAFEBAG) *sk);
|
||||
STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7data(PKCS7 *p7);
|
||||
PKCS7 *PKCS12_pack_p7encdata(int pbe_nid, const char *pass, int passlen,
|
||||
unsigned char *salt, int saltlen, int iter,
|
||||
STACK_OF(PKCS12_SAFEBAG) *bags);
|
||||
STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7encdata(PKCS7 *p7, const char *pass, int passlen);
|
||||
unsigned char *salt, int saltlen, int iter,
|
||||
STACK_OF(PKCS12_SAFEBAG) *bags);
|
||||
STACK_OF(PKCS12_SAFEBAG) *PKCS12_unpack_p7encdata(PKCS7 *p7, const char *pass,
|
||||
int passlen);
|
||||
|
||||
int PKCS12_pack_authsafes(PKCS12 *p12, STACK_OF(PKCS7) *safes);
|
||||
STACK_OF(PKCS7) *PKCS12_unpack_authsafes(PKCS12 *p12);
|
||||
STACK_OF(PKCS7) *PKCS12_unpack_authsafes(const PKCS12 *p12);
|
||||
|
||||
int PKCS12_add_localkeyid(PKCS12_SAFEBAG *bag, unsigned char *name, int namelen);
|
||||
int PKCS12_add_localkeyid(PKCS12_SAFEBAG *bag, unsigned char *name,
|
||||
int namelen);
|
||||
int PKCS12_add_friendlyname_asc(PKCS12_SAFEBAG *bag, const char *name,
|
||||
int namelen);
|
||||
int namelen);
|
||||
int PKCS12_add_friendlyname_utf8(PKCS12_SAFEBAG *bag, const char *name,
|
||||
int namelen);
|
||||
int PKCS12_add_CSPName_asc(PKCS12_SAFEBAG *bag, const char *name,
|
||||
int namelen);
|
||||
int PKCS12_add_friendlyname_uni(PKCS12_SAFEBAG *bag, const unsigned char *name,
|
||||
int namelen);
|
||||
int namelen);
|
||||
int PKCS12_add_friendlyname_uni(PKCS12_SAFEBAG *bag,
|
||||
const unsigned char *name, int namelen);
|
||||
int PKCS8_add_keyusage(PKCS8_PRIV_KEY_INFO *p8, int usage);
|
||||
ASN1_TYPE *PKCS12_get_attr_gen(STACK_OF(X509_ATTRIBUTE) *attrs, int attr_nid);
|
||||
ASN1_TYPE *PKCS12_get_attr_gen(const STACK_OF(X509_ATTRIBUTE) *attrs,
|
||||
int attr_nid);
|
||||
char *PKCS12_get_friendlyname(PKCS12_SAFEBAG *bag);
|
||||
unsigned char *PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass,
|
||||
int passlen, unsigned char *in, int inlen,
|
||||
unsigned char **data, int *datalen, int en_de);
|
||||
void * PKCS12_item_decrypt_d2i(X509_ALGOR *algor, const ASN1_ITEM *it,
|
||||
const char *pass, int passlen, ASN1_OCTET_STRING *oct, int zbuf);
|
||||
ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor, const ASN1_ITEM *it,
|
||||
const char *pass, int passlen,
|
||||
void *obj, int zbuf);
|
||||
const STACK_OF(X509_ATTRIBUTE) *
|
||||
PKCS12_SAFEBAG_get0_attrs(const PKCS12_SAFEBAG *bag);
|
||||
unsigned char *PKCS12_pbe_crypt(const X509_ALGOR *algor,
|
||||
const char *pass, int passlen,
|
||||
const unsigned char *in, int inlen,
|
||||
unsigned char **data, int *datalen,
|
||||
int en_de);
|
||||
void *PKCS12_item_decrypt_d2i(const X509_ALGOR *algor, const ASN1_ITEM *it,
|
||||
const char *pass, int passlen,
|
||||
const ASN1_OCTET_STRING *oct, int zbuf);
|
||||
ASN1_OCTET_STRING *PKCS12_item_i2d_encrypt(X509_ALGOR *algor,
|
||||
const ASN1_ITEM *it,
|
||||
const char *pass, int passlen,
|
||||
void *obj, int zbuf);
|
||||
PKCS12 *PKCS12_init(int mode);
|
||||
int PKCS12_key_gen_asc(const char *pass, int passlen, unsigned char *salt,
|
||||
int saltlen, int id, int iter, int n,
|
||||
unsigned char *out, const EVP_MD *md_type);
|
||||
int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt, int saltlen, int id, int iter, int n, unsigned char *out, const EVP_MD *md_type);
|
||||
int saltlen, int id, int iter, int n,
|
||||
unsigned char *out, const EVP_MD *md_type);
|
||||
int PKCS12_key_gen_uni(unsigned char *pass, int passlen, unsigned char *salt,
|
||||
int saltlen, int id, int iter, int n,
|
||||
unsigned char *out, const EVP_MD *md_type);
|
||||
int PKCS12_key_gen_utf8(const char *pass, int passlen, unsigned char *salt,
|
||||
int saltlen, int id, int iter, int n,
|
||||
unsigned char *out, const EVP_MD *md_type);
|
||||
int PKCS12_PBE_keyivgen(EVP_CIPHER_CTX *ctx, const char *pass, int passlen,
|
||||
ASN1_TYPE *param, const EVP_CIPHER *cipher, const EVP_MD *md_type,
|
||||
int en_de);
|
||||
ASN1_TYPE *param, const EVP_CIPHER *cipher,
|
||||
const EVP_MD *md_type, int en_de);
|
||||
int PKCS12_gen_mac(PKCS12 *p12, const char *pass, int passlen,
|
||||
unsigned char *mac, unsigned int *maclen);
|
||||
unsigned char *mac, unsigned int *maclen);
|
||||
int PKCS12_verify_mac(PKCS12 *p12, const char *pass, int passlen);
|
||||
int PKCS12_set_mac(PKCS12 *p12, const char *pass, int passlen,
|
||||
unsigned char *salt, int saltlen, int iter,
|
||||
const EVP_MD *md_type);
|
||||
unsigned char *salt, int saltlen, int iter,
|
||||
const EVP_MD *md_type);
|
||||
int PKCS12_setup_mac(PKCS12 *p12, int iter, unsigned char *salt,
|
||||
int saltlen, const EVP_MD *md_type);
|
||||
unsigned char *asc2uni(const char *asc, int asclen, unsigned char **uni, int *unilen);
|
||||
char *uni2asc(unsigned char *uni, int unilen);
|
||||
int saltlen, const EVP_MD *md_type);
|
||||
unsigned char *OPENSSL_asc2uni(const char *asc, int asclen,
|
||||
unsigned char **uni, int *unilen);
|
||||
char *OPENSSL_uni2asc(const unsigned char *uni, int unilen);
|
||||
unsigned char *OPENSSL_utf82uni(const char *asc, int asclen,
|
||||
unsigned char **uni, int *unilen);
|
||||
char *OPENSSL_uni2utf8(const unsigned char *uni, int unilen);
|
||||
|
||||
DECLARE_ASN1_FUNCTIONS(PKCS12)
|
||||
DECLARE_ASN1_FUNCTIONS(PKCS12_MAC_DATA)
|
||||
@ -245,89 +193,90 @@ DECLARE_ASN1_ITEM(PKCS12_AUTHSAFES)
|
||||
|
||||
void PKCS12_PBE_add(void);
|
||||
int PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert,
|
||||
STACK_OF(X509) **ca);
|
||||
PKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey, X509 *cert,
|
||||
STACK_OF(X509) *ca, int nid_key, int nid_cert, int iter,
|
||||
int mac_iter, int keytype);
|
||||
STACK_OF(X509) **ca);
|
||||
PKCS12 *PKCS12_create(const char *pass, const char *name, EVP_PKEY *pkey,
|
||||
X509 *cert, STACK_OF(X509) *ca, int nid_key, int nid_cert,
|
||||
int iter, int mac_iter, int keytype);
|
||||
|
||||
PKCS12_SAFEBAG *PKCS12_add_cert(STACK_OF(PKCS12_SAFEBAG) **pbags, X509 *cert);
|
||||
PKCS12_SAFEBAG *PKCS12_add_key(STACK_OF(PKCS12_SAFEBAG) **pbags, EVP_PKEY *key,
|
||||
int key_usage, int iter,
|
||||
int key_nid, char *pass);
|
||||
PKCS12_SAFEBAG *PKCS12_add_key(STACK_OF(PKCS12_SAFEBAG) **pbags,
|
||||
EVP_PKEY *key, int key_usage, int iter,
|
||||
int key_nid, const char *pass);
|
||||
int PKCS12_add_safe(STACK_OF(PKCS7) **psafes, STACK_OF(PKCS12_SAFEBAG) *bags,
|
||||
int safe_nid, int iter, char *pass);
|
||||
int safe_nid, int iter, const char *pass);
|
||||
PKCS12 *PKCS12_add_safes(STACK_OF(PKCS7) *safes, int p7_nid);
|
||||
|
||||
int i2d_PKCS12_bio(BIO *bp, PKCS12 *p12);
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
int i2d_PKCS12_fp(FILE *fp, PKCS12 *p12);
|
||||
# endif
|
||||
PKCS12 *d2i_PKCS12_bio(BIO *bp, PKCS12 **p12);
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
PKCS12 *d2i_PKCS12_fp(FILE *fp, PKCS12 **p12);
|
||||
int PKCS12_newpass(PKCS12 *p12, char *oldpass, char *newpass);
|
||||
# endif
|
||||
int PKCS12_newpass(PKCS12 *p12, const char *oldpass, const char *newpass);
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
/*
|
||||
* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
void ERR_load_PKCS12_strings(void);
|
||||
|
||||
int ERR_load_PKCS12_strings(void);
|
||||
|
||||
/* Error codes for the PKCS12 functions. */
|
||||
|
||||
/* Function codes. */
|
||||
#define PKCS12_F_PARSE_BAG 129
|
||||
#define PKCS12_F_PARSE_BAGS 103
|
||||
#define PKCS12_F_PKCS12_ADD_FRIENDLYNAME 100
|
||||
#define PKCS12_F_PKCS12_ADD_FRIENDLYNAME_ASC 127
|
||||
#define PKCS12_F_PKCS12_ADD_FRIENDLYNAME_UNI 102
|
||||
#define PKCS12_F_PKCS12_ADD_LOCALKEYID 104
|
||||
#define PKCS12_F_PKCS12_CREATE 105
|
||||
#define PKCS12_F_PKCS12_GEN_MAC 107
|
||||
#define PKCS12_F_PKCS12_INIT 109
|
||||
#define PKCS12_F_PKCS12_ITEM_DECRYPT_D2I 106
|
||||
#define PKCS12_F_PKCS12_ITEM_I2D_ENCRYPT 108
|
||||
#define PKCS12_F_PKCS12_ITEM_PACK_SAFEBAG 117
|
||||
#define PKCS12_F_PKCS12_KEY_GEN_ASC 110
|
||||
#define PKCS12_F_PKCS12_KEY_GEN_UNI 111
|
||||
#define PKCS12_F_PKCS12_MAKE_KEYBAG 112
|
||||
#define PKCS12_F_PKCS12_MAKE_SHKEYBAG 113
|
||||
#define PKCS12_F_PKCS12_NEWPASS 128
|
||||
#define PKCS12_F_PKCS12_PACK_P7DATA 114
|
||||
#define PKCS12_F_PKCS12_PACK_P7ENCDATA 115
|
||||
#define PKCS12_F_PKCS12_PARSE 118
|
||||
#define PKCS12_F_PKCS12_PBE_CRYPT 119
|
||||
#define PKCS12_F_PKCS12_PBE_KEYIVGEN 120
|
||||
#define PKCS12_F_PKCS12_SETUP_MAC 122
|
||||
#define PKCS12_F_PKCS12_SET_MAC 123
|
||||
#define PKCS12_F_PKCS12_UNPACK_AUTHSAFES 130
|
||||
#define PKCS12_F_PKCS12_UNPACK_P7DATA 131
|
||||
#define PKCS12_F_PKCS12_VERIFY_MAC 126
|
||||
#define PKCS12_F_PKCS8_ADD_KEYUSAGE 124
|
||||
#define PKCS12_F_PKCS8_ENCRYPT 125
|
||||
# define PKCS12_F_PKCS12_CREATE 105
|
||||
# define PKCS12_F_PKCS12_GEN_MAC 107
|
||||
# define PKCS12_F_PKCS12_INIT 109
|
||||
# define PKCS12_F_PKCS12_ITEM_DECRYPT_D2I 106
|
||||
# define PKCS12_F_PKCS12_ITEM_I2D_ENCRYPT 108
|
||||
# define PKCS12_F_PKCS12_ITEM_PACK_SAFEBAG 117
|
||||
# define PKCS12_F_PKCS12_KEY_GEN_ASC 110
|
||||
# define PKCS12_F_PKCS12_KEY_GEN_UNI 111
|
||||
# define PKCS12_F_PKCS12_KEY_GEN_UTF8 116
|
||||
# define PKCS12_F_PKCS12_NEWPASS 128
|
||||
# define PKCS12_F_PKCS12_PACK_P7DATA 114
|
||||
# define PKCS12_F_PKCS12_PACK_P7ENCDATA 115
|
||||
# define PKCS12_F_PKCS12_PARSE 118
|
||||
# define PKCS12_F_PKCS12_PBE_CRYPT 119
|
||||
# define PKCS12_F_PKCS12_PBE_KEYIVGEN 120
|
||||
# define PKCS12_F_PKCS12_SAFEBAG_CREATE0_P8INF 112
|
||||
# define PKCS12_F_PKCS12_SAFEBAG_CREATE0_PKCS8 113
|
||||
# define PKCS12_F_PKCS12_SAFEBAG_CREATE_PKCS8_ENCRYPT 133
|
||||
# define PKCS12_F_PKCS12_SETUP_MAC 122
|
||||
# define PKCS12_F_PKCS12_SET_MAC 123
|
||||
# define PKCS12_F_PKCS12_UNPACK_AUTHSAFES 130
|
||||
# define PKCS12_F_PKCS12_UNPACK_P7DATA 131
|
||||
# define PKCS12_F_PKCS12_VERIFY_MAC 126
|
||||
# define PKCS12_F_PKCS8_ENCRYPT 125
|
||||
# define PKCS12_F_PKCS8_SET0_PBE 132
|
||||
|
||||
/* Reason codes. */
|
||||
#define PKCS12_R_CANT_PACK_STRUCTURE 100
|
||||
#define PKCS12_R_CONTENT_TYPE_NOT_DATA 121
|
||||
#define PKCS12_R_DECODE_ERROR 101
|
||||
#define PKCS12_R_ENCODE_ERROR 102
|
||||
#define PKCS12_R_ENCRYPT_ERROR 103
|
||||
#define PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE 120
|
||||
#define PKCS12_R_INVALID_NULL_ARGUMENT 104
|
||||
#define PKCS12_R_INVALID_NULL_PKCS12_POINTER 105
|
||||
#define PKCS12_R_IV_GEN_ERROR 106
|
||||
#define PKCS12_R_KEY_GEN_ERROR 107
|
||||
#define PKCS12_R_MAC_ABSENT 108
|
||||
#define PKCS12_R_MAC_GENERATION_ERROR 109
|
||||
#define PKCS12_R_MAC_SETUP_ERROR 110
|
||||
#define PKCS12_R_MAC_STRING_SET_ERROR 111
|
||||
#define PKCS12_R_MAC_VERIFY_ERROR 112
|
||||
#define PKCS12_R_MAC_VERIFY_FAILURE 113
|
||||
#define PKCS12_R_PARSE_ERROR 114
|
||||
#define PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR 115
|
||||
#define PKCS12_R_PKCS12_CIPHERFINAL_ERROR 116
|
||||
#define PKCS12_R_PKCS12_PBE_CRYPT_ERROR 117
|
||||
#define PKCS12_R_UNKNOWN_DIGEST_ALGORITHM 118
|
||||
#define PKCS12_R_UNSUPPORTED_PKCS12_MODE 119
|
||||
# define PKCS12_R_CANT_PACK_STRUCTURE 100
|
||||
# define PKCS12_R_CONTENT_TYPE_NOT_DATA 121
|
||||
# define PKCS12_R_DECODE_ERROR 101
|
||||
# define PKCS12_R_ENCODE_ERROR 102
|
||||
# define PKCS12_R_ENCRYPT_ERROR 103
|
||||
# define PKCS12_R_ERROR_SETTING_ENCRYPTED_DATA_TYPE 120
|
||||
# define PKCS12_R_INVALID_NULL_ARGUMENT 104
|
||||
# define PKCS12_R_INVALID_NULL_PKCS12_POINTER 105
|
||||
# define PKCS12_R_IV_GEN_ERROR 106
|
||||
# define PKCS12_R_KEY_GEN_ERROR 107
|
||||
# define PKCS12_R_MAC_ABSENT 108
|
||||
# define PKCS12_R_MAC_GENERATION_ERROR 109
|
||||
# define PKCS12_R_MAC_SETUP_ERROR 110
|
||||
# define PKCS12_R_MAC_STRING_SET_ERROR 111
|
||||
# define PKCS12_R_MAC_VERIFY_FAILURE 113
|
||||
# define PKCS12_R_PARSE_ERROR 114
|
||||
# define PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR 115
|
||||
# define PKCS12_R_PKCS12_CIPHERFINAL_ERROR 116
|
||||
# define PKCS12_R_PKCS12_PBE_CRYPT_ERROR 117
|
||||
# define PKCS12_R_UNKNOWN_DIGEST_ALGORITHM 118
|
||||
# define PKCS12_R_UNSUPPORTED_PKCS12_MODE 119
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@ -1,297 +1,219 @@
|
||||
/* crypto/pkcs7/pkcs7.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_PKCS7_H
|
||||
#define HEADER_PKCS7_H
|
||||
# define HEADER_PKCS7_H
|
||||
|
||||
#include <openssl/asn1.h>
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/e_os2.h>
|
||||
# include <openssl/asn1.h>
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/e_os2.h>
|
||||
|
||||
#include <openssl/symhacks.h>
|
||||
#include <openssl/ossl_typ.h>
|
||||
# include <openssl/symhacks.h>
|
||||
# include <openssl/ossl_typ.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef OPENSSL_SYS_WIN32
|
||||
/* Under Win32 thes are defined in wincrypt.h */
|
||||
#undef PKCS7_ISSUER_AND_SERIAL
|
||||
#undef PKCS7_SIGNER_INFO
|
||||
#endif
|
||||
|
||||
/*
|
||||
Encryption_ID DES-CBC
|
||||
Digest_ID MD5
|
||||
Digest_Encryption_ID rsaEncryption
|
||||
Key_Encryption_ID rsaEncryption
|
||||
/*-
|
||||
Encryption_ID DES-CBC
|
||||
Digest_ID MD5
|
||||
Digest_Encryption_ID rsaEncryption
|
||||
Key_Encryption_ID rsaEncryption
|
||||
*/
|
||||
|
||||
typedef struct pkcs7_issuer_and_serial_st
|
||||
{
|
||||
X509_NAME *issuer;
|
||||
ASN1_INTEGER *serial;
|
||||
} PKCS7_ISSUER_AND_SERIAL;
|
||||
typedef struct pkcs7_issuer_and_serial_st {
|
||||
X509_NAME *issuer;
|
||||
ASN1_INTEGER *serial;
|
||||
} PKCS7_ISSUER_AND_SERIAL;
|
||||
|
||||
typedef struct pkcs7_signer_info_st
|
||||
{
|
||||
ASN1_INTEGER *version; /* version 1 */
|
||||
PKCS7_ISSUER_AND_SERIAL *issuer_and_serial;
|
||||
X509_ALGOR *digest_alg;
|
||||
STACK_OF(X509_ATTRIBUTE) *auth_attr; /* [ 0 ] */
|
||||
X509_ALGOR *digest_enc_alg;
|
||||
ASN1_OCTET_STRING *enc_digest;
|
||||
STACK_OF(X509_ATTRIBUTE) *unauth_attr; /* [ 1 ] */
|
||||
typedef struct pkcs7_signer_info_st {
|
||||
ASN1_INTEGER *version; /* version 1 */
|
||||
PKCS7_ISSUER_AND_SERIAL *issuer_and_serial;
|
||||
X509_ALGOR *digest_alg;
|
||||
STACK_OF(X509_ATTRIBUTE) *auth_attr; /* [ 0 ] */
|
||||
X509_ALGOR *digest_enc_alg;
|
||||
ASN1_OCTET_STRING *enc_digest;
|
||||
STACK_OF(X509_ATTRIBUTE) *unauth_attr; /* [ 1 ] */
|
||||
/* The private key to sign with */
|
||||
EVP_PKEY *pkey;
|
||||
} PKCS7_SIGNER_INFO;
|
||||
|
||||
/* The private key to sign with */
|
||||
EVP_PKEY *pkey;
|
||||
} PKCS7_SIGNER_INFO;
|
||||
DEFINE_STACK_OF(PKCS7_SIGNER_INFO)
|
||||
|
||||
DECLARE_STACK_OF(PKCS7_SIGNER_INFO)
|
||||
DECLARE_ASN1_SET_OF(PKCS7_SIGNER_INFO)
|
||||
typedef struct pkcs7_recip_info_st {
|
||||
ASN1_INTEGER *version; /* version 0 */
|
||||
PKCS7_ISSUER_AND_SERIAL *issuer_and_serial;
|
||||
X509_ALGOR *key_enc_algor;
|
||||
ASN1_OCTET_STRING *enc_key;
|
||||
X509 *cert; /* get the pub-key from this */
|
||||
} PKCS7_RECIP_INFO;
|
||||
|
||||
typedef struct pkcs7_recip_info_st
|
||||
{
|
||||
ASN1_INTEGER *version; /* version 0 */
|
||||
PKCS7_ISSUER_AND_SERIAL *issuer_and_serial;
|
||||
X509_ALGOR *key_enc_algor;
|
||||
ASN1_OCTET_STRING *enc_key;
|
||||
X509 *cert; /* get the pub-key from this */
|
||||
} PKCS7_RECIP_INFO;
|
||||
DEFINE_STACK_OF(PKCS7_RECIP_INFO)
|
||||
|
||||
DECLARE_STACK_OF(PKCS7_RECIP_INFO)
|
||||
DECLARE_ASN1_SET_OF(PKCS7_RECIP_INFO)
|
||||
typedef struct pkcs7_signed_st {
|
||||
ASN1_INTEGER *version; /* version 1 */
|
||||
STACK_OF(X509_ALGOR) *md_algs; /* md used */
|
||||
STACK_OF(X509) *cert; /* [ 0 ] */
|
||||
STACK_OF(X509_CRL) *crl; /* [ 1 ] */
|
||||
STACK_OF(PKCS7_SIGNER_INFO) *signer_info;
|
||||
struct pkcs7_st *contents;
|
||||
} PKCS7_SIGNED;
|
||||
/*
|
||||
* The above structure is very very similar to PKCS7_SIGN_ENVELOPE. How about
|
||||
* merging the two
|
||||
*/
|
||||
|
||||
typedef struct pkcs7_signed_st
|
||||
{
|
||||
ASN1_INTEGER *version; /* version 1 */
|
||||
STACK_OF(X509_ALGOR) *md_algs; /* md used */
|
||||
STACK_OF(X509) *cert; /* [ 0 ] */
|
||||
STACK_OF(X509_CRL) *crl; /* [ 1 ] */
|
||||
STACK_OF(PKCS7_SIGNER_INFO) *signer_info;
|
||||
typedef struct pkcs7_enc_content_st {
|
||||
ASN1_OBJECT *content_type;
|
||||
X509_ALGOR *algorithm;
|
||||
ASN1_OCTET_STRING *enc_data; /* [ 0 ] */
|
||||
const EVP_CIPHER *cipher;
|
||||
} PKCS7_ENC_CONTENT;
|
||||
|
||||
struct pkcs7_st *contents;
|
||||
} PKCS7_SIGNED;
|
||||
/* The above structure is very very similar to PKCS7_SIGN_ENVELOPE.
|
||||
* How about merging the two */
|
||||
typedef struct pkcs7_enveloped_st {
|
||||
ASN1_INTEGER *version; /* version 0 */
|
||||
STACK_OF(PKCS7_RECIP_INFO) *recipientinfo;
|
||||
PKCS7_ENC_CONTENT *enc_data;
|
||||
} PKCS7_ENVELOPE;
|
||||
|
||||
typedef struct pkcs7_enc_content_st
|
||||
{
|
||||
ASN1_OBJECT *content_type;
|
||||
X509_ALGOR *algorithm;
|
||||
ASN1_OCTET_STRING *enc_data; /* [ 0 ] */
|
||||
const EVP_CIPHER *cipher;
|
||||
} PKCS7_ENC_CONTENT;
|
||||
typedef struct pkcs7_signedandenveloped_st {
|
||||
ASN1_INTEGER *version; /* version 1 */
|
||||
STACK_OF(X509_ALGOR) *md_algs; /* md used */
|
||||
STACK_OF(X509) *cert; /* [ 0 ] */
|
||||
STACK_OF(X509_CRL) *crl; /* [ 1 ] */
|
||||
STACK_OF(PKCS7_SIGNER_INFO) *signer_info;
|
||||
PKCS7_ENC_CONTENT *enc_data;
|
||||
STACK_OF(PKCS7_RECIP_INFO) *recipientinfo;
|
||||
} PKCS7_SIGN_ENVELOPE;
|
||||
|
||||
typedef struct pkcs7_enveloped_st
|
||||
{
|
||||
ASN1_INTEGER *version; /* version 0 */
|
||||
STACK_OF(PKCS7_RECIP_INFO) *recipientinfo;
|
||||
PKCS7_ENC_CONTENT *enc_data;
|
||||
} PKCS7_ENVELOPE;
|
||||
typedef struct pkcs7_digest_st {
|
||||
ASN1_INTEGER *version; /* version 0 */
|
||||
X509_ALGOR *md; /* md used */
|
||||
struct pkcs7_st *contents;
|
||||
ASN1_OCTET_STRING *digest;
|
||||
} PKCS7_DIGEST;
|
||||
|
||||
typedef struct pkcs7_signedandenveloped_st
|
||||
{
|
||||
ASN1_INTEGER *version; /* version 1 */
|
||||
STACK_OF(X509_ALGOR) *md_algs; /* md used */
|
||||
STACK_OF(X509) *cert; /* [ 0 ] */
|
||||
STACK_OF(X509_CRL) *crl; /* [ 1 ] */
|
||||
STACK_OF(PKCS7_SIGNER_INFO) *signer_info;
|
||||
typedef struct pkcs7_encrypted_st {
|
||||
ASN1_INTEGER *version; /* version 0 */
|
||||
PKCS7_ENC_CONTENT *enc_data;
|
||||
} PKCS7_ENCRYPT;
|
||||
|
||||
PKCS7_ENC_CONTENT *enc_data;
|
||||
STACK_OF(PKCS7_RECIP_INFO) *recipientinfo;
|
||||
} PKCS7_SIGN_ENVELOPE;
|
||||
typedef struct pkcs7_st {
|
||||
/*
|
||||
* The following is non NULL if it contains ASN1 encoding of this
|
||||
* structure
|
||||
*/
|
||||
unsigned char *asn1;
|
||||
long length;
|
||||
# define PKCS7_S_HEADER 0
|
||||
# define PKCS7_S_BODY 1
|
||||
# define PKCS7_S_TAIL 2
|
||||
int state; /* used during processing */
|
||||
int detached;
|
||||
ASN1_OBJECT *type;
|
||||
/* content as defined by the type */
|
||||
/*
|
||||
* all encryption/message digests are applied to the 'contents', leaving
|
||||
* out the 'type' field.
|
||||
*/
|
||||
union {
|
||||
char *ptr;
|
||||
/* NID_pkcs7_data */
|
||||
ASN1_OCTET_STRING *data;
|
||||
/* NID_pkcs7_signed */
|
||||
PKCS7_SIGNED *sign;
|
||||
/* NID_pkcs7_enveloped */
|
||||
PKCS7_ENVELOPE *enveloped;
|
||||
/* NID_pkcs7_signedAndEnveloped */
|
||||
PKCS7_SIGN_ENVELOPE *signed_and_enveloped;
|
||||
/* NID_pkcs7_digest */
|
||||
PKCS7_DIGEST *digest;
|
||||
/* NID_pkcs7_encrypted */
|
||||
PKCS7_ENCRYPT *encrypted;
|
||||
/* Anything else */
|
||||
ASN1_TYPE *other;
|
||||
} d;
|
||||
} PKCS7;
|
||||
|
||||
typedef struct pkcs7_digest_st
|
||||
{
|
||||
ASN1_INTEGER *version; /* version 0 */
|
||||
X509_ALGOR *md; /* md used */
|
||||
struct pkcs7_st *contents;
|
||||
ASN1_OCTET_STRING *digest;
|
||||
} PKCS7_DIGEST;
|
||||
DEFINE_STACK_OF(PKCS7)
|
||||
|
||||
typedef struct pkcs7_encrypted_st
|
||||
{
|
||||
ASN1_INTEGER *version; /* version 0 */
|
||||
PKCS7_ENC_CONTENT *enc_data;
|
||||
} PKCS7_ENCRYPT;
|
||||
# define PKCS7_OP_SET_DETACHED_SIGNATURE 1
|
||||
# define PKCS7_OP_GET_DETACHED_SIGNATURE 2
|
||||
|
||||
typedef struct pkcs7_st
|
||||
{
|
||||
/* The following is non NULL if it contains ASN1 encoding of
|
||||
* this structure */
|
||||
unsigned char *asn1;
|
||||
long length;
|
||||
# define PKCS7_get_signed_attributes(si) ((si)->auth_attr)
|
||||
# define PKCS7_get_attributes(si) ((si)->unauth_attr)
|
||||
|
||||
#define PKCS7_S_HEADER 0
|
||||
#define PKCS7_S_BODY 1
|
||||
#define PKCS7_S_TAIL 2
|
||||
int state; /* used during processing */
|
||||
# define PKCS7_type_is_signed(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_signed)
|
||||
# define PKCS7_type_is_encrypted(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted)
|
||||
# define PKCS7_type_is_enveloped(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_enveloped)
|
||||
# define PKCS7_type_is_signedAndEnveloped(a) \
|
||||
(OBJ_obj2nid((a)->type) == NID_pkcs7_signedAndEnveloped)
|
||||
# define PKCS7_type_is_data(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_data)
|
||||
# define PKCS7_type_is_digest(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_digest)
|
||||
|
||||
int detached;
|
||||
# define PKCS7_set_detached(p,v) \
|
||||
PKCS7_ctrl(p,PKCS7_OP_SET_DETACHED_SIGNATURE,v,NULL)
|
||||
# define PKCS7_get_detached(p) \
|
||||
PKCS7_ctrl(p,PKCS7_OP_GET_DETACHED_SIGNATURE,0,NULL)
|
||||
|
||||
ASN1_OBJECT *type;
|
||||
/* content as defined by the type */
|
||||
/* all encryption/message digests are applied to the 'contents',
|
||||
* leaving out the 'type' field. */
|
||||
union {
|
||||
char *ptr;
|
||||
|
||||
/* NID_pkcs7_data */
|
||||
ASN1_OCTET_STRING *data;
|
||||
|
||||
/* NID_pkcs7_signed */
|
||||
PKCS7_SIGNED *sign;
|
||||
|
||||
/* NID_pkcs7_enveloped */
|
||||
PKCS7_ENVELOPE *enveloped;
|
||||
|
||||
/* NID_pkcs7_signedAndEnveloped */
|
||||
PKCS7_SIGN_ENVELOPE *signed_and_enveloped;
|
||||
|
||||
/* NID_pkcs7_digest */
|
||||
PKCS7_DIGEST *digest;
|
||||
|
||||
/* NID_pkcs7_encrypted */
|
||||
PKCS7_ENCRYPT *encrypted;
|
||||
|
||||
/* Anything else */
|
||||
ASN1_TYPE *other;
|
||||
} d;
|
||||
} PKCS7;
|
||||
|
||||
DECLARE_STACK_OF(PKCS7)
|
||||
DECLARE_ASN1_SET_OF(PKCS7)
|
||||
DECLARE_PKCS12_STACK_OF(PKCS7)
|
||||
|
||||
#define PKCS7_OP_SET_DETACHED_SIGNATURE 1
|
||||
#define PKCS7_OP_GET_DETACHED_SIGNATURE 2
|
||||
|
||||
#define PKCS7_get_signed_attributes(si) ((si)->auth_attr)
|
||||
#define PKCS7_get_attributes(si) ((si)->unauth_attr)
|
||||
|
||||
#define PKCS7_type_is_signed(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_signed)
|
||||
#define PKCS7_type_is_encrypted(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_encrypted)
|
||||
#define PKCS7_type_is_enveloped(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_enveloped)
|
||||
#define PKCS7_type_is_signedAndEnveloped(a) \
|
||||
(OBJ_obj2nid((a)->type) == NID_pkcs7_signedAndEnveloped)
|
||||
#define PKCS7_type_is_data(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_data)
|
||||
|
||||
#define PKCS7_type_is_digest(a) (OBJ_obj2nid((a)->type) == NID_pkcs7_digest)
|
||||
|
||||
#define PKCS7_set_detached(p,v) \
|
||||
PKCS7_ctrl(p,PKCS7_OP_SET_DETACHED_SIGNATURE,v,NULL)
|
||||
#define PKCS7_get_detached(p) \
|
||||
PKCS7_ctrl(p,PKCS7_OP_GET_DETACHED_SIGNATURE,0,NULL)
|
||||
|
||||
#define PKCS7_is_detached(p7) (PKCS7_type_is_signed(p7) && PKCS7_get_detached(p7))
|
||||
|
||||
#ifdef SSLEAY_MACROS
|
||||
#ifndef PKCS7_ISSUER_AND_SERIAL_digest
|
||||
#define PKCS7_ISSUER_AND_SERIAL_digest(data,type,md,len) \
|
||||
ASN1_digest((int (*)())i2d_PKCS7_ISSUER_AND_SERIAL,type,\
|
||||
(char *)data,md,len)
|
||||
#endif
|
||||
#endif
|
||||
# define PKCS7_is_detached(p7) (PKCS7_type_is_signed(p7) && PKCS7_get_detached(p7))
|
||||
|
||||
/* S/MIME related flags */
|
||||
|
||||
#define PKCS7_TEXT 0x1
|
||||
#define PKCS7_NOCERTS 0x2
|
||||
#define PKCS7_NOSIGS 0x4
|
||||
#define PKCS7_NOCHAIN 0x8
|
||||
#define PKCS7_NOINTERN 0x10
|
||||
#define PKCS7_NOVERIFY 0x20
|
||||
#define PKCS7_DETACHED 0x40
|
||||
#define PKCS7_BINARY 0x80
|
||||
#define PKCS7_NOATTR 0x100
|
||||
#define PKCS7_NOSMIMECAP 0x200
|
||||
#define PKCS7_NOOLDMIMETYPE 0x400
|
||||
#define PKCS7_CRLFEOL 0x800
|
||||
#define PKCS7_STREAM 0x1000
|
||||
#define PKCS7_NOCRL 0x2000
|
||||
# define PKCS7_TEXT 0x1
|
||||
# define PKCS7_NOCERTS 0x2
|
||||
# define PKCS7_NOSIGS 0x4
|
||||
# define PKCS7_NOCHAIN 0x8
|
||||
# define PKCS7_NOINTERN 0x10
|
||||
# define PKCS7_NOVERIFY 0x20
|
||||
# define PKCS7_DETACHED 0x40
|
||||
# define PKCS7_BINARY 0x80
|
||||
# define PKCS7_NOATTR 0x100
|
||||
# define PKCS7_NOSMIMECAP 0x200
|
||||
# define PKCS7_NOOLDMIMETYPE 0x400
|
||||
# define PKCS7_CRLFEOL 0x800
|
||||
# define PKCS7_STREAM 0x1000
|
||||
# define PKCS7_NOCRL 0x2000
|
||||
# define PKCS7_PARTIAL 0x4000
|
||||
# define PKCS7_REUSE_DIGEST 0x8000
|
||||
# define PKCS7_NO_DUAL_CONTENT 0x10000
|
||||
|
||||
/* Flags: for compatibility with older code */
|
||||
|
||||
#define SMIME_TEXT PKCS7_TEXT
|
||||
#define SMIME_NOCERTS PKCS7_NOCERTS
|
||||
#define SMIME_NOSIGS PKCS7_NOSIGS
|
||||
#define SMIME_NOCHAIN PKCS7_NOCHAIN
|
||||
#define SMIME_NOINTERN PKCS7_NOINTERN
|
||||
#define SMIME_NOVERIFY PKCS7_NOVERIFY
|
||||
#define SMIME_DETACHED PKCS7_DETACHED
|
||||
#define SMIME_BINARY PKCS7_BINARY
|
||||
#define SMIME_NOATTR PKCS7_NOATTR
|
||||
# define SMIME_TEXT PKCS7_TEXT
|
||||
# define SMIME_NOCERTS PKCS7_NOCERTS
|
||||
# define SMIME_NOSIGS PKCS7_NOSIGS
|
||||
# define SMIME_NOCHAIN PKCS7_NOCHAIN
|
||||
# define SMIME_NOINTERN PKCS7_NOINTERN
|
||||
# define SMIME_NOVERIFY PKCS7_NOVERIFY
|
||||
# define SMIME_DETACHED PKCS7_DETACHED
|
||||
# define SMIME_BINARY PKCS7_BINARY
|
||||
# define SMIME_NOATTR PKCS7_NOATTR
|
||||
|
||||
/* CRLF ASCII canonicalisation */
|
||||
# define SMIME_ASCIICRLF 0x80000
|
||||
|
||||
DECLARE_ASN1_FUNCTIONS(PKCS7_ISSUER_AND_SERIAL)
|
||||
|
||||
#ifndef SSLEAY_MACROS
|
||||
int PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data,const EVP_MD *type,
|
||||
unsigned char *md,unsigned int *len);
|
||||
#ifndef OPENSSL_NO_FP_API
|
||||
PKCS7 *d2i_PKCS7_fp(FILE *fp,PKCS7 **p7);
|
||||
int i2d_PKCS7_fp(FILE *fp,PKCS7 *p7);
|
||||
#endif
|
||||
int PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data,
|
||||
const EVP_MD *type, unsigned char *md,
|
||||
unsigned int *len);
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
PKCS7 *d2i_PKCS7_fp(FILE *fp, PKCS7 **p7);
|
||||
int i2d_PKCS7_fp(FILE *fp, PKCS7 *p7);
|
||||
# endif
|
||||
PKCS7 *PKCS7_dup(PKCS7 *p7);
|
||||
PKCS7 *d2i_PKCS7_bio(BIO *bp,PKCS7 **p7);
|
||||
int i2d_PKCS7_bio(BIO *bp,PKCS7 *p7);
|
||||
#endif
|
||||
PKCS7 *d2i_PKCS7_bio(BIO *bp, PKCS7 **p7);
|
||||
int i2d_PKCS7_bio(BIO *bp, PKCS7 *p7);
|
||||
int i2d_PKCS7_bio_stream(BIO *out, PKCS7 *p7, BIO *in, int flags);
|
||||
int PEM_write_bio_PKCS7_stream(BIO *out, PKCS7 *p7, BIO *in, int flags);
|
||||
|
||||
DECLARE_ASN1_FUNCTIONS(PKCS7_SIGNER_INFO)
|
||||
DECLARE_ASN1_FUNCTIONS(PKCS7_RECIP_INFO)
|
||||
@ -307,6 +229,7 @@ DECLARE_ASN1_ITEM(PKCS7_ATTR_SIGN)
|
||||
DECLARE_ASN1_ITEM(PKCS7_ATTR_VERIFY)
|
||||
|
||||
DECLARE_ASN1_NDEF_FUNCTION(PKCS7)
|
||||
DECLARE_ASN1_PRINT_FUNCTION(PKCS7)
|
||||
|
||||
long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg);
|
||||
|
||||
@ -314,151 +237,168 @@ int PKCS7_set_type(PKCS7 *p7, int type);
|
||||
int PKCS7_set0_type_other(PKCS7 *p7, int type, ASN1_TYPE *other);
|
||||
int PKCS7_set_content(PKCS7 *p7, PKCS7 *p7_data);
|
||||
int PKCS7_SIGNER_INFO_set(PKCS7_SIGNER_INFO *p7i, X509 *x509, EVP_PKEY *pkey,
|
||||
const EVP_MD *dgst);
|
||||
const EVP_MD *dgst);
|
||||
int PKCS7_SIGNER_INFO_sign(PKCS7_SIGNER_INFO *si);
|
||||
int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *p7i);
|
||||
int PKCS7_add_certificate(PKCS7 *p7, X509 *x509);
|
||||
int PKCS7_add_crl(PKCS7 *p7, X509_CRL *x509);
|
||||
int PKCS7_content_new(PKCS7 *p7, int nid);
|
||||
int PKCS7_dataVerify(X509_STORE *cert_store, X509_STORE_CTX *ctx,
|
||||
BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si);
|
||||
BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si);
|
||||
int PKCS7_signatureVerify(BIO *bio, PKCS7 *p7, PKCS7_SIGNER_INFO *si,
|
||||
X509 *x509);
|
||||
X509 *x509);
|
||||
|
||||
BIO *PKCS7_dataInit(PKCS7 *p7, BIO *bio);
|
||||
int PKCS7_dataFinal(PKCS7 *p7, BIO *bio);
|
||||
BIO *PKCS7_dataDecode(PKCS7 *p7, EVP_PKEY *pkey, BIO *in_bio, X509 *pcert);
|
||||
|
||||
|
||||
PKCS7_SIGNER_INFO *PKCS7_add_signature(PKCS7 *p7, X509 *x509,
|
||||
EVP_PKEY *pkey, const EVP_MD *dgst);
|
||||
EVP_PKEY *pkey, const EVP_MD *dgst);
|
||||
X509 *PKCS7_cert_from_signer_info(PKCS7 *p7, PKCS7_SIGNER_INFO *si);
|
||||
int PKCS7_set_digest(PKCS7 *p7, const EVP_MD *md);
|
||||
STACK_OF(PKCS7_SIGNER_INFO) *PKCS7_get_signer_info(PKCS7 *p7);
|
||||
|
||||
PKCS7_RECIP_INFO *PKCS7_add_recipient(PKCS7 *p7, X509 *x509);
|
||||
void PKCS7_SIGNER_INFO_get0_algs(PKCS7_SIGNER_INFO *si, EVP_PKEY **pk,
|
||||
X509_ALGOR **pdig, X509_ALGOR **psig);
|
||||
void PKCS7_RECIP_INFO_get0_alg(PKCS7_RECIP_INFO *ri, X509_ALGOR **penc);
|
||||
int PKCS7_add_recipient_info(PKCS7 *p7, PKCS7_RECIP_INFO *ri);
|
||||
int PKCS7_RECIP_INFO_set(PKCS7_RECIP_INFO *p7i, X509 *x509);
|
||||
int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher);
|
||||
int PKCS7_stream(unsigned char ***boundary, PKCS7 *p7);
|
||||
|
||||
PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx);
|
||||
ASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk);
|
||||
int PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si,int nid,int type,
|
||||
void *data);
|
||||
int PKCS7_add_attribute (PKCS7_SIGNER_INFO *p7si, int nid, int atrtype,
|
||||
void *value);
|
||||
int PKCS7_add_signed_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int type,
|
||||
void *data);
|
||||
int PKCS7_add_attribute(PKCS7_SIGNER_INFO *p7si, int nid, int atrtype,
|
||||
void *value);
|
||||
ASN1_TYPE *PKCS7_get_attribute(PKCS7_SIGNER_INFO *si, int nid);
|
||||
ASN1_TYPE *PKCS7_get_signed_attribute(PKCS7_SIGNER_INFO *si, int nid);
|
||||
int PKCS7_set_signed_attributes(PKCS7_SIGNER_INFO *p7si,
|
||||
STACK_OF(X509_ATTRIBUTE) *sk);
|
||||
int PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si,STACK_OF(X509_ATTRIBUTE) *sk);
|
||||
|
||||
STACK_OF(X509_ATTRIBUTE) *sk);
|
||||
int PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si,
|
||||
STACK_OF(X509_ATTRIBUTE) *sk);
|
||||
|
||||
PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,
|
||||
BIO *data, int flags);
|
||||
BIO *data, int flags);
|
||||
|
||||
PKCS7_SIGNER_INFO *PKCS7_sign_add_signer(PKCS7 *p7,
|
||||
X509 *signcert, EVP_PKEY *pkey,
|
||||
const EVP_MD *md, int flags);
|
||||
|
||||
int PKCS7_final(PKCS7 *p7, BIO *data, int flags);
|
||||
int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
|
||||
BIO *indata, BIO *out, int flags);
|
||||
STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags);
|
||||
BIO *indata, BIO *out, int flags);
|
||||
STACK_OF(X509) *PKCS7_get0_signers(PKCS7 *p7, STACK_OF(X509) *certs,
|
||||
int flags);
|
||||
PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, const EVP_CIPHER *cipher,
|
||||
int flags);
|
||||
int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags);
|
||||
int flags);
|
||||
int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data,
|
||||
int flags);
|
||||
|
||||
int PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si,
|
||||
STACK_OF(X509_ALGOR) *cap);
|
||||
STACK_OF(X509_ALGOR) *cap);
|
||||
STACK_OF(X509_ALGOR) *PKCS7_get_smimecap(PKCS7_SIGNER_INFO *si);
|
||||
int PKCS7_simple_smimecap(STACK_OF(X509_ALGOR) *sk, int nid, int arg);
|
||||
|
||||
int PKCS7_add_attrib_content_type(PKCS7_SIGNER_INFO *si, ASN1_OBJECT *coid);
|
||||
int PKCS7_add0_attrib_signing_time(PKCS7_SIGNER_INFO *si, ASN1_TIME *t);
|
||||
int PKCS7_add1_attrib_digest(PKCS7_SIGNER_INFO *si,
|
||||
const unsigned char *md, int mdlen);
|
||||
|
||||
int SMIME_write_PKCS7(BIO *bio, PKCS7 *p7, BIO *data, int flags);
|
||||
PKCS7 *SMIME_read_PKCS7(BIO *bio, BIO **bcont);
|
||||
int SMIME_crlf_copy(BIO *in, BIO *out, int flags);
|
||||
int SMIME_text(BIO *in, BIO *out);
|
||||
|
||||
BIO *BIO_new_PKCS7(BIO *out, PKCS7 *p7);
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
/*
|
||||
* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
void ERR_load_PKCS7_strings(void);
|
||||
|
||||
int ERR_load_PKCS7_strings(void);
|
||||
|
||||
/* Error codes for the PKCS7 functions. */
|
||||
|
||||
/* Function codes. */
|
||||
#define PKCS7_F_B64_READ_PKCS7 120
|
||||
#define PKCS7_F_B64_WRITE_PKCS7 121
|
||||
#define PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP 118
|
||||
#define PKCS7_F_PKCS7_ADD_CERTIFICATE 100
|
||||
#define PKCS7_F_PKCS7_ADD_CRL 101
|
||||
#define PKCS7_F_PKCS7_ADD_RECIPIENT_INFO 102
|
||||
#define PKCS7_F_PKCS7_ADD_SIGNER 103
|
||||
#define PKCS7_F_PKCS7_BIO_ADD_DIGEST 125
|
||||
#define PKCS7_F_PKCS7_CTRL 104
|
||||
#define PKCS7_F_PKCS7_DATADECODE 112
|
||||
#define PKCS7_F_PKCS7_DATAFINAL 128
|
||||
#define PKCS7_F_PKCS7_DATAINIT 105
|
||||
#define PKCS7_F_PKCS7_DATASIGN 106
|
||||
#define PKCS7_F_PKCS7_DATAVERIFY 107
|
||||
#define PKCS7_F_PKCS7_DECRYPT 114
|
||||
#define PKCS7_F_PKCS7_ENCRYPT 115
|
||||
#define PKCS7_F_PKCS7_FIND_DIGEST 127
|
||||
#define PKCS7_F_PKCS7_GET0_SIGNERS 124
|
||||
#define PKCS7_F_PKCS7_SET_CIPHER 108
|
||||
#define PKCS7_F_PKCS7_SET_CONTENT 109
|
||||
#define PKCS7_F_PKCS7_SET_DIGEST 126
|
||||
#define PKCS7_F_PKCS7_SET_TYPE 110
|
||||
#define PKCS7_F_PKCS7_SIGN 116
|
||||
#define PKCS7_F_PKCS7_SIGNATUREVERIFY 113
|
||||
#define PKCS7_F_PKCS7_SIMPLE_SMIMECAP 119
|
||||
#define PKCS7_F_PKCS7_VERIFY 117
|
||||
#define PKCS7_F_SMIME_READ_PKCS7 122
|
||||
#define PKCS7_F_SMIME_TEXT 123
|
||||
# define PKCS7_F_DO_PKCS7_SIGNED_ATTRIB 136
|
||||
# define PKCS7_F_PKCS7_ADD0_ATTRIB_SIGNING_TIME 135
|
||||
# define PKCS7_F_PKCS7_ADD_ATTRIB_SMIMECAP 118
|
||||
# define PKCS7_F_PKCS7_ADD_CERTIFICATE 100
|
||||
# define PKCS7_F_PKCS7_ADD_CRL 101
|
||||
# define PKCS7_F_PKCS7_ADD_RECIPIENT_INFO 102
|
||||
# define PKCS7_F_PKCS7_ADD_SIGNATURE 131
|
||||
# define PKCS7_F_PKCS7_ADD_SIGNER 103
|
||||
# define PKCS7_F_PKCS7_BIO_ADD_DIGEST 125
|
||||
# define PKCS7_F_PKCS7_COPY_EXISTING_DIGEST 138
|
||||
# define PKCS7_F_PKCS7_CTRL 104
|
||||
# define PKCS7_F_PKCS7_DATADECODE 112
|
||||
# define PKCS7_F_PKCS7_DATAFINAL 128
|
||||
# define PKCS7_F_PKCS7_DATAINIT 105
|
||||
# define PKCS7_F_PKCS7_DATAVERIFY 107
|
||||
# define PKCS7_F_PKCS7_DECRYPT 114
|
||||
# define PKCS7_F_PKCS7_DECRYPT_RINFO 133
|
||||
# define PKCS7_F_PKCS7_ENCODE_RINFO 132
|
||||
# define PKCS7_F_PKCS7_ENCRYPT 115
|
||||
# define PKCS7_F_PKCS7_FINAL 134
|
||||
# define PKCS7_F_PKCS7_FIND_DIGEST 127
|
||||
# define PKCS7_F_PKCS7_GET0_SIGNERS 124
|
||||
# define PKCS7_F_PKCS7_RECIP_INFO_SET 130
|
||||
# define PKCS7_F_PKCS7_SET_CIPHER 108
|
||||
# define PKCS7_F_PKCS7_SET_CONTENT 109
|
||||
# define PKCS7_F_PKCS7_SET_DIGEST 126
|
||||
# define PKCS7_F_PKCS7_SET_TYPE 110
|
||||
# define PKCS7_F_PKCS7_SIGN 116
|
||||
# define PKCS7_F_PKCS7_SIGNATUREVERIFY 113
|
||||
# define PKCS7_F_PKCS7_SIGNER_INFO_SET 129
|
||||
# define PKCS7_F_PKCS7_SIGNER_INFO_SIGN 139
|
||||
# define PKCS7_F_PKCS7_SIGN_ADD_SIGNER 137
|
||||
# define PKCS7_F_PKCS7_SIMPLE_SMIMECAP 119
|
||||
# define PKCS7_F_PKCS7_VERIFY 117
|
||||
|
||||
/* Reason codes. */
|
||||
#define PKCS7_R_CERTIFICATE_VERIFY_ERROR 117
|
||||
#define PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 144
|
||||
#define PKCS7_R_CIPHER_NOT_INITIALIZED 116
|
||||
#define PKCS7_R_CONTENT_AND_DATA_PRESENT 118
|
||||
#define PKCS7_R_DECODE_ERROR 130
|
||||
#define PKCS7_R_DECRYPTED_KEY_IS_WRONG_LENGTH 100
|
||||
#define PKCS7_R_DECRYPT_ERROR 119
|
||||
#define PKCS7_R_DIGEST_FAILURE 101
|
||||
#define PKCS7_R_ERROR_ADDING_RECIPIENT 120
|
||||
#define PKCS7_R_ERROR_SETTING_CIPHER 121
|
||||
#define PKCS7_R_INVALID_MIME_TYPE 131
|
||||
#define PKCS7_R_INVALID_NULL_POINTER 143
|
||||
#define PKCS7_R_MIME_NO_CONTENT_TYPE 132
|
||||
#define PKCS7_R_MIME_PARSE_ERROR 133
|
||||
#define PKCS7_R_MIME_SIG_PARSE_ERROR 134
|
||||
#define PKCS7_R_MISSING_CERIPEND_INFO 103
|
||||
#define PKCS7_R_NO_CONTENT 122
|
||||
#define PKCS7_R_NO_CONTENT_TYPE 135
|
||||
#define PKCS7_R_NO_MULTIPART_BODY_FAILURE 136
|
||||
#define PKCS7_R_NO_MULTIPART_BOUNDARY 137
|
||||
#define PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE 115
|
||||
#define PKCS7_R_NO_RECIPIENT_MATCHES_KEY 146
|
||||
#define PKCS7_R_NO_SIGNATURES_ON_DATA 123
|
||||
#define PKCS7_R_NO_SIGNERS 142
|
||||
#define PKCS7_R_NO_SIG_CONTENT_TYPE 138
|
||||
#define PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE 104
|
||||
#define PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR 124
|
||||
#define PKCS7_R_PKCS7_DATAFINAL 126
|
||||
#define PKCS7_R_PKCS7_DATAFINAL_ERROR 125
|
||||
#define PKCS7_R_PKCS7_DATASIGN 145
|
||||
#define PKCS7_R_PKCS7_PARSE_ERROR 139
|
||||
#define PKCS7_R_PKCS7_SIG_PARSE_ERROR 140
|
||||
#define PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 127
|
||||
#define PKCS7_R_SIGNATURE_FAILURE 105
|
||||
#define PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND 128
|
||||
#define PKCS7_R_SIG_INVALID_MIME_TYPE 141
|
||||
#define PKCS7_R_SMIME_TEXT_ERROR 129
|
||||
#define PKCS7_R_UNABLE_TO_FIND_CERTIFICATE 106
|
||||
#define PKCS7_R_UNABLE_TO_FIND_MEM_BIO 107
|
||||
#define PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST 108
|
||||
#define PKCS7_R_UNKNOWN_DIGEST_TYPE 109
|
||||
#define PKCS7_R_UNKNOWN_OPERATION 110
|
||||
#define PKCS7_R_UNSUPPORTED_CIPHER_TYPE 111
|
||||
#define PKCS7_R_UNSUPPORTED_CONTENT_TYPE 112
|
||||
#define PKCS7_R_WRONG_CONTENT_TYPE 113
|
||||
#define PKCS7_R_WRONG_PKCS7_TYPE 114
|
||||
# define PKCS7_R_CERTIFICATE_VERIFY_ERROR 117
|
||||
# define PKCS7_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 144
|
||||
# define PKCS7_R_CIPHER_NOT_INITIALIZED 116
|
||||
# define PKCS7_R_CONTENT_AND_DATA_PRESENT 118
|
||||
# define PKCS7_R_CTRL_ERROR 152
|
||||
# define PKCS7_R_DECRYPT_ERROR 119
|
||||
# define PKCS7_R_DIGEST_FAILURE 101
|
||||
# define PKCS7_R_ENCRYPTION_CTRL_FAILURE 149
|
||||
# define PKCS7_R_ENCRYPTION_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 150
|
||||
# define PKCS7_R_ERROR_ADDING_RECIPIENT 120
|
||||
# define PKCS7_R_ERROR_SETTING_CIPHER 121
|
||||
# define PKCS7_R_INVALID_NULL_POINTER 143
|
||||
# define PKCS7_R_INVALID_SIGNED_DATA_TYPE 155
|
||||
# define PKCS7_R_NO_CONTENT 122
|
||||
# define PKCS7_R_NO_DEFAULT_DIGEST 151
|
||||
# define PKCS7_R_NO_MATCHING_DIGEST_TYPE_FOUND 154
|
||||
# define PKCS7_R_NO_RECIPIENT_MATCHES_CERTIFICATE 115
|
||||
# define PKCS7_R_NO_SIGNATURES_ON_DATA 123
|
||||
# define PKCS7_R_NO_SIGNERS 142
|
||||
# define PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE 104
|
||||
# define PKCS7_R_PKCS7_ADD_SIGNATURE_ERROR 124
|
||||
# define PKCS7_R_PKCS7_ADD_SIGNER_ERROR 153
|
||||
# define PKCS7_R_PKCS7_DATASIGN 145
|
||||
# define PKCS7_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 127
|
||||
# define PKCS7_R_SIGNATURE_FAILURE 105
|
||||
# define PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND 128
|
||||
# define PKCS7_R_SIGNING_CTRL_FAILURE 147
|
||||
# define PKCS7_R_SIGNING_NOT_SUPPORTED_FOR_THIS_KEY_TYPE 148
|
||||
# define PKCS7_R_SMIME_TEXT_ERROR 129
|
||||
# define PKCS7_R_UNABLE_TO_FIND_CERTIFICATE 106
|
||||
# define PKCS7_R_UNABLE_TO_FIND_MEM_BIO 107
|
||||
# define PKCS7_R_UNABLE_TO_FIND_MESSAGE_DIGEST 108
|
||||
# define PKCS7_R_UNKNOWN_DIGEST_TYPE 109
|
||||
# define PKCS7_R_UNKNOWN_OPERATION 110
|
||||
# define PKCS7_R_UNSUPPORTED_CIPHER_TYPE 111
|
||||
# define PKCS7_R_UNSUPPORTED_CONTENT_TYPE 112
|
||||
# define PKCS7_R_WRONG_CONTENT_TYPE 113
|
||||
# define PKCS7_R_WRONG_PKCS7_TYPE 114
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@ -1,140 +1,89 @@
|
||||
/* crypto/rand/rand.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_RAND_H
|
||||
#define HEADER_RAND_H
|
||||
# define HEADER_RAND_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <openssl/ossl_typ.h>
|
||||
#include <openssl/e_os2.h>
|
||||
|
||||
#if defined(OPENSSL_SYS_WINDOWS)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
# include <stdlib.h>
|
||||
# include <openssl/ossl_typ.h>
|
||||
# include <openssl/e_os2.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(OPENSSL_FIPS)
|
||||
#define FIPS_RAND_SIZE_T size_t
|
||||
#endif
|
||||
|
||||
/* Already defined in ossl_typ.h */
|
||||
/* typedef struct rand_meth_st RAND_METHOD; */
|
||||
|
||||
struct rand_meth_st
|
||||
{
|
||||
void (*seed)(const void *buf, int num);
|
||||
int (*bytes)(unsigned char *buf, int num);
|
||||
void (*cleanup)(void);
|
||||
void (*add)(const void *buf, int num, double entropy);
|
||||
int (*pseudorand)(unsigned char *buf, int num);
|
||||
int (*status)(void);
|
||||
};
|
||||
struct rand_meth_st {
|
||||
int (*seed) (const void *buf, int num);
|
||||
int (*bytes) (unsigned char *buf, int num);
|
||||
void (*cleanup) (void);
|
||||
int (*add) (const void *buf, int num, double entropy);
|
||||
int (*pseudorand) (unsigned char *buf, int num);
|
||||
int (*status) (void);
|
||||
};
|
||||
|
||||
#ifdef BN_DEBUG
|
||||
# ifdef BN_DEBUG
|
||||
extern int rand_predictable;
|
||||
#endif
|
||||
# endif
|
||||
|
||||
int RAND_set_rand_method(const RAND_METHOD *meth);
|
||||
const RAND_METHOD *RAND_get_rand_method(void);
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
# ifndef OPENSSL_NO_ENGINE
|
||||
int RAND_set_rand_engine(ENGINE *engine);
|
||||
# endif
|
||||
RAND_METHOD *RAND_OpenSSL(void);
|
||||
#if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# define RAND_cleanup() while(0) continue
|
||||
#endif
|
||||
RAND_METHOD *RAND_SSLeay(void);
|
||||
void RAND_cleanup(void );
|
||||
int RAND_bytes(unsigned char *buf,int num);
|
||||
int RAND_pseudo_bytes(unsigned char *buf,int num);
|
||||
void RAND_seed(const void *buf,int num);
|
||||
void RAND_add(const void *buf,int num,double entropy);
|
||||
int RAND_load_file(const char *file,long max_bytes);
|
||||
int RAND_write_file(const char *file);
|
||||
const char *RAND_file_name(char *file,size_t num);
|
||||
int RAND_bytes(unsigned char *buf, int num);
|
||||
DEPRECATEDIN_1_1_0(int RAND_pseudo_bytes(unsigned char *buf, int num))
|
||||
void RAND_seed(const void *buf, int num);
|
||||
#if defined(__ANDROID__) && defined(__NDK_FPABI__)
|
||||
__NDK_FPABI__ /* __attribute__((pcs("aapcs"))) on ARM */
|
||||
#endif
|
||||
void RAND_add(const void *buf, int num, double entropy);
|
||||
int RAND_load_file(const char *file, long max_bytes);
|
||||
int RAND_write_file(const char *file);
|
||||
const char *RAND_file_name(char *file, size_t num);
|
||||
int RAND_status(void);
|
||||
# ifndef OPENSSL_NO_EGD
|
||||
int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes);
|
||||
int RAND_egd(const char *path);
|
||||
int RAND_egd_bytes(const char *path,int bytes);
|
||||
int RAND_egd_bytes(const char *path, int bytes);
|
||||
# endif
|
||||
int RAND_poll(void);
|
||||
|
||||
#if defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32)
|
||||
|
||||
void RAND_screen(void);
|
||||
int RAND_event(UINT, WPARAM, LPARAM);
|
||||
|
||||
#if defined(_WIN32) && (defined(BASETYPES) || defined(_WINDEF_H))
|
||||
/* application has to include <windows.h> in order to use these */
|
||||
DEPRECATEDIN_1_1_0(void RAND_screen(void))
|
||||
DEPRECATEDIN_1_1_0(int RAND_event(UINT, WPARAM, LPARAM))
|
||||
#endif
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
/*
|
||||
* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
void ERR_load_RAND_strings(void);
|
||||
|
||||
int ERR_load_RAND_strings(void);
|
||||
|
||||
/* Error codes for the RAND functions. */
|
||||
|
||||
/* Function codes. */
|
||||
#define RAND_F_RAND_GET_RAND_METHOD 101
|
||||
#define RAND_F_SSLEAY_RAND_BYTES 100
|
||||
# define RAND_F_RAND_BYTES 100
|
||||
|
||||
/* Reason codes. */
|
||||
#define RAND_R_PRNG_NOT_SEEDED 100
|
||||
# define RAND_R_PRNG_NOT_SEEDED 100
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@ -1,101 +1,51 @@
|
||||
/* crypto/rc2/rc2.h */
|
||||
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_RC2_H
|
||||
#define HEADER_RC2_H
|
||||
# define HEADER_RC2_H
|
||||
|
||||
#include <openssl/opensslconf.h> /* OPENSSL_NO_RC2, RC2_INT */
|
||||
#ifdef OPENSSL_NO_RC2
|
||||
#error RC2 is disabled.
|
||||
#endif
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
#define RC2_ENCRYPT 1
|
||||
#define RC2_DECRYPT 0
|
||||
|
||||
#define RC2_BLOCK 8
|
||||
#define RC2_KEY_LENGTH 16
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifndef OPENSSL_NO_RC2
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
# endif
|
||||
|
||||
typedef struct rc2_key_st
|
||||
{
|
||||
RC2_INT data[64];
|
||||
} RC2_KEY;
|
||||
typedef unsigned int RC2_INT;
|
||||
|
||||
# define RC2_ENCRYPT 1
|
||||
# define RC2_DECRYPT 0
|
||||
|
||||
void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data,int bits);
|
||||
void RC2_ecb_encrypt(const unsigned char *in,unsigned char *out,RC2_KEY *key,
|
||||
int enc);
|
||||
void RC2_encrypt(unsigned long *data,RC2_KEY *key);
|
||||
void RC2_decrypt(unsigned long *data,RC2_KEY *key);
|
||||
# define RC2_BLOCK 8
|
||||
# define RC2_KEY_LENGTH 16
|
||||
|
||||
typedef struct rc2_key_st {
|
||||
RC2_INT data[64];
|
||||
} RC2_KEY;
|
||||
|
||||
void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits);
|
||||
void RC2_ecb_encrypt(const unsigned char *in, unsigned char *out,
|
||||
RC2_KEY *key, int enc);
|
||||
void RC2_encrypt(unsigned long *data, RC2_KEY *key);
|
||||
void RC2_decrypt(unsigned long *data, RC2_KEY *key);
|
||||
void RC2_cbc_encrypt(const unsigned char *in, unsigned char *out, long length,
|
||||
RC2_KEY *ks, unsigned char *iv, int enc);
|
||||
RC2_KEY *ks, unsigned char *iv, int enc);
|
||||
void RC2_cfb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, RC2_KEY *schedule, unsigned char *ivec,
|
||||
int *num, int enc);
|
||||
long length, RC2_KEY *schedule, unsigned char *ivec,
|
||||
int *num, int enc);
|
||||
void RC2_ofb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, RC2_KEY *schedule, unsigned char *ivec,
|
||||
int *num);
|
||||
long length, RC2_KEY *schedule, unsigned char *ivec,
|
||||
int *num);
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
@ -1,87 +1,36 @@
|
||||
/* crypto/rc4/rc4.h */
|
||||
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_RC4_H
|
||||
#define HEADER_RC4_H
|
||||
# define HEADER_RC4_H
|
||||
|
||||
#include <openssl/opensslconf.h> /* OPENSSL_NO_RC4, RC4_INT */
|
||||
#ifdef OPENSSL_NO_RC4
|
||||
#error RC4 is disabled.
|
||||
#endif
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_RC4
|
||||
# include <stddef.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct rc4_key_st
|
||||
{
|
||||
RC4_INT x,y;
|
||||
RC4_INT data[256];
|
||||
} RC4_KEY;
|
||||
|
||||
typedef struct rc4_key_st {
|
||||
RC4_INT x, y;
|
||||
RC4_INT data[256];
|
||||
} RC4_KEY;
|
||||
|
||||
const char *RC4_options(void);
|
||||
void RC4_set_key(RC4_KEY *key, int len, const unsigned char *data);
|
||||
void RC4(RC4_KEY *key, unsigned long len, const unsigned char *indata,
|
||||
unsigned char *outdata);
|
||||
void RC4(RC4_KEY *key, size_t len, const unsigned char *indata,
|
||||
unsigned char *outdata);
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
63
src/dep/include/openssl/rc5.h
Normal file
63
src/dep/include/openssl/rc5.h
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_RC5_H
|
||||
# define HEADER_RC5_H
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_RC5
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
# define RC5_ENCRYPT 1
|
||||
# define RC5_DECRYPT 0
|
||||
|
||||
# define RC5_32_INT unsigned int
|
||||
|
||||
# define RC5_32_BLOCK 8
|
||||
# define RC5_32_KEY_LENGTH 16/* This is a default, max is 255 */
|
||||
|
||||
/*
|
||||
* This are the only values supported. Tweak the code if you want more The
|
||||
* most supported modes will be RC5-32/12/16 RC5-32/16/8
|
||||
*/
|
||||
# define RC5_8_ROUNDS 8
|
||||
# define RC5_12_ROUNDS 12
|
||||
# define RC5_16_ROUNDS 16
|
||||
|
||||
typedef struct rc5_key_st {
|
||||
/* Number of rounds */
|
||||
int rounds;
|
||||
RC5_32_INT data[2 * (RC5_16_ROUNDS + 1)];
|
||||
} RC5_32_KEY;
|
||||
|
||||
void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data,
|
||||
int rounds);
|
||||
void RC5_32_ecb_encrypt(const unsigned char *in, unsigned char *out,
|
||||
RC5_32_KEY *key, int enc);
|
||||
void RC5_32_encrypt(unsigned long *data, RC5_32_KEY *key);
|
||||
void RC5_32_decrypt(unsigned long *data, RC5_32_KEY *key);
|
||||
void RC5_32_cbc_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, RC5_32_KEY *ks, unsigned char *iv,
|
||||
int enc);
|
||||
void RC5_32_cfb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, RC5_32_KEY *schedule,
|
||||
unsigned char *ivec, int *num, int enc);
|
||||
void RC5_32_ofb64_encrypt(const unsigned char *in, unsigned char *out,
|
||||
long length, RC5_32_KEY *schedule,
|
||||
unsigned char *ivec, int *num);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
@ -1,103 +1,47 @@
|
||||
/* crypto/ripemd/ripemd.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_RIPEMD_H
|
||||
#define HEADER_RIPEMD_H
|
||||
# define HEADER_RIPEMD_H
|
||||
|
||||
#include <openssl/e_os2.h>
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#ifndef OPENSSL_NO_RMD160
|
||||
# include <openssl/e_os2.h>
|
||||
# include <stddef.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#ifdef OPENSSL_NO_RIPEMD
|
||||
#error RIPEMD is disabled.
|
||||
#endif
|
||||
# define RIPEMD160_LONG unsigned int
|
||||
|
||||
#if defined(OPENSSL_SYS_WIN16) || defined(__LP32__)
|
||||
#define RIPEMD160_LONG unsigned long
|
||||
#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)
|
||||
#define RIPEMD160_LONG unsigned long
|
||||
#define RIPEMD160_LONG_LOG2 3
|
||||
#else
|
||||
#define RIPEMD160_LONG unsigned int
|
||||
#endif
|
||||
# define RIPEMD160_CBLOCK 64
|
||||
# define RIPEMD160_LBLOCK (RIPEMD160_CBLOCK/4)
|
||||
# define RIPEMD160_DIGEST_LENGTH 20
|
||||
|
||||
#define RIPEMD160_CBLOCK 64
|
||||
#define RIPEMD160_LBLOCK (RIPEMD160_CBLOCK/4)
|
||||
#define RIPEMD160_DIGEST_LENGTH 20
|
||||
|
||||
typedef struct RIPEMD160state_st
|
||||
{
|
||||
RIPEMD160_LONG A,B,C,D,E;
|
||||
RIPEMD160_LONG Nl,Nh;
|
||||
RIPEMD160_LONG data[RIPEMD160_LBLOCK];
|
||||
unsigned int num;
|
||||
} RIPEMD160_CTX;
|
||||
typedef struct RIPEMD160state_st {
|
||||
RIPEMD160_LONG A, B, C, D, E;
|
||||
RIPEMD160_LONG Nl, Nh;
|
||||
RIPEMD160_LONG data[RIPEMD160_LBLOCK];
|
||||
unsigned int num;
|
||||
} RIPEMD160_CTX;
|
||||
|
||||
int RIPEMD160_Init(RIPEMD160_CTX *c);
|
||||
int RIPEMD160_Update(RIPEMD160_CTX *c, const void *data, size_t len);
|
||||
int RIPEMD160_Final(unsigned char *md, RIPEMD160_CTX *c);
|
||||
unsigned char *RIPEMD160(const unsigned char *d, size_t n,
|
||||
unsigned char *md);
|
||||
unsigned char *RIPEMD160(const unsigned char *d, size_t n, unsigned char *md);
|
||||
void RIPEMD160_Transform(RIPEMD160_CTX *c, const unsigned char *b);
|
||||
#ifdef __cplusplus
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
# endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@ -1,429 +1,590 @@
|
||||
/* crypto/rsa/rsa.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_RSA_H
|
||||
#define HEADER_RSA_H
|
||||
# define HEADER_RSA_H
|
||||
|
||||
#include <openssl/asn1.h>
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
#ifndef OPENSSL_NO_BIO
|
||||
#include <openssl/bio.h>
|
||||
#endif
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/ossl_typ.h>
|
||||
#ifndef OPENSSL_NO_DEPRECATED
|
||||
#include <openssl/bn.h>
|
||||
#endif
|
||||
|
||||
#ifdef OPENSSL_NO_RSA
|
||||
#error RSA is disabled.
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifndef OPENSSL_NO_RSA
|
||||
# include <openssl/asn1.h>
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/crypto.h>
|
||||
# include <openssl/ossl_typ.h>
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# include <openssl/bn.h>
|
||||
# endif
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
# endif
|
||||
|
||||
/* Declared already in ossl_typ.h */
|
||||
/* typedef struct rsa_st RSA; */
|
||||
/* typedef struct rsa_meth_st RSA_METHOD; */
|
||||
/* The types RSA and RSA_METHOD are defined in ossl_typ.h */
|
||||
|
||||
struct rsa_meth_st
|
||||
{
|
||||
const char *name;
|
||||
int (*rsa_pub_enc)(int flen,const unsigned char *from,
|
||||
unsigned char *to,
|
||||
RSA *rsa,int padding);
|
||||
int (*rsa_pub_dec)(int flen,const unsigned char *from,
|
||||
unsigned char *to,
|
||||
RSA *rsa,int padding);
|
||||
int (*rsa_priv_enc)(int flen,const unsigned char *from,
|
||||
unsigned char *to,
|
||||
RSA *rsa,int padding);
|
||||
int (*rsa_priv_dec)(int flen,const unsigned char *from,
|
||||
unsigned char *to,
|
||||
RSA *rsa,int padding);
|
||||
int (*rsa_mod_exp)(BIGNUM *r0,const BIGNUM *I,RSA *rsa,BN_CTX *ctx); /* Can be null */
|
||||
int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||
const BIGNUM *m, BN_CTX *ctx,
|
||||
BN_MONT_CTX *m_ctx); /* Can be null */
|
||||
int (*init)(RSA *rsa); /* called at new */
|
||||
int (*finish)(RSA *rsa); /* called at free */
|
||||
int flags; /* RSA_METHOD_FLAG_* things */
|
||||
char *app_data; /* may be needed! */
|
||||
/* New sign and verify functions: some libraries don't allow arbitrary data
|
||||
* to be signed/verified: this allows them to be used. Note: for this to work
|
||||
* the RSA_public_decrypt() and RSA_private_encrypt() should *NOT* be used
|
||||
* RSA_sign(), RSA_verify() should be used instead. Note: for backwards
|
||||
* compatibility this functionality is only enabled if the RSA_FLAG_SIGN_VER
|
||||
* option is set in 'flags'.
|
||||
*/
|
||||
int (*rsa_sign)(int type,
|
||||
const unsigned char *m, unsigned int m_length,
|
||||
unsigned char *sigret, unsigned int *siglen, const RSA *rsa);
|
||||
int (*rsa_verify)(int dtype,
|
||||
const unsigned char *m, unsigned int m_length,
|
||||
unsigned char *sigbuf, unsigned int siglen, const RSA *rsa);
|
||||
/* If this callback is NULL, the builtin software RSA key-gen will be used. This
|
||||
* is for behavioural compatibility whilst the code gets rewired, but one day
|
||||
* it would be nice to assume there are no such things as "builtin software"
|
||||
* implementations. */
|
||||
int (*rsa_keygen)(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb);
|
||||
};
|
||||
# ifndef OPENSSL_RSA_MAX_MODULUS_BITS
|
||||
# define OPENSSL_RSA_MAX_MODULUS_BITS 16384
|
||||
# endif
|
||||
|
||||
struct rsa_st
|
||||
{
|
||||
/* The first parameter is used to pickup errors where
|
||||
* this is passed instead of aEVP_PKEY, it is set to 0 */
|
||||
int pad;
|
||||
long version;
|
||||
const RSA_METHOD *meth;
|
||||
/* functional reference if 'meth' is ENGINE-provided */
|
||||
ENGINE *engine;
|
||||
BIGNUM *n;
|
||||
BIGNUM *e;
|
||||
BIGNUM *d;
|
||||
BIGNUM *p;
|
||||
BIGNUM *q;
|
||||
BIGNUM *dmp1;
|
||||
BIGNUM *dmq1;
|
||||
BIGNUM *iqmp;
|
||||
/* be careful using this if the RSA structure is shared */
|
||||
CRYPTO_EX_DATA ex_data;
|
||||
int references;
|
||||
int flags;
|
||||
# define OPENSSL_RSA_FIPS_MIN_MODULUS_BITS 1024
|
||||
|
||||
/* Used to cache montgomery values */
|
||||
BN_MONT_CTX *_method_mod_n;
|
||||
BN_MONT_CTX *_method_mod_p;
|
||||
BN_MONT_CTX *_method_mod_q;
|
||||
# ifndef OPENSSL_RSA_SMALL_MODULUS_BITS
|
||||
# define OPENSSL_RSA_SMALL_MODULUS_BITS 3072
|
||||
# endif
|
||||
# ifndef OPENSSL_RSA_MAX_PUBEXP_BITS
|
||||
|
||||
/* all BIGNUM values are actually in the following data, if it is not
|
||||
* NULL */
|
||||
char *bignum_data;
|
||||
BN_BLINDING *blinding;
|
||||
BN_BLINDING *mt_blinding;
|
||||
};
|
||||
/* exponent limit enforced for "large" modulus only */
|
||||
# define OPENSSL_RSA_MAX_PUBEXP_BITS 64
|
||||
# endif
|
||||
|
||||
#define RSA_3 0x3L
|
||||
#define RSA_F4 0x10001L
|
||||
# define RSA_3 0x3L
|
||||
# define RSA_F4 0x10001L
|
||||
|
||||
#define RSA_METHOD_FLAG_NO_CHECK 0x0001 /* don't check pub/private match */
|
||||
# define RSA_METHOD_FLAG_NO_CHECK 0x0001/* don't check pub/private
|
||||
* match */
|
||||
|
||||
#define RSA_FLAG_CACHE_PUBLIC 0x0002
|
||||
#define RSA_FLAG_CACHE_PRIVATE 0x0004
|
||||
#define RSA_FLAG_BLINDING 0x0008
|
||||
#define RSA_FLAG_THREAD_SAFE 0x0010
|
||||
/* This flag means the private key operations will be handled by rsa_mod_exp
|
||||
# define RSA_FLAG_CACHE_PUBLIC 0x0002
|
||||
# define RSA_FLAG_CACHE_PRIVATE 0x0004
|
||||
# define RSA_FLAG_BLINDING 0x0008
|
||||
# define RSA_FLAG_THREAD_SAFE 0x0010
|
||||
/*
|
||||
* This flag means the private key operations will be handled by rsa_mod_exp
|
||||
* and that they do not depend on the private key components being present:
|
||||
* for example a key stored in external hardware. Without this flag bn_mod_exp
|
||||
* gets called when private key components are absent.
|
||||
* for example a key stored in external hardware. Without this flag
|
||||
* bn_mod_exp gets called when private key components are absent.
|
||||
*/
|
||||
#define RSA_FLAG_EXT_PKEY 0x0020
|
||||
# define RSA_FLAG_EXT_PKEY 0x0020
|
||||
|
||||
/* This flag in the RSA_METHOD enables the new rsa_sign, rsa_verify functions.
|
||||
/*
|
||||
* new with 0.9.6j and 0.9.7b; the built-in
|
||||
* RSA implementation now uses blinding by
|
||||
* default (ignoring RSA_FLAG_BLINDING),
|
||||
* but other engines might not need it
|
||||
*/
|
||||
#define RSA_FLAG_SIGN_VER 0x0040
|
||||
# define RSA_FLAG_NO_BLINDING 0x0080
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
/*
|
||||
* Does nothing. Previously this switched off constant time behaviour.
|
||||
*/
|
||||
# define RSA_FLAG_NO_CONSTTIME 0x0000
|
||||
# endif
|
||||
# if OPENSSL_API_COMPAT < 0x00908000L
|
||||
/* deprecated name for the flag*/
|
||||
/*
|
||||
* new with 0.9.7h; the built-in RSA
|
||||
* implementation now uses constant time
|
||||
* modular exponentiation for secret exponents
|
||||
* by default. This flag causes the
|
||||
* faster variable sliding window method to
|
||||
* be used for all exponents.
|
||||
*/
|
||||
# define RSA_FLAG_NO_EXP_CONSTTIME RSA_FLAG_NO_CONSTTIME
|
||||
# endif
|
||||
|
||||
#define RSA_FLAG_NO_BLINDING 0x0080 /* new with 0.9.6j and 0.9.7b; the built-in
|
||||
* RSA implementation now uses blinding by
|
||||
* default (ignoring RSA_FLAG_BLINDING),
|
||||
* but other engines might not need it
|
||||
*/
|
||||
#define RSA_FLAG_NO_EXP_CONSTTIME 0x0100 /* new with 0.9.7h; the built-in RSA
|
||||
* implementation now uses constant time
|
||||
* modular exponentiation for secret exponents
|
||||
* by default. This flag causes the
|
||||
* faster variable sliding window method to
|
||||
* be used for all exponents.
|
||||
*/
|
||||
# define EVP_PKEY_CTX_set_rsa_padding(ctx, pad) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, -1, EVP_PKEY_CTRL_RSA_PADDING, \
|
||||
pad, NULL)
|
||||
|
||||
#define RSA_PKCS1_PADDING 1
|
||||
#define RSA_SSLV23_PADDING 2
|
||||
#define RSA_NO_PADDING 3
|
||||
#define RSA_PKCS1_OAEP_PADDING 4
|
||||
#define RSA_X931_PADDING 5
|
||||
# define EVP_PKEY_CTX_get_rsa_padding(ctx, ppad) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, -1, \
|
||||
EVP_PKEY_CTRL_GET_RSA_PADDING, 0, ppad)
|
||||
|
||||
#define RSA_PKCS1_PADDING_SIZE 11
|
||||
# define EVP_PKEY_CTX_set_rsa_pss_saltlen(ctx, len) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, \
|
||||
(EVP_PKEY_OP_SIGN|EVP_PKEY_OP_VERIFY), \
|
||||
EVP_PKEY_CTRL_RSA_PSS_SALTLEN, \
|
||||
len, NULL)
|
||||
|
||||
#define RSA_set_app_data(s,arg) RSA_set_ex_data(s,0,arg)
|
||||
#define RSA_get_app_data(s) RSA_get_ex_data(s,0)
|
||||
# define EVP_PKEY_CTX_get_rsa_pss_saltlen(ctx, plen) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, \
|
||||
(EVP_PKEY_OP_SIGN|EVP_PKEY_OP_VERIFY), \
|
||||
EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN, \
|
||||
0, plen)
|
||||
|
||||
RSA * RSA_new(void);
|
||||
RSA * RSA_new_method(ENGINE *engine);
|
||||
int RSA_size(const RSA *);
|
||||
# define EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, bits) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_KEYGEN, \
|
||||
EVP_PKEY_CTRL_RSA_KEYGEN_BITS, bits, NULL)
|
||||
|
||||
# define EVP_PKEY_CTX_set_rsa_keygen_pubexp(ctx, pubexp) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_KEYGEN, \
|
||||
EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP, 0, pubexp)
|
||||
|
||||
# define EVP_PKEY_CTX_set_rsa_mgf1_md(ctx, md) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, \
|
||||
EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT, \
|
||||
EVP_PKEY_CTRL_RSA_MGF1_MD, 0, (void *)md)
|
||||
|
||||
# define EVP_PKEY_CTX_set_rsa_oaep_md(ctx, md) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \
|
||||
EVP_PKEY_CTRL_RSA_OAEP_MD, 0, (void *)md)
|
||||
|
||||
# define EVP_PKEY_CTX_get_rsa_mgf1_md(ctx, pmd) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, \
|
||||
EVP_PKEY_OP_TYPE_SIG | EVP_PKEY_OP_TYPE_CRYPT, \
|
||||
EVP_PKEY_CTRL_GET_RSA_MGF1_MD, 0, (void *)pmd)
|
||||
|
||||
# define EVP_PKEY_CTX_get_rsa_oaep_md(ctx, pmd) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \
|
||||
EVP_PKEY_CTRL_GET_RSA_OAEP_MD, 0, (void *)pmd)
|
||||
|
||||
# define EVP_PKEY_CTX_set0_rsa_oaep_label(ctx, l, llen) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \
|
||||
EVP_PKEY_CTRL_RSA_OAEP_LABEL, llen, (void *)l)
|
||||
|
||||
# define EVP_PKEY_CTX_get0_rsa_oaep_label(ctx, l) \
|
||||
EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_RSA, EVP_PKEY_OP_TYPE_CRYPT, \
|
||||
EVP_PKEY_CTRL_GET_RSA_OAEP_LABEL, 0, (void *)l)
|
||||
|
||||
# define EVP_PKEY_CTRL_RSA_PADDING (EVP_PKEY_ALG_CTRL + 1)
|
||||
# define EVP_PKEY_CTRL_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 2)
|
||||
|
||||
# define EVP_PKEY_CTRL_RSA_KEYGEN_BITS (EVP_PKEY_ALG_CTRL + 3)
|
||||
# define EVP_PKEY_CTRL_RSA_KEYGEN_PUBEXP (EVP_PKEY_ALG_CTRL + 4)
|
||||
# define EVP_PKEY_CTRL_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 5)
|
||||
|
||||
# define EVP_PKEY_CTRL_GET_RSA_PADDING (EVP_PKEY_ALG_CTRL + 6)
|
||||
# define EVP_PKEY_CTRL_GET_RSA_PSS_SALTLEN (EVP_PKEY_ALG_CTRL + 7)
|
||||
# define EVP_PKEY_CTRL_GET_RSA_MGF1_MD (EVP_PKEY_ALG_CTRL + 8)
|
||||
|
||||
# define EVP_PKEY_CTRL_RSA_OAEP_MD (EVP_PKEY_ALG_CTRL + 9)
|
||||
# define EVP_PKEY_CTRL_RSA_OAEP_LABEL (EVP_PKEY_ALG_CTRL + 10)
|
||||
|
||||
# define EVP_PKEY_CTRL_GET_RSA_OAEP_MD (EVP_PKEY_ALG_CTRL + 11)
|
||||
# define EVP_PKEY_CTRL_GET_RSA_OAEP_LABEL (EVP_PKEY_ALG_CTRL + 12)
|
||||
|
||||
# define RSA_PKCS1_PADDING 1
|
||||
# define RSA_SSLV23_PADDING 2
|
||||
# define RSA_NO_PADDING 3
|
||||
# define RSA_PKCS1_OAEP_PADDING 4
|
||||
# define RSA_X931_PADDING 5
|
||||
/* EVP_PKEY_ only */
|
||||
# define RSA_PKCS1_PSS_PADDING 6
|
||||
|
||||
# define RSA_PKCS1_PADDING_SIZE 11
|
||||
|
||||
# define RSA_set_app_data(s,arg) RSA_set_ex_data(s,0,arg)
|
||||
# define RSA_get_app_data(s) RSA_get_ex_data(s,0)
|
||||
|
||||
RSA *RSA_new(void);
|
||||
RSA *RSA_new_method(ENGINE *engine);
|
||||
int RSA_bits(const RSA *rsa);
|
||||
int RSA_size(const RSA *rsa);
|
||||
int RSA_security_bits(const RSA *rsa);
|
||||
|
||||
int RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d);
|
||||
int RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q);
|
||||
int RSA_set0_crt_params(RSA *r,BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp);
|
||||
void RSA_get0_key(const RSA *r,
|
||||
const BIGNUM **n, const BIGNUM **e, const BIGNUM **d);
|
||||
void RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q);
|
||||
void RSA_get0_crt_params(const RSA *r,
|
||||
const BIGNUM **dmp1, const BIGNUM **dmq1,
|
||||
const BIGNUM **iqmp);
|
||||
void RSA_clear_flags(RSA *r, int flags);
|
||||
int RSA_test_flags(const RSA *r, int flags);
|
||||
void RSA_set_flags(RSA *r, int flags);
|
||||
ENGINE *RSA_get0_engine(const RSA *r);
|
||||
|
||||
/* Deprecated version */
|
||||
#ifndef OPENSSL_NO_DEPRECATED
|
||||
RSA * RSA_generate_key(int bits, unsigned long e,void
|
||||
(*callback)(int,int,void *),void *cb_arg);
|
||||
#endif /* !defined(OPENSSL_NO_DEPRECATED) */
|
||||
DEPRECATEDIN_0_9_8(RSA *RSA_generate_key(int bits, unsigned long e, void
|
||||
(*callback) (int, int, void *),
|
||||
void *cb_arg))
|
||||
|
||||
/* New version */
|
||||
int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb);
|
||||
int RSA_generate_key_ex(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb);
|
||||
|
||||
int RSA_check_key(const RSA *);
|
||||
/* next 4 return -1 on error */
|
||||
int RSA_public_encrypt(int flen, const unsigned char *from,
|
||||
unsigned char *to, RSA *rsa,int padding);
|
||||
int RSA_private_encrypt(int flen, const unsigned char *from,
|
||||
unsigned char *to, RSA *rsa,int padding);
|
||||
int RSA_public_decrypt(int flen, const unsigned char *from,
|
||||
unsigned char *to, RSA *rsa,int padding);
|
||||
int RSA_private_decrypt(int flen, const unsigned char *from,
|
||||
unsigned char *to, RSA *rsa,int padding);
|
||||
void RSA_free (RSA *r);
|
||||
int RSA_X931_derive_ex(RSA *rsa, BIGNUM *p1, BIGNUM *p2, BIGNUM *q1,
|
||||
BIGNUM *q2, const BIGNUM *Xp1, const BIGNUM *Xp2,
|
||||
const BIGNUM *Xp, const BIGNUM *Xq1, const BIGNUM *Xq2,
|
||||
const BIGNUM *Xq, const BIGNUM *e, BN_GENCB *cb);
|
||||
int RSA_X931_generate_key_ex(RSA *rsa, int bits, const BIGNUM *e,
|
||||
BN_GENCB *cb);
|
||||
|
||||
int RSA_check_key(const RSA *);
|
||||
int RSA_check_key_ex(const RSA *, BN_GENCB *cb);
|
||||
/* next 4 return -1 on error */
|
||||
int RSA_public_encrypt(int flen, const unsigned char *from,
|
||||
unsigned char *to, RSA *rsa, int padding);
|
||||
int RSA_private_encrypt(int flen, const unsigned char *from,
|
||||
unsigned char *to, RSA *rsa, int padding);
|
||||
int RSA_public_decrypt(int flen, const unsigned char *from,
|
||||
unsigned char *to, RSA *rsa, int padding);
|
||||
int RSA_private_decrypt(int flen, const unsigned char *from,
|
||||
unsigned char *to, RSA *rsa, int padding);
|
||||
void RSA_free(RSA *r);
|
||||
/* "up" the RSA object's reference count */
|
||||
int RSA_up_ref(RSA *r);
|
||||
int RSA_up_ref(RSA *r);
|
||||
|
||||
int RSA_flags(const RSA *r);
|
||||
int RSA_flags(const RSA *r);
|
||||
|
||||
void RSA_set_default_method(const RSA_METHOD *meth);
|
||||
const RSA_METHOD *RSA_get_default_method(void);
|
||||
const RSA_METHOD *RSA_get_method(const RSA *rsa);
|
||||
int RSA_set_method(RSA *rsa, const RSA_METHOD *meth);
|
||||
|
||||
/* This function needs the memory locking malloc callbacks to be installed */
|
||||
int RSA_memory_lock(RSA *r);
|
||||
|
||||
/* these are the actual SSLeay RSA functions */
|
||||
const RSA_METHOD *RSA_PKCS1_SSLeay(void);
|
||||
/* these are the actual RSA functions */
|
||||
const RSA_METHOD *RSA_PKCS1_OpenSSL(void);
|
||||
|
||||
const RSA_METHOD *RSA_null_method(void);
|
||||
|
||||
DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPublicKey)
|
||||
DECLARE_ASN1_ENCODE_FUNCTIONS_const(RSA, RSAPrivateKey)
|
||||
|
||||
#ifndef OPENSSL_NO_FP_API
|
||||
int RSA_print_fp(FILE *fp, const RSA *r,int offset);
|
||||
#endif
|
||||
typedef struct rsa_pss_params_st {
|
||||
X509_ALGOR *hashAlgorithm;
|
||||
X509_ALGOR *maskGenAlgorithm;
|
||||
ASN1_INTEGER *saltLength;
|
||||
ASN1_INTEGER *trailerField;
|
||||
} RSA_PSS_PARAMS;
|
||||
|
||||
#ifndef OPENSSL_NO_BIO
|
||||
int RSA_print(BIO *bp, const RSA *r,int offset);
|
||||
#endif
|
||||
DECLARE_ASN1_FUNCTIONS(RSA_PSS_PARAMS)
|
||||
|
||||
int i2d_RSA_NET(const RSA *a, unsigned char **pp,
|
||||
int (*cb)(char *buf, int len, const char *prompt, int verify),
|
||||
int sgckey);
|
||||
RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length,
|
||||
int (*cb)(char *buf, int len, const char *prompt, int verify),
|
||||
int sgckey);
|
||||
typedef struct rsa_oaep_params_st {
|
||||
X509_ALGOR *hashFunc;
|
||||
X509_ALGOR *maskGenFunc;
|
||||
X509_ALGOR *pSourceFunc;
|
||||
} RSA_OAEP_PARAMS;
|
||||
|
||||
int i2d_Netscape_RSA(const RSA *a, unsigned char **pp,
|
||||
int (*cb)(char *buf, int len, const char *prompt,
|
||||
int verify));
|
||||
RSA *d2i_Netscape_RSA(RSA **a, const unsigned char **pp, long length,
|
||||
int (*cb)(char *buf, int len, const char *prompt,
|
||||
int verify));
|
||||
DECLARE_ASN1_FUNCTIONS(RSA_OAEP_PARAMS)
|
||||
|
||||
/* The following 2 functions sign and verify a X509_SIG ASN1 object
|
||||
* inside PKCS#1 padded RSA encryption */
|
||||
# ifndef OPENSSL_NO_STDIO
|
||||
int RSA_print_fp(FILE *fp, const RSA *r, int offset);
|
||||
# endif
|
||||
|
||||
int RSA_print(BIO *bp, const RSA *r, int offset);
|
||||
|
||||
/*
|
||||
* The following 2 functions sign and verify a X509_SIG ASN1 object inside
|
||||
* PKCS#1 padded RSA encryption
|
||||
*/
|
||||
int RSA_sign(int type, const unsigned char *m, unsigned int m_length,
|
||||
unsigned char *sigret, unsigned int *siglen, RSA *rsa);
|
||||
unsigned char *sigret, unsigned int *siglen, RSA *rsa);
|
||||
int RSA_verify(int type, const unsigned char *m, unsigned int m_length,
|
||||
unsigned char *sigbuf, unsigned int siglen, RSA *rsa);
|
||||
const unsigned char *sigbuf, unsigned int siglen, RSA *rsa);
|
||||
|
||||
/* The following 2 function sign and verify a ASN1_OCTET_STRING
|
||||
* object inside PKCS#1 padded RSA encryption */
|
||||
/*
|
||||
* The following 2 function sign and verify a ASN1_OCTET_STRING object inside
|
||||
* PKCS#1 padded RSA encryption
|
||||
*/
|
||||
int RSA_sign_ASN1_OCTET_STRING(int type,
|
||||
const unsigned char *m, unsigned int m_length,
|
||||
unsigned char *sigret, unsigned int *siglen, RSA *rsa);
|
||||
int RSA_verify_ASN1_OCTET_STRING(int type,
|
||||
const unsigned char *m, unsigned int m_length,
|
||||
unsigned char *sigbuf, unsigned int siglen, RSA *rsa);
|
||||
const unsigned char *m, unsigned int m_length,
|
||||
unsigned char *sigret, unsigned int *siglen,
|
||||
RSA *rsa);
|
||||
int RSA_verify_ASN1_OCTET_STRING(int type, const unsigned char *m,
|
||||
unsigned int m_length, unsigned char *sigbuf,
|
||||
unsigned int siglen, RSA *rsa);
|
||||
|
||||
int RSA_blinding_on(RSA *rsa, BN_CTX *ctx);
|
||||
void RSA_blinding_off(RSA *rsa);
|
||||
BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *ctx);
|
||||
|
||||
int RSA_padding_add_PKCS1_type_1(unsigned char *to,int tlen,
|
||||
const unsigned char *f,int fl);
|
||||
int RSA_padding_check_PKCS1_type_1(unsigned char *to,int tlen,
|
||||
const unsigned char *f,int fl,int rsa_len);
|
||||
int RSA_padding_add_PKCS1_type_2(unsigned char *to,int tlen,
|
||||
const unsigned char *f,int fl);
|
||||
int RSA_padding_check_PKCS1_type_2(unsigned char *to,int tlen,
|
||||
const unsigned char *f,int fl,int rsa_len);
|
||||
int PKCS1_MGF1(unsigned char *mask, long len,
|
||||
const unsigned char *seed, long seedlen, const EVP_MD *dgst);
|
||||
int RSA_padding_add_PKCS1_OAEP(unsigned char *to,int tlen,
|
||||
const unsigned char *f,int fl,
|
||||
const unsigned char *p,int pl);
|
||||
int RSA_padding_check_PKCS1_OAEP(unsigned char *to,int tlen,
|
||||
const unsigned char *f,int fl,int rsa_len,
|
||||
const unsigned char *p,int pl);
|
||||
int RSA_padding_add_SSLv23(unsigned char *to,int tlen,
|
||||
const unsigned char *f,int fl);
|
||||
int RSA_padding_check_SSLv23(unsigned char *to,int tlen,
|
||||
const unsigned char *f,int fl,int rsa_len);
|
||||
int RSA_padding_add_none(unsigned char *to,int tlen,
|
||||
const unsigned char *f,int fl);
|
||||
int RSA_padding_check_none(unsigned char *to,int tlen,
|
||||
const unsigned char *f,int fl,int rsa_len);
|
||||
int RSA_padding_add_X931(unsigned char *to,int tlen,
|
||||
const unsigned char *f,int fl);
|
||||
int RSA_padding_check_X931(unsigned char *to,int tlen,
|
||||
const unsigned char *f,int fl,int rsa_len);
|
||||
int RSA_padding_add_PKCS1_type_1(unsigned char *to, int tlen,
|
||||
const unsigned char *f, int fl);
|
||||
int RSA_padding_check_PKCS1_type_1(unsigned char *to, int tlen,
|
||||
const unsigned char *f, int fl,
|
||||
int rsa_len);
|
||||
int RSA_padding_add_PKCS1_type_2(unsigned char *to, int tlen,
|
||||
const unsigned char *f, int fl);
|
||||
int RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen,
|
||||
const unsigned char *f, int fl,
|
||||
int rsa_len);
|
||||
int PKCS1_MGF1(unsigned char *mask, long len, const unsigned char *seed,
|
||||
long seedlen, const EVP_MD *dgst);
|
||||
int RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen,
|
||||
const unsigned char *f, int fl,
|
||||
const unsigned char *p, int pl);
|
||||
int RSA_padding_check_PKCS1_OAEP(unsigned char *to, int tlen,
|
||||
const unsigned char *f, int fl, int rsa_len,
|
||||
const unsigned char *p, int pl);
|
||||
int RSA_padding_add_PKCS1_OAEP_mgf1(unsigned char *to, int tlen,
|
||||
const unsigned char *from, int flen,
|
||||
const unsigned char *param, int plen,
|
||||
const EVP_MD *md, const EVP_MD *mgf1md);
|
||||
int RSA_padding_check_PKCS1_OAEP_mgf1(unsigned char *to, int tlen,
|
||||
const unsigned char *from, int flen,
|
||||
int num, const unsigned char *param,
|
||||
int plen, const EVP_MD *md,
|
||||
const EVP_MD *mgf1md);
|
||||
int RSA_padding_add_SSLv23(unsigned char *to, int tlen,
|
||||
const unsigned char *f, int fl);
|
||||
int RSA_padding_check_SSLv23(unsigned char *to, int tlen,
|
||||
const unsigned char *f, int fl, int rsa_len);
|
||||
int RSA_padding_add_none(unsigned char *to, int tlen, const unsigned char *f,
|
||||
int fl);
|
||||
int RSA_padding_check_none(unsigned char *to, int tlen,
|
||||
const unsigned char *f, int fl, int rsa_len);
|
||||
int RSA_padding_add_X931(unsigned char *to, int tlen, const unsigned char *f,
|
||||
int fl);
|
||||
int RSA_padding_check_X931(unsigned char *to, int tlen,
|
||||
const unsigned char *f, int fl, int rsa_len);
|
||||
int RSA_X931_hash_id(int nid);
|
||||
|
||||
int RSA_verify_PKCS1_PSS(RSA *rsa, const unsigned char *mHash,
|
||||
const EVP_MD *Hash, const unsigned char *EM, int sLen);
|
||||
const EVP_MD *Hash, const unsigned char *EM,
|
||||
int sLen);
|
||||
int RSA_padding_add_PKCS1_PSS(RSA *rsa, unsigned char *EM,
|
||||
const unsigned char *mHash,
|
||||
const EVP_MD *Hash, int sLen);
|
||||
const unsigned char *mHash, const EVP_MD *Hash,
|
||||
int sLen);
|
||||
|
||||
int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
|
||||
CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
|
||||
int RSA_set_ex_data(RSA *r,int idx,void *arg);
|
||||
int RSA_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash,
|
||||
const EVP_MD *Hash, const EVP_MD *mgf1Hash,
|
||||
const unsigned char *EM, int sLen);
|
||||
|
||||
int RSA_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM,
|
||||
const unsigned char *mHash,
|
||||
const EVP_MD *Hash, const EVP_MD *mgf1Hash,
|
||||
int sLen);
|
||||
|
||||
#define RSA_get_ex_new_index(l, p, newf, dupf, freef) \
|
||||
CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_RSA, l, p, newf, dupf, freef)
|
||||
int RSA_set_ex_data(RSA *r, int idx, void *arg);
|
||||
void *RSA_get_ex_data(const RSA *r, int idx);
|
||||
|
||||
RSA *RSAPublicKey_dup(RSA *rsa);
|
||||
RSA *RSAPrivateKey_dup(RSA *rsa);
|
||||
|
||||
/*
|
||||
* If this flag is set the RSA method is FIPS compliant and can be used in
|
||||
* FIPS mode. This is set in the validated module method. If an application
|
||||
* sets this flag in its own methods it is its responsibility to ensure the
|
||||
* result is compliant.
|
||||
*/
|
||||
|
||||
# define RSA_FLAG_FIPS_METHOD 0x0400
|
||||
|
||||
/*
|
||||
* If this flag is set the operations normally disabled in FIPS mode are
|
||||
* permitted it is then the applications responsibility to ensure that the
|
||||
* usage is compliant.
|
||||
*/
|
||||
|
||||
# define RSA_FLAG_NON_FIPS_ALLOW 0x0400
|
||||
/*
|
||||
* Application has decided PRNG is good enough to generate a key: don't
|
||||
* check.
|
||||
*/
|
||||
# define RSA_FLAG_CHECKED 0x0800
|
||||
|
||||
RSA_METHOD *RSA_meth_new(const char *name, int flags);
|
||||
void RSA_meth_free(RSA_METHOD *meth);
|
||||
RSA_METHOD *RSA_meth_dup(const RSA_METHOD *meth);
|
||||
const char *RSA_meth_get0_name(const RSA_METHOD *meth);
|
||||
int RSA_meth_set1_name(RSA_METHOD *meth, const char *name);
|
||||
int RSA_meth_get_flags(RSA_METHOD *meth);
|
||||
int RSA_meth_set_flags(RSA_METHOD *meth, int flags);
|
||||
void *RSA_meth_get0_app_data(const RSA_METHOD *meth);
|
||||
int RSA_meth_set0_app_data(RSA_METHOD *meth, void *app_data);
|
||||
int (*RSA_meth_get_pub_enc(const RSA_METHOD *meth))
|
||||
(int flen, const unsigned char *from,
|
||||
unsigned char *to, RSA *rsa, int padding);
|
||||
int RSA_meth_set_pub_enc(RSA_METHOD *rsa,
|
||||
int (*pub_enc) (int flen, const unsigned char *from,
|
||||
unsigned char *to, RSA *rsa,
|
||||
int padding));
|
||||
int (*RSA_meth_get_pub_dec(const RSA_METHOD *meth))
|
||||
(int flen, const unsigned char *from,
|
||||
unsigned char *to, RSA *rsa, int padding);
|
||||
int RSA_meth_set_pub_dec(RSA_METHOD *rsa,
|
||||
int (*pub_dec) (int flen, const unsigned char *from,
|
||||
unsigned char *to, RSA *rsa,
|
||||
int padding));
|
||||
int (*RSA_meth_get_priv_enc(const RSA_METHOD *meth))
|
||||
(int flen, const unsigned char *from,
|
||||
unsigned char *to, RSA *rsa, int padding);
|
||||
int RSA_meth_set_priv_enc(RSA_METHOD *rsa,
|
||||
int (*priv_enc) (int flen, const unsigned char *from,
|
||||
unsigned char *to, RSA *rsa,
|
||||
int padding));
|
||||
int (*RSA_meth_get_priv_dec(const RSA_METHOD *meth))
|
||||
(int flen, const unsigned char *from,
|
||||
unsigned char *to, RSA *rsa, int padding);
|
||||
int RSA_meth_set_priv_dec(RSA_METHOD *rsa,
|
||||
int (*priv_dec) (int flen, const unsigned char *from,
|
||||
unsigned char *to, RSA *rsa,
|
||||
int padding));
|
||||
int (*RSA_meth_get_mod_exp(const RSA_METHOD *meth))
|
||||
(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx);
|
||||
int RSA_meth_set_mod_exp(RSA_METHOD *rsa,
|
||||
int (*mod_exp) (BIGNUM *r0, const BIGNUM *I, RSA *rsa,
|
||||
BN_CTX *ctx));
|
||||
int (*RSA_meth_get_bn_mod_exp(const RSA_METHOD *meth))
|
||||
(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
|
||||
const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
|
||||
int RSA_meth_set_bn_mod_exp(RSA_METHOD *rsa,
|
||||
int (*bn_mod_exp) (BIGNUM *r,
|
||||
const BIGNUM *a,
|
||||
const BIGNUM *p,
|
||||
const BIGNUM *m,
|
||||
BN_CTX *ctx,
|
||||
BN_MONT_CTX *m_ctx));
|
||||
int (*RSA_meth_get_init(const RSA_METHOD *meth)) (RSA *rsa);
|
||||
int RSA_meth_set_init(RSA_METHOD *rsa, int (*init) (RSA *rsa));
|
||||
int (*RSA_meth_get_finish(const RSA_METHOD *meth)) (RSA *rsa);
|
||||
int RSA_meth_set_finish(RSA_METHOD *rsa, int (*finish) (RSA *rsa));
|
||||
int (*RSA_meth_get_sign(const RSA_METHOD *meth))
|
||||
(int type,
|
||||
const unsigned char *m, unsigned int m_length,
|
||||
unsigned char *sigret, unsigned int *siglen,
|
||||
const RSA *rsa);
|
||||
int RSA_meth_set_sign(RSA_METHOD *rsa,
|
||||
int (*sign) (int type, const unsigned char *m,
|
||||
unsigned int m_length,
|
||||
unsigned char *sigret, unsigned int *siglen,
|
||||
const RSA *rsa));
|
||||
int (*RSA_meth_get_verify(const RSA_METHOD *meth))
|
||||
(int dtype, const unsigned char *m,
|
||||
unsigned int m_length, const unsigned char *sigbuf,
|
||||
unsigned int siglen, const RSA *rsa);
|
||||
int RSA_meth_set_verify(RSA_METHOD *rsa,
|
||||
int (*verify) (int dtype, const unsigned char *m,
|
||||
unsigned int m_length,
|
||||
const unsigned char *sigbuf,
|
||||
unsigned int siglen, const RSA *rsa));
|
||||
int (*RSA_meth_get_keygen(const RSA_METHOD *meth))
|
||||
(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb);
|
||||
int RSA_meth_set_keygen(RSA_METHOD *rsa,
|
||||
int (*keygen) (RSA *rsa, int bits, BIGNUM *e,
|
||||
BN_GENCB *cb));
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
/*
|
||||
* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
void ERR_load_RSA_strings(void);
|
||||
|
||||
int ERR_load_RSA_strings(void);
|
||||
|
||||
/* Error codes for the RSA functions. */
|
||||
|
||||
/* Function codes. */
|
||||
#define RSA_F_MEMORY_LOCK 100
|
||||
#define RSA_F_RSA_BUILTIN_KEYGEN 129
|
||||
#define RSA_F_RSA_CHECK_KEY 123
|
||||
#define RSA_F_RSA_EAY_PRIVATE_DECRYPT 101
|
||||
#define RSA_F_RSA_EAY_PRIVATE_ENCRYPT 102
|
||||
#define RSA_F_RSA_EAY_PUBLIC_DECRYPT 103
|
||||
#define RSA_F_RSA_EAY_PUBLIC_ENCRYPT 104
|
||||
#define RSA_F_RSA_GENERATE_KEY 105
|
||||
#define RSA_F_RSA_MEMORY_LOCK 130
|
||||
#define RSA_F_RSA_NEW_METHOD 106
|
||||
#define RSA_F_RSA_NULL 124
|
||||
#define RSA_F_RSA_NULL_MOD_EXP 131
|
||||
#define RSA_F_RSA_NULL_PRIVATE_DECRYPT 132
|
||||
#define RSA_F_RSA_NULL_PRIVATE_ENCRYPT 133
|
||||
#define RSA_F_RSA_NULL_PUBLIC_DECRYPT 134
|
||||
#define RSA_F_RSA_NULL_PUBLIC_ENCRYPT 135
|
||||
#define RSA_F_RSA_PADDING_ADD_NONE 107
|
||||
#define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP 121
|
||||
#define RSA_F_RSA_PADDING_ADD_PKCS1_PSS 125
|
||||
#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1 108
|
||||
#define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2 109
|
||||
#define RSA_F_RSA_PADDING_ADD_SSLV23 110
|
||||
#define RSA_F_RSA_PADDING_ADD_X931 127
|
||||
#define RSA_F_RSA_PADDING_CHECK_NONE 111
|
||||
#define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP 122
|
||||
#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1 112
|
||||
#define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2 113
|
||||
#define RSA_F_RSA_PADDING_CHECK_SSLV23 114
|
||||
#define RSA_F_RSA_PADDING_CHECK_X931 128
|
||||
#define RSA_F_RSA_PRINT 115
|
||||
#define RSA_F_RSA_PRINT_FP 116
|
||||
#define RSA_F_RSA_SETUP_BLINDING 136
|
||||
#define RSA_F_RSA_SIGN 117
|
||||
#define RSA_F_RSA_SIGN_ASN1_OCTET_STRING 118
|
||||
#define RSA_F_RSA_VERIFY 119
|
||||
#define RSA_F_RSA_VERIFY_ASN1_OCTET_STRING 120
|
||||
#define RSA_F_RSA_VERIFY_PKCS1_PSS 126
|
||||
# define RSA_F_CHECK_PADDING_MD 140
|
||||
# define RSA_F_ENCODE_PKCS1 146
|
||||
# define RSA_F_INT_RSA_VERIFY 145
|
||||
# define RSA_F_OLD_RSA_PRIV_DECODE 147
|
||||
# define RSA_F_PKEY_RSA_CTRL 143
|
||||
# define RSA_F_PKEY_RSA_CTRL_STR 144
|
||||
# define RSA_F_PKEY_RSA_SIGN 142
|
||||
# define RSA_F_PKEY_RSA_VERIFY 149
|
||||
# define RSA_F_PKEY_RSA_VERIFYRECOVER 141
|
||||
# define RSA_F_RSA_ALGOR_TO_MD 156
|
||||
# define RSA_F_RSA_BUILTIN_KEYGEN 129
|
||||
# define RSA_F_RSA_CHECK_KEY 123
|
||||
# define RSA_F_RSA_CHECK_KEY_EX 160
|
||||
# define RSA_F_RSA_CMS_DECRYPT 159
|
||||
# define RSA_F_RSA_ITEM_VERIFY 148
|
||||
# define RSA_F_RSA_METH_DUP 161
|
||||
# define RSA_F_RSA_METH_NEW 162
|
||||
# define RSA_F_RSA_METH_SET1_NAME 163
|
||||
# define RSA_F_RSA_MGF1_TO_MD 157
|
||||
# define RSA_F_RSA_NEW_METHOD 106
|
||||
# define RSA_F_RSA_NULL 124
|
||||
# define RSA_F_RSA_NULL_PRIVATE_DECRYPT 132
|
||||
# define RSA_F_RSA_NULL_PRIVATE_ENCRYPT 133
|
||||
# define RSA_F_RSA_NULL_PUBLIC_DECRYPT 134
|
||||
# define RSA_F_RSA_NULL_PUBLIC_ENCRYPT 135
|
||||
# define RSA_F_RSA_OSSL_PRIVATE_DECRYPT 101
|
||||
# define RSA_F_RSA_OSSL_PRIVATE_ENCRYPT 102
|
||||
# define RSA_F_RSA_OSSL_PUBLIC_DECRYPT 103
|
||||
# define RSA_F_RSA_OSSL_PUBLIC_ENCRYPT 104
|
||||
# define RSA_F_RSA_PADDING_ADD_NONE 107
|
||||
# define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP 121
|
||||
# define RSA_F_RSA_PADDING_ADD_PKCS1_OAEP_MGF1 154
|
||||
# define RSA_F_RSA_PADDING_ADD_PKCS1_PSS 125
|
||||
# define RSA_F_RSA_PADDING_ADD_PKCS1_PSS_MGF1 152
|
||||
# define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_1 108
|
||||
# define RSA_F_RSA_PADDING_ADD_PKCS1_TYPE_2 109
|
||||
# define RSA_F_RSA_PADDING_ADD_SSLV23 110
|
||||
# define RSA_F_RSA_PADDING_ADD_X931 127
|
||||
# define RSA_F_RSA_PADDING_CHECK_NONE 111
|
||||
# define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP 122
|
||||
# define RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP_MGF1 153
|
||||
# define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_1 112
|
||||
# define RSA_F_RSA_PADDING_CHECK_PKCS1_TYPE_2 113
|
||||
# define RSA_F_RSA_PADDING_CHECK_SSLV23 114
|
||||
# define RSA_F_RSA_PADDING_CHECK_X931 128
|
||||
# define RSA_F_RSA_PRINT 115
|
||||
# define RSA_F_RSA_PRINT_FP 116
|
||||
# define RSA_F_RSA_PRIV_ENCODE 138
|
||||
# define RSA_F_RSA_PSS_TO_CTX 155
|
||||
# define RSA_F_RSA_PUB_DECODE 139
|
||||
# define RSA_F_RSA_SETUP_BLINDING 136
|
||||
# define RSA_F_RSA_SIGN 117
|
||||
# define RSA_F_RSA_SIGN_ASN1_OCTET_STRING 118
|
||||
# define RSA_F_RSA_VERIFY 119
|
||||
# define RSA_F_RSA_VERIFY_ASN1_OCTET_STRING 120
|
||||
# define RSA_F_RSA_VERIFY_PKCS1_PSS_MGF1 126
|
||||
|
||||
/* Reason codes. */
|
||||
#define RSA_R_ALGORITHM_MISMATCH 100
|
||||
#define RSA_R_BAD_E_VALUE 101
|
||||
#define RSA_R_BAD_FIXED_HEADER_DECRYPT 102
|
||||
#define RSA_R_BAD_PAD_BYTE_COUNT 103
|
||||
#define RSA_R_BAD_SIGNATURE 104
|
||||
#define RSA_R_BLOCK_TYPE_IS_NOT_01 106
|
||||
#define RSA_R_BLOCK_TYPE_IS_NOT_02 107
|
||||
#define RSA_R_DATA_GREATER_THAN_MOD_LEN 108
|
||||
#define RSA_R_DATA_TOO_LARGE 109
|
||||
#define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 110
|
||||
#define RSA_R_DATA_TOO_LARGE_FOR_MODULUS 132
|
||||
#define RSA_R_DATA_TOO_SMALL 111
|
||||
#define RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE 122
|
||||
#define RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY 112
|
||||
#define RSA_R_DMP1_NOT_CONGRUENT_TO_D 124
|
||||
#define RSA_R_DMQ1_NOT_CONGRUENT_TO_D 125
|
||||
#define RSA_R_D_E_NOT_CONGRUENT_TO_1 123
|
||||
#define RSA_R_FIRST_OCTET_INVALID 133
|
||||
#define RSA_R_INVALID_HEADER 137
|
||||
#define RSA_R_INVALID_MESSAGE_LENGTH 131
|
||||
#define RSA_R_INVALID_PADDING 138
|
||||
#define RSA_R_INVALID_TRAILER 139
|
||||
#define RSA_R_IQMP_NOT_INVERSE_OF_Q 126
|
||||
#define RSA_R_KEY_SIZE_TOO_SMALL 120
|
||||
#define RSA_R_LAST_OCTET_INVALID 134
|
||||
#define RSA_R_NO_PUBLIC_EXPONENT 140
|
||||
#define RSA_R_NULL_BEFORE_BLOCK_MISSING 113
|
||||
#define RSA_R_N_DOES_NOT_EQUAL_P_Q 127
|
||||
#define RSA_R_OAEP_DECODING_ERROR 121
|
||||
#define RSA_R_PADDING_CHECK_FAILED 114
|
||||
#define RSA_R_P_NOT_PRIME 128
|
||||
#define RSA_R_Q_NOT_PRIME 129
|
||||
#define RSA_R_RSA_OPERATIONS_NOT_SUPPORTED 130
|
||||
#define RSA_R_SLEN_CHECK_FAILED 136
|
||||
#define RSA_R_SLEN_RECOVERY_FAILED 135
|
||||
#define RSA_R_SSLV3_ROLLBACK_ATTACK 115
|
||||
#define RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 116
|
||||
#define RSA_R_UNKNOWN_ALGORITHM_TYPE 117
|
||||
#define RSA_R_UNKNOWN_PADDING_TYPE 118
|
||||
#define RSA_R_WRONG_SIGNATURE_LENGTH 119
|
||||
# define RSA_R_ALGORITHM_MISMATCH 100
|
||||
# define RSA_R_BAD_E_VALUE 101
|
||||
# define RSA_R_BAD_FIXED_HEADER_DECRYPT 102
|
||||
# define RSA_R_BAD_PAD_BYTE_COUNT 103
|
||||
# define RSA_R_BAD_SIGNATURE 104
|
||||
# define RSA_R_BLOCK_TYPE_IS_NOT_01 106
|
||||
# define RSA_R_BLOCK_TYPE_IS_NOT_02 107
|
||||
# define RSA_R_DATA_GREATER_THAN_MOD_LEN 108
|
||||
# define RSA_R_DATA_TOO_LARGE 109
|
||||
# define RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE 110
|
||||
# define RSA_R_DATA_TOO_LARGE_FOR_MODULUS 132
|
||||
# define RSA_R_DATA_TOO_SMALL 111
|
||||
# define RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE 122
|
||||
# define RSA_R_DIGEST_DOES_NOT_MATCH 158
|
||||
# define RSA_R_DIGEST_TOO_BIG_FOR_RSA_KEY 112
|
||||
# define RSA_R_DMP1_NOT_CONGRUENT_TO_D 124
|
||||
# define RSA_R_DMQ1_NOT_CONGRUENT_TO_D 125
|
||||
# define RSA_R_D_E_NOT_CONGRUENT_TO_1 123
|
||||
# define RSA_R_FIRST_OCTET_INVALID 133
|
||||
# define RSA_R_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE 144
|
||||
# define RSA_R_INVALID_DIGEST 157
|
||||
# define RSA_R_INVALID_DIGEST_LENGTH 143
|
||||
# define RSA_R_INVALID_HEADER 137
|
||||
# define RSA_R_INVALID_LABEL 160
|
||||
# define RSA_R_INVALID_MESSAGE_LENGTH 131
|
||||
# define RSA_R_INVALID_MGF1_MD 156
|
||||
# define RSA_R_INVALID_OAEP_PARAMETERS 161
|
||||
# define RSA_R_INVALID_PADDING 138
|
||||
# define RSA_R_INVALID_PADDING_MODE 141
|
||||
# define RSA_R_INVALID_PSS_PARAMETERS 149
|
||||
# define RSA_R_INVALID_PSS_SALTLEN 146
|
||||
# define RSA_R_INVALID_SALT_LENGTH 150
|
||||
# define RSA_R_INVALID_TRAILER 139
|
||||
# define RSA_R_INVALID_X931_DIGEST 142
|
||||
# define RSA_R_IQMP_NOT_INVERSE_OF_Q 126
|
||||
# define RSA_R_KEY_SIZE_TOO_SMALL 120
|
||||
# define RSA_R_LAST_OCTET_INVALID 134
|
||||
# define RSA_R_MODULUS_TOO_LARGE 105
|
||||
# define RSA_R_NO_PUBLIC_EXPONENT 140
|
||||
# define RSA_R_NULL_BEFORE_BLOCK_MISSING 113
|
||||
# define RSA_R_N_DOES_NOT_EQUAL_P_Q 127
|
||||
# define RSA_R_OAEP_DECODING_ERROR 121
|
||||
# define RSA_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE 148
|
||||
# define RSA_R_PADDING_CHECK_FAILED 114
|
||||
# define RSA_R_PKCS_DECODING_ERROR 159
|
||||
# define RSA_R_P_NOT_PRIME 128
|
||||
# define RSA_R_Q_NOT_PRIME 129
|
||||
# define RSA_R_RSA_OPERATIONS_NOT_SUPPORTED 130
|
||||
# define RSA_R_SLEN_CHECK_FAILED 136
|
||||
# define RSA_R_SLEN_RECOVERY_FAILED 135
|
||||
# define RSA_R_SSLV3_ROLLBACK_ATTACK 115
|
||||
# define RSA_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 116
|
||||
# define RSA_R_UNKNOWN_ALGORITHM_TYPE 117
|
||||
# define RSA_R_UNKNOWN_DIGEST 166
|
||||
# define RSA_R_UNKNOWN_MASK_DIGEST 151
|
||||
# define RSA_R_UNKNOWN_PADDING_TYPE 118
|
||||
# define RSA_R_UNSUPPORTED_ENCRYPTION_TYPE 162
|
||||
# define RSA_R_UNSUPPORTED_LABEL_SOURCE 163
|
||||
# define RSA_R_UNSUPPORTED_MASK_ALGORITHM 153
|
||||
# define RSA_R_UNSUPPORTED_MASK_PARAMETER 154
|
||||
# define RSA_R_UNSUPPORTED_SIGNATURE_TYPE 155
|
||||
# define RSA_R_VALUE_MISSING 147
|
||||
# define RSA_R_WRONG_SIGNATURE_LENGTH 119
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
98
src/dep/include/openssl/seed.h
Normal file
98
src/dep/include/openssl/seed.h
Normal file
@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright 2007-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 KISA(Korea Information Security Agency). All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Neither the name of author nor the names of its contributors may
|
||||
* be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef HEADER_SEED_H
|
||||
# define HEADER_SEED_H
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_SEED
|
||||
# include <openssl/e_os2.h>
|
||||
# include <openssl/crypto.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* look whether we need 'long' to get 32 bits */
|
||||
# ifdef AES_LONG
|
||||
# ifndef SEED_LONG
|
||||
# define SEED_LONG 1
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# if !defined(NO_SYS_TYPES_H)
|
||||
# include <sys/types.h>
|
||||
# endif
|
||||
|
||||
# define SEED_BLOCK_SIZE 16
|
||||
# define SEED_KEY_LENGTH 16
|
||||
|
||||
typedef struct seed_key_st {
|
||||
# ifdef SEED_LONG
|
||||
unsigned long data[32];
|
||||
# else
|
||||
unsigned int data[32];
|
||||
# endif
|
||||
} SEED_KEY_SCHEDULE;
|
||||
|
||||
void SEED_set_key(const unsigned char rawkey[SEED_KEY_LENGTH],
|
||||
SEED_KEY_SCHEDULE *ks);
|
||||
|
||||
void SEED_encrypt(const unsigned char s[SEED_BLOCK_SIZE],
|
||||
unsigned char d[SEED_BLOCK_SIZE],
|
||||
const SEED_KEY_SCHEDULE *ks);
|
||||
void SEED_decrypt(const unsigned char s[SEED_BLOCK_SIZE],
|
||||
unsigned char d[SEED_BLOCK_SIZE],
|
||||
const SEED_KEY_SCHEDULE *ks);
|
||||
|
||||
void SEED_ecb_encrypt(const unsigned char *in, unsigned char *out,
|
||||
const SEED_KEY_SCHEDULE *ks, int enc);
|
||||
void SEED_cbc_encrypt(const unsigned char *in, unsigned char *out, size_t len,
|
||||
const SEED_KEY_SCHEDULE *ks,
|
||||
unsigned char ivec[SEED_BLOCK_SIZE], int enc);
|
||||
void SEED_cfb128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const SEED_KEY_SCHEDULE *ks,
|
||||
unsigned char ivec[SEED_BLOCK_SIZE], int *num,
|
||||
int enc);
|
||||
void SEED_ofb128_encrypt(const unsigned char *in, unsigned char *out,
|
||||
size_t len, const SEED_KEY_SCHEDULE *ks,
|
||||
unsigned char ivec[SEED_BLOCK_SIZE], int *num);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
@ -1,196 +1,116 @@
|
||||
/* crypto/sha/sha.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_SHA_H
|
||||
#define HEADER_SHA_H
|
||||
# define HEADER_SHA_H
|
||||
|
||||
#include <openssl/e_os2.h>
|
||||
# include <openssl/e_os2.h>
|
||||
# include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(OPENSSL_NO_SHA) || (defined(OPENSSL_NO_SHA0) && defined(OPENSSL_NO_SHA1))
|
||||
#error SHA is disabled.
|
||||
#endif
|
||||
|
||||
#if defined(OPENSSL_FIPS)
|
||||
#define FIPS_SHA_SIZE_T size_t
|
||||
#endif
|
||||
|
||||
/*
|
||||
/*-
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
* ! SHA_LONG has to be at least 32 bits wide. If it's wider, then !
|
||||
* ! SHA_LONG_LOG2 has to be defined along. !
|
||||
* ! SHA_LONG has to be at least 32 bits wide. !
|
||||
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
*/
|
||||
# define SHA_LONG unsigned int
|
||||
|
||||
#if defined(OPENSSL_SYS_WIN16) || defined(__LP32__)
|
||||
#define SHA_LONG unsigned long
|
||||
#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__)
|
||||
#define SHA_LONG unsigned long
|
||||
#define SHA_LONG_LOG2 3
|
||||
#else
|
||||
#define SHA_LONG unsigned int
|
||||
#endif
|
||||
# define SHA_LBLOCK 16
|
||||
# define SHA_CBLOCK (SHA_LBLOCK*4)/* SHA treats input data as a
|
||||
* contiguous array of 32 bit wide
|
||||
* big-endian values. */
|
||||
# define SHA_LAST_BLOCK (SHA_CBLOCK-8)
|
||||
# define SHA_DIGEST_LENGTH 20
|
||||
|
||||
#define SHA_LBLOCK 16
|
||||
#define SHA_CBLOCK (SHA_LBLOCK*4) /* SHA treats input data as a
|
||||
* contiguous array of 32 bit
|
||||
* wide big-endian values. */
|
||||
#define SHA_LAST_BLOCK (SHA_CBLOCK-8)
|
||||
#define SHA_DIGEST_LENGTH 20
|
||||
typedef struct SHAstate_st {
|
||||
SHA_LONG h0, h1, h2, h3, h4;
|
||||
SHA_LONG Nl, Nh;
|
||||
SHA_LONG data[SHA_LBLOCK];
|
||||
unsigned int num;
|
||||
} SHA_CTX;
|
||||
|
||||
typedef struct SHAstate_st
|
||||
{
|
||||
SHA_LONG h0,h1,h2,h3,h4;
|
||||
SHA_LONG Nl,Nh;
|
||||
SHA_LONG data[SHA_LBLOCK];
|
||||
unsigned int num;
|
||||
} SHA_CTX;
|
||||
|
||||
#ifndef OPENSSL_NO_SHA0
|
||||
int SHA_Init(SHA_CTX *c);
|
||||
int SHA_Update(SHA_CTX *c, const void *data, size_t len);
|
||||
int SHA_Final(unsigned char *md, SHA_CTX *c);
|
||||
unsigned char *SHA(const unsigned char *d, size_t n, unsigned char *md);
|
||||
void SHA_Transform(SHA_CTX *c, const unsigned char *data);
|
||||
#endif
|
||||
#ifndef OPENSSL_NO_SHA1
|
||||
int SHA1_Init(SHA_CTX *c);
|
||||
int SHA1_Update(SHA_CTX *c, const void *data, size_t len);
|
||||
int SHA1_Final(unsigned char *md, SHA_CTX *c);
|
||||
unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md);
|
||||
void SHA1_Transform(SHA_CTX *c, const unsigned char *data);
|
||||
#endif
|
||||
|
||||
#define SHA256_CBLOCK (SHA_LBLOCK*4) /* SHA-256 treats input data as a
|
||||
* contiguous array of 32 bit
|
||||
* wide big-endian values. */
|
||||
#define SHA224_DIGEST_LENGTH 28
|
||||
#define SHA256_DIGEST_LENGTH 32
|
||||
# define SHA256_CBLOCK (SHA_LBLOCK*4)/* SHA-256 treats input data as a
|
||||
* contiguous array of 32 bit wide
|
||||
* big-endian values. */
|
||||
|
||||
typedef struct SHA256state_st
|
||||
{
|
||||
SHA_LONG h[8];
|
||||
SHA_LONG Nl,Nh;
|
||||
SHA_LONG data[SHA_LBLOCK];
|
||||
unsigned int num,md_len;
|
||||
} SHA256_CTX;
|
||||
typedef struct SHA256state_st {
|
||||
SHA_LONG h[8];
|
||||
SHA_LONG Nl, Nh;
|
||||
SHA_LONG data[SHA_LBLOCK];
|
||||
unsigned int num, md_len;
|
||||
} SHA256_CTX;
|
||||
|
||||
#ifndef OPENSSL_NO_SHA256
|
||||
int SHA224_Init(SHA256_CTX *c);
|
||||
int SHA224_Update(SHA256_CTX *c, const void *data, size_t len);
|
||||
int SHA224_Final(unsigned char *md, SHA256_CTX *c);
|
||||
unsigned char *SHA224(const unsigned char *d, size_t n,unsigned char *md);
|
||||
unsigned char *SHA224(const unsigned char *d, size_t n, unsigned char *md);
|
||||
int SHA256_Init(SHA256_CTX *c);
|
||||
int SHA256_Update(SHA256_CTX *c, const void *data, size_t len);
|
||||
int SHA256_Final(unsigned char *md, SHA256_CTX *c);
|
||||
unsigned char *SHA256(const unsigned char *d, size_t n,unsigned char *md);
|
||||
unsigned char *SHA256(const unsigned char *d, size_t n, unsigned char *md);
|
||||
void SHA256_Transform(SHA256_CTX *c, const unsigned char *data);
|
||||
#endif
|
||||
|
||||
#define SHA384_DIGEST_LENGTH 48
|
||||
#define SHA512_DIGEST_LENGTH 64
|
||||
# define SHA224_DIGEST_LENGTH 28
|
||||
# define SHA256_DIGEST_LENGTH 32
|
||||
# define SHA384_DIGEST_LENGTH 48
|
||||
# define SHA512_DIGEST_LENGTH 64
|
||||
|
||||
#ifndef OPENSSL_NO_SHA512
|
||||
/*
|
||||
* Unlike 32-bit digest algorithms, SHA-512 *relies* on SHA_LONG64
|
||||
* being exactly 64-bit wide. See Implementation Notes in sha512.c
|
||||
* for further details.
|
||||
*/
|
||||
#define SHA512_CBLOCK (SHA_LBLOCK*8) /* SHA-512 treats input data as a
|
||||
* contiguous array of 64 bit
|
||||
* wide big-endian values. */
|
||||
#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__)
|
||||
#define SHA_LONG64 unsigned __int64
|
||||
#define U64(C) C##UI64
|
||||
#elif defined(__arch64__)
|
||||
#define SHA_LONG64 unsigned long
|
||||
#define U64(C) C##UL
|
||||
#else
|
||||
#define SHA_LONG64 unsigned long long
|
||||
#define U64(C) C##ULL
|
||||
#endif
|
||||
/*
|
||||
* SHA-512 treats input data as a
|
||||
* contiguous array of 64 bit
|
||||
* wide big-endian values.
|
||||
*/
|
||||
# define SHA512_CBLOCK (SHA_LBLOCK*8)
|
||||
# if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__)
|
||||
# define SHA_LONG64 unsigned __int64
|
||||
# define U64(C) C##UI64
|
||||
# elif defined(__arch64__)
|
||||
# define SHA_LONG64 unsigned long
|
||||
# define U64(C) C##UL
|
||||
# else
|
||||
# define SHA_LONG64 unsigned long long
|
||||
# define U64(C) C##ULL
|
||||
# endif
|
||||
|
||||
typedef struct SHA512state_st
|
||||
{
|
||||
SHA_LONG64 h[8];
|
||||
SHA_LONG64 Nl,Nh;
|
||||
union {
|
||||
SHA_LONG64 d[SHA_LBLOCK];
|
||||
unsigned char p[SHA512_CBLOCK];
|
||||
} u;
|
||||
unsigned int num,md_len;
|
||||
} SHA512_CTX;
|
||||
#endif
|
||||
typedef struct SHA512state_st {
|
||||
SHA_LONG64 h[8];
|
||||
SHA_LONG64 Nl, Nh;
|
||||
union {
|
||||
SHA_LONG64 d[SHA_LBLOCK];
|
||||
unsigned char p[SHA512_CBLOCK];
|
||||
} u;
|
||||
unsigned int num, md_len;
|
||||
} SHA512_CTX;
|
||||
|
||||
#ifndef OPENSSL_NO_SHA512
|
||||
int SHA384_Init(SHA512_CTX *c);
|
||||
int SHA384_Update(SHA512_CTX *c, const void *data, size_t len);
|
||||
int SHA384_Final(unsigned char *md, SHA512_CTX *c);
|
||||
unsigned char *SHA384(const unsigned char *d, size_t n,unsigned char *md);
|
||||
unsigned char *SHA384(const unsigned char *d, size_t n, unsigned char *md);
|
||||
int SHA512_Init(SHA512_CTX *c);
|
||||
int SHA512_Update(SHA512_CTX *c, const void *data, size_t len);
|
||||
int SHA512_Final(unsigned char *md, SHA512_CTX *c);
|
||||
unsigned char *SHA512(const unsigned char *d, size_t n,unsigned char *md);
|
||||
unsigned char *SHA512(const unsigned char *d, size_t n, unsigned char *md);
|
||||
void SHA512_Transform(SHA512_CTX *c, const unsigned char *data);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
131
src/dep/include/openssl/srp.h
Normal file
131
src/dep/include/openssl/srp.h
Normal file
@ -0,0 +1,131 @@
|
||||
/*
|
||||
* Copyright 2011-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_SRP_H
|
||||
# define HEADER_SRP_H
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
|
||||
#ifndef OPENSSL_NO_SRP
|
||||
# include <stdio.h>
|
||||
# include <string.h>
|
||||
# include <openssl/safestack.h>
|
||||
# include <openssl/bn.h>
|
||||
# include <openssl/crypto.h>
|
||||
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
typedef struct SRP_gN_cache_st {
|
||||
char *b64_bn;
|
||||
BIGNUM *bn;
|
||||
} SRP_gN_cache;
|
||||
|
||||
|
||||
DEFINE_STACK_OF(SRP_gN_cache)
|
||||
|
||||
typedef struct SRP_user_pwd_st {
|
||||
/* Owned by us. */
|
||||
char *id;
|
||||
BIGNUM *s;
|
||||
BIGNUM *v;
|
||||
/* Not owned by us. */
|
||||
const BIGNUM *g;
|
||||
const BIGNUM *N;
|
||||
/* Owned by us. */
|
||||
char *info;
|
||||
} SRP_user_pwd;
|
||||
|
||||
void SRP_user_pwd_free(SRP_user_pwd *user_pwd);
|
||||
|
||||
DEFINE_STACK_OF(SRP_user_pwd)
|
||||
|
||||
typedef struct SRP_VBASE_st {
|
||||
STACK_OF(SRP_user_pwd) *users_pwd;
|
||||
STACK_OF(SRP_gN_cache) *gN_cache;
|
||||
/* to simulate a user */
|
||||
char *seed_key;
|
||||
const BIGNUM *default_g;
|
||||
const BIGNUM *default_N;
|
||||
} SRP_VBASE;
|
||||
|
||||
/*
|
||||
* Internal structure storing N and g pair
|
||||
*/
|
||||
typedef struct SRP_gN_st {
|
||||
char *id;
|
||||
const BIGNUM *g;
|
||||
const BIGNUM *N;
|
||||
} SRP_gN;
|
||||
|
||||
DEFINE_STACK_OF(SRP_gN)
|
||||
|
||||
SRP_VBASE *SRP_VBASE_new(char *seed_key);
|
||||
void SRP_VBASE_free(SRP_VBASE *vb);
|
||||
int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file);
|
||||
|
||||
/* This method ignores the configured seed and fails for an unknown user. */
|
||||
DEPRECATEDIN_1_1_0(SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username))
|
||||
/* NOTE: unlike in SRP_VBASE_get_by_user, caller owns the returned pointer.*/
|
||||
SRP_user_pwd *SRP_VBASE_get1_by_user(SRP_VBASE *vb, char *username);
|
||||
|
||||
char *SRP_create_verifier(const char *user, const char *pass, char **salt,
|
||||
char **verifier, const char *N, const char *g);
|
||||
int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt,
|
||||
BIGNUM **verifier, const BIGNUM *N,
|
||||
const BIGNUM *g);
|
||||
|
||||
# define SRP_NO_ERROR 0
|
||||
# define SRP_ERR_VBASE_INCOMPLETE_FILE 1
|
||||
# define SRP_ERR_VBASE_BN_LIB 2
|
||||
# define SRP_ERR_OPEN_FILE 3
|
||||
# define SRP_ERR_MEMORY 4
|
||||
|
||||
# define DB_srptype 0
|
||||
# define DB_srpverifier 1
|
||||
# define DB_srpsalt 2
|
||||
# define DB_srpid 3
|
||||
# define DB_srpgN 4
|
||||
# define DB_srpinfo 5
|
||||
# undef DB_NUMBER
|
||||
# define DB_NUMBER 6
|
||||
|
||||
# define DB_SRP_INDEX 'I'
|
||||
# define DB_SRP_VALID 'V'
|
||||
# define DB_SRP_REVOKED 'R'
|
||||
# define DB_SRP_MODIF 'v'
|
||||
|
||||
/* see srp.c */
|
||||
char *SRP_check_known_gN_param(const BIGNUM *g, const BIGNUM *N);
|
||||
SRP_gN *SRP_get_default_gN(const char *id);
|
||||
|
||||
/* server side .... */
|
||||
BIGNUM *SRP_Calc_server_key(const BIGNUM *A, const BIGNUM *v, const BIGNUM *u,
|
||||
const BIGNUM *b, const BIGNUM *N);
|
||||
BIGNUM *SRP_Calc_B(const BIGNUM *b, const BIGNUM *N, const BIGNUM *g,
|
||||
const BIGNUM *v);
|
||||
int SRP_Verify_A_mod_N(const BIGNUM *A, const BIGNUM *N);
|
||||
BIGNUM *SRP_Calc_u(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N);
|
||||
|
||||
/* client side .... */
|
||||
BIGNUM *SRP_Calc_x(const BIGNUM *s, const char *user, const char *pass);
|
||||
BIGNUM *SRP_Calc_A(const BIGNUM *a, const BIGNUM *N, const BIGNUM *g);
|
||||
BIGNUM *SRP_Calc_client_key(const BIGNUM *N, const BIGNUM *B, const BIGNUM *g,
|
||||
const BIGNUM *x, const BIGNUM *a, const BIGNUM *u);
|
||||
int SRP_Verify_B_mod_N(const BIGNUM *B, const BIGNUM *N);
|
||||
|
||||
# define SRP_MINIMAL_N 1024
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
50
src/dep/include/openssl/srtp.h
Normal file
50
src/dep/include/openssl/srtp.h
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright 2011-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/*
|
||||
* DTLS code by Eric Rescorla <ekr@rtfm.com>
|
||||
*
|
||||
* Copyright (C) 2006, Network Resonance, Inc. Copyright (C) 2011, RTFM, Inc.
|
||||
*/
|
||||
|
||||
#ifndef HEADER_D1_SRTP_H
|
||||
# define HEADER_D1_SRTP_H
|
||||
|
||||
# include <openssl/ssl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
# define SRTP_AES128_CM_SHA1_80 0x0001
|
||||
# define SRTP_AES128_CM_SHA1_32 0x0002
|
||||
# define SRTP_AES128_F8_SHA1_80 0x0003
|
||||
# define SRTP_AES128_F8_SHA1_32 0x0004
|
||||
# define SRTP_NULL_SHA1_80 0x0005
|
||||
# define SRTP_NULL_SHA1_32 0x0006
|
||||
|
||||
/* AEAD SRTP protection profiles from RFC 7714 */
|
||||
# define SRTP_AEAD_AES_128_GCM 0x0007
|
||||
# define SRTP_AEAD_AES_256_GCM 0x0008
|
||||
|
||||
# ifndef OPENSSL_NO_SRTP
|
||||
|
||||
__owur int SSL_CTX_set_tlsext_use_srtp(SSL_CTX *ctx, const char *profiles);
|
||||
__owur int SSL_set_tlsext_use_srtp(SSL *ctx, const char *profiles);
|
||||
|
||||
__owur STACK_OF(SRTP_PROTECTION_PROFILE) *SSL_get_srtp_profiles(SSL *ssl);
|
||||
__owur SRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *s);
|
||||
|
||||
# endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,268 +1,24 @@
|
||||
/* ssl/ssl2.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_SSL2_H
|
||||
#define HEADER_SSL2_H
|
||||
# define HEADER_SSL2_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Protocol Version Codes */
|
||||
#define SSL2_VERSION 0x0002
|
||||
#define SSL2_VERSION_MAJOR 0x00
|
||||
#define SSL2_VERSION_MINOR 0x02
|
||||
/* #define SSL2_CLIENT_VERSION 0x0002 */
|
||||
/* #define SSL2_SERVER_VERSION 0x0002 */
|
||||
# define SSL2_VERSION 0x0002
|
||||
|
||||
/* Protocol Message Codes */
|
||||
#define SSL2_MT_ERROR 0
|
||||
#define SSL2_MT_CLIENT_HELLO 1
|
||||
#define SSL2_MT_CLIENT_MASTER_KEY 2
|
||||
#define SSL2_MT_CLIENT_FINISHED 3
|
||||
#define SSL2_MT_SERVER_HELLO 4
|
||||
#define SSL2_MT_SERVER_VERIFY 5
|
||||
#define SSL2_MT_SERVER_FINISHED 6
|
||||
#define SSL2_MT_REQUEST_CERTIFICATE 7
|
||||
#define SSL2_MT_CLIENT_CERTIFICATE 8
|
||||
|
||||
/* Error Message Codes */
|
||||
#define SSL2_PE_UNDEFINED_ERROR 0x0000
|
||||
#define SSL2_PE_NO_CIPHER 0x0001
|
||||
#define SSL2_PE_NO_CERTIFICATE 0x0002
|
||||
#define SSL2_PE_BAD_CERTIFICATE 0x0004
|
||||
#define SSL2_PE_UNSUPPORTED_CERTIFICATE_TYPE 0x0006
|
||||
|
||||
/* Cipher Kind Values */
|
||||
#define SSL2_CK_NULL_WITH_MD5 0x02000000 /* v3 */
|
||||
#define SSL2_CK_RC4_128_WITH_MD5 0x02010080
|
||||
#define SSL2_CK_RC4_128_EXPORT40_WITH_MD5 0x02020080
|
||||
#define SSL2_CK_RC2_128_CBC_WITH_MD5 0x02030080
|
||||
#define SSL2_CK_RC2_128_CBC_EXPORT40_WITH_MD5 0x02040080
|
||||
#define SSL2_CK_IDEA_128_CBC_WITH_MD5 0x02050080
|
||||
#define SSL2_CK_DES_64_CBC_WITH_MD5 0x02060040
|
||||
#define SSL2_CK_DES_64_CBC_WITH_SHA 0x02060140 /* v3 */
|
||||
#define SSL2_CK_DES_192_EDE3_CBC_WITH_MD5 0x020700c0
|
||||
#define SSL2_CK_DES_192_EDE3_CBC_WITH_SHA 0x020701c0 /* v3 */
|
||||
#define SSL2_CK_RC4_64_WITH_MD5 0x02080080 /* MS hack */
|
||||
|
||||
#define SSL2_CK_DES_64_CFB64_WITH_MD5_1 0x02ff0800 /* SSLeay */
|
||||
#define SSL2_CK_NULL 0x02ff0810 /* SSLeay */
|
||||
|
||||
#define SSL2_TXT_DES_64_CFB64_WITH_MD5_1 "DES-CFB-M1"
|
||||
#define SSL2_TXT_NULL_WITH_MD5 "NULL-MD5"
|
||||
#define SSL2_TXT_RC4_128_WITH_MD5 "RC4-MD5"
|
||||
#define SSL2_TXT_RC4_128_EXPORT40_WITH_MD5 "EXP-RC4-MD5"
|
||||
#define SSL2_TXT_RC2_128_CBC_WITH_MD5 "RC2-CBC-MD5"
|
||||
#define SSL2_TXT_RC2_128_CBC_EXPORT40_WITH_MD5 "EXP-RC2-CBC-MD5"
|
||||
#define SSL2_TXT_IDEA_128_CBC_WITH_MD5 "IDEA-CBC-MD5"
|
||||
#define SSL2_TXT_DES_64_CBC_WITH_MD5 "DES-CBC-MD5"
|
||||
#define SSL2_TXT_DES_64_CBC_WITH_SHA "DES-CBC-SHA"
|
||||
#define SSL2_TXT_DES_192_EDE3_CBC_WITH_MD5 "DES-CBC3-MD5"
|
||||
#define SSL2_TXT_DES_192_EDE3_CBC_WITH_SHA "DES-CBC3-SHA"
|
||||
#define SSL2_TXT_RC4_64_WITH_MD5 "RC4-64-MD5"
|
||||
|
||||
#define SSL2_TXT_NULL "NULL"
|
||||
|
||||
/* Flags for the SSL_CIPHER.algorithm2 field */
|
||||
#define SSL2_CF_5_BYTE_ENC 0x01
|
||||
#define SSL2_CF_8_BYTE_ENC 0x02
|
||||
|
||||
/* Certificate Type Codes */
|
||||
#define SSL2_CT_X509_CERTIFICATE 0x01
|
||||
|
||||
/* Authentication Type Code */
|
||||
#define SSL2_AT_MD5_WITH_RSA_ENCRYPTION 0x01
|
||||
|
||||
#define SSL2_MAX_SSL_SESSION_ID_LENGTH 32
|
||||
|
||||
/* Upper/Lower Bounds */
|
||||
#define SSL2_MAX_MASTER_KEY_LENGTH_IN_BITS 256
|
||||
#ifdef OPENSSL_SYS_MPE
|
||||
#define SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER 29998u
|
||||
#else
|
||||
#define SSL2_MAX_RECORD_LENGTH_2_BYTE_HEADER 32767u /* 2^15-1 */
|
||||
#endif
|
||||
#define SSL2_MAX_RECORD_LENGTH_3_BYTE_HEADER 16383 /* 2^14-1 */
|
||||
|
||||
#define SSL2_CHALLENGE_LENGTH 16
|
||||
/*#define SSL2_CHALLENGE_LENGTH 32 */
|
||||
#define SSL2_MIN_CHALLENGE_LENGTH 16
|
||||
#define SSL2_MAX_CHALLENGE_LENGTH 32
|
||||
#define SSL2_CONNECTION_ID_LENGTH 16
|
||||
#define SSL2_MAX_CONNECTION_ID_LENGTH 16
|
||||
#define SSL2_SSL_SESSION_ID_LENGTH 16
|
||||
#define SSL2_MAX_CERT_CHALLENGE_LENGTH 32
|
||||
#define SSL2_MIN_CERT_CHALLENGE_LENGTH 16
|
||||
#define SSL2_MAX_KEY_MATERIAL_LENGTH 24
|
||||
|
||||
#ifndef HEADER_SSL_LOCL_H
|
||||
#define CERT char
|
||||
#endif
|
||||
|
||||
typedef struct ssl2_state_st
|
||||
{
|
||||
int three_byte_header;
|
||||
int clear_text; /* clear text */
|
||||
int escape; /* not used in SSLv2 */
|
||||
int ssl2_rollback; /* used if SSLv23 rolled back to SSLv2 */
|
||||
|
||||
/* non-blocking io info, used to make sure the same
|
||||
* args were passwd */
|
||||
unsigned int wnum; /* number of bytes sent so far */
|
||||
int wpend_tot;
|
||||
const unsigned char *wpend_buf;
|
||||
|
||||
int wpend_off; /* offset to data to write */
|
||||
int wpend_len; /* number of bytes passwd to write */
|
||||
int wpend_ret; /* number of bytes to return to caller */
|
||||
|
||||
/* buffer raw data */
|
||||
int rbuf_left;
|
||||
int rbuf_offs;
|
||||
unsigned char *rbuf;
|
||||
unsigned char *wbuf;
|
||||
|
||||
unsigned char *write_ptr;/* used to point to the start due to
|
||||
* 2/3 byte header. */
|
||||
|
||||
unsigned int padding;
|
||||
unsigned int rlength; /* passed to ssl2_enc */
|
||||
int ract_data_length; /* Set when things are encrypted. */
|
||||
unsigned int wlength; /* passed to ssl2_enc */
|
||||
int wact_data_length; /* Set when things are decrypted. */
|
||||
unsigned char *ract_data;
|
||||
unsigned char *wact_data;
|
||||
unsigned char *mac_data;
|
||||
|
||||
unsigned char *read_key;
|
||||
unsigned char *write_key;
|
||||
|
||||
/* Stuff specifically to do with this SSL session */
|
||||
unsigned int challenge_length;
|
||||
unsigned char challenge[SSL2_MAX_CHALLENGE_LENGTH];
|
||||
unsigned int conn_id_length;
|
||||
unsigned char conn_id[SSL2_MAX_CONNECTION_ID_LENGTH];
|
||||
unsigned int key_material_length;
|
||||
unsigned char key_material[SSL2_MAX_KEY_MATERIAL_LENGTH*2];
|
||||
|
||||
unsigned long read_sequence;
|
||||
unsigned long write_sequence;
|
||||
|
||||
struct {
|
||||
unsigned int conn_id_length;
|
||||
unsigned int cert_type;
|
||||
unsigned int cert_length;
|
||||
unsigned int csl;
|
||||
unsigned int clear;
|
||||
unsigned int enc;
|
||||
unsigned char ccl[SSL2_MAX_CERT_CHALLENGE_LENGTH];
|
||||
unsigned int cipher_spec_length;
|
||||
unsigned int session_id_length;
|
||||
unsigned int clen;
|
||||
unsigned int rlen;
|
||||
} tmp;
|
||||
} SSL2_STATE;
|
||||
|
||||
/* SSLv2 */
|
||||
/* client */
|
||||
#define SSL2_ST_SEND_CLIENT_HELLO_A (0x10|SSL_ST_CONNECT)
|
||||
#define SSL2_ST_SEND_CLIENT_HELLO_B (0x11|SSL_ST_CONNECT)
|
||||
#define SSL2_ST_GET_SERVER_HELLO_A (0x20|SSL_ST_CONNECT)
|
||||
#define SSL2_ST_GET_SERVER_HELLO_B (0x21|SSL_ST_CONNECT)
|
||||
#define SSL2_ST_SEND_CLIENT_MASTER_KEY_A (0x30|SSL_ST_CONNECT)
|
||||
#define SSL2_ST_SEND_CLIENT_MASTER_KEY_B (0x31|SSL_ST_CONNECT)
|
||||
#define SSL2_ST_SEND_CLIENT_FINISHED_A (0x40|SSL_ST_CONNECT)
|
||||
#define SSL2_ST_SEND_CLIENT_FINISHED_B (0x41|SSL_ST_CONNECT)
|
||||
#define SSL2_ST_SEND_CLIENT_CERTIFICATE_A (0x50|SSL_ST_CONNECT)
|
||||
#define SSL2_ST_SEND_CLIENT_CERTIFICATE_B (0x51|SSL_ST_CONNECT)
|
||||
#define SSL2_ST_SEND_CLIENT_CERTIFICATE_C (0x52|SSL_ST_CONNECT)
|
||||
#define SSL2_ST_SEND_CLIENT_CERTIFICATE_D (0x53|SSL_ST_CONNECT)
|
||||
#define SSL2_ST_GET_SERVER_VERIFY_A (0x60|SSL_ST_CONNECT)
|
||||
#define SSL2_ST_GET_SERVER_VERIFY_B (0x61|SSL_ST_CONNECT)
|
||||
#define SSL2_ST_GET_SERVER_FINISHED_A (0x70|SSL_ST_CONNECT)
|
||||
#define SSL2_ST_GET_SERVER_FINISHED_B (0x71|SSL_ST_CONNECT)
|
||||
#define SSL2_ST_CLIENT_START_ENCRYPTION (0x80|SSL_ST_CONNECT)
|
||||
#define SSL2_ST_X509_GET_CLIENT_CERTIFICATE (0x90|SSL_ST_CONNECT)
|
||||
/* server */
|
||||
#define SSL2_ST_GET_CLIENT_HELLO_A (0x10|SSL_ST_ACCEPT)
|
||||
#define SSL2_ST_GET_CLIENT_HELLO_B (0x11|SSL_ST_ACCEPT)
|
||||
#define SSL2_ST_GET_CLIENT_HELLO_C (0x12|SSL_ST_ACCEPT)
|
||||
#define SSL2_ST_SEND_SERVER_HELLO_A (0x20|SSL_ST_ACCEPT)
|
||||
#define SSL2_ST_SEND_SERVER_HELLO_B (0x21|SSL_ST_ACCEPT)
|
||||
#define SSL2_ST_GET_CLIENT_MASTER_KEY_A (0x30|SSL_ST_ACCEPT)
|
||||
#define SSL2_ST_GET_CLIENT_MASTER_KEY_B (0x31|SSL_ST_ACCEPT)
|
||||
#define SSL2_ST_SEND_SERVER_VERIFY_A (0x40|SSL_ST_ACCEPT)
|
||||
#define SSL2_ST_SEND_SERVER_VERIFY_B (0x41|SSL_ST_ACCEPT)
|
||||
#define SSL2_ST_SEND_SERVER_VERIFY_C (0x42|SSL_ST_ACCEPT)
|
||||
#define SSL2_ST_GET_CLIENT_FINISHED_A (0x50|SSL_ST_ACCEPT)
|
||||
#define SSL2_ST_GET_CLIENT_FINISHED_B (0x51|SSL_ST_ACCEPT)
|
||||
#define SSL2_ST_SEND_SERVER_FINISHED_A (0x60|SSL_ST_ACCEPT)
|
||||
#define SSL2_ST_SEND_SERVER_FINISHED_B (0x61|SSL_ST_ACCEPT)
|
||||
#define SSL2_ST_SEND_REQUEST_CERTIFICATE_A (0x70|SSL_ST_ACCEPT)
|
||||
#define SSL2_ST_SEND_REQUEST_CERTIFICATE_B (0x71|SSL_ST_ACCEPT)
|
||||
#define SSL2_ST_SEND_REQUEST_CERTIFICATE_C (0x72|SSL_ST_ACCEPT)
|
||||
#define SSL2_ST_SEND_REQUEST_CERTIFICATE_D (0x73|SSL_ST_ACCEPT)
|
||||
#define SSL2_ST_SERVER_START_ENCRYPTION (0x80|SSL_ST_ACCEPT)
|
||||
#define SSL2_ST_X509_GET_SERVER_CERTIFICATE (0x90|SSL_ST_ACCEPT)
|
||||
# define SSL2_MT_CLIENT_HELLO 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@ -1,113 +1,12 @@
|
||||
/* ssl/ssl3.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* openssl-core@openssl.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||
* Hudson (tjh@cryptsoft.com).
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
/* ====================================================================
|
||||
* Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED.
|
||||
* ECC cipher suite support in OpenSSL originally developed by
|
||||
@ -115,441 +14,297 @@
|
||||
*/
|
||||
|
||||
#ifndef HEADER_SSL3_H
|
||||
#define HEADER_SSL3_H
|
||||
# define HEADER_SSL3_H
|
||||
|
||||
#ifndef OPENSSL_NO_COMP
|
||||
#include <openssl/comp.h>
|
||||
#endif
|
||||
#include <openssl/buffer.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/pq_compat.h>
|
||||
# include <openssl/comp.h>
|
||||
# include <openssl/buffer.h>
|
||||
# include <openssl/evp.h>
|
||||
# include <openssl/ssl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define SSL3_CK_RSA_NULL_MD5 0x03000001
|
||||
#define SSL3_CK_RSA_NULL_SHA 0x03000002
|
||||
#define SSL3_CK_RSA_RC4_40_MD5 0x03000003
|
||||
#define SSL3_CK_RSA_RC4_128_MD5 0x03000004
|
||||
#define SSL3_CK_RSA_RC4_128_SHA 0x03000005
|
||||
#define SSL3_CK_RSA_RC2_40_MD5 0x03000006
|
||||
#define SSL3_CK_RSA_IDEA_128_SHA 0x03000007
|
||||
#define SSL3_CK_RSA_DES_40_CBC_SHA 0x03000008
|
||||
#define SSL3_CK_RSA_DES_64_CBC_SHA 0x03000009
|
||||
#define SSL3_CK_RSA_DES_192_CBC3_SHA 0x0300000A
|
||||
|
||||
#define SSL3_CK_DH_DSS_DES_40_CBC_SHA 0x0300000B
|
||||
#define SSL3_CK_DH_DSS_DES_64_CBC_SHA 0x0300000C
|
||||
#define SSL3_CK_DH_DSS_DES_192_CBC3_SHA 0x0300000D
|
||||
#define SSL3_CK_DH_RSA_DES_40_CBC_SHA 0x0300000E
|
||||
#define SSL3_CK_DH_RSA_DES_64_CBC_SHA 0x0300000F
|
||||
#define SSL3_CK_DH_RSA_DES_192_CBC3_SHA 0x03000010
|
||||
|
||||
#define SSL3_CK_EDH_DSS_DES_40_CBC_SHA 0x03000011
|
||||
#define SSL3_CK_EDH_DSS_DES_64_CBC_SHA 0x03000012
|
||||
#define SSL3_CK_EDH_DSS_DES_192_CBC3_SHA 0x03000013
|
||||
#define SSL3_CK_EDH_RSA_DES_40_CBC_SHA 0x03000014
|
||||
#define SSL3_CK_EDH_RSA_DES_64_CBC_SHA 0x03000015
|
||||
#define SSL3_CK_EDH_RSA_DES_192_CBC3_SHA 0x03000016
|
||||
|
||||
#define SSL3_CK_ADH_RC4_40_MD5 0x03000017
|
||||
#define SSL3_CK_ADH_RC4_128_MD5 0x03000018
|
||||
#define SSL3_CK_ADH_DES_40_CBC_SHA 0x03000019
|
||||
#define SSL3_CK_ADH_DES_64_CBC_SHA 0x0300001A
|
||||
#define SSL3_CK_ADH_DES_192_CBC_SHA 0x0300001B
|
||||
|
||||
#define SSL3_CK_FZA_DMS_NULL_SHA 0x0300001C
|
||||
#define SSL3_CK_FZA_DMS_FZA_SHA 0x0300001D
|
||||
#if 0 /* Because it clashes with KRB5, is never used any more, and is safe
|
||||
to remove according to David Hopwood <david.hopwood@zetnet.co.uk>
|
||||
of the ietf-tls list */
|
||||
#define SSL3_CK_FZA_DMS_RC4_SHA 0x0300001E
|
||||
#endif
|
||||
|
||||
/* VRS Additional Kerberos5 entries
|
||||
/*
|
||||
* Signalling cipher suite value from RFC 5746
|
||||
* (TLS_EMPTY_RENEGOTIATION_INFO_SCSV)
|
||||
*/
|
||||
#define SSL3_CK_KRB5_DES_64_CBC_SHA 0x0300001E
|
||||
#define SSL3_CK_KRB5_DES_192_CBC3_SHA 0x0300001F
|
||||
#define SSL3_CK_KRB5_RC4_128_SHA 0x03000020
|
||||
#define SSL3_CK_KRB5_IDEA_128_CBC_SHA 0x03000021
|
||||
#define SSL3_CK_KRB5_DES_64_CBC_MD5 0x03000022
|
||||
#define SSL3_CK_KRB5_DES_192_CBC3_MD5 0x03000023
|
||||
#define SSL3_CK_KRB5_RC4_128_MD5 0x03000024
|
||||
#define SSL3_CK_KRB5_IDEA_128_CBC_MD5 0x03000025
|
||||
# define SSL3_CK_SCSV 0x030000FF
|
||||
|
||||
#define SSL3_CK_KRB5_DES_40_CBC_SHA 0x03000026
|
||||
#define SSL3_CK_KRB5_RC2_40_CBC_SHA 0x03000027
|
||||
#define SSL3_CK_KRB5_RC4_40_SHA 0x03000028
|
||||
#define SSL3_CK_KRB5_DES_40_CBC_MD5 0x03000029
|
||||
#define SSL3_CK_KRB5_RC2_40_CBC_MD5 0x0300002A
|
||||
#define SSL3_CK_KRB5_RC4_40_MD5 0x0300002B
|
||||
|
||||
#define SSL3_TXT_RSA_NULL_MD5 "NULL-MD5"
|
||||
#define SSL3_TXT_RSA_NULL_SHA "NULL-SHA"
|
||||
#define SSL3_TXT_RSA_RC4_40_MD5 "EXP-RC4-MD5"
|
||||
#define SSL3_TXT_RSA_RC4_128_MD5 "RC4-MD5"
|
||||
#define SSL3_TXT_RSA_RC4_128_SHA "RC4-SHA"
|
||||
#define SSL3_TXT_RSA_RC2_40_MD5 "EXP-RC2-CBC-MD5"
|
||||
#define SSL3_TXT_RSA_IDEA_128_SHA "IDEA-CBC-SHA"
|
||||
#define SSL3_TXT_RSA_DES_40_CBC_SHA "EXP-DES-CBC-SHA"
|
||||
#define SSL3_TXT_RSA_DES_64_CBC_SHA "DES-CBC-SHA"
|
||||
#define SSL3_TXT_RSA_DES_192_CBC3_SHA "DES-CBC3-SHA"
|
||||
|
||||
#define SSL3_TXT_DH_DSS_DES_40_CBC_SHA "EXP-DH-DSS-DES-CBC-SHA"
|
||||
#define SSL3_TXT_DH_DSS_DES_64_CBC_SHA "DH-DSS-DES-CBC-SHA"
|
||||
#define SSL3_TXT_DH_DSS_DES_192_CBC3_SHA "DH-DSS-DES-CBC3-SHA"
|
||||
#define SSL3_TXT_DH_RSA_DES_40_CBC_SHA "EXP-DH-RSA-DES-CBC-SHA"
|
||||
#define SSL3_TXT_DH_RSA_DES_64_CBC_SHA "DH-RSA-DES-CBC-SHA"
|
||||
#define SSL3_TXT_DH_RSA_DES_192_CBC3_SHA "DH-RSA-DES-CBC3-SHA"
|
||||
|
||||
#define SSL3_TXT_EDH_DSS_DES_40_CBC_SHA "EXP-EDH-DSS-DES-CBC-SHA"
|
||||
#define SSL3_TXT_EDH_DSS_DES_64_CBC_SHA "EDH-DSS-DES-CBC-SHA"
|
||||
#define SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA "EDH-DSS-DES-CBC3-SHA"
|
||||
#define SSL3_TXT_EDH_RSA_DES_40_CBC_SHA "EXP-EDH-RSA-DES-CBC-SHA"
|
||||
#define SSL3_TXT_EDH_RSA_DES_64_CBC_SHA "EDH-RSA-DES-CBC-SHA"
|
||||
#define SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA "EDH-RSA-DES-CBC3-SHA"
|
||||
|
||||
#define SSL3_TXT_ADH_RC4_40_MD5 "EXP-ADH-RC4-MD5"
|
||||
#define SSL3_TXT_ADH_RC4_128_MD5 "ADH-RC4-MD5"
|
||||
#define SSL3_TXT_ADH_DES_40_CBC_SHA "EXP-ADH-DES-CBC-SHA"
|
||||
#define SSL3_TXT_ADH_DES_64_CBC_SHA "ADH-DES-CBC-SHA"
|
||||
#define SSL3_TXT_ADH_DES_192_CBC_SHA "ADH-DES-CBC3-SHA"
|
||||
|
||||
#define SSL3_TXT_FZA_DMS_NULL_SHA "FZA-NULL-SHA"
|
||||
#define SSL3_TXT_FZA_DMS_FZA_SHA "FZA-FZA-CBC-SHA"
|
||||
#define SSL3_TXT_FZA_DMS_RC4_SHA "FZA-RC4-SHA"
|
||||
|
||||
#define SSL3_TXT_KRB5_DES_64_CBC_SHA "KRB5-DES-CBC-SHA"
|
||||
#define SSL3_TXT_KRB5_DES_192_CBC3_SHA "KRB5-DES-CBC3-SHA"
|
||||
#define SSL3_TXT_KRB5_RC4_128_SHA "KRB5-RC4-SHA"
|
||||
#define SSL3_TXT_KRB5_IDEA_128_CBC_SHA "KRB5-IDEA-CBC-SHA"
|
||||
#define SSL3_TXT_KRB5_DES_64_CBC_MD5 "KRB5-DES-CBC-MD5"
|
||||
#define SSL3_TXT_KRB5_DES_192_CBC3_MD5 "KRB5-DES-CBC3-MD5"
|
||||
#define SSL3_TXT_KRB5_RC4_128_MD5 "KRB5-RC4-MD5"
|
||||
#define SSL3_TXT_KRB5_IDEA_128_CBC_MD5 "KRB5-IDEA-CBC-MD5"
|
||||
|
||||
#define SSL3_TXT_KRB5_DES_40_CBC_SHA "EXP-KRB5-DES-CBC-SHA"
|
||||
#define SSL3_TXT_KRB5_RC2_40_CBC_SHA "EXP-KRB5-RC2-CBC-SHA"
|
||||
#define SSL3_TXT_KRB5_RC4_40_SHA "EXP-KRB5-RC4-SHA"
|
||||
#define SSL3_TXT_KRB5_DES_40_CBC_MD5 "EXP-KRB5-DES-CBC-MD5"
|
||||
#define SSL3_TXT_KRB5_RC2_40_CBC_MD5 "EXP-KRB5-RC2-CBC-MD5"
|
||||
#define SSL3_TXT_KRB5_RC4_40_MD5 "EXP-KRB5-RC4-MD5"
|
||||
|
||||
#define SSL3_SSL_SESSION_ID_LENGTH 32
|
||||
#define SSL3_MAX_SSL_SESSION_ID_LENGTH 32
|
||||
|
||||
#define SSL3_MASTER_SECRET_SIZE 48
|
||||
#define SSL3_RANDOM_SIZE 32
|
||||
#define SSL3_SESSION_ID_SIZE 32
|
||||
#define SSL3_RT_HEADER_LENGTH 5
|
||||
|
||||
/* Due to MS stuffing up, this can change.... */
|
||||
#if defined(OPENSSL_SYS_WIN16) || \
|
||||
(defined(OPENSSL_SYS_MSDOS) && !defined(OPENSSL_SYS_WIN32))
|
||||
#define SSL3_RT_MAX_EXTRA (14000)
|
||||
#else
|
||||
#define SSL3_RT_MAX_EXTRA (16384)
|
||||
#endif
|
||||
|
||||
#define SSL3_RT_MAX_PLAIN_LENGTH 16384
|
||||
#ifdef OPENSSL_NO_COMP
|
||||
#define SSL3_RT_MAX_COMPRESSED_LENGTH SSL3_RT_MAX_PLAIN_LENGTH
|
||||
#else
|
||||
#define SSL3_RT_MAX_COMPRESSED_LENGTH (1024+SSL3_RT_MAX_PLAIN_LENGTH)
|
||||
#endif
|
||||
#define SSL3_RT_MAX_ENCRYPTED_LENGTH (1024+SSL3_RT_MAX_COMPRESSED_LENGTH)
|
||||
#define SSL3_RT_MAX_PACKET_SIZE (SSL3_RT_MAX_ENCRYPTED_LENGTH+SSL3_RT_HEADER_LENGTH)
|
||||
#define SSL3_RT_MAX_DATA_SIZE (1024*1024)
|
||||
|
||||
#define SSL3_MD_CLIENT_FINISHED_CONST "\x43\x4C\x4E\x54"
|
||||
#define SSL3_MD_SERVER_FINISHED_CONST "\x53\x52\x56\x52"
|
||||
|
||||
#define SSL3_VERSION 0x0300
|
||||
#define SSL3_VERSION_MAJOR 0x03
|
||||
#define SSL3_VERSION_MINOR 0x00
|
||||
|
||||
#define SSL3_RT_CHANGE_CIPHER_SPEC 20
|
||||
#define SSL3_RT_ALERT 21
|
||||
#define SSL3_RT_HANDSHAKE 22
|
||||
#define SSL3_RT_APPLICATION_DATA 23
|
||||
|
||||
#define SSL3_AL_WARNING 1
|
||||
#define SSL3_AL_FATAL 2
|
||||
|
||||
#define SSL3_AD_CLOSE_NOTIFY 0
|
||||
#define SSL3_AD_UNEXPECTED_MESSAGE 10 /* fatal */
|
||||
#define SSL3_AD_BAD_RECORD_MAC 20 /* fatal */
|
||||
#define SSL3_AD_DECOMPRESSION_FAILURE 30 /* fatal */
|
||||
#define SSL3_AD_HANDSHAKE_FAILURE 40 /* fatal */
|
||||
#define SSL3_AD_NO_CERTIFICATE 41
|
||||
#define SSL3_AD_BAD_CERTIFICATE 42
|
||||
#define SSL3_AD_UNSUPPORTED_CERTIFICATE 43
|
||||
#define SSL3_AD_CERTIFICATE_REVOKED 44
|
||||
#define SSL3_AD_CERTIFICATE_EXPIRED 45
|
||||
#define SSL3_AD_CERTIFICATE_UNKNOWN 46
|
||||
#define SSL3_AD_ILLEGAL_PARAMETER 47 /* fatal */
|
||||
|
||||
typedef struct ssl3_record_st
|
||||
{
|
||||
/*r */ int type; /* type of record */
|
||||
/*rw*/ unsigned int length; /* How many bytes available */
|
||||
/*r */ unsigned int off; /* read/write offset into 'buf' */
|
||||
/*rw*/ unsigned char *data; /* pointer to the record data */
|
||||
/*rw*/ unsigned char *input; /* where the decode bytes are */
|
||||
/*r */ unsigned char *comp; /* only used with decompression - malloc()ed */
|
||||
/*r */ unsigned long epoch; /* epoch number, needed by DTLS1 */
|
||||
/*r */ PQ_64BIT seq_num; /* sequence number, needed by DTLS1 */
|
||||
} SSL3_RECORD;
|
||||
|
||||
typedef struct ssl3_buffer_st
|
||||
{
|
||||
unsigned char *buf; /* at least SSL3_RT_MAX_PACKET_SIZE bytes,
|
||||
* see ssl3_setup_buffers() */
|
||||
size_t len; /* buffer size */
|
||||
int offset; /* where to 'copy from' */
|
||||
int left; /* how many bytes left */
|
||||
} SSL3_BUFFER;
|
||||
|
||||
#define SSL3_CT_RSA_SIGN 1
|
||||
#define SSL3_CT_DSS_SIGN 2
|
||||
#define SSL3_CT_RSA_FIXED_DH 3
|
||||
#define SSL3_CT_DSS_FIXED_DH 4
|
||||
#define SSL3_CT_RSA_EPHEMERAL_DH 5
|
||||
#define SSL3_CT_DSS_EPHEMERAL_DH 6
|
||||
#define SSL3_CT_FORTEZZA_DMS 20
|
||||
/* SSL3_CT_NUMBER is used to size arrays and it must be large
|
||||
* enough to contain all of the cert types defined either for
|
||||
* SSLv3 and TLSv1.
|
||||
/*
|
||||
* Signalling cipher suite value from draft-ietf-tls-downgrade-scsv-00
|
||||
* (TLS_FALLBACK_SCSV)
|
||||
*/
|
||||
#define SSL3_CT_NUMBER 7
|
||||
# define SSL3_CK_FALLBACK_SCSV 0x03005600
|
||||
|
||||
# define SSL3_CK_RSA_NULL_MD5 0x03000001
|
||||
# define SSL3_CK_RSA_NULL_SHA 0x03000002
|
||||
# define SSL3_CK_RSA_RC4_40_MD5 0x03000003
|
||||
# define SSL3_CK_RSA_RC4_128_MD5 0x03000004
|
||||
# define SSL3_CK_RSA_RC4_128_SHA 0x03000005
|
||||
# define SSL3_CK_RSA_RC2_40_MD5 0x03000006
|
||||
# define SSL3_CK_RSA_IDEA_128_SHA 0x03000007
|
||||
# define SSL3_CK_RSA_DES_40_CBC_SHA 0x03000008
|
||||
# define SSL3_CK_RSA_DES_64_CBC_SHA 0x03000009
|
||||
# define SSL3_CK_RSA_DES_192_CBC3_SHA 0x0300000A
|
||||
|
||||
# define SSL3_CK_DH_DSS_DES_40_CBC_SHA 0x0300000B
|
||||
# define SSL3_CK_DH_DSS_DES_64_CBC_SHA 0x0300000C
|
||||
# define SSL3_CK_DH_DSS_DES_192_CBC3_SHA 0x0300000D
|
||||
# define SSL3_CK_DH_RSA_DES_40_CBC_SHA 0x0300000E
|
||||
# define SSL3_CK_DH_RSA_DES_64_CBC_SHA 0x0300000F
|
||||
# define SSL3_CK_DH_RSA_DES_192_CBC3_SHA 0x03000010
|
||||
|
||||
# define SSL3_CK_DHE_DSS_DES_40_CBC_SHA 0x03000011
|
||||
# define SSL3_CK_EDH_DSS_DES_40_CBC_SHA SSL3_CK_DHE_DSS_DES_40_CBC_SHA
|
||||
# define SSL3_CK_DHE_DSS_DES_64_CBC_SHA 0x03000012
|
||||
# define SSL3_CK_EDH_DSS_DES_64_CBC_SHA SSL3_CK_DHE_DSS_DES_64_CBC_SHA
|
||||
# define SSL3_CK_DHE_DSS_DES_192_CBC3_SHA 0x03000013
|
||||
# define SSL3_CK_EDH_DSS_DES_192_CBC3_SHA SSL3_CK_DHE_DSS_DES_192_CBC3_SHA
|
||||
# define SSL3_CK_DHE_RSA_DES_40_CBC_SHA 0x03000014
|
||||
# define SSL3_CK_EDH_RSA_DES_40_CBC_SHA SSL3_CK_DHE_RSA_DES_40_CBC_SHA
|
||||
# define SSL3_CK_DHE_RSA_DES_64_CBC_SHA 0x03000015
|
||||
# define SSL3_CK_EDH_RSA_DES_64_CBC_SHA SSL3_CK_DHE_RSA_DES_64_CBC_SHA
|
||||
# define SSL3_CK_DHE_RSA_DES_192_CBC3_SHA 0x03000016
|
||||
# define SSL3_CK_EDH_RSA_DES_192_CBC3_SHA SSL3_CK_DHE_RSA_DES_192_CBC3_SHA
|
||||
|
||||
# define SSL3_CK_ADH_RC4_40_MD5 0x03000017
|
||||
# define SSL3_CK_ADH_RC4_128_MD5 0x03000018
|
||||
# define SSL3_CK_ADH_DES_40_CBC_SHA 0x03000019
|
||||
# define SSL3_CK_ADH_DES_64_CBC_SHA 0x0300001A
|
||||
# define SSL3_CK_ADH_DES_192_CBC_SHA 0x0300001B
|
||||
|
||||
# define SSL3_TXT_RSA_NULL_MD5 "NULL-MD5"
|
||||
# define SSL3_TXT_RSA_NULL_SHA "NULL-SHA"
|
||||
# define SSL3_TXT_RSA_RC4_40_MD5 "EXP-RC4-MD5"
|
||||
# define SSL3_TXT_RSA_RC4_128_MD5 "RC4-MD5"
|
||||
# define SSL3_TXT_RSA_RC4_128_SHA "RC4-SHA"
|
||||
# define SSL3_TXT_RSA_RC2_40_MD5 "EXP-RC2-CBC-MD5"
|
||||
# define SSL3_TXT_RSA_IDEA_128_SHA "IDEA-CBC-SHA"
|
||||
# define SSL3_TXT_RSA_DES_40_CBC_SHA "EXP-DES-CBC-SHA"
|
||||
# define SSL3_TXT_RSA_DES_64_CBC_SHA "DES-CBC-SHA"
|
||||
# define SSL3_TXT_RSA_DES_192_CBC3_SHA "DES-CBC3-SHA"
|
||||
|
||||
# define SSL3_TXT_DH_DSS_DES_40_CBC_SHA "EXP-DH-DSS-DES-CBC-SHA"
|
||||
# define SSL3_TXT_DH_DSS_DES_64_CBC_SHA "DH-DSS-DES-CBC-SHA"
|
||||
# define SSL3_TXT_DH_DSS_DES_192_CBC3_SHA "DH-DSS-DES-CBC3-SHA"
|
||||
# define SSL3_TXT_DH_RSA_DES_40_CBC_SHA "EXP-DH-RSA-DES-CBC-SHA"
|
||||
# define SSL3_TXT_DH_RSA_DES_64_CBC_SHA "DH-RSA-DES-CBC-SHA"
|
||||
# define SSL3_TXT_DH_RSA_DES_192_CBC3_SHA "DH-RSA-DES-CBC3-SHA"
|
||||
|
||||
# define SSL3_TXT_DHE_DSS_DES_40_CBC_SHA "EXP-DHE-DSS-DES-CBC-SHA"
|
||||
# define SSL3_TXT_DHE_DSS_DES_64_CBC_SHA "DHE-DSS-DES-CBC-SHA"
|
||||
# define SSL3_TXT_DHE_DSS_DES_192_CBC3_SHA "DHE-DSS-DES-CBC3-SHA"
|
||||
# define SSL3_TXT_DHE_RSA_DES_40_CBC_SHA "EXP-DHE-RSA-DES-CBC-SHA"
|
||||
# define SSL3_TXT_DHE_RSA_DES_64_CBC_SHA "DHE-RSA-DES-CBC-SHA"
|
||||
# define SSL3_TXT_DHE_RSA_DES_192_CBC3_SHA "DHE-RSA-DES-CBC3-SHA"
|
||||
|
||||
/*
|
||||
* This next block of six "EDH" labels is for backward compatibility with
|
||||
* older versions of OpenSSL. New code should use the six "DHE" labels above
|
||||
* instead:
|
||||
*/
|
||||
# define SSL3_TXT_EDH_DSS_DES_40_CBC_SHA "EXP-EDH-DSS-DES-CBC-SHA"
|
||||
# define SSL3_TXT_EDH_DSS_DES_64_CBC_SHA "EDH-DSS-DES-CBC-SHA"
|
||||
# define SSL3_TXT_EDH_DSS_DES_192_CBC3_SHA "EDH-DSS-DES-CBC3-SHA"
|
||||
# define SSL3_TXT_EDH_RSA_DES_40_CBC_SHA "EXP-EDH-RSA-DES-CBC-SHA"
|
||||
# define SSL3_TXT_EDH_RSA_DES_64_CBC_SHA "EDH-RSA-DES-CBC-SHA"
|
||||
# define SSL3_TXT_EDH_RSA_DES_192_CBC3_SHA "EDH-RSA-DES-CBC3-SHA"
|
||||
|
||||
# define SSL3_TXT_ADH_RC4_40_MD5 "EXP-ADH-RC4-MD5"
|
||||
# define SSL3_TXT_ADH_RC4_128_MD5 "ADH-RC4-MD5"
|
||||
# define SSL3_TXT_ADH_DES_40_CBC_SHA "EXP-ADH-DES-CBC-SHA"
|
||||
# define SSL3_TXT_ADH_DES_64_CBC_SHA "ADH-DES-CBC-SHA"
|
||||
# define SSL3_TXT_ADH_DES_192_CBC_SHA "ADH-DES-CBC3-SHA"
|
||||
|
||||
# define SSL3_SSL_SESSION_ID_LENGTH 32
|
||||
# define SSL3_MAX_SSL_SESSION_ID_LENGTH 32
|
||||
|
||||
# define SSL3_MASTER_SECRET_SIZE 48
|
||||
# define SSL3_RANDOM_SIZE 32
|
||||
# define SSL3_SESSION_ID_SIZE 32
|
||||
# define SSL3_RT_HEADER_LENGTH 5
|
||||
|
||||
# define SSL3_HM_HEADER_LENGTH 4
|
||||
|
||||
# ifndef SSL3_ALIGN_PAYLOAD
|
||||
/*
|
||||
* Some will argue that this increases memory footprint, but it's not
|
||||
* actually true. Point is that malloc has to return at least 64-bit aligned
|
||||
* pointers, meaning that allocating 5 bytes wastes 3 bytes in either case.
|
||||
* Suggested pre-gaping simply moves these wasted bytes from the end of
|
||||
* allocated region to its front, but makes data payload aligned, which
|
||||
* improves performance:-)
|
||||
*/
|
||||
# define SSL3_ALIGN_PAYLOAD 8
|
||||
# else
|
||||
# if (SSL3_ALIGN_PAYLOAD&(SSL3_ALIGN_PAYLOAD-1))!=0
|
||||
# error "insane SSL3_ALIGN_PAYLOAD"
|
||||
# undef SSL3_ALIGN_PAYLOAD
|
||||
# endif
|
||||
# endif
|
||||
|
||||
/*
|
||||
* This is the maximum MAC (digest) size used by the SSL library. Currently
|
||||
* maximum of 20 is used by SHA1, but we reserve for future extension for
|
||||
* 512-bit hashes.
|
||||
*/
|
||||
|
||||
# define SSL3_RT_MAX_MD_SIZE 64
|
||||
|
||||
/*
|
||||
* Maximum block size used in all ciphersuites. Currently 16 for AES.
|
||||
*/
|
||||
|
||||
# define SSL_RT_MAX_CIPHER_BLOCK_SIZE 16
|
||||
|
||||
# define SSL3_RT_MAX_EXTRA (16384)
|
||||
|
||||
/* Maximum plaintext length: defined by SSL/TLS standards */
|
||||
# define SSL3_RT_MAX_PLAIN_LENGTH 16384
|
||||
/* Maximum compression overhead: defined by SSL/TLS standards */
|
||||
# define SSL3_RT_MAX_COMPRESSED_OVERHEAD 1024
|
||||
|
||||
/*
|
||||
* The standards give a maximum encryption overhead of 1024 bytes. In
|
||||
* practice the value is lower than this. The overhead is the maximum number
|
||||
* of padding bytes (256) plus the mac size.
|
||||
*/
|
||||
# define SSL3_RT_MAX_ENCRYPTED_OVERHEAD (256 + SSL3_RT_MAX_MD_SIZE)
|
||||
|
||||
/*
|
||||
* OpenSSL currently only uses a padding length of at most one block so the
|
||||
* send overhead is smaller.
|
||||
*/
|
||||
|
||||
# define SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD \
|
||||
(SSL_RT_MAX_CIPHER_BLOCK_SIZE + SSL3_RT_MAX_MD_SIZE)
|
||||
|
||||
/* If compression isn't used don't include the compression overhead */
|
||||
|
||||
# ifdef OPENSSL_NO_COMP
|
||||
# define SSL3_RT_MAX_COMPRESSED_LENGTH SSL3_RT_MAX_PLAIN_LENGTH
|
||||
# else
|
||||
# define SSL3_RT_MAX_COMPRESSED_LENGTH \
|
||||
(SSL3_RT_MAX_PLAIN_LENGTH+SSL3_RT_MAX_COMPRESSED_OVERHEAD)
|
||||
# endif
|
||||
# define SSL3_RT_MAX_ENCRYPTED_LENGTH \
|
||||
(SSL3_RT_MAX_ENCRYPTED_OVERHEAD+SSL3_RT_MAX_COMPRESSED_LENGTH)
|
||||
# define SSL3_RT_MAX_PACKET_SIZE \
|
||||
(SSL3_RT_MAX_ENCRYPTED_LENGTH+SSL3_RT_HEADER_LENGTH)
|
||||
|
||||
# define SSL3_MD_CLIENT_FINISHED_CONST "\x43\x4C\x4E\x54"
|
||||
# define SSL3_MD_SERVER_FINISHED_CONST "\x53\x52\x56\x52"
|
||||
|
||||
# define SSL3_VERSION 0x0300
|
||||
# define SSL3_VERSION_MAJOR 0x03
|
||||
# define SSL3_VERSION_MINOR 0x00
|
||||
|
||||
# define SSL3_RT_CHANGE_CIPHER_SPEC 20
|
||||
# define SSL3_RT_ALERT 21
|
||||
# define SSL3_RT_HANDSHAKE 22
|
||||
# define SSL3_RT_APPLICATION_DATA 23
|
||||
# define DTLS1_RT_HEARTBEAT 24
|
||||
|
||||
/* Pseudo content types to indicate additional parameters */
|
||||
# define TLS1_RT_CRYPTO 0x1000
|
||||
# define TLS1_RT_CRYPTO_PREMASTER (TLS1_RT_CRYPTO | 0x1)
|
||||
# define TLS1_RT_CRYPTO_CLIENT_RANDOM (TLS1_RT_CRYPTO | 0x2)
|
||||
# define TLS1_RT_CRYPTO_SERVER_RANDOM (TLS1_RT_CRYPTO | 0x3)
|
||||
# define TLS1_RT_CRYPTO_MASTER (TLS1_RT_CRYPTO | 0x4)
|
||||
|
||||
# define TLS1_RT_CRYPTO_READ 0x0000
|
||||
# define TLS1_RT_CRYPTO_WRITE 0x0100
|
||||
# define TLS1_RT_CRYPTO_MAC (TLS1_RT_CRYPTO | 0x5)
|
||||
# define TLS1_RT_CRYPTO_KEY (TLS1_RT_CRYPTO | 0x6)
|
||||
# define TLS1_RT_CRYPTO_IV (TLS1_RT_CRYPTO | 0x7)
|
||||
# define TLS1_RT_CRYPTO_FIXED_IV (TLS1_RT_CRYPTO | 0x8)
|
||||
|
||||
/* Pseudo content type for SSL/TLS header info */
|
||||
# define SSL3_RT_HEADER 0x100
|
||||
|
||||
# define SSL3_AL_WARNING 1
|
||||
# define SSL3_AL_FATAL 2
|
||||
|
||||
# define SSL3_AD_CLOSE_NOTIFY 0
|
||||
# define SSL3_AD_UNEXPECTED_MESSAGE 10/* fatal */
|
||||
# define SSL3_AD_BAD_RECORD_MAC 20/* fatal */
|
||||
# define SSL3_AD_DECOMPRESSION_FAILURE 30/* fatal */
|
||||
# define SSL3_AD_HANDSHAKE_FAILURE 40/* fatal */
|
||||
# define SSL3_AD_NO_CERTIFICATE 41
|
||||
# define SSL3_AD_BAD_CERTIFICATE 42
|
||||
# define SSL3_AD_UNSUPPORTED_CERTIFICATE 43
|
||||
# define SSL3_AD_CERTIFICATE_REVOKED 44
|
||||
# define SSL3_AD_CERTIFICATE_EXPIRED 45
|
||||
# define SSL3_AD_CERTIFICATE_UNKNOWN 46
|
||||
# define SSL3_AD_ILLEGAL_PARAMETER 47/* fatal */
|
||||
|
||||
# define TLS1_HB_REQUEST 1
|
||||
# define TLS1_HB_RESPONSE 2
|
||||
|
||||
|
||||
#define SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS 0x0001
|
||||
#define SSL3_FLAGS_DELAY_CLIENT_FINISHED 0x0002
|
||||
#define SSL3_FLAGS_POP_BUFFER 0x0004
|
||||
#define TLS1_FLAGS_TLS_PADDING_BUG 0x0008
|
||||
# define SSL3_CT_RSA_SIGN 1
|
||||
# define SSL3_CT_DSS_SIGN 2
|
||||
# define SSL3_CT_RSA_FIXED_DH 3
|
||||
# define SSL3_CT_DSS_FIXED_DH 4
|
||||
# define SSL3_CT_RSA_EPHEMERAL_DH 5
|
||||
# define SSL3_CT_DSS_EPHEMERAL_DH 6
|
||||
# define SSL3_CT_FORTEZZA_DMS 20
|
||||
/*
|
||||
* SSL3_CT_NUMBER is used to size arrays and it must be large enough to
|
||||
* contain all of the cert types defined either for SSLv3 and TLSv1.
|
||||
*/
|
||||
# define SSL3_CT_NUMBER 9
|
||||
|
||||
typedef struct ssl3_state_st
|
||||
{
|
||||
long flags;
|
||||
int delay_buf_pop_ret;
|
||||
# define SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS 0x0001
|
||||
|
||||
unsigned char read_sequence[8];
|
||||
unsigned char read_mac_secret[EVP_MAX_MD_SIZE];
|
||||
unsigned char write_sequence[8];
|
||||
unsigned char write_mac_secret[EVP_MAX_MD_SIZE];
|
||||
/* Removed from OpenSSL 1.1.0 */
|
||||
# define TLS1_FLAGS_TLS_PADDING_BUG 0x0
|
||||
|
||||
unsigned char server_random[SSL3_RANDOM_SIZE];
|
||||
unsigned char client_random[SSL3_RANDOM_SIZE];
|
||||
# define TLS1_FLAGS_SKIP_CERT_VERIFY 0x0010
|
||||
|
||||
/* flags for countermeasure against known-IV weakness */
|
||||
int need_empty_fragments;
|
||||
int empty_fragment_done;
|
||||
/* Set if we encrypt then mac instead of usual mac then encrypt */
|
||||
# define TLS1_FLAGS_ENCRYPT_THEN_MAC_READ 0x0100
|
||||
# define TLS1_FLAGS_ENCRYPT_THEN_MAC TLS1_FLAGS_ENCRYPT_THEN_MAC_READ
|
||||
|
||||
SSL3_BUFFER rbuf; /* read IO goes into here */
|
||||
SSL3_BUFFER wbuf; /* write IO goes into here */
|
||||
/* Set if extended master secret extension received from peer */
|
||||
# define TLS1_FLAGS_RECEIVED_EXTMS 0x0200
|
||||
|
||||
SSL3_RECORD rrec; /* each decoded record goes in here */
|
||||
SSL3_RECORD wrec; /* goes out from here */
|
||||
# define TLS1_FLAGS_ENCRYPT_THEN_MAC_WRITE 0x0400
|
||||
|
||||
/* storage for Alert/Handshake protocol data received but not
|
||||
* yet processed by ssl3_read_bytes: */
|
||||
unsigned char alert_fragment[2];
|
||||
unsigned int alert_fragment_len;
|
||||
unsigned char handshake_fragment[4];
|
||||
unsigned int handshake_fragment_len;
|
||||
# define SSL3_MT_HELLO_REQUEST 0
|
||||
# define SSL3_MT_CLIENT_HELLO 1
|
||||
# define SSL3_MT_SERVER_HELLO 2
|
||||
# define SSL3_MT_NEWSESSION_TICKET 4
|
||||
# define SSL3_MT_CERTIFICATE 11
|
||||
# define SSL3_MT_SERVER_KEY_EXCHANGE 12
|
||||
# define SSL3_MT_CERTIFICATE_REQUEST 13
|
||||
# define SSL3_MT_SERVER_DONE 14
|
||||
# define SSL3_MT_CERTIFICATE_VERIFY 15
|
||||
# define SSL3_MT_CLIENT_KEY_EXCHANGE 16
|
||||
# define SSL3_MT_FINISHED 20
|
||||
# define SSL3_MT_CERTIFICATE_STATUS 22
|
||||
# ifndef OPENSSL_NO_NEXTPROTONEG
|
||||
# define SSL3_MT_NEXT_PROTO 67
|
||||
# endif
|
||||
# define DTLS1_MT_HELLO_VERIFY_REQUEST 3
|
||||
|
||||
/* partial write - check the numbers match */
|
||||
unsigned int wnum; /* number of bytes sent so far */
|
||||
int wpend_tot; /* number bytes written */
|
||||
int wpend_type;
|
||||
int wpend_ret; /* number of bytes submitted */
|
||||
const unsigned char *wpend_buf;
|
||||
/* Dummy message type for handling CCS like a normal handshake message */
|
||||
# define SSL3_MT_CHANGE_CIPHER_SPEC 0x0101
|
||||
|
||||
/* used during startup, digest all incoming/outgoing packets */
|
||||
EVP_MD_CTX finish_dgst1;
|
||||
EVP_MD_CTX finish_dgst2;
|
||||
|
||||
/* this is set whenerver we see a change_cipher_spec message
|
||||
* come in when we are not looking for one */
|
||||
int change_cipher_spec;
|
||||
|
||||
int warn_alert;
|
||||
int fatal_alert;
|
||||
/* we allow one fatal and one warning alert to be outstanding,
|
||||
* send close alert via the warning alert */
|
||||
int alert_dispatch;
|
||||
unsigned char send_alert[2];
|
||||
|
||||
/* This flag is set when we should renegotiate ASAP, basically when
|
||||
* there is no more data in the read or write buffers */
|
||||
int renegotiate;
|
||||
int total_renegotiations;
|
||||
int num_renegotiations;
|
||||
|
||||
int in_read_app_data;
|
||||
|
||||
struct {
|
||||
/* actually only needs to be 16+20 */
|
||||
unsigned char cert_verify_md[EVP_MAX_MD_SIZE*2];
|
||||
|
||||
/* actually only need to be 16+20 for SSLv3 and 12 for TLS */
|
||||
unsigned char finish_md[EVP_MAX_MD_SIZE*2];
|
||||
int finish_md_len;
|
||||
unsigned char peer_finish_md[EVP_MAX_MD_SIZE*2];
|
||||
int peer_finish_md_len;
|
||||
|
||||
unsigned long message_size;
|
||||
int message_type;
|
||||
|
||||
/* used to hold the new cipher we are going to use */
|
||||
SSL_CIPHER *new_cipher;
|
||||
#ifndef OPENSSL_NO_DH
|
||||
DH *dh;
|
||||
#endif
|
||||
|
||||
#ifndef OPENSSL_NO_ECDH
|
||||
EC_KEY *ecdh; /* holds short lived ECDH key */
|
||||
#endif
|
||||
|
||||
/* used when SSL_ST_FLUSH_DATA is entered */
|
||||
int next_state;
|
||||
|
||||
int reuse_message;
|
||||
|
||||
/* used for certificate requests */
|
||||
int cert_req;
|
||||
int ctype_num;
|
||||
char ctype[SSL3_CT_NUMBER];
|
||||
STACK_OF(X509_NAME) *ca_names;
|
||||
|
||||
int use_rsa_tmp;
|
||||
|
||||
int key_block_length;
|
||||
unsigned char *key_block;
|
||||
|
||||
const EVP_CIPHER *new_sym_enc;
|
||||
const EVP_MD *new_hash;
|
||||
#ifndef OPENSSL_NO_COMP
|
||||
const SSL_COMP *new_compression;
|
||||
#else
|
||||
char *new_compression;
|
||||
#endif
|
||||
int cert_request;
|
||||
} tmp;
|
||||
|
||||
} SSL3_STATE;
|
||||
|
||||
|
||||
/* SSLv3 */
|
||||
/*client */
|
||||
/* extra state */
|
||||
#define SSL3_ST_CW_FLUSH (0x100|SSL_ST_CONNECT)
|
||||
/* write to server */
|
||||
#define SSL3_ST_CW_CLNT_HELLO_A (0x110|SSL_ST_CONNECT)
|
||||
#define SSL3_ST_CW_CLNT_HELLO_B (0x111|SSL_ST_CONNECT)
|
||||
/* read from server */
|
||||
#define SSL3_ST_CR_SRVR_HELLO_A (0x120|SSL_ST_CONNECT)
|
||||
#define SSL3_ST_CR_SRVR_HELLO_B (0x121|SSL_ST_CONNECT)
|
||||
#define DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A (0x126|SSL_ST_CONNECT)
|
||||
#define DTLS1_ST_CR_HELLO_VERIFY_REQUEST_B (0x127|SSL_ST_CONNECT)
|
||||
#define SSL3_ST_CR_CERT_A (0x130|SSL_ST_CONNECT)
|
||||
#define SSL3_ST_CR_CERT_B (0x131|SSL_ST_CONNECT)
|
||||
#define SSL3_ST_CR_KEY_EXCH_A (0x140|SSL_ST_CONNECT)
|
||||
#define SSL3_ST_CR_KEY_EXCH_B (0x141|SSL_ST_CONNECT)
|
||||
#define SSL3_ST_CR_CERT_REQ_A (0x150|SSL_ST_CONNECT)
|
||||
#define SSL3_ST_CR_CERT_REQ_B (0x151|SSL_ST_CONNECT)
|
||||
#define SSL3_ST_CR_SRVR_DONE_A (0x160|SSL_ST_CONNECT)
|
||||
#define SSL3_ST_CR_SRVR_DONE_B (0x161|SSL_ST_CONNECT)
|
||||
/* write to server */
|
||||
#define SSL3_ST_CW_CERT_A (0x170|SSL_ST_CONNECT)
|
||||
#define SSL3_ST_CW_CERT_B (0x171|SSL_ST_CONNECT)
|
||||
#define SSL3_ST_CW_CERT_C (0x172|SSL_ST_CONNECT)
|
||||
#define SSL3_ST_CW_CERT_D (0x173|SSL_ST_CONNECT)
|
||||
#define SSL3_ST_CW_KEY_EXCH_A (0x180|SSL_ST_CONNECT)
|
||||
#define SSL3_ST_CW_KEY_EXCH_B (0x181|SSL_ST_CONNECT)
|
||||
#define SSL3_ST_CW_CERT_VRFY_A (0x190|SSL_ST_CONNECT)
|
||||
#define SSL3_ST_CW_CERT_VRFY_B (0x191|SSL_ST_CONNECT)
|
||||
#define SSL3_ST_CW_CHANGE_A (0x1A0|SSL_ST_CONNECT)
|
||||
#define SSL3_ST_CW_CHANGE_B (0x1A1|SSL_ST_CONNECT)
|
||||
#define SSL3_ST_CW_FINISHED_A (0x1B0|SSL_ST_CONNECT)
|
||||
#define SSL3_ST_CW_FINISHED_B (0x1B1|SSL_ST_CONNECT)
|
||||
/* read from server */
|
||||
#define SSL3_ST_CR_CHANGE_A (0x1C0|SSL_ST_CONNECT)
|
||||
#define SSL3_ST_CR_CHANGE_B (0x1C1|SSL_ST_CONNECT)
|
||||
#define SSL3_ST_CR_FINISHED_A (0x1D0|SSL_ST_CONNECT)
|
||||
#define SSL3_ST_CR_FINISHED_B (0x1D1|SSL_ST_CONNECT)
|
||||
|
||||
/* server */
|
||||
/* extra state */
|
||||
#define SSL3_ST_SW_FLUSH (0x100|SSL_ST_ACCEPT)
|
||||
/* read from client */
|
||||
/* Do not change the number values, they do matter */
|
||||
#define SSL3_ST_SR_CLNT_HELLO_A (0x110|SSL_ST_ACCEPT)
|
||||
#define SSL3_ST_SR_CLNT_HELLO_B (0x111|SSL_ST_ACCEPT)
|
||||
#define SSL3_ST_SR_CLNT_HELLO_C (0x112|SSL_ST_ACCEPT)
|
||||
/* write to client */
|
||||
#define DTLS1_ST_SW_HELLO_VERIFY_REQUEST_A (0x113|SSL_ST_ACCEPT)
|
||||
#define DTLS1_ST_SW_HELLO_VERIFY_REQUEST_B (0x114|SSL_ST_ACCEPT)
|
||||
#define SSL3_ST_SW_HELLO_REQ_A (0x120|SSL_ST_ACCEPT)
|
||||
#define SSL3_ST_SW_HELLO_REQ_B (0x121|SSL_ST_ACCEPT)
|
||||
#define SSL3_ST_SW_HELLO_REQ_C (0x122|SSL_ST_ACCEPT)
|
||||
#define SSL3_ST_SW_SRVR_HELLO_A (0x130|SSL_ST_ACCEPT)
|
||||
#define SSL3_ST_SW_SRVR_HELLO_B (0x131|SSL_ST_ACCEPT)
|
||||
#define SSL3_ST_SW_CERT_A (0x140|SSL_ST_ACCEPT)
|
||||
#define SSL3_ST_SW_CERT_B (0x141|SSL_ST_ACCEPT)
|
||||
#define SSL3_ST_SW_KEY_EXCH_A (0x150|SSL_ST_ACCEPT)
|
||||
#define SSL3_ST_SW_KEY_EXCH_B (0x151|SSL_ST_ACCEPT)
|
||||
#define SSL3_ST_SW_CERT_REQ_A (0x160|SSL_ST_ACCEPT)
|
||||
#define SSL3_ST_SW_CERT_REQ_B (0x161|SSL_ST_ACCEPT)
|
||||
#define SSL3_ST_SW_SRVR_DONE_A (0x170|SSL_ST_ACCEPT)
|
||||
#define SSL3_ST_SW_SRVR_DONE_B (0x171|SSL_ST_ACCEPT)
|
||||
/* read from client */
|
||||
#define SSL3_ST_SR_CERT_A (0x180|SSL_ST_ACCEPT)
|
||||
#define SSL3_ST_SR_CERT_B (0x181|SSL_ST_ACCEPT)
|
||||
#define SSL3_ST_SR_KEY_EXCH_A (0x190|SSL_ST_ACCEPT)
|
||||
#define SSL3_ST_SR_KEY_EXCH_B (0x191|SSL_ST_ACCEPT)
|
||||
#define SSL3_ST_SR_CERT_VRFY_A (0x1A0|SSL_ST_ACCEPT)
|
||||
#define SSL3_ST_SR_CERT_VRFY_B (0x1A1|SSL_ST_ACCEPT)
|
||||
#define SSL3_ST_SR_CHANGE_A (0x1B0|SSL_ST_ACCEPT)
|
||||
#define SSL3_ST_SR_CHANGE_B (0x1B1|SSL_ST_ACCEPT)
|
||||
#define SSL3_ST_SR_FINISHED_A (0x1C0|SSL_ST_ACCEPT)
|
||||
#define SSL3_ST_SR_FINISHED_B (0x1C1|SSL_ST_ACCEPT)
|
||||
/* write to client */
|
||||
#define SSL3_ST_SW_CHANGE_A (0x1D0|SSL_ST_ACCEPT)
|
||||
#define SSL3_ST_SW_CHANGE_B (0x1D1|SSL_ST_ACCEPT)
|
||||
#define SSL3_ST_SW_FINISHED_A (0x1E0|SSL_ST_ACCEPT)
|
||||
#define SSL3_ST_SW_FINISHED_B (0x1E1|SSL_ST_ACCEPT)
|
||||
|
||||
#define SSL3_MT_HELLO_REQUEST 0
|
||||
#define SSL3_MT_CLIENT_HELLO 1
|
||||
#define SSL3_MT_SERVER_HELLO 2
|
||||
#define SSL3_MT_CERTIFICATE 11
|
||||
#define SSL3_MT_SERVER_KEY_EXCHANGE 12
|
||||
#define SSL3_MT_CERTIFICATE_REQUEST 13
|
||||
#define SSL3_MT_SERVER_DONE 14
|
||||
#define SSL3_MT_CERTIFICATE_VERIFY 15
|
||||
#define SSL3_MT_CLIENT_KEY_EXCHANGE 16
|
||||
#define SSL3_MT_FINISHED 20
|
||||
#define DTLS1_MT_HELLO_VERIFY_REQUEST 3
|
||||
|
||||
|
||||
#define SSL3_MT_CCS 1
|
||||
# define SSL3_MT_CCS 1
|
||||
|
||||
/* These are used when changing over to a new cipher */
|
||||
#define SSL3_CC_READ 0x01
|
||||
#define SSL3_CC_WRITE 0x02
|
||||
#define SSL3_CC_CLIENT 0x10
|
||||
#define SSL3_CC_SERVER 0x20
|
||||
#define SSL3_CHANGE_CIPHER_CLIENT_WRITE (SSL3_CC_CLIENT|SSL3_CC_WRITE)
|
||||
#define SSL3_CHANGE_CIPHER_SERVER_READ (SSL3_CC_SERVER|SSL3_CC_READ)
|
||||
#define SSL3_CHANGE_CIPHER_CLIENT_READ (SSL3_CC_CLIENT|SSL3_CC_READ)
|
||||
#define SSL3_CHANGE_CIPHER_SERVER_WRITE (SSL3_CC_SERVER|SSL3_CC_WRITE)
|
||||
# define SSL3_CC_READ 0x01
|
||||
# define SSL3_CC_WRITE 0x02
|
||||
# define SSL3_CC_CLIENT 0x10
|
||||
# define SSL3_CC_SERVER 0x20
|
||||
# define SSL3_CHANGE_CIPHER_CLIENT_WRITE (SSL3_CC_CLIENT|SSL3_CC_WRITE)
|
||||
# define SSL3_CHANGE_CIPHER_SERVER_READ (SSL3_CC_SERVER|SSL3_CC_READ)
|
||||
# define SSL3_CHANGE_CIPHER_CLIENT_READ (SSL3_CC_CLIENT|SSL3_CC_READ)
|
||||
# define SSL3_CHANGE_CIPHER_SERVER_WRITE (SSL3_CC_SERVER|SSL3_CC_WRITE)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@ -1,106 +1,75 @@
|
||||
/* crypto/stack/stack.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_STACK_H
|
||||
#define HEADER_STACK_H
|
||||
# define HEADER_STACK_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct stack_st
|
||||
{
|
||||
int num;
|
||||
char **data;
|
||||
int sorted;
|
||||
typedef struct stack_st OPENSSL_STACK; /* Use STACK_OF(...) instead */
|
||||
|
||||
int num_alloc;
|
||||
int (*comp)(const char * const *, const char * const *);
|
||||
} STACK;
|
||||
typedef int (*OPENSSL_sk_compfunc)(const void *, const void *);
|
||||
typedef void (*OPENSSL_sk_freefunc)(void *);
|
||||
typedef void *(*OPENSSL_sk_copyfunc)(const void *);
|
||||
|
||||
#define M_sk_num(sk) ((sk) ? (sk)->num:-1)
|
||||
#define M_sk_value(sk,n) ((sk) ? (sk)->data[n] : NULL)
|
||||
int OPENSSL_sk_num(const OPENSSL_STACK *);
|
||||
void *OPENSSL_sk_value(const OPENSSL_STACK *, int);
|
||||
|
||||
int sk_num(const STACK *);
|
||||
char *sk_value(const STACK *, int);
|
||||
void *OPENSSL_sk_set(OPENSSL_STACK *st, int i, const void *data);
|
||||
|
||||
char *sk_set(STACK *, int, char *);
|
||||
OPENSSL_STACK *OPENSSL_sk_new(OPENSSL_sk_compfunc cmp);
|
||||
OPENSSL_STACK *OPENSSL_sk_new_null(void);
|
||||
void OPENSSL_sk_free(OPENSSL_STACK *);
|
||||
void OPENSSL_sk_pop_free(OPENSSL_STACK *st, void (*func) (void *));
|
||||
OPENSSL_STACK *OPENSSL_sk_deep_copy(const OPENSSL_STACK *, OPENSSL_sk_copyfunc c, OPENSSL_sk_freefunc f);
|
||||
int OPENSSL_sk_insert(OPENSSL_STACK *sk, const void *data, int where);
|
||||
void *OPENSSL_sk_delete(OPENSSL_STACK *st, int loc);
|
||||
void *OPENSSL_sk_delete_ptr(OPENSSL_STACK *st, const void *p);
|
||||
int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data);
|
||||
int OPENSSL_sk_find_ex(OPENSSL_STACK *st, const void *data);
|
||||
int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data);
|
||||
int OPENSSL_sk_unshift(OPENSSL_STACK *st, const void *data);
|
||||
void *OPENSSL_sk_shift(OPENSSL_STACK *st);
|
||||
void *OPENSSL_sk_pop(OPENSSL_STACK *st);
|
||||
void OPENSSL_sk_zero(OPENSSL_STACK *st);
|
||||
OPENSSL_sk_compfunc OPENSSL_sk_set_cmp_func(OPENSSL_STACK *sk, OPENSSL_sk_compfunc cmp);
|
||||
OPENSSL_STACK *OPENSSL_sk_dup(const OPENSSL_STACK *st);
|
||||
void OPENSSL_sk_sort(OPENSSL_STACK *st);
|
||||
int OPENSSL_sk_is_sorted(const OPENSSL_STACK *st);
|
||||
|
||||
STACK *sk_new(int (*cmp)(const char * const *, const char * const *));
|
||||
STACK *sk_new_null(void);
|
||||
void sk_free(STACK *);
|
||||
void sk_pop_free(STACK *st, void (*func)(void *));
|
||||
int sk_insert(STACK *sk,char *data,int where);
|
||||
char *sk_delete(STACK *st,int loc);
|
||||
char *sk_delete_ptr(STACK *st, char *p);
|
||||
int sk_find(STACK *st,char *data);
|
||||
int sk_find_ex(STACK *st,char *data);
|
||||
int sk_push(STACK *st,char *data);
|
||||
int sk_unshift(STACK *st,char *data);
|
||||
char *sk_shift(STACK *st);
|
||||
char *sk_pop(STACK *st);
|
||||
void sk_zero(STACK *st);
|
||||
int (*sk_set_cmp_func(STACK *sk, int (*c)(const char * const *,
|
||||
const char * const *)))
|
||||
(const char * const *, const char * const *);
|
||||
STACK *sk_dup(STACK *st);
|
||||
void sk_sort(STACK *st);
|
||||
int sk_is_sorted(const STACK *st);
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# define _STACK OPENSSL_STACK
|
||||
# define sk_num OPENSSL_sk_num
|
||||
# define sk_value OPENSSL_sk_value
|
||||
# define sk_set OPENSSL_sk_set
|
||||
# define sk_new OPENSSL_sk_new
|
||||
# define sk_new_null OPENSSL_sk_new_null
|
||||
# define sk_free OPENSSL_sk_free
|
||||
# define sk_pop_free OPENSSL_sk_pop_free
|
||||
# define sk_deep_copy OPENSSL_sk_deep_copy
|
||||
# define sk_insert OPENSSL_sk_insert
|
||||
# define sk_delete OPENSSL_sk_delete
|
||||
# define sk_delete_ptr OPENSSL_sk_delete_ptr
|
||||
# define sk_find OPENSSL_sk_find
|
||||
# define sk_find_ex OPENSSL_sk_find_ex
|
||||
# define sk_push OPENSSL_sk_push
|
||||
# define sk_unshift OPENSSL_sk_unshift
|
||||
# define sk_shift OPENSSL_sk_shift
|
||||
# define sk_pop OPENSSL_sk_pop
|
||||
# define sk_zero OPENSSL_sk_zero
|
||||
# define sk_set_cmp_func OPENSSL_sk_set_cmp_func
|
||||
# define sk_dup OPENSSL_sk_dup
|
||||
# define sk_sort OPENSSL_sk_sort
|
||||
# define sk_is_sorted OPENSSL_sk_is_sorted
|
||||
# endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@ -1,383 +1,52 @@
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1999 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* openssl-core@openssl.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||
* Hudson (tjh@cryptsoft.com).
|
||||
/*
|
||||
* Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_SYMHACKS_H
|
||||
#define HEADER_SYMHACKS_H
|
||||
# define HEADER_SYMHACKS_H
|
||||
|
||||
#include <openssl/e_os2.h>
|
||||
# include <openssl/e_os2.h>
|
||||
|
||||
/* Hacks to solve the problem with linkers incapable of handling very long
|
||||
symbol names. In the case of VMS, the limit is 31 characters on VMS for
|
||||
VAX. */
|
||||
#ifdef OPENSSL_SYS_VMS
|
||||
/* Case insensitive linking causes problems.... */
|
||||
# if defined(OPENSSL_SYS_VMS)
|
||||
# undef ERR_load_CRYPTO_strings
|
||||
# define ERR_load_CRYPTO_strings ERR_load_CRYPTOlib_strings
|
||||
# undef OCSP_crlID_new
|
||||
# define OCSP_crlID_new OCSP_crlID2_new
|
||||
|
||||
/* Hack a long name in crypto/ex_data.c */
|
||||
#undef CRYPTO_get_ex_data_implementation
|
||||
#define CRYPTO_get_ex_data_implementation CRYPTO_get_ex_data_impl
|
||||
#undef CRYPTO_set_ex_data_implementation
|
||||
#define CRYPTO_set_ex_data_implementation CRYPTO_set_ex_data_impl
|
||||
# undef d2i_ECPARAMETERS
|
||||
# define d2i_ECPARAMETERS d2i_UC_ECPARAMETERS
|
||||
# undef i2d_ECPARAMETERS
|
||||
# define i2d_ECPARAMETERS i2d_UC_ECPARAMETERS
|
||||
# undef d2i_ECPKPARAMETERS
|
||||
# define d2i_ECPKPARAMETERS d2i_UC_ECPKPARAMETERS
|
||||
# undef i2d_ECPKPARAMETERS
|
||||
# define i2d_ECPKPARAMETERS i2d_UC_ECPKPARAMETERS
|
||||
|
||||
/* Hack a long name in crypto/asn1/a_mbstr.c */
|
||||
#undef ASN1_STRING_set_default_mask_asc
|
||||
#define ASN1_STRING_set_default_mask_asc ASN1_STRING_set_def_mask_asc
|
||||
/*
|
||||
* These functions do not seem to exist! However, I'm paranoid... Original
|
||||
* command in x509v3.h: These functions are being redefined in another
|
||||
* directory, and clash when the linker is case-insensitive, so let's hide
|
||||
* them a little, by giving them an extra 'o' at the beginning of the name...
|
||||
*/
|
||||
# undef X509v3_cleanup_extensions
|
||||
# define X509v3_cleanup_extensions oX509v3_cleanup_extensions
|
||||
# undef X509v3_add_extension
|
||||
# define X509v3_add_extension oX509v3_add_extension
|
||||
# undef X509v3_add_netscape_extensions
|
||||
# define X509v3_add_netscape_extensions oX509v3_add_netscape_extensions
|
||||
# undef X509v3_add_standard_extensions
|
||||
# define X509v3_add_standard_extensions oX509v3_add_standard_extensions
|
||||
|
||||
#if 0 /* No longer needed, since safestack macro magic does the job */
|
||||
/* Hack the names created with DECLARE_ASN1_SET_OF(PKCS7_SIGNER_INFO) */
|
||||
#undef i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO
|
||||
#define i2d_ASN1_SET_OF_PKCS7_SIGNER_INFO i2d_ASN1_SET_OF_PKCS7_SIGINF
|
||||
#undef d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO
|
||||
#define d2i_ASN1_SET_OF_PKCS7_SIGNER_INFO d2i_ASN1_SET_OF_PKCS7_SIGINF
|
||||
#endif
|
||||
/* This one clashes with CMS_data_create */
|
||||
# undef cms_Data_create
|
||||
# define cms_Data_create priv_cms_Data_create
|
||||
|
||||
#if 0 /* No longer needed, since safestack macro magic does the job */
|
||||
/* Hack the names created with DECLARE_ASN1_SET_OF(PKCS7_RECIP_INFO) */
|
||||
#undef i2d_ASN1_SET_OF_PKCS7_RECIP_INFO
|
||||
#define i2d_ASN1_SET_OF_PKCS7_RECIP_INFO i2d_ASN1_SET_OF_PKCS7_RECINF
|
||||
#undef d2i_ASN1_SET_OF_PKCS7_RECIP_INFO
|
||||
#define d2i_ASN1_SET_OF_PKCS7_RECIP_INFO d2i_ASN1_SET_OF_PKCS7_RECINF
|
||||
#endif
|
||||
# endif
|
||||
|
||||
#if 0 /* No longer needed, since safestack macro magic does the job */
|
||||
/* Hack the names created with DECLARE_ASN1_SET_OF(ACCESS_DESCRIPTION) */
|
||||
#undef i2d_ASN1_SET_OF_ACCESS_DESCRIPTION
|
||||
#define i2d_ASN1_SET_OF_ACCESS_DESCRIPTION i2d_ASN1_SET_OF_ACC_DESC
|
||||
#undef d2i_ASN1_SET_OF_ACCESS_DESCRIPTION
|
||||
#define d2i_ASN1_SET_OF_ACCESS_DESCRIPTION d2i_ASN1_SET_OF_ACC_DESC
|
||||
#endif
|
||||
|
||||
/* Hack the names created with DECLARE_PEM_rw(NETSCAPE_CERT_SEQUENCE) */
|
||||
#undef PEM_read_NETSCAPE_CERT_SEQUENCE
|
||||
#define PEM_read_NETSCAPE_CERT_SEQUENCE PEM_read_NS_CERT_SEQ
|
||||
#undef PEM_write_NETSCAPE_CERT_SEQUENCE
|
||||
#define PEM_write_NETSCAPE_CERT_SEQUENCE PEM_write_NS_CERT_SEQ
|
||||
#undef PEM_read_bio_NETSCAPE_CERT_SEQUENCE
|
||||
#define PEM_read_bio_NETSCAPE_CERT_SEQUENCE PEM_read_bio_NS_CERT_SEQ
|
||||
#undef PEM_write_bio_NETSCAPE_CERT_SEQUENCE
|
||||
#define PEM_write_bio_NETSCAPE_CERT_SEQUENCE PEM_write_bio_NS_CERT_SEQ
|
||||
#undef PEM_write_cb_bio_NETSCAPE_CERT_SEQUENCE
|
||||
#define PEM_write_cb_bio_NETSCAPE_CERT_SEQUENCE PEM_write_cb_bio_NS_CERT_SEQ
|
||||
|
||||
/* Hack the names created with DECLARE_PEM_rw(PKCS8_PRIV_KEY_INFO) */
|
||||
#undef PEM_read_PKCS8_PRIV_KEY_INFO
|
||||
#define PEM_read_PKCS8_PRIV_KEY_INFO PEM_read_P8_PRIV_KEY_INFO
|
||||
#undef PEM_write_PKCS8_PRIV_KEY_INFO
|
||||
#define PEM_write_PKCS8_PRIV_KEY_INFO PEM_write_P8_PRIV_KEY_INFO
|
||||
#undef PEM_read_bio_PKCS8_PRIV_KEY_INFO
|
||||
#define PEM_read_bio_PKCS8_PRIV_KEY_INFO PEM_read_bio_P8_PRIV_KEY_INFO
|
||||
#undef PEM_write_bio_PKCS8_PRIV_KEY_INFO
|
||||
#define PEM_write_bio_PKCS8_PRIV_KEY_INFO PEM_write_bio_P8_PRIV_KEY_INFO
|
||||
#undef PEM_write_cb_bio_PKCS8_PRIV_KEY_INFO
|
||||
#define PEM_write_cb_bio_PKCS8_PRIV_KEY_INFO PEM_wrt_cb_bio_P8_PRIV_KEY_INFO
|
||||
|
||||
/* Hack other PEM names */
|
||||
#undef PEM_write_bio_PKCS8PrivateKey_nid
|
||||
#define PEM_write_bio_PKCS8PrivateKey_nid PEM_write_bio_PKCS8PrivKey_nid
|
||||
|
||||
/* Hack some long X509 names */
|
||||
#undef X509_REVOKED_get_ext_by_critical
|
||||
#define X509_REVOKED_get_ext_by_critical X509_REVOKED_get_ext_by_critic
|
||||
#undef X509_policy_tree_get0_user_policies
|
||||
#define X509_policy_tree_get0_user_policies X509_pcy_tree_get0_usr_policies
|
||||
#undef X509_policy_node_get0_qualifiers
|
||||
#define X509_policy_node_get0_qualifiers X509_pcy_node_get0_qualifiers
|
||||
#undef X509_STORE_CTX_get_explicit_policy
|
||||
#define X509_STORE_CTX_get_explicit_policy X509_STORE_CTX_get_expl_policy
|
||||
|
||||
/* Hack some long CRYPTO names */
|
||||
#undef CRYPTO_set_dynlock_destroy_callback
|
||||
#define CRYPTO_set_dynlock_destroy_callback CRYPTO_set_dynlock_destroy_cb
|
||||
#undef CRYPTO_set_dynlock_create_callback
|
||||
#define CRYPTO_set_dynlock_create_callback CRYPTO_set_dynlock_create_cb
|
||||
#undef CRYPTO_set_dynlock_lock_callback
|
||||
#define CRYPTO_set_dynlock_lock_callback CRYPTO_set_dynlock_lock_cb
|
||||
#undef CRYPTO_get_dynlock_lock_callback
|
||||
#define CRYPTO_get_dynlock_lock_callback CRYPTO_get_dynlock_lock_cb
|
||||
#undef CRYPTO_get_dynlock_destroy_callback
|
||||
#define CRYPTO_get_dynlock_destroy_callback CRYPTO_get_dynlock_destroy_cb
|
||||
#undef CRYPTO_get_dynlock_create_callback
|
||||
#define CRYPTO_get_dynlock_create_callback CRYPTO_get_dynlock_create_cb
|
||||
#undef CRYPTO_set_locked_mem_ex_functions
|
||||
#define CRYPTO_set_locked_mem_ex_functions CRYPTO_set_locked_mem_ex_funcs
|
||||
#undef CRYPTO_get_locked_mem_ex_functions
|
||||
#define CRYPTO_get_locked_mem_ex_functions CRYPTO_get_locked_mem_ex_funcs
|
||||
|
||||
/* Hack some long SSL names */
|
||||
#undef SSL_CTX_set_default_verify_paths
|
||||
#define SSL_CTX_set_default_verify_paths SSL_CTX_set_def_verify_paths
|
||||
#undef SSL_get_ex_data_X509_STORE_CTX_idx
|
||||
#define SSL_get_ex_data_X509_STORE_CTX_idx SSL_get_ex_d_X509_STORE_CTX_idx
|
||||
#undef SSL_add_file_cert_subjects_to_stack
|
||||
#define SSL_add_file_cert_subjects_to_stack SSL_add_file_cert_subjs_to_stk
|
||||
#undef SSL_add_dir_cert_subjects_to_stack
|
||||
#define SSL_add_dir_cert_subjects_to_stack SSL_add_dir_cert_subjs_to_stk
|
||||
#undef SSL_CTX_use_certificate_chain_file
|
||||
#define SSL_CTX_use_certificate_chain_file SSL_CTX_use_cert_chain_file
|
||||
#undef SSL_CTX_set_cert_verify_callback
|
||||
#define SSL_CTX_set_cert_verify_callback SSL_CTX_set_cert_verify_cb
|
||||
#undef SSL_CTX_set_default_passwd_cb_userdata
|
||||
#define SSL_CTX_set_default_passwd_cb_userdata SSL_CTX_set_def_passwd_cb_ud
|
||||
#undef SSL_COMP_get_compression_methods
|
||||
#define SSL_COMP_get_compression_methods SSL_COMP_get_compress_methods
|
||||
|
||||
/* Hack some long ENGINE names */
|
||||
#undef ENGINE_get_default_BN_mod_exp_crt
|
||||
#define ENGINE_get_default_BN_mod_exp_crt ENGINE_get_def_BN_mod_exp_crt
|
||||
#undef ENGINE_set_default_BN_mod_exp_crt
|
||||
#define ENGINE_set_default_BN_mod_exp_crt ENGINE_set_def_BN_mod_exp_crt
|
||||
#undef ENGINE_set_load_privkey_function
|
||||
#define ENGINE_set_load_privkey_function ENGINE_set_load_privkey_fn
|
||||
#undef ENGINE_get_load_privkey_function
|
||||
#define ENGINE_get_load_privkey_function ENGINE_get_load_privkey_fn
|
||||
|
||||
/* Hack some long OCSP names */
|
||||
#undef OCSP_REQUEST_get_ext_by_critical
|
||||
#define OCSP_REQUEST_get_ext_by_critical OCSP_REQUEST_get_ext_by_crit
|
||||
#undef OCSP_BASICRESP_get_ext_by_critical
|
||||
#define OCSP_BASICRESP_get_ext_by_critical OCSP_BASICRESP_get_ext_by_crit
|
||||
#undef OCSP_SINGLERESP_get_ext_by_critical
|
||||
#define OCSP_SINGLERESP_get_ext_by_critical OCSP_SINGLERESP_get_ext_by_crit
|
||||
|
||||
/* Hack some long DES names */
|
||||
#undef _ossl_old_des_ede3_cfb64_encrypt
|
||||
#define _ossl_old_des_ede3_cfb64_encrypt _ossl_odes_ede3_cfb64_encrypt
|
||||
#undef _ossl_old_des_ede3_ofb64_encrypt
|
||||
#define _ossl_old_des_ede3_ofb64_encrypt _ossl_odes_ede3_ofb64_encrypt
|
||||
|
||||
/* Hack some long EVP names */
|
||||
#undef OPENSSL_add_all_algorithms_noconf
|
||||
#define OPENSSL_add_all_algorithms_noconf OPENSSL_add_all_algo_noconf
|
||||
#undef OPENSSL_add_all_algorithms_conf
|
||||
#define OPENSSL_add_all_algorithms_conf OPENSSL_add_all_algo_conf
|
||||
|
||||
/* Hack some long EC names */
|
||||
#undef EC_GROUP_set_point_conversion_form
|
||||
#define EC_GROUP_set_point_conversion_form EC_GROUP_set_point_conv_form
|
||||
#undef EC_GROUP_get_point_conversion_form
|
||||
#define EC_GROUP_get_point_conversion_form EC_GROUP_get_point_conv_form
|
||||
#undef EC_GROUP_clear_free_all_extra_data
|
||||
#define EC_GROUP_clear_free_all_extra_data EC_GROUP_clr_free_all_xtra_data
|
||||
#undef EC_POINT_set_Jprojective_coordinates_GFp
|
||||
#define EC_POINT_set_Jprojective_coordinates_GFp \
|
||||
EC_POINT_set_Jproj_coords_GFp
|
||||
#undef EC_POINT_get_Jprojective_coordinates_GFp
|
||||
#define EC_POINT_get_Jprojective_coordinates_GFp \
|
||||
EC_POINT_get_Jproj_coords_GFp
|
||||
#undef EC_POINT_set_affine_coordinates_GFp
|
||||
#define EC_POINT_set_affine_coordinates_GFp EC_POINT_set_affine_coords_GFp
|
||||
#undef EC_POINT_get_affine_coordinates_GFp
|
||||
#define EC_POINT_get_affine_coordinates_GFp EC_POINT_get_affine_coords_GFp
|
||||
#undef EC_POINT_set_compressed_coordinates_GFp
|
||||
#define EC_POINT_set_compressed_coordinates_GFp EC_POINT_set_compr_coords_GFp
|
||||
#undef EC_POINT_set_affine_coordinates_GF2m
|
||||
#define EC_POINT_set_affine_coordinates_GF2m EC_POINT_set_affine_coords_GF2m
|
||||
#undef EC_POINT_get_affine_coordinates_GF2m
|
||||
#define EC_POINT_get_affine_coordinates_GF2m EC_POINT_get_affine_coords_GF2m
|
||||
#undef EC_POINT_set_compressed_coordinates_GF2m
|
||||
#define EC_POINT_set_compressed_coordinates_GF2m \
|
||||
EC_POINT_set_compr_coords_GF2m
|
||||
#undef ec_GF2m_simple_group_clear_finish
|
||||
#define ec_GF2m_simple_group_clear_finish ec_GF2m_simple_grp_clr_finish
|
||||
#undef ec_GF2m_simple_group_check_discriminant
|
||||
#define ec_GF2m_simple_group_check_discriminant ec_GF2m_simple_grp_chk_discrim
|
||||
#undef ec_GF2m_simple_point_clear_finish
|
||||
#define ec_GF2m_simple_point_clear_finish ec_GF2m_simple_pt_clr_finish
|
||||
#undef ec_GF2m_simple_point_set_to_infinity
|
||||
#define ec_GF2m_simple_point_set_to_infinity ec_GF2m_simple_pt_set_to_inf
|
||||
#undef ec_GF2m_simple_points_make_affine
|
||||
#define ec_GF2m_simple_points_make_affine ec_GF2m_simple_pts_make_affine
|
||||
#undef ec_GF2m_simple_point_set_affine_coordinates
|
||||
#define ec_GF2m_simple_point_set_affine_coordinates \
|
||||
ec_GF2m_smp_pt_set_af_coords
|
||||
#undef ec_GF2m_simple_point_get_affine_coordinates
|
||||
#define ec_GF2m_simple_point_get_affine_coordinates \
|
||||
ec_GF2m_smp_pt_get_af_coords
|
||||
#undef ec_GF2m_simple_set_compressed_coordinates
|
||||
#define ec_GF2m_simple_set_compressed_coordinates \
|
||||
ec_GF2m_smp_set_compr_coords
|
||||
#undef ec_GFp_simple_group_set_curve_GFp
|
||||
#define ec_GFp_simple_group_set_curve_GFp ec_GFp_simple_grp_set_curve_GFp
|
||||
#undef ec_GFp_simple_group_get_curve_GFp
|
||||
#define ec_GFp_simple_group_get_curve_GFp ec_GFp_simple_grp_get_curve_GFp
|
||||
#undef ec_GFp_simple_group_clear_finish
|
||||
#define ec_GFp_simple_group_clear_finish ec_GFp_simple_grp_clear_finish
|
||||
#undef ec_GFp_simple_group_set_generator
|
||||
#define ec_GFp_simple_group_set_generator ec_GFp_simple_grp_set_generator
|
||||
#undef ec_GFp_simple_group_get0_generator
|
||||
#define ec_GFp_simple_group_get0_generator ec_GFp_simple_grp_gt0_generator
|
||||
#undef ec_GFp_simple_group_get_cofactor
|
||||
#define ec_GFp_simple_group_get_cofactor ec_GFp_simple_grp_get_cofactor
|
||||
#undef ec_GFp_simple_point_clear_finish
|
||||
#define ec_GFp_simple_point_clear_finish ec_GFp_simple_pt_clear_finish
|
||||
#undef ec_GFp_simple_point_set_to_infinity
|
||||
#define ec_GFp_simple_point_set_to_infinity ec_GFp_simple_pt_set_to_inf
|
||||
#undef ec_GFp_simple_points_make_affine
|
||||
#define ec_GFp_simple_points_make_affine ec_GFp_simple_pts_make_affine
|
||||
#undef ec_GFp_simple_group_get_curve_GFp
|
||||
#define ec_GFp_simple_group_get_curve_GFp ec_GFp_simple_grp_get_curve_GFp
|
||||
#undef ec_GFp_simple_set_Jprojective_coordinates_GFp
|
||||
#define ec_GFp_simple_set_Jprojective_coordinates_GFp \
|
||||
ec_GFp_smp_set_Jproj_coords_GFp
|
||||
#undef ec_GFp_simple_get_Jprojective_coordinates_GFp
|
||||
#define ec_GFp_simple_get_Jprojective_coordinates_GFp \
|
||||
ec_GFp_smp_get_Jproj_coords_GFp
|
||||
#undef ec_GFp_simple_point_set_affine_coordinates_GFp
|
||||
#define ec_GFp_simple_point_set_affine_coordinates_GFp \
|
||||
ec_GFp_smp_pt_set_af_coords_GFp
|
||||
#undef ec_GFp_simple_point_get_affine_coordinates_GFp
|
||||
#define ec_GFp_simple_point_get_affine_coordinates_GFp \
|
||||
ec_GFp_smp_pt_get_af_coords_GFp
|
||||
#undef ec_GFp_simple_set_compressed_coordinates_GFp
|
||||
#define ec_GFp_simple_set_compressed_coordinates_GFp \
|
||||
ec_GFp_smp_set_compr_coords_GFp
|
||||
#undef ec_GFp_simple_point_set_affine_coordinates
|
||||
#define ec_GFp_simple_point_set_affine_coordinates \
|
||||
ec_GFp_smp_pt_set_af_coords
|
||||
#undef ec_GFp_simple_point_get_affine_coordinates
|
||||
#define ec_GFp_simple_point_get_affine_coordinates \
|
||||
ec_GFp_smp_pt_get_af_coords
|
||||
#undef ec_GFp_simple_set_compressed_coordinates
|
||||
#define ec_GFp_simple_set_compressed_coordinates \
|
||||
ec_GFp_smp_set_compr_coords
|
||||
#undef ec_GFp_simple_group_check_discriminant
|
||||
#define ec_GFp_simple_group_check_discriminant ec_GFp_simple_grp_chk_discrim
|
||||
|
||||
/* Hack som long STORE names */
|
||||
#undef STORE_method_set_initialise_function
|
||||
#define STORE_method_set_initialise_function STORE_meth_set_initialise_fn
|
||||
#undef STORE_method_set_cleanup_function
|
||||
#define STORE_method_set_cleanup_function STORE_meth_set_cleanup_fn
|
||||
#undef STORE_method_set_generate_function
|
||||
#define STORE_method_set_generate_function STORE_meth_set_generate_fn
|
||||
#undef STORE_method_set_modify_function
|
||||
#define STORE_method_set_modify_function STORE_meth_set_modify_fn
|
||||
#undef STORE_method_set_revoke_function
|
||||
#define STORE_method_set_revoke_function STORE_meth_set_revoke_fn
|
||||
#undef STORE_method_set_delete_function
|
||||
#define STORE_method_set_delete_function STORE_meth_set_delete_fn
|
||||
#undef STORE_method_set_list_start_function
|
||||
#define STORE_method_set_list_start_function STORE_meth_set_list_start_fn
|
||||
#undef STORE_method_set_list_next_function
|
||||
#define STORE_method_set_list_next_function STORE_meth_set_list_next_fn
|
||||
#undef STORE_method_set_list_end_function
|
||||
#define STORE_method_set_list_end_function STORE_meth_set_list_end_fn
|
||||
#undef STORE_method_set_update_store_function
|
||||
#define STORE_method_set_update_store_function STORE_meth_set_update_store_fn
|
||||
#undef STORE_method_set_lock_store_function
|
||||
#define STORE_method_set_lock_store_function STORE_meth_set_lock_store_fn
|
||||
#undef STORE_method_set_unlock_store_function
|
||||
#define STORE_method_set_unlock_store_function STORE_meth_set_unlock_store_fn
|
||||
#undef STORE_method_get_initialise_function
|
||||
#define STORE_method_get_initialise_function STORE_meth_get_initialise_fn
|
||||
#undef STORE_method_get_cleanup_function
|
||||
#define STORE_method_get_cleanup_function STORE_meth_get_cleanup_fn
|
||||
#undef STORE_method_get_generate_function
|
||||
#define STORE_method_get_generate_function STORE_meth_get_generate_fn
|
||||
#undef STORE_method_get_modify_function
|
||||
#define STORE_method_get_modify_function STORE_meth_get_modify_fn
|
||||
#undef STORE_method_get_revoke_function
|
||||
#define STORE_method_get_revoke_function STORE_meth_get_revoke_fn
|
||||
#undef STORE_method_get_delete_function
|
||||
#define STORE_method_get_delete_function STORE_meth_get_delete_fn
|
||||
#undef STORE_method_get_list_start_function
|
||||
#define STORE_method_get_list_start_function STORE_meth_get_list_start_fn
|
||||
#undef STORE_method_get_list_next_function
|
||||
#define STORE_method_get_list_next_function STORE_meth_get_list_next_fn
|
||||
#undef STORE_method_get_list_end_function
|
||||
#define STORE_method_get_list_end_function STORE_meth_get_list_end_fn
|
||||
#undef STORE_method_get_update_store_function
|
||||
#define STORE_method_get_update_store_function STORE_meth_get_update_store_fn
|
||||
#undef STORE_method_get_lock_store_function
|
||||
#define STORE_method_get_lock_store_function STORE_meth_get_lock_store_fn
|
||||
#undef STORE_method_get_unlock_store_function
|
||||
#define STORE_method_get_unlock_store_function STORE_meth_get_unlock_store_fn
|
||||
|
||||
#endif /* defined OPENSSL_SYS_VMS */
|
||||
|
||||
|
||||
/* Case insensiteve linking causes problems.... */
|
||||
#if defined(OPENSSL_SYS_WIN16) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_OS2)
|
||||
#undef ERR_load_CRYPTO_strings
|
||||
#define ERR_load_CRYPTO_strings ERR_load_CRYPTOlib_strings
|
||||
#undef OCSP_crlID_new
|
||||
#define OCSP_crlID_new OCSP_crlID2_new
|
||||
|
||||
#undef d2i_ECPARAMETERS
|
||||
#define d2i_ECPARAMETERS d2i_UC_ECPARAMETERS
|
||||
#undef i2d_ECPARAMETERS
|
||||
#define i2d_ECPARAMETERS i2d_UC_ECPARAMETERS
|
||||
#undef d2i_ECPKPARAMETERS
|
||||
#define d2i_ECPKPARAMETERS d2i_UC_ECPKPARAMETERS
|
||||
#undef i2d_ECPKPARAMETERS
|
||||
#define i2d_ECPKPARAMETERS i2d_UC_ECPKPARAMETERS
|
||||
|
||||
/* These functions do not seem to exist! However, I'm paranoid...
|
||||
Original command in x509v3.h:
|
||||
These functions are being redefined in another directory,
|
||||
and clash when the linker is case-insensitive, so let's
|
||||
hide them a little, by giving them an extra 'o' at the
|
||||
beginning of the name... */
|
||||
#undef X509v3_cleanup_extensions
|
||||
#define X509v3_cleanup_extensions oX509v3_cleanup_extensions
|
||||
#undef X509v3_add_extension
|
||||
#define X509v3_add_extension oX509v3_add_extension
|
||||
#undef X509v3_add_netscape_extensions
|
||||
#define X509v3_add_netscape_extensions oX509v3_add_netscape_extensions
|
||||
#undef X509v3_add_standard_extensions
|
||||
#define X509v3_add_standard_extensions oX509v3_add_standard_extensions
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* ! defined HEADER_VMS_IDHACKS_H */
|
||||
#endif /* ! defined HEADER_VMS_IDHACKS_H */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
643
src/dep/include/openssl/ts.h
Normal file
643
src/dep/include/openssl/ts.h
Normal file
@ -0,0 +1,643 @@
|
||||
/*
|
||||
* Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_TS_H
|
||||
# define HEADER_TS_H
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_TS
|
||||
# include <openssl/symhacks.h>
|
||||
# include <openssl/buffer.h>
|
||||
# include <openssl/evp.h>
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/stack.h>
|
||||
# include <openssl/asn1.h>
|
||||
# include <openssl/safestack.h>
|
||||
# include <openssl/rsa.h>
|
||||
# include <openssl/dsa.h>
|
||||
# include <openssl/dh.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
# include <openssl/x509.h>
|
||||
# include <openssl/x509v3.h>
|
||||
|
||||
typedef struct TS_msg_imprint_st TS_MSG_IMPRINT;
|
||||
typedef struct TS_req_st TS_REQ;
|
||||
typedef struct TS_accuracy_st TS_ACCURACY;
|
||||
typedef struct TS_tst_info_st TS_TST_INFO;
|
||||
|
||||
/* Possible values for status. */
|
||||
# define TS_STATUS_GRANTED 0
|
||||
# define TS_STATUS_GRANTED_WITH_MODS 1
|
||||
# define TS_STATUS_REJECTION 2
|
||||
# define TS_STATUS_WAITING 3
|
||||
# define TS_STATUS_REVOCATION_WARNING 4
|
||||
# define TS_STATUS_REVOCATION_NOTIFICATION 5
|
||||
|
||||
/* Possible values for failure_info. */
|
||||
# define TS_INFO_BAD_ALG 0
|
||||
# define TS_INFO_BAD_REQUEST 2
|
||||
# define TS_INFO_BAD_DATA_FORMAT 5
|
||||
# define TS_INFO_TIME_NOT_AVAILABLE 14
|
||||
# define TS_INFO_UNACCEPTED_POLICY 15
|
||||
# define TS_INFO_UNACCEPTED_EXTENSION 16
|
||||
# define TS_INFO_ADD_INFO_NOT_AVAILABLE 17
|
||||
# define TS_INFO_SYSTEM_FAILURE 25
|
||||
|
||||
|
||||
typedef struct TS_status_info_st TS_STATUS_INFO;
|
||||
typedef struct ESS_issuer_serial ESS_ISSUER_SERIAL;
|
||||
typedef struct ESS_cert_id ESS_CERT_ID;
|
||||
typedef struct ESS_signing_cert ESS_SIGNING_CERT;
|
||||
|
||||
DEFINE_STACK_OF(ESS_CERT_ID)
|
||||
|
||||
typedef struct TS_resp_st TS_RESP;
|
||||
|
||||
TS_REQ *TS_REQ_new(void);
|
||||
void TS_REQ_free(TS_REQ *a);
|
||||
int i2d_TS_REQ(const TS_REQ *a, unsigned char **pp);
|
||||
TS_REQ *d2i_TS_REQ(TS_REQ **a, const unsigned char **pp, long length);
|
||||
|
||||
TS_REQ *TS_REQ_dup(TS_REQ *a);
|
||||
|
||||
#ifndef OPENSSL_NO_STDIO
|
||||
TS_REQ *d2i_TS_REQ_fp(FILE *fp, TS_REQ **a);
|
||||
int i2d_TS_REQ_fp(FILE *fp, TS_REQ *a);
|
||||
#endif
|
||||
TS_REQ *d2i_TS_REQ_bio(BIO *fp, TS_REQ **a);
|
||||
int i2d_TS_REQ_bio(BIO *fp, TS_REQ *a);
|
||||
|
||||
TS_MSG_IMPRINT *TS_MSG_IMPRINT_new(void);
|
||||
void TS_MSG_IMPRINT_free(TS_MSG_IMPRINT *a);
|
||||
int i2d_TS_MSG_IMPRINT(const TS_MSG_IMPRINT *a, unsigned char **pp);
|
||||
TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT(TS_MSG_IMPRINT **a,
|
||||
const unsigned char **pp, long length);
|
||||
|
||||
TS_MSG_IMPRINT *TS_MSG_IMPRINT_dup(TS_MSG_IMPRINT *a);
|
||||
|
||||
#ifndef OPENSSL_NO_STDIO
|
||||
TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT **a);
|
||||
int i2d_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT *a);
|
||||
#endif
|
||||
TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_bio(BIO *bio, TS_MSG_IMPRINT **a);
|
||||
int i2d_TS_MSG_IMPRINT_bio(BIO *bio, TS_MSG_IMPRINT *a);
|
||||
|
||||
TS_RESP *TS_RESP_new(void);
|
||||
void TS_RESP_free(TS_RESP *a);
|
||||
int i2d_TS_RESP(const TS_RESP *a, unsigned char **pp);
|
||||
TS_RESP *d2i_TS_RESP(TS_RESP **a, const unsigned char **pp, long length);
|
||||
TS_TST_INFO *PKCS7_to_TS_TST_INFO(PKCS7 *token);
|
||||
TS_RESP *TS_RESP_dup(TS_RESP *a);
|
||||
|
||||
#ifndef OPENSSL_NO_STDIO
|
||||
TS_RESP *d2i_TS_RESP_fp(FILE *fp, TS_RESP **a);
|
||||
int i2d_TS_RESP_fp(FILE *fp, TS_RESP *a);
|
||||
#endif
|
||||
TS_RESP *d2i_TS_RESP_bio(BIO *bio, TS_RESP **a);
|
||||
int i2d_TS_RESP_bio(BIO *bio, TS_RESP *a);
|
||||
|
||||
TS_STATUS_INFO *TS_STATUS_INFO_new(void);
|
||||
void TS_STATUS_INFO_free(TS_STATUS_INFO *a);
|
||||
int i2d_TS_STATUS_INFO(const TS_STATUS_INFO *a, unsigned char **pp);
|
||||
TS_STATUS_INFO *d2i_TS_STATUS_INFO(TS_STATUS_INFO **a,
|
||||
const unsigned char **pp, long length);
|
||||
TS_STATUS_INFO *TS_STATUS_INFO_dup(TS_STATUS_INFO *a);
|
||||
|
||||
TS_TST_INFO *TS_TST_INFO_new(void);
|
||||
void TS_TST_INFO_free(TS_TST_INFO *a);
|
||||
int i2d_TS_TST_INFO(const TS_TST_INFO *a, unsigned char **pp);
|
||||
TS_TST_INFO *d2i_TS_TST_INFO(TS_TST_INFO **a, const unsigned char **pp,
|
||||
long length);
|
||||
TS_TST_INFO *TS_TST_INFO_dup(TS_TST_INFO *a);
|
||||
|
||||
#ifndef OPENSSL_NO_STDIO
|
||||
TS_TST_INFO *d2i_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO **a);
|
||||
int i2d_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO *a);
|
||||
#endif
|
||||
TS_TST_INFO *d2i_TS_TST_INFO_bio(BIO *bio, TS_TST_INFO **a);
|
||||
int i2d_TS_TST_INFO_bio(BIO *bio, TS_TST_INFO *a);
|
||||
|
||||
TS_ACCURACY *TS_ACCURACY_new(void);
|
||||
void TS_ACCURACY_free(TS_ACCURACY *a);
|
||||
int i2d_TS_ACCURACY(const TS_ACCURACY *a, unsigned char **pp);
|
||||
TS_ACCURACY *d2i_TS_ACCURACY(TS_ACCURACY **a, const unsigned char **pp,
|
||||
long length);
|
||||
TS_ACCURACY *TS_ACCURACY_dup(TS_ACCURACY *a);
|
||||
|
||||
ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_new(void);
|
||||
void ESS_ISSUER_SERIAL_free(ESS_ISSUER_SERIAL *a);
|
||||
int i2d_ESS_ISSUER_SERIAL(const ESS_ISSUER_SERIAL *a, unsigned char **pp);
|
||||
ESS_ISSUER_SERIAL *d2i_ESS_ISSUER_SERIAL(ESS_ISSUER_SERIAL **a,
|
||||
const unsigned char **pp,
|
||||
long length);
|
||||
ESS_ISSUER_SERIAL *ESS_ISSUER_SERIAL_dup(ESS_ISSUER_SERIAL *a);
|
||||
|
||||
ESS_CERT_ID *ESS_CERT_ID_new(void);
|
||||
void ESS_CERT_ID_free(ESS_CERT_ID *a);
|
||||
int i2d_ESS_CERT_ID(const ESS_CERT_ID *a, unsigned char **pp);
|
||||
ESS_CERT_ID *d2i_ESS_CERT_ID(ESS_CERT_ID **a, const unsigned char **pp,
|
||||
long length);
|
||||
ESS_CERT_ID *ESS_CERT_ID_dup(ESS_CERT_ID *a);
|
||||
|
||||
ESS_SIGNING_CERT *ESS_SIGNING_CERT_new(void);
|
||||
void ESS_SIGNING_CERT_free(ESS_SIGNING_CERT *a);
|
||||
int i2d_ESS_SIGNING_CERT(const ESS_SIGNING_CERT *a, unsigned char **pp);
|
||||
ESS_SIGNING_CERT *d2i_ESS_SIGNING_CERT(ESS_SIGNING_CERT **a,
|
||||
const unsigned char **pp, long length);
|
||||
ESS_SIGNING_CERT *ESS_SIGNING_CERT_dup(ESS_SIGNING_CERT *a);
|
||||
|
||||
int TS_REQ_set_version(TS_REQ *a, long version);
|
||||
long TS_REQ_get_version(const TS_REQ *a);
|
||||
|
||||
int TS_STATUS_INFO_set_status(TS_STATUS_INFO *a, int i);
|
||||
const ASN1_INTEGER *TS_STATUS_INFO_get0_status(const TS_STATUS_INFO *a);
|
||||
|
||||
const STACK_OF(ASN1_UTF8STRING) *
|
||||
TS_STATUS_INFO_get0_text(const TS_STATUS_INFO *a);
|
||||
|
||||
const ASN1_BIT_STRING *
|
||||
TS_STATUS_INFO_get0_failure_info(const TS_STATUS_INFO *a);
|
||||
|
||||
int TS_REQ_set_msg_imprint(TS_REQ *a, TS_MSG_IMPRINT *msg_imprint);
|
||||
TS_MSG_IMPRINT *TS_REQ_get_msg_imprint(TS_REQ *a);
|
||||
|
||||
int TS_MSG_IMPRINT_set_algo(TS_MSG_IMPRINT *a, X509_ALGOR *alg);
|
||||
X509_ALGOR *TS_MSG_IMPRINT_get_algo(TS_MSG_IMPRINT *a);
|
||||
|
||||
int TS_MSG_IMPRINT_set_msg(TS_MSG_IMPRINT *a, unsigned char *d, int len);
|
||||
ASN1_OCTET_STRING *TS_MSG_IMPRINT_get_msg(TS_MSG_IMPRINT *a);
|
||||
|
||||
int TS_REQ_set_policy_id(TS_REQ *a, const ASN1_OBJECT *policy);
|
||||
ASN1_OBJECT *TS_REQ_get_policy_id(TS_REQ *a);
|
||||
|
||||
int TS_REQ_set_nonce(TS_REQ *a, const ASN1_INTEGER *nonce);
|
||||
const ASN1_INTEGER *TS_REQ_get_nonce(const TS_REQ *a);
|
||||
|
||||
int TS_REQ_set_cert_req(TS_REQ *a, int cert_req);
|
||||
int TS_REQ_get_cert_req(const TS_REQ *a);
|
||||
|
||||
STACK_OF(X509_EXTENSION) *TS_REQ_get_exts(TS_REQ *a);
|
||||
void TS_REQ_ext_free(TS_REQ *a);
|
||||
int TS_REQ_get_ext_count(TS_REQ *a);
|
||||
int TS_REQ_get_ext_by_NID(TS_REQ *a, int nid, int lastpos);
|
||||
int TS_REQ_get_ext_by_OBJ(TS_REQ *a, const ASN1_OBJECT *obj, int lastpos);
|
||||
int TS_REQ_get_ext_by_critical(TS_REQ *a, int crit, int lastpos);
|
||||
X509_EXTENSION *TS_REQ_get_ext(TS_REQ *a, int loc);
|
||||
X509_EXTENSION *TS_REQ_delete_ext(TS_REQ *a, int loc);
|
||||
int TS_REQ_add_ext(TS_REQ *a, X509_EXTENSION *ex, int loc);
|
||||
void *TS_REQ_get_ext_d2i(TS_REQ *a, int nid, int *crit, int *idx);
|
||||
|
||||
/* Function declarations for TS_REQ defined in ts/ts_req_print.c */
|
||||
|
||||
int TS_REQ_print_bio(BIO *bio, TS_REQ *a);
|
||||
|
||||
/* Function declarations for TS_RESP defined in ts/ts_resp_utils.c */
|
||||
|
||||
int TS_RESP_set_status_info(TS_RESP *a, TS_STATUS_INFO *info);
|
||||
TS_STATUS_INFO *TS_RESP_get_status_info(TS_RESP *a);
|
||||
|
||||
/* Caller loses ownership of PKCS7 and TS_TST_INFO objects. */
|
||||
void TS_RESP_set_tst_info(TS_RESP *a, PKCS7 *p7, TS_TST_INFO *tst_info);
|
||||
PKCS7 *TS_RESP_get_token(TS_RESP *a);
|
||||
TS_TST_INFO *TS_RESP_get_tst_info(TS_RESP *a);
|
||||
|
||||
int TS_TST_INFO_set_version(TS_TST_INFO *a, long version);
|
||||
long TS_TST_INFO_get_version(const TS_TST_INFO *a);
|
||||
|
||||
int TS_TST_INFO_set_policy_id(TS_TST_INFO *a, ASN1_OBJECT *policy_id);
|
||||
ASN1_OBJECT *TS_TST_INFO_get_policy_id(TS_TST_INFO *a);
|
||||
|
||||
int TS_TST_INFO_set_msg_imprint(TS_TST_INFO *a, TS_MSG_IMPRINT *msg_imprint);
|
||||
TS_MSG_IMPRINT *TS_TST_INFO_get_msg_imprint(TS_TST_INFO *a);
|
||||
|
||||
int TS_TST_INFO_set_serial(TS_TST_INFO *a, const ASN1_INTEGER *serial);
|
||||
const ASN1_INTEGER *TS_TST_INFO_get_serial(const TS_TST_INFO *a);
|
||||
|
||||
int TS_TST_INFO_set_time(TS_TST_INFO *a, const ASN1_GENERALIZEDTIME *gtime);
|
||||
const ASN1_GENERALIZEDTIME *TS_TST_INFO_get_time(const TS_TST_INFO *a);
|
||||
|
||||
int TS_TST_INFO_set_accuracy(TS_TST_INFO *a, TS_ACCURACY *accuracy);
|
||||
TS_ACCURACY *TS_TST_INFO_get_accuracy(TS_TST_INFO *a);
|
||||
|
||||
int TS_ACCURACY_set_seconds(TS_ACCURACY *a, const ASN1_INTEGER *seconds);
|
||||
const ASN1_INTEGER *TS_ACCURACY_get_seconds(const TS_ACCURACY *a);
|
||||
|
||||
int TS_ACCURACY_set_millis(TS_ACCURACY *a, const ASN1_INTEGER *millis);
|
||||
const ASN1_INTEGER *TS_ACCURACY_get_millis(const TS_ACCURACY *a);
|
||||
|
||||
int TS_ACCURACY_set_micros(TS_ACCURACY *a, const ASN1_INTEGER *micros);
|
||||
const ASN1_INTEGER *TS_ACCURACY_get_micros(const TS_ACCURACY *a);
|
||||
|
||||
int TS_TST_INFO_set_ordering(TS_TST_INFO *a, int ordering);
|
||||
int TS_TST_INFO_get_ordering(const TS_TST_INFO *a);
|
||||
|
||||
int TS_TST_INFO_set_nonce(TS_TST_INFO *a, const ASN1_INTEGER *nonce);
|
||||
const ASN1_INTEGER *TS_TST_INFO_get_nonce(const TS_TST_INFO *a);
|
||||
|
||||
int TS_TST_INFO_set_tsa(TS_TST_INFO *a, GENERAL_NAME *tsa);
|
||||
GENERAL_NAME *TS_TST_INFO_get_tsa(TS_TST_INFO *a);
|
||||
|
||||
STACK_OF(X509_EXTENSION) *TS_TST_INFO_get_exts(TS_TST_INFO *a);
|
||||
void TS_TST_INFO_ext_free(TS_TST_INFO *a);
|
||||
int TS_TST_INFO_get_ext_count(TS_TST_INFO *a);
|
||||
int TS_TST_INFO_get_ext_by_NID(TS_TST_INFO *a, int nid, int lastpos);
|
||||
int TS_TST_INFO_get_ext_by_OBJ(TS_TST_INFO *a, const ASN1_OBJECT *obj,
|
||||
int lastpos);
|
||||
int TS_TST_INFO_get_ext_by_critical(TS_TST_INFO *a, int crit, int lastpos);
|
||||
X509_EXTENSION *TS_TST_INFO_get_ext(TS_TST_INFO *a, int loc);
|
||||
X509_EXTENSION *TS_TST_INFO_delete_ext(TS_TST_INFO *a, int loc);
|
||||
int TS_TST_INFO_add_ext(TS_TST_INFO *a, X509_EXTENSION *ex, int loc);
|
||||
void *TS_TST_INFO_get_ext_d2i(TS_TST_INFO *a, int nid, int *crit, int *idx);
|
||||
|
||||
/*
|
||||
* Declarations related to response generation, defined in ts/ts_resp_sign.c.
|
||||
*/
|
||||
|
||||
/* Optional flags for response generation. */
|
||||
|
||||
/* Don't include the TSA name in response. */
|
||||
# define TS_TSA_NAME 0x01
|
||||
|
||||
/* Set ordering to true in response. */
|
||||
# define TS_ORDERING 0x02
|
||||
|
||||
/*
|
||||
* Include the signer certificate and the other specified certificates in
|
||||
* the ESS signing certificate attribute beside the PKCS7 signed data.
|
||||
* Only the signer certificates is included by default.
|
||||
*/
|
||||
# define TS_ESS_CERT_ID_CHAIN 0x04
|
||||
|
||||
/* Forward declaration. */
|
||||
struct TS_resp_ctx;
|
||||
|
||||
/* This must return a unique number less than 160 bits long. */
|
||||
typedef ASN1_INTEGER *(*TS_serial_cb) (struct TS_resp_ctx *, void *);
|
||||
|
||||
/*
|
||||
* This must return the seconds and microseconds since Jan 1, 1970 in the sec
|
||||
* and usec variables allocated by the caller. Return non-zero for success
|
||||
* and zero for failure.
|
||||
*/
|
||||
typedef int (*TS_time_cb) (struct TS_resp_ctx *, void *, long *sec,
|
||||
long *usec);
|
||||
|
||||
/*
|
||||
* This must process the given extension. It can modify the TS_TST_INFO
|
||||
* object of the context. Return values: !0 (processed), 0 (error, it must
|
||||
* set the status info/failure info of the response).
|
||||
*/
|
||||
typedef int (*TS_extension_cb) (struct TS_resp_ctx *, X509_EXTENSION *,
|
||||
void *);
|
||||
|
||||
typedef struct TS_resp_ctx TS_RESP_CTX;
|
||||
|
||||
DEFINE_STACK_OF_CONST(EVP_MD)
|
||||
|
||||
/* Creates a response context that can be used for generating responses. */
|
||||
TS_RESP_CTX *TS_RESP_CTX_new(void);
|
||||
void TS_RESP_CTX_free(TS_RESP_CTX *ctx);
|
||||
|
||||
/* This parameter must be set. */
|
||||
int TS_RESP_CTX_set_signer_cert(TS_RESP_CTX *ctx, X509 *signer);
|
||||
|
||||
/* This parameter must be set. */
|
||||
int TS_RESP_CTX_set_signer_key(TS_RESP_CTX *ctx, EVP_PKEY *key);
|
||||
|
||||
int TS_RESP_CTX_set_signer_digest(TS_RESP_CTX *ctx,
|
||||
const EVP_MD *signer_digest);
|
||||
|
||||
/* This parameter must be set. */
|
||||
int TS_RESP_CTX_set_def_policy(TS_RESP_CTX *ctx, const ASN1_OBJECT *def_policy);
|
||||
|
||||
/* No additional certs are included in the response by default. */
|
||||
int TS_RESP_CTX_set_certs(TS_RESP_CTX *ctx, STACK_OF(X509) *certs);
|
||||
|
||||
/*
|
||||
* Adds a new acceptable policy, only the default policy is accepted by
|
||||
* default.
|
||||
*/
|
||||
int TS_RESP_CTX_add_policy(TS_RESP_CTX *ctx, const ASN1_OBJECT *policy);
|
||||
|
||||
/*
|
||||
* Adds a new acceptable message digest. Note that no message digests are
|
||||
* accepted by default. The md argument is shared with the caller.
|
||||
*/
|
||||
int TS_RESP_CTX_add_md(TS_RESP_CTX *ctx, const EVP_MD *md);
|
||||
|
||||
/* Accuracy is not included by default. */
|
||||
int TS_RESP_CTX_set_accuracy(TS_RESP_CTX *ctx,
|
||||
int secs, int millis, int micros);
|
||||
|
||||
/*
|
||||
* Clock precision digits, i.e. the number of decimal digits: '0' means sec,
|
||||
* '3' msec, '6' usec, and so on. Default is 0.
|
||||
*/
|
||||
int TS_RESP_CTX_set_clock_precision_digits(TS_RESP_CTX *ctx,
|
||||
unsigned clock_precision_digits);
|
||||
/* At most we accept usec precision. */
|
||||
# define TS_MAX_CLOCK_PRECISION_DIGITS 6
|
||||
|
||||
/* Maximum status message length */
|
||||
# define TS_MAX_STATUS_LENGTH (1024 * 1024)
|
||||
|
||||
/* No flags are set by default. */
|
||||
void TS_RESP_CTX_add_flags(TS_RESP_CTX *ctx, int flags);
|
||||
|
||||
/* Default callback always returns a constant. */
|
||||
void TS_RESP_CTX_set_serial_cb(TS_RESP_CTX *ctx, TS_serial_cb cb, void *data);
|
||||
|
||||
/* Default callback uses the gettimeofday() and gmtime() system calls. */
|
||||
void TS_RESP_CTX_set_time_cb(TS_RESP_CTX *ctx, TS_time_cb cb, void *data);
|
||||
|
||||
/*
|
||||
* Default callback rejects all extensions. The extension callback is called
|
||||
* when the TS_TST_INFO object is already set up and not signed yet.
|
||||
*/
|
||||
/* FIXME: extension handling is not tested yet. */
|
||||
void TS_RESP_CTX_set_extension_cb(TS_RESP_CTX *ctx,
|
||||
TS_extension_cb cb, void *data);
|
||||
|
||||
/* The following methods can be used in the callbacks. */
|
||||
int TS_RESP_CTX_set_status_info(TS_RESP_CTX *ctx,
|
||||
int status, const char *text);
|
||||
|
||||
/* Sets the status info only if it is still TS_STATUS_GRANTED. */
|
||||
int TS_RESP_CTX_set_status_info_cond(TS_RESP_CTX *ctx,
|
||||
int status, const char *text);
|
||||
|
||||
int TS_RESP_CTX_add_failure_info(TS_RESP_CTX *ctx, int failure);
|
||||
|
||||
/* The get methods below can be used in the extension callback. */
|
||||
TS_REQ *TS_RESP_CTX_get_request(TS_RESP_CTX *ctx);
|
||||
|
||||
TS_TST_INFO *TS_RESP_CTX_get_tst_info(TS_RESP_CTX *ctx);
|
||||
|
||||
/*
|
||||
* Creates the signed TS_TST_INFO and puts it in TS_RESP.
|
||||
* In case of errors it sets the status info properly.
|
||||
* Returns NULL only in case of memory allocation/fatal error.
|
||||
*/
|
||||
TS_RESP *TS_RESP_create_response(TS_RESP_CTX *ctx, BIO *req_bio);
|
||||
|
||||
/*
|
||||
* Declarations related to response verification,
|
||||
* they are defined in ts/ts_resp_verify.c.
|
||||
*/
|
||||
|
||||
int TS_RESP_verify_signature(PKCS7 *token, STACK_OF(X509) *certs,
|
||||
X509_STORE *store, X509 **signer_out);
|
||||
|
||||
/* Context structure for the generic verify method. */
|
||||
|
||||
/* Verify the signer's certificate and the signature of the response. */
|
||||
# define TS_VFY_SIGNATURE (1u << 0)
|
||||
/* Verify the version number of the response. */
|
||||
# define TS_VFY_VERSION (1u << 1)
|
||||
/* Verify if the policy supplied by the user matches the policy of the TSA. */
|
||||
# define TS_VFY_POLICY (1u << 2)
|
||||
/*
|
||||
* Verify the message imprint provided by the user. This flag should not be
|
||||
* specified with TS_VFY_DATA.
|
||||
*/
|
||||
# define TS_VFY_IMPRINT (1u << 3)
|
||||
/*
|
||||
* Verify the message imprint computed by the verify method from the user
|
||||
* provided data and the MD algorithm of the response. This flag should not
|
||||
* be specified with TS_VFY_IMPRINT.
|
||||
*/
|
||||
# define TS_VFY_DATA (1u << 4)
|
||||
/* Verify the nonce value. */
|
||||
# define TS_VFY_NONCE (1u << 5)
|
||||
/* Verify if the TSA name field matches the signer certificate. */
|
||||
# define TS_VFY_SIGNER (1u << 6)
|
||||
/* Verify if the TSA name field equals to the user provided name. */
|
||||
# define TS_VFY_TSA_NAME (1u << 7)
|
||||
|
||||
/* You can use the following convenience constants. */
|
||||
# define TS_VFY_ALL_IMPRINT (TS_VFY_SIGNATURE \
|
||||
| TS_VFY_VERSION \
|
||||
| TS_VFY_POLICY \
|
||||
| TS_VFY_IMPRINT \
|
||||
| TS_VFY_NONCE \
|
||||
| TS_VFY_SIGNER \
|
||||
| TS_VFY_TSA_NAME)
|
||||
# define TS_VFY_ALL_DATA (TS_VFY_SIGNATURE \
|
||||
| TS_VFY_VERSION \
|
||||
| TS_VFY_POLICY \
|
||||
| TS_VFY_DATA \
|
||||
| TS_VFY_NONCE \
|
||||
| TS_VFY_SIGNER \
|
||||
| TS_VFY_TSA_NAME)
|
||||
|
||||
typedef struct TS_verify_ctx TS_VERIFY_CTX;
|
||||
|
||||
int TS_RESP_verify_response(TS_VERIFY_CTX *ctx, TS_RESP *response);
|
||||
int TS_RESP_verify_token(TS_VERIFY_CTX *ctx, PKCS7 *token);
|
||||
|
||||
/*
|
||||
* Declarations related to response verification context,
|
||||
*/
|
||||
TS_VERIFY_CTX *TS_VERIFY_CTX_new(void);
|
||||
void TS_VERIFY_CTX_init(TS_VERIFY_CTX *ctx);
|
||||
void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx);
|
||||
void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx);
|
||||
int TS_VERIFY_CTX_set_flags(TS_VERIFY_CTX *ctx, int f);
|
||||
int TS_VERIFY_CTX_add_flags(TS_VERIFY_CTX *ctx, int f);
|
||||
BIO *TS_VERIFY_CTX_set_data(TS_VERIFY_CTX *ctx, BIO *b);
|
||||
unsigned char *TS_VERIFY_CTX_set_imprint(TS_VERIFY_CTX *ctx,
|
||||
unsigned char *hexstr, long len);
|
||||
X509_STORE *TS_VERIFY_CTX_set_store(TS_VERIFY_CTX *ctx, X509_STORE *s);
|
||||
STACK_OF(X509) *TS_VERIFY_CTS_set_certs(TS_VERIFY_CTX *ctx, STACK_OF(X509) *certs);
|
||||
|
||||
/*-
|
||||
* If ctx is NULL, it allocates and returns a new object, otherwise
|
||||
* it returns ctx. It initialises all the members as follows:
|
||||
* flags = TS_VFY_ALL_IMPRINT & ~(TS_VFY_TSA_NAME | TS_VFY_SIGNATURE)
|
||||
* certs = NULL
|
||||
* store = NULL
|
||||
* policy = policy from the request or NULL if absent (in this case
|
||||
* TS_VFY_POLICY is cleared from flags as well)
|
||||
* md_alg = MD algorithm from request
|
||||
* imprint, imprint_len = imprint from request
|
||||
* data = NULL
|
||||
* nonce, nonce_len = nonce from the request or NULL if absent (in this case
|
||||
* TS_VFY_NONCE is cleared from flags as well)
|
||||
* tsa_name = NULL
|
||||
* Important: after calling this method TS_VFY_SIGNATURE should be added!
|
||||
*/
|
||||
TS_VERIFY_CTX *TS_REQ_to_TS_VERIFY_CTX(TS_REQ *req, TS_VERIFY_CTX *ctx);
|
||||
|
||||
/* Function declarations for TS_RESP defined in ts/ts_resp_print.c */
|
||||
|
||||
int TS_RESP_print_bio(BIO *bio, TS_RESP *a);
|
||||
int TS_STATUS_INFO_print_bio(BIO *bio, TS_STATUS_INFO *a);
|
||||
int TS_TST_INFO_print_bio(BIO *bio, TS_TST_INFO *a);
|
||||
|
||||
/* Common utility functions defined in ts/ts_lib.c */
|
||||
|
||||
int TS_ASN1_INTEGER_print_bio(BIO *bio, const ASN1_INTEGER *num);
|
||||
int TS_OBJ_print_bio(BIO *bio, const ASN1_OBJECT *obj);
|
||||
int TS_ext_print_bio(BIO *bio, const STACK_OF(X509_EXTENSION) *extensions);
|
||||
int TS_X509_ALGOR_print_bio(BIO *bio, const X509_ALGOR *alg);
|
||||
int TS_MSG_IMPRINT_print_bio(BIO *bio, TS_MSG_IMPRINT *msg);
|
||||
|
||||
/*
|
||||
* Function declarations for handling configuration options, defined in
|
||||
* ts/ts_conf.c
|
||||
*/
|
||||
|
||||
X509 *TS_CONF_load_cert(const char *file);
|
||||
STACK_OF(X509) *TS_CONF_load_certs(const char *file);
|
||||
EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass);
|
||||
const char *TS_CONF_get_tsa_section(CONF *conf, const char *section);
|
||||
int TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb,
|
||||
TS_RESP_CTX *ctx);
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
int TS_CONF_set_crypto_device(CONF *conf, const char *section,
|
||||
const char *device);
|
||||
int TS_CONF_set_default_engine(const char *name);
|
||||
#endif
|
||||
int TS_CONF_set_signer_cert(CONF *conf, const char *section,
|
||||
const char *cert, TS_RESP_CTX *ctx);
|
||||
int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs,
|
||||
TS_RESP_CTX *ctx);
|
||||
int TS_CONF_set_signer_key(CONF *conf, const char *section,
|
||||
const char *key, const char *pass,
|
||||
TS_RESP_CTX *ctx);
|
||||
int TS_CONF_set_signer_digest(CONF *conf, const char *section,
|
||||
const char *md, TS_RESP_CTX *ctx);
|
||||
int TS_CONF_set_def_policy(CONF *conf, const char *section,
|
||||
const char *policy, TS_RESP_CTX *ctx);
|
||||
int TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx);
|
||||
int TS_CONF_set_digests(CONF *conf, const char *section, TS_RESP_CTX *ctx);
|
||||
int TS_CONF_set_accuracy(CONF *conf, const char *section, TS_RESP_CTX *ctx);
|
||||
int TS_CONF_set_clock_precision_digits(CONF *conf, const char *section,
|
||||
TS_RESP_CTX *ctx);
|
||||
int TS_CONF_set_ordering(CONF *conf, const char *section, TS_RESP_CTX *ctx);
|
||||
int TS_CONF_set_tsa_name(CONF *conf, const char *section, TS_RESP_CTX *ctx);
|
||||
int TS_CONF_set_ess_cert_id_chain(CONF *conf, const char *section,
|
||||
TS_RESP_CTX *ctx);
|
||||
|
||||
/* -------------------------------------------------- */
|
||||
/* BEGIN ERROR CODES */
|
||||
/*
|
||||
* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
|
||||
int ERR_load_TS_strings(void);
|
||||
|
||||
/* Error codes for the TS functions. */
|
||||
|
||||
/* Function codes. */
|
||||
# define TS_F_DEF_SERIAL_CB 110
|
||||
# define TS_F_DEF_TIME_CB 111
|
||||
# define TS_F_ESS_ADD_SIGNING_CERT 112
|
||||
# define TS_F_ESS_CERT_ID_NEW_INIT 113
|
||||
# define TS_F_ESS_SIGNING_CERT_NEW_INIT 114
|
||||
# define TS_F_INT_TS_RESP_VERIFY_TOKEN 149
|
||||
# define TS_F_PKCS7_TO_TS_TST_INFO 148
|
||||
# define TS_F_TS_ACCURACY_SET_MICROS 115
|
||||
# define TS_F_TS_ACCURACY_SET_MILLIS 116
|
||||
# define TS_F_TS_ACCURACY_SET_SECONDS 117
|
||||
# define TS_F_TS_CHECK_IMPRINTS 100
|
||||
# define TS_F_TS_CHECK_NONCES 101
|
||||
# define TS_F_TS_CHECK_POLICY 102
|
||||
# define TS_F_TS_CHECK_SIGNING_CERTS 103
|
||||
# define TS_F_TS_CHECK_STATUS_INFO 104
|
||||
# define TS_F_TS_COMPUTE_IMPRINT 145
|
||||
# define TS_F_TS_CONF_INVALID 151
|
||||
# define TS_F_TS_CONF_LOAD_CERT 153
|
||||
# define TS_F_TS_CONF_LOAD_CERTS 154
|
||||
# define TS_F_TS_CONF_LOAD_KEY 155
|
||||
# define TS_F_TS_CONF_LOOKUP_FAIL 152
|
||||
# define TS_F_TS_CONF_SET_DEFAULT_ENGINE 146
|
||||
# define TS_F_TS_GET_STATUS_TEXT 105
|
||||
# define TS_F_TS_MSG_IMPRINT_SET_ALGO 118
|
||||
# define TS_F_TS_REQ_SET_MSG_IMPRINT 119
|
||||
# define TS_F_TS_REQ_SET_NONCE 120
|
||||
# define TS_F_TS_REQ_SET_POLICY_ID 121
|
||||
# define TS_F_TS_RESP_CREATE_RESPONSE 122
|
||||
# define TS_F_TS_RESP_CREATE_TST_INFO 123
|
||||
# define TS_F_TS_RESP_CTX_ADD_FAILURE_INFO 124
|
||||
# define TS_F_TS_RESP_CTX_ADD_MD 125
|
||||
# define TS_F_TS_RESP_CTX_ADD_POLICY 126
|
||||
# define TS_F_TS_RESP_CTX_NEW 127
|
||||
# define TS_F_TS_RESP_CTX_SET_ACCURACY 128
|
||||
# define TS_F_TS_RESP_CTX_SET_CERTS 129
|
||||
# define TS_F_TS_RESP_CTX_SET_DEF_POLICY 130
|
||||
# define TS_F_TS_RESP_CTX_SET_SIGNER_CERT 131
|
||||
# define TS_F_TS_RESP_CTX_SET_STATUS_INFO 132
|
||||
# define TS_F_TS_RESP_GET_POLICY 133
|
||||
# define TS_F_TS_RESP_SET_GENTIME_WITH_PRECISION 134
|
||||
# define TS_F_TS_RESP_SET_STATUS_INFO 135
|
||||
# define TS_F_TS_RESP_SET_TST_INFO 150
|
||||
# define TS_F_TS_RESP_SIGN 136
|
||||
# define TS_F_TS_RESP_VERIFY_SIGNATURE 106
|
||||
# define TS_F_TS_TST_INFO_SET_ACCURACY 137
|
||||
# define TS_F_TS_TST_INFO_SET_MSG_IMPRINT 138
|
||||
# define TS_F_TS_TST_INFO_SET_NONCE 139
|
||||
# define TS_F_TS_TST_INFO_SET_POLICY_ID 140
|
||||
# define TS_F_TS_TST_INFO_SET_SERIAL 141
|
||||
# define TS_F_TS_TST_INFO_SET_TIME 142
|
||||
# define TS_F_TS_TST_INFO_SET_TSA 143
|
||||
# define TS_F_TS_VERIFY 108
|
||||
# define TS_F_TS_VERIFY_CERT 109
|
||||
# define TS_F_TS_VERIFY_CTX_NEW 144
|
||||
|
||||
/* Reason codes. */
|
||||
# define TS_R_BAD_PKCS7_TYPE 132
|
||||
# define TS_R_BAD_TYPE 133
|
||||
# define TS_R_CANNOT_LOAD_CERT 137
|
||||
# define TS_R_CANNOT_LOAD_KEY 138
|
||||
# define TS_R_CERTIFICATE_VERIFY_ERROR 100
|
||||
# define TS_R_COULD_NOT_SET_ENGINE 127
|
||||
# define TS_R_COULD_NOT_SET_TIME 115
|
||||
# define TS_R_DETACHED_CONTENT 134
|
||||
# define TS_R_ESS_ADD_SIGNING_CERT_ERROR 116
|
||||
# define TS_R_ESS_SIGNING_CERTIFICATE_ERROR 101
|
||||
# define TS_R_INVALID_NULL_POINTER 102
|
||||
# define TS_R_INVALID_SIGNER_CERTIFICATE_PURPOSE 117
|
||||
# define TS_R_MESSAGE_IMPRINT_MISMATCH 103
|
||||
# define TS_R_NONCE_MISMATCH 104
|
||||
# define TS_R_NONCE_NOT_RETURNED 105
|
||||
# define TS_R_NO_CONTENT 106
|
||||
# define TS_R_NO_TIME_STAMP_TOKEN 107
|
||||
# define TS_R_PKCS7_ADD_SIGNATURE_ERROR 118
|
||||
# define TS_R_PKCS7_ADD_SIGNED_ATTR_ERROR 119
|
||||
# define TS_R_PKCS7_TO_TS_TST_INFO_FAILED 129
|
||||
# define TS_R_POLICY_MISMATCH 108
|
||||
# define TS_R_PRIVATE_KEY_DOES_NOT_MATCH_CERTIFICATE 120
|
||||
# define TS_R_RESPONSE_SETUP_ERROR 121
|
||||
# define TS_R_SIGNATURE_FAILURE 109
|
||||
# define TS_R_THERE_MUST_BE_ONE_SIGNER 110
|
||||
# define TS_R_TIME_SYSCALL_ERROR 122
|
||||
# define TS_R_TOKEN_NOT_PRESENT 130
|
||||
# define TS_R_TOKEN_PRESENT 131
|
||||
# define TS_R_TSA_NAME_MISMATCH 111
|
||||
# define TS_R_TSA_UNTRUSTED 112
|
||||
# define TS_R_TST_INFO_SETUP_ERROR 123
|
||||
# define TS_R_TS_DATASIGN 124
|
||||
# define TS_R_UNACCEPTABLE_POLICY 125
|
||||
# define TS_R_UNSUPPORTED_MD_ALGORITHM 126
|
||||
# define TS_R_UNSUPPORTED_VERSION 113
|
||||
# define TS_R_VAR_BAD_VALUE 135
|
||||
# define TS_R_VAR_LOOKUP_FAILURE 136
|
||||
# define TS_R_WRONG_CONTENT_TYPE 114
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
@ -1,106 +1,54 @@
|
||||
/* crypto/txt_db/txt_db.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_TXT_DB_H
|
||||
#define HEADER_TXT_DB_H
|
||||
# define HEADER_TXT_DB_H
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
#ifndef OPENSSL_NO_BIO
|
||||
#include <openssl/bio.h>
|
||||
#endif
|
||||
#include <openssl/stack.h>
|
||||
#include <openssl/lhash.h>
|
||||
# include <openssl/opensslconf.h>
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/stack.h>
|
||||
# include <openssl/lhash.h>
|
||||
|
||||
#define DB_ERROR_OK 0
|
||||
#define DB_ERROR_MALLOC 1
|
||||
#define DB_ERROR_INDEX_CLASH 2
|
||||
#define DB_ERROR_INDEX_OUT_OF_RANGE 3
|
||||
#define DB_ERROR_NO_INDEX 4
|
||||
#define DB_ERROR_INSERT_INDEX_CLASH 5
|
||||
# define DB_ERROR_OK 0
|
||||
# define DB_ERROR_MALLOC 1
|
||||
# define DB_ERROR_INDEX_CLASH 2
|
||||
# define DB_ERROR_INDEX_OUT_OF_RANGE 3
|
||||
# define DB_ERROR_NO_INDEX 4
|
||||
# define DB_ERROR_INSERT_INDEX_CLASH 5
|
||||
# define DB_ERROR_WRONG_NUM_FIELDS 6
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct txt_db_st
|
||||
{
|
||||
int num_fields;
|
||||
STACK /* char ** */ *data;
|
||||
LHASH **index;
|
||||
int (**qual)(char **);
|
||||
long error;
|
||||
long arg1;
|
||||
long arg2;
|
||||
char **arg_row;
|
||||
} TXT_DB;
|
||||
typedef OPENSSL_STRING *OPENSSL_PSTRING;
|
||||
DEFINE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING)
|
||||
|
||||
typedef struct txt_db_st {
|
||||
int num_fields;
|
||||
STACK_OF(OPENSSL_PSTRING) *data;
|
||||
LHASH_OF(OPENSSL_STRING) **index;
|
||||
int (**qual) (OPENSSL_STRING *);
|
||||
long error;
|
||||
long arg1;
|
||||
long arg2;
|
||||
OPENSSL_STRING *arg_row;
|
||||
} TXT_DB;
|
||||
|
||||
#ifndef OPENSSL_NO_BIO
|
||||
TXT_DB *TXT_DB_read(BIO *in, int num);
|
||||
long TXT_DB_write(BIO *out, TXT_DB *db);
|
||||
#else
|
||||
TXT_DB *TXT_DB_read(char *in, int num);
|
||||
long TXT_DB_write(char *out, TXT_DB *db);
|
||||
#endif
|
||||
int TXT_DB_create_index(TXT_DB *db,int field,int (*qual)(char **),
|
||||
LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp);
|
||||
int TXT_DB_create_index(TXT_DB *db, int field, int (*qual) (OPENSSL_STRING *),
|
||||
OPENSSL_LH_HASHFUNC hash, OPENSSL_LH_COMPFUNC cmp);
|
||||
void TXT_DB_free(TXT_DB *db);
|
||||
char **TXT_DB_get_by_index(TXT_DB *db, int idx, char **value);
|
||||
int TXT_DB_insert(TXT_DB *db,char **value);
|
||||
OPENSSL_STRING *TXT_DB_get_by_index(TXT_DB *db, int idx,
|
||||
OPENSSL_STRING *value);
|
||||
int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *value);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@ -1,113 +1,65 @@
|
||||
/* crypto/ui/ui.h -*- mode:C; c-file-style: "eay" -*- */
|
||||
/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
|
||||
* project 2001.
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 2001 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* openssl-core@openssl.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||
* Hudson (tjh@cryptsoft.com).
|
||||
/*
|
||||
* Copyright 2001-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_UI_H
|
||||
#define HEADER_UI_H
|
||||
# define HEADER_UI_H
|
||||
|
||||
#ifndef OPENSSL_NO_DEPRECATED
|
||||
#include <openssl/crypto.h>
|
||||
#endif
|
||||
#include <openssl/safestack.h>
|
||||
#include <openssl/ossl_typ.h>
|
||||
# include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_UI
|
||||
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# include <openssl/crypto.h>
|
||||
# endif
|
||||
# include <openssl/safestack.h>
|
||||
# include <openssl/ossl_typ.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Declared already in ossl_typ.h */
|
||||
/* typedef struct ui_st UI; */
|
||||
/* typedef struct ui_method_st UI_METHOD; */
|
||||
|
||||
|
||||
/* All the following functions return -1 or NULL on error and in some cases
|
||||
(UI_process()) -2 if interrupted or in some other way cancelled.
|
||||
When everything is fine, they return 0, a positive value or a non-NULL
|
||||
pointer, all depending on their purpose. */
|
||||
/*
|
||||
* All the following functions return -1 or NULL on error and in some cases
|
||||
* (UI_process()) -2 if interrupted or in some other way cancelled. When
|
||||
* everything is fine, they return 0, a positive value or a non-NULL pointer,
|
||||
* all depending on their purpose.
|
||||
*/
|
||||
|
||||
/* Creators and destructor. */
|
||||
UI *UI_new(void);
|
||||
UI *UI_new_method(const UI_METHOD *method);
|
||||
void UI_free(UI *ui);
|
||||
|
||||
/* The following functions are used to add strings to be printed and prompt
|
||||
/*-
|
||||
The following functions are used to add strings to be printed and prompt
|
||||
strings to prompt for data. The names are UI_{add,dup}_<function>_string
|
||||
and UI_{add,dup}_input_boolean.
|
||||
|
||||
UI_{add,dup}_<function>_string have the following meanings:
|
||||
add add a text or prompt string. The pointers given to these
|
||||
functions are used verbatim, no copying is done.
|
||||
dup make a copy of the text or prompt string, then add the copy
|
||||
to the collection of strings in the user interface.
|
||||
<function>
|
||||
The function is a name for the functionality that the given
|
||||
string shall be used for. It can be one of:
|
||||
input use the string as data prompt.
|
||||
verify use the string as verification prompt. This
|
||||
is used to verify a previous input.
|
||||
info use the string for informational output.
|
||||
error use the string for error output.
|
||||
add add a text or prompt string. The pointers given to these
|
||||
functions are used verbatim, no copying is done.
|
||||
dup make a copy of the text or prompt string, then add the copy
|
||||
to the collection of strings in the user interface.
|
||||
<function>
|
||||
The function is a name for the functionality that the given
|
||||
string shall be used for. It can be one of:
|
||||
input use the string as data prompt.
|
||||
verify use the string as verification prompt. This
|
||||
is used to verify a previous input.
|
||||
info use the string for informational output.
|
||||
error use the string for error output.
|
||||
Honestly, there's currently no difference between info and error for the
|
||||
moment.
|
||||
|
||||
UI_{add,dup}_input_boolean have the same semantics for "add" and "dup",
|
||||
and are typically used when one wants to prompt for a yes/no response.
|
||||
|
||||
|
||||
All of the functions in this group take a UI and a prompt string.
|
||||
The string input and verify addition functions also take a flag argument,
|
||||
a buffer for the result to end up with, a minimum input size and a maximum
|
||||
@ -126,21 +78,23 @@ void UI_free(UI *ui);
|
||||
added, so the result is *not* a string.
|
||||
|
||||
On success, the all return an index of the added information. That index
|
||||
is usefull when retrieving results with UI_get0_result(). */
|
||||
is useful when retrieving results with UI_get0_result(). */
|
||||
int UI_add_input_string(UI *ui, const char *prompt, int flags,
|
||||
char *result_buf, int minsize, int maxsize);
|
||||
char *result_buf, int minsize, int maxsize);
|
||||
int UI_dup_input_string(UI *ui, const char *prompt, int flags,
|
||||
char *result_buf, int minsize, int maxsize);
|
||||
char *result_buf, int minsize, int maxsize);
|
||||
int UI_add_verify_string(UI *ui, const char *prompt, int flags,
|
||||
char *result_buf, int minsize, int maxsize, const char *test_buf);
|
||||
char *result_buf, int minsize, int maxsize,
|
||||
const char *test_buf);
|
||||
int UI_dup_verify_string(UI *ui, const char *prompt, int flags,
|
||||
char *result_buf, int minsize, int maxsize, const char *test_buf);
|
||||
char *result_buf, int minsize, int maxsize,
|
||||
const char *test_buf);
|
||||
int UI_add_input_boolean(UI *ui, const char *prompt, const char *action_desc,
|
||||
const char *ok_chars, const char *cancel_chars,
|
||||
int flags, char *result_buf);
|
||||
const char *ok_chars, const char *cancel_chars,
|
||||
int flags, char *result_buf);
|
||||
int UI_dup_input_boolean(UI *ui, const char *prompt, const char *action_desc,
|
||||
const char *ok_chars, const char *cancel_chars,
|
||||
int flags, char *result_buf);
|
||||
const char *ok_chars, const char *cancel_chars,
|
||||
int flags, char *result_buf);
|
||||
int UI_add_info_string(UI *ui, const char *text);
|
||||
int UI_dup_info_string(UI *ui, const char *text);
|
||||
int UI_add_error_string(UI *ui, const char *text);
|
||||
@ -148,56 +102,60 @@ int UI_dup_error_string(UI *ui, const char *text);
|
||||
|
||||
/* These are the possible flags. They can be or'ed together. */
|
||||
/* Use to have echoing of input */
|
||||
#define UI_INPUT_FLAG_ECHO 0x01
|
||||
/* Use a default password. Where that password is found is completely
|
||||
up to the application, it might for example be in the user data set
|
||||
with UI_add_user_data(). It is not recommended to have more than
|
||||
one input in each UI being marked with this flag, or the application
|
||||
might get confused. */
|
||||
#define UI_INPUT_FLAG_DEFAULT_PWD 0x02
|
||||
|
||||
/* The user of these routines may want to define flags of their own. The core
|
||||
UI won't look at those, but will pass them on to the method routines. They
|
||||
must use higher bits so they don't get confused with the UI bits above.
|
||||
UI_INPUT_FLAG_USER_BASE tells which is the lowest bit to use. A good
|
||||
example of use is this:
|
||||
|
||||
#define MY_UI_FLAG1 (0x01 << UI_INPUT_FLAG_USER_BASE)
|
||||
# define UI_INPUT_FLAG_ECHO 0x01
|
||||
/*
|
||||
* Use a default password. Where that password is found is completely up to
|
||||
* the application, it might for example be in the user data set with
|
||||
* UI_add_user_data(). It is not recommended to have more than one input in
|
||||
* each UI being marked with this flag, or the application might get
|
||||
* confused.
|
||||
*/
|
||||
# define UI_INPUT_FLAG_DEFAULT_PWD 0x02
|
||||
|
||||
/*-
|
||||
* The user of these routines may want to define flags of their own. The core
|
||||
* UI won't look at those, but will pass them on to the method routines. They
|
||||
* must use higher bits so they don't get confused with the UI bits above.
|
||||
* UI_INPUT_FLAG_USER_BASE tells which is the lowest bit to use. A good
|
||||
* example of use is this:
|
||||
*
|
||||
* #define MY_UI_FLAG1 (0x01 << UI_INPUT_FLAG_USER_BASE)
|
||||
*
|
||||
*/
|
||||
#define UI_INPUT_FLAG_USER_BASE 16
|
||||
# define UI_INPUT_FLAG_USER_BASE 16
|
||||
|
||||
|
||||
/* The following function helps construct a prompt. object_desc is a
|
||||
textual short description of the object, for example "pass phrase",
|
||||
and object_name is the name of the object (might be a card name or
|
||||
a file name.
|
||||
The returned string shall always be allocated on the heap with
|
||||
OPENSSL_malloc(), and need to be free'd with OPENSSL_free().
|
||||
|
||||
If the ui_method doesn't contain a pointer to a user-defined prompt
|
||||
constructor, a default string is built, looking like this:
|
||||
|
||||
"Enter {object_desc} for {object_name}:"
|
||||
|
||||
So, if object_desc has the value "pass phrase" and object_name has
|
||||
the value "foo.key", the resulting string is:
|
||||
|
||||
"Enter pass phrase for foo.key:"
|
||||
/*-
|
||||
* The following function helps construct a prompt. object_desc is a
|
||||
* textual short description of the object, for example "pass phrase",
|
||||
* and object_name is the name of the object (might be a card name or
|
||||
* a file name.
|
||||
* The returned string shall always be allocated on the heap with
|
||||
* OPENSSL_malloc(), and need to be free'd with OPENSSL_free().
|
||||
*
|
||||
* If the ui_method doesn't contain a pointer to a user-defined prompt
|
||||
* constructor, a default string is built, looking like this:
|
||||
*
|
||||
* "Enter {object_desc} for {object_name}:"
|
||||
*
|
||||
* So, if object_desc has the value "pass phrase" and object_name has
|
||||
* the value "foo.key", the resulting string is:
|
||||
*
|
||||
* "Enter pass phrase for foo.key:"
|
||||
*/
|
||||
char *UI_construct_prompt(UI *ui_method,
|
||||
const char *object_desc, const char *object_name);
|
||||
const char *object_desc, const char *object_name);
|
||||
|
||||
|
||||
/* The following function is used to store a pointer to user-specific data.
|
||||
Any previous such pointer will be returned and replaced.
|
||||
|
||||
For callback purposes, this function makes a lot more sense than using
|
||||
ex_data, since the latter requires that different parts of OpenSSL or
|
||||
applications share the same ex_data index.
|
||||
|
||||
Note that the UI_OpenSSL() method completely ignores the user data.
|
||||
Other methods may not, however. */
|
||||
/*
|
||||
* The following function is used to store a pointer to user-specific data.
|
||||
* Any previous such pointer will be returned and replaced.
|
||||
*
|
||||
* For callback purposes, this function makes a lot more sense than using
|
||||
* ex_data, since the latter requires that different parts of OpenSSL or
|
||||
* applications share the same ex_data index.
|
||||
*
|
||||
* Note that the UI_OpenSSL() method completely ignores the user data. Other
|
||||
* methods may not, however.
|
||||
*/
|
||||
void *UI_add_user_data(UI *ui, void *user_data);
|
||||
/* We need a user data retrieving function as well. */
|
||||
void *UI_get0_user_data(UI *ui);
|
||||
@ -208,28 +166,34 @@ const char *UI_get0_result(UI *ui, int i);
|
||||
/* When all strings have been added, process the whole thing. */
|
||||
int UI_process(UI *ui);
|
||||
|
||||
/* Give a user interface parametrised control commands. This can be used to
|
||||
send down an integer, a data pointer or a function pointer, as well as
|
||||
be used to get information from a UI. */
|
||||
int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f)(void));
|
||||
/*
|
||||
* Give a user interface parametrised control commands. This can be used to
|
||||
* send down an integer, a data pointer or a function pointer, as well as be
|
||||
* used to get information from a UI.
|
||||
*/
|
||||
int UI_ctrl(UI *ui, int cmd, long i, void *p, void (*f) (void));
|
||||
|
||||
/* The commands */
|
||||
/* Use UI_CONTROL_PRINT_ERRORS with the value 1 to have UI_process print the
|
||||
OpenSSL error stack before printing any info or added error messages and
|
||||
before any prompting. */
|
||||
#define UI_CTRL_PRINT_ERRORS 1
|
||||
/* Check if a UI_process() is possible to do again with the same instance of
|
||||
a user interface. This makes UI_ctrl() return 1 if it is redoable, and 0
|
||||
if not. */
|
||||
#define UI_CTRL_IS_REDOABLE 2
|
||||
|
||||
/*
|
||||
* Use UI_CONTROL_PRINT_ERRORS with the value 1 to have UI_process print the
|
||||
* OpenSSL error stack before printing any info or added error messages and
|
||||
* before any prompting.
|
||||
*/
|
||||
# define UI_CTRL_PRINT_ERRORS 1
|
||||
/*
|
||||
* Check if a UI_process() is possible to do again with the same instance of
|
||||
* a user interface. This makes UI_ctrl() return 1 if it is redoable, and 0
|
||||
* if not.
|
||||
*/
|
||||
# define UI_CTRL_IS_REDOABLE 2
|
||||
|
||||
/* Some methods may use extra data */
|
||||
#define UI_set_app_data(s,arg) UI_set_ex_data(s,0,arg)
|
||||
#define UI_get_app_data(s) UI_get_ex_data(s,0)
|
||||
int UI_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
|
||||
CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
|
||||
int UI_set_ex_data(UI *r,int idx,void *arg);
|
||||
# define UI_set_app_data(s,arg) UI_set_ex_data(s,0,arg)
|
||||
# define UI_get_app_data(s) UI_get_ex_data(s,0)
|
||||
|
||||
#define UI_get_ex_new_index(l, p, newf, dupf, freef) \
|
||||
CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_UI, l, p, newf, dupf, freef)
|
||||
int UI_set_ex_data(UI *r, int idx, void *arg);
|
||||
void *UI_get_ex_data(UI *r, int idx);
|
||||
|
||||
/* Use specific methods instead of the built-in one */
|
||||
@ -241,34 +205,34 @@ const UI_METHOD *UI_set_method(UI *ui, const UI_METHOD *meth);
|
||||
/* The method with all the built-in thingies */
|
||||
UI_METHOD *UI_OpenSSL(void);
|
||||
|
||||
|
||||
/* ---------- For method writers ---------- */
|
||||
/* A method contains a number of functions that implement the low level
|
||||
/*-
|
||||
A method contains a number of functions that implement the low level
|
||||
of the User Interface. The functions are:
|
||||
|
||||
an opener This function starts a session, maybe by opening
|
||||
a channel to a tty, or by opening a window.
|
||||
a writer This function is called to write a given string,
|
||||
maybe to the tty, maybe as a field label in a
|
||||
window.
|
||||
a flusher This function is called to flush everything that
|
||||
has been output so far. It can be used to actually
|
||||
display a dialog box after it has been built.
|
||||
a reader This function is called to read a given prompt,
|
||||
maybe from the tty, maybe from a field in a
|
||||
window. Note that it's called wth all string
|
||||
structures, not only the prompt ones, so it must
|
||||
check such things itself.
|
||||
a closer This function closes the session, maybe by closing
|
||||
the channel to the tty, or closing the window.
|
||||
an opener This function starts a session, maybe by opening
|
||||
a channel to a tty, or by opening a window.
|
||||
a writer This function is called to write a given string,
|
||||
maybe to the tty, maybe as a field label in a
|
||||
window.
|
||||
a flusher This function is called to flush everything that
|
||||
has been output so far. It can be used to actually
|
||||
display a dialog box after it has been built.
|
||||
a reader This function is called to read a given prompt,
|
||||
maybe from the tty, maybe from a field in a
|
||||
window. Note that it's called with all string
|
||||
structures, not only the prompt ones, so it must
|
||||
check such things itself.
|
||||
a closer This function closes the session, maybe by closing
|
||||
the channel to the tty, or closing the window.
|
||||
|
||||
All these functions are expected to return:
|
||||
|
||||
0 on error.
|
||||
1 on success.
|
||||
-1 on out-of-band events, for example if some prompting has
|
||||
been canceled (by pressing Ctrl-C, for example). This is
|
||||
only checked when returned by the flusher or the reader.
|
||||
0 on error.
|
||||
1 on success.
|
||||
-1 on out-of-band events, for example if some prompting has
|
||||
been canceled (by pressing Ctrl-C, for example). This is
|
||||
only checked when returned by the flusher or the reader.
|
||||
|
||||
The way this is used, the opener is first called, then the writer for all
|
||||
strings, then the flusher, then the reader for all strings and finally the
|
||||
@ -284,40 +248,55 @@ UI_METHOD *UI_OpenSSL(void);
|
||||
the reader take a UI_STRING.
|
||||
*/
|
||||
|
||||
/* The UI_STRING type is the data structure that contains all the needed info
|
||||
about a string or a prompt, including test data for a verification prompt.
|
||||
*/
|
||||
DECLARE_STACK_OF(UI_STRING)
|
||||
/*
|
||||
* The UI_STRING type is the data structure that contains all the needed info
|
||||
* about a string or a prompt, including test data for a verification prompt.
|
||||
*/
|
||||
typedef struct ui_string_st UI_STRING;
|
||||
DEFINE_STACK_OF(UI_STRING)
|
||||
|
||||
/* The different types of strings that are currently supported.
|
||||
This is only needed by method authors. */
|
||||
enum UI_string_types
|
||||
{
|
||||
UIT_NONE=0,
|
||||
UIT_PROMPT, /* Prompt for a string */
|
||||
UIT_VERIFY, /* Prompt for a string and verify */
|
||||
UIT_BOOLEAN, /* Prompt for a yes/no response */
|
||||
UIT_INFO, /* Send info to the user */
|
||||
UIT_ERROR /* Send an error message to the user */
|
||||
};
|
||||
/*
|
||||
* The different types of strings that are currently supported. This is only
|
||||
* needed by method authors.
|
||||
*/
|
||||
enum UI_string_types {
|
||||
UIT_NONE = 0,
|
||||
UIT_PROMPT, /* Prompt for a string */
|
||||
UIT_VERIFY, /* Prompt for a string and verify */
|
||||
UIT_BOOLEAN, /* Prompt for a yes/no response */
|
||||
UIT_INFO, /* Send info to the user */
|
||||
UIT_ERROR /* Send an error message to the user */
|
||||
};
|
||||
|
||||
/* Create and manipulate methods */
|
||||
UI_METHOD *UI_create_method(char *name);
|
||||
UI_METHOD *UI_create_method(const char *name);
|
||||
void UI_destroy_method(UI_METHOD *ui_method);
|
||||
int UI_method_set_opener(UI_METHOD *method, int (*opener)(UI *ui));
|
||||
int UI_method_set_writer(UI_METHOD *method, int (*writer)(UI *ui, UI_STRING *uis));
|
||||
int UI_method_set_flusher(UI_METHOD *method, int (*flusher)(UI *ui));
|
||||
int UI_method_set_reader(UI_METHOD *method, int (*reader)(UI *ui, UI_STRING *uis));
|
||||
int UI_method_set_closer(UI_METHOD *method, int (*closer)(UI *ui));
|
||||
int (*UI_method_get_opener(UI_METHOD *method))(UI*);
|
||||
int (*UI_method_get_writer(UI_METHOD *method))(UI*,UI_STRING*);
|
||||
int (*UI_method_get_flusher(UI_METHOD *method))(UI*);
|
||||
int (*UI_method_get_reader(UI_METHOD *method))(UI*,UI_STRING*);
|
||||
int (*UI_method_get_closer(UI_METHOD *method))(UI*);
|
||||
int UI_method_set_opener(UI_METHOD *method, int (*opener) (UI *ui));
|
||||
int UI_method_set_writer(UI_METHOD *method,
|
||||
int (*writer) (UI *ui, UI_STRING *uis));
|
||||
int UI_method_set_flusher(UI_METHOD *method, int (*flusher) (UI *ui));
|
||||
int UI_method_set_reader(UI_METHOD *method,
|
||||
int (*reader) (UI *ui, UI_STRING *uis));
|
||||
int UI_method_set_closer(UI_METHOD *method, int (*closer) (UI *ui));
|
||||
int UI_method_set_prompt_constructor(UI_METHOD *method,
|
||||
char *(*prompt_constructor) (UI *ui,
|
||||
const char
|
||||
*object_desc,
|
||||
const char
|
||||
*object_name));
|
||||
int (*UI_method_get_opener(UI_METHOD *method)) (UI *);
|
||||
int (*UI_method_get_writer(UI_METHOD *method)) (UI *, UI_STRING *);
|
||||
int (*UI_method_get_flusher(UI_METHOD *method)) (UI *);
|
||||
int (*UI_method_get_reader(UI_METHOD *method)) (UI *, UI_STRING *);
|
||||
int (*UI_method_get_closer(UI_METHOD *method)) (UI *);
|
||||
char *(*UI_method_get_prompt_constructor(UI_METHOD *method)) (UI *,
|
||||
const char *,
|
||||
const char *);
|
||||
|
||||
/* The following functions are helpers for method writers to access relevant
|
||||
data from a UI_STRING. */
|
||||
/*
|
||||
* The following functions are helpers for method writers to access relevant
|
||||
* data from a UI_STRING.
|
||||
*/
|
||||
|
||||
/* Return type of the UI_STRING */
|
||||
enum UI_string_types UI_get_string_type(UI_STRING *uis);
|
||||
@ -325,11 +304,16 @@ enum UI_string_types UI_get_string_type(UI_STRING *uis);
|
||||
int UI_get_input_flags(UI_STRING *uis);
|
||||
/* Return the actual string to output (the prompt, info or error) */
|
||||
const char *UI_get0_output_string(UI_STRING *uis);
|
||||
/* Return the optional action string to output (the boolean promtp instruction) */
|
||||
/*
|
||||
* Return the optional action string to output (the boolean prompt
|
||||
* instruction)
|
||||
*/
|
||||
const char *UI_get0_action_string(UI_STRING *uis);
|
||||
/* Return the result of a prompt */
|
||||
const char *UI_get0_result_string(UI_STRING *uis);
|
||||
/* Return the string to test the result against. Only useful with verifies. */
|
||||
/*
|
||||
* Return the string to test the result against. Only useful with verifies.
|
||||
*/
|
||||
const char *UI_get0_test_string(UI_STRING *uis);
|
||||
/* Return the required minimum size of the result */
|
||||
int UI_get_result_minsize(UI_STRING *uis);
|
||||
@ -338,44 +322,57 @@ int UI_get_result_maxsize(UI_STRING *uis);
|
||||
/* Set the result of a UI_STRING. */
|
||||
int UI_set_result(UI *ui, UI_STRING *uis, const char *result);
|
||||
|
||||
|
||||
/* A couple of popular utility functions */
|
||||
int UI_UTIL_read_pw_string(char *buf,int length,const char *prompt,int verify);
|
||||
int UI_UTIL_read_pw(char *buf,char *buff,int size,const char *prompt,int verify);
|
||||
|
||||
int UI_UTIL_read_pw_string(char *buf, int length, const char *prompt,
|
||||
int verify);
|
||||
int UI_UTIL_read_pw(char *buf, char *buff, int size, const char *prompt,
|
||||
int verify);
|
||||
|
||||
/* BEGIN ERROR CODES */
|
||||
/* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
/*
|
||||
* The following lines are auto generated by the script mkerr.pl. Any changes
|
||||
* made after this point may be overwritten when the script is next run.
|
||||
*/
|
||||
void ERR_load_UI_strings(void);
|
||||
|
||||
int ERR_load_UI_strings(void);
|
||||
|
||||
/* Error codes for the UI functions. */
|
||||
|
||||
/* Function codes. */
|
||||
#define UI_F_GENERAL_ALLOCATE_BOOLEAN 108
|
||||
#define UI_F_GENERAL_ALLOCATE_PROMPT 109
|
||||
#define UI_F_GENERAL_ALLOCATE_STRING 100
|
||||
#define UI_F_UI_CTRL 111
|
||||
#define UI_F_UI_DUP_ERROR_STRING 101
|
||||
#define UI_F_UI_DUP_INFO_STRING 102
|
||||
#define UI_F_UI_DUP_INPUT_BOOLEAN 110
|
||||
#define UI_F_UI_DUP_INPUT_STRING 103
|
||||
#define UI_F_UI_DUP_VERIFY_STRING 106
|
||||
#define UI_F_UI_GET0_RESULT 107
|
||||
#define UI_F_UI_NEW_METHOD 104
|
||||
#define UI_F_UI_SET_RESULT 105
|
||||
# define UI_F_CLOSE_CONSOLE 115
|
||||
# define UI_F_ECHO_CONSOLE 116
|
||||
# define UI_F_GENERAL_ALLOCATE_BOOLEAN 108
|
||||
# define UI_F_GENERAL_ALLOCATE_PROMPT 109
|
||||
# define UI_F_NOECHO_CONSOLE 117
|
||||
# define UI_F_OPEN_CONSOLE 114
|
||||
# define UI_F_UI_CREATE_METHOD 112
|
||||
# define UI_F_UI_CTRL 111
|
||||
# define UI_F_UI_DUP_ERROR_STRING 101
|
||||
# define UI_F_UI_DUP_INFO_STRING 102
|
||||
# define UI_F_UI_DUP_INPUT_BOOLEAN 110
|
||||
# define UI_F_UI_DUP_INPUT_STRING 103
|
||||
# define UI_F_UI_DUP_VERIFY_STRING 106
|
||||
# define UI_F_UI_GET0_RESULT 107
|
||||
# define UI_F_UI_NEW_METHOD 104
|
||||
# define UI_F_UI_PROCESS 113
|
||||
# define UI_F_UI_SET_RESULT 105
|
||||
|
||||
/* Reason codes. */
|
||||
#define UI_R_COMMON_OK_AND_CANCEL_CHARACTERS 104
|
||||
#define UI_R_INDEX_TOO_LARGE 102
|
||||
#define UI_R_INDEX_TOO_SMALL 103
|
||||
#define UI_R_NO_RESULT_BUFFER 105
|
||||
#define UI_R_RESULT_TOO_LARGE 100
|
||||
#define UI_R_RESULT_TOO_SMALL 101
|
||||
#define UI_R_UNKNOWN_CONTROL_COMMAND 106
|
||||
# define UI_R_COMMON_OK_AND_CANCEL_CHARACTERS 104
|
||||
# define UI_R_INDEX_TOO_LARGE 102
|
||||
# define UI_R_INDEX_TOO_SMALL 103
|
||||
# define UI_R_NO_RESULT_BUFFER 105
|
||||
# define UI_R_PROCESSING_ERROR 107
|
||||
# define UI_R_RESULT_TOO_LARGE 100
|
||||
# define UI_R_RESULT_TOO_SMALL 101
|
||||
# define UI_R_SYSASSIGN_ERROR 109
|
||||
# define UI_R_SYSDASSGN_ERROR 110
|
||||
# define UI_R_SYSQIOW_ERROR 111
|
||||
# define UI_R_UNKNOWN_CONTROL_COMMAND 106
|
||||
# define UI_R_UNKNOWN_TTYGET_ERRNO_VALUE 108
|
||||
|
||||
#ifdef __cplusplus
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
48
src/dep/include/openssl/whrlpool.h
Normal file
48
src/dep/include/openssl/whrlpool.h
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright 2005-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_WHRLPOOL_H
|
||||
# define HEADER_WHRLPOOL_H
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
|
||||
# ifndef OPENSSL_NO_WHIRLPOOL
|
||||
# include <openssl/e_os2.h>
|
||||
# include <stddef.h>
|
||||
# ifdef __cplusplus
|
||||
extern "C" {
|
||||
# endif
|
||||
|
||||
# define WHIRLPOOL_DIGEST_LENGTH (512/8)
|
||||
# define WHIRLPOOL_BBLOCK 512
|
||||
# define WHIRLPOOL_COUNTER (256/8)
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
unsigned char c[WHIRLPOOL_DIGEST_LENGTH];
|
||||
/* double q is here to ensure 64-bit alignment */
|
||||
double q[WHIRLPOOL_DIGEST_LENGTH / sizeof(double)];
|
||||
} H;
|
||||
unsigned char data[WHIRLPOOL_BBLOCK / 8];
|
||||
unsigned int bitoff;
|
||||
size_t bitlen[WHIRLPOOL_COUNTER / sizeof(size_t)];
|
||||
} WHIRLPOOL_CTX;
|
||||
|
||||
int WHIRLPOOL_Init(WHIRLPOOL_CTX *c);
|
||||
int WHIRLPOOL_Update(WHIRLPOOL_CTX *c, const void *inp, size_t bytes);
|
||||
void WHIRLPOOL_BitUpdate(WHIRLPOOL_CTX *c, const void *inp, size_t bits);
|
||||
int WHIRLPOOL_Final(unsigned char *md, WHIRLPOOL_CTX *c);
|
||||
unsigned char *WHIRLPOOL(const void *inp, size_t bytes, unsigned char *md);
|
||||
|
||||
# ifdef __cplusplus
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,109 +1,41 @@
|
||||
/* crypto/x509/x509_vfy.h */
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
/*
|
||||
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
* Licensed under the OpenSSL license (the "License"). You may not use
|
||||
* this file except in compliance with the License. You can obtain a copy
|
||||
* in the file LICENSE in the source distribution or at
|
||||
* https://www.openssl.org/source/license.html
|
||||
*/
|
||||
|
||||
#ifndef HEADER_X509_H
|
||||
#include <openssl/x509.h>
|
||||
/* openssl/x509.h ends up #include-ing this file at about the only
|
||||
* appropriate moment. */
|
||||
#endif
|
||||
|
||||
#ifndef HEADER_X509_VFY_H
|
||||
#define HEADER_X509_VFY_H
|
||||
# define HEADER_X509_VFY_H
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
#ifndef OPENSSL_NO_LHASH
|
||||
#include <openssl/lhash.h>
|
||||
#endif
|
||||
#include <openssl/bio.h>
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/symhacks.h>
|
||||
/*
|
||||
* Protect against recursion, x509.h and x509_vfy.h each include the other.
|
||||
*/
|
||||
# ifndef HEADER_X509_H
|
||||
# include <openssl/x509.h>
|
||||
# endif
|
||||
|
||||
# include <openssl/opensslconf.h>
|
||||
# include <openssl/lhash.h>
|
||||
# include <openssl/bio.h>
|
||||
# include <openssl/crypto.h>
|
||||
# include <openssl/symhacks.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Outer object */
|
||||
typedef struct x509_hash_dir_st
|
||||
{
|
||||
int num_dirs;
|
||||
char **dirs;
|
||||
int *dirs_type;
|
||||
int num_dirs_alloced;
|
||||
} X509_HASH_DIR_CTX;
|
||||
|
||||
typedef struct x509_file_st
|
||||
{
|
||||
int num_paths; /* number of paths to files or directories */
|
||||
int num_alloced;
|
||||
char **paths; /* the list of paths or directories */
|
||||
int *path_type;
|
||||
} X509_CERT_FILE_CTX;
|
||||
|
||||
/*******************************/
|
||||
/*
|
||||
/*-
|
||||
SSL_CTX -> X509_STORE
|
||||
-> X509_LOOKUP
|
||||
->X509_LOOKUP_METHOD
|
||||
-> X509_LOOKUP
|
||||
->X509_LOOKUP_METHOD
|
||||
-> X509_LOOKUP
|
||||
->X509_LOOKUP_METHOD
|
||||
-> X509_LOOKUP
|
||||
->X509_LOOKUP_METHOD
|
||||
|
||||
SSL -> X509_STORE_CTX
|
||||
->X509_STORE
|
||||
SSL -> X509_STORE_CTX
|
||||
->X509_STORE
|
||||
|
||||
The X509_STORE holds the tables etc for verification stuff.
|
||||
A X509_STORE_CTX is used while validating a single certificate.
|
||||
@ -112,281 +44,283 @@ The X509_STORE then calls a function to actually verify the
|
||||
certificate chain.
|
||||
*/
|
||||
|
||||
#define X509_LU_RETRY -1
|
||||
#define X509_LU_FAIL 0
|
||||
#define X509_LU_X509 1
|
||||
#define X509_LU_CRL 2
|
||||
#define X509_LU_PKEY 3
|
||||
typedef enum {
|
||||
X509_LU_NONE = 0,
|
||||
X509_LU_X509, X509_LU_CRL
|
||||
} X509_LOOKUP_TYPE;
|
||||
|
||||
typedef struct x509_object_st
|
||||
{
|
||||
/* one of the above types */
|
||||
int type;
|
||||
union {
|
||||
char *ptr;
|
||||
X509 *x509;
|
||||
X509_CRL *crl;
|
||||
EVP_PKEY *pkey;
|
||||
} data;
|
||||
} X509_OBJECT;
|
||||
#if OPENSSL_API_COMPAT < 0x10100000L
|
||||
#define X509_LU_RETRY -1
|
||||
#define X509_LU_FAIL 0
|
||||
#endif
|
||||
|
||||
typedef struct x509_lookup_st X509_LOOKUP;
|
||||
|
||||
DECLARE_STACK_OF(X509_LOOKUP)
|
||||
DECLARE_STACK_OF(X509_OBJECT)
|
||||
|
||||
/* This is a static that defines the function interface */
|
||||
typedef struct x509_lookup_method_st
|
||||
{
|
||||
const char *name;
|
||||
int (*new_item)(X509_LOOKUP *ctx);
|
||||
void (*free)(X509_LOOKUP *ctx);
|
||||
int (*init)(X509_LOOKUP *ctx);
|
||||
int (*shutdown)(X509_LOOKUP *ctx);
|
||||
int (*ctrl)(X509_LOOKUP *ctx,int cmd,const char *argc,long argl,
|
||||
char **ret);
|
||||
int (*get_by_subject)(X509_LOOKUP *ctx,int type,X509_NAME *name,
|
||||
X509_OBJECT *ret);
|
||||
int (*get_by_issuer_serial)(X509_LOOKUP *ctx,int type,X509_NAME *name,
|
||||
ASN1_INTEGER *serial,X509_OBJECT *ret);
|
||||
int (*get_by_fingerprint)(X509_LOOKUP *ctx,int type,
|
||||
unsigned char *bytes,int len,
|
||||
X509_OBJECT *ret);
|
||||
int (*get_by_alias)(X509_LOOKUP *ctx,int type,char *str,int len,
|
||||
X509_OBJECT *ret);
|
||||
} X509_LOOKUP_METHOD;
|
||||
|
||||
/* This structure hold all parameters associated with a verify operation
|
||||
* by including an X509_VERIFY_PARAM structure in related structures the
|
||||
* parameters used can be customized
|
||||
*/
|
||||
|
||||
typedef struct X509_VERIFY_PARAM_st
|
||||
{
|
||||
char *name;
|
||||
time_t check_time; /* Time to use */
|
||||
unsigned long inh_flags; /* Inheritance flags */
|
||||
unsigned long flags; /* Various verify flags */
|
||||
int purpose; /* purpose to check untrusted certificates */
|
||||
int trust; /* trust setting to check */
|
||||
int depth; /* Verify depth */
|
||||
STACK_OF(ASN1_OBJECT) *policies; /* Permissible policies */
|
||||
} X509_VERIFY_PARAM;
|
||||
|
||||
DECLARE_STACK_OF(X509_VERIFY_PARAM)
|
||||
|
||||
/* This is used to hold everything. It is used for all certificate
|
||||
* validation. Once we have a certificate chain, the 'verify'
|
||||
* function is then called to actually check the cert chain. */
|
||||
struct x509_store_st
|
||||
{
|
||||
/* The following is a cache of trusted certs */
|
||||
int cache; /* if true, stash any hits */
|
||||
STACK_OF(X509_OBJECT) *objs; /* Cache of all objects */
|
||||
|
||||
/* These are external lookup methods */
|
||||
STACK_OF(X509_LOOKUP) *get_cert_methods;
|
||||
|
||||
X509_VERIFY_PARAM *param;
|
||||
|
||||
/* Callbacks for various operations */
|
||||
int (*verify)(X509_STORE_CTX *ctx); /* called to verify a certificate */
|
||||
int (*verify_cb)(int ok,X509_STORE_CTX *ctx); /* error callback */
|
||||
int (*get_issuer)(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); /* get issuers cert from ctx */
|
||||
int (*check_issued)(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); /* check issued */
|
||||
int (*check_revocation)(X509_STORE_CTX *ctx); /* Check revocation status of chain */
|
||||
int (*get_crl)(X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x); /* retrieve CRL */
|
||||
int (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl); /* Check CRL validity */
|
||||
int (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); /* Check certificate against CRL */
|
||||
int (*cleanup)(X509_STORE_CTX *ctx);
|
||||
|
||||
CRYPTO_EX_DATA ex_data;
|
||||
int references;
|
||||
} /* X509_STORE */;
|
||||
DEFINE_STACK_OF(X509_LOOKUP)
|
||||
DEFINE_STACK_OF(X509_OBJECT)
|
||||
DEFINE_STACK_OF(X509_VERIFY_PARAM)
|
||||
|
||||
int X509_STORE_set_depth(X509_STORE *store, int depth);
|
||||
|
||||
#define X509_STORE_set_verify_cb_func(ctx,func) ((ctx)->verify_cb=(func))
|
||||
#define X509_STORE_set_verify_func(ctx,func) ((ctx)->verify=(func))
|
||||
typedef int (*X509_STORE_CTX_verify_cb)(int, X509_STORE_CTX *);
|
||||
typedef int (*X509_STORE_CTX_verify_fn)(X509_STORE_CTX *);
|
||||
typedef int (*X509_STORE_CTX_get_issuer_fn)(X509 **issuer,
|
||||
X509_STORE_CTX *ctx, X509 *x);
|
||||
typedef int (*X509_STORE_CTX_check_issued_fn)(X509_STORE_CTX *ctx,
|
||||
X509 *x, X509 *issuer);
|
||||
typedef int (*X509_STORE_CTX_check_revocation_fn)(X509_STORE_CTX *ctx);
|
||||
typedef int (*X509_STORE_CTX_get_crl_fn)(X509_STORE_CTX *ctx,
|
||||
X509_CRL **crl, X509 *x);
|
||||
typedef int (*X509_STORE_CTX_check_crl_fn)(X509_STORE_CTX *ctx, X509_CRL *crl);
|
||||
typedef int (*X509_STORE_CTX_cert_crl_fn)(X509_STORE_CTX *ctx,
|
||||
X509_CRL *crl, X509 *x);
|
||||
typedef int (*X509_STORE_CTX_check_policy_fn)(X509_STORE_CTX *ctx);
|
||||
typedef STACK_OF(X509) *(*X509_STORE_CTX_lookup_certs_fn)(X509_STORE_CTX *ctx,
|
||||
X509_NAME *nm);
|
||||
typedef STACK_OF(X509_CRL) *(*X509_STORE_CTX_lookup_crls_fn)(X509_STORE_CTX *ctx,
|
||||
X509_NAME *nm);
|
||||
typedef int (*X509_STORE_CTX_cleanup_fn)(X509_STORE_CTX *ctx);
|
||||
|
||||
/* This is the functions plus an instance of the local variables. */
|
||||
struct x509_lookup_st
|
||||
{
|
||||
int init; /* have we been started */
|
||||
int skip; /* don't use us. */
|
||||
X509_LOOKUP_METHOD *method; /* the functions */
|
||||
char *method_data; /* method data */
|
||||
|
||||
X509_STORE *store_ctx; /* who owns us */
|
||||
} /* X509_LOOKUP */;
|
||||
|
||||
/* This is a used when verifying cert chains. Since the
|
||||
* gathering of the cert chain can take some time (and have to be
|
||||
* 'retried', this needs to be kept and passed around. */
|
||||
struct x509_store_ctx_st /* X509_STORE_CTX */
|
||||
{
|
||||
X509_STORE *ctx;
|
||||
int current_method; /* used when looking up certs */
|
||||
|
||||
/* The following are set by the caller */
|
||||
X509 *cert; /* The cert to check */
|
||||
STACK_OF(X509) *untrusted; /* chain of X509s - untrusted - passed in */
|
||||
STACK_OF(X509_CRL) *crls; /* set of CRLs passed in */
|
||||
|
||||
X509_VERIFY_PARAM *param;
|
||||
void *other_ctx; /* Other info for use with get_issuer() */
|
||||
|
||||
/* Callbacks for various operations */
|
||||
int (*verify)(X509_STORE_CTX *ctx); /* called to verify a certificate */
|
||||
int (*verify_cb)(int ok,X509_STORE_CTX *ctx); /* error callback */
|
||||
int (*get_issuer)(X509 **issuer, X509_STORE_CTX *ctx, X509 *x); /* get issuers cert from ctx */
|
||||
int (*check_issued)(X509_STORE_CTX *ctx, X509 *x, X509 *issuer); /* check issued */
|
||||
int (*check_revocation)(X509_STORE_CTX *ctx); /* Check revocation status of chain */
|
||||
int (*get_crl)(X509_STORE_CTX *ctx, X509_CRL **crl, X509 *x); /* retrieve CRL */
|
||||
int (*check_crl)(X509_STORE_CTX *ctx, X509_CRL *crl); /* Check CRL validity */
|
||||
int (*cert_crl)(X509_STORE_CTX *ctx, X509_CRL *crl, X509 *x); /* Check certificate against CRL */
|
||||
int (*check_policy)(X509_STORE_CTX *ctx);
|
||||
int (*cleanup)(X509_STORE_CTX *ctx);
|
||||
|
||||
/* The following is built up */
|
||||
int valid; /* if 0, rebuild chain */
|
||||
int last_untrusted; /* index of last untrusted cert */
|
||||
STACK_OF(X509) *chain; /* chain of X509s - built up and trusted */
|
||||
X509_POLICY_TREE *tree; /* Valid policy tree */
|
||||
|
||||
int explicit_policy; /* Require explicit policy value */
|
||||
|
||||
/* When something goes wrong, this is why */
|
||||
int error_depth;
|
||||
int error;
|
||||
X509 *current_cert;
|
||||
X509 *current_issuer; /* cert currently being tested as valid issuer */
|
||||
X509_CRL *current_crl; /* current CRL */
|
||||
|
||||
CRYPTO_EX_DATA ex_data;
|
||||
} /* X509_STORE_CTX */;
|
||||
|
||||
void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth);
|
||||
|
||||
#define X509_STORE_CTX_set_app_data(ctx,data) \
|
||||
X509_STORE_CTX_set_ex_data(ctx,0,data)
|
||||
#define X509_STORE_CTX_get_app_data(ctx) \
|
||||
X509_STORE_CTX_get_ex_data(ctx,0)
|
||||
# define X509_STORE_CTX_set_app_data(ctx,data) \
|
||||
X509_STORE_CTX_set_ex_data(ctx,0,data)
|
||||
# define X509_STORE_CTX_get_app_data(ctx) \
|
||||
X509_STORE_CTX_get_ex_data(ctx,0)
|
||||
|
||||
#define X509_L_FILE_LOAD 1
|
||||
#define X509_L_ADD_DIR 2
|
||||
# define X509_L_FILE_LOAD 1
|
||||
# define X509_L_ADD_DIR 2
|
||||
|
||||
#define X509_LOOKUP_load_file(x,name,type) \
|
||||
X509_LOOKUP_ctrl((x),X509_L_FILE_LOAD,(name),(long)(type),NULL)
|
||||
# define X509_LOOKUP_load_file(x,name,type) \
|
||||
X509_LOOKUP_ctrl((x),X509_L_FILE_LOAD,(name),(long)(type),NULL)
|
||||
|
||||
#define X509_LOOKUP_add_dir(x,name,type) \
|
||||
X509_LOOKUP_ctrl((x),X509_L_ADD_DIR,(name),(long)(type),NULL)
|
||||
# define X509_LOOKUP_add_dir(x,name,type) \
|
||||
X509_LOOKUP_ctrl((x),X509_L_ADD_DIR,(name),(long)(type),NULL)
|
||||
|
||||
#define X509_V_OK 0
|
||||
/* illegal error (for uninitialized values, to avoid X509_V_OK): 1 */
|
||||
|
||||
#define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT 2
|
||||
#define X509_V_ERR_UNABLE_TO_GET_CRL 3
|
||||
#define X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE 4
|
||||
#define X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE 5
|
||||
#define X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY 6
|
||||
#define X509_V_ERR_CERT_SIGNATURE_FAILURE 7
|
||||
#define X509_V_ERR_CRL_SIGNATURE_FAILURE 8
|
||||
#define X509_V_ERR_CERT_NOT_YET_VALID 9
|
||||
#define X509_V_ERR_CERT_HAS_EXPIRED 10
|
||||
#define X509_V_ERR_CRL_NOT_YET_VALID 11
|
||||
#define X509_V_ERR_CRL_HAS_EXPIRED 12
|
||||
#define X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD 13
|
||||
#define X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD 14
|
||||
#define X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD 15
|
||||
#define X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD 16
|
||||
#define X509_V_ERR_OUT_OF_MEM 17
|
||||
#define X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT 18
|
||||
#define X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN 19
|
||||
#define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY 20
|
||||
#define X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE 21
|
||||
#define X509_V_ERR_CERT_CHAIN_TOO_LONG 22
|
||||
#define X509_V_ERR_CERT_REVOKED 23
|
||||
#define X509_V_ERR_INVALID_CA 24
|
||||
#define X509_V_ERR_PATH_LENGTH_EXCEEDED 25
|
||||
#define X509_V_ERR_INVALID_PURPOSE 26
|
||||
#define X509_V_ERR_CERT_UNTRUSTED 27
|
||||
#define X509_V_ERR_CERT_REJECTED 28
|
||||
# define X509_V_OK 0
|
||||
# define X509_V_ERR_UNSPECIFIED 1
|
||||
# define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT 2
|
||||
# define X509_V_ERR_UNABLE_TO_GET_CRL 3
|
||||
# define X509_V_ERR_UNABLE_TO_DECRYPT_CERT_SIGNATURE 4
|
||||
# define X509_V_ERR_UNABLE_TO_DECRYPT_CRL_SIGNATURE 5
|
||||
# define X509_V_ERR_UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY 6
|
||||
# define X509_V_ERR_CERT_SIGNATURE_FAILURE 7
|
||||
# define X509_V_ERR_CRL_SIGNATURE_FAILURE 8
|
||||
# define X509_V_ERR_CERT_NOT_YET_VALID 9
|
||||
# define X509_V_ERR_CERT_HAS_EXPIRED 10
|
||||
# define X509_V_ERR_CRL_NOT_YET_VALID 11
|
||||
# define X509_V_ERR_CRL_HAS_EXPIRED 12
|
||||
# define X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD 13
|
||||
# define X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD 14
|
||||
# define X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD 15
|
||||
# define X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD 16
|
||||
# define X509_V_ERR_OUT_OF_MEM 17
|
||||
# define X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT 18
|
||||
# define X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN 19
|
||||
# define X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY 20
|
||||
# define X509_V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE 21
|
||||
# define X509_V_ERR_CERT_CHAIN_TOO_LONG 22
|
||||
# define X509_V_ERR_CERT_REVOKED 23
|
||||
# define X509_V_ERR_INVALID_CA 24
|
||||
# define X509_V_ERR_PATH_LENGTH_EXCEEDED 25
|
||||
# define X509_V_ERR_INVALID_PURPOSE 26
|
||||
# define X509_V_ERR_CERT_UNTRUSTED 27
|
||||
# define X509_V_ERR_CERT_REJECTED 28
|
||||
/* These are 'informational' when looking for issuer cert */
|
||||
#define X509_V_ERR_SUBJECT_ISSUER_MISMATCH 29
|
||||
#define X509_V_ERR_AKID_SKID_MISMATCH 30
|
||||
#define X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH 31
|
||||
#define X509_V_ERR_KEYUSAGE_NO_CERTSIGN 32
|
||||
|
||||
#define X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER 33
|
||||
#define X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION 34
|
||||
#define X509_V_ERR_KEYUSAGE_NO_CRL_SIGN 35
|
||||
#define X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION 36
|
||||
#define X509_V_ERR_INVALID_NON_CA 37
|
||||
#define X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED 38
|
||||
#define X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE 39
|
||||
#define X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED 40
|
||||
|
||||
#define X509_V_ERR_INVALID_EXTENSION 41
|
||||
#define X509_V_ERR_INVALID_POLICY_EXTENSION 42
|
||||
#define X509_V_ERR_NO_EXPLICIT_POLICY 43
|
||||
|
||||
|
||||
# define X509_V_ERR_SUBJECT_ISSUER_MISMATCH 29
|
||||
# define X509_V_ERR_AKID_SKID_MISMATCH 30
|
||||
# define X509_V_ERR_AKID_ISSUER_SERIAL_MISMATCH 31
|
||||
# define X509_V_ERR_KEYUSAGE_NO_CERTSIGN 32
|
||||
# define X509_V_ERR_UNABLE_TO_GET_CRL_ISSUER 33
|
||||
# define X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION 34
|
||||
# define X509_V_ERR_KEYUSAGE_NO_CRL_SIGN 35
|
||||
# define X509_V_ERR_UNHANDLED_CRITICAL_CRL_EXTENSION 36
|
||||
# define X509_V_ERR_INVALID_NON_CA 37
|
||||
# define X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED 38
|
||||
# define X509_V_ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE 39
|
||||
# define X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED 40
|
||||
# define X509_V_ERR_INVALID_EXTENSION 41
|
||||
# define X509_V_ERR_INVALID_POLICY_EXTENSION 42
|
||||
# define X509_V_ERR_NO_EXPLICIT_POLICY 43
|
||||
# define X509_V_ERR_DIFFERENT_CRL_SCOPE 44
|
||||
# define X509_V_ERR_UNSUPPORTED_EXTENSION_FEATURE 45
|
||||
# define X509_V_ERR_UNNESTED_RESOURCE 46
|
||||
# define X509_V_ERR_PERMITTED_VIOLATION 47
|
||||
# define X509_V_ERR_EXCLUDED_VIOLATION 48
|
||||
# define X509_V_ERR_SUBTREE_MINMAX 49
|
||||
/* The application is not happy */
|
||||
#define X509_V_ERR_APPLICATION_VERIFICATION 50
|
||||
# define X509_V_ERR_APPLICATION_VERIFICATION 50
|
||||
# define X509_V_ERR_UNSUPPORTED_CONSTRAINT_TYPE 51
|
||||
# define X509_V_ERR_UNSUPPORTED_CONSTRAINT_SYNTAX 52
|
||||
# define X509_V_ERR_UNSUPPORTED_NAME_SYNTAX 53
|
||||
# define X509_V_ERR_CRL_PATH_VALIDATION_ERROR 54
|
||||
/* Another issuer check debug option */
|
||||
# define X509_V_ERR_PATH_LOOP 55
|
||||
/* Suite B mode algorithm violation */
|
||||
# define X509_V_ERR_SUITE_B_INVALID_VERSION 56
|
||||
# define X509_V_ERR_SUITE_B_INVALID_ALGORITHM 57
|
||||
# define X509_V_ERR_SUITE_B_INVALID_CURVE 58
|
||||
# define X509_V_ERR_SUITE_B_INVALID_SIGNATURE_ALGORITHM 59
|
||||
# define X509_V_ERR_SUITE_B_LOS_NOT_ALLOWED 60
|
||||
# define X509_V_ERR_SUITE_B_CANNOT_SIGN_P_384_WITH_P_256 61
|
||||
/* Host, email and IP check errors */
|
||||
# define X509_V_ERR_HOSTNAME_MISMATCH 62
|
||||
# define X509_V_ERR_EMAIL_MISMATCH 63
|
||||
# define X509_V_ERR_IP_ADDRESS_MISMATCH 64
|
||||
/* DANE TLSA errors */
|
||||
# define X509_V_ERR_DANE_NO_MATCH 65
|
||||
/* security level errors */
|
||||
# define X509_V_ERR_EE_KEY_TOO_SMALL 66
|
||||
# define X509_V_ERR_CA_KEY_TOO_SMALL 67
|
||||
# define X509_V_ERR_CA_MD_TOO_WEAK 68
|
||||
/* Caller error */
|
||||
# define X509_V_ERR_INVALID_CALL 69
|
||||
/* Issuer lookup error */
|
||||
# define X509_V_ERR_STORE_LOOKUP 70
|
||||
/* Certificate transparency */
|
||||
# define X509_V_ERR_NO_VALID_SCTS 71
|
||||
|
||||
# define X509_V_ERR_PROXY_SUBJECT_NAME_VIOLATION 72
|
||||
|
||||
/* Certificate verify flags */
|
||||
|
||||
/* Send issuer+subject checks to verify_cb */
|
||||
#define X509_V_FLAG_CB_ISSUER_CHECK 0x1
|
||||
# if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# define X509_V_FLAG_CB_ISSUER_CHECK 0x0 /* Deprecated */
|
||||
# endif
|
||||
/* Use check time instead of current time */
|
||||
#define X509_V_FLAG_USE_CHECK_TIME 0x2
|
||||
# define X509_V_FLAG_USE_CHECK_TIME 0x2
|
||||
/* Lookup CRLs */
|
||||
#define X509_V_FLAG_CRL_CHECK 0x4
|
||||
# define X509_V_FLAG_CRL_CHECK 0x4
|
||||
/* Lookup CRLs for whole chain */
|
||||
#define X509_V_FLAG_CRL_CHECK_ALL 0x8
|
||||
# define X509_V_FLAG_CRL_CHECK_ALL 0x8
|
||||
/* Ignore unhandled critical extensions */
|
||||
#define X509_V_FLAG_IGNORE_CRITICAL 0x10
|
||||
# define X509_V_FLAG_IGNORE_CRITICAL 0x10
|
||||
/* Disable workarounds for broken certificates */
|
||||
#define X509_V_FLAG_X509_STRICT 0x20
|
||||
# define X509_V_FLAG_X509_STRICT 0x20
|
||||
/* Enable proxy certificate validation */
|
||||
#define X509_V_FLAG_ALLOW_PROXY_CERTS 0x40
|
||||
# define X509_V_FLAG_ALLOW_PROXY_CERTS 0x40
|
||||
/* Enable policy checking */
|
||||
#define X509_V_FLAG_POLICY_CHECK 0x80
|
||||
# define X509_V_FLAG_POLICY_CHECK 0x80
|
||||
/* Policy variable require-explicit-policy */
|
||||
#define X509_V_FLAG_EXPLICIT_POLICY 0x100
|
||||
# define X509_V_FLAG_EXPLICIT_POLICY 0x100
|
||||
/* Policy variable inhibit-any-policy */
|
||||
#define X509_V_FLAG_INHIBIT_ANY 0x200
|
||||
# define X509_V_FLAG_INHIBIT_ANY 0x200
|
||||
/* Policy variable inhibit-policy-mapping */
|
||||
#define X509_V_FLAG_INHIBIT_MAP 0x400
|
||||
# define X509_V_FLAG_INHIBIT_MAP 0x400
|
||||
/* Notify callback that policy is OK */
|
||||
#define X509_V_FLAG_NOTIFY_POLICY 0x800
|
||||
# define X509_V_FLAG_NOTIFY_POLICY 0x800
|
||||
/* Extended CRL features such as indirect CRLs, alternate CRL signing keys */
|
||||
# define X509_V_FLAG_EXTENDED_CRL_SUPPORT 0x1000
|
||||
/* Delta CRL support */
|
||||
# define X509_V_FLAG_USE_DELTAS 0x2000
|
||||
/* Check self-signed CA signature */
|
||||
# define X509_V_FLAG_CHECK_SS_SIGNATURE 0x4000
|
||||
/* Use trusted store first */
|
||||
# define X509_V_FLAG_TRUSTED_FIRST 0x8000
|
||||
/* Suite B 128 bit only mode: not normally used */
|
||||
# define X509_V_FLAG_SUITEB_128_LOS_ONLY 0x10000
|
||||
/* Suite B 192 bit only mode */
|
||||
# define X509_V_FLAG_SUITEB_192_LOS 0x20000
|
||||
/* Suite B 128 bit mode allowing 192 bit algorithms */
|
||||
# define X509_V_FLAG_SUITEB_128_LOS 0x30000
|
||||
/* Allow partial chains if at least one certificate is in trusted store */
|
||||
# define X509_V_FLAG_PARTIAL_CHAIN 0x80000
|
||||
/*
|
||||
* If the initial chain is not trusted, do not attempt to build an alternative
|
||||
* chain. Alternate chain checking was introduced in 1.1.0. Setting this flag
|
||||
* will force the behaviour to match that of previous versions.
|
||||
*/
|
||||
# define X509_V_FLAG_NO_ALT_CHAINS 0x100000
|
||||
/* Do not check certificate/CRL validity against current time */
|
||||
# define X509_V_FLAG_NO_CHECK_TIME 0x200000
|
||||
|
||||
#define X509_VP_FLAG_DEFAULT 0x1
|
||||
#define X509_VP_FLAG_OVERWRITE 0x2
|
||||
#define X509_VP_FLAG_RESET_FLAGS 0x4
|
||||
#define X509_VP_FLAG_LOCKED 0x8
|
||||
#define X509_VP_FLAG_ONCE 0x10
|
||||
# define X509_VP_FLAG_DEFAULT 0x1
|
||||
# define X509_VP_FLAG_OVERWRITE 0x2
|
||||
# define X509_VP_FLAG_RESET_FLAGS 0x4
|
||||
# define X509_VP_FLAG_LOCKED 0x8
|
||||
# define X509_VP_FLAG_ONCE 0x10
|
||||
|
||||
/* Internal use: mask of policy related options */
|
||||
#define X509_V_FLAG_POLICY_MASK (X509_V_FLAG_POLICY_CHECK \
|
||||
| X509_V_FLAG_EXPLICIT_POLICY \
|
||||
| X509_V_FLAG_INHIBIT_ANY \
|
||||
| X509_V_FLAG_INHIBIT_MAP)
|
||||
# define X509_V_FLAG_POLICY_MASK (X509_V_FLAG_POLICY_CHECK \
|
||||
| X509_V_FLAG_EXPLICIT_POLICY \
|
||||
| X509_V_FLAG_INHIBIT_ANY \
|
||||
| X509_V_FLAG_INHIBIT_MAP)
|
||||
|
||||
int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, int type,
|
||||
X509_NAME *name);
|
||||
X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h,int type,X509_NAME *name);
|
||||
X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h, X509_OBJECT *x);
|
||||
void X509_OBJECT_up_ref_count(X509_OBJECT *a);
|
||||
void X509_OBJECT_free_contents(X509_OBJECT *a);
|
||||
X509_STORE *X509_STORE_new(void );
|
||||
int X509_OBJECT_idx_by_subject(STACK_OF(X509_OBJECT) *h, X509_LOOKUP_TYPE type,
|
||||
X509_NAME *name);
|
||||
X509_OBJECT *X509_OBJECT_retrieve_by_subject(STACK_OF(X509_OBJECT) *h,
|
||||
X509_LOOKUP_TYPE type,
|
||||
X509_NAME *name);
|
||||
X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h,
|
||||
X509_OBJECT *x);
|
||||
int X509_OBJECT_up_ref_count(X509_OBJECT *a);
|
||||
X509_OBJECT *X509_OBJECT_new(void);
|
||||
void X509_OBJECT_free(X509_OBJECT *a);
|
||||
X509_LOOKUP_TYPE X509_OBJECT_get_type(const X509_OBJECT *a);
|
||||
X509 *X509_OBJECT_get0_X509(const X509_OBJECT *a);
|
||||
X509_CRL *X509_OBJECT_get0_X509_CRL(X509_OBJECT *a);
|
||||
X509_STORE *X509_STORE_new(void);
|
||||
void X509_STORE_free(X509_STORE *v);
|
||||
int X509_STORE_lock(X509_STORE *ctx);
|
||||
int X509_STORE_unlock(X509_STORE *ctx);
|
||||
int X509_STORE_up_ref(X509_STORE *v);
|
||||
STACK_OF(X509_OBJECT) *X509_STORE_get0_objects(X509_STORE *v);
|
||||
|
||||
STACK_OF(X509) *X509_STORE_CTX_get1_certs(X509_STORE_CTX *st, X509_NAME *nm);
|
||||
STACK_OF(X509_CRL) *X509_STORE_CTX_get1_crls(X509_STORE_CTX *st, X509_NAME *nm);
|
||||
int X509_STORE_set_flags(X509_STORE *ctx, unsigned long flags);
|
||||
int X509_STORE_set_purpose(X509_STORE *ctx, int purpose);
|
||||
int X509_STORE_set_trust(X509_STORE *ctx, int trust);
|
||||
int X509_STORE_set1_param(X509_STORE *ctx, X509_VERIFY_PARAM *pm);
|
||||
X509_VERIFY_PARAM *X509_STORE_get0_param(X509_STORE *ctx);
|
||||
|
||||
void X509_STORE_set_verify(X509_STORE *ctx, X509_STORE_CTX_verify_fn verify);
|
||||
#define X509_STORE_set_verify_func(ctx, func) \
|
||||
X509_STORE_set_verify((ctx),(func))
|
||||
void X509_STORE_CTX_set_verify(X509_STORE_CTX *ctx,
|
||||
X509_STORE_CTX_verify_fn verify);
|
||||
X509_STORE_CTX_verify_fn X509_STORE_get_verify(X509_STORE *ctx);
|
||||
void X509_STORE_set_verify_cb(X509_STORE *ctx,
|
||||
X509_STORE_CTX_verify_cb verify_cb);
|
||||
# define X509_STORE_set_verify_cb_func(ctx,func) \
|
||||
X509_STORE_set_verify_cb((ctx),(func))
|
||||
X509_STORE_CTX_verify_cb X509_STORE_get_verify_cb(X509_STORE *ctx);
|
||||
void X509_STORE_set_get_issuer(X509_STORE *ctx,
|
||||
X509_STORE_CTX_get_issuer_fn get_issuer);
|
||||
X509_STORE_CTX_get_issuer_fn X509_STORE_get_get_issuer(X509_STORE *ctx);
|
||||
void X509_STORE_set_check_issued(X509_STORE *ctx,
|
||||
X509_STORE_CTX_check_issued_fn check_issued);
|
||||
X509_STORE_CTX_check_issued_fn X509_STORE_get_check_issued(X509_STORE *ctx);
|
||||
void X509_STORE_set_check_revocation(X509_STORE *ctx,
|
||||
X509_STORE_CTX_check_revocation_fn check_revocation);
|
||||
X509_STORE_CTX_check_revocation_fn X509_STORE_get_check_revocation(X509_STORE *ctx);
|
||||
void X509_STORE_set_get_crl(X509_STORE *ctx,
|
||||
X509_STORE_CTX_get_crl_fn get_crl);
|
||||
X509_STORE_CTX_get_crl_fn X509_STORE_get_get_crl(X509_STORE *ctx);
|
||||
void X509_STORE_set_check_crl(X509_STORE *ctx,
|
||||
X509_STORE_CTX_check_crl_fn check_crl);
|
||||
X509_STORE_CTX_check_crl_fn X509_STORE_get_check_crl(X509_STORE *ctx);
|
||||
void X509_STORE_set_cert_crl(X509_STORE *ctx,
|
||||
X509_STORE_CTX_cert_crl_fn cert_crl);
|
||||
X509_STORE_CTX_cert_crl_fn X509_STORE_get_cert_crl(X509_STORE *ctx);
|
||||
void X509_STORE_set_check_policy(X509_STORE *ctx,
|
||||
X509_STORE_CTX_check_policy_fn check_policy);
|
||||
X509_STORE_CTX_check_policy_fn X509_STORE_get_check_policy(X509_STORE *ctx);
|
||||
void X509_STORE_set_lookup_certs(X509_STORE *ctx,
|
||||
X509_STORE_CTX_lookup_certs_fn lookup_certs);
|
||||
X509_STORE_CTX_lookup_certs_fn X509_STORE_get_lookup_certs(X509_STORE *ctx);
|
||||
void X509_STORE_set_lookup_crls(X509_STORE *ctx,
|
||||
X509_STORE_CTX_lookup_crls_fn lookup_crls);
|
||||
#define X509_STORE_set_lookup_crls_cb(ctx, func) \
|
||||
X509_STORE_set_lookup_crls((ctx), (func))
|
||||
X509_STORE_CTX_lookup_crls_fn X509_STORE_get_lookup_crls(X509_STORE *ctx);
|
||||
void X509_STORE_set_cleanup(X509_STORE *ctx,
|
||||
X509_STORE_CTX_cleanup_fn cleanup);
|
||||
X509_STORE_CTX_cleanup_fn X509_STORE_get_cleanup(X509_STORE *ctx);
|
||||
|
||||
#define X509_STORE_get_ex_new_index(l, p, newf, dupf, freef) \
|
||||
CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509_STORE, l, p, newf, dupf, freef)
|
||||
int X509_STORE_set_ex_data(X509_STORE *ctx, int idx, void *data);
|
||||
void *X509_STORE_get_ex_data(X509_STORE *ctx, int idx);
|
||||
|
||||
X509_STORE_CTX *X509_STORE_CTX_new(void);
|
||||
|
||||
@ -394,137 +328,217 @@ int X509_STORE_CTX_get1_issuer(X509 **issuer, X509_STORE_CTX *ctx, X509 *x);
|
||||
|
||||
void X509_STORE_CTX_free(X509_STORE_CTX *ctx);
|
||||
int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store,
|
||||
X509 *x509, STACK_OF(X509) *chain);
|
||||
void X509_STORE_CTX_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk);
|
||||
X509 *x509, STACK_OF(X509) *chain);
|
||||
void X509_STORE_CTX_set0_trusted_stack(X509_STORE_CTX *ctx, STACK_OF(X509) *sk);
|
||||
void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx);
|
||||
|
||||
X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m);
|
||||
X509_STORE *X509_STORE_CTX_get0_store(X509_STORE_CTX *ctx);
|
||||
X509 *X509_STORE_CTX_get0_cert(X509_STORE_CTX *ctx);
|
||||
STACK_OF(X509)* X509_STORE_CTX_get0_untrusted(X509_STORE_CTX *ctx);
|
||||
void X509_STORE_CTX_set0_untrusted(X509_STORE_CTX *ctx, STACK_OF(X509) *sk);
|
||||
void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx,
|
||||
X509_STORE_CTX_verify_cb verify);
|
||||
X509_STORE_CTX_verify_cb X509_STORE_CTX_get_verify_cb(X509_STORE_CTX *ctx);
|
||||
X509_STORE_CTX_verify_fn X509_STORE_CTX_get_verify(X509_STORE_CTX *ctx);
|
||||
X509_STORE_CTX_get_issuer_fn X509_STORE_CTX_get_get_issuer(X509_STORE_CTX *ctx);
|
||||
X509_STORE_CTX_check_issued_fn X509_STORE_CTX_get_check_issued(X509_STORE_CTX *ctx);
|
||||
X509_STORE_CTX_check_revocation_fn X509_STORE_CTX_get_check_revocation(X509_STORE_CTX *ctx);
|
||||
X509_STORE_CTX_get_crl_fn X509_STORE_CTX_get_get_crl(X509_STORE_CTX *ctx);
|
||||
X509_STORE_CTX_check_crl_fn X509_STORE_CTX_get_check_crl(X509_STORE_CTX *ctx);
|
||||
X509_STORE_CTX_cert_crl_fn X509_STORE_CTX_get_cert_crl(X509_STORE_CTX *ctx);
|
||||
X509_STORE_CTX_check_policy_fn X509_STORE_CTX_get_check_policy(X509_STORE_CTX *ctx);
|
||||
X509_STORE_CTX_lookup_certs_fn X509_STORE_CTX_get_lookup_certs(X509_STORE_CTX *ctx);
|
||||
X509_STORE_CTX_lookup_crls_fn X509_STORE_CTX_get_lookup_crls(X509_STORE_CTX *ctx);
|
||||
X509_STORE_CTX_cleanup_fn X509_STORE_CTX_get_cleanup(X509_STORE_CTX *ctx);
|
||||
|
||||
#if OPENSSL_API_COMPAT < 0x10100000L
|
||||
# define X509_STORE_CTX_get_chain X509_STORE_CTX_get0_chain
|
||||
# define X509_STORE_CTX_set_chain X509_STORE_CTX_set0_untrusted
|
||||
# define X509_STORE_CTX_trusted_stack X509_STORE_CTX_set0_trusted_stack
|
||||
# define X509_STORE_get_by_subject X509_STORE_CTX_get_by_subject
|
||||
# define X509_STORE_get1_cert X509_STORE_CTX_get1_certs
|
||||
# define X509_STORE_get1_crl X509_STORE_CTX_get1_crls
|
||||
#endif
|
||||
|
||||
X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m);
|
||||
X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void);
|
||||
X509_LOOKUP_METHOD *X509_LOOKUP_file(void);
|
||||
|
||||
int X509_STORE_add_cert(X509_STORE *ctx, X509 *x);
|
||||
int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x);
|
||||
|
||||
int X509_STORE_get_by_subject(X509_STORE_CTX *vs,int type,X509_NAME *name,
|
||||
X509_OBJECT *ret);
|
||||
int X509_STORE_CTX_get_by_subject(X509_STORE_CTX *vs, X509_LOOKUP_TYPE type,
|
||||
X509_NAME *name, X509_OBJECT *ret);
|
||||
X509_OBJECT *X509_STORE_CTX_get_obj_by_subject(X509_STORE_CTX *vs,
|
||||
X509_LOOKUP_TYPE type,
|
||||
X509_NAME *name);
|
||||
|
||||
int X509_LOOKUP_ctrl(X509_LOOKUP *ctx, int cmd, const char *argc,
|
||||
long argl, char **ret);
|
||||
long argl, char **ret);
|
||||
|
||||
#ifndef OPENSSL_NO_STDIO
|
||||
int X509_load_cert_file(X509_LOOKUP *ctx, const char *file, int type);
|
||||
int X509_load_crl_file(X509_LOOKUP *ctx, const char *file, int type);
|
||||
int X509_load_cert_crl_file(X509_LOOKUP *ctx, const char *file, int type);
|
||||
#endif
|
||||
|
||||
|
||||
X509_LOOKUP *X509_LOOKUP_new(X509_LOOKUP_METHOD *method);
|
||||
void X509_LOOKUP_free(X509_LOOKUP *ctx);
|
||||
int X509_LOOKUP_init(X509_LOOKUP *ctx);
|
||||
int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, int type, X509_NAME *name,
|
||||
X509_OBJECT *ret);
|
||||
int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, int type, X509_NAME *name,
|
||||
ASN1_INTEGER *serial, X509_OBJECT *ret);
|
||||
int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, int type,
|
||||
unsigned char *bytes, int len, X509_OBJECT *ret);
|
||||
int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, int type, char *str,
|
||||
int len, X509_OBJECT *ret);
|
||||
int X509_LOOKUP_by_subject(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,
|
||||
X509_NAME *name, X509_OBJECT *ret);
|
||||
int X509_LOOKUP_by_issuer_serial(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,
|
||||
X509_NAME *name, ASN1_INTEGER *serial,
|
||||
X509_OBJECT *ret);
|
||||
int X509_LOOKUP_by_fingerprint(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,
|
||||
const unsigned char *bytes, int len,
|
||||
X509_OBJECT *ret);
|
||||
int X509_LOOKUP_by_alias(X509_LOOKUP *ctx, X509_LOOKUP_TYPE type,
|
||||
const char *str, int len, X509_OBJECT *ret);
|
||||
int X509_LOOKUP_shutdown(X509_LOOKUP *ctx);
|
||||
|
||||
#ifndef OPENSSL_NO_STDIO
|
||||
int X509_STORE_load_locations (X509_STORE *ctx,
|
||||
const char *file, const char *dir);
|
||||
int X509_STORE_set_default_paths(X509_STORE *ctx);
|
||||
#endif
|
||||
int X509_STORE_load_locations(X509_STORE *ctx,
|
||||
const char *file, const char *dir);
|
||||
int X509_STORE_set_default_paths(X509_STORE *ctx);
|
||||
|
||||
int X509_STORE_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
|
||||
CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
|
||||
int X509_STORE_CTX_set_ex_data(X509_STORE_CTX *ctx,int idx,void *data);
|
||||
void * X509_STORE_CTX_get_ex_data(X509_STORE_CTX *ctx,int idx);
|
||||
int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx);
|
||||
void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx,int s);
|
||||
int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx);
|
||||
X509 * X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx);
|
||||
STACK_OF(X509) *X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx);
|
||||
#define X509_STORE_CTX_get_ex_new_index(l, p, newf, dupf, freef) \
|
||||
CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509_STORE_CTX, l, p, newf, dupf, freef)
|
||||
int X509_STORE_CTX_set_ex_data(X509_STORE_CTX *ctx, int idx, void *data);
|
||||
void *X509_STORE_CTX_get_ex_data(X509_STORE_CTX *ctx, int idx);
|
||||
int X509_STORE_CTX_get_error(X509_STORE_CTX *ctx);
|
||||
void X509_STORE_CTX_set_error(X509_STORE_CTX *ctx, int s);
|
||||
int X509_STORE_CTX_get_error_depth(X509_STORE_CTX *ctx);
|
||||
void X509_STORE_CTX_set_error_depth(X509_STORE_CTX *ctx, int depth);
|
||||
X509 *X509_STORE_CTX_get_current_cert(X509_STORE_CTX *ctx);
|
||||
void X509_STORE_CTX_set_current_cert(X509_STORE_CTX *ctx, X509 *x);
|
||||
X509 *X509_STORE_CTX_get0_current_issuer(X509_STORE_CTX *ctx);
|
||||
X509_CRL *X509_STORE_CTX_get0_current_crl(X509_STORE_CTX *ctx);
|
||||
X509_STORE_CTX *X509_STORE_CTX_get0_parent_ctx(X509_STORE_CTX *ctx);
|
||||
STACK_OF(X509) *X509_STORE_CTX_get0_chain(X509_STORE_CTX *ctx);
|
||||
STACK_OF(X509) *X509_STORE_CTX_get1_chain(X509_STORE_CTX *ctx);
|
||||
void X509_STORE_CTX_set_cert(X509_STORE_CTX *c,X509 *x);
|
||||
void X509_STORE_CTX_set_chain(X509_STORE_CTX *c,STACK_OF(X509) *sk);
|
||||
void X509_STORE_CTX_set0_crls(X509_STORE_CTX *c,STACK_OF(X509_CRL) *sk);
|
||||
void X509_STORE_CTX_set_cert(X509_STORE_CTX *c, X509 *x);
|
||||
void X509_STORE_CTX_set0_verified_chain(X509_STORE_CTX *c, STACK_OF(X509) *sk);
|
||||
void X509_STORE_CTX_set0_crls(X509_STORE_CTX *c, STACK_OF(X509_CRL) *sk);
|
||||
int X509_STORE_CTX_set_purpose(X509_STORE_CTX *ctx, int purpose);
|
||||
int X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust);
|
||||
int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx, int def_purpose,
|
||||
int purpose, int trust);
|
||||
int purpose, int trust);
|
||||
void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags);
|
||||
void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags,
|
||||
time_t t);
|
||||
void X509_STORE_CTX_set_verify_cb(X509_STORE_CTX *ctx,
|
||||
int (*verify_cb)(int, X509_STORE_CTX *));
|
||||
time_t t);
|
||||
|
||||
X509_POLICY_TREE *X509_STORE_CTX_get0_policy_tree(X509_STORE_CTX *ctx);
|
||||
int X509_STORE_CTX_get_explicit_policy(X509_STORE_CTX *ctx);
|
||||
int X509_STORE_CTX_get_num_untrusted(X509_STORE_CTX *ctx);
|
||||
|
||||
X509_VERIFY_PARAM *X509_STORE_CTX_get0_param(X509_STORE_CTX *ctx);
|
||||
void X509_STORE_CTX_set0_param(X509_STORE_CTX *ctx, X509_VERIFY_PARAM *param);
|
||||
int X509_STORE_CTX_set_default(X509_STORE_CTX *ctx, const char *name);
|
||||
|
||||
/*
|
||||
* Bridge opacity barrier between libcrypt and libssl, also needed to support
|
||||
* offline testing in test/danetest.c
|
||||
*/
|
||||
void X509_STORE_CTX_set0_dane(X509_STORE_CTX *ctx, SSL_DANE *dane);
|
||||
#define DANE_FLAG_NO_DANE_EE_NAMECHECKS (1L << 0)
|
||||
|
||||
/* X509_VERIFY_PARAM functions */
|
||||
|
||||
X509_VERIFY_PARAM *X509_VERIFY_PARAM_new(void);
|
||||
void X509_VERIFY_PARAM_free(X509_VERIFY_PARAM *param);
|
||||
int X509_VERIFY_PARAM_inherit(X509_VERIFY_PARAM *to,
|
||||
const X509_VERIFY_PARAM *from);
|
||||
const X509_VERIFY_PARAM *from);
|
||||
int X509_VERIFY_PARAM_set1(X509_VERIFY_PARAM *to,
|
||||
const X509_VERIFY_PARAM *from);
|
||||
const X509_VERIFY_PARAM *from);
|
||||
int X509_VERIFY_PARAM_set1_name(X509_VERIFY_PARAM *param, const char *name);
|
||||
int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, unsigned long flags);
|
||||
int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param,
|
||||
unsigned long flags);
|
||||
int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param,
|
||||
unsigned long flags);
|
||||
unsigned long flags);
|
||||
unsigned long X509_VERIFY_PARAM_get_flags(X509_VERIFY_PARAM *param);
|
||||
int X509_VERIFY_PARAM_set_purpose(X509_VERIFY_PARAM *param, int purpose);
|
||||
int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param, int trust);
|
||||
void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth);
|
||||
void X509_VERIFY_PARAM_set_auth_level(X509_VERIFY_PARAM *param, int auth_level);
|
||||
time_t X509_VERIFY_PARAM_get_time(const X509_VERIFY_PARAM *param);
|
||||
void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t);
|
||||
int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param,
|
||||
ASN1_OBJECT *policy);
|
||||
ASN1_OBJECT *policy);
|
||||
int X509_VERIFY_PARAM_set1_policies(X509_VERIFY_PARAM *param,
|
||||
STACK_OF(ASN1_OBJECT) *policies);
|
||||
STACK_OF(ASN1_OBJECT) *policies);
|
||||
|
||||
int X509_VERIFY_PARAM_set_inh_flags(X509_VERIFY_PARAM *param,
|
||||
uint32_t flags);
|
||||
uint32_t X509_VERIFY_PARAM_get_inh_flags(const X509_VERIFY_PARAM *param);
|
||||
|
||||
int X509_VERIFY_PARAM_set1_host(X509_VERIFY_PARAM *param,
|
||||
const char *name, size_t namelen);
|
||||
int X509_VERIFY_PARAM_add1_host(X509_VERIFY_PARAM *param,
|
||||
const char *name, size_t namelen);
|
||||
void X509_VERIFY_PARAM_set_hostflags(X509_VERIFY_PARAM *param,
|
||||
unsigned int flags);
|
||||
char *X509_VERIFY_PARAM_get0_peername(X509_VERIFY_PARAM *);
|
||||
void X509_VERIFY_PARAM_move_peername(X509_VERIFY_PARAM *, X509_VERIFY_PARAM *);
|
||||
int X509_VERIFY_PARAM_set1_email(X509_VERIFY_PARAM *param,
|
||||
const char *email, size_t emaillen);
|
||||
int X509_VERIFY_PARAM_set1_ip(X509_VERIFY_PARAM *param,
|
||||
const unsigned char *ip, size_t iplen);
|
||||
int X509_VERIFY_PARAM_set1_ip_asc(X509_VERIFY_PARAM *param,
|
||||
const char *ipasc);
|
||||
|
||||
int X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param);
|
||||
int X509_VERIFY_PARAM_get_auth_level(const X509_VERIFY_PARAM *param);
|
||||
const char *X509_VERIFY_PARAM_get0_name(const X509_VERIFY_PARAM *param);
|
||||
|
||||
int X509_VERIFY_PARAM_add0_table(X509_VERIFY_PARAM *param);
|
||||
int X509_VERIFY_PARAM_get_count(void);
|
||||
const X509_VERIFY_PARAM *X509_VERIFY_PARAM_get0(int id);
|
||||
const X509_VERIFY_PARAM *X509_VERIFY_PARAM_lookup(const char *name);
|
||||
void X509_VERIFY_PARAM_table_cleanup(void);
|
||||
|
||||
/* Non positive return values are errors */
|
||||
#define X509_PCY_TREE_FAILURE -2 /* Failure to satisfy explicit policy */
|
||||
#define X509_PCY_TREE_INVALID -1 /* Inconsistent or invalid extensions */
|
||||
#define X509_PCY_TREE_INTERNAL 0 /* Internal error, most likely malloc */
|
||||
|
||||
/*
|
||||
* Positive return values form a bit mask, all but the first are internal to
|
||||
* the library and don't appear in results from X509_policy_check().
|
||||
*/
|
||||
#define X509_PCY_TREE_VALID 1 /* The policy tree is valid */
|
||||
#define X509_PCY_TREE_EMPTY 2 /* The policy tree is empty */
|
||||
#define X509_PCY_TREE_EXPLICIT 4 /* Explicit policy required */
|
||||
|
||||
int X509_policy_check(X509_POLICY_TREE **ptree, int *pexplicit_policy,
|
||||
STACK_OF(X509) *certs,
|
||||
STACK_OF(ASN1_OBJECT) *policy_oids,
|
||||
unsigned int flags);
|
||||
STACK_OF(X509) *certs,
|
||||
STACK_OF(ASN1_OBJECT) *policy_oids, unsigned int flags);
|
||||
|
||||
void X509_policy_tree_free(X509_POLICY_TREE *tree);
|
||||
|
||||
int X509_policy_tree_level_count(const X509_POLICY_TREE *tree);
|
||||
X509_POLICY_LEVEL *
|
||||
X509_policy_tree_get0_level(const X509_POLICY_TREE *tree, int i);
|
||||
X509_POLICY_LEVEL *X509_policy_tree_get0_level(const X509_POLICY_TREE *tree,
|
||||
int i);
|
||||
|
||||
STACK_OF(X509_POLICY_NODE) *
|
||||
X509_policy_tree_get0_policies(const X509_POLICY_TREE *tree);
|
||||
STACK_OF(X509_POLICY_NODE) *X509_policy_tree_get0_policies(const
|
||||
X509_POLICY_TREE
|
||||
*tree);
|
||||
|
||||
STACK_OF(X509_POLICY_NODE) *
|
||||
X509_policy_tree_get0_user_policies(const X509_POLICY_TREE *tree);
|
||||
STACK_OF(X509_POLICY_NODE) *X509_policy_tree_get0_user_policies(const
|
||||
X509_POLICY_TREE
|
||||
*tree);
|
||||
|
||||
int X509_policy_level_node_count(X509_POLICY_LEVEL *level);
|
||||
|
||||
X509_POLICY_NODE *X509_policy_level_get0_node(X509_POLICY_LEVEL *level, int i);
|
||||
X509_POLICY_NODE *X509_policy_level_get0_node(X509_POLICY_LEVEL *level,
|
||||
int i);
|
||||
|
||||
const ASN1_OBJECT *X509_policy_node_get0_policy(const X509_POLICY_NODE *node);
|
||||
|
||||
STACK_OF(POLICYQUALINFO) *
|
||||
X509_policy_node_get0_qualifiers(const X509_POLICY_NODE *node);
|
||||
const X509_POLICY_NODE *
|
||||
X509_policy_node_get0_parent(const X509_POLICY_NODE *node);
|
||||
STACK_OF(POLICYQUALINFO) *X509_policy_node_get0_qualifiers(const
|
||||
X509_POLICY_NODE
|
||||
*node);
|
||||
const X509_POLICY_NODE *X509_policy_node_get0_parent(const X509_POLICY_NODE
|
||||
*node);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user