/*
 * Copyright 2002-2006 The Apache Software Foundation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * imitations under the License.
 */

#include <openssl/err.h>

#define OUT_OF_MEMORY_EX      "java/lang/OutOfMemoryError"
#define RUNTIME_EX            "java/lang/RuntimeException"
#define ILLEGAL_ARGUMENT_EX   "java/lang/IllegalArgumentException"
#define NO_SUCH_ALGO_EX       "java/security/NoSuchAlgorithmException"
#define INVALID_KEY_EX        "java/security/InvalidKeyException"
#define CLONE_NOT_SUPP_EX     "java/lang/CloneNotSupportedException"

#define OUT_OF_MEMORY_MSG "JuiCE OpenSSL: out of memory"
#define CONTEXT_NULL_MSG  "JuiCE OpenSSL: context handle is NULL"
#define KEY_NULL_MSG      "JuiCE OpenSSL: key handle is NULL"
#define EC_KEY_PUBLIC1_MSG "JuiCE OpenSSL: problem to decode public EC key"
#define EC_KEY_PUBLIC2_MSG "JuiCE OpenSSL: problem to set public EC key"
#define EC_KEY_PRIV1_MSG  "JuiCE OpenSSL: problem to set private EC key"
#define EC_KEY_MSG        "JuiCE OpenSSL: no EC key provided"

/*
 * Use the error handling model of OpenSSL. OpenSSL defines a code
 * for user libraries.
 * We define our own functions (f) codes for JuiCE openSSL native code.
 * If possible we use reason (r) codes from OpenSSL reason codes.
 */

#define F_initOpenSSLEvp      1
#define F_openSSLHMacInit     2
#define F_initOpenSSLRSA      3
#define F_initOpenSSLDSA      4
#define F_openSSLDigestInit   5
#define F_initOpenSSLECDSA    6
#define F_doPhaseDHOpenSSL    7
#define F_AESF8_CipherInit    9
#define F_F8_CipherInit      10
#define F_initOpenSSLF8      11


#define JUICEerr(f,r) ERR_PUT_error(ERR_LIB_USER,(f),(r),__FILE__,__LINE__)

char *getErrorStringOpenSSL(char *);
