mirror of
https://github.com/saymrwulf/cryptography.git
synced 2026-05-14 20:37:55 +00:00
Removed most of the C files. We'll add them back as needed.
This commit is contained in:
parent
d21da67719
commit
6b0eb72108
19 changed files with 1 additions and 944 deletions
|
|
@ -8,4 +8,4 @@ install:
|
|||
- pip install pytest flake8
|
||||
script:
|
||||
- py.test
|
||||
- flake8 .
|
||||
- "flake8 . --ignore='E128'"
|
||||
|
|
|
|||
|
|
@ -27,24 +27,6 @@ class API(object):
|
|||
)
|
||||
|
||||
_modules = [
|
||||
'asn1',
|
||||
'bio',
|
||||
'bio_filter',
|
||||
'bio_sink',
|
||||
'err',
|
||||
'evp',
|
||||
'evp_md',
|
||||
'evp_cipher',
|
||||
'evp_cipher_listing',
|
||||
'hmac',
|
||||
'obj',
|
||||
'openssl',
|
||||
'nid',
|
||||
'pkcs5',
|
||||
'rand',
|
||||
'ssl',
|
||||
'ssleay',
|
||||
'stdio',
|
||||
]
|
||||
|
||||
def __init__(self):
|
||||
|
|
|
|||
|
|
@ -1,131 +0,0 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
INCLUDES = [
|
||||
'#include <openssl/bio.h>',
|
||||
]
|
||||
|
||||
TYPES = [
|
||||
# BIO ctrl constants
|
||||
'static const int BIO_CTRL_RESET;',
|
||||
'static const int BIO_CTRL_EOF;',
|
||||
'static const int BIO_CTRL_SET;',
|
||||
'static const int BIO_CTRL_SET_CLOSE;',
|
||||
'static const int BIO_CTRL_FLUSH;',
|
||||
'static const int BIO_CTRL_DUP;',
|
||||
'static const int BIO_CTRL_GET_CLOSE;',
|
||||
'static const int BIO_CTRL_INFO;',
|
||||
'static const int BIO_CTRL_GET;',
|
||||
'static const int BIO_CTRL_PENDING;',
|
||||
'static const int BIO_CTRL_WPENDING;',
|
||||
'static const int BIO_C_FILE_SEEK;',
|
||||
'static const int BIO_C_FILE_TELL;',
|
||||
# BIO type constants
|
||||
'static const int BIO_TYPE_NONE;',
|
||||
'static const int BIO_TYPE_PROXY_CLIENT;',
|
||||
'static const int BIO_TYPE_PROXY_SERVER;',
|
||||
'static const int BIO_TYPE_NBIO_TEST;',
|
||||
'static const int BIO_TYPE_BER;',
|
||||
'static const int BIO_TYPE_BIO;',
|
||||
'static const int BIO_TYPE_DESCRIPTOR;',
|
||||
# BIO flags
|
||||
'static const int BIO_FLAGS_READ;',
|
||||
'static const int BIO_FLAGS_WRITE;',
|
||||
'static const int BIO_FLAGS_IO_SPECIAL;',
|
||||
'static const int BIO_FLAGS_RWS;',
|
||||
'static const int BIO_FLAGS_SHOULD_RETRY;',
|
||||
'typedef ... BUF_MEM;',
|
||||
# BIO forward declaration
|
||||
'typedef struct bio_st BIO;',
|
||||
# BIO callbacks definition
|
||||
'typedef void bio_info_cb(BIO *b, int oper, const char *ptr, int arg1, long arg2, long arg3);',
|
||||
# BIO_METHOD definition
|
||||
'''
|
||||
struct bio_method_st {
|
||||
int type;
|
||||
const char *name;
|
||||
int (*bwrite)(BIO*, const char*, int);
|
||||
int (*bread)(BIO*, char*, int);
|
||||
int (*bputs)(BIO*, const char*);
|
||||
int (*bgets)(BIO*, char*, int);
|
||||
long (*ctrl)(BIO*, int, long, void*);
|
||||
int (*create)(BIO*);
|
||||
int (*destroy)(BIO*);
|
||||
long (*callback_ctrl)(BIO*, int, bio_info_cb*);
|
||||
...;
|
||||
};''',
|
||||
'typedef struct bio_method_st BIO_METHOD;',
|
||||
# BIO definition
|
||||
'''
|
||||
struct bio_st {
|
||||
BIO_METHOD *method;
|
||||
long (*callback)(struct bio_st*, int, const char*, int, long, long);
|
||||
char *cb_arg;
|
||||
int init;
|
||||
int shutdown;
|
||||
int flags;
|
||||
int retry_reason;
|
||||
int num;
|
||||
void *ptr;
|
||||
struct bio_st *next_bio;
|
||||
struct bio_st *prev_bio;
|
||||
int references;
|
||||
unsigned long num_read;
|
||||
unsigned long num_write;
|
||||
...;
|
||||
};''',
|
||||
]
|
||||
|
||||
FUNCTIONS = [
|
||||
# BIO create functions
|
||||
'BIO* BIO_new(BIO_METHOD *type);',
|
||||
'int BIO_set(BIO *a, BIO_METHOD *type);',
|
||||
'int BIO_free(BIO *a);',
|
||||
'void BIO_vfree(BIO *a);',
|
||||
'void BIO_free_all(BIO *a);',
|
||||
# BIO stacking functions
|
||||
'BIO* BIO_push(BIO *b, BIO *append);',
|
||||
'BIO* BIO_pop(BIO *b);',
|
||||
'BIO* BIO_next(BIO *b);',
|
||||
'BIO* BIO_find_type(BIO *b, int bio_type);',
|
||||
'int BIO_method_type(BIO *b);',
|
||||
# BIO control functions
|
||||
'long BIO_ctrl(BIO *bp, int cmd, long larg, void *parg);',
|
||||
'long BIO_callback_ctrl(BIO *b, int cmd, void (*fp)(struct bio_st *, int, const char *, int, long, long));',
|
||||
'char* BIO_ptr_ctrl(BIO *bp, int cmd, long larg);',
|
||||
'long BIO_int_ctrl(BIO *bp, int cmd, long larg, int iarg);',
|
||||
'int BIO_reset(BIO *b);',
|
||||
'int BIO_seek(BIO *b, int ofs);',
|
||||
'int BIO_tell(BIO *b);',
|
||||
'int BIO_flush(BIO *b);',
|
||||
'int BIO_eof(BIO *b);',
|
||||
'int BIO_set_close(BIO *b,long flag);',
|
||||
'int BIO_get_close(BIO *b);',
|
||||
'int BIO_pending(BIO *b);',
|
||||
'int BIO_wpending(BIO *b);',
|
||||
'size_t BIO_ctrl_pending(BIO *b);',
|
||||
'size_t BIO_ctrl_wpending(BIO *b);',
|
||||
'int BIO_get_info_callback(BIO *b,bio_info_cb **cbp);',
|
||||
'int BIO_set_info_callback(BIO *b,bio_info_cb *cb);',
|
||||
# BIO IO functions
|
||||
'int BIO_read(BIO *b, void *buf, int len);',
|
||||
'int BIO_gets(BIO *b, char *buf, int size);',
|
||||
'int BIO_write(BIO *b, const void *buf, int len);',
|
||||
'int BIO_puts(BIO *b, const char *buf);',
|
||||
# BIO should functions
|
||||
'int BIO_should_read(BIO *b);',
|
||||
'int BIO_should_write(BIO *b);',
|
||||
'int BIO_should_io_special(BIO *b);',
|
||||
'int BIO_retry_type(BIO *b);',
|
||||
'int BIO_should_retry(BIO *b);',
|
||||
]
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
INCLUDES = [
|
||||
'#include <openssl/bio.h>',
|
||||
]
|
||||
|
||||
TYPES = [
|
||||
'static const int BIO_TYPE_NULL_FILTER;',
|
||||
'static const int BIO_TYPE_SSL;',
|
||||
'static const int BIO_TYPE_MD;',
|
||||
'static const int BIO_TYPE_BUFFER;',
|
||||
'static const int BIO_TYPE_CIPHER;',
|
||||
'static const int BIO_TYPE_BASE64;',
|
||||
'static const int BIO_TYPE_FILTER;',
|
||||
]
|
||||
|
||||
FUNCTIONS = [
|
||||
# BIO null
|
||||
'BIO_METHOD *BIO_f_null(void);',
|
||||
# BIO ssl
|
||||
# TODO
|
||||
# BIO message digests
|
||||
'BIO_METHOD *BIO_f_md(void);',
|
||||
'int BIO_set_md(BIO *b, EVP_MD *md);',
|
||||
'int BIO_get_md(BIO *b, EVP_MD **mdp);',
|
||||
'int BIO_set_md_ctx(BIO *b, EVP_MD_CTX **mdcp);',
|
||||
'int BIO_get_md_ctx(BIO *b, EVP_MD_CTX **mdcp);',
|
||||
# BIO buffer
|
||||
'BIO_METHOD * BIO_f_buffer(void);',
|
||||
'long BIO_get_buffer_num_lines(BIO *b);',
|
||||
'long BIO_set_read_buffer_size(BIO *b, long size);',
|
||||
'long BIO_set_write_buffer_size(BIO *b, long size);',
|
||||
'long BIO_set_buffer_size(BIO *b, long size);',
|
||||
'long BIO_set_buffer_read_data(BIO *b, void *buf, long num);',
|
||||
# BIO cipher
|
||||
'BIO_METHOD * BIO_f_cipher(void);',
|
||||
'void BIO_set_cipher(BIO *b,const EVP_CIPHER *cipher, unsigned char *key, unsigned char *iv, int enc);',
|
||||
'int BIO_get_cipher_status(BIO *b);',
|
||||
'int BIO_get_cipher_ctx(BIO *b, EVP_CIPHER_CTX **pctx);',
|
||||
# BIO base64
|
||||
'BIO_METHOD *BIO_f_base64(void);',
|
||||
# BIO zlib
|
||||
]
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
INCLUDES = [
|
||||
'#include <openssl/bio.h>',
|
||||
]
|
||||
|
||||
TYPES = [
|
||||
'static const int BIO_TYPE_MEM;',
|
||||
'static const int BIO_TYPE_FILE;',
|
||||
'static const int BIO_TYPE_FD;',
|
||||
'static const int BIO_TYPE_SOCKET;',
|
||||
'static const int BIO_TYPE_CONNECT;',
|
||||
'static const int BIO_TYPE_ACCEPT;',
|
||||
'static const int BIO_TYPE_NULL;',
|
||||
'static const int BIO_CLOSE;',
|
||||
'static const int BIO_NOCLOSE;',
|
||||
'static const int BIO_TYPE_SOURCE_SINK;',
|
||||
]
|
||||
|
||||
FUNCTIONS = [
|
||||
# BIO mem buffers
|
||||
'BIO_METHOD *BIO_s_mem(void);',
|
||||
'long BIO_set_mem_eof_return(BIO *b, int v);',
|
||||
'long BIO_get_mem_data(BIO *b, char **pp);',
|
||||
'long BIO_set_mem_buf(BIO *b,BUF_MEM *bm,int c);',
|
||||
'long BIO_get_mem_ptr(BIO *b,BUF_MEM **pp);',
|
||||
'BIO *BIO_new_mem_buf(void *buf, int len);',
|
||||
# BIO files
|
||||
'BIO_METHOD *BIO_s_file(void);',
|
||||
'BIO *BIO_new_file(const char *filename, const char *mode);',
|
||||
'BIO *BIO_new_fp(FILE *stream, int flags);',
|
||||
'long BIO_set_fp(BIO *b, FILE *fp, int flags);',
|
||||
'long BIO_get_fp(BIO *b, FILE **fpp);',
|
||||
'int BIO_read_filename(BIO *b, char *name);',
|
||||
'int BIO_write_filename(BIO *b, char *name);',
|
||||
'int BIO_append_filename(BIO *b, char *name);',
|
||||
'int BIO_rw_filename(BIO *b, char *name);',
|
||||
# BIO fd
|
||||
'BIO_METHOD *BIO_s_fd(void);',
|
||||
'long BIO_set_fd(BIO *bp, long fd, int cmd);',
|
||||
'long BIO_get_fd(BIO *bp, char *c);',
|
||||
'BIO *BIO_new_fd(int fd, int close_flag);',
|
||||
# BIO socket
|
||||
'BIO_METHOD *BIO_s_socket(void);'
|
||||
'BIO *BIO_new_socket(int sock, int close_flag);'
|
||||
# BIO connect
|
||||
# TODO
|
||||
# BIO accept
|
||||
# TODO
|
||||
# BIO null
|
||||
'BIO_METHOD *BIO_s_null(void);',
|
||||
]
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
INCLUDES = [
|
||||
'#include <openssl/err.h>',
|
||||
'#include <openssl/ssl.h>',
|
||||
]
|
||||
|
||||
SETUP = [
|
||||
'SSL_load_error_strings',
|
||||
]
|
||||
|
||||
TEARDOWN = [
|
||||
'ERR_free_strings',
|
||||
]
|
||||
|
||||
TYPES = [
|
||||
'struct ERR_string_data_st { unsigned long error; const char *string; };',
|
||||
'typedef struct ERR_string_data_st ERR_STRING_DATA;',
|
||||
]
|
||||
|
||||
FUNCTIONS = [
|
||||
'void ERR_load_crypto_strings(void);',
|
||||
'void ERR_free_strings(void);',
|
||||
'void SSL_load_error_strings(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(BIO *bp);',
|
||||
'void ERR_print_errors_fp(FILE *fp);',
|
||||
'unsigned long ERR_get_error(void);',
|
||||
'unsigned long ERR_peek_error(void);',
|
||||
'unsigned long ERR_peek_last_error(void);',
|
||||
'unsigned long ERR_get_error_line(const char **file, int *line);',
|
||||
'unsigned long ERR_peek_error_line(const char **file, int *line);',
|
||||
'unsigned long ERR_peek_last_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_line_data(const char **file, int *line, const char **data, int *flags);',
|
||||
'unsigned long ERR_peek_last_error_line_data(const char **file, int *line, const char **data, int *flags);',
|
||||
'void ERR_put_error(int lib, int func, int reason, const char *file, int line);',
|
||||
'void ERR_add_error_data(int num, ...);',
|
||||
'void ERR_load_strings(int lib, ERR_STRING_DATA str[]);',
|
||||
'int ERR_get_next_error_library(void);',
|
||||
'unsigned long ERR_PACK(int lib, int func, int reason);',
|
||||
'int ERR_GET_LIB(unsigned long e);',
|
||||
'int ERR_GET_FUNC(unsigned long e);',
|
||||
'int ERR_GET_REASON(unsigned long e);',
|
||||
]
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
INCLUDES = [
|
||||
'#include "openssl/evp.h"',
|
||||
]
|
||||
|
||||
TEARDOWN = [
|
||||
'EVP_cleanup',
|
||||
]
|
||||
|
||||
TYPES = [
|
||||
'typedef ... ENGINE;',
|
||||
]
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
INCLUDES = [
|
||||
'#include "openssl/evp.h"',
|
||||
]
|
||||
|
||||
TYPES = [
|
||||
'static const int EVP_CIPH_ECB_MODE;',
|
||||
'static const int EVP_CIPH_CBC_MODE;',
|
||||
'static const int EVP_CIPH_CFB_MODE;',
|
||||
'static const int EVP_CIPH_OFB_MODE;',
|
||||
'static const int EVP_CIPH_STREAM_CIPHER;',
|
||||
'struct evp_cipher_ctx_st { ...; };',
|
||||
'typedef ... EVP_CIPHER;',
|
||||
'typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX;',
|
||||
]
|
||||
|
||||
FUNCTIONS = [
|
||||
'void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *a);',
|
||||
# encrypt_ex
|
||||
'int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, ENGINE *impl, unsigned char *key, unsigned char *iv);',
|
||||
'int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, unsigned char *in, int inl);',
|
||||
'int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);',
|
||||
# decrypt_ex
|
||||
'int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, ENGINE *impl, unsigned char *key, unsigned char *iv);',
|
||||
'int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, unsigned char *in, int inl);',
|
||||
'int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);',
|
||||
# cipher_ex
|
||||
'int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, ENGINE *impl, unsigned char *key, unsigned char *iv, int enc);',
|
||||
'int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, unsigned char *in, int inl);',
|
||||
'int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);',
|
||||
# encrypt
|
||||
'int EVP_EncryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, unsigned char *key, unsigned char *iv);',
|
||||
'int EVP_EncryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl);',
|
||||
# decrypt
|
||||
'int EVP_DecryptInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, unsigned char *key, unsigned char *iv);',
|
||||
'int EVP_DecryptFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);',
|
||||
# cipher
|
||||
'int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type, unsigned char *key, unsigned char *iv, int enc);',
|
||||
'int EVP_CipherFinal(EVP_CIPHER_CTX *ctx, unsigned char *outm, int *outl);',
|
||||
# control
|
||||
'int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *x, int padding);',
|
||||
'int EVP_CIPHER_CTX_set_key_length(EVP_CIPHER_CTX *x, int keylen);',
|
||||
'int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr);',
|
||||
'int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *a);',
|
||||
'const EVP_CIPHER *EVP_get_cipherbyname(const char *name);',
|
||||
# cipher macros
|
||||
'const EVP_CIPHER *EVP_get_cipherbynid(int n);',
|
||||
'const EVP_CIPHER *EVP_get_cipherbyobj(const ASN1_OBJECT *o);',
|
||||
'int EVP_CIPHER_nid(const EVP_CIPHER *cipher);',
|
||||
'int EVP_CIPHER_block_size(const EVP_CIPHER *cipher);',
|
||||
'int EVP_CIPHER_key_length(const EVP_CIPHER *cipher);',
|
||||
'int EVP_CIPHER_iv_length(const EVP_CIPHER *cipher);',
|
||||
'unsigned long EVP_CIPHER_flags(const EVP_CIPHER *cipher);',
|
||||
'unsigned long EVP_CIPHER_mode(const EVP_CIPHER *cipher);',
|
||||
'int EVP_CIPHER_type(const EVP_CIPHER *ctx);',
|
||||
# ctx macros
|
||||
'const EVP_CIPHER *EVP_CIPHER_CTX_cipher(const EVP_CIPHER_CTX *ctx);',
|
||||
'int EVP_CIPHER_CTX_nid(const EVP_CIPHER_CTX *ctx);',
|
||||
'int EVP_CIPHER_CTX_block_size(const EVP_CIPHER_CTX *ctx);',
|
||||
'int EVP_CIPHER_CTX_key_length(const EVP_CIPHER_CTX *ctx);',
|
||||
'int EVP_CIPHER_CTX_iv_length(const EVP_CIPHER_CTX *ctx);',
|
||||
'void *EVP_CIPHER_CTX_get_app_data(const EVP_CIPHER_CTX *ctx);',
|
||||
'void EVP_CIPHER_CTX_set_app_data(EVP_CIPHER_CTX *ctx, void *data);',
|
||||
'int EVP_CIPHER_CTX_type(const EVP_CIPHER_CTX *ctx);',
|
||||
'unsigned long EVP_CIPHER_CTX_flags(const EVP_CIPHER_CTX *ctx);',
|
||||
'unsigned long EVP_CIPHER_CTX_mode(const EVP_CIPHER_CTX *ctx);',
|
||||
'int EVP_CIPHER_param_to_asn1(EVP_CIPHER_CTX *c, ASN1_TYPE *type);',
|
||||
'int EVP_CIPHER_asn1_to_param(EVP_CIPHER_CTX *c, ASN1_TYPE *type);',
|
||||
]
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
INCLUDES = [
|
||||
'#include "openssl/evp.h"',
|
||||
]
|
||||
|
||||
FUNCTIONS = [
|
||||
'const EVP_CIPHER *EVP_enc_null(void);',
|
||||
'const EVP_CIPHER *EVP_des_ecb(void);',
|
||||
'const EVP_CIPHER *EVP_des_ede(void);',
|
||||
'const EVP_CIPHER *EVP_des_ede3(void);',
|
||||
'const EVP_CIPHER *EVP_des_ede_ecb(void);',
|
||||
'const EVP_CIPHER *EVP_des_ede3_ecb(void);',
|
||||
'const EVP_CIPHER *EVP_des_cfb64(void);',
|
||||
'const EVP_CIPHER *EVP_des_cfb1(void);',
|
||||
'const EVP_CIPHER *EVP_des_cfb8(void);',
|
||||
'const EVP_CIPHER *EVP_des_ede_cfb64(void);',
|
||||
'const EVP_CIPHER *EVP_des_ede3_cfb64(void);',
|
||||
'const EVP_CIPHER *EVP_des_ede3_cfb1(void);',
|
||||
'const EVP_CIPHER *EVP_des_ede3_cfb8(void);',
|
||||
'const EVP_CIPHER *EVP_des_ofb(void);',
|
||||
'const EVP_CIPHER *EVP_des_ede_ofb(void);',
|
||||
'const EVP_CIPHER *EVP_des_ede3_ofb(void);',
|
||||
'const EVP_CIPHER *EVP_des_cbc(void);',
|
||||
'const EVP_CIPHER *EVP_des_ede_cbc(void);',
|
||||
'const EVP_CIPHER *EVP_des_ede3_cbc(void);',
|
||||
'const EVP_CIPHER *EVP_desx_cbc(void);',
|
||||
'const EVP_CIPHER *EVP_rc4(void);',
|
||||
'const EVP_CIPHER *EVP_rc4_40(void);',
|
||||
'const EVP_CIPHER *EVP_rc2_ecb(void);',
|
||||
'const EVP_CIPHER *EVP_rc2_cbc(void);',
|
||||
'const EVP_CIPHER *EVP_rc2_40_cbc(void);',
|
||||
'const EVP_CIPHER *EVP_rc2_64_cbc(void);',
|
||||
'const EVP_CIPHER *EVP_rc2_cfb64(void);',
|
||||
'const EVP_CIPHER *EVP_rc2_ofb(void);',
|
||||
'const EVP_CIPHER *EVP_bf_ecb(void);',
|
||||
'const EVP_CIPHER *EVP_bf_cbc(void);',
|
||||
'const EVP_CIPHER *EVP_bf_cfb64(void);',
|
||||
'const EVP_CIPHER *EVP_bf_ofb(void);',
|
||||
'const EVP_CIPHER *EVP_cast5_ecb(void);',
|
||||
'const EVP_CIPHER *EVP_cast5_cbc(void);',
|
||||
'const EVP_CIPHER *EVP_cast5_cfb64(void);',
|
||||
'const EVP_CIPHER *EVP_cast5_ofb(void);',
|
||||
'const EVP_CIPHER *EVP_aes_128_ecb(void);',
|
||||
'const EVP_CIPHER *EVP_aes_128_cbc(void);',
|
||||
'const EVP_CIPHER *EVP_aes_128_cfb1(void);',
|
||||
'const EVP_CIPHER *EVP_aes_128_cfb8(void);',
|
||||
'const EVP_CIPHER *EVP_aes_128_cfb128(void);',
|
||||
'const EVP_CIPHER *EVP_aes_128_ofb(void);',
|
||||
'const EVP_CIPHER *EVP_aes_192_ecb(void);',
|
||||
'const EVP_CIPHER *EVP_aes_192_cbc(void);',
|
||||
'const EVP_CIPHER *EVP_aes_192_cfb1(void);',
|
||||
'const EVP_CIPHER *EVP_aes_192_cfb8(void);',
|
||||
'const EVP_CIPHER *EVP_aes_192_cfb128(void);',
|
||||
'const EVP_CIPHER *EVP_aes_192_ofb(void);',
|
||||
'const EVP_CIPHER *EVP_aes_256_ecb(void);',
|
||||
'const EVP_CIPHER *EVP_aes_256_cbc(void);',
|
||||
'const EVP_CIPHER *EVP_aes_256_cfb1(void);',
|
||||
'const EVP_CIPHER *EVP_aes_256_cfb8(void);',
|
||||
'const EVP_CIPHER *EVP_aes_256_cfb128(void);',
|
||||
'const EVP_CIPHER *EVP_aes_256_ofb(void);',
|
||||
]
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
INCLUDES = [
|
||||
'#include "openssl/evp.h"',
|
||||
]
|
||||
|
||||
TYPES = [
|
||||
'static const int EVP_MAX_MD_SIZE;',
|
||||
'static const int EVP_MAX_KEY_LENGTH;',
|
||||
'static const int EVP_MAX_IV_LENGTH;',
|
||||
'static const int EVP_MAX_BLOCK_LENGTH;',
|
||||
'struct env_md_ctx_st { ...; };',
|
||||
'typedef ... EVP_MD;',
|
||||
'typedef struct env_md_ctx_st EVP_MD_CTX;',
|
||||
]
|
||||
|
||||
FUNCTIONS = [
|
||||
'void EVP_cleanup(void);',
|
||||
'void EVP_MD_CTX_init(EVP_MD_CTX *ctx);',
|
||||
'EVP_MD_CTX *EVP_MD_CTX_create(void);',
|
||||
'int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl);',
|
||||
'int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *d, size_t cnt);',
|
||||
'int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s);',
|
||||
'int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx);',
|
||||
'void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx);',
|
||||
'int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out,const EVP_MD_CTX *in);',
|
||||
'int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type);',
|
||||
'int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s);',
|
||||
'int EVP_MD_CTX_copy(EVP_MD_CTX *out,EVP_MD_CTX *in);',
|
||||
'const EVP_MD *EVP_get_digestbyname(const char *name);',
|
||||
'const EVP_MD *EVP_get_digestbynid(int n);',
|
||||
'const EVP_MD *EVP_get_digestbyobj(const ASN1_OBJECT *o);',
|
||||
'const EVP_MD *EVP_md_null(void);',
|
||||
'const EVP_MD *EVP_md4(void);',
|
||||
'const EVP_MD *EVP_md5(void);',
|
||||
'const EVP_MD *EVP_sha(void);',
|
||||
'const EVP_MD *EVP_sha1(void);',
|
||||
'const EVP_MD *EVP_dss(void);',
|
||||
'const EVP_MD *EVP_dss1(void);',
|
||||
'const EVP_MD *EVP_ecdsa(void);',
|
||||
'const EVP_MD *EVP_sha224(void);',
|
||||
'const EVP_MD *EVP_sha256(void);',
|
||||
'const EVP_MD *EVP_sha384(void);',
|
||||
'const EVP_MD *EVP_sha512(void);',
|
||||
'const EVP_MD *EVP_ripemd160(void);',
|
||||
'int EVP_MD_type(const EVP_MD *md);',
|
||||
'int EVP_MD_pkey_type(const EVP_MD *md);',
|
||||
'int EVP_MD_size(const EVP_MD *md);',
|
||||
'int EVP_MD_block_size(const EVP_MD *md);',
|
||||
'const EVP_MD *EVP_MD_CTX_md(const EVP_MD_CTX *ctx);',
|
||||
'int EVP_MD_CTX_size(const EVP_MD_CTX *ctx);',
|
||||
'int EVP_MD_CTX_block_size(const EVP_MD_CTX *ctx);',
|
||||
'int EVP_MD_CTX_type(const EVP_MD_CTX *ctx);',
|
||||
]
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
INCLUDES = [
|
||||
'#include <openssl/hmac.h>',
|
||||
]
|
||||
|
||||
TYPES = [
|
||||
'struct hmac_ctx_st { ...; };',
|
||||
'typedef struct hmac_ctx_st HMAC_CTX;',
|
||||
]
|
||||
|
||||
FUNCTIONS = [
|
||||
'unsigned char *HMAC(const EVP_MD *evp_md, const void *key,'
|
||||
'int key_len, const unsigned char *d, int n,'
|
||||
'unsigned char *md, unsigned int *md_len);',
|
||||
'void HMAC_CTX_init(HMAC_CTX *ctx);',
|
||||
'void HMAC_Init(HMAC_CTX *ctx, const void *key, int key_len, const EVP_MD *md);',
|
||||
'void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int key_len, const EVP_MD *md, ENGINE *impl);',
|
||||
'void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, int len);',
|
||||
'void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len);',
|
||||
'void HMAC_CTX_cleanup(HMAC_CTX *ctx);',
|
||||
'void HMAC_cleanup(HMAC_CTX *ctx);',
|
||||
]
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
TYPES = [
|
||||
'static const int NID_undef;',
|
||||
'static const int NID_dsa;',
|
||||
'static const int NID_dsaWithSHA;',
|
||||
'static const int NID_dsaWithSHA1;',
|
||||
'static const int NID_md4;',
|
||||
'static const int NID_md5;',
|
||||
'static const int NID_mdc2;',
|
||||
'static const int NID_ripemd160;',
|
||||
'static const int NID_sha;',
|
||||
'static const int NID_sha1;',
|
||||
'static const int NID_sha256;',
|
||||
'static const int NID_sha384;',
|
||||
'static const int NID_sha512;',
|
||||
'static const int NID_sha224;',
|
||||
'static const int NID_sha;',
|
||||
'static const int NID_ecdsa_with_SHA1;',
|
||||
'static const int NID_ecdsa_with_SHA224;',
|
||||
'static const int NID_ecdsa_with_SHA256;',
|
||||
'static const int NID_ecdsa_with_SHA384;',
|
||||
'static const int NID_ecdsa_with_SHA512;',
|
||||
]
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
INCLUDES = [
|
||||
'#include <openssl/objects.h>',
|
||||
]
|
||||
|
||||
TYPES = [
|
||||
'static const int OBJ_NAME_TYPE_UNDEF;',
|
||||
'static const int OBJ_NAME_TYPE_MD_METH;',
|
||||
'static const int OBJ_NAME_TYPE_CIPHER_METH;',
|
||||
'static const int OBJ_NAME_TYPE_PKEY_METH;',
|
||||
'static const int OBJ_NAME_TYPE_COMP_METH;',
|
||||
'static const int OBJ_NAME_TYPE_NUM;',
|
||||
'struct obj_name_st { int type; int alias; const char *name; const char *data; ...; };',
|
||||
'typedef struct obj_name_st OBJ_NAME;',
|
||||
]
|
||||
|
||||
FUNCTIONS = [
|
||||
'ASN1_OBJECT *OBJ_nid2obj(int n);',
|
||||
'const char *OBJ_nid2ln(int n);',
|
||||
'const char *OBJ_nid2sn(int n);',
|
||||
'int OBJ_obj2nid(const ASN1_OBJECT *o);',
|
||||
'int OBJ_ln2nid(const char *ln);',
|
||||
'int OBJ_sn2nid(const char *sn);',
|
||||
'int OBJ_txt2nid(const char *s);',
|
||||
'ASN1_OBJECT * OBJ_txt2obj(const char *s, int no_name);',
|
||||
'int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name);',
|
||||
'int OBJ_cmp(const ASN1_OBJECT *a,const ASN1_OBJECT *b);',
|
||||
'ASN1_OBJECT * OBJ_dup(const ASN1_OBJECT *o);',
|
||||
'int OBJ_create(const char *oid,const char *sn,const char *ln);',
|
||||
'void OBJ_cleanup(void);',
|
||||
'int OBJ_NAME_init(void);',
|
||||
'void OBJ_NAME_do_all(int type,void (*fn)(const OBJ_NAME *,void *arg), void *arg);',
|
||||
'void OBJ_NAME_do_all_sorted(int type,void (*fn)(const OBJ_NAME *,void *arg), void *arg);',
|
||||
]
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
INCLUDES = [
|
||||
'#include "openssl/ssl.h"',
|
||||
]
|
||||
|
||||
SETUP = [
|
||||
'OpenSSL_add_all_digests',
|
||||
'OpenSSL_add_all_ciphers',
|
||||
]
|
||||
|
||||
FUNCTIONS = [
|
||||
"void OpenSSL_add_all_algorithms(void);",
|
||||
"void OpenSSL_add_all_ciphers(void);",
|
||||
"void OpenSSL_add_all_digests(void);",
|
||||
]
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
INCLUDES = [
|
||||
'#include "openssl/evp.h"',
|
||||
]
|
||||
|
||||
FUNCTIONS = [
|
||||
'int PKCS5_PBKDF2_HMAC_SHA1(const char *pass, int passlen,'
|
||||
'const unsigned char *salt, int saltlen, int iter,'
|
||||
'int keylen, unsigned char *out);',
|
||||
'int EVP_BytesToKey(const EVP_CIPHER *type,const EVP_MD *md,'
|
||||
'const unsigned char *salt,'
|
||||
'const unsigned char *data, int datal, int count,'
|
||||
'unsigned char *key,unsigned char *iv);',
|
||||
]
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
INCLUDES = [
|
||||
'#include <openssl/rand.h>',
|
||||
]
|
||||
|
||||
FUNCTIONS = [
|
||||
'void RAND_seed(const void *buf, int num);',
|
||||
'void RAND_add(const void *buf, int num, double entropy);',
|
||||
'int RAND_status(void);',
|
||||
'int RAND_egd(const char *path);',
|
||||
'int RAND_egd_bytes(const char *path, int bytes);',
|
||||
'int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes);',
|
||||
'const char *RAND_file_name(char *buf, size_t num);',
|
||||
'int RAND_load_file(const char *filename, long max_bytes);',
|
||||
'int RAND_write_file(const char *filename);',
|
||||
'void RAND_cleanup(void);',
|
||||
'int RAND_bytes(unsigned char *buf, int num);',
|
||||
'int RAND_pseudo_bytes(unsigned char *buf, int num);',
|
||||
]
|
||||
|
|
@ -1,121 +0,0 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from functools import wraps
|
||||
|
||||
INCLUDES = [
|
||||
'#include "openssl/ssl.h"',
|
||||
]
|
||||
|
||||
SETUP = [
|
||||
'SSL_library_init',
|
||||
]
|
||||
|
||||
TYPES = [
|
||||
# Internally invented symbol to tell us if SSLv2 is supported
|
||||
'static const int OPENTLS_NO_SSL2;',
|
||||
|
||||
'typedef ... SSL_METHOD;',
|
||||
'typedef ... SSL_CTX;',
|
||||
]
|
||||
|
||||
FUNCTIONS = [
|
||||
'int SSL_library_init(void);',
|
||||
|
||||
# methods
|
||||
'const SSL_METHOD *SSLv3_method(void);',
|
||||
'const SSL_METHOD *SSLv3_server_method(void);',
|
||||
'const SSL_METHOD *SSLv3_client_method(void);',
|
||||
'const SSL_METHOD *TLSv1_method(void);',
|
||||
'const SSL_METHOD *TLSv1_server_method(void);',
|
||||
'const SSL_METHOD *TLSv1_client_method(void);',
|
||||
'const SSL_METHOD *SSLv23_method(void);',
|
||||
'const SSL_METHOD *SSLv23_server_method(void);',
|
||||
'const SSL_METHOD *SSLv23_client_method(void);',
|
||||
|
||||
# SSLv2 support is compiled out of some versions of OpenSSL. These will
|
||||
# get special support when we generate the bindings so that if they are
|
||||
# available they will be wrapped, but if they are not they won't cause
|
||||
# problems (like link errors).
|
||||
'SSL_METHOD *SSLv2_method(void);',
|
||||
'SSL_METHOD *SSLv2_server_method(void);',
|
||||
'SSL_METHOD *SSLv2_client_method(void);',
|
||||
|
||||
# context
|
||||
'SSL_CTX *SSL_CTX_new(SSL_METHOD *method);',
|
||||
'void SSL_CTX_free(SSL_CTX *ctx);',
|
||||
]
|
||||
|
||||
C_CUSTOMIZATION = [
|
||||
"""
|
||||
#ifdef OPENSSL_NO_SSL2
|
||||
static const int OPENTLS_NO_SSL2 = 1;
|
||||
SSL_METHOD* (*SSLv2_method)(void) = NULL;
|
||||
SSL_METHOD* (*SSLv2_client_method)(void) = NULL;
|
||||
SSL_METHOD* (*SSLv2_server_method)(void) = NULL;
|
||||
#else
|
||||
static const int OPENTLS_NO_SSL2 = 0;
|
||||
#endif
|
||||
"""]
|
||||
|
||||
|
||||
def _not_implemented_override(wrapped):
|
||||
"""
|
||||
Decorator to help define an override which just raises NotImplementedError,
|
||||
useful to define friendly versions of APIs which are not actually available
|
||||
in the version of OpenSSL currently in use.
|
||||
|
||||
wrapped is the Python function which will override the cffi-defined
|
||||
wrapper.
|
||||
|
||||
This returns a factory to create the override function. It expects to be
|
||||
called by the tls.c.api setup machinery. See tls/c/__init__.py.
|
||||
"""
|
||||
@wraps(wrapped)
|
||||
def _not_implemented_factory(api, from_openssl):
|
||||
"""
|
||||
If SSLv2 is not supported by the OpenSSL library represented by the
|
||||
given api object, create an override function which raises
|
||||
NotImplementedError instead of trying to call the requested API (which
|
||||
would probably result in a null pointer dereference).
|
||||
"""
|
||||
if api.OPENTLS_NO_SSL2:
|
||||
# SSLv2 is unsupported, give back the safe wrapper
|
||||
@wraps(wrapped)
|
||||
def not_implemented(*args, **kwargs):
|
||||
raise NotImplementedError()
|
||||
return not_implemented
|
||||
else:
|
||||
# SSLv2 is supported, give back the original function
|
||||
return from_openssl
|
||||
|
||||
return _not_implemented_factory
|
||||
|
||||
|
||||
@_not_implemented_override
|
||||
def SSLv2_method():
|
||||
pass
|
||||
|
||||
|
||||
@_not_implemented_override
|
||||
def SSLv2_client_method():
|
||||
pass
|
||||
|
||||
|
||||
@_not_implemented_override
|
||||
def SSLv2_server_method():
|
||||
pass
|
||||
|
||||
OVERRIDES = [
|
||||
SSLv2_method, SSLv2_client_method, SSLv2_server_method,
|
||||
]
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
INCLUDES = [
|
||||
'#include "openssl/ssl.h"',
|
||||
]
|
||||
|
||||
TYPES = [
|
||||
'static const int SSLEAY_VERSION;',
|
||||
'static const int SSLEAY_CFLAGS;',
|
||||
'static const int SSLEAY_BUILT_ON;',
|
||||
'static const int SSLEAY_PLATFORM;',
|
||||
'static const int SSLEAY_DIR;',
|
||||
]
|
||||
|
||||
FUNCTIONS = [
|
||||
"long SSLeay(void);",
|
||||
"const char* SSLeay_version(int);",
|
||||
]
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
INCLUDES = [
|
||||
'#include <stdio.h>',
|
||||
]
|
||||
|
||||
TYPES = [
|
||||
]
|
||||
|
||||
FUNCTIONS = [
|
||||
'FILE *fdopen(int fildes, const char *mode);',
|
||||
'FILE *fopen(const char *restrict filename, const char *restrict mode);',
|
||||
'FILE *freopen(const char *restrict filename, const char *restrict mode, FILE *restrict stream);',
|
||||
]
|
||||
Loading…
Reference in a new issue