Merge pull request 'Changes to compile openssl-3.1.7 in vx6.9' (#4) from ossl_compilation into master
Reviewed-on: http://13.234.246.121:3000/Neominds/ossl35vx69/pulls/4
This commit is contained in:
@@ -0,0 +1,237 @@
|
||||
/* ipcrypto.h - public API of Wind River Crypto */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2006-2014, 2019-2021, 2023-2024 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
#ifndef IPCRYPTO_H
|
||||
#define IPCRYPTO_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
DESCRIPTION
|
||||
This library contains the API for Wind River Crypto
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 CONFIGURATION
|
||||
****************************************************************************
|
||||
*/
|
||||
#include "ipcrypto_config.h"
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#include <openssl/ossl_typ.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/* IPCRYPTO release XYyZz,
|
||||
* X = major version
|
||||
* Yy = minor version (two different versions might be incompatible)
|
||||
* Zz = patch version (two different versions are always compatible)
|
||||
*/
|
||||
#define IPCRYPTO_RELEASE 70
|
||||
|
||||
#ifndef AES_BLOCKSIZE
|
||||
#define AES_BLOCKSIZE 16
|
||||
#endif
|
||||
|
||||
#define AES_KEY_128_BYTES 16
|
||||
#define AES_KEY_192_BYTES 24
|
||||
#define AES_KEY_256_BYTES 32
|
||||
#define AESKW_BLOCKSIZE 8
|
||||
|
||||
/*this LOCK is useless in openssl1.1.1, will be delete after all 3rd update*/
|
||||
#define CRYPTO_NUM_LOCKS 41
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/* Forward declaration */
|
||||
struct env_md_st;
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 6 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipcrypto_crc32 -
|
||||
*
|
||||
* \NOMANUAL:
|
||||
*
|
||||
*/
|
||||
extern unsigned int ipcrypto_crc32(
|
||||
const unsigned char* s,
|
||||
unsigned int len
|
||||
);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* ipcrypto_key_fingerprint_bubblebabble -
|
||||
*
|
||||
* \NOMANUAL:
|
||||
*
|
||||
*/
|
||||
extern char * ipcrypto_key_fingerprint_bubblebabble(
|
||||
unsigned char* dgst_raw,
|
||||
unsigned int dgst_raw_len
|
||||
);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* aeskw_wrap - encrypt a key using AES Keywrap
|
||||
*
|
||||
* This routine encrypts a key using AES Keywrap.
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i <key>
|
||||
* Pointer to key encryption key buffer.
|
||||
*
|
||||
* \i <keyLength>
|
||||
* Length of key in key buffer in bytes. Must be 16, 24 or 32 bytes.
|
||||
*
|
||||
* \i <iv>
|
||||
* Pointer to initialization vector buffer.
|
||||
*
|
||||
* \i <ivLength>
|
||||
* Length of IV in bytes. Must be AESKW_BLOCKSIZE.
|
||||
*
|
||||
* \i <plainText>
|
||||
* Pointer to buffer to encrypt.
|
||||
*
|
||||
* \i <plainTextLength>
|
||||
* Length of plainText buffer. Must be a multiple of AESKW_BLOCKSIZE.
|
||||
*
|
||||
* \i <cipherText>
|
||||
* Pointer to output buffer.
|
||||
*
|
||||
* \i <cipherTextLength>
|
||||
* Pointer to a variable containing the length of the output buffer. On input, '*cipherTextLength'
|
||||
* must be set to the size of the 'cipherText' buffer. On output, '*cipherTextLength' is updated to the length
|
||||
* of data copied into the 'cipherText' buffer.
|
||||
*
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: 1 on success, -1 on error
|
||||
*
|
||||
*/
|
||||
extern int aeskw_wrap(
|
||||
unsigned char *key,
|
||||
int keyLength,
|
||||
unsigned char *iv,
|
||||
int ivLength,
|
||||
unsigned char *plainText,
|
||||
int plainTextLength,
|
||||
unsigned char *cipherText,
|
||||
int *cipherTextLength
|
||||
);
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* aeskw_unwrap - decrypt a key using AES Keywrap
|
||||
*
|
||||
* This routine decrypts a key using AES Keywrap.
|
||||
*
|
||||
* Parameters:
|
||||
* \is
|
||||
* \i <key>
|
||||
* Pointer to key encryption key buffer.
|
||||
*
|
||||
* \i <keyLength>
|
||||
* Length of key in key buffer in bytes. Must be 16, 24 or 32 bytes.
|
||||
*
|
||||
* \i <iv>
|
||||
* Pointer to initialization vector buffer.
|
||||
*
|
||||
* \i <ivLength>
|
||||
* Length of IV in bytes. Must be AESKW_BLOCKSIZE.
|
||||
*
|
||||
* \i <cipherText>
|
||||
* Pointer to buffer to decrypt.
|
||||
*
|
||||
* \i <cipherTextLength>
|
||||
* Length of cipherText buffer. Must be a multiple of AESKW_BLOCKSIZE.
|
||||
*
|
||||
* \i <plainText>
|
||||
* Pointer to output buffer.
|
||||
*
|
||||
* \i <plainTextLength>
|
||||
* Pointer to a variable containing the length of the output buffer. On input, '*plainTextLength'
|
||||
* must be set to the size of the 'plainText' buffer. On output, '*plainTextLength' is updated to the length
|
||||
* of data copied into the 'plainText' buffer.
|
||||
*
|
||||
* \ie
|
||||
*
|
||||
* RETURNS: 1 on success, -1 on error
|
||||
*
|
||||
*/
|
||||
|
||||
extern int aeskw_unwrap(
|
||||
unsigned char *key,
|
||||
int keyLength,
|
||||
unsigned char *iv,
|
||||
int ivLength,
|
||||
unsigned char *cipherText,
|
||||
int cipherTextLength,
|
||||
unsigned char *plainText,
|
||||
int *plainTextLength
|
||||
);
|
||||
|
||||
|
||||
void ipcrypto_rsa_oaep_encode(const EVP_MD* hash,
|
||||
unsigned char *in,
|
||||
int inlen,
|
||||
unsigned char *out,
|
||||
int outlen);
|
||||
|
||||
int ipcrypto_rsa_oaep_decode(const EVP_MD* hash,
|
||||
unsigned char *in,
|
||||
int in_len,
|
||||
unsigned char *out,
|
||||
int* out_len);
|
||||
|
||||
struct rand_meth_st * vxRandLibMeth(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2014, 2021, 2024 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
#ifndef IPCRYPTO_CONFIG_H
|
||||
#define IPCRYPTO_CONFIG_H
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 1 DESCRIPTION
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 2 INCLUDE FILES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#include <openssl/opensslconf.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*
|
||||
****************************************************************************
|
||||
* 3 DEFINES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
#ifdef IPCRYPTO_MINIMUM_FOOTPRINT
|
||||
|
||||
/* Hash algorithms */
|
||||
#define OPENSSL_NO_MD2
|
||||
#define OPENSSL_NO_MD4
|
||||
#define OPENSSL_NO_RIPEMD
|
||||
#define OPENSSL_NO_RIPEMD160
|
||||
#define OPENSSL_NO_RMD160
|
||||
|
||||
/* Symmetrical algorithms */
|
||||
/*#define OPENSSL_NO_AES*/
|
||||
#define OPENSSL_NO_BF
|
||||
#define OPENSSL_NO_CAST
|
||||
#define OPENSSL_NO_CHAIN_VERIFY
|
||||
#define OPENSSL_NO_DESCBCM
|
||||
#define OPENSSL_NO_RC4
|
||||
#define OPENSSL_NO_RC2
|
||||
|
||||
/* Asymmetrical algorithms */
|
||||
/* These algorithms are needed by IPIKE, IPSSH, IPSSL, IPWEBS */
|
||||
/* #define OPENSSL_NO_DH */
|
||||
/* #define OPENSSL_NO_DSA */
|
||||
/* ipwebs and ipsslproxy require RSA */
|
||||
/* #define OPENSSL_NO_RSA */
|
||||
|
||||
|
||||
#define OPENSSL_NO_KRB5
|
||||
/* #define OPENSSL_NO_OCSP */
|
||||
|
||||
#endif
|
||||
|
||||
/* The following algorithms have an unclear patent situation, hence we exclude them */
|
||||
#define OPENSSL_NO_MDC2
|
||||
#define OPENSSL_NO_IDEA
|
||||
|
||||
|
||||
#ifdef OPENSSL_FIPS
|
||||
#define OPENSSL_NO_MD2
|
||||
/*#define OPENSSL_NO_MD4*/
|
||||
#define OPENSSL_NO_RIPEMD
|
||||
#define OPENSSL_NO_RIPEMD160
|
||||
#define OPENSSL_NO_RMD160
|
||||
|
||||
#define OPENSSL_NO_BF
|
||||
#define OPENSSL_NO_CAST
|
||||
#define OPENSSL_NO_RC4
|
||||
#define OPENSSL_NO_RC2
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* IPCRYPTO_DEFAULT_CONFIG_FILE
|
||||
*===========================================================================
|
||||
*/
|
||||
#define IPCRYPTO_DEFAULT_CONFIG_FILE "/ram/openssl.cnf"
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* IPCRYPTO_USE_APPS
|
||||
*===========================================================================
|
||||
* Define to include openssl shell command applications.
|
||||
*/
|
||||
#if !defined(IPCRYPTO_MINIMUM_FOOTPRINT)
|
||||
#define IPCRYPTO_USE_APPS
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
*===========================================================================
|
||||
* IPCRYPTO_USE_TEST
|
||||
*===========================================================================
|
||||
* Define to include openssl shell command test tools.
|
||||
#if !defined(IPCRYPTO_MINIMUM_FOOTPRINT)
|
||||
#endif
|
||||
*/
|
||||
#define IPCRYPTO_USE_TEST
|
||||
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 4 TYPES
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* 5 FUNCTIONS
|
||||
****************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************
|
||||
* END OF FILE
|
||||
****************************************************************************
|
||||
*/
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2021, 2024 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
#ifndef IPCRYPTO_SHELL_H
|
||||
#define IPCRYPTO_SHELL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef int (* Ipcrypto_shell_cmd_type) (int argc, char ** argv);
|
||||
|
||||
int ipcrypto_shell_add_cmd(const char *name, const char *usage,
|
||||
const char *description, Ipcrypto_shell_cmd_type hook);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#endif /*IPCRYPTO_SHELL_H*/
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 2016, 2021, 2024 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
|
||||
#ifndef IPCRYPTO_UTIL_H
|
||||
#define IPCRYPTO_UTIL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Operation timed out and failed. */
|
||||
#define IPCRYPTO_ERR_TIMEOUT -1120
|
||||
|
||||
/* Operation failed because blocking is illegal. */
|
||||
#define IPCRYPTO_ERR_WOULDBLOCK -1121
|
||||
|
||||
/* Operation was interrupted */
|
||||
#define IPCRYPTO_ERR_INTERRUPT -1122
|
||||
|
||||
typedef void *mutex_t;
|
||||
/* Block type */
|
||||
typedef void * Ipcrypto_block;
|
||||
|
||||
struct sockaddr;
|
||||
struct timeval;
|
||||
struct tms;
|
||||
|
||||
int mutex_create(mutex_t *mutex);
|
||||
int mutex_delete(mutex_t *mutex);
|
||||
void mutex_lock(mutex_t mutex);
|
||||
void mutex_unlock(mutex_t mutex);
|
||||
int ipcrypto_block_create(Ipcrypto_block *block);
|
||||
int ipcrypto_block_delete(Ipcrypto_block *block);
|
||||
int ipcrypto_block_wait(Ipcrypto_block block, int milli_seconds);
|
||||
void ipcrypto_block_post(Ipcrypto_block block);
|
||||
void ipcrypto_microtime(struct timeval *tv);
|
||||
clock_t ipcrypto_times(struct tms *buf);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#endif /*IPCRYPTO_UTIL_H*/
|
||||
@@ -0,0 +1,86 @@
|
||||
/* sys/select.h */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2009-2010, 2016, 2018, 2021 Wind River Systems, Inc.
|
||||
*
|
||||
* The right to copy, distribute, modify or otherwise make use
|
||||
* of this software may be licensed only pursuant to the terms
|
||||
* of an applicable Wind River license agreement.
|
||||
*/
|
||||
#ifndef _SYS_SELECT_H_
|
||||
#define _SYS_SELECT_H_
|
||||
#if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE) && \
|
||||
!defined(_POSIX_AEP_RT_CONTROLLER_C_SOURCE)
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#else
|
||||
|
||||
#include <base/e_vxTypesOld.h> /* _VX_FD_SETSIZE, etc. */
|
||||
|
||||
#endif /* _POSIX_xxx_SOURCE */
|
||||
|
||||
#include <sys/time.h> /* timeval */
|
||||
#include <signal.h> /* sigset_t */
|
||||
#include <time.h> /* timespec */
|
||||
#include <strings.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef FD_SETSIZE
|
||||
#define FD_SETSIZE _VX_FD_SETSIZE
|
||||
#endif /* FD_SETSIZE */
|
||||
|
||||
#ifndef _FD_MASK_DEFINED
|
||||
#define _FD_MASK_DEFINED
|
||||
typedef long fd_mask;
|
||||
#endif /* _FD_MASK_DEFINED */
|
||||
|
||||
#ifndef NBBY
|
||||
#define NBBY 8
|
||||
#endif
|
||||
|
||||
#ifndef NFDBITS
|
||||
#define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */
|
||||
#endif
|
||||
|
||||
#ifndef howmany
|
||||
#define howmany(x, y) ((unsigned int)(((x)+((y)-1)))/(unsigned int)(y))
|
||||
#endif
|
||||
|
||||
#ifndef _FD_SET_DEFINED
|
||||
#define _FD_SET_DEFINED
|
||||
typedef struct fd_set
|
||||
{
|
||||
fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
|
||||
} fd_set;
|
||||
#endif /* _FD_SET_DEFINED */
|
||||
|
||||
#ifndef _FD_FUNC_DEFINED
|
||||
#define _FD_FUNC_DEFINED
|
||||
#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~((fd_mask)1 << ((n) % NFDBITS)))
|
||||
#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & ((fd_mask)1 << ((n) % NFDBITS)))
|
||||
#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= ((fd_mask)1 << ((n) % NFDBITS)))
|
||||
#define FD_ZERO(p) bzero((char *)(p), sizeof(*(p)))
|
||||
#endif /* _FD_FUNC_DEFINED */
|
||||
|
||||
#ifdef _WRS_KERNEL
|
||||
extern int select (int width, fd_set * pReadFds, fd_set * pWriteFds,
|
||||
fd_set * pExceptFds, struct timeval * pTimeOut);
|
||||
#else
|
||||
extern int select(int, fd_set *_Restrict, fd_set *_Restrict, fd_set *_Restrict,
|
||||
struct timeval *_Restrict);
|
||||
#endif
|
||||
|
||||
#if FALSE /* pselect not implemented */
|
||||
extern int pselect(int, fd_set *_Restrict, fd_set *_Restrict, fd_set *_Restrict,
|
||||
const struct timespec *_Restrict, const sigset_t *_Restrict);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SYS_SELECT_H_ */
|
||||
@@ -96,6 +96,8 @@ modification history
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define thrd_success 0
|
||||
|
||||
/* BUS types */
|
||||
|
||||
#define BUS_TYPE_NONE NONE
|
||||
|
||||
@@ -268,7 +268,7 @@ ifndef _WRS_CONFIG_MEM_ALLOT
|
||||
DUAL_SUBDIRS += demo
|
||||
endif
|
||||
|
||||
GNU_SUBDIRS =
|
||||
GNU_SUBDIRS = openssl
|
||||
|
||||
DIAB_SUBDIRS =
|
||||
|
||||
|
||||
@@ -798,10 +798,9 @@ int ipcrypto_init_internal(SEM_ID semId)
|
||||
|
||||
#if defined (_WRS_KERNEL)
|
||||
/* use shareable FILEs rather than task-specific stdout/stderr */
|
||||
FILE * fpout = _Files[1];
|
||||
FILE * fperr = _Files[2];
|
||||
bio_out = BIO_new_fp(fpout, BIO_NOCLOSE | BIO_FP_TEXT);
|
||||
bio_err = BIO_new_fp(fperr, BIO_NOCLOSE | BIO_FP_TEXT);
|
||||
|
||||
bio_out = BIO_new_fp(stdout, BIO_NOCLOSE | BIO_FP_TEXT);
|
||||
bio_err = BIO_new_fp(stderr, BIO_NOCLOSE | BIO_FP_TEXT);
|
||||
#else
|
||||
bio_out = BIO_new_fp(stdout, BIO_NOCLOSE | BIO_FP_TEXT);
|
||||
bio_err = BIO_new_fp(stderr, BIO_NOCLOSE | BIO_FP_TEXT);
|
||||
|
||||
@@ -967,7 +967,23 @@ int RAND_set_seed_source_type(OSSL_LIB_CTX *ctx, const char *seed,
|
||||
|
||||
#if defined(OPENSSL_SYS_VXWORKS_SUPPORT)&&!defined(FIPS_MODULE)
|
||||
#include <vxWorks.h>
|
||||
#include <randomNumGen.h>
|
||||
#include <stdLib.h>
|
||||
#include <tickLib.h>
|
||||
|
||||
int randPseudoBytes(unsigned char * randBuf, int numOfBytes)
|
||||
{
|
||||
int i;
|
||||
|
||||
srand((unsigned int)tickGet());
|
||||
|
||||
for (i = 0; i < numOfBytes; i++)
|
||||
{
|
||||
/* take lowest 8 bits */
|
||||
randBuf[i] = (uint8_t)(rand() & 0xFF);
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
int RAND_poll(void)
|
||||
{
|
||||
|
||||
@@ -59,7 +59,6 @@ use OpenSSL::stackhash qw(generate_stack_macros);
|
||||
typedef int once_flag;
|
||||
typedef unsigned int tss_t;
|
||||
# ifndef __cplusplus
|
||||
#include <threads.h>
|
||||
# endif
|
||||
# endif
|
||||
|
||||
@@ -500,6 +499,15 @@ typedef LONG CRYPTO_ONCE;
|
||||
typedef once_flag CRYPTO_ONCE;
|
||||
typedef tss_t CRYPTO_THREAD_LOCAL;
|
||||
typedef TASK_ID CRYPTO_THREAD_ID;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int initialized;
|
||||
SEM_ID sem;
|
||||
}CRYPTO_ONCE_STATIC_INIT;
|
||||
|
||||
# define ONCE_FLAG_INIT {0, NULL}
|
||||
|
||||
# define CRYPTO_ONCE_STATIC_INIT ONCE_FLAG_INIT
|
||||
# else
|
||||
# if defined(__TANDEM) && defined(_SPT_MODEL_)
|
||||
|
||||
+23
-1
@@ -31,7 +31,29 @@
|
||||
#endif
|
||||
|
||||
#if defined(OPENSSL_SYS_VXWORKS)
|
||||
# include <randomNumGen.h>
|
||||
#include <stdLib.h>
|
||||
#include <tickLib.h>
|
||||
|
||||
int randSecure (void)
|
||||
{
|
||||
return OK;
|
||||
}
|
||||
|
||||
STATUS randUBytes (unsigned char * randBuf, int numOfBytes)
|
||||
{
|
||||
int i;
|
||||
|
||||
srand((unsigned int)tickGet());
|
||||
|
||||
for (i = 0; i < numOfBytes; i++)
|
||||
{
|
||||
/* take lowest 8 bits */
|
||||
randBuf[i] = (uint8_t)(rand() & 0xFF);
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* Macro to convert two thirty two bit values into a sixty four bit one */
|
||||
|
||||
+1
@@ -10,6 +10,7 @@
|
||||
/* This file has quite some overlap with engines/e_loader_attic.c */
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <ctype.h> /* isdigit */
|
||||
#include <assert.h>
|
||||
|
||||
@@ -15,23 +15,51 @@ Random Number Library
|
||||
*/
|
||||
|
||||
#include <vxWorks.h>
|
||||
#include <randomNumGen.h>
|
||||
#include <stdLib.h>
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
#include <tickLib.h>
|
||||
|
||||
#include <openssl/rand.h>
|
||||
|
||||
/*
|
||||
* Writes `len` random bytes into `buf`.
|
||||
* Arguments:
|
||||
* buf - pointer to a buffer provided by the caller
|
||||
* len - number of random bytes to generate
|
||||
*
|
||||
* Returns:
|
||||
* 0 on success
|
||||
*/
|
||||
int fill_random_bytes(uint8_t *buf, int len) {
|
||||
|
||||
int i;
|
||||
|
||||
srand((unsigned int)tickGet());
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
/* take lowest 8 bits */
|
||||
buf[i] = (uint8_t)(rand() & 0xFF);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int vxRandLibSeed(const void *buf, int num)
|
||||
{
|
||||
return randAdd(buf, num, num);
|
||||
|
||||
fill_random_bytes ((uint8_t *)buf, num);
|
||||
srand (buf);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int vxRandLibBytes(unsigned char *buf, int num)
|
||||
{
|
||||
int rc;
|
||||
rc = randABytes(buf, num);
|
||||
if (rc == OK)
|
||||
return 1;
|
||||
return 0;
|
||||
fill_random_bytes ((uint8_t *)buf, num);
|
||||
return OK;
|
||||
}
|
||||
|
||||
static void vxRandLibCleanup(void)
|
||||
@@ -41,21 +69,28 @@ static void vxRandLibCleanup(void)
|
||||
|
||||
static int vxRandLibAdd(const void *buf, int num, double entropy)
|
||||
{
|
||||
return randAdd(buf, num, (int)entropy);
|
||||
fill_random_bytes ((uint8_t *)buf, num);
|
||||
srand (buf);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int vxRandLibPseudorand(unsigned char *buf, int num)
|
||||
{
|
||||
int rc;
|
||||
rc = randUBytes(buf, num);
|
||||
if (rc == OK)
|
||||
|
||||
fill_random_bytes ((uint8_t *)buf, num);
|
||||
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vxRandLibStatus(void)
|
||||
{
|
||||
return randSecure();
|
||||
int i;
|
||||
|
||||
for (i=0; i< 2; i++)
|
||||
sleep (1);
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
static struct rand_meth_st vxRandLibMethSt =
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Makefile - for openssl
|
||||
# Makefile - for openssl_src
|
||||
#
|
||||
# Copyright (c) 2019-2025 Wind River Systems, Inc.
|
||||
#
|
||||
@@ -8,7 +8,29 @@
|
||||
#
|
||||
|
||||
|
||||
include $(WIND_KRNL_MK)/defs.ver.mk
|
||||
TGT_DIR=$(WIND_BASE)/target
|
||||
PKG_SRC_BUILD_DIR=$(VSB_DIR)/3pp/openssl-3.1.7
|
||||
OPENSSL_COMPRSS_DIR=$(WIND_HOME)/vxworks-6.9/target/src/openssl/OPENSSL
|
||||
KERNEL_PUBLIC_INCLUDE_DIR=$(PKG_SRC_BUILD_DIR)/krnl/h/public
|
||||
|
||||
#for applying patch
|
||||
PATCH=$(WIND_HOME)/vxworks-6.9/host/msys2-x86-win64/usr/bin/patch.exe
|
||||
OPENSSL_SRC_DIR=$(WIND_HOME)/vxworks-6.9/target/src/openssl/openssl_src
|
||||
SRC_PATCH_DIR=$(WIND_HOME)/vxworks-6.9/target/src/openssl/OPENSSL/openssl-openssl-3.1.7
|
||||
|
||||
# hardcoded for now -
|
||||
_WRS_CONFIG_OPENSSL_OPTIONS= no-aria no-blake2 no-camellia no-chacha no-md2 no-ocb no-poly1305 no-rc2 no-scrypt no-seed no-siphash no-sm2 no-sm3 no-sm4 no-cms no-cmp no-err no-autoerrinit no-filenames no-ct no-ec2m no-multiblock no-rfc3779 no-srp no-tests
|
||||
|
||||
_WRS_CONFIG_OPENSSL_IPNET_OPTIONS=
|
||||
VXWORKS_MAK=vxworks.krnl.mak
|
||||
VXE=openssl
|
||||
PKG_NAME=openssl-3.1.7
|
||||
MAKECMDGOALS=_mk
|
||||
|
||||
#MAKE_ARGS needs depends on BSP. Example shown below:-
|
||||
#CPU=SIMNT TOOL=llvm TOOL_VERSION=llvm_2016_04 _CC_VERSION=llvm_18_1_8_1 _WRS_CONFIG_ENDIAN=little _WRS_CONFIG_FP=hard VSB_DIR=C:/25.09/workbench-4/workspace/VSB2_vxSim ROOT_DIR=C:/25.09/workbench-4/workspace/VSB2_vxSim/usr/root
|
||||
MAKE_ARGS="CPU=SIMNT TOOL=gnu TOOL_VERSION=llvm_2016_04 _CC_VERSION=llvm_18_1_8_1 _WRS_CONFIG_ENDIAN=little _WRS_CONFIG_FP=hard VSB_DIR=C:/25.09/workbench-4/workspace/VSB2_vxSim ROOT_DIR=C:/25.09/workbench-4/workspace/VSB2_vxSim/usr/root"
|
||||
|
||||
|
||||
include $(VSB_DIR)/h/config/auto.conf
|
||||
PKG_VER := 3.1.7
|
||||
@@ -24,7 +46,7 @@ else
|
||||
EXCLUDED_PATCHES = armv4cpuid.pl.patch
|
||||
endif
|
||||
|
||||
include $(WIND_KRNL_MK)/rules.unix.ports.mk
|
||||
#include $(WIND_KRNL_MK)/rules.unix.ports.mk
|
||||
|
||||
|
||||
ifeq 'x86-win32' '$(WIND_HOST_TYPE)'
|
||||
@@ -104,10 +126,6 @@ else
|
||||
BUILD_TYPE := --release
|
||||
endif
|
||||
|
||||
ifdef _WRS_CONFIG_OPENSSL_FIPSMODULE
|
||||
_WRS_CONFIG_OPENSSL_OPTIONS += enable-fips
|
||||
endif
|
||||
|
||||
OPENSSL_VSB_OPTIONS = $(_WRS_CONFIG_OPENSSL_OPTIONS) $(_WRS_CONFIG_OPENSSL_IPNET_OPTIONS)
|
||||
|
||||
ifeq (, $(findstring enable-fips, $(_WRS_CONFIG_OPENSSL_OPTIONS)))
|
||||
@@ -125,16 +143,26 @@ ifeq 'x86-win32' '$(WIND_HOST_TYPE)'
|
||||
export CONFIGURE_CMD := $(CONFIGURE_CMD) PERL=$(WIND_BASE)/host/msys2-x86-win64/usr/bin/perl5
|
||||
endif
|
||||
|
||||
ifeq "$(BUILDSTAGE)" "PREBUILD"
|
||||
|
||||
PUBLIC_INCLUDE_DIRS = include/openssl
|
||||
PUBLIC_INCLUDE_DIRS := $(addprefix $(PKG_SRC_BUILD_DIR)/,$(PUBLIC_INCLUDE_DIRS))
|
||||
PUBLIC_INCLUDE_DIRS := $(PKG_SRC_BUILD_DIR)/$(PUBLIC_INCLUDE_DIRS)
|
||||
|
||||
OPENSSL_TEST_PATH := $(PKG_SRC_BUILD_DIR)/test
|
||||
OPENSSL_TEST_SCRIPT_DIR := vx-test-script
|
||||
OPENSSL_TEST_SCRIPT_PATH := $(OPENSSL_TEST_PATH)/$(OPENSSL_TEST_SCRIPT_DIR)
|
||||
|
||||
|
||||
target: get-openssl \
|
||||
$(OPENSSL_TEST_SCRIPT_PATH) \
|
||||
$(PKG_SRC_BUILD_DIR)/include/openssl/configuration.h \
|
||||
$(PUBLIC_INCLUDE_DIRS)
|
||||
cd $(PKG_SRC_BUILD_DIR)/krnl && $(MAKE) -f $(VXWORKS_MAK) VXE=$@ PKG_NAME=$(PKG_NAME) PKG_VER=$(PKG_VER) $(MAKECMDGOALS)
|
||||
|
||||
get-openssl:
|
||||
cd $(VSB_DIR) && mkdir -p 3pp
|
||||
cp -r $(OPENSSL_COMPRSS_DIR)/$(PKG_NAME) $(VSB_DIR)/3pp/$(PKG_NAME)
|
||||
|
||||
|
||||
$(OPENSSL_TEST_SCRIPT_PATH) : $(OPENSSL_TEST_SCRIPT_DIR)/generate_test_buildinfo $(OPENSSL_TEST_SCRIPT_DIR)/adapt_test_src_file
|
||||
echo "pre-process openssl test"
|
||||
|
||||
@@ -151,26 +179,16 @@ $(PKG_SRC_BUILD_DIR)/include/openssl/configuration.h:
|
||||
echo "generating configuration.h and other generated headers"
|
||||
cd $(PKG_SRC_BUILD_DIR); \
|
||||
$(PERL_NAME) $(CONFIGURE_CMD) > /dev/null 2>&1; \
|
||||
$(MAKE) build_generated
|
||||
$(MAKE) build_generated;
|
||||
mkdir -p $(PKG_SRC_BUILD_DIR)/krnl
|
||||
mkdir -p $(PKG_SRC_BUILD_DIR)/krnl/h
|
||||
mkdir -p $(PKG_SRC_BUILD_DIR)/krnl/h/public
|
||||
cp -r -u -L $(PKG_SRC_BUILD_DIR)/include/openssl/ $(KERNEL_PUBLIC_INCLUDE_DIR)
|
||||
cp $(VXWORKS_MAK) $(PKG_SRC_BUILD_DIR)/krnl
|
||||
|
||||
$(PUBLIC_INCLUDE_DIRS) : prebuild $(OPENSSL_TEST_SCRIPT_PATH) $(PKG_SRC_BUILD_DIR)/include/openssl/configuration.h
|
||||
cp -r -u -L $@ $(VSB_USER_PUBLIC_INCLUDE_DIR)
|
||||
cp -r -u -L $@ $(VSB_KERNEL_PUBLIC_INCLUDE_DIR)
|
||||
|
||||
default : $(PUBLIC_INCLUDE_DIRS)
|
||||
endif
|
||||
|
||||
ifeq "$(BUILDSTAGE)" "BUILD"
|
||||
export PKG_SRC_BUILD_DIR := $(PKG_SRC_BUILD_DIR)/krnl
|
||||
$(shell mkdir -p $(PKG_SRC_BUILD_DIR))
|
||||
endif
|
||||
|
||||
ifeq "$(BUILDSTAGE)" "POST_USR_BUILD_STATIC"
|
||||
export PKG_SRC_BUILD_DIR := $(PKG_SRC_BUILD_DIR)/usr
|
||||
$(shell mkdir -p $(PKG_SRC_BUILD_DIR))
|
||||
endif
|
||||
|
||||
ifeq "$(BUILDSTAGE)" "POST_USR_BUILD_SHARED"
|
||||
export PKG_SRC_BUILD_DIR := $(PKG_SRC_BUILD_DIR)/usr
|
||||
$(shell mkdir -p $(PKG_SRC_BUILD_DIR))
|
||||
endif
|
||||
$(PUBLIC_INCLUDE_DIRS) : $(OPENSSL_TEST_SCRIPT_PATH) $(PKG_SRC_BUILD_DIR)/include/openssl/configuration.h
|
||||
mkdir -p $(PKG_SRC_BUILD_DIR)/krnl
|
||||
mkdir -p $(PKG_SRC_BUILD_DIR)/krnl/h
|
||||
mkdir -p $(PKG_SRC_BUILD_DIR)/krnl/h/public
|
||||
cp -r -u -L $(PKG_SRC_BUILD_DIR)/include/openssl/ $(KERNEL_PUBLIC_INCLUDE_DIR)
|
||||
cp $(VXWORKS_MAK) $(PKG_SRC_BUILD_DIR)/krnl
|
||||
|
||||
@@ -7,9 +7,12 @@
|
||||
# of an applicable Wind River license agreement.
|
||||
#
|
||||
|
||||
include $(VSB_DIR)/h/config/auto.conf
|
||||
TGT_DIR=$(WIND_BASE)/target
|
||||
|
||||
VX_CFLAGS = $(patsubst '-D_VSB_CONFIG_FILE="%"',,$(subst -ansi,,$(CFLAGS))) $(OPTION_DEPEND_GEN_D)
|
||||
include $(VSB_DIR)/h/config/auto.conf
|
||||
include $(TGT_DIR)/h/make/defs.library
|
||||
|
||||
VX_CFLAGS = $(patsubst -D_VSB_CONFIG_FILE=\"%\",-D_VSB_CONFIG_FILE=\\\"%\\\",$(subst -ansi,,$(CFLAGS))) $(OPTION_DEPEND_GEN_D)
|
||||
|
||||
ifdef _WRS_CONFIG_ENDIAN_little
|
||||
VX_CFLAGS += -DL_ENDIAN
|
||||
@@ -59,7 +62,7 @@ default : _mk
|
||||
ifneq (, $(findstring enable-fips, $(CONFIGURE_CMD)))
|
||||
_mk: Makefile build install fipsobjlist fipsintall $(SIGN_LIB)
|
||||
else
|
||||
_mk: Makefile build install
|
||||
_mk: Makefile build
|
||||
endif
|
||||
|
||||
Makefile:
|
||||
@@ -67,7 +70,7 @@ Makefile:
|
||||
$(PERL_NAME) ../$(CONFIGURE_CMD) $(VX_CONFIGURE_OPTS) > /dev/null 2>&1
|
||||
|
||||
build: Makefile
|
||||
@echo building $(VSBL_NAME) from generated Makefile
|
||||
@echo building OPENSSL from generated Makefile
|
||||
ifdef _WRS_CONFIG_SBOM
|
||||
$(MAKE) -f Makefile CC="$(CC)" AR="$(AR)" ARFLAGS="$(ARFLAGS)" _WRS_CONFIG_SBOM=1
|
||||
else
|
||||
@@ -139,7 +142,7 @@ $(SIGN_LIB) : fipsintall
|
||||
$(DKM_ENCRYPT_CMD) fips.out
|
||||
endif
|
||||
|
||||
include $(WIND_KRNL_MK)/rules.library.mk
|
||||
include $(TGT_DIR)/h/make/rules.library
|
||||
|
||||
#
|
||||
# this code is 3rd party. Suppress all compiler warnings
|
||||
|
||||
Reference in New Issue
Block a user