/******************************************************************************************** * (c)2004-2011 Broadcom Corporation * * * * This program is the proprietary software of Broadcom Corporation and/or its licensors, * * and may only be used, duplicated, modified or distributed pursuant to the terms and * * conditions of a separate, written license agreement executed between you and Broadcom * * (an "Authorized License"). Except as set forth in an Authorized License, Broadcom grants* * no license (express or implied), right to use, or waiver of any kind with respect to the * * Software, and Broadcom expressly reserves all rights in and to the Software and all * * intellectual property rights therein. IF YOU HAVE NO AUTHORIZED LICENSE, THEN YOU * * HAVE NO RIGHT TO USE THIS SOFTWARE IN ANY WAY, AND SHOULD IMMEDIATELY * * NOTIFY BROADCOM AND DISCONTINUE ALL USE OF THE SOFTWARE. * * * Except as expressly set forth in the Authorized License, * * * 1. This program, including its structure, sequence and organization, constitutes * * the valuable trade secrets of Broadcom, and you shall use all reasonable efforts to * * protect the confidentiality thereof,and to use this information only in connection * * with your use of Broadcom integrated circuit products. * * * * 2. TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" * * AND WITH ALL FAULTS AND BROADCOM MAKES NO PROMISES, REPRESENTATIONS OR * * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO * * THE SOFTWARE. BROADCOM SPECIFICALLY DISCLAIMS ANY AND ALL IMPLIED WARRANTIES * * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, * * LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION * * OR CORRESPONDENCE TO DESCRIPTION. YOU ASSUME THE ENTIRE RISK ARISING OUT OF * * USE OR PERFORMANCE OF THE SOFTWARE. * * * * 3. TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT SHALL BROADCOM OR ITS * * LICENSORS BE LIABLE FOR (i) CONSEQUENTIAL, INCIDENTAL, SPECIAL, INDIRECT, OR * * EXEMPLARY DAMAGES WHATSOEVER ARISING OUT OF OR IN ANY WAY RELATING TO YOUR * * USE OF OR INABILITY TO USE THE SOFTWARE EVEN IF BROADCOM HAS BEEN ADVISED OF * * THE POSSIBILITY OF SUCH DAMAGES; OR (ii) ANY AMOUNT IN EXCESS OF THE AMOUNT * * ACTUALLY PAID FOR THE SOFTWARE ITSELF OR U.S. $1, WHICHEVER IS GREATER. THESE * * LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF * * ANY LIMITED REMEDY. * * $brcm_Workfile: bcrypt.h $ * $brcm_Revision: 2 $ * $brcm_Date: 11/8/11 2:42p $ * * Module Description: * * Revision History: * * $brcm_Log: /nexus/lib/dtcp_ip/include/bcrypt.h $ * * 2 11/8/11 2:42p leisun * SWSECURITY-86: Including original license term for bcrypt * * Module Description: * openssl wrapper functions from bcrypt. * *********************************************************************************************/ /*! \file bcrypt.h * \brief openssl wrappers originally from bcrypt lib. */ #ifndef BCRYPT_H__ #define BCRYPT_H__ #ifdef __cplusplus extern "C" { #endif #include #include "ecc.h" #define BCRYPT_LINUX_USER_MODE_DRV /* Host Secure Module magic number used to check if opaque handle is corrupt */ #define BCRYPT_P_HANDLE_MAGIC_NUMBER 0xfeedbabe #define BCRYPT_P_CHECK_ERR_CODE_FUNC( errCode, function ) \ if( (errCode = (function)) != BERR_SUCCESS ) \ { \ errCode = BERR_TRACE(errCode); \ goto BCRYPT_P_DONE_LABEL; \ } #define BCRYPT_P_CHECK_ERR_CODE_FUNC2( errCode, errCodeValue, function ) \ if ( ( errCode = (function)) != BERR_SUCCESS ) \ { \ errCode = BERR_TRACE(errCodeValue); \ goto BCRYPT_P_DONE_LABEL; \ } #define BCRYPT_P_CHECK_ERR_CODE_CONDITION( errCode, errCodeValue, condition ) \ if( (condition) ) \ { \ errCode = BERR_TRACE((errCodeValue)); \ goto BCRYPT_P_DONE_LABEL; \ } /* Definitions */ /* Host Secure module status codes */ typedef enum BCRYPT_STATUS_e{ BCRYPT_STATUS_eOK, BCRYPT_STATUS_eFAILED, BCRYPT_STATUS_eTIME_OUT, BCRYPT_STATUS_eHW_BUSY_ERR, BCRYPT_STATUS_eOUT_OF_SYSTEM_MEMORY, BCRYPT_STATUS_eINVALID_PARAMETER } BCRYPT_STATUS_eCode; /*************************************************************************** Summary: Parameters for BCRYPT handle. Description: This Structure defines the parameters for BCRYPT handle. It contains different handles such as HSM handle, DMA handle, and Memory DMA handle, DMA Event handle, HSM Mutex Handle, and DMA Mutex handle. Moreover, it contains bIsOpen and ulMagicNumber which must be equal to BCRYPT_P_HANDLE_MAGIC_NUMBER. See Also: BCRYPT_Setting ****************************************************************************/ typedef struct BCRYPT_P_Handle { unsigned long ulMagicNumber; /* Out: BCRYPT Magic Number */ bool bIsOpen; /* Out: Defines if BCRYPT handle is open */ } BCRYPT_P_Handle; /*************************************************************************** Summary: BCRYPT context handle. Description: This Structure defines BCRYPT_Handle which holds the context of BCRYPT. The system should have only one BCRYPT_Handle. It is created by BCRYPT_Open function. The caller of BCRYPT_Open is responsible to store this BCRYPT_Handle and uses it for the future function calls. See Also: BCRYPT_Open ****************************************************************************/ typedef struct BCRYPT_P_Handle * BCRYPT_Handle; BCRYPT_STATUS_eCode BCRYPT_Open( BCRYPT_Handle *outp_handle); /***************************************************************************** Summary: This function frees the BCRYPT handle. Description: This function shall free the BCRYPT handle and any resources contained in the main handle. This function shall try to free any resources associated with sub handles created from the main handle (BCRYPT_handle). Regardless of the return value, this function always attempts to free all the allocated resources. System shall not call any other BCRYPT functions after calling this function. Calling Context: The function shall be called from application level or from driver level, for example in Linux during insmod. Performance and Timing: This is a synchronous/blocking function that will not return until it is done or failed. Input: inout_handle - BCRYPT_Handle Returns: BCRYPT_STATUS_eOK - success BCRYPT_STATUS_eFAILED - failure See Also: BCRYPT_Open ******************************************************************************/ BCRYPT_STATUS_eCode BCRYPT_Close( BCRYPT_Handle inout_handle); /*************************************************************************** Summary: Parameters for SHA-1 algorithm in software. Description: This Structure defines the parameters for SHA-1 algorithm in software. It contains input source data, the length on input data in bytes, SHA-1 context, inital SHA-1 context, the generated digest, and the length of digset in bytes. ****************************************************************************/ typedef struct BCRYPT_Sha1Sw { unsigned char *pucSrcData; /* In: A pointer to the input source data */ unsigned long ulSrcDataLenInByte; /* In: Length of the input data in bytes */ unsigned long ulctxnum; /*In: Sha1 context, MUST be within 0-15. */ bool binitctx; /*In: Init SHA-1 context. */ bool bfinal; /*In: Generate final digest. */ unsigned char *pucDigest; /* Out: A pointer to the output digest value */ unsigned char ucDigestLenInByte; /* Out: Length of the output digest in bytes */ } BCRYPT_Sha1Sw_t; /* Basic Module Functions */ /***************************************************************************** Summary: This function implements the SHA-1 algorithm in SW. Description: This function implements the SHA-1 algorithm in software. It is based on the SHA-1 implementation of the openssl code. The binaries of the openssl library is already included into the build environment. Calling Context: The function shall be called from application level or from driver level, for example in Linux during insmod. Performance and Timing: This is a synchronous/blocking function that will not return until it is done or failed. Input: hBcrypt - BCRYPT_Handle inoutp_sha1SwIO - BCRYPT_Sha1Sw_t, a ref/pointer to the parameters for the SW implementation of the SHA-1 algorithm. Returns: BCRYPT_STATUS_eOK - success BCRYPT_STATUS_eFAILED - failure ******************************************************************************/ BCRYPT_STATUS_eCode BCrypt_Sha1Sw( BCRYPT_Handle hBcrypt, BCRYPT_Sha1Sw_t *inoutp_sha1SwIO ); /*************************************************************************** Summary: Parameters for the SW AES algorithm in the CBC mode of operation. Description: This Structure defines the parameters for the SW AES algorithm for the CBC mode of operation. It contains the input key, initialization vector, input and output streams, and the crypto mode. See Also: BCrypt_AESCBCSw ****************************************************************************/ typedef struct BCRYPT_S_AESCBCSwCtrl{ unsigned char *pIn; /* In: A pointer to the input data steam */ unsigned char *piv; /* In: A pointer to the CBC initialization vector. */ unsigned char *pkey; /* In: A pointer to the encryption key */ unsigned long len; /* In: Length of the input data steam */ bool bEncFlag; /* In: Encrypt flag: 1: encrypt, 0: decrypt */ unsigned long keybits; /* In: key length in bits. 128, 192, 256 only.*/ unsigned char *pOut; /* Out: A pointer to the encrypted output data */ } BCRYPT_S_AESCBCSwCtrl_t; /* Basic Module Functions */ /***************************************************************************** Summary: This function implements the AES algorithm in the CBC mode of operation in SW. Description: This function implements the AES algorithm in the CBC mode of operation in software. It is based on the AES implementation of the openssl code. All key lengths of 128, 192, and 256 are supported. The binaries of the openssl library is already included into the build environment. Since this is a software implementation for the AES algorithm in the CBC mode of operation, it can only be used with the clear key. If the application requires an encrypted key, then the key must be decrypted before sending in to this function call. Calling Context: The function shall be called from application level or from driver level, for example in Linux during insmod. Performance and Timing: This is a synchronous/blocking function that will not return until it is done or failed. Input: hBcrypt - BCRYPT_Handle inoutp_AESCBCSwCtrl - BCRYPT_S_AESCBCSwCtrl_t, a ref/pointer to the parameters for the SW implementation of the AES algorithm in the CBC mode of operation. Returns: BCRYPT_STATUS_eOK - success BCRYPT_STATUS_eFAILED - failure See Also: BCrypt_AESECBSw ******************************************************************************/ BCRYPT_STATUS_eCode BCrypt_AESCBCSw( BCRYPT_Handle hBcrypt, BCRYPT_S_AESCBCSwCtrl_t *inoutp_AESCBCSwCtrl ); /*************************************************************************** Summary: Parameters for the SW AES algorithm in the ECB mode of operation. Description: This Structure defines the parameters for the SW AES algorithm for the ECB mode of operation. It contains the input key, initialization vector, input and output streams, and the crypto mode. See Also: BCrypt_AESECBSw ****************************************************************************/ typedef struct BCRYPT_S_AESECBSwCtrl{ unsigned char *pIn; /* In: A pointer to the input data steam */ unsigned char *pkey; /* In: A pointer to the encryption key */ unsigned long len; /* In: Length of the input data steam */ bool bEncFlag; /* In: Encrypt flag: 1: encrypt, 0: decrypt */ unsigned long keybits; /* In: key length in bits. 128, 192, 256 only.*/ unsigned char *pOut; /* Out: A pointer to the encrypted output data */ } BCRYPT_S_AESECBSwCtrl_t; /* Basic Module Functions */ /***************************************************************************** Summary: This function implements the AES algorithm in the ECB mode of operation in SW. Description: This function implements the AES algorithm in the ECB mode of operation in software. It is based on the AES implementation of the openssl code. All key lengths of 128, 192, and 256 are supported. The binaries of the openssl library is already included into the build environment. Since this is a software implementation for the AES algorithm in the ECB mode of operation, it can only be used with the clear key. If the application requires an encrypted key, then the key must be decrypted before sending in to this function call. Calling Context: The function shall be called from application level or from driver level, for example in Linux during insmod. Performance and Timing: This is a synchronous/blocking function that will not return until it is done or failed. Input: hBcrypt - BCRYPT_Handle inoutp_AESECBSwCtrl - BCRYPT_S_AESECBSwCtrl_t, a ref/pointer to the parameters for the SW implementation of the AES algorithm in the ECB mode of operation. Returns: BCRYPT_STATUS_eOK - success BCRYPT_STATUS_eFAILED - failure See Also: BCrypt_AESECBSw ******************************************************************************/ BCRYPT_STATUS_eCode BCrypt_AESECBSw( BCRYPT_Handle hBcrypt, BCRYPT_S_AESECBSwCtrl_t *inoutp_AESECBSwCtrl ); /*************************************************************************** Summary: Parameters for Elliptic Curve. Description: This Structure defines the parameters for Elliptic Curve. It contains modulus P, elliptic curve coefficient A and B, the base point G with components X and Y, and the order of base point G. See Also: BCRYPT_ECCPoint ****************************************************************************/ typedef struct BCRYPT_ECCParam { char *P; /* In: Modulus */ char *A; /* In: Elliptic curve coefficient a */ char *B; /* In: Elliptic curve coefficient b */ char *G_x; /* In: Base point, X component */ char *G_y; /* In: Base point, Y component */ char *N; /* In: Order of base point G */ } BCRYPT_ECCParam_t; /*************************************************************************** Summary: Parameters for a point on an EC curve. Description: This Structure defines the parameters a point on an EC curve. It contains the components x and y of the point on an EC curve. See Also: BCRYPT_ECCParam ****************************************************************************/ typedef struct BCRYPT_ECCPoint { char *x; /* In: Component x of the point in EC curve*/ char *y; /* In: Component y of the point in EC curve*/ } BCRYPT_ECCPoint_t; /* * Signature */ typedef enum { BCRYPT_ECCSig_Format_Decimal = 0, BCRYPT_ECCSig_Format_Hex } BCRYPT_ECCSig_Format_t; /*************************************************************************** Summary: Parameters for a ECC signature. Description: This Structure defines the parameters for ECC signature. It contains r, s (signature) and the signature format. See Also: BCRYPT_ECCParam, BCRYPT_ECCPoint ****************************************************************************/ typedef struct BCRYPT_ECCSig { char *r; /* In: Component r of ECC signature*/ char *s; /* In: Component s of ECC signature*/ BCRYPT_ECCSig_Format_t format; /* In: Signature format*/ } BCRYPT_ECCSig_t; /* * Public key */ typedef BCRYPT_ECCPoint_t BCRYPT_ECCPublicKey_t; /*************************************************************************** Summary: Parameters for a ECDSA Verify. Description: This Structure defines the parameters for ECDSA Verify. It contains EC curve parameters, signature, public key, hash string and its length, and a flag indicating if signature is valid. See Also: BCRYPT_ECCParam, BCRYPT_ECCPoint, BCRYPT_ECCSig BCRYPT_ECDSASw_Sign, BCRYPT_ECDSASw_Multiply ****************************************************************************/ typedef struct BCRYPT_ECDSASw_Verify { BCRYPT_ECCParam_t eccParm; /* In: EC curve parameters */ BCRYPT_ECCSig_t sig; /* In: ECC Signature */ BCRYPT_ECCPublicKey_t publicKey; /* In: Public key */ unsigned char *hash; /* In: A pointer to hash string */ unsigned char hashLen; /* In: Length of hash */ bool sigIsValid; /* Out: A flag indicating signature is valid */ } BCRYPT_ECDSASw_Verify_t; /*************************************************************************** Summary: Parameters for a ECDSA Sign. Description: This Structure defines the parameters for ECDSA Sign. It contains EC curve parameters, signature, private key, hash string and its length, and a random integer. See Also: BCRYPT_ECCParam, BCRYPT_ECCPoint, BCRYPT_ECCSig BCRYPT_ECDSASw_Verify, BCRYPT_ECDSASw_Multiply ****************************************************************************/ typedef struct BCRYPT_ECDSASw_Sign { BCRYPT_ECCParam_t eccParm; /* In: EC curve parameters */ BCRYPT_ECCSig_t sig; /* In: ECC Signature */ unsigned char *hash; /* In: A pointer to hash string */ unsigned char hashLen; /* In: Length of hash */ char *k; /* In: A random integer k */ char *privateKey; /* In: Private key */ } BCRYPT_ECDSASw_Sign_t; /*************************************************************************** Summary: Parameters for a EC Scalar Multiplication. Description: This Structure defines the parameters for EC Scalar Multiplication. It contains EC curve parameters, scalar, input point, and the output point. See Also: BCRYPT_ECCParam, BCRYPT_ECCPoint, BCRYPT_ECCSig BCRYPT_ECDSASw_Sign, BCRYPT_ECDSASw_Verify ****************************************************************************/ typedef struct BCRYPT_ECDSASw_Multiply { BCRYPT_ECCParam_t eccParm; /* In: EC curve parameters */ char *scalar; /* In: Scalar value */ BCRYPT_ECCPoint_t inPoint; /* In: Input point */ BCRYPT_ECCPoint_t outPoint; /* Out: output point, result of Scalar Multiplication */ } BCRYPT_ECDSASw_Multiply_t; /* ECDSA functions */ /***************************************************************************** Summary: This function implements the ECDSA Verify algorithm in SW. Description: This function implements the ECDSA Verify algorithm in software. It is based on the ECDSA implementation of the openssl code. The binaries of the openssl library is already included into the build environment. Calling Context: The function shall be called from application level or from driver level, for example in Linux during insmod. Performance and Timing: This is a synchronous/blocking function that will not return until it is done or failed. Input: hBcrypt - BCRYPT_Handle inoutp_ecdsaSwIO - BCRYPT_ECDSASw_Verify_t, a ref/pointer to the parameters for the SW implementation of the ECDSA Verify algorithm. Returns: BCRYPT_STATUS_eOK - success BCRYPT_STATUS_eFAILED - failure See Also: BCrypt_ECDSASignSw, BCrypt_ECDSAMultiplySw ******************************************************************************/ BCRYPT_STATUS_eCode BCrypt_ECDSAVerifySw( BCRYPT_Handle hBcrypt, BCRYPT_ECDSASw_Verify_t *inoutp_ecdsaSwIO ); /***************************************************************************** Summary: This function implements the ECDSA Sign algorithm in SW. Description: This function implements the ECDSA Sign algorithm in software. It is based on the ECDSA implementation of the openssl code. The binaries of the openssl library is already included into the build environment. Calling Context: The function shall be called from application level or from driver level, for example in Linux during insmod. Performance and Timing: This is a synchronous/blocking function that will not return until it is done or failed. Input: hBcrypt - BCRYPT_Handle inoutp_ecdsaSwIO - BCRYPT_ECDSASw_Sign_t, a ref/pointer to the parameters for the SW implementation of the ECDSA Sign algorithm. Returns: BCRYPT_STATUS_eOK - success BCRYPT_STATUS_eFAILED - failure See Also: BCrypt_ECDSAVerifySw, BCrypt_ECDSAMultiplySw ******************************************************************************/ BCRYPT_STATUS_eCode BCrypt_ECDSASignSw( BCRYPT_Handle hBcrypt, BCRYPT_ECDSASw_Sign_t *inoutp_ecdsaSwIO ); /***************************************************************************** Summary: This function cleans up the ECDSA paramter allocated by OpenSSL. Description: This function cleans the ECDSA paramter allocated by OpenSSL. Specifically, during the call to ECDSASignSw the function allocates memory for the sig.r or sig.s using the BN_bn2dec or BN_bn2hex these needs to be freed by calling the OPNESSL_free once. Thius function allows the user of the ECDSASignSw to free up these memory once it has done using them. Calling Context: The function shall be called from application level or from driver level, for example in Linux during insmod. Performance and Timing: This is a synchronous/blocking function that will not return until it is done or failed. Input: hBcrypt - BCRYPT_Handle inoutp_ecdsaSwIO - BCRYPT_ECDSASw_Sign_t, a ref/pointer to the parameters for the SW implementation of the ECDSA Sign algorithm. Returns: BCRYPT_STATUS_eOK - success BCRYPT_STATUS_eFAILED - failure See Also: BCrypt_ECDSAVerifySw, BCrypt_ECDSAMultiplySw ******************************************************************************/ BCRYPT_STATUS_eCode BCrypt_Sign_ECDSAClean( BCRYPT_Handle hBcrypt, BCRYPT_ECDSASw_Sign_t *inoutp_ecdsaSwIO ); /***************************************************************************** Summary: This function cleans up the ECDSA paramter allocated by OpenSSL. Description: This function cleans the ECDSA paramter allocated by OpenSSL. Specifically, during the call to ECDSAMultiplySw the function allocates memory for the sig.r or sig.s using the BN_bn2dec or BN_bn2hex these needs to be freed by calling the OPNESSL_free once. Thius function allows the user of the ECDSAMultiplySw to free up these memory once it has done using them. Calling Context: The function shall be called from application level or from driver level, for example in Linux during insmod. Performance and Timing: This is a synchronous/blocking function that will not return until it is done or failed. Input: hBcrypt - BCRYPT_Handle inoutp_ecdsaSwIO - BCRYPT_ECDSASw_Multiply_t, a ref/pointer to the parameters for the SW implementation of the ECDSA Sign algorithm. Returns: BCRYPT_STATUS_eOK - success BCRYPT_STATUS_eFAILED - failure See Also: BCrypt_Sign_ECDSAClean ******************************************************************************/ BCRYPT_STATUS_eCode BCrypt_Multiply_ECDSAClean( BCRYPT_Handle hBcrypt, BCRYPT_ECDSASw_Multiply_t *inoutp_ecdsaSwIO ); /***************************************************************************** Summary: This function implements the EC Scalar Multiplication algorithm in SW. Description: This function implements theEC Scalar Multiplication algorithm in software. It is based on the EC Scalar Multiplication implementation of the openssl code. The binaries of the openssl library is already included into the build environment. Calling Context: The function shall be called from application level or from driver level, for example in Linux during insmod. Performance and Timing: This is a synchronous/blocking function that will not return until it is done or failed. Input: hBcrypt - BCRYPT_Handle inoutp_ecdsaSwIO - BCRYPT_ECDSASw_Multiply_t, a ref/pointer to the parameters for the SW implementation of the EC Scalar Multiplication algorithm. Returns: BCRYPT_STATUS_eOK - success BCRYPT_STATUS_eFAILED - failure See Also: BCrypt_ECDSASignSw, BCrypt_ECDSAVerifySw ******************************************************************************/ BCRYPT_STATUS_eCode BCrypt_ECDSAMultiplySw( BCRYPT_Handle hBcrypt, BCRYPT_ECDSASw_Multiply_t *inoutp_ecdsaSwIO ); /* Number conversion utility functions */ typedef enum { BCRYPT_String_Format_Decimal = 0, BCRYPT_String_Format_Hex } BCRYPT_String_Format_t; /***************************************************************************** Summary: This function Converts Binary to String. Description: This function Converts Binary to String. It is based on the implementation of the openssl code. The binaries of the openssl library is already included into the build environment. Calling Context: The function shall be called from application level or from driver level, for example in Linux during insmod. Performance and Timing: This is a synchronous/blocking function that will not return until it is done or failed. Input: hBcrypt - BCRYPT_Handle data - unsigned char, a ref/pointer to data to be converted . byteLen - unsigned long, length of data in bytes. format - BCRYPT_String_Format_t, format of input string. Output: outStr - char, a ref/pointer to output string. Returns: BCRYPT_STATUS_eOK - success BCRYPT_STATUS_eFAILED - failure See Also: BCrypt_ConvStrToBin ******************************************************************************/ BCRYPT_STATUS_eCode BCrypt_ConvBinToStr( BCRYPT_Handle hBcrypt, unsigned char *data, unsigned long byteLen, BCRYPT_String_Format_t format, char *outStr ); /***************************************************************************** Summary: This function Converts String to Binary. Description: This function Converts String to Binary. It is based on the implementation of the openssl code. The binaries of the openssl library is already included into the build environment. Calling Context: The function shall be called from application level or from driver level, for example in Linux during insmod. Performance and Timing: This is a synchronous/blocking function that will not return until it is done or failed. Input: hBcrypt - BCRYPT_Handle inStr - char, a ref/pointer to input string. format - BCRYPT_String_Format_t, format of input string. Output: data - unsigned char, a ref/pointer to binary data. byteLen - unsigned long, a ref/pointer to the length of data in bytes. Returns: BCRYPT_STATUS_eOK - success BCRYPT_STATUS_eFAILED - failure See Also: BCrypt_ConvBinToStr ******************************************************************************/ BCRYPT_STATUS_eCode BCrypt_ConvStrToBin( BCRYPT_Handle hBcrypt, char *inStr, BCRYPT_String_Format_t format, unsigned char *data, unsigned long *byteLen ); #ifdef __cplusplus } #endif #endif /* BCRYPT_H__ */