Add sm2utl and sm9utl commands

This commit is contained in:
Zhi Guan
2018-12-25 14:49:12 +08:00
parent 0e38e3e7a3
commit 786d6f0205
15 changed files with 6500 additions and 5419 deletions

View File

@@ -121,6 +121,16 @@ int SM2_ciphertext_size(const EC_KEY *ec_key, size_t inlen)
return ret;
}
int i2d_SM2CiphertextValue_bio(BIO *bp, SM2CiphertextValue *a)
{
return ASN1_item_i2d_bio(ASN1_ITEM_rptr(SM2CiphertextValue), bp, a);
}
SM2CiphertextValue *d2i_SM2CiphertextValue_bio(BIO *bp, SM2CiphertextValue **a)
{
return ASN1_item_d2i_bio(ASN1_ITEM_rptr(SM2CiphertextValue), bp, a);
}
#ifndef OPENSSL_NO_STDIO
SM2CiphertextValue *d2i_SM2CiphertextValue_fp(FILE *fp, SM2CiphertextValue **a)
{

View File

@@ -147,6 +147,27 @@ int SM9PublicKey_gmtls_encode(SM9PublicKey *pk, unsigned char key[1024])
return 0;
}
int i2d_SM9Signature_bio(BIO *bp, SM9Signature *a)
{
return ASN1_item_i2d_bio(ASN1_ITEM_rptr(SM9Signature), bp, a);
}
SM9Signature *d2i_SM9Signature_bio(BIO *bp, SM9Signature **a)
{
return ASN1_item_d2i_bio(ASN1_ITEM_rptr(SM9Signature), bp, a);
}
int i2d_SM9Ciphertext_bio(BIO *bp, SM9Ciphertext *a)
{
return ASN1_item_i2d_bio(ASN1_ITEM_rptr(SM9Ciphertext), bp, a);
}
SM9Ciphertext *d2i_SM9Ciphertext_bio(BIO *bp, SM9Ciphertext **a)
{
return ASN1_item_d2i_bio(ASN1_ITEM_rptr(SM9Ciphertext), bp, a);
}
#ifndef OPENSSL_NO_STDIO
SM9MasterSecret *d2i_SM9MasterSecret_fp(FILE *fp, SM9MasterSecret **msk)
{

View File

@@ -83,7 +83,8 @@
#define SM9_PHI_D6 0x06
#define SM9_MAX_PLAINTEXT_LENGTH 65535
#define SM9_MAX_PLAINTEXT_LENGTH 12800
#define SM9_MAX_CIPHERTEXT_LENGTH 25600
#ifdef __cplusplus