jl777
9 years ago
7 changed files with 974 additions and 0 deletions
@ -0,0 +1,111 @@ |
|||||
|
/* crypto/cryptlib.h */ |
||||
|
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
|
* All rights reserved. |
||||
|
* |
||||
|
* This package is an SSL implementation written |
||||
|
* by Eric Young (eay@cryptsoft.com). |
||||
|
* The implementation was written so as to conform with Netscapes SSL. |
||||
|
* |
||||
|
* This library is free for commercial and non-commercial use as long as |
||||
|
* the following conditions are aheared to. The following conditions |
||||
|
* apply to all code found in this distribution, be it the RC4, RSA, |
||||
|
* lhash, DES, etc., code; not just the SSL code. The SSL documentation |
||||
|
* included with this distribution is covered by the same copyright terms |
||||
|
* except that the holder is Tim Hudson (tjh@cryptsoft.com). |
||||
|
* |
||||
|
* Copyright remains Eric Young's, and as such any Copyright notices in |
||||
|
* the code are not to be removed. |
||||
|
* If this package is used in a product, Eric Young should be given attribution |
||||
|
* as the author of the parts of the library used. |
||||
|
* This can be in the form of a textual message at program startup or |
||||
|
* in documentation (online or textual) provided with the package. |
||||
|
* |
||||
|
* Redistribution and use in source and binary forms, with or without |
||||
|
* modification, are permitted provided that the following conditions |
||||
|
* are met: |
||||
|
* 1. Redistributions of source code must retain the copyright |
||||
|
* notice, this list of conditions and the following disclaimer. |
||||
|
* 2. Redistributions in binary form must reproduce the above copyright |
||||
|
* notice, this list of conditions and the following disclaimer in the |
||||
|
* documentation and/or other materials provided with the distribution. |
||||
|
* 3. All advertising materials mentioning features or use of this software |
||||
|
* must display the following acknowledgement: |
||||
|
* "This product includes cryptographic software written by |
||||
|
* Eric Young (eay@cryptsoft.com)" |
||||
|
* The word 'cryptographic' can be left out if the rouines from the library |
||||
|
* being used are not cryptographic related :-). |
||||
|
* 4. If you include any Windows specific code (or a derivative thereof) from |
||||
|
* the apps directory (application code) you must include an acknowledgement: |
||||
|
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" |
||||
|
* |
||||
|
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND |
||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE |
||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
||||
|
* SUCH DAMAGE. |
||||
|
* |
||||
|
* The licence and distribution terms for any publically available version or |
||||
|
* derivative of this code cannot be changed. i.e. this code cannot simply be |
||||
|
* copied and put under another distribution licence |
||||
|
* [including the GNU Public Licence.] |
||||
|
*/ |
||||
|
|
||||
|
#ifndef HEADER_CRYPTLIB_H |
||||
|
#define HEADER_CRYPTLIB_H |
||||
|
|
||||
|
#include <stdlib.h> |
||||
|
#include <string.h> |
||||
|
|
||||
|
#include "e_os.h" |
||||
|
|
||||
|
#ifdef OPENSSL_USE_APPLINK |
||||
|
#define BIO_FLAGS_UPLINK 0x8000 |
||||
|
#include "ms/uplink.h" |
||||
|
#endif |
||||
|
|
||||
|
#include <openssl/crypto.h> |
||||
|
#include <openssl/buffer.h> |
||||
|
#include <openssl/bio.h> |
||||
|
#include <openssl/err.h> |
||||
|
#include <openssl/opensslconf.h> |
||||
|
|
||||
|
#ifdef __cplusplus |
||||
|
extern "C" { |
||||
|
#endif |
||||
|
|
||||
|
#ifndef OPENSSL_SYS_VMS |
||||
|
#define X509_CERT_AREA OPENSSLDIR |
||||
|
#define X509_CERT_DIR OPENSSLDIR "/certs" |
||||
|
#define X509_CERT_FILE OPENSSLDIR "/cert.pem" |
||||
|
#define X509_PRIVATE_DIR OPENSSLDIR "/private" |
||||
|
#else |
||||
|
#define X509_CERT_AREA "SSLROOT:[000000]" |
||||
|
#define X509_CERT_DIR "SSLCERTS:" |
||||
|
#define X509_CERT_FILE "SSLCERTS:cert.pem" |
||||
|
#define X509_PRIVATE_DIR "SSLPRIVATE:" |
||||
|
#endif |
||||
|
|
||||
|
#define X509_CERT_DIR_EVP "SSL_CERT_DIR" |
||||
|
#define X509_CERT_FILE_EVP "SSL_CERT_FILE" |
||||
|
|
||||
|
/* size of string representations */ |
||||
|
#define DECIMAL_SIZE(type) ((sizeof(type)*8+2)/3+1) |
||||
|
#define HEX_SIZE(type) (sizeof(type)*2) |
||||
|
|
||||
|
void OPENSSL_cpuid_setup(void); |
||||
|
extern unsigned int OPENSSL_ia32cap_P[]; |
||||
|
void OPENSSL_showfatal(const char *fmta,...); |
||||
|
void *OPENSSL_stderr(void); |
||||
|
extern int OPENSSL_NONPIC_relocated; |
||||
|
|
||||
|
#ifdef __cplusplus |
||||
|
} |
||||
|
#endif |
||||
|
|
||||
|
#endif |
@ -0,0 +1,209 @@ |
|||||
|
/* crypto/fips_err.h */ |
||||
|
/* ====================================================================
|
||||
|
* Copyright (c) 1999-2011 The OpenSSL Project. All rights reserved. |
||||
|
* |
||||
|
* Redistribution and use in source and binary forms, with or without |
||||
|
* modification, are permitted provided that the following conditions |
||||
|
* are met: |
||||
|
* |
||||
|
* 1. Redistributions of source code must retain the above copyright |
||||
|
* notice, this list of conditions and the following disclaimer. |
||||
|
* |
||||
|
* 2. Redistributions in binary form must reproduce the above copyright |
||||
|
* notice, this list of conditions and the following disclaimer in |
||||
|
* the documentation and/or other materials provided with the |
||||
|
* distribution. |
||||
|
* |
||||
|
* 3. All advertising materials mentioning features or use of this |
||||
|
* software must display the following acknowledgment: |
||||
|
* "This product includes software developed by the OpenSSL Project |
||||
|
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
||||
|
* |
||||
|
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to |
||||
|
* endorse or promote products derived from this software without |
||||
|
* prior written permission. For written permission, please contact |
||||
|
* openssl-core@OpenSSL.org. |
||||
|
* |
||||
|
* 5. Products derived from this software may not be called "OpenSSL" |
||||
|
* nor may "OpenSSL" appear in their names without prior written |
||||
|
* permission of the OpenSSL Project. |
||||
|
* |
||||
|
* 6. Redistributions of any form whatsoever must retain the following |
||||
|
* acknowledgment: |
||||
|
* "This product includes software developed by the OpenSSL Project |
||||
|
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
||||
|
* |
||||
|
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY |
||||
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR |
||||
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
||||
|
* OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
|
* ==================================================================== |
||||
|
* |
||||
|
* This product includes cryptographic software written by Eric Young |
||||
|
* (eay@cryptsoft.com). This product includes software written by Tim |
||||
|
* Hudson (tjh@cryptsoft.com). |
||||
|
* |
||||
|
*/ |
||||
|
|
||||
|
/* NOTE: this file was auto generated by the mkerr.pl script: any changes
|
||||
|
* made to it will be overwritten when the script next updates this file, |
||||
|
* only reason strings will be preserved. |
||||
|
*/ |
||||
|
|
||||
|
#include <stdio.h> |
||||
|
#include <openssl/err.h> |
||||
|
#include <openssl/fips.h> |
||||
|
|
||||
|
/* BEGIN ERROR CODES */ |
||||
|
#ifndef OPENSSL_NO_ERR |
||||
|
|
||||
|
#define ERR_FUNC(func) ERR_PACK(ERR_LIB_FIPS,func,0) |
||||
|
#define ERR_REASON(reason) ERR_PACK(ERR_LIB_FIPS,0,reason) |
||||
|
|
||||
|
static ERR_STRING_DATA FIPS_str_functs[]= |
||||
|
{ |
||||
|
{ERR_FUNC(FIPS_F_DH_BUILTIN_GENPARAMS), "DH_BUILTIN_GENPARAMS"}, |
||||
|
{ERR_FUNC(FIPS_F_DH_INIT), "DH_INIT"}, |
||||
|
{ERR_FUNC(FIPS_F_DRBG_RESEED), "DRBG_RESEED"}, |
||||
|
{ERR_FUNC(FIPS_F_DSA_BUILTIN_PARAMGEN), "DSA_BUILTIN_PARAMGEN"}, |
||||
|
{ERR_FUNC(FIPS_F_DSA_BUILTIN_PARAMGEN2), "DSA_BUILTIN_PARAMGEN2"}, |
||||
|
{ERR_FUNC(FIPS_F_DSA_DO_SIGN), "DSA_do_sign"}, |
||||
|
{ERR_FUNC(FIPS_F_DSA_DO_VERIFY), "DSA_do_verify"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_CHECK_DSA), "FIPS_CHECK_DSA"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_CHECK_DSA_PRNG), "fips_check_dsa_prng"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_CHECK_EC), "FIPS_CHECK_EC"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_CHECK_EC_PRNG), "fips_check_ec_prng"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_CHECK_INCORE_FINGERPRINT), "FIPS_check_incore_fingerprint"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_CHECK_RSA), "fips_check_rsa"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_CHECK_RSA_PRNG), "fips_check_rsa_prng"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_CIPHER), "FIPS_cipher"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_CIPHERINIT), "FIPS_cipherinit"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_CIPHER_CTX_CTRL), "FIPS_CIPHER_CTX_CTRL"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_DIGESTFINAL), "FIPS_digestfinal"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_DIGESTINIT), "FIPS_digestinit"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_DIGESTUPDATE), "FIPS_digestupdate"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_DRBG_BYTES), "FIPS_DRBG_BYTES"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_DRBG_CHECK), "FIPS_DRBG_CHECK"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_DRBG_CPRNG_TEST), "FIPS_DRBG_CPRNG_TEST"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_DRBG_ERROR_CHECK), "FIPS_DRBG_ERROR_CHECK"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_DRBG_GENERATE), "FIPS_drbg_generate"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_DRBG_INIT), "FIPS_drbg_init"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_DRBG_INSTANTIATE), "FIPS_drbg_instantiate"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_DRBG_NEW), "FIPS_drbg_new"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_DRBG_RESEED), "FIPS_drbg_reseed"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_DRBG_SINGLE_KAT), "FIPS_DRBG_SINGLE_KAT"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_DSA_SIGN_DIGEST), "FIPS_dsa_sign_digest"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_DSA_VERIFY_DIGEST), "FIPS_dsa_verify_digest"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_GET_ENTROPY), "FIPS_GET_ENTROPY"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_MODULE_MODE_SET), "FIPS_module_mode_set"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_PKEY_SIGNATURE_TEST), "fips_pkey_signature_test"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_RAND_ADD), "FIPS_rand_add"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_RAND_BYTES), "FIPS_rand_bytes"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_RAND_PSEUDO_BYTES), "FIPS_rand_pseudo_bytes"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_RAND_SEED), "FIPS_rand_seed"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_RAND_SET_METHOD), "FIPS_rand_set_method"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_RAND_STATUS), "FIPS_rand_status"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_RSA_SIGN_DIGEST), "FIPS_rsa_sign_digest"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_RSA_VERIFY_DIGEST), "FIPS_rsa_verify_digest"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_SELFTEST_AES), "FIPS_selftest_aes"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_SELFTEST_AES_CCM), "FIPS_selftest_aes_ccm"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_SELFTEST_AES_GCM), "FIPS_selftest_aes_gcm"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_SELFTEST_AES_XTS), "FIPS_selftest_aes_xts"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_SELFTEST_CMAC), "FIPS_selftest_cmac"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_SELFTEST_DES), "FIPS_selftest_des"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_SELFTEST_DSA), "FIPS_selftest_dsa"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_SELFTEST_ECDSA), "FIPS_selftest_ecdsa"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_SELFTEST_HMAC), "FIPS_selftest_hmac"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_SELFTEST_SHA1), "FIPS_selftest_sha1"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_SELFTEST_X931), "FIPS_selftest_x931"}, |
||||
|
{ERR_FUNC(FIPS_F_FIPS_SET_PRNG_KEY), "FIPS_SET_PRNG_KEY"}, |
||||
|
{ERR_FUNC(FIPS_F_HASH_FINAL), "HASH_FINAL"}, |
||||
|
{ERR_FUNC(FIPS_F_RSA_BUILTIN_KEYGEN), "RSA_BUILTIN_KEYGEN"}, |
||||
|
{ERR_FUNC(FIPS_F_RSA_EAY_INIT), "RSA_EAY_INIT"}, |
||||
|
{ERR_FUNC(FIPS_F_RSA_EAY_PRIVATE_DECRYPT), "RSA_EAY_PRIVATE_DECRYPT"}, |
||||
|
{ERR_FUNC(FIPS_F_RSA_EAY_PRIVATE_ENCRYPT), "RSA_EAY_PRIVATE_ENCRYPT"}, |
||||
|
{ERR_FUNC(FIPS_F_RSA_EAY_PUBLIC_DECRYPT), "RSA_EAY_PUBLIC_DECRYPT"}, |
||||
|
{ERR_FUNC(FIPS_F_RSA_EAY_PUBLIC_ENCRYPT), "RSA_EAY_PUBLIC_ENCRYPT"}, |
||||
|
{ERR_FUNC(FIPS_F_RSA_X931_GENERATE_KEY_EX), "RSA_X931_generate_key_ex"}, |
||||
|
{0,NULL} |
||||
|
}; |
||||
|
|
||||
|
static ERR_STRING_DATA FIPS_str_reasons[]= |
||||
|
{ |
||||
|
{ERR_REASON(FIPS_R_ADDITIONAL_INPUT_ERROR_UNDETECTED),"additional input error undetected"}, |
||||
|
{ERR_REASON(FIPS_R_ADDITIONAL_INPUT_TOO_LONG),"additional input too long"}, |
||||
|
{ERR_REASON(FIPS_R_ALREADY_INSTANTIATED) ,"already instantiated"}, |
||||
|
{ERR_REASON(FIPS_R_AUTHENTICATION_FAILURE),"authentication failure"}, |
||||
|
{ERR_REASON(FIPS_R_CONTRADICTING_EVIDENCE),"contradicting evidence"}, |
||||
|
{ERR_REASON(FIPS_R_DRBG_NOT_INITIALISED) ,"drbg not initialised"}, |
||||
|
{ERR_REASON(FIPS_R_DRBG_STUCK) ,"drbg stuck"}, |
||||
|
{ERR_REASON(FIPS_R_ENTROPY_ERROR_UNDETECTED),"entropy error undetected"}, |
||||
|
{ERR_REASON(FIPS_R_ENTROPY_NOT_REQUESTED_FOR_RESEED),"entropy not requested for reseed"}, |
||||
|
{ERR_REASON(FIPS_R_ENTROPY_SOURCE_STUCK) ,"entropy source stuck"}, |
||||
|
{ERR_REASON(FIPS_R_ERROR_INITIALISING_DRBG),"error initialising drbg"}, |
||||
|
{ERR_REASON(FIPS_R_ERROR_INSTANTIATING_DRBG),"error instantiating drbg"}, |
||||
|
{ERR_REASON(FIPS_R_ERROR_RETRIEVING_ADDITIONAL_INPUT),"error retrieving additional input"}, |
||||
|
{ERR_REASON(FIPS_R_ERROR_RETRIEVING_ENTROPY),"error retrieving entropy"}, |
||||
|
{ERR_REASON(FIPS_R_ERROR_RETRIEVING_NONCE),"error retrieving nonce"}, |
||||
|
{ERR_REASON(FIPS_R_FINGERPRINT_DOES_NOT_MATCH),"fingerprint does not match"}, |
||||
|
{ERR_REASON(FIPS_R_FINGERPRINT_DOES_NOT_MATCH_NONPIC_RELOCATED),"fingerprint does not match nonpic relocated"}, |
||||
|
{ERR_REASON(FIPS_R_FINGERPRINT_DOES_NOT_MATCH_SEGMENT_ALIASING),"fingerprint does not match segment aliasing"}, |
||||
|
{ERR_REASON(FIPS_R_FIPS_MODE_ALREADY_SET),"fips mode already set"}, |
||||
|
{ERR_REASON(FIPS_R_FIPS_SELFTEST_FAILED) ,"fips selftest failed"}, |
||||
|
{ERR_REASON(FIPS_R_FUNCTION_ERROR) ,"function error"}, |
||||
|
{ERR_REASON(FIPS_R_GENERATE_ERROR) ,"generate error"}, |
||||
|
{ERR_REASON(FIPS_R_GENERATE_ERROR_UNDETECTED),"generate error undetected"}, |
||||
|
{ERR_REASON(FIPS_R_INSTANTIATE_ERROR) ,"instantiate error"}, |
||||
|
{ERR_REASON(FIPS_R_INSUFFICIENT_SECURITY_STRENGTH),"insufficient security strength"}, |
||||
|
{ERR_REASON(FIPS_R_INTERNAL_ERROR) ,"internal error"}, |
||||
|
{ERR_REASON(FIPS_R_INVALID_KEY_LENGTH) ,"invalid key length"}, |
||||
|
{ERR_REASON(FIPS_R_INVALID_PARAMETERS) ,"invalid parameters"}, |
||||
|
{ERR_REASON(FIPS_R_IN_ERROR_STATE) ,"in error state"}, |
||||
|
{ERR_REASON(FIPS_R_KEY_TOO_SHORT) ,"key too short"}, |
||||
|
{ERR_REASON(FIPS_R_NONCE_ERROR_UNDETECTED),"nonce error undetected"}, |
||||
|
{ERR_REASON(FIPS_R_NON_FIPS_METHOD) ,"non fips method"}, |
||||
|
{ERR_REASON(FIPS_R_NOPR_TEST1_FAILURE) ,"nopr test1 failure"}, |
||||
|
{ERR_REASON(FIPS_R_NOPR_TEST2_FAILURE) ,"nopr test2 failure"}, |
||||
|
{ERR_REASON(FIPS_R_NOT_INSTANTIATED) ,"not instantiated"}, |
||||
|
{ERR_REASON(FIPS_R_PAIRWISE_TEST_FAILED) ,"pairwise test failed"}, |
||||
|
{ERR_REASON(FIPS_R_PERSONALISATION_ERROR_UNDETECTED),"personalisation error undetected"}, |
||||
|
{ERR_REASON(FIPS_R_PERSONALISATION_STRING_TOO_LONG),"personalisation string too long"}, |
||||
|
{ERR_REASON(FIPS_R_PRNG_STRENGTH_TOO_LOW),"prng strength too low"}, |
||||
|
{ERR_REASON(FIPS_R_PR_TEST1_FAILURE) ,"pr test1 failure"}, |
||||
|
{ERR_REASON(FIPS_R_PR_TEST2_FAILURE) ,"pr test2 failure"}, |
||||
|
{ERR_REASON(FIPS_R_REQUEST_LENGTH_ERROR_UNDETECTED),"request length error undetected"}, |
||||
|
{ERR_REASON(FIPS_R_REQUEST_TOO_LARGE_FOR_DRBG),"request too large for drbg"}, |
||||
|
{ERR_REASON(FIPS_R_RESEED_COUNTER_ERROR) ,"reseed counter error"}, |
||||
|
{ERR_REASON(FIPS_R_RESEED_ERROR) ,"reseed error"}, |
||||
|
{ERR_REASON(FIPS_R_SELFTEST_FAILED) ,"selftest failed"}, |
||||
|
{ERR_REASON(FIPS_R_SELFTEST_FAILURE) ,"selftest failure"}, |
||||
|
{ERR_REASON(FIPS_R_STRENGTH_ERROR_UNDETECTED),"strength error undetected"}, |
||||
|
{ERR_REASON(FIPS_R_TEST_FAILURE) ,"test failure"}, |
||||
|
{ERR_REASON(FIPS_R_UNINSTANTIATE_ERROR) ,"uninstantiate error"}, |
||||
|
{ERR_REASON(FIPS_R_UNINSTANTIATE_ZEROISE_ERROR),"uninstantiate zeroise error"}, |
||||
|
{ERR_REASON(FIPS_R_UNSUPPORTED_DRBG_TYPE),"unsupported drbg type"}, |
||||
|
{ERR_REASON(FIPS_R_UNSUPPORTED_PLATFORM) ,"unsupported platform"}, |
||||
|
{0,NULL} |
||||
|
}; |
||||
|
|
||||
|
#endif |
||||
|
|
||||
|
void ERR_load_FIPS_strings(void) |
||||
|
{ |
||||
|
#ifndef OPENSSL_NO_ERR |
||||
|
|
||||
|
if (ERR_func_error_string(FIPS_str_functs[0].error) == NULL) |
||||
|
{ |
||||
|
ERR_load_strings(0,FIPS_str_functs); |
||||
|
ERR_load_strings(0,FIPS_str_reasons); |
||||
|
} |
||||
|
#endif |
||||
|
} |
@ -0,0 +1,415 @@ |
|||||
|
/* crypto/md32_common.h */ |
||||
|
/* ====================================================================
|
||||
|
* Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. |
||||
|
* |
||||
|
* Redistribution and use in source and binary forms, with or without |
||||
|
* modification, are permitted provided that the following conditions |
||||
|
* are met: |
||||
|
* |
||||
|
* 1. Redistributions of source code must retain the above copyright |
||||
|
* notice, this list of conditions and the following disclaimer. |
||||
|
* |
||||
|
* 2. Redistributions in binary form must reproduce the above copyright |
||||
|
* notice, this list of conditions and the following disclaimer in |
||||
|
* the documentation and/or other materials provided with the |
||||
|
* distribution. |
||||
|
* |
||||
|
* 3. All advertising materials mentioning features or use of this |
||||
|
* software must display the following acknowledgment: |
||||
|
* "This product includes software developed by the OpenSSL Project |
||||
|
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
||||
|
* |
||||
|
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to |
||||
|
* endorse or promote products derived from this software without |
||||
|
* prior written permission. For written permission, please contact |
||||
|
* licensing@OpenSSL.org. |
||||
|
* |
||||
|
* 5. Products derived from this software may not be called "OpenSSL" |
||||
|
* nor may "OpenSSL" appear in their names without prior written |
||||
|
* permission of the OpenSSL Project. |
||||
|
* |
||||
|
* 6. Redistributions of any form whatsoever must retain the following |
||||
|
* acknowledgment: |
||||
|
* "This product includes software developed by the OpenSSL Project |
||||
|
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
||||
|
* |
||||
|
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY |
||||
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR |
||||
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
||||
|
* OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
|
* ==================================================================== |
||||
|
* |
||||
|
*/ |
||||
|
|
||||
|
/*
|
||||
|
* This is a generic 32 bit "collector" for message digest algorithms. |
||||
|
* Whenever needed it collects input character stream into chunks of |
||||
|
* 32 bit values and invokes a block function that performs actual hash |
||||
|
* calculations. |
||||
|
* |
||||
|
* Porting guide. |
||||
|
* |
||||
|
* Obligatory macros: |
||||
|
* |
||||
|
* DATA_ORDER_IS_BIG_ENDIAN or DATA_ORDER_IS_LITTLE_ENDIAN |
||||
|
* this macro defines byte order of input stream. |
||||
|
* HASH_CBLOCK |
||||
|
* size of a unit chunk HASH_BLOCK operates on. |
||||
|
* HASH_LONG |
||||
|
* has to be at lest 32 bit wide, if it's wider, then |
||||
|
* HASH_LONG_LOG2 *has to* be defined along |
||||
|
* HASH_CTX |
||||
|
* context structure that at least contains following |
||||
|
* members: |
||||
|
* typedef struct { |
||||
|
* ... |
||||
|
* HASH_LONG Nl,Nh; |
||||
|
* either { |
||||
|
* HASH_LONG data[HASH_LBLOCK]; |
||||
|
* unsigned char data[HASH_CBLOCK]; |
||||
|
* }; |
||||
|
* unsigned int num; |
||||
|
* ... |
||||
|
* } HASH_CTX; |
||||
|
* data[] vector is expected to be zeroed upon first call to |
||||
|
* HASH_UPDATE. |
||||
|
* HASH_UPDATE |
||||
|
* name of "Update" function, implemented here. |
||||
|
* HASH_TRANSFORM |
||||
|
* name of "Transform" function, implemented here. |
||||
|
* HASH_FINAL |
||||
|
* name of "Final" function, implemented here. |
||||
|
* HASH_BLOCK_DATA_ORDER |
||||
|
* name of "block" function capable of treating *unaligned* input |
||||
|
* message in original (data) byte order, implemented externally. |
||||
|
* HASH_MAKE_STRING |
||||
|
* macro convering context variables to an ASCII hash string. |
||||
|
* |
||||
|
* MD5 example: |
||||
|
* |
||||
|
* #define DATA_ORDER_IS_LITTLE_ENDIAN |
||||
|
* |
||||
|
* #define HASH_LONG MD5_LONG |
||||
|
* #define HASH_LONG_LOG2 MD5_LONG_LOG2 |
||||
|
* #define HASH_CTX MD5_CTX |
||||
|
* #define HASH_CBLOCK MD5_CBLOCK |
||||
|
* #define HASH_UPDATE MD5_Update |
||||
|
* #define HASH_TRANSFORM MD5_Transform |
||||
|
* #define HASH_FINAL MD5_Final |
||||
|
* #define HASH_BLOCK_DATA_ORDER md5_block_data_order |
||||
|
* |
||||
|
* <appro@fy.chalmers.se> |
||||
|
*/ |
||||
|
|
||||
|
#if !defined(DATA_ORDER_IS_BIG_ENDIAN) && !defined(DATA_ORDER_IS_LITTLE_ENDIAN) |
||||
|
#error "DATA_ORDER must be defined!" |
||||
|
#endif |
||||
|
|
||||
|
#ifndef HASH_CBLOCK |
||||
|
#error "HASH_CBLOCK must be defined!" |
||||
|
#endif |
||||
|
#ifndef HASH_LONG |
||||
|
#error "HASH_LONG must be defined!" |
||||
|
#endif |
||||
|
#ifndef HASH_CTX |
||||
|
#error "HASH_CTX must be defined!" |
||||
|
#endif |
||||
|
|
||||
|
#ifndef HASH_UPDATE |
||||
|
#error "HASH_UPDATE must be defined!" |
||||
|
#endif |
||||
|
#ifndef HASH_TRANSFORM |
||||
|
#error "HASH_TRANSFORM must be defined!" |
||||
|
#endif |
||||
|
#ifndef HASH_FINAL |
||||
|
#error "HASH_FINAL must be defined!" |
||||
|
#endif |
||||
|
|
||||
|
#ifndef HASH_BLOCK_DATA_ORDER |
||||
|
#error "HASH_BLOCK_DATA_ORDER must be defined!" |
||||
|
#endif |
||||
|
|
||||
|
/*
|
||||
|
* Engage compiler specific rotate intrinsic function if available. |
||||
|
*/ |
||||
|
#undef ROTATE |
||||
|
#ifndef PEDANTIC |
||||
|
# if defined(_MSC_VER) || defined(__ICC) |
||||
|
# define ROTATE(a,n) _lrotl(a,n) |
||||
|
# elif defined(__MWERKS__) |
||||
|
# if defined(__POWERPC__) |
||||
|
# define ROTATE(a,n) __rlwinm(a,n,0,31) |
||||
|
# elif defined(__MC68K__) |
||||
|
/* Motorola specific tweak. <appro@fy.chalmers.se> */ |
||||
|
# define ROTATE(a,n) ( n<24 ? __rol(a,n) : __ror(a,32-n) ) |
||||
|
# else |
||||
|
# define ROTATE(a,n) __rol(a,n) |
||||
|
# endif |
||||
|
# elif defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) |
||||
|
/*
|
||||
|
* Some GNU C inline assembler templates. Note that these are |
||||
|
* rotates by *constant* number of bits! But that's exactly |
||||
|
* what we need here... |
||||
|
* <appro@fy.chalmers.se> |
||||
|
*/ |
||||
|
# if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__) |
||||
|
# define ROTATE(a,n) ({ register unsigned int ret; \ |
||||
|
asm ( \ |
||||
|
"roll %1,%0" \ |
||||
|
: "=r"(ret) \ |
||||
|
: "I"(n), "0"((unsigned int)(a)) \ |
||||
|
: "cc"); \ |
||||
|
ret; \ |
||||
|
}) |
||||
|
# elif defined(_ARCH_PPC) || defined(_ARCH_PPC64) || \ |
||||
|
defined(__powerpc) || defined(__ppc__) || defined(__powerpc64__) |
||||
|
# define ROTATE(a,n) ({ register unsigned int ret; \ |
||||
|
asm ( \ |
||||
|
"rlwinm %0,%1,%2,0,31" \ |
||||
|
: "=r"(ret) \ |
||||
|
: "r"(a), "I"(n)); \ |
||||
|
ret; \ |
||||
|
}) |
||||
|
# elif defined(__s390x__) |
||||
|
# define ROTATE(a,n) ({ register unsigned int ret; \ |
||||
|
asm ("rll %0,%1,%2" \ |
||||
|
: "=r"(ret) \ |
||||
|
: "r"(a), "I"(n)); \ |
||||
|
ret; \ |
||||
|
}) |
||||
|
# endif |
||||
|
# endif |
||||
|
#endif /* PEDANTIC */ |
||||
|
|
||||
|
#ifndef ROTATE |
||||
|
#define ROTATE(a,n) (((a)<<(n))|(((a)&0xffffffff)>>(32-(n)))) |
||||
|
#endif |
||||
|
|
||||
|
#if defined(DATA_ORDER_IS_BIG_ENDIAN) |
||||
|
|
||||
|
#ifndef PEDANTIC |
||||
|
# if defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) |
||||
|
# if ((defined(__i386) || defined(__i386__)) && !defined(I386_ONLY)) || \ |
||||
|
(defined(__x86_64) || defined(__x86_64__)) |
||||
|
# if !defined(B_ENDIAN) |
||||
|
/*
|
||||
|
* This gives ~30-40% performance improvement in SHA-256 compiled |
||||
|
* with gcc [on P4]. Well, first macro to be frank. We can pull |
||||
|
* this trick on x86* platforms only, because these CPUs can fetch |
||||
|
* unaligned data without raising an exception. |
||||
|
*/ |
||||
|
# define HOST_c2l(c,l) ({ unsigned int r=*((const unsigned int *)(c)); \ |
||||
|
asm ("bswapl %0":"=r"(r):"0"(r)); \ |
||||
|
(c)+=4; (l)=r; }) |
||||
|
# define HOST_l2c(l,c) ({ unsigned int r=(l); \ |
||||
|
asm ("bswapl %0":"=r"(r):"0"(r)); \ |
||||
|
*((unsigned int *)(c))=r; (c)+=4; r; }) |
||||
|
# endif |
||||
|
# endif |
||||
|
# endif |
||||
|
#endif |
||||
|
#if defined(__s390__) || defined(__s390x__) |
||||
|
# define HOST_c2l(c,l) ((l)=*((const unsigned int *)(c)), (c)+=4, (l)) |
||||
|
# define HOST_l2c(l,c) (*((unsigned int *)(c))=(l), (c)+=4, (l)) |
||||
|
#endif |
||||
|
|
||||
|
#ifndef HOST_c2l |
||||
|
#define HOST_c2l(c,l) (l =(((unsigned long)(*((c)++)))<<24), \ |
||||
|
l|=(((unsigned long)(*((c)++)))<<16), \ |
||||
|
l|=(((unsigned long)(*((c)++)))<< 8), \ |
||||
|
l|=(((unsigned long)(*((c)++))) ), \ |
||||
|
l) |
||||
|
#endif |
||||
|
#ifndef HOST_l2c |
||||
|
#define HOST_l2c(l,c) (*((c)++)=(unsigned char)(((l)>>24)&0xff), \ |
||||
|
*((c)++)=(unsigned char)(((l)>>16)&0xff), \ |
||||
|
*((c)++)=(unsigned char)(((l)>> 8)&0xff), \ |
||||
|
*((c)++)=(unsigned char)(((l) )&0xff), \ |
||||
|
l) |
||||
|
#endif |
||||
|
|
||||
|
#elif defined(DATA_ORDER_IS_LITTLE_ENDIAN) |
||||
|
|
||||
|
#ifndef PEDANTIC |
||||
|
# if defined(__GNUC__) && __GNUC__>=2 && !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_NO_INLINE_ASM) |
||||
|
# if defined(__s390x__) |
||||
|
# define HOST_c2l(c,l) ({ asm ("lrv %0,%1" \ |
||||
|
:"=d"(l) :"m"(*(const unsigned int *)(c)));\ |
||||
|
(c)+=4; (l); }) |
||||
|
# define HOST_l2c(l,c) ({ asm ("strv %1,%0" \ |
||||
|
:"=m"(*(unsigned int *)(c)) :"d"(l));\ |
||||
|
(c)+=4; (l); }) |
||||
|
# endif |
||||
|
# endif |
||||
|
#endif |
||||
|
#if defined(__i386) || defined(__i386__) || defined(__x86_64) || defined(__x86_64__) |
||||
|
# ifndef B_ENDIAN |
||||
|
/* See comment in DATA_ORDER_IS_BIG_ENDIAN section. */ |
||||
|
# define HOST_c2l(c,l) ((l)=*((const unsigned int *)(c)), (c)+=4, l) |
||||
|
# define HOST_l2c(l,c) (*((unsigned int *)(c))=(l), (c)+=4, l) |
||||
|
# endif |
||||
|
#endif |
||||
|
|
||||
|
#ifndef HOST_c2l |
||||
|
#define HOST_c2l(c,l) (l =(((unsigned long)(*((c)++))) ), \ |
||||
|
l|=(((unsigned long)(*((c)++)))<< 8), \ |
||||
|
l|=(((unsigned long)(*((c)++)))<<16), \ |
||||
|
l|=(((unsigned long)(*((c)++)))<<24), \ |
||||
|
l) |
||||
|
#endif |
||||
|
#ifndef HOST_l2c |
||||
|
#define HOST_l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ |
||||
|
*((c)++)=(unsigned char)(((l)>> 8)&0xff), \ |
||||
|
*((c)++)=(unsigned char)(((l)>>16)&0xff), \ |
||||
|
*((c)++)=(unsigned char)(((l)>>24)&0xff), \ |
||||
|
l) |
||||
|
#endif |
||||
|
|
||||
|
#endif |
||||
|
|
||||
|
/*
|
||||
|
* Time for some action:-) |
||||
|
*/ |
||||
|
|
||||
|
int HASH_UPDATE (HASH_CTX *c, const void *data_, size_t len) |
||||
|
{ |
||||
|
const unsigned char *data=data_; |
||||
|
unsigned char *p; |
||||
|
HASH_LONG l; |
||||
|
size_t n; |
||||
|
|
||||
|
if (len==0) return 1; |
||||
|
|
||||
|
l=(c->Nl+(((HASH_LONG)len)<<3))&0xffffffffUL; |
||||
|
/* 95-05-24 eay Fixed a bug with the overflow handling, thanks to
|
||||
|
* Wei Dai <weidai@eskimo.com> for pointing it out. */ |
||||
|
if (l < c->Nl) /* overflow */ |
||||
|
c->Nh++; |
||||
|
c->Nh+=(HASH_LONG)(len>>29); /* might cause compiler warning on 16-bit */ |
||||
|
c->Nl=l; |
||||
|
|
||||
|
n = c->num; |
||||
|
if (n != 0) |
||||
|
{ |
||||
|
p=(unsigned char *)c->data; |
||||
|
|
||||
|
if (len >= HASH_CBLOCK || len+n >= HASH_CBLOCK) |
||||
|
{ |
||||
|
memcpy (p+n,data,HASH_CBLOCK-n); |
||||
|
HASH_BLOCK_DATA_ORDER (c,p,1); |
||||
|
n = HASH_CBLOCK-n; |
||||
|
data += n; |
||||
|
len -= n; |
||||
|
c->num = 0; |
||||
|
memset (p,0,HASH_CBLOCK); /* keep it zeroed */ |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
memcpy (p+n,data,len); |
||||
|
c->num += (unsigned int)len; |
||||
|
return 1; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
n = len/HASH_CBLOCK; |
||||
|
if (n > 0) |
||||
|
{ |
||||
|
HASH_BLOCK_DATA_ORDER (c,data,n); |
||||
|
n *= HASH_CBLOCK; |
||||
|
data += n; |
||||
|
len -= n; |
||||
|
} |
||||
|
|
||||
|
if (len != 0) |
||||
|
{ |
||||
|
p = (unsigned char *)c->data; |
||||
|
c->num = (unsigned int)len; |
||||
|
memcpy (p,data,len); |
||||
|
} |
||||
|
return 1; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
void HASH_TRANSFORM (HASH_CTX *c, const unsigned char *data) |
||||
|
{ |
||||
|
HASH_BLOCK_DATA_ORDER (c,data,1); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
int HASH_FINAL (unsigned char *md, HASH_CTX *c) |
||||
|
{ |
||||
|
unsigned char *p = (unsigned char *)c->data; |
||||
|
size_t n = c->num; |
||||
|
|
||||
|
p[n] = 0x80; /* there is always room for one */ |
||||
|
n++; |
||||
|
|
||||
|
if (n > (HASH_CBLOCK-8)) |
||||
|
{ |
||||
|
memset (p+n,0,HASH_CBLOCK-n); |
||||
|
n=0; |
||||
|
HASH_BLOCK_DATA_ORDER (c,p,1); |
||||
|
} |
||||
|
memset (p+n,0,HASH_CBLOCK-8-n); |
||||
|
|
||||
|
p += HASH_CBLOCK-8; |
||||
|
#if defined(DATA_ORDER_IS_BIG_ENDIAN) |
||||
|
(void)HOST_l2c(c->Nh,p); |
||||
|
(void)HOST_l2c(c->Nl,p); |
||||
|
#elif defined(DATA_ORDER_IS_LITTLE_ENDIAN) |
||||
|
(void)HOST_l2c(c->Nl,p); |
||||
|
(void)HOST_l2c(c->Nh,p); |
||||
|
#endif |
||||
|
p -= HASH_CBLOCK; |
||||
|
HASH_BLOCK_DATA_ORDER (c,p,1); |
||||
|
c->num=0; |
||||
|
memset (p,0,HASH_CBLOCK); |
||||
|
|
||||
|
#ifndef HASH_MAKE_STRING |
||||
|
#error "HASH_MAKE_STRING must be defined!" |
||||
|
#else |
||||
|
HASH_MAKE_STRING(c,md); |
||||
|
#endif |
||||
|
|
||||
|
return 1; |
||||
|
} |
||||
|
|
||||
|
#ifndef MD32_REG_T |
||||
|
#if defined(__alpha) || defined(__sparcv9) || defined(__mips) |
||||
|
#define MD32_REG_T long |
||||
|
/*
|
||||
|
* This comment was originaly written for MD5, which is why it |
||||
|
* discusses A-D. But it basically applies to all 32-bit digests, |
||||
|
* which is why it was moved to common header file. |
||||
|
* |
||||
|
* In case you wonder why A-D are declared as long and not |
||||
|
* as MD5_LONG. Doing so results in slight performance |
||||
|
* boost on LP64 architectures. The catch is we don't |
||||
|
* really care if 32 MSBs of a 64-bit register get polluted |
||||
|
* with eventual overflows as we *save* only 32 LSBs in |
||||
|
* *either* case. Now declaring 'em long excuses the compiler |
||||
|
* from keeping 32 MSBs zeroed resulting in 13% performance |
||||
|
* improvement under SPARC Solaris7/64 and 5% under AlphaLinux. |
||||
|
* Well, to be honest it should say that this *prevents* |
||||
|
* performance degradation. |
||||
|
* <appro@fy.chalmers.se> |
||||
|
*/ |
||||
|
#else |
||||
|
/*
|
||||
|
* Above is not absolute and there are LP64 compilers that |
||||
|
* generate better code if MD32_REG_T is defined int. The above |
||||
|
* pre-processor condition reflects the circumstances under which |
||||
|
* the conclusion was made and is subject to further extension. |
||||
|
* <appro@fy.chalmers.se> |
||||
|
*/ |
||||
|
#define MD32_REG_T int |
||||
|
#endif |
||||
|
#endif |
@ -0,0 +1,53 @@ |
|||||
|
/* crypto/o_dir.h -*- mode:C; c-file-style: "eay" -*- */ |
||||
|
/* Copied from Richard Levitte's (richard@levitte.org) LP library. All
|
||||
|
* symbol names have been changed, with permission from the author. |
||||
|
*/ |
||||
|
|
||||
|
/* $LP: LPlib/source/LPdir.h,v 1.1 2004/06/14 08:56:04 _cvs_levitte Exp $ */ |
||||
|
/*
|
||||
|
* Copyright (c) 2004, Richard Levitte <richard@levitte.org> |
||||
|
* All rights reserved. |
||||
|
* |
||||
|
* Redistribution and use in source and binary forms, with or without |
||||
|
* modification, are permitted provided that the following conditions |
||||
|
* are met: |
||||
|
* 1. Redistributions of source code must retain the above copyright |
||||
|
* notice, this list of conditions and the following disclaimer. |
||||
|
* 2. Redistributions in binary form must reproduce the above copyright |
||||
|
* notice, this list of conditions and the following disclaimer in the |
||||
|
* documentation and/or other materials provided with the distribution. |
||||
|
* |
||||
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
||||
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
||||
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
||||
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
||||
|
* SUCH DAMAGE. |
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
#ifndef O_DIR_H |
||||
|
#define O_DIR_H |
||||
|
|
||||
|
#ifdef __cplusplus |
||||
|
extern "C" { |
||||
|
#endif |
||||
|
|
||||
|
typedef struct OPENSSL_dir_context_st OPENSSL_DIR_CTX; |
||||
|
|
||||
|
/* returns NULL on error or end-of-directory.
|
||||
|
If it is end-of-directory, errno will be zero */ |
||||
|
const char *OPENSSL_DIR_read(OPENSSL_DIR_CTX **ctx, const char *directory); |
||||
|
/* returns 1 on success, 0 on error */ |
||||
|
int OPENSSL_DIR_end(OPENSSL_DIR_CTX **ctx); |
||||
|
|
||||
|
#ifdef __cplusplus |
||||
|
} |
||||
|
#endif |
||||
|
|
||||
|
#endif /* LPDIR_H */ |
@ -0,0 +1,68 @@ |
|||||
|
/* crypto/o_str.h -*- mode:C; c-file-style: "eay" -*- */ |
||||
|
/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
|
||||
|
* project 2003. |
||||
|
*/ |
||||
|
/* ====================================================================
|
||||
|
* Copyright (c) 2003 The OpenSSL Project. All rights reserved. |
||||
|
* |
||||
|
* Redistribution and use in source and binary forms, with or without |
||||
|
* modification, are permitted provided that the following conditions |
||||
|
* are met: |
||||
|
* |
||||
|
* 1. Redistributions of source code must retain the above copyright |
||||
|
* notice, this list of conditions and the following disclaimer. |
||||
|
* |
||||
|
* 2. Redistributions in binary form must reproduce the above copyright |
||||
|
* notice, this list of conditions and the following disclaimer in |
||||
|
* the documentation and/or other materials provided with the |
||||
|
* distribution. |
||||
|
* |
||||
|
* 3. All advertising materials mentioning features or use of this |
||||
|
* software must display the following acknowledgment: |
||||
|
* "This product includes software developed by the OpenSSL Project |
||||
|
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
||||
|
* |
||||
|
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to |
||||
|
* endorse or promote products derived from this software without |
||||
|
* prior written permission. For written permission, please contact |
||||
|
* licensing@OpenSSL.org. |
||||
|
* |
||||
|
* 5. Products derived from this software may not be called "OpenSSL" |
||||
|
* nor may "OpenSSL" appear in their names without prior written |
||||
|
* permission of the OpenSSL Project. |
||||
|
* |
||||
|
* 6. Redistributions of any form whatsoever must retain the following |
||||
|
* acknowledgment: |
||||
|
* "This product includes software developed by the OpenSSL Project |
||||
|
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
||||
|
* |
||||
|
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY |
||||
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR |
||||
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
||||
|
* OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
|
* ==================================================================== |
||||
|
* |
||||
|
* This product includes cryptographic software written by Eric Young |
||||
|
* (eay@cryptsoft.com). This product includes software written by Tim |
||||
|
* Hudson (tjh@cryptsoft.com). |
||||
|
* |
||||
|
*/ |
||||
|
|
||||
|
#ifndef HEADER_O_STR_H |
||||
|
#define HEADER_O_STR_H |
||||
|
|
||||
|
#include <stddef.h> /* to get size_t */ |
||||
|
|
||||
|
int OPENSSL_strcasecmp(const char *str1, const char *str2); |
||||
|
int OPENSSL_strncasecmp(const char *str1, const char *str2, size_t n); |
||||
|
int OPENSSL_memcmp(const void *p1,const void *p2,size_t n); |
||||
|
|
||||
|
#endif |
@ -0,0 +1,67 @@ |
|||||
|
/* crypto/o_time.h -*- mode:C; c-file-style: "eay" -*- */ |
||||
|
/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
|
||||
|
* project 2001. |
||||
|
*/ |
||||
|
/* ====================================================================
|
||||
|
* Copyright (c) 2001 The OpenSSL Project. All rights reserved. |
||||
|
* |
||||
|
* Redistribution and use in source and binary forms, with or without |
||||
|
* modification, are permitted provided that the following conditions |
||||
|
* are met: |
||||
|
* |
||||
|
* 1. Redistributions of source code must retain the above copyright |
||||
|
* notice, this list of conditions and the following disclaimer. |
||||
|
* |
||||
|
* 2. Redistributions in binary form must reproduce the above copyright |
||||
|
* notice, this list of conditions and the following disclaimer in |
||||
|
* the documentation and/or other materials provided with the |
||||
|
* distribution. |
||||
|
* |
||||
|
* 3. All advertising materials mentioning features or use of this |
||||
|
* software must display the following acknowledgment: |
||||
|
* "This product includes software developed by the OpenSSL Project |
||||
|
* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
|
||||
|
* |
||||
|
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to |
||||
|
* endorse or promote products derived from this software without |
||||
|
* prior written permission. For written permission, please contact |
||||
|
* licensing@OpenSSL.org. |
||||
|
* |
||||
|
* 5. Products derived from this software may not be called "OpenSSL" |
||||
|
* nor may "OpenSSL" appear in their names without prior written |
||||
|
* permission of the OpenSSL Project. |
||||
|
* |
||||
|
* 6. Redistributions of any form whatsoever must retain the following |
||||
|
* acknowledgment: |
||||
|
* "This product includes software developed by the OpenSSL Project |
||||
|
* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
|
||||
|
* |
||||
|
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY |
||||
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
||||
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR |
||||
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
||||
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
||||
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
||||
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
||||
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
||||
|
* OF THE POSSIBILITY OF SUCH DAMAGE. |
||||
|
* ==================================================================== |
||||
|
* |
||||
|
* This product includes cryptographic software written by Eric Young |
||||
|
* (eay@cryptsoft.com). This product includes software written by Tim |
||||
|
* Hudson (tjh@cryptsoft.com). |
||||
|
* |
||||
|
*/ |
||||
|
|
||||
|
#ifndef HEADER_O_TIME_H |
||||
|
#define HEADER_O_TIME_H |
||||
|
|
||||
|
#include <time.h> |
||||
|
|
||||
|
struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result); |
||||
|
int OPENSSL_gmtime_adj(struct tm *tm, int offset_day, long offset_sec); |
||||
|
|
||||
|
#endif |
@ -0,0 +1,51 @@ |
|||||
|
|
||||
|
#ifdef NAML$C_MAXRSS |
||||
|
|
||||
|
# define CC_RMS_NAMX cc$rms_naml |
||||
|
# define FAB_NAMX fab$l_naml |
||||
|
# define FAB_OR_NAML( fab, naml) naml |
||||
|
# define FAB_OR_NAML_DNA naml$l_long_defname |
||||
|
# define FAB_OR_NAML_DNS naml$l_long_defname_size |
||||
|
# define FAB_OR_NAML_FNA naml$l_long_filename |
||||
|
# define FAB_OR_NAML_FNS naml$l_long_filename_size |
||||
|
# define NAMX_ESA naml$l_long_expand |
||||
|
# define NAMX_ESL naml$l_long_expand_size |
||||
|
# define NAMX_ESS naml$l_long_expand_alloc |
||||
|
# define NAMX_NOP naml$b_nop |
||||
|
# define SET_NAMX_NO_SHORT_UPCASE( nam) nam.naml$v_no_short_upcase = 1 |
||||
|
|
||||
|
# if __INITIAL_POINTER_SIZE == 64 |
||||
|
# define NAMX_DNA_FNA_SET(fab) fab.fab$l_dna = (__char_ptr32) -1; \ |
||||
|
fab.fab$l_fna = (__char_ptr32) -1; |
||||
|
# else /* __INITIAL_POINTER_SIZE == 64 */ |
||||
|
# define NAMX_DNA_FNA_SET(fab) fab.fab$l_dna = (char *) -1; \ |
||||
|
fab.fab$l_fna = (char *) -1; |
||||
|
# endif /* __INITIAL_POINTER_SIZE == 64 [else] */ |
||||
|
|
||||
|
# define NAMX_MAXRSS NAML$C_MAXRSS |
||||
|
# define NAMX_STRUCT NAML |
||||
|
|
||||
|
#else /* def NAML$C_MAXRSS */ |
||||
|
|
||||
|
# define CC_RMS_NAMX cc$rms_nam |
||||
|
# define FAB_NAMX fab$l_nam |
||||
|
# define FAB_OR_NAML( fab, naml) fab |
||||
|
# define FAB_OR_NAML_DNA fab$l_dna |
||||
|
# define FAB_OR_NAML_DNS fab$b_dns |
||||
|
# define FAB_OR_NAML_FNA fab$l_fna |
||||
|
# define FAB_OR_NAML_FNS fab$b_fns |
||||
|
# define NAMX_ESA nam$l_esa |
||||
|
# define NAMX_ESL nam$b_esl |
||||
|
# define NAMX_ESS nam$b_ess |
||||
|
# define NAMX_NOP nam$b_nop |
||||
|
# define NAMX_DNA_FNA_SET(fab) |
||||
|
# define NAMX_MAXRSS NAM$C_MAXRSS |
||||
|
# define NAMX_STRUCT NAM |
||||
|
# ifdef NAM$M_NO_SHORT_UPCASE |
||||
|
# define SET_NAMX_NO_SHORT_UPCASE( nam) naml.naml$v_no_short_upcase = 1 |
||||
|
# else /* def NAM$M_NO_SHORT_UPCASE */ |
||||
|
# define SET_NAMX_NO_SHORT_UPCASE( nam) |
||||
|
# endif /* def NAM$M_NO_SHORT_UPCASE [else] */ |
||||
|
|
||||
|
#endif /* def NAML$C_MAXRSS [else] */ |
||||
|
|
Loading…
Reference in new issue