Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions crypto/openssl_mbedtls_wrapper/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,25 @@ config OPENSSL_MBEDTLS_WRAPPER
depends on CRYPTO_MBEDTLS
bool "openssl mbedtls wrapper"
default n

if OPENSSL_MBEDTLS_WRAPPER

choice
prompt "Openssl Mbedtls Wrapper Assert Debug"
default OPENSSL_ASSERT_EXIT

config OPENSSL_ASSERT_DEBUG
bool "SSL_ASSERT* will show error file name and line"

config OPENSSL_ASSERT_EXIT
bool "SSL_ASSERT* will just return error code"

config OPENSSL_ASSERT_DEBUG_EXIT
bool "SSL_ASSERT* will show error file name and line, then return error code"

config OPENSSL_ASSERT_DEBUG_BLOCK
bool "SSL_ASSERT* will show error file name and line, then block here with 'while (1)'"

endchoice

endif # OPENSSL_MBEDTLS_WRAPPER
72 changes: 71 additions & 1 deletion crypto/openssl_mbedtls_wrapper/include/openssl/bio.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,86 @@
****************************************************************************/

#include <openssl/base.h>
#include <openssl/types.h>

/****************************************************************************
* Public Function Prototypes
* Pre-processor Definitions
****************************************************************************/

/* There are the classes of BIOs */

#define BIO_TYPE_DESCRIPTOR 0x0100 /* socket, fd, connect or accept */
#define BIO_TYPE_FILTER 0x0200
#define BIO_TYPE_SOURCE_SINK 0x0400

#define BIO_FLAGS_BASE64_NO_NL 0x100

/* This is used with memory BIOs: BIO_FLAGS_MEM_RDONLY
* means we shouldn't free up or change the data in any way;
* BIO_FLAGS_NONCLEAR_RST means we shouldn't clear data on reset.
*/

#define BIO_FLAGS_MEM_RDONLY 0x200
#define BIO_FLAGS_NONCLEAR_RST 0x400
#define BIO_FLAGS_IN_EOF 0x800

#define BIO_TYPE_NONE 0
#define BIO_TYPE_MEM (1 | BIO_TYPE_SOURCE_SINK)
#define BIO_TYPE_FILE (2 | BIO_TYPE_SOURCE_SINK)
#define BIO_TYPE_BASE64 (11 | BIO_TYPE_FILTER)

/****************************************************************************
* Public Types
****************************************************************************/

struct bio_method_st
{
int type;
char *name;
int (*bwrite_old) (BIO *, const char *, int);
int (*bread_old) (BIO *, char *, int);
int (*create) (BIO *);
int (*destroy) (BIO *);
};

struct bio_st
{
const BIO_METHOD *method;
int flags; /* extra storage */
void *ptr;
struct bio_st *next_bio; /* used by filter BIOs */
struct bio_st *prev_bio; /* used by filter BIOs */
};

#ifdef __cplusplus
extern "C"
{
#endif

/****************************************************************************
* Public Function Prototypes
****************************************************************************/

const BIO_METHOD *BIO_f_base64(void);

Check failure on line 90 in crypto/openssl_mbedtls_wrapper/include/openssl/bio.h

View workflow job for this annotation

GitHub Actions / check

Mixed case identifier found

const BIO_METHOD *BIO_s_mem(void);

Check failure on line 92 in crypto/openssl_mbedtls_wrapper/include/openssl/bio.h

View workflow job for this annotation

GitHub Actions / check

Mixed case identifier found

BIO *BIO_new(const BIO_METHOD *method);

Check failure on line 94 in crypto/openssl_mbedtls_wrapper/include/openssl/bio.h

View workflow job for this annotation

GitHub Actions / check

Mixed case identifier found

BIO *BIO_push(BIO *b, BIO *bio);

Check failure on line 96 in crypto/openssl_mbedtls_wrapper/include/openssl/bio.h

View workflow job for this annotation

GitHub Actions / check

Mixed case identifier found

void BIO_set_flags(BIO *b, int flags);

Check failure on line 98 in crypto/openssl_mbedtls_wrapper/include/openssl/bio.h

View workflow job for this annotation

GitHub Actions / check

Mixed case identifier found

int BIO_write(BIO *b, const void *data, int dlen);

Check failure on line 100 in crypto/openssl_mbedtls_wrapper/include/openssl/bio.h

View workflow job for this annotation

GitHub Actions / check

Mixed case identifier found

int BIO_read(BIO *b, void *data, int dlen);

Check failure on line 102 in crypto/openssl_mbedtls_wrapper/include/openssl/bio.h

View workflow job for this annotation

GitHub Actions / check

Mixed case identifier found

void BIO_free_all(BIO *bio);

Check failure on line 104 in crypto/openssl_mbedtls_wrapper/include/openssl/bio.h

View workflow job for this annotation

GitHub Actions / check

Mixed case identifier found

BIO *BIO_next(BIO *b);

Check failure on line 106 in crypto/openssl_mbedtls_wrapper/include/openssl/bio.h

View workflow job for this annotation

GitHub Actions / check

Mixed case identifier found

int BIO_flush(BIO *b);

Check failure on line 108 in crypto/openssl_mbedtls_wrapper/include/openssl/bio.h

View workflow job for this annotation

GitHub Actions / check

Mixed case identifier found

#ifdef __cplusplus
}
#endif
Expand Down
48 changes: 48 additions & 0 deletions crypto/openssl_mbedtls_wrapper/include/openssl/crypto.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/****************************************************************************
* apps/crypto/openssl_mbedtls_wrapper/include/openssl/crypto.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you 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.
****************************************************************************/

#ifndef OPENSSL_MBEDTLS_WRAPPER_CRYPTO_H
#define OPENSSL_MBEDTLS_WRAPPER_CRYPTO_H

/****************************************************************************
* Included Files
****************************************************************************/

#include <openssl/base.h>

/****************************************************************************
* Pre-processor Definitions
****************************************************************************/

#define CRYPTO_num_locks() 1
#define CRYPTO_set_locking_callback(func)

#define CRYPTO_set_id_callback(func)

/* 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

#endif /* OPENSSL_MBEDTLS_WRAPPER_CRYPTO_H */
6 changes: 6 additions & 0 deletions crypto/openssl_mbedtls_wrapper/include/openssl/err.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ unsigned long ERR_peek_last_error(void);
void ERR_error_string_n(unsigned long e, char *buf, size_t len);
void ERR_free_strings(void);
char *ERR_error_string(unsigned long e, char *buf);
void ERR_clear_error(void);
unsigned long ERR_get_error(void);
void ERR_remove_state(unsigned long pid);
int ERR_load_crypto_strings(void);
void ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u),
void *u);

#ifdef __cplusplus
}
Expand Down
8 changes: 8 additions & 0 deletions crypto/openssl_mbedtls_wrapper/include/openssl/evp.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@

#define EVP_PKEY_X25519 NID_X25519

/****************************************************************************
* Public Types
****************************************************************************/

struct evp_pkey_st
{
void *pkey_pm;
Expand Down Expand Up @@ -166,6 +170,10 @@ int PKCS5_PBKDF2_HMAC(const char *password, size_t password_len,

const PKEY_METHOD *EVP_PKEY_method(void);

int OpenSSL_add_all_algorithms(void);

void EVP_cleanup(void);

#ifdef __cplusplus
}
#endif
Expand Down
Loading
Loading