update sm2

This commit is contained in:
Zhi Guan
2017-02-22 18:22:47 +08:00
parent a1e9e04cc9
commit d9ea57a8c0
5 changed files with 165 additions and 126 deletions

View File

@@ -1272,58 +1272,6 @@ void EC_KEY_METHOD_get_verify(EC_KEY_METHOD *meth,
const ECDSA_SIG *sig,
EC_KEY *eckey));
# ifndef OPENSSL_NO_SM2
void EC_KEY_METHOD_set_encrypt(EC_KEY_METHOD *meth,
int (*encrypt)(int type,
const unsigned char *in,
size_t inlen,
unsigned char *out,
size_t *outlen,
EC_KEY *ec_key),
ECIES_CIPHERTEXT_VALUE *(*do_encrypt)(int type,
const unsigned char *in,
size_t inlen,
EC_KEY *ec_key));
void EC_KEY_METHOD_get_decrypt(EC_KEY_METHOD *meth,
int (*decrypt)(int type,
const unsigned char *in,
size_t inlen,
unsigned char *out,
size_t *outlen,
EC_KEY *ec_key),
int (do_decrypt)(int type,
const ECIES_CIPHERTEXT_VALUE *in,
unsigned char *out,
size_t *outlen,
EC_KEY *ec_key));
void EC_KEY_METHOD_get_encrypt(EC_KEY_METHOD *meth,
int (**pencrypt)(int type,
const unsigned char *in,
size_t inlen,
unsigned char *out,
size_t *outlen,
EC_KEY *ec_key),
ECIES_CIPHERTEXT_VALUE *(**pdo_encrypt)(int type,
const unsigned char *in,
size_t inlen,
EC_KEY *ec_key));
void EC_KEY_METHOD_get_decrypt(EC_KEY_METHOD *meth,
int (**pdecrypt)(int type,
const unsigned char *in,
size_t inlen,
unsigned char *out,
size_t *outlen,
EC_KEY *ec_key),
int (*pdo_decrypt)(int type,
const ECIES_CIPHERTEXT_VALUE *in,
unsigned char *out,
size_t *outlen,
EC_KEY *ec_key));
# endif
# define ECParameters_dup(x) ASN1_dup_of(EC_KEY,i2d_ECParameters,d2i_ECParameters,x)
# ifndef __cplusplus

View File

@@ -56,7 +56,7 @@
#include <openssl/kdf2.h>
#include <openssl/x509.h>
#include <openssl/asn1.h>
#include <openssl/ecdsa.h>
#include <openssl/ecies.h>
#include <openssl/sm3.h>
#ifdef __cplusplus
@@ -220,6 +220,63 @@ int SM2_KAP_final_check(SM2_KAP_CTX *ctx, const unsigned char *checksum,
void SM2_KAP_CTX_cleanup(SM2_KAP_CTX *ctx);
const EC_KEY_METHOD *EC_KEY_GmSSL(void);
const EC_KEY_METHOD *EC_KEY_get_default_secg_method(void);
const EC_KEY_METHOD *EC_KEY_get_default_sm_method(void);
void EC_KEY_set_default_secg_method(const EC_KEY_METHOD *meth);
void EC_KEY_set_default_sm_method(const EC_KEY_METHOD *meth);
void EC_KEY_METHOD_set_encrypt(EC_KEY_METHOD *meth,
int (*encrypt)(int type,
const unsigned char *in,
size_t inlen,
unsigned char *out,
size_t *outlen,
EC_KEY *ec_key),
ECIES_CIPHERTEXT_VALUE *(*do_encrypt)(int type,
const unsigned char *in,
size_t inlen,
EC_KEY *ec_key));
void EC_KEY_METHOD_set_decrypt(EC_KEY_METHOD *meth,
int (*decrypt)(int type,
const unsigned char *in,
size_t inlen,
unsigned char *out,
size_t *outlen,
EC_KEY *ec_key),
int (do_decrypt)(int type,
const ECIES_CIPHERTEXT_VALUE *in,
unsigned char *out,
size_t *outlen,
EC_KEY *ec_key));
void EC_KEY_METHOD_get_encrypt(EC_KEY_METHOD *meth,
int (**pencrypt)(int type,
const unsigned char *in,
size_t inlen,
unsigned char *out,
size_t *outlen,
EC_KEY *ec_key),
ECIES_CIPHERTEXT_VALUE *(**pdo_encrypt)(int type,
const unsigned char *in,
size_t inlen,
EC_KEY *ec_key));
void EC_KEY_METHOD_get_decrypt(EC_KEY_METHOD *meth,
int (**pdecrypt)(int type,
const unsigned char *in,
size_t inlen,
unsigned char *out,
size_t *outlen,
EC_KEY *ec_key),
int (**pdo_decrypt)(int type,
const ECIES_CIPHERTEXT_VALUE *in,
unsigned char *out,
size_t *outlen,
EC_KEY *ec_key));
#ifdef __cplusplus
}
#endif