This PR updates the build to succeed without relying on existing OpenSSL versions. Changes include: 1. Removed OpenSSL 0.9.8 and 1.0.2 components from VSB configuration 2. Removed ipcrypto and ipssl from ipnet root Makefile (ipComps and VARLIST) 3. Updated ipcom/src/ipcom_auth.c for compatibility with OpenSSL 3.5.0 4. Added OpenSSL 3.5.0 include paths where required 5. Removed script from vxworks.krnl.mak which was renaming old OpenSSL library files 6. Removed script from ossl350_prepare/Makefile which was copying OpenSSL 3.5.0 headers to target/h 7. Adapted OpenSSL 3.5.0 headers to ipcom types during build 8. Modified ipnet CDF to switch dependency from INCLUDE_IPSSL to INCLUDE_IPCRYPTO 9. Components: WebCli and NTP are by default disabled Note : There may still be build issues, as target/h/openssl and old OpenSSL source files remain in master. Co-authored-by: subhamgdeb <subhamgdeb> Reviewed-on: http://13.234.246.121:3000/Neominds/ossl35vx69/pulls/57 Reviewed-by: Siddhant Singh <siddhant.singh@neominds.in> Co-authored-by: Subham <subham.gangdeb@neominds.in> Co-committed-by: Subham <subham.gangdeb@neominds.in>
248 lines
6.4 KiB
C
248 lines
6.4 KiB
C
/* 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
|
|
****************************************************************************
|
|
*/
|
|
#ifdef IPCRYPTO_USE_TYPE_MAPPING
|
|
typedef struct _AES_CMAC_CONTEXT
|
|
{
|
|
Ip_u8 IV[AES_BLOCKSIZE]; /* IV initialization vector */
|
|
Ip_u32 ivLength; /* IV length */
|
|
Ip_u8 k1[AES_BLOCKSIZE]; /* k1 subkey */
|
|
Ip_u8 k2[AES_BLOCKSIZE]; /* k2 subkey */
|
|
AES_KEY aesKey; /* AES_KEY used for cipher */
|
|
} AES_CMAC_CTX;
|
|
#endif
|
|
|
|
/* 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
|
|
****************************************************************************
|
|
*/
|