mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
apps/crypto: Add project openssl_mbedtls_wrapper
Add openssl mbedtls wrapper project Signed-off-by: yanghuatao <yanghuatao@xiaomi.com>
This commit is contained in:
parent
da83750cd3
commit
f1ace3774f
56 changed files with 4330 additions and 0 deletions
9
crypto/openssl_mbedtls_wrapper/Kconfig
Normal file
9
crypto/openssl_mbedtls_wrapper/Kconfig
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see the file kconfig-language.txt in the NuttX tools repository.
|
||||
#
|
||||
|
||||
config OPENSSL_MBEDTLS_WRAPPER
|
||||
depends on CRYPTO_MBEDTLS
|
||||
bool "openssl mbedtls wrapper"
|
||||
default n
|
||||
25
crypto/openssl_mbedtls_wrapper/Make.defs
Normal file
25
crypto/openssl_mbedtls_wrapper/Make.defs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
############################################################################
|
||||
# apps/crypto/openssl_mbedtls_wrapper/Make.defs
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
ifneq ($(CONFIG_OPENSSL_MBEDTLS_WRAPPER),)
|
||||
CONFIGURED_APPS += $(APPDIR)/crypto/openssl_mbedtls_wrapper
|
||||
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/crypto/openssl_mbedtls_wrapper/include
|
||||
CXXFLAGS += ${INCDIR_PREFIX}$(APPDIR)/crypto/openssl_mbedtls_wrapper/include
|
||||
endif
|
||||
23
crypto/openssl_mbedtls_wrapper/Makefile
Normal file
23
crypto/openssl_mbedtls_wrapper/Makefile
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
############################################################################
|
||||
# apps/crypto/openssl_mbedtls_wrapper/Makefile
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include $(APPDIR)/Make.defs
|
||||
CSRCS += $(wildcard $(APPDIR)/crypto/openssl_mbedtls_wrapper/mbedtls/*.c)
|
||||
include $(APPDIR)/Application.mk
|
||||
80
crypto/openssl_mbedtls_wrapper/include/openssl/aes.h
Normal file
80
crypto/openssl_mbedtls_wrapper/include/openssl/aes.h
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/include/openssl/aes.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_AES_H
|
||||
#define OPENSSL_MBEDTLS_WRAPPER_AES_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/base.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define AES_ENCRYPT 1
|
||||
#define AES_DECRYPT 0
|
||||
|
||||
#define AES_BLOCK_SIZE 16
|
||||
#define AES_MAXNR 14
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
struct aes_key_st
|
||||
{
|
||||
uint32_t rd_key[4 * (AES_MAXNR + 1)];
|
||||
unsigned rounds;
|
||||
};
|
||||
|
||||
typedef struct aes_key_st AES_KEY;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
int AES_set_encrypt_key(const uint8_t *key, unsigned bits,
|
||||
AES_KEY *aeskey);
|
||||
|
||||
void AES_encrypt(const uint8_t *in, uint8_t *out,
|
||||
const AES_KEY *key);
|
||||
|
||||
int AES_set_decrypt_key(const uint8_t *key, unsigned bits,
|
||||
AES_KEY *aeskey);
|
||||
|
||||
void AES_decrypt(const uint8_t *in, uint8_t *out,
|
||||
const AES_KEY *key);
|
||||
|
||||
void AES_cbc_encrypt(const uint8_t *in, uint8_t *out,
|
||||
size_t len, const AES_KEY *key,
|
||||
uint8_t *ivec, const int enc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OPENSSL_MBEDTLS_WRAPPER_AES_H */
|
||||
82
crypto/openssl_mbedtls_wrapper/include/openssl/asn1.h
Normal file
82
crypto/openssl_mbedtls_wrapper/include/openssl/asn1.h
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/include/openssl/asn1.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_ASN1_H
|
||||
#define OPENSSL_MBEDTLS_WRAPPER_ASN1_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/base.h>
|
||||
#include <time.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define MBSTRING_FLAG 0x1000
|
||||
#define MBSTRING_UTF8 (MBSTRING_FLAG)
|
||||
#define MBSTRING_ASC (MBSTRING_FLAG | 1)
|
||||
|
||||
#define V_ASN1_NULL 5
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
void ASN1_BIT_STRING_free(ASN1_BIT_STRING *a);
|
||||
|
||||
void ASN1_INTEGER_free(ASN1_INTEGER *a);
|
||||
|
||||
void ASN1_OBJECT_free(ASN1_OBJECT *a);
|
||||
|
||||
void ASN1_OCTET_STRING_free(ASN1_OCTET_STRING *a);
|
||||
|
||||
void ASN1_TIME_free(ASN1_TIME *a);
|
||||
|
||||
ASN1_BIT_STRING *ASN1_BIT_STRING_new(void);
|
||||
|
||||
int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *str, int n, int value);
|
||||
|
||||
ASN1_OCTET_STRING *ASN1_OCTET_STRING_new(void);
|
||||
|
||||
int i2d_ASN1_BIT_STRING(const ASN1_BIT_STRING *in, uint8_t **outp);
|
||||
|
||||
int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str,
|
||||
const unsigned char *data, int len);
|
||||
|
||||
ASN1_INTEGER *ASN1_INTEGER_new(void);
|
||||
|
||||
ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai);
|
||||
|
||||
ASN1_TIME *ASN1_TIME_new(void);
|
||||
|
||||
ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OPENSSL_MBEDTLS_WRAPPER_ASN1_H */
|
||||
82
crypto/openssl_mbedtls_wrapper/include/openssl/base.h
Normal file
82
crypto/openssl_mbedtls_wrapper/include/openssl/base.h
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/include/openssl/base.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_BASE_H
|
||||
#define OPENSSL_MBEDTLS_WRAPPER_BASE_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define ASN1_BIT_STRING ASN1_STRING
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
typedef struct EVP_CIPHER EVP_CIPHER;
|
||||
typedef struct EVP_CIPHER_CTX EVP_CIPHER_CTX;
|
||||
typedef struct ENGINE ENGINE;
|
||||
typedef struct EVP_MD EVP_MD;
|
||||
typedef struct EVP_MD_CTX EVP_MD_CTX;
|
||||
typedef struct ASN1_BIT_STRING ASN1_BIT_STRING;
|
||||
typedef struct ASN1_INTEGER ASN1_INTEGER;
|
||||
typedef struct ASN1_OBJECT ASN1_OBJECT;
|
||||
typedef struct ASN1_OCTET_STRING ASN1_OCTET_STRING;
|
||||
typedef struct ASN1_TIME ASN1_TIME;
|
||||
typedef struct BN_CTX BN_CTX;
|
||||
typedef struct EC_GROUP EC_GROUP;
|
||||
typedef struct EC_KEY EC_KEY;
|
||||
typedef struct EC_POINT EC_POINT;
|
||||
typedef struct EVP_PKEY EVP_PKEY;
|
||||
typedef struct EVP_PKEY_CTX EVP_PKEY_CTX;
|
||||
typedef struct PKCS8_PRIV_KEY_INFO PKCS8_PRIV_KEY_INFO;
|
||||
typedef struct RSA RSA;
|
||||
typedef struct X509 X509;
|
||||
typedef struct X509_ALGOR X509_ALGOR;
|
||||
typedef struct X509_EXTENSION X509_EXTENSION;
|
||||
typedef struct X509_NAME X509_NAME;
|
||||
typedef struct BIGNUM BIGNUM;
|
||||
typedef struct HMAC_CTX HMAC_CTX;
|
||||
typedef struct rsa_meth_st RSA_METHOD;
|
||||
typedef struct ecdsa_method_st ECDSA_METHOD;
|
||||
typedef struct BN_GENCB BN_GENCB;
|
||||
typedef struct sha256_state_st SHA256_CTX;
|
||||
typedef struct sha_state_st SHA_CTX;
|
||||
typedef struct cbb_st CBB;
|
||||
typedef struct ecdsa_sig_st ECDSA_SIG;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OPENSSL_MBEDTLS_WRAPPER_BASE_H */
|
||||
42
crypto/openssl_mbedtls_wrapper/include/openssl/bio.h
Normal file
42
crypto/openssl_mbedtls_wrapper/include/openssl/bio.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/include/openssl/bio.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_BIO_H
|
||||
#define OPENSSL_MBEDTLS_WRAPPER_BIO_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/base.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OPENSSL_MBEDTLS_WRAPPER_BIO_H */
|
||||
76
crypto/openssl_mbedtls_wrapper/include/openssl/bn.h
Normal file
76
crypto/openssl_mbedtls_wrapper/include/openssl/bn.h
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/include/openssl/bn.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_BN_H
|
||||
#define OPENSSL_MBEDTLS_WRAPPER_BN_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/asn1.h>
|
||||
#include <openssl/base.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define BN_ULONG uint32_t
|
||||
#define BN_BITS2 32
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
typedef uint32_t BN_ULONG;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
BN_CTX *BN_CTX_new(void);
|
||||
void BN_CTX_free(BN_CTX *a);
|
||||
void BN_free(BIGNUM *a);
|
||||
|
||||
BN_ULONG BN_get_word(const BIGNUM *bn);
|
||||
|
||||
unsigned BN_num_bits(const BIGNUM *bn);
|
||||
|
||||
BIGNUM *BN_new(void);
|
||||
|
||||
int BN_bn2binpad(const BIGNUM *in, uint8_t *out, int len);
|
||||
|
||||
int BN_set_word(BIGNUM *bn, BN_ULONG value);
|
||||
|
||||
BIGNUM *BN_dup(const BIGNUM *src);
|
||||
|
||||
BIGNUM *BN_bin2bn(const uint8_t *in, size_t len, BIGNUM *ret);
|
||||
|
||||
int BN_one(BIGNUM *bn);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OPENSSL_MBEDTLS_WRAPPER_BN_H */
|
||||
114
crypto/openssl_mbedtls_wrapper/include/openssl/bytestring.h
Normal file
114
crypto/openssl_mbedtls_wrapper/include/openssl/bytestring.h
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/include/openssl/bytestring.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_BYTESTRING_H
|
||||
#define OPENSSL_MBEDTLS_WRAPPER_BYTESTRING_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/base.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
struct cbb_buffer_st
|
||||
{
|
||||
uint8_t * buf;
|
||||
|
||||
/* len is the number of valid bytes in |buf|. */
|
||||
|
||||
size_t len;
|
||||
|
||||
/* cap is the size of |buf|. */
|
||||
|
||||
size_t cap;
|
||||
|
||||
/* can_resize is one iff |buf| is owned by this object. If not then |buf|
|
||||
* cannot be resized.
|
||||
*/
|
||||
|
||||
unsigned can_resize : 1;
|
||||
|
||||
/* error is one if there was an error writing to this CBB. All future
|
||||
* operations will fail.
|
||||
*/
|
||||
|
||||
unsigned error : 1;
|
||||
};
|
||||
|
||||
struct cbb_child_st
|
||||
{
|
||||
/* base is a pointer to the buffer this |CBB| writes to. */
|
||||
|
||||
struct cbb_buffer_st * base;
|
||||
|
||||
/* offset is the number of bytes from the start of
|
||||
* |base->buf| to this |CBB|'s
|
||||
* pending length prefix.
|
||||
*/
|
||||
|
||||
size_t offset;
|
||||
|
||||
/* pending_len_len contains the number of bytes in this |CBB|'s pending
|
||||
* length-prefix, or zero if no length-prefix is pending.
|
||||
*/
|
||||
|
||||
uint8_t pending_len_len;
|
||||
unsigned pending_is_asn1 : 1;
|
||||
};
|
||||
|
||||
struct cbb_st
|
||||
{
|
||||
/* child points to a child CBB if a length-prefix is pending.
|
||||
* CBB* child;
|
||||
* is_child is one if this is a child |CBB| and zero if it is a top-level
|
||||
* |CBB|. This determines which arm of the union is valid.
|
||||
*/
|
||||
|
||||
char is_child;
|
||||
union
|
||||
{
|
||||
struct cbb_buffer_st base;
|
||||
struct cbb_child_st child;
|
||||
} u;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
int CBB_init(CBB *cbb, size_t initial_capacity);
|
||||
|
||||
int CBB_finish(CBB *cbb, uint8_t **out_data, size_t *out_len);
|
||||
|
||||
void CBB_cleanup(CBB *cbb);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OPENSSL_MBEDTLS_WRAPPER_BYTESTRING_H */
|
||||
108
crypto/openssl_mbedtls_wrapper/include/openssl/cipher.h
Normal file
108
crypto/openssl_mbedtls_wrapper/include/openssl/cipher.h
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/include/openssl/cipher.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_CIPER_H
|
||||
#define OPENSSL_MBEDTLS_WRAPPER_CIPER_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/base.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define CIPHER_R_BAD_DECRYPT 101
|
||||
#define EVP_CTRL_GCM_GET_TAG 0x10
|
||||
#define EVP_CTRL_GCM_SET_TAG 0x11
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx);
|
||||
int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *ctx);
|
||||
|
||||
const EVP_CIPHER *EVP_aes_128_ecb(void);
|
||||
const EVP_CIPHER *EVP_aes_192_ecb(void);
|
||||
const EVP_CIPHER *EVP_aes_256_ecb(void);
|
||||
const EVP_CIPHER *EVP_aes_128_cbc(void);
|
||||
const EVP_CIPHER *EVP_aes_192_cbc(void);
|
||||
const EVP_CIPHER *EVP_aes_256_cbc(void);
|
||||
const EVP_CIPHER *EVP_aes_128_ctr(void);
|
||||
const EVP_CIPHER *EVP_aes_192_ctr(void);
|
||||
const EVP_CIPHER *EVP_aes_256_ctr(void);
|
||||
const EVP_CIPHER *EVP_aes_128_gcm(void);
|
||||
const EVP_CIPHER *EVP_aes_192_gcm(void);
|
||||
const EVP_CIPHER *EVP_aes_256_gcm(void);
|
||||
|
||||
const EVP_CIPHER *EVP_des_ede(void);
|
||||
const EVP_CIPHER *EVP_des_ede3(void);
|
||||
const EVP_CIPHER *EVP_des_ede_cbc(void);
|
||||
const EVP_CIPHER *EVP_des_ede3_cbc(void);
|
||||
|
||||
int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr);
|
||||
int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad);
|
||||
int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
|
||||
ENGINE *impl, const unsigned char *key,
|
||||
const unsigned char *iv, int enc);
|
||||
int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
|
||||
int *outl, const unsigned char *in,
|
||||
int inl);
|
||||
int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm,
|
||||
int *outl);
|
||||
|
||||
int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx);
|
||||
|
||||
EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void);
|
||||
|
||||
void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx);
|
||||
|
||||
int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
|
||||
ENGINE *impl, const uint8_t *key,
|
||||
const uint8_t *iv);
|
||||
|
||||
int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
|
||||
ENGINE *impl, const uint8_t *key,
|
||||
const uint8_t *iv);
|
||||
|
||||
int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, uint8_t *out,
|
||||
int *out_len, const uint8_t *in,
|
||||
int in_len);
|
||||
|
||||
int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, uint8_t *out, int *out_len);
|
||||
|
||||
int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, uint8_t *out,
|
||||
int *out_len, const uint8_t *in,
|
||||
int in_len);
|
||||
|
||||
int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, uint8_t *out, int *out_len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OPENSSL_MBEDTLS_WRAPPER_CIPER_H */
|
||||
77
crypto/openssl_mbedtls_wrapper/include/openssl/curve25519.h
Normal file
77
crypto/openssl_mbedtls_wrapper/include/openssl/curve25519.h
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/include/openssl/curve25519.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_CURVE25519_H
|
||||
#define OPENSSL_MBEDTLS_WRAPPER_CURVE25519_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/base.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define X25519_PRIVATE_KEY_LEN 32
|
||||
#define X25519_PUBLIC_VALUE_LEN 32
|
||||
#define X25519_SHARED_KEY_LEN 32
|
||||
#define ED25519_PRIVATE_KEY_LEN 64
|
||||
#define ED25519_PUBLIC_KEY_LEN 32
|
||||
#define ED25519_SIGNATURE_LEN 64
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/* ED25519_keypair sets |out_public_key| and |out_private_key| to a freshly
|
||||
* generated, public–private key pair.
|
||||
*/
|
||||
|
||||
void ED25519_keypair(uint8_t out_public_key[32],
|
||||
uint8_t out_private_key[64]);
|
||||
|
||||
void X25519_keypair(uint8_t out_public_value[32],
|
||||
uint8_t out_private_key[32]);
|
||||
|
||||
int X25519(uint8_t out_shared_key[32], const uint8_t private_key[32],
|
||||
const uint8_t peer_public_value[32]);
|
||||
|
||||
int ED25519_sign(uint8_t out_sig[64], const uint8_t *message,
|
||||
size_t message_len, const uint8_t private_key[64]);
|
||||
|
||||
int ED25519_verify(const uint8_t *message, size_t message_len,
|
||||
const uint8_t signature[64],
|
||||
const uint8_t public_key[32]);
|
||||
|
||||
void ED25519_keypair_from_seed(uint8_t out_public_key[32],
|
||||
uint8_t out_private_key[64],
|
||||
const uint8_t seed[32]);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OPENSSL_MBEDTLS_WRAPPER_CURVE25519_H */
|
||||
42
crypto/openssl_mbedtls_wrapper/include/openssl/des.h
Normal file
42
crypto/openssl_mbedtls_wrapper/include/openssl/des.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/include/openssl/des.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_DES_H
|
||||
#define OPENSSL_MBEDTLS_WRAPPER_DES_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/base.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OPENSSL_MBEDTLS_WRAPPER_DES_H */
|
||||
103
crypto/openssl_mbedtls_wrapper/include/openssl/digest.h
Normal file
103
crypto/openssl_mbedtls_wrapper/include/openssl/digest.h
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/include/openssl/digest.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 KEYMASTER_DIGEST_H
|
||||
#define KEYMASTER_DIGEST_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/base.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define EVP_MAX_MD_SIZE 64 // SHA-512 is the longest so far.
|
||||
#define EVP_MAX_MD_BLOCK_SIZE 128 // SHA-512 is the longest so far.
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
const EVP_MD *EVP_md4(void);
|
||||
const EVP_MD *EVP_md5(void);
|
||||
const EVP_MD *EVP_sha1(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_sha512_256(void);
|
||||
const EVP_MD *EVP_blake2b256(void);
|
||||
|
||||
const EVP_MD *EVP_md5_sha1(void);
|
||||
|
||||
const EVP_MD *EVP_get_digestbynid(int nid);
|
||||
|
||||
const EVP_MD *EVP_get_digestbyobj(const ASN1_OBJECT *obj);
|
||||
|
||||
void EVP_MD_CTX_init(EVP_MD_CTX *ctx);
|
||||
|
||||
EVP_MD_CTX *EVP_MD_CTX_new(void);
|
||||
|
||||
int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx);
|
||||
|
||||
void EVP_MD_CTX_cleanse(EVP_MD_CTX *ctx);
|
||||
|
||||
void EVP_MD_CTX_free(EVP_MD_CTX *ctx);
|
||||
|
||||
int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in);
|
||||
|
||||
void EVP_MD_CTX_move(EVP_MD_CTX *out, EVP_MD_CTX *in);
|
||||
|
||||
int EVP_MD_CTX_reset(EVP_MD_CTX *ctx);
|
||||
|
||||
/* Digest operations. */
|
||||
|
||||
int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type,
|
||||
ENGINE *engine);
|
||||
|
||||
int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type);
|
||||
|
||||
int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *data, size_t len);
|
||||
|
||||
int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, uint8_t *md_out,
|
||||
unsigned int *out_size);
|
||||
|
||||
int EVP_DigestFinal(EVP_MD_CTX *ctx, uint8_t *md_out,
|
||||
unsigned int *out_size);
|
||||
|
||||
int EVP_Digest(const void *data, size_t len,
|
||||
uint8_t *md_out, unsigned int *md_out_size,
|
||||
const EVP_MD *type, ENGINE *impl);
|
||||
|
||||
size_t EVP_MD_size(const EVP_MD *md);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* KEYMASTER_DIGEST_H */
|
||||
|
||||
112
crypto/openssl_mbedtls_wrapper/include/openssl/ec.h
Normal file
112
crypto/openssl_mbedtls_wrapper/include/openssl/ec.h
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/include/openssl/ec.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_EC_H
|
||||
#define OPENSSL_MBEDTLS_WRAPPER_EC_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/base.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define OPENSSL_EC_NAMED_CURVE 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/* point_conversion_form_t enumerates forms, as defined in X9.62 (ECDSA), for
|
||||
* the encoding of a elliptic curve point (x,y)
|
||||
*/
|
||||
|
||||
typedef enum
|
||||
{
|
||||
/* POINT_CONVERSION_COMPRESSED indicates that the point is encoded as z||x,
|
||||
* where the octet z specifies which solution of the quadratic equation y
|
||||
* is.
|
||||
*/
|
||||
|
||||
POINT_CONVERSION_COMPRESSED = 2,
|
||||
|
||||
/* POINT_CONVERSION_UNCOMPRESSED indicates that the point is encoded as
|
||||
* z||x||y, where z is the octet 0x04.
|
||||
*/
|
||||
|
||||
POINT_CONVERSION_UNCOMPRESSED = 4,
|
||||
|
||||
/* POINT_CONVERSION_HYBRID indicates that the point is encoded as z||x||y,
|
||||
* where z specifies which solution of the quadratic equation y is. This is
|
||||
* not supported by the code and has never been observed in use.
|
||||
*
|
||||
* TODO(agl): remove once node.js no longer references this.
|
||||
*/
|
||||
|
||||
POINT_CONVERSION_HYBRID = 6,
|
||||
} point_conversion_form_t;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
void EC_GROUP_free(EC_GROUP *a);
|
||||
|
||||
void EC_KEY_free(EC_KEY *a);
|
||||
|
||||
void EC_POINT_free(EC_POINT *a);
|
||||
|
||||
int EC_GROUP_get_curve_name(const EC_GROUP *group);
|
||||
|
||||
EC_GROUP *EC_GROUP_new_by_curve_name(int nid);
|
||||
|
||||
int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx);
|
||||
|
||||
int EC_POINT_get_affine_coordinates_GFp(const EC_GROUP *group,
|
||||
const EC_POINT *point, BIGNUM *x,
|
||||
BIGNUM *y, BN_CTX *ctx);
|
||||
|
||||
/* EC_GROUP_set_point_conversion_form aborts the process if |form| is not
|
||||
* |POINT_CONVERSION_UNCOMPRESSED| and otherwise does nothing.
|
||||
*/
|
||||
|
||||
void EC_GROUP_set_point_conversion_form(EC_GROUP *group,
|
||||
point_conversion_form_t form);
|
||||
|
||||
void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag);
|
||||
|
||||
EC_POINT *EC_POINT_new(const EC_GROUP *group);
|
||||
|
||||
int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *point,
|
||||
const uint8_t *buf, size_t len,
|
||||
BN_CTX *ctx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OPENSSL_MBEDTLS_WRAPPER_EC_H */
|
||||
108
crypto/openssl_mbedtls_wrapper/include/openssl/ec_key.h
Normal file
108
crypto/openssl_mbedtls_wrapper/include/openssl/ec_key.h
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/include/openssl/ec_key.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_EC_KEY_H
|
||||
#define OPENSSL_MBEDTLS_WRAPPER_EC_KEY_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/base.h>
|
||||
#include <openssl/engine.h>
|
||||
#include <openssl/ex_data.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define ECDSA_FLAG_OPAQUE 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
struct ecdsa_method_st
|
||||
{
|
||||
struct openssl_method_common_st common;
|
||||
|
||||
void *app_data;
|
||||
|
||||
int (*init)(EC_KEY *key);
|
||||
int (*finish)(EC_KEY *key);
|
||||
|
||||
/* group_order_size returns the number of bytes needed to
|
||||
* represent the order of the group. This is used to
|
||||
* calculate the maximum size of an ECDSA signature
|
||||
* in |ECDSA_size|.
|
||||
*/
|
||||
|
||||
size_t (*group_order_size)(const EC_KEY *key);
|
||||
|
||||
/* sign matches the arguments and behaviour of |ECDSA_sign|. */
|
||||
|
||||
int (*sign)(const uint8_t *digest, size_t digest_len, uint8_t *sig,
|
||||
unsigned int *sig_len, EC_KEY *eckey);
|
||||
|
||||
int flags;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
EC_KEY *EC_KEY_new(void);
|
||||
|
||||
const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key);
|
||||
|
||||
const EC_POINT *EC_KEY_get0_public_key(const EC_KEY *key);
|
||||
|
||||
int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group);
|
||||
|
||||
int EC_KEY_generate_key(EC_KEY *key);
|
||||
|
||||
int EC_KEY_check_key(const EC_KEY *key);
|
||||
|
||||
int EC_KEY_get_ex_new_index(long argl, void *argp,
|
||||
CRYPTO_EX_unused *unused,
|
||||
CRYPTO_EX_dup *dup_unused,
|
||||
CRYPTO_EX_free *free_func);
|
||||
|
||||
EC_KEY *EC_KEY_new_method(const ENGINE *engine);
|
||||
|
||||
int EC_KEY_set_ex_data(EC_KEY *r, int idx, void *arg);
|
||||
|
||||
void *EC_KEY_get_ex_data(const EC_KEY *r, int idx);
|
||||
|
||||
int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub);
|
||||
|
||||
EC_KEY *EC_KEY_new_by_curve_name(int nid);
|
||||
|
||||
int EC_KEY_set_private_key(EC_KEY *key, const BIGNUM *priv);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OPENSSL_MBEDTLS_WRAPPER_EC_KEY_H */
|
||||
81
crypto/openssl_mbedtls_wrapper/include/openssl/ecdsa.h
Normal file
81
crypto/openssl_mbedtls_wrapper/include/openssl/ecdsa.h
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/include/openssl/ecdsa.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_ECDSA_H
|
||||
#define OPENSSL_MBEDTLS_WRAPPER_ECDSA_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/base.h>
|
||||
#include <openssl/ec_key.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
struct ecdsa_sig_st
|
||||
{
|
||||
BIGNUM *r;
|
||||
BIGNUM *s;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
size_t ECDSA_size(const EC_KEY *key);
|
||||
|
||||
int ECDSA_sign(int type, const uint8_t *digest, size_t digest_len,
|
||||
uint8_t *sig, unsigned int *sig_len,
|
||||
const EC_KEY *key);
|
||||
|
||||
int ECDSA_verify(int type, const uint8_t *digest,
|
||||
size_t digest_len, const uint8_t *sig,
|
||||
size_t sig_len, const EC_KEY *key);
|
||||
|
||||
int i2d_ECDSA_SIG(const ECDSA_SIG *sig, uint8_t **outp);
|
||||
|
||||
ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **out, const uint8_t **inp, long len);
|
||||
|
||||
const BIGNUM *ECDSA_SIG_get0_r(const ECDSA_SIG *sig);
|
||||
|
||||
const BIGNUM *ECDSA_SIG_get0_s(const ECDSA_SIG *sig);
|
||||
|
||||
ECDSA_SIG *ECDSA_SIG_new(void);
|
||||
|
||||
void ECDSA_SIG_free(ECDSA_SIG *sig);
|
||||
|
||||
ECDSA_SIG *ECDSA_do_sign(const uint8_t *digest, size_t digest_len,
|
||||
const EC_KEY *key);
|
||||
|
||||
int ECDSA_do_verify(const uint8_t *digest, size_t digest_len,
|
||||
const ECDSA_SIG *sig, const EC_KEY *key);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OPENSSL_MBEDTLS_WRAPPER_ECDSA_H */
|
||||
62
crypto/openssl_mbedtls_wrapper/include/openssl/engine.h
Normal file
62
crypto/openssl_mbedtls_wrapper/include/openssl/engine.h
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/include/openssl/engine.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_ENGINE_H
|
||||
#define OPENSSL_MBEDTLS_WRAPPER_ENGINE_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/base.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
struct openssl_method_common_st
|
||||
{
|
||||
int references; /* dummy – not used. */
|
||||
char is_static;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
ENGINE *ENGINE_new(void);
|
||||
|
||||
void ENGINE_free(ENGINE *a);
|
||||
|
||||
int ENGINE_set_RSA_method(ENGINE *engine, const RSA_METHOD *method,
|
||||
size_t method_size);
|
||||
|
||||
int ENGINE_set_ECDSA_method(ENGINE *engine, const ECDSA_METHOD *method,
|
||||
size_t method_size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OPENSSL_MBEDTLS_WRAPPER_ENGINE_H */
|
||||
53
crypto/openssl_mbedtls_wrapper/include/openssl/err.h
Normal file
53
crypto/openssl_mbedtls_wrapper/include/openssl/err.h
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/include/openssl/err.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_ERR_H
|
||||
#define OPENSSL_MBEDTLS_WRAPPER_ERR_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define ERR_GET_LIB(l) (int)(((l) >> 24L) & 0x0FFL)
|
||||
#define ERR_GET_REASON(l) (int)((l)&0xFFFL)
|
||||
#define ERR_LIB_CIPHER 30
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
unsigned long ERR_peek_last_error(void);
|
||||
void ERR_error_string_n(unsigned long e, char *buf, size_t len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OPENSSL_MBEDTLS_WRAPPER_ERR_H */
|
||||
160
crypto/openssl_mbedtls_wrapper/include/openssl/evp.h
Normal file
160
crypto/openssl_mbedtls_wrapper/include/openssl/evp.h
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/include/openssl/evp.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_EVP_H
|
||||
#define OPENSSL_MBEDTLS_WRAPPER_EVP_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/base.h>
|
||||
#include <openssl/cipher.h>
|
||||
#include <openssl/digest.h>
|
||||
#include <openssl/ec_key.h>
|
||||
#include <openssl/mem.h>
|
||||
#include <openssl/nid.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define EVP_PKEY_RSA NID_rsaEncryption
|
||||
#define EVP_PKEY_EC NID_X9_62_id_ecPublicKey
|
||||
#define EVP_PKEY_ED25519 NID_ED25519
|
||||
|
||||
#define EVP_PKEY_X25519 NID_X25519
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
int EVP_PKEY_id(const EVP_PKEY *pkey);
|
||||
|
||||
RSA *EVP_PKEY_get1_RSA(const EVP_PKEY *pkey);
|
||||
|
||||
int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, RSA *key);
|
||||
|
||||
EVP_PKEY *EVP_PKEY_new(void);
|
||||
|
||||
void EVP_PKEY_free(EVP_PKEY *pkey);
|
||||
|
||||
void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx);
|
||||
|
||||
EC_KEY *EVP_PKEY_get0_EC_KEY(const EVP_PKEY *pkey);
|
||||
|
||||
EC_KEY *EVP_PKEY_get1_EC_KEY(const EVP_PKEY *pkey);
|
||||
|
||||
int EVP_PKEY_type(int nid);
|
||||
|
||||
EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **out,
|
||||
const uint8_t **inp, long len);
|
||||
|
||||
int i2d_PUBKEY(const EVP_PKEY *pkey, uint8_t **outp);
|
||||
|
||||
EVP_PKEY *EVP_PKEY_new_raw_private_key(int type, ENGINE *unused,
|
||||
const uint8_t *in, size_t len);
|
||||
|
||||
int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, EC_KEY *key);
|
||||
|
||||
int EVP_PKEY_bits(const EVP_PKEY *pkey);
|
||||
|
||||
int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
|
||||
const EVP_MD *type, ENGINE *e,
|
||||
EVP_PKEY *pkey);
|
||||
|
||||
int EVP_DigestSignUpdate(EVP_MD_CTX *ctx, const void *data, size_t len);
|
||||
|
||||
int EVP_DigestSignFinal(EVP_MD_CTX *ctx, uint8_t *out_sig,
|
||||
size_t *out_sig_len);
|
||||
|
||||
int EVP_DigestSign(EVP_MD_CTX *ctx, uint8_t *out_sig,
|
||||
size_t *out_sig_len, const uint8_t *data,
|
||||
size_t data_len);
|
||||
|
||||
int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
|
||||
const EVP_MD *type, ENGINE *e,
|
||||
EVP_PKEY *pkey);
|
||||
|
||||
int EVP_DigestVerifyUpdate(EVP_MD_CTX *ctx, const void *data,
|
||||
size_t len);
|
||||
|
||||
int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const uint8_t *sig,
|
||||
size_t sig_len);
|
||||
|
||||
EVP_PKEY *d2i_PUBKEY(EVP_PKEY **out, const uint8_t **inp,
|
||||
long len);
|
||||
|
||||
int EVP_PKEY_size(const EVP_PKEY *pkey);
|
||||
|
||||
int EVP_PKEY_CTX_set_rsa_padding(EVP_PKEY_CTX *ctx, int padding);
|
||||
|
||||
int EVP_PKEY_CTX_set_rsa_pss_saltlen(EVP_PKEY_CTX *ctx, int salt_len);
|
||||
|
||||
int EVP_PKEY_CTX_set_rsa_oaep_md(EVP_PKEY_CTX *ctx, const EVP_MD *md);
|
||||
|
||||
int EVP_PKEY_CTX_set_rsa_mgf1_md(EVP_PKEY_CTX *ctx, const EVP_MD *md);
|
||||
|
||||
EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e);
|
||||
|
||||
int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx);
|
||||
|
||||
int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx, uint8_t *out,
|
||||
size_t *out_len, const uint8_t *in,
|
||||
size_t in_len);
|
||||
|
||||
int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx);
|
||||
|
||||
int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx, uint8_t *out,
|
||||
size_t *out_len, const uint8_t *in,
|
||||
size_t in_len);
|
||||
|
||||
int i2d_PrivateKey(const EVP_PKEY *key, uint8_t **outp);
|
||||
|
||||
EVP_PKEY *X509_get_pubkey(X509 *x509);
|
||||
|
||||
int EVP_marshal_private_key(CBB *cbb, const EVP_PKEY *key);
|
||||
|
||||
int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx);
|
||||
|
||||
int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer);
|
||||
|
||||
int EVP_PKEY_get_raw_private_key(const EVP_PKEY *pkey, uint8_t *out,
|
||||
size_t *out_len);
|
||||
|
||||
int EVP_PKEY_get_raw_public_key(const EVP_PKEY *pkey, uint8_t *out,
|
||||
size_t *out_len);
|
||||
|
||||
int EVP_PKEY_derive(EVP_PKEY_CTX *ctx, uint8_t *key, size_t *out_key_len);
|
||||
|
||||
int PKCS5_PBKDF2_HMAC(const char *password, size_t password_len,
|
||||
const uint8_t *salt, size_t salt_len,
|
||||
unsigned iterations, const EVP_MD *digest,
|
||||
size_t key_len, uint8_t *out_key);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OPENSSL_MBEDTLS_WRAPPER_EVP_H */
|
||||
57
crypto/openssl_mbedtls_wrapper/include/openssl/ex_data.h
Normal file
57
crypto/openssl_mbedtls_wrapper/include/openssl/ex_data.h
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/include/openssl/ex_data.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_EX_DATA_H
|
||||
#define OPENSSL_MBEDTLS_WRAPPER_EX_DATA_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/base.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
typedef int CRYPTO_EX_unused;
|
||||
typedef struct CRYPTO_EX_DATA CRYPTO_EX_DATA;
|
||||
|
||||
typedef int CRYPTO_EX_dup(CRYPTO_EX_DATA *to, const CRYPTO_EX_DATA *from,
|
||||
void **from_d, int index,
|
||||
long argl, void *argp);
|
||||
|
||||
typedef void CRYPTO_EX_free(void *parent, void *ptr,
|
||||
CRYPTO_EX_DATA *ad, int index,
|
||||
long argl, void *argp);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OPENSSL_MBEDTLS_WRAPPER_EX_DATA_H */
|
||||
73
crypto/openssl_mbedtls_wrapper/include/openssl/hkdf.h
Normal file
73
crypto/openssl_mbedtls_wrapper/include/openssl/hkdf.h
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/include/openssl/hkdf.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_HKDF_H
|
||||
#define OPENSSL_MBEDTLS_WRAPPER_HKDF_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/base.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
int HKDF(uint8_t *out_key, size_t out_len,
|
||||
const EVP_MD *digest, const uint8_t *secret,
|
||||
size_t secret_len, const uint8_t *salt,
|
||||
size_t salt_len, const uint8_t *info,
|
||||
size_t info_len);
|
||||
|
||||
/* HKDF_extract computes a HKDF PRK (as specified by RFC 5869) from initial
|
||||
* keying material |secret| and salt |salt| using |digest|, and outputs
|
||||
* |out_len| bytes to |out_key|. The maximum output size is
|
||||
* |EVP_MAX_MD_SIZE|. It returns one on success and zero on error.
|
||||
*
|
||||
* WARNING: This function orders the inputs differently from RFC 5869
|
||||
* specification. Double-check which parameter is the secret/IKM and which is
|
||||
* the salt when using.
|
||||
*/
|
||||
|
||||
int HKDF_extract(uint8_t *out_key, size_t *out_len,
|
||||
const EVP_MD *digest, const uint8_t *secret,
|
||||
size_t secret_len, const uint8_t *salt,
|
||||
size_t salt_len);
|
||||
|
||||
/* HKDF_expand computes a HKDF OKM (as specified by RFC 5869) of length
|
||||
* |out_len| from the PRK |prk| and info |info| using |digest|, and outputs
|
||||
* the result to |out_key|. It returns one on success and zero on error.
|
||||
*/
|
||||
|
||||
int HKDF_expand(uint8_t *out_key, size_t out_len,
|
||||
const EVP_MD *digest, const uint8_t *prk,
|
||||
size_t prk_len, const uint8_t *info,
|
||||
size_t info_len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OPENSSL_MBEDTLS_WRAPPER_HKDF_H */
|
||||
72
crypto/openssl_mbedtls_wrapper/include/openssl/hmac.h
Normal file
72
crypto/openssl_mbedtls_wrapper/include/openssl/hmac.h
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/include/openssl/hmac.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_HMAC_H
|
||||
#define OPENSSL_MBEDTLS_WRAPPER_HMAC_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/base.h>
|
||||
#include <openssl/digest.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/* HMAC calculates the HMAC of |data_len| bytes of |data|, using the given
|
||||
* key and hash function, and writes the result to |out|. On entry, |out|
|
||||
* must contain at least |EVP_MD_size| bytes of space. The actual length
|
||||
* of the result is written to |*out_len|. An output size of
|
||||
* |EVP_MAX_MD_SIZE| will always be large enough. It returns |out|
|
||||
* or NULL on error.
|
||||
*/
|
||||
|
||||
uint8_t *HMAC(const EVP_MD *evp_md, const void *key,
|
||||
size_t key_len, const uint8_t *data, size_t data_len,
|
||||
uint8_t *out, unsigned int *out_len);
|
||||
|
||||
HMAC_CTX *HMAC_CTX_new(void);
|
||||
|
||||
void HMAC_CTX_init(HMAC_CTX *ctx);
|
||||
|
||||
int HMAC_Init_ex(HMAC_CTX *ctx, const void *key,
|
||||
size_t key_len, const EVP_MD *md,
|
||||
ENGINE *impl);
|
||||
|
||||
int HMAC_Update(HMAC_CTX *ctx, const uint8_t *data, size_t data_len);
|
||||
|
||||
int HMAC_Final(HMAC_CTX *ctx, uint8_t *out, unsigned int *out_len);
|
||||
|
||||
void HMAC_CTX_cleanup(HMAC_CTX *ctx);
|
||||
|
||||
void HMAC_CTX_free(HMAC_CTX *ctx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OPENSSL_MBEDTLS_WRAPPER_HMAC_H */
|
||||
|
||||
53
crypto/openssl_mbedtls_wrapper/include/openssl/md5.h
Normal file
53
crypto/openssl_mbedtls_wrapper/include/openssl/md5.h
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/include/openssl/md5.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_MD5_H
|
||||
#define OPENSSL_MBEDTLS_WRAPPER_MD5_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/base.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* MD5_DIGEST_LENGTH is the length of an MD5 digest. */
|
||||
|
||||
#define MD5_DIGEST_LENGTH 16
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t *MD5(const uint8_t *data, size_t len,
|
||||
uint8_t out[MD5_DIGEST_LENGTH]);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OPENSSL_MBEDTLS_WRAPPER_MD5_H */
|
||||
54
crypto/openssl_mbedtls_wrapper/include/openssl/mem.h
Normal file
54
crypto/openssl_mbedtls_wrapper/include/openssl/mem.h
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/include/openssl/mem.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_MEM_H
|
||||
#define OPENSSL_MBEDTLS_WRAPPER_MEM_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/base.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/* 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 void *a, const void *b, size_t len);
|
||||
|
||||
void OPENSSL_free(void *ptr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OPENSSL_MBEDTLS_WRAPPER_MEM_H */
|
||||
58
crypto/openssl_mbedtls_wrapper/include/openssl/nid.h
Normal file
58
crypto/openssl_mbedtls_wrapper/include/openssl/nid.h
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/include/openssl/nid.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_NID_H
|
||||
#define OPENSSL_MBEDTLS_WRAPPER_NID_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/base.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define NID_rsaEncryption 6
|
||||
#define NID_commonName 13
|
||||
#define NID_key_usage 83
|
||||
#define NID_X9_62_id_ecPublicKey 408
|
||||
#define NID_X9_62_prime256v1 415
|
||||
#define NID_sha256WithRSAEncryption 668
|
||||
#define NID_secp224r1 713
|
||||
#define NID_secp384r1 715
|
||||
#define NID_secp521r1 716
|
||||
#define NID_X25519 948
|
||||
#define NID_ED25519 949
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OPENSSL_MBEDTLS_WRAPPER_NID_H */
|
||||
45
crypto/openssl_mbedtls_wrapper/include/openssl/obj.h
Normal file
45
crypto/openssl_mbedtls_wrapper/include/openssl/obj.h
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/include/openssl/obj.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_OBJ_H
|
||||
#define OPENSSL_MBEDTLS_WRAPPER_OBJ_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/base.h>
|
||||
#include <openssl/nid.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
ASN1_OBJECT *OBJ_nid2obj(int nid);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OPENSSL_MBEDTLS_WRAPPER_OBJ_H */
|
||||
42
crypto/openssl_mbedtls_wrapper/include/openssl/pem.h
Normal file
42
crypto/openssl_mbedtls_wrapper/include/openssl/pem.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/include/openssl/pem.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_PEM_H
|
||||
#define OPENSSL_MBEDTLS_WRAPPER_PEM_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/base.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OPENSSL_MBEDTLS_WRAPPER_PEM_H */
|
||||
40
crypto/openssl_mbedtls_wrapper/include/openssl/rand.h
Normal file
40
crypto/openssl_mbedtls_wrapper/include/openssl/rand.h
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/include/openssl/rand.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_RAND_H
|
||||
#define OPENSSL_MBEDTLS_WRAPPER_RAND_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
int RAND_bytes(unsigned char *buf, int num);
|
||||
|
||||
void RAND_add(const void *buf, int num, double randomness);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OPENSSL_MBEDTLS_WRAPPER_RAND_H */
|
||||
140
crypto/openssl_mbedtls_wrapper/include/openssl/rsa.h
Normal file
140
crypto/openssl_mbedtls_wrapper/include/openssl/rsa.h
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/include/openssl/rsa.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_RSA_H
|
||||
#define OPENSSL_MBEDTLS_WRAPPER_RSA_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/base.h>
|
||||
#include <openssl/engine.h>
|
||||
#include <openssl/ex_data.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
#define RSA_PKCS1_PADDING 1
|
||||
#define RSA_FLAG_OPAQUE 1
|
||||
#define RSA_NO_PADDING 3
|
||||
#define RSA_PKCS1_OAEP_PADDING 4
|
||||
#define RSA_PKCS1_PSS_PADDING 6
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
struct rsa_meth_st
|
||||
{
|
||||
struct openssl_method_common_st common;
|
||||
|
||||
void *app_data;
|
||||
|
||||
int (*init)(RSA *rsa);
|
||||
int (*finish)(RSA *rsa);
|
||||
|
||||
/* size returns the size of the RSA modulus in bytes. */
|
||||
|
||||
size_t (*size)(const RSA *rsa);
|
||||
|
||||
int (*sign)(int type, const uint8_t *m,
|
||||
unsigned int m_length, uint8_t *sigret,
|
||||
unsigned int *siglen, const RSA *rsa);
|
||||
|
||||
/* These functions mirror the |RSA_*| functions of the same name. */
|
||||
|
||||
int (*sign_raw)(RSA *rsa, size_t *out_len,
|
||||
uint8_t *out, size_t max_out,
|
||||
const uint8_t *in, size_t in_len,
|
||||
int padding);
|
||||
int (*decrypt)(RSA *rsa, size_t *out_len,
|
||||
uint8_t *out, size_t max_out,
|
||||
const uint8_t *in, size_t in_len,
|
||||
int padding);
|
||||
|
||||
/* private_transform takes a big-endian integer from |in|, calculates the
|
||||
* d'th power of it, modulo the RSA modulus and writes the result as a
|
||||
* big-endian integer to |out|. Both |in| and |out| are |len| bytes long
|
||||
* and |len| is always equal to |RSA_size(rsa)|. If the result of
|
||||
* the transform can be represented in fewer than |len| bytes,
|
||||
* then |out| must be zero padded on the left.
|
||||
*
|
||||
* It returns one on success and zero otherwise.
|
||||
*
|
||||
* RSA decrypt and sign operations will call this,
|
||||
* thus an ENGINE might wish
|
||||
* to override it in order to avoid having to implement the padding
|
||||
* functionality demanded by those, higher level, operations.
|
||||
*/
|
||||
|
||||
int (*private_transform)(RSA *rsa, uint8_t *out,
|
||||
const uint8_t *in, size_t len);
|
||||
|
||||
int flags;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
RSA *RSA_new(void);
|
||||
|
||||
void RSA_free(RSA *a);
|
||||
|
||||
unsigned RSA_size(const RSA *rsa);
|
||||
|
||||
const BIGNUM *RSA_get0_e(const RSA *rsa);
|
||||
|
||||
const BIGNUM *RSA_get0_n(const RSA *rsa);
|
||||
|
||||
int RSA_generate_key_ex(RSA *rsa, int bits,
|
||||
const BIGNUM *e, BN_GENCB *cb);
|
||||
|
||||
int RSA_get_ex_new_index(long argl, void *argp,
|
||||
CRYPTO_EX_unused *unused,
|
||||
CRYPTO_EX_dup *dup_unused,
|
||||
CRYPTO_EX_free *free_func);
|
||||
|
||||
RSA *RSA_new_method(const ENGINE *engine);
|
||||
|
||||
int RSA_set_ex_data(RSA *rsa, int idx, void *arg);
|
||||
|
||||
void *RSA_get_ex_data(const RSA *rsa, int idx);
|
||||
|
||||
int RSA_set0_key(RSA *rsa, BIGNUM *n, BIGNUM *e, BIGNUM *d);
|
||||
|
||||
int RSA_private_encrypt(size_t flen, const uint8_t *from,
|
||||
uint8_t *to, RSA *rsa, int padding);
|
||||
|
||||
int RSA_public_decrypt(size_t flen, const uint8_t *from,
|
||||
uint8_t *to, RSA *rsa, int padding);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OPENSSL_MBEDTLS_WRAPPER_RSA_H */
|
||||
|
||||
129
crypto/openssl_mbedtls_wrapper/include/openssl/sha.h
Normal file
129
crypto/openssl_mbedtls_wrapper/include/openssl/sha.h
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/include/openssl/sha.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_SHA_H
|
||||
#define OPENSSL_MBEDTLS_WRAPPER_SHA_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/base.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* SHA256_DIGEST_LENGTH is the length of a SHA-256 digest */
|
||||
|
||||
#define SHA256_DIGEST_LENGTH 32
|
||||
|
||||
/* SHA_CBLOCK is the block size of SHA-1. */
|
||||
|
||||
#define SHA_CBLOCK 64
|
||||
|
||||
/* SHA_DIGEST_LENGTH is the length of a SHA-1 digest. */
|
||||
|
||||
#define SHA_DIGEST_LENGTH 20
|
||||
|
||||
#define SHA256_CBLOCK 64
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
struct sha_state_st
|
||||
{
|
||||
/* wpa_supplicant accesses |h0|..|h4| so we must support those names
|
||||
* for compatibility with it until it can be updated.
|
||||
*/
|
||||
|
||||
union
|
||||
{
|
||||
uint32_t h[5];
|
||||
struct
|
||||
{
|
||||
uint32_t h0;
|
||||
uint32_t h1;
|
||||
uint32_t h2;
|
||||
uint32_t h3;
|
||||
uint32_t h4;
|
||||
};
|
||||
};
|
||||
uint32_t Nl;
|
||||
uint32_t Nh;
|
||||
uint8_t data[SHA_CBLOCK];
|
||||
unsigned num;
|
||||
};
|
||||
|
||||
struct sha256_state_st
|
||||
{
|
||||
uint32_t h[8];
|
||||
uint32_t Nl;
|
||||
uint32_t Nh;
|
||||
uint8_t data[SHA256_CBLOCK];
|
||||
unsigned num;
|
||||
unsigned md_len;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/* SHA1_Init initialises |sha| and returns one. */
|
||||
|
||||
int SHA1_Init(SHA_CTX *sha);
|
||||
|
||||
/* SHA1_Update adds |len| bytes from |data| to |sha| and returns one. */
|
||||
|
||||
int SHA1_Update(SHA_CTX *sha, const void *data, size_t len);
|
||||
|
||||
/* SHA1_Final adds the final padding to |sha| and writes the
|
||||
* resulting digest to |out|, which must have at least
|
||||
* |SHA_DIGEST_LENGTH| bytes of space. It returns one.
|
||||
*/
|
||||
|
||||
int SHA1_Final(uint8_t out[SHA_DIGEST_LENGTH], SHA_CTX *sha);
|
||||
|
||||
/* SHA1 writes the digest of |len| bytes from |data| to |out| and returns
|
||||
* |out|. There must be at least |SHA_DIGEST_LENGTH| bytes of space in
|
||||
* |out|.
|
||||
*/
|
||||
|
||||
uint8_t *SHA1(const uint8_t *data, size_t len,
|
||||
uint8_t out[SHA_DIGEST_LENGTH]);
|
||||
|
||||
void SHA1_Transform(SHA_CTX *sha, const uint8_t block[SHA_CBLOCK]);
|
||||
|
||||
int SHA256_Init(SHA256_CTX *sha);
|
||||
|
||||
int SHA256_Update(SHA256_CTX *sha, const void *data, size_t len);
|
||||
|
||||
int SHA256_Final(uint8_t out[SHA256_DIGEST_LENGTH], SHA256_CTX *sha);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OPENSSL_MBEDTLS_WRAPPER_SHA_H */
|
||||
42
crypto/openssl_mbedtls_wrapper/include/openssl/stack.h
Normal file
42
crypto/openssl_mbedtls_wrapper/include/openssl/stack.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/include/openssl/stack.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_STACK_H
|
||||
#define OPENSSL_MBEDTLS_WRAPPER_STACK_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/base.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OPENSSL_MBEDTLS_WRAPPER_STACK_H */
|
||||
110
crypto/openssl_mbedtls_wrapper/include/openssl/x509.h
Normal file
110
crypto/openssl_mbedtls_wrapper/include/openssl/x509.h
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/include/openssl/x509.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_X509_H
|
||||
#define OPENSSL_MBEDTLS_WRAPPER_X509_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/base.h>
|
||||
#include <openssl/bytestring.h>
|
||||
#include <openssl/ecdsa.h>
|
||||
#include <openssl/obj.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
void PKCS8_PRIV_KEY_INFO_free(PKCS8_PRIV_KEY_INFO *key);
|
||||
|
||||
X509 *X509_new(void);
|
||||
|
||||
void X509_free(X509 *a);
|
||||
|
||||
void X509_ALGOR_free(X509_ALGOR *a);
|
||||
|
||||
void X509_EXTENSION_free(X509_EXTENSION *a);
|
||||
|
||||
void X509_NAME_free(X509_NAME *a);
|
||||
|
||||
EVP_PKEY *EVP_PKCS82PKEY(const PKCS8_PRIV_KEY_INFO *p8);
|
||||
|
||||
X509_ALGOR *X509_ALGOR_new(void);
|
||||
|
||||
int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *obj,
|
||||
int param_type, void *param_value);
|
||||
|
||||
int X509_set1_signature_algo(X509 *x509, const X509_ALGOR *algo);
|
||||
|
||||
int X509_set1_signature_value(X509 *x509, const uint8_t *sig,
|
||||
size_t sig_len);
|
||||
|
||||
X509_NAME *X509_NAME_new(void);
|
||||
|
||||
int X509_NAME_get_text_by_NID(const X509_NAME *name, int nid,
|
||||
char *buf, int len);
|
||||
|
||||
int X509_set_issuer_name(X509 *x509, X509_NAME *name);
|
||||
|
||||
int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field,
|
||||
int type, const uint8_t *bytes,
|
||||
int len, int loc, int set);
|
||||
|
||||
X509_NAME *d2i_X509_NAME(X509_NAME **out, const uint8_t **inp, long len);
|
||||
|
||||
X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex,
|
||||
int nid, int crit,
|
||||
const ASN1_OCTET_STRING *data);
|
||||
|
||||
int X509_set_version(X509 *x509, long version);
|
||||
|
||||
int X509_set_serialNumber(X509 *x509, const ASN1_INTEGER *serial);
|
||||
|
||||
int X509_set_subject_name(X509 *x509, X509_NAME *name);
|
||||
|
||||
int X509_set_notBefore(X509 *x509, const ASN1_TIME *tm);
|
||||
|
||||
int X509_set_notAfter(X509 *x509, const ASN1_TIME *tm);
|
||||
|
||||
int X509_set_pubkey(X509 *x509, EVP_PKEY *pkey);
|
||||
|
||||
int X509_add_ext(X509 *x, const X509_EXTENSION *ex, int loc);
|
||||
|
||||
int X509_sign(X509 *x509, EVP_PKEY *pkey, const EVP_MD *md);
|
||||
|
||||
int i2d_X509(X509 *x509, uint8_t **outp);
|
||||
|
||||
PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO(PKCS8_PRIV_KEY_INFO *info,
|
||||
const uint8_t **key_data,
|
||||
size_t key_length);
|
||||
|
||||
X509 *d2i_X509(X509 **out, const uint8_t **inp, long len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OPENSSL_MBEDTLS_WRAPPER_X509_H */
|
||||
42
crypto/openssl_mbedtls_wrapper/include/openssl/x509v3.h
Normal file
42
crypto/openssl_mbedtls_wrapper/include/openssl/x509v3.h
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/include/openssl/x509v3.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_X509V3_H
|
||||
#define OPENSSL_MBEDTLS_WRAPPER_X509V3_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/x509.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OPENSSL_MBEDTLS_WRAPPER_X509V3_H */
|
||||
208
crypto/openssl_mbedtls_wrapper/mbedtls/aes.c
Normal file
208
crypto/openssl_mbedtls_wrapper/mbedtls/aes.c
Normal file
|
|
@ -0,0 +1,208 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/mbedtls/aes.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <mbedtls/cipher.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
void EVP_CIPHER_CTX_init(EVP_CIPHER_CTX *ctx)
|
||||
{
|
||||
mbedtls_cipher_init((mbedtls_cipher_context_t *)ctx);
|
||||
}
|
||||
|
||||
int EVP_CIPHER_CTX_cleanup(EVP_CIPHER_CTX *ctx)
|
||||
{
|
||||
mbedtls_cipher_free((mbedtls_cipher_context_t *)ctx);
|
||||
return 1;
|
||||
}
|
||||
|
||||
const EVP_CIPHER *EVP_aes_128_ecb(void)
|
||||
{
|
||||
return (const EVP_CIPHER *)mbedtls_cipher_info_from_type(
|
||||
MBEDTLS_CIPHER_AES_128_ECB);
|
||||
}
|
||||
|
||||
const EVP_CIPHER *EVP_aes_192_ecb(void)
|
||||
{
|
||||
return (const EVP_CIPHER *)mbedtls_cipher_info_from_type(
|
||||
MBEDTLS_CIPHER_AES_192_ECB);
|
||||
}
|
||||
|
||||
const EVP_CIPHER *EVP_aes_256_ecb(void)
|
||||
{
|
||||
return (const EVP_CIPHER *)mbedtls_cipher_info_from_type(
|
||||
MBEDTLS_CIPHER_AES_256_ECB);
|
||||
}
|
||||
|
||||
const EVP_CIPHER *EVP_aes_128_cbc(void)
|
||||
{
|
||||
return (const EVP_CIPHER *)mbedtls_cipher_info_from_type(
|
||||
MBEDTLS_CIPHER_AES_128_CBC);
|
||||
}
|
||||
|
||||
const EVP_CIPHER *EVP_aes_192_cbc(void)
|
||||
{
|
||||
return (const EVP_CIPHER *)mbedtls_cipher_info_from_type(
|
||||
MBEDTLS_CIPHER_AES_192_CBC);
|
||||
}
|
||||
|
||||
const EVP_CIPHER *EVP_aes_256_cbc(void)
|
||||
{
|
||||
return (const EVP_CIPHER *)mbedtls_cipher_info_from_type(
|
||||
MBEDTLS_CIPHER_AES_256_CBC);
|
||||
}
|
||||
|
||||
const EVP_CIPHER *EVP_aes_128_ctr(void)
|
||||
{
|
||||
return (const EVP_CIPHER *)mbedtls_cipher_info_from_type(
|
||||
MBEDTLS_CIPHER_AES_128_CTR);
|
||||
}
|
||||
|
||||
const EVP_CIPHER *EVP_aes_192_ctr(void)
|
||||
{
|
||||
return (const EVP_CIPHER *)mbedtls_cipher_info_from_type(
|
||||
MBEDTLS_CIPHER_AES_192_CTR);
|
||||
}
|
||||
|
||||
const EVP_CIPHER *EVP_aes_256_ctr(void)
|
||||
{
|
||||
return (const EVP_CIPHER *)mbedtls_cipher_info_from_type(
|
||||
MBEDTLS_CIPHER_AES_256_CTR);
|
||||
}
|
||||
|
||||
const EVP_CIPHER *EVP_aes_128_gcm(void)
|
||||
{
|
||||
return (const EVP_CIPHER *)mbedtls_cipher_info_from_type(
|
||||
MBEDTLS_CIPHER_AES_128_GCM);
|
||||
}
|
||||
|
||||
const EVP_CIPHER *EVP_aes_192_gcm(void)
|
||||
{
|
||||
return (const EVP_CIPHER *)mbedtls_cipher_info_from_type(
|
||||
MBEDTLS_CIPHER_AES_192_GCM);
|
||||
}
|
||||
|
||||
const EVP_CIPHER *EVP_aes_256_gcm(void)
|
||||
{
|
||||
return (const EVP_CIPHER *)mbedtls_cipher_info_from_type(
|
||||
MBEDTLS_CIPHER_AES_256_GCM);
|
||||
}
|
||||
|
||||
int EVP_CIPHER_CTX_set_padding(EVP_CIPHER_CTX *c, int pad)
|
||||
{
|
||||
mbedtls_cipher_padding_t padding = MBEDTLS_PADDING_PKCS7;
|
||||
if (pad == 0)
|
||||
{
|
||||
padding = MBEDTLS_PADDING_NONE;
|
||||
}
|
||||
|
||||
mbedtls_cipher_set_padding_mode((mbedtls_cipher_context_t *)c, padding);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
|
||||
ENGINE *impl, const unsigned char *key,
|
||||
const unsigned char *iv, int enc)
|
||||
{
|
||||
mbedtls_cipher_context_t *ctx_ = (mbedtls_cipher_context_t *)ctx;
|
||||
mbedtls_cipher_set_padding_mode(ctx_, MBEDTLS_PADDING_PKCS7);
|
||||
const mbedtls_operation_t operation = enc
|
||||
? MBEDTLS_ENCRYPT : MBEDTLS_DECRYPT;
|
||||
int ret = mbedtls_cipher_setup(ctx_,
|
||||
(mbedtls_cipher_info_t *)cipher);
|
||||
if (ret != 0)
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
|
||||
ret = mbedtls_cipher_setkey(ctx_, key,
|
||||
mbedtls_cipher_get_key_bitlen(ctx_),
|
||||
operation);
|
||||
if (ret != 0)
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
|
||||
ret = mbedtls_cipher_set_iv(ctx_, iv,
|
||||
mbedtls_cipher_get_iv_size(ctx_));
|
||||
if (ret != 0)
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
|
||||
return 1;
|
||||
error:
|
||||
errno = ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
|
||||
const unsigned char *in, int inl)
|
||||
{
|
||||
size_t out_len = 0;
|
||||
int ret = mbedtls_cipher_update((mbedtls_cipher_context_t *)ctx,
|
||||
in, inl, out, &out_len);
|
||||
if (ret != 0)
|
||||
{
|
||||
errno = ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
*outl = out_len;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int EVP_CipherFinal_ex(EVP_CIPHER_CTX *ctx,
|
||||
unsigned char *outm, int *outl)
|
||||
{
|
||||
size_t out_len = 0;
|
||||
int ret = mbedtls_cipher_finish((mbedtls_cipher_context_t *)ctx,
|
||||
outm, &out_len);
|
||||
if (ret != 0)
|
||||
{
|
||||
errno = ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
*outl = out_len;
|
||||
return 1;
|
||||
}
|
||||
|
||||
EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void)
|
||||
{
|
||||
return (EVP_CIPHER_CTX *)(malloc(sizeof(mbedtls_cipher_context_t)));
|
||||
}
|
||||
|
||||
void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx)
|
||||
{
|
||||
if (ctx == NULL)
|
||||
return;
|
||||
|
||||
free(ctx);
|
||||
}
|
||||
91
crypto/openssl_mbedtls_wrapper/mbedtls/asn1.c
Normal file
91
crypto/openssl_mbedtls_wrapper/mbedtls/asn1.c
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/mbedtls/asn1.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/asn1.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
void ASN1_TIME_free(ASN1_TIME *a)
|
||||
{
|
||||
}
|
||||
|
||||
void ASN1_INTEGER_free(ASN1_INTEGER *a)
|
||||
{
|
||||
}
|
||||
|
||||
void ASN1_OCTET_STRING_free(ASN1_OCTET_STRING *a)
|
||||
{
|
||||
}
|
||||
|
||||
void ASN1_BIT_STRING_free(ASN1_BIT_STRING *a)
|
||||
{
|
||||
}
|
||||
|
||||
ASN1_TIME *ASN1_TIME_new(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *str, int n, int value)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int i2d_ASN1_BIT_STRING(const ASN1_BIT_STRING *in, uint8_t **outp)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
ASN1_OCTET_STRING *ASN1_OCTET_STRING_new(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str,
|
||||
const unsigned char *data, int len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
ASN1_INTEGER *ASN1_INTEGER_new(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ASN1_BIT_STRING *ASN1_BIT_STRING_new(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
39
crypto/openssl_mbedtls_wrapper/mbedtls/bn.c
Normal file
39
crypto/openssl_mbedtls_wrapper/mbedtls/bn.c
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/mbedtls/bn.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/bn.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
BIGNUM *BN_bin2bn(const uint8_t *in, size_t len, BIGNUM *ret)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int BN_one(BIGNUM *bn)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
43
crypto/openssl_mbedtls_wrapper/mbedtls/bytestring.c
Normal file
43
crypto/openssl_mbedtls_wrapper/mbedtls/bytestring.c
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/mbedtls/bytestring.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/bytestring.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int CBB_finish(CBB *cbb, uint8_t **out_data, size_t *out_len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CBB_cleanup(CBB *cbb)
|
||||
{
|
||||
}
|
||||
|
||||
int CBB_init(CBB *cbb, size_t initial_capacity)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
172
crypto/openssl_mbedtls_wrapper/mbedtls/cipher.c
Normal file
172
crypto/openssl_mbedtls_wrapper/mbedtls/cipher.c
Normal file
|
|
@ -0,0 +1,172 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/mbedtls/cipher.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/aes.h>
|
||||
#include <openssl/cipher.h>
|
||||
|
||||
#include <mbedtls/aes.h>
|
||||
#include <mbedtls/cipher.h>
|
||||
#include <mbedtls/cmac.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER * cipher,
|
||||
ENGINE *impl, const uint8_t *key, const uint8_t *iv)
|
||||
{
|
||||
mbedtls_cipher_context_t *m_ctx = (mbedtls_cipher_context_t *)ctx;
|
||||
mbedtls_cipher_init(m_ctx);
|
||||
mbedtls_cipher_setup(m_ctx, (const mbedtls_cipher_info_t *)cipher);
|
||||
mbedtls_cipher_setkey(m_ctx, key, m_ctx->cipher_info->key_bitlen,
|
||||
MBEDTLS_DECRYPT);
|
||||
mbedtls_cipher_set_iv(m_ctx, iv, m_ctx->cipher_info->iv_size);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, uint8_t *out, int *out_len,
|
||||
const uint8_t *in, int in_len)
|
||||
{
|
||||
size_t len = 0;
|
||||
int ret = mbedtls_cipher_update((mbedtls_cipher_context_t *)ctx,
|
||||
in, in_len, out, &len);
|
||||
*out_len = len;
|
||||
return !ret;
|
||||
}
|
||||
|
||||
int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, uint8_t *out, int *out_len)
|
||||
{
|
||||
size_t len = 0;
|
||||
int ret = mbedtls_cipher_finish((mbedtls_cipher_context_t *)ctx,
|
||||
out, &len);
|
||||
*out_len = len;
|
||||
return !ret;
|
||||
}
|
||||
|
||||
const EVP_CIPHER *EVP_des_ede(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const EVP_CIPHER *EVP_des_ede3(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const EVP_CIPHER *EVP_des_ede_cbc(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const EVP_CIPHER *EVP_des_ede3_cbc(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *type,
|
||||
ENGINE *impl, const unsigned char *key,
|
||||
const unsigned char *iv)
|
||||
{
|
||||
mbedtls_cipher_context_t *m_ctx = (mbedtls_cipher_context_t *)ctx;
|
||||
mbedtls_cipher_init(m_ctx);
|
||||
if (mbedtls_cipher_setup(m_ctx, (const mbedtls_cipher_info_t *)type) != 0)
|
||||
{
|
||||
mbedtls_cipher_free(m_ctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (mbedtls_cipher_setkey(m_ctx, key,
|
||||
m_ctx->cipher_info->key_bitlen,
|
||||
MBEDTLS_ENCRYPT) != 0)
|
||||
{
|
||||
mbedtls_cipher_free(m_ctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (mbedtls_cipher_set_iv(m_ctx, iv, m_ctx->cipher_info->iv_size) != 0)
|
||||
{
|
||||
mbedtls_cipher_free(m_ctx);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int EVP_EncryptUpdate(EVP_CIPHER_CTX * ctx, uint8_t *out, int *out_len,
|
||||
const uint8_t *in, int in_len)
|
||||
{
|
||||
return !mbedtls_cipher_update((mbedtls_cipher_context_t *)ctx,
|
||||
in, in_len, out, (size_t *)out_len);
|
||||
}
|
||||
|
||||
int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx,
|
||||
unsigned char *out, int *out_len)
|
||||
{
|
||||
return !mbedtls_cipher_finish((mbedtls_cipher_context_t *)ctx, out,
|
||||
(size_t *)out_len);
|
||||
}
|
||||
|
||||
void AES_cbc_encrypt(const uint8_t *in, uint8_t *out, size_t len,
|
||||
const AES_KEY *key, uint8_t *ivec, const int enc)
|
||||
{
|
||||
const mbedtls_aes_context *ctx = (const mbedtls_aes_context *)key;
|
||||
mbedtls_aes_crypt_cbc((mbedtls_aes_context *)ctx, enc, len, ivec, in, out);
|
||||
}
|
||||
|
||||
int EVP_CIPHER_CTX_ctrl(EVP_CIPHER_CTX *ctx, int command,
|
||||
int tag_len, void *tag)
|
||||
{
|
||||
mbedtls_cipher_context_t *m_ctx = (mbedtls_cipher_context_t *)ctx;
|
||||
int ret = 0;
|
||||
if (command == EVP_CTRL_GCM_GET_TAG)
|
||||
{
|
||||
ret = mbedtls_cipher_write_tag(m_ctx, (unsigned char *)tag, tag_len);
|
||||
}
|
||||
else if (command == EVP_CTRL_GCM_SET_TAG)
|
||||
{
|
||||
ret = mbedtls_cipher_check_tag(m_ctx,
|
||||
(const unsigned char *)tag,
|
||||
tag_len);
|
||||
}
|
||||
|
||||
return !ret;
|
||||
}
|
||||
|
||||
int AES_set_encrypt_key(const uint8_t *key, unsigned bits, AES_KEY *aeskey)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int AES_set_decrypt_key(const uint8_t *key, unsigned bits, AES_KEY *aeskey)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
void AES_encrypt(const uint8_t *in, uint8_t *out, const AES_KEY *key)
|
||||
{
|
||||
}
|
||||
|
||||
void AES_decrypt(const uint8_t *in, uint8_t *out, const AES_KEY *key)
|
||||
{
|
||||
}
|
||||
52
crypto/openssl_mbedtls_wrapper/mbedtls/curve25519.c
Normal file
52
crypto/openssl_mbedtls_wrapper/mbedtls/curve25519.c
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/mbedtls/curve25519.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/curve25519.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
void ED25519_keypair(uint8_t out_public_key[32],
|
||||
uint8_t out_private_key[64])
|
||||
{
|
||||
}
|
||||
|
||||
void X25519_keypair(uint8_t out_public_value[32],
|
||||
uint8_t out_private_key[32])
|
||||
{
|
||||
}
|
||||
|
||||
int X25519(uint8_t out_shared_key[32],
|
||||
const uint8_t private_key[32],
|
||||
const uint8_t peer_public_value[32])
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ED25519_keypair_from_seed(uint8_t out_public_key[32],
|
||||
uint8_t out_private_key[64],
|
||||
const uint8_t seed[32])
|
||||
{
|
||||
}
|
||||
104
crypto/openssl_mbedtls_wrapper/mbedtls/digest.c
Normal file
104
crypto/openssl_mbedtls_wrapper/mbedtls/digest.c
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/mbedtls/digest.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <mbedtls/md.h>
|
||||
#include <openssl/digest.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
EVP_MD_CTX *EVP_MD_CTX_new(void)
|
||||
{
|
||||
mbedtls_md_context_t *ctx =
|
||||
(mbedtls_md_context_t *)malloc(sizeof(mbedtls_md_context_t));
|
||||
EVP_MD_CTX_init((EVP_MD_CTX *)ctx);
|
||||
return (EVP_MD_CTX *)ctx;
|
||||
}
|
||||
|
||||
void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
|
||||
{
|
||||
if (ctx != NULL)
|
||||
{
|
||||
EVP_MD_CTX_cleanup(ctx);
|
||||
free(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
const EVP_MD *EVP_md5(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *engine)
|
||||
{
|
||||
mbedtls_md_context_t *m_ctx = (mbedtls_md_context_t *)ctx;
|
||||
if (mbedtls_md_setup(m_ctx, (const mbedtls_md_info_t *)type, 0) != 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (mbedtls_md_starts(m_ctx) != 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *data, size_t len)
|
||||
{
|
||||
if (mbedtls_md_update((mbedtls_md_context_t *)ctx,
|
||||
(const unsigned char *)data, len) != 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int EVP_DigestFinal_ex(EVP_MD_CTX *ctx, uint8_t *md_out,
|
||||
unsigned int *size)
|
||||
{
|
||||
const mbedtls_md_info_t *md_info = ((mbedtls_md_context_t *)ctx)->md_info;
|
||||
if (md_info == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
*size = mbedtls_md_get_size(md_info);
|
||||
if (mbedtls_md_finish((mbedtls_md_context_t *)ctx, md_out) != 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx)
|
||||
{
|
||||
mbedtls_md_free((mbedtls_md_context_t *)ctx);
|
||||
return 1;
|
||||
}
|
||||
47
crypto/openssl_mbedtls_wrapper/mbedtls/ec.c
Normal file
47
crypto/openssl_mbedtls_wrapper/mbedtls/ec.c
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/mbedtls/ec.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/ec.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
void EC_KEY_free(EC_KEY *a)
|
||||
{
|
||||
}
|
||||
|
||||
EC_GROUP *EC_GROUP_new_by_curve_name(int nid)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void EC_GROUP_free(EC_GROUP *a)
|
||||
{
|
||||
}
|
||||
|
||||
int EC_GROUP_get_curve_name(const EC_GROUP *group)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
34
crypto/openssl_mbedtls_wrapper/mbedtls/ec_key.c
Normal file
34
crypto/openssl_mbedtls_wrapper/mbedtls/ec_key.c
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/mbedtls/ec_key.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/ec_key.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int EC_KEY_check_key(const EC_KEY *key)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
46
crypto/openssl_mbedtls_wrapper/mbedtls/ecdsa.c
Normal file
46
crypto/openssl_mbedtls_wrapper/mbedtls/ecdsa.c
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/mbedtls/ecdsa.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/ecdsa.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
size_t ECDSA_size(const EC_KEY *key)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ECDSA_sign(int type, const uint8_t *digest, size_t digest_len,
|
||||
uint8_t *sig, unsigned int *sig_len, const EC_KEY *key)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ECDSA_verify(int type, const uint8_t *digest, size_t digest_len,
|
||||
const uint8_t *sig, size_t sig_len, const EC_KEY *key)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
33
crypto/openssl_mbedtls_wrapper/mbedtls/engine.c
Normal file
33
crypto/openssl_mbedtls_wrapper/mbedtls/engine.c
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/mbedtls/engine.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/engine.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
void ENGINE_free(ENGINE *a)
|
||||
{
|
||||
}
|
||||
42
crypto/openssl_mbedtls_wrapper/mbedtls/err.c
Normal file
42
crypto/openssl_mbedtls_wrapper/mbedtls/err.c
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/mbedtls/err.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/err.h>
|
||||
#include <mbedtls/error.h>
|
||||
#include <mbedtls/cipher.h>
|
||||
#include <errno.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
unsigned long ERR_peek_last_error()
|
||||
{
|
||||
return errno;
|
||||
}
|
||||
|
||||
void ERR_error_string_n(unsigned long e, char *buf, size_t len)
|
||||
{
|
||||
mbedtls_strerror(e, buf, len);
|
||||
}
|
||||
296
crypto/openssl_mbedtls_wrapper/mbedtls/evp.c
Normal file
296
crypto/openssl_mbedtls_wrapper/mbedtls/evp.c
Normal file
|
|
@ -0,0 +1,296 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/mbedtls/evp.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/bn.h>
|
||||
#include <openssl/cipher.h>
|
||||
#include <openssl/ec.h>
|
||||
#include <openssl/evp.h>
|
||||
|
||||
#include <mbedtls/md.h>
|
||||
#include <mbedtls/pk.h>
|
||||
#include <mbedtls/rsa.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int EVP_PKEY_id(const EVP_PKEY *pkey)
|
||||
{
|
||||
const mbedtls_pk_context *mbedtls_pkey = (const mbedtls_pk_context *)pkey;
|
||||
return mbedtls_pk_get_type(mbedtls_pkey);
|
||||
}
|
||||
|
||||
RSA *EVP_PKEY_get1_RSA(const EVP_PKEY *pkey)
|
||||
{
|
||||
mbedtls_pk_context *mbedtls_pkey = (mbedtls_pk_context *)pkey;
|
||||
if (pkey == NULL || mbedtls_pk_get_type(mbedtls_pkey) != MBEDTLS_PK_RSA)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mbedtls_rsa_context *rsa = mbedtls_pk_rsa(* mbedtls_pkey);
|
||||
return (RSA *)rsa;
|
||||
}
|
||||
|
||||
void EVP_PKEY_free(EVP_PKEY *pkey)
|
||||
{
|
||||
}
|
||||
|
||||
int EVP_PKEY_type(int nid)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
EC_KEY *EVP_PKEY_get1_EC_KEY(const EVP_PKEY *pkey)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EVP_PKEY *EVP_PKEY_new(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, RSA *key)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void EVP_MD_CTX_init(EVP_MD_CTX *ctx)
|
||||
{
|
||||
mbedtls_md_init((mbedtls_md_context_t *)ctx);
|
||||
}
|
||||
|
||||
EVP_PKEY *EVP_PKEY_new_raw_private_key(int type, ENGINE *unused,
|
||||
const uint8_t *in, size_t len)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EC_KEY *EC_KEY_new(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void EC_GROUP_set_point_conversion_form(EC_GROUP *group,
|
||||
point_conversion_form_t form)
|
||||
{
|
||||
}
|
||||
|
||||
void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag)
|
||||
{
|
||||
}
|
||||
|
||||
int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int EC_KEY_generate_key(EC_KEY *key)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
BIGNUM *BN_new(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void BN_free(BIGNUM *bn)
|
||||
{
|
||||
}
|
||||
|
||||
int BN_set_word(BIGNUM *bn, BN_ULONG value)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
BN_ULONG BN_get_word(const BIGNUM *bn)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int EVP_DigestVerifyFinal(EVP_MD_CTX *ctx, const uint8_t *sig,
|
||||
size_t sig_len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int EVP_DigestVerifyUpdate(EVP_MD_CTX *ctx, const void *data, size_t len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int EVP_DigestVerifyInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
|
||||
const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int EVP_DigestSignFinal(EVP_MD_CTX *ctx, uint8_t *out_sig,
|
||||
size_t *out_sig_len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int i2d_PUBKEY(const EVP_PKEY *pkey, uint8_t **outp)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **out,
|
||||
const uint8_t **inp, long len)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, EC_KEY *key)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int EVP_PKEY_bits(const EVP_PKEY *pkey)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int EVP_DigestSignInit(EVP_MD_CTX *ctx, EVP_PKEY_CTX **pctx,
|
||||
const EVP_MD *type, ENGINE *e, EVP_PKEY *pkey)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int EVP_DigestSignUpdate(EVP_MD_CTX *ctx, const void *data, size_t len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int EVP_marshal_private_key(CBB *cbb, const EVP_PKEY *key)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int EVP_DigestSign(EVP_MD_CTX *ctx, uint8_t *out_sig, size_t *out_sig_len,
|
||||
const uint8_t *data, size_t data_len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int EVP_PKEY_size(const EVP_PKEY *pkey)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int EVP_PKEY_CTX_set_rsa_oaep_md(EVP_PKEY_CTX *ctx, const EVP_MD *md)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int EVP_PKEY_CTX_set_rsa_padding(EVP_PKEY_CTX *ctx, int padding)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int EVP_PKEY_CTX_set_rsa_pss_saltlen(EVP_PKEY_CTX *ctx, int salt_len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int EVP_PKEY_CTX_set_rsa_mgf1_md(EVP_PKEY_CTX *ctx, const EVP_MD *md)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int EVP_PKEY_encrypt_init(EVP_PKEY_CTX *ctx)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int EVP_PKEY_encrypt(EVP_PKEY_CTX *ctx, uint8_t *out, size_t *out_len,
|
||||
const uint8_t *in, size_t in_len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int EVP_PKEY_decrypt_init(EVP_PKEY_CTX *ctx)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int EVP_PKEY_decrypt(EVP_PKEY_CTX *ctx, uint8_t *out, size_t *out_len,
|
||||
const uint8_t *in, size_t in_len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx)
|
||||
{
|
||||
}
|
||||
|
||||
int i2d_PrivateKey(const EVP_PKEY *key, uint8_t **outp)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int EVP_PKEY_derive(EVP_PKEY_CTX *ctx, uint8_t *key, size_t *out_key_len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int EVP_PKEY_get_raw_public_key(const EVP_PKEY *pkey,
|
||||
uint8_t *out, size_t *out_len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
EVP_PKEY *d2i_PUBKEY(EVP_PKEY **out, const uint8_t **inp, long len)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int EVP_PKEY_get_raw_private_key(const EVP_PKEY *pkey,
|
||||
uint8_t *out, size_t *out_len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
45
crypto/openssl_mbedtls_wrapper/mbedtls/hkdf.c
Normal file
45
crypto/openssl_mbedtls_wrapper/mbedtls/hkdf.c
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/mbedtls/hkdf.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/hkdf.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int HKDF_extract(uint8_t *out_key, size_t *out_len,
|
||||
const EVP_MD *digest, const uint8_t *secret,
|
||||
size_t secret_len, const uint8_t *salt,
|
||||
size_t salt_len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int HKDF_expand(uint8_t *out_key, size_t out_len,
|
||||
const EVP_MD *digest, const uint8_t *prk,
|
||||
size_t prk_len, const uint8_t *info,
|
||||
size_t info_len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
167
crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c
Normal file
167
crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c
Normal file
|
|
@ -0,0 +1,167 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/mbedtls/hmac.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <errno.h>
|
||||
#include <openssl/hmac.h>
|
||||
#include <mbedtls/hmac_drbg.h>
|
||||
#include <mbedtls/md.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t *HMAC(const EVP_MD *evp_md, const void *key,
|
||||
size_t key_len, const uint8_t *data,
|
||||
size_t data_len, uint8_t *out,
|
||||
unsigned int *out_len)
|
||||
{
|
||||
if (mbedtls_md_hmac((const mbedtls_md_info_t *)evp_md,
|
||||
(const unsigned char *)key, key_len, data, data_len,
|
||||
out) != 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (out_len != NULL)
|
||||
{
|
||||
*out_len = mbedtls_md_get_size((const mbedtls_md_info_t *)evp_md);
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
HMAC_CTX *HMAC_CTX_new(void)
|
||||
{
|
||||
mbedtls_md_context_t *ctx =
|
||||
(mbedtls_md_context_t *)malloc(sizeof(mbedtls_md_context_t));
|
||||
if (ctx != NULL)
|
||||
{
|
||||
mbedtls_md_init(ctx);
|
||||
}
|
||||
|
||||
return (HMAC_CTX *)ctx;
|
||||
}
|
||||
|
||||
void HMAC_CTX_init(HMAC_CTX *ctx)
|
||||
{
|
||||
mbedtls_md_init((mbedtls_md_context_t *)ctx);
|
||||
}
|
||||
|
||||
int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, size_t key_len,
|
||||
const EVP_MD *md, ENGINE *impl)
|
||||
{
|
||||
int ret = mbedtls_md_setup((mbedtls_md_context_t *)ctx,
|
||||
(const mbedtls_md_info_t *)md, 1);
|
||||
if (ret != 0)
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
|
||||
ret = mbedtls_md_hmac_starts((mbedtls_md_context_t *)ctx,
|
||||
(const unsigned char *)key, key_len);
|
||||
if (ret != 0)
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
|
||||
return 1;
|
||||
error:
|
||||
errno = ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int HMAC_Update(HMAC_CTX *ctx, const uint8_t *data, size_t data_len)
|
||||
{
|
||||
errno = mbedtls_md_hmac_update((mbedtls_md_context_t *)ctx,
|
||||
data, data_len);
|
||||
return !errno;
|
||||
}
|
||||
|
||||
int HMAC_Final(HMAC_CTX *ctx, uint8_t *out, unsigned int *out_len)
|
||||
{
|
||||
size_t md_size;
|
||||
|
||||
const mbedtls_md_info_t *md_info =
|
||||
((mbedtls_md_context_t *)(ctx))->md_info;
|
||||
if (md_info == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
md_size = mbedtls_md_get_size(md_info);
|
||||
*out_len = md_size;
|
||||
errno = mbedtls_md_hmac_finish((mbedtls_md_context_t *)ctx, out);
|
||||
return !errno;
|
||||
}
|
||||
|
||||
void HMAC_CTX_cleanup(HMAC_CTX *ctx)
|
||||
{
|
||||
mbedtls_md_free((mbedtls_md_context_t *)ctx);
|
||||
}
|
||||
|
||||
void HMAC_CTX_free(HMAC_CTX *ctx)
|
||||
{
|
||||
mbedtls_md_free((mbedtls_md_context_t *)ctx);
|
||||
free(ctx);
|
||||
}
|
||||
|
||||
size_t EVP_MD_size(const EVP_MD *md)
|
||||
{
|
||||
return mbedtls_md_get_size((const mbedtls_md_info_t *)md);
|
||||
}
|
||||
|
||||
const EVP_MD *EVP_sha1()
|
||||
{
|
||||
const mbedtls_md_info_t *md_info =
|
||||
mbedtls_md_info_from_type(MBEDTLS_MD_SHA1);
|
||||
return (const EVP_MD *)md_info;
|
||||
}
|
||||
|
||||
const EVP_MD *EVP_sha224()
|
||||
{
|
||||
const mbedtls_md_info_t *md_info =
|
||||
mbedtls_md_info_from_type(MBEDTLS_MD_SHA224);
|
||||
return (const EVP_MD *)md_info;
|
||||
}
|
||||
|
||||
const EVP_MD *EVP_sha256()
|
||||
{
|
||||
const mbedtls_md_info_t *md_info =
|
||||
mbedtls_md_info_from_type(MBEDTLS_MD_SHA256);
|
||||
return (const EVP_MD *)md_info;
|
||||
}
|
||||
|
||||
const EVP_MD *EVP_sha384()
|
||||
{
|
||||
const mbedtls_md_info_t *md_info =
|
||||
mbedtls_md_info_from_type(MBEDTLS_MD_SHA384);
|
||||
return (const EVP_MD *)md_info;
|
||||
}
|
||||
|
||||
const EVP_MD *EVP_sha512()
|
||||
{
|
||||
const mbedtls_md_info_t *md_info =
|
||||
mbedtls_md_info_from_type(MBEDTLS_MD_SHA512);
|
||||
return (const EVP_MD *)md_info;
|
||||
}
|
||||
41
crypto/openssl_mbedtls_wrapper/mbedtls/md5.c
Normal file
41
crypto/openssl_mbedtls_wrapper/mbedtls/md5.c
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/mbedtls/md5.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <mbedtls/md5.h>
|
||||
#include <openssl/md5.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
uint8_t *MD5(const uint8_t *data, size_t len,
|
||||
uint8_t out[MD5_DIGEST_LENGTH])
|
||||
{
|
||||
if (mbedtls_md5(data, len, out) != 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
39
crypto/openssl_mbedtls_wrapper/mbedtls/mem.c
Normal file
39
crypto/openssl_mbedtls_wrapper/mbedtls/mem.c
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/mbedtls/mem.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <mbedtls/constant_time.h>
|
||||
#include <openssl/mem.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int CRYPTO_memcmp(const void *in_a, const void *in_b, size_t len)
|
||||
{
|
||||
return mbedtls_ct_memcmp(in_a, in_b, len);
|
||||
}
|
||||
|
||||
void OPENSSL_free(void *ptr)
|
||||
{
|
||||
}
|
||||
34
crypto/openssl_mbedtls_wrapper/mbedtls/obj.c
Normal file
34
crypto/openssl_mbedtls_wrapper/mbedtls/obj.c
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/mbedtls/obj.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/obj.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
ASN1_OBJECT *OBJ_nid2obj(int nid)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
55
crypto/openssl_mbedtls_wrapper/mbedtls/pbkdf.c
Normal file
55
crypto/openssl_mbedtls_wrapper/mbedtls/pbkdf.c
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/mbedtls/pbkdf.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <errno.h>
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/hmac.h>
|
||||
#include <mbedtls/pkcs5.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int PKCS5_PBKDF2_HMAC(const char *password, size_t password_len,
|
||||
const uint8_t *salt, size_t salt_len,
|
||||
unsigned iterations, const EVP_MD *digest,
|
||||
size_t key_len, uint8_t *out_key)
|
||||
{
|
||||
mbedtls_md_context_t md_ctx;
|
||||
int generate_result = 0;
|
||||
int ret = 0;
|
||||
mbedtls_md_init(&md_ctx);
|
||||
ret = mbedtls_md_setup(&md_ctx, (const mbedtls_md_info_t *)digest, 1);
|
||||
if (ret == 0
|
||||
&& mbedtls_pkcs5_pbkdf2_hmac(&md_ctx,
|
||||
(const unsigned char *)password,
|
||||
password_len, salt, salt_len,
|
||||
iterations, key_len, out_key) == 0)
|
||||
{
|
||||
generate_result = 1;
|
||||
}
|
||||
|
||||
mbedtls_md_free(&md_ctx);
|
||||
return generate_result;
|
||||
}
|
||||
71
crypto/openssl_mbedtls_wrapper/mbedtls/rand.c
Normal file
71
crypto/openssl_mbedtls_wrapper/mbedtls/rand.c
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/mbedtls/rand.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <mbedtls/ctr_drbg.h>
|
||||
#include <mbedtls/entropy.h>
|
||||
#include <openssl/rand.h>
|
||||
#include <string.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/* RAND_bytes() generates num random bytes using a
|
||||
* cryptographically secure pseudo random generator
|
||||
* (CSPRNG) and stores them in buf.
|
||||
*
|
||||
* @param buf the buffer to contains the generated random data
|
||||
* @param num the length of the generated random data
|
||||
* @return return 1 on success, other value on failure
|
||||
*/
|
||||
|
||||
int RAND_bytes(unsigned char *buf, int num)
|
||||
{
|
||||
int ret;
|
||||
mbedtls_entropy_context entropy;
|
||||
mbedtls_ctr_drbg_context ctr_drbg;
|
||||
const char *keymaster_personalization =
|
||||
"softkeymaster_random_generator";
|
||||
mbedtls_entropy_init(&entropy);
|
||||
mbedtls_ctr_drbg_init(&ctr_drbg);
|
||||
|
||||
ret = mbedtls_ctr_drbg_seed(&ctr_drbg, mbedtls_entropy_func,
|
||||
&entropy, (const unsigned char *)keymaster_personalization,
|
||||
strlen(keymaster_personalization)) == 0
|
||||
&& mbedtls_ctr_drbg_random(&ctr_drbg, buf, num) == 0 ? 1 : 0;
|
||||
mbedtls_ctr_drbg_free(&ctr_drbg);
|
||||
mbedtls_entropy_free(&entropy);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* RAND_add method using to seed the random generator
|
||||
* This function also do nothing on android
|
||||
* https://github.com/google/boringssl/blob/
|
||||
* 94b477cea5057d9372984a311aba9276f737f748/
|
||||
* crypto/rand_extra/rand_extra.c#L39
|
||||
*/
|
||||
|
||||
void RAND_add(const void *buf, int num, double randomness)
|
||||
{
|
||||
}
|
||||
68
crypto/openssl_mbedtls_wrapper/mbedtls/rsa.c
Normal file
68
crypto/openssl_mbedtls_wrapper/mbedtls/rsa.c
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/mbedtls/rsa.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <mbedtls/rsa.h>
|
||||
#include <openssl/err.h>
|
||||
#include <openssl/rsa.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
unsigned RSA_size(const RSA *rsa)
|
||||
{
|
||||
return (mbedtls_rsa_get_len((const mbedtls_rsa_context *)rsa) + 7) / 8;
|
||||
}
|
||||
|
||||
const BIGNUM *RSA_get0_e(const RSA *rsa)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
RSA *RSA_new(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void RSA_free(RSA *rsa)
|
||||
{
|
||||
}
|
||||
|
||||
int RSA_generate_key_ex(RSA *rsa, int bits,
|
||||
const BIGNUM *e_value, BN_GENCB *cb)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int RSA_private_encrypt(size_t flen, const uint8_t *from,
|
||||
uint8_t *to, RSA *rsa, int padding)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int RSA_public_decrypt(size_t flen, const uint8_t *from,
|
||||
uint8_t *to, RSA *rsa, int padding)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
44
crypto/openssl_mbedtls_wrapper/mbedtls/sha.c
Normal file
44
crypto/openssl_mbedtls_wrapper/mbedtls/sha.c
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/mbedtls/sha.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/sha.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int SHA256_Init(SHA256_CTX *sha)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SHA256_Update(SHA256_CTX *sha, const void *data, size_t len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SHA256_Final(uint8_t out[SHA256_DIGEST_LENGTH], SHA256_CTX *sha)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
163
crypto/openssl_mbedtls_wrapper/mbedtls/x509.c
Normal file
163
crypto/openssl_mbedtls_wrapper/mbedtls/x509.c
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
/****************************************************************************
|
||||
* apps/crypto/openssl_mbedtls_wrapper/mbedtls/x509.c
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <openssl/x509.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
void X509_free(X509 *a)
|
||||
{
|
||||
}
|
||||
|
||||
void X509_EXTENSION_free(X509_EXTENSION *a)
|
||||
{
|
||||
}
|
||||
|
||||
int X509_set_notAfter(X509 *x509, const ASN1_TIME *tm)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void X509_NAME_free(X509_NAME *a)
|
||||
{
|
||||
}
|
||||
|
||||
void X509_ALGOR_free(X509_ALGOR *a)
|
||||
{
|
||||
}
|
||||
|
||||
int X509_sign(X509 *x509, EVP_PKEY *pkey, const EVP_MD *md)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int X509_add_ext(X509 *x, const X509_EXTENSION *ex, int loc)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int X509_set_pubkey(X509 *x509, EVP_PKEY *pkey)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex,
|
||||
int nid, int crit,
|
||||
const ASN1_OCTET_STRING *data)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
X509 *X509_new(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int X509_set_version(X509 *x509, long version)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int X509_set_serialNumber(X509 *x509, const ASN1_INTEGER *serial)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int X509_set_subject_name(X509 *x509, X509_NAME *name)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int X509_set_issuer_name(X509 *x509, X509_NAME *name)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int X509_set_notBefore(X509 *x509, const ASN1_TIME *tm)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *obj,
|
||||
int param_type, void *param_value)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int X509_set1_signature_algo(X509 *x509, const X509_ALGOR *algo)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int X509_set1_signature_value(X509 *x509,
|
||||
const uint8_t *sig,
|
||||
size_t sig_len)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
X509_NAME *X509_NAME_new(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int X509_NAME_add_entry_by_txt(X509_NAME *name, const char *field,
|
||||
int type, const uint8_t *bytes,
|
||||
int len, int loc, int set)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
X509_NAME *d2i_X509_NAME(X509_NAME **out, const uint8_t **inp, long len)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
X509_ALGOR *X509_ALGOR_new(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int i2d_X509(X509 *x509, uint8_t **outp)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
PKCS8_PRIV_KEY_INFO *d2i_PKCS8_PRIV_KEY_INFO(PKCS8_PRIV_KEY_INFO *info,
|
||||
const uint8_t **key_data,
|
||||
size_t key_length)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void PKCS8_PRIV_KEY_INFO_free(PKCS8_PRIV_KEY_INFO *key)
|
||||
{
|
||||
}
|
||||
|
||||
EVP_PKEY *EVP_PKCS82PKEY(const PKCS8_PRIV_KEY_INFO *p8)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue