Files
GmSSL/include/openssl/gmsaf.h
2017-02-19 23:42:38 +08:00

133 lines
5.9 KiB
C

/* ====================================================================
* Copyright (c) 2015 - 2016 The GmSSL 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 GmSSL Project.
* (http://gmssl.org/)"
*
* 4. The name "GmSSL Project" must not be used to endorse or promote
* products derived from this software without prior written
* permission. For written permission, please contact
* guanzhi1980@gmail.com.
*
* 5. Products derived from this software may not be called "GmSSL"
* nor may "GmSSL" appear in their names without prior written
* permission of the GmSSL Project.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the GmSSL Project
* (http://gmssl.org/)"
*
* THIS SOFTWARE IS PROVIDED BY THE GmSSL 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 GmSSL 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.
* ====================================================================
*/
#ifndef HEADER_GMSAF_H
#define HEADER_GMSAF_H
#include <stdio.h>
#include <openssl/sgd.h>
#include <openssl/saf.h>
#ifdef __cplusplus
extern "C" {
#endif
int SAF_PrintNameInfo(FILE *fp, SGD_NAME_INFO *nameInfo);
const char *SAF_GetErrorString(int err);
/* BEGIN ERROR CODES */
/*
* The following lines are auto generated by the script mkerr.pl. Any changes
* made after this point may be overwritten when the script is next run.
*/
int ERR_load_SAF_strings(void);
/* Error codes for the SAF functions. */
/* Function codes. */
# define SAF_F_SAF_BASE64_CREATEBASE64OBJ 100
# define SAF_F_SAF_BASE64_DECODE 101
# define SAF_F_SAF_BASE64_DECODEFINAL 102
# define SAF_F_SAF_BASE64_DECODEUPDATE 103
# define SAF_F_SAF_BASE64_ENCODE 104
# define SAF_F_SAF_BASE64_ENCODEFINAL 105
# define SAF_F_SAF_BASE64_ENCODEUPDATE 106
# define SAF_F_SAF_CHANGEPIN 123
# define SAF_F_SAF_CREATESYMMKEYOBJ 107
# define SAF_F_SAF_ECCPUBLICKEYENC 108
# define SAF_F_SAF_ECCPUBLICKEYENCBYCERT 109
# define SAF_F_SAF_ECCSIGN 110
# define SAF_F_SAF_ECCVERIFYSIGN 111
# define SAF_F_SAF_ECCVERIFYSIGNBYCERT 112
# define SAF_F_SAF_GENECCKEYPAIR 113
# define SAF_F_SAF_GENERATEAGREEMENTDATAWITHECC 114
# define SAF_F_SAF_GENERATEKEYWITHECC 115
# define SAF_F_SAF_GENERATEKEYWITHEPK 124
# define SAF_F_SAF_GENRANDOM 125
# define SAF_F_SAF_GETECCPUBLICKEY 116
# define SAF_F_SAF_GETVERSION 126
# define SAF_F_SAF_IMPORTENCEDKEY 127
# define SAF_F_SAF_INITIALIZE 128
# define SAF_F_SAF_LOGIN 129
# define SAF_F_SAF_LOGOUT 130
# define SAF_F_SAF_MACFINAL 117
# define SAF_F_SAF_MACUPDATE 118
# define SAF_F_SAF_PKCS7_DECODEDIGESTEDDATA 119
# define SAF_F_SAF_PKCS7_ENCODEDIGESTEDDATA 120
# define SAF_F_SAF_SYMMDECRYPTUPDATE 121
# define SAF_F_SAF_SYMMENCRYPTUPDATE 122
/* Reason codes. */
# define SAF_R_BUFFER_TOO_SMALL 100
# define SAF_R_CBCMAC_FAILURE 101
# define SAF_R_CMAC_FAILURE 115
# define SAF_R_ENCRYPT_KEY_FAILURE 116
# define SAF_R_GEN_RANDOM 102
# define SAF_R_GEN_RANDOM_FAILURE 117
# define SAF_R_INT_OVERFLOW 103
# define SAF_R_INVALID_ALGOR 104
# define SAF_R_INVALID_CONTEXT 105
# define SAF_R_INVALID_DIGEST_ALGOR 106
# define SAF_R_INVALID_HANDLE 107
# define SAF_R_INVALID_INPUT_LENGTH 108
# define SAF_R_INVALID_KEY_LENGTH 109
# define SAF_R_INVALID_KEY_USAGE 110
# define SAF_R_INVALID_LENGTH 111
# define SAF_R_MAC_FAILURE 112
# define SAF_R_NOT_SUPPORTED 118
# define SAF_R_OPERATION_NOT_INITIALIZED 113
# define SAF_R_SAF_ERROR 114
# ifdef __cplusplus
}
# endif
#endif