/* 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 #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 * Pointer to key encryption key buffer. * * \i * Length of key in key buffer in bytes. Must be 16, 24 or 32 bytes. * * \i * Pointer to initialization vector buffer. * * \i * Length of IV in bytes. Must be AESKW_BLOCKSIZE. * * \i * 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 **************************************************************************** */