=pod =encoding utf8 =head1 NAME SM9_setup, SM9_generate_master_secret, SM9_extract_public_parameters, SM9_extract_private_key, SM9_extract_public_key - SM9 Algorithm =head1 SYNOPSIS #include int SM9_setup(int pairing, int scheme, int hash1, SM9PublicParameters **mpk, SM9MasterSecret **msk); SM9MasterSecret *SM9_generate_master_secret(int pairing, int scheme, int hash1); SM9PublicParameters *SM9_extract_public_parameters(SM9MasterSecret *msk); SM9PrivateKey *SM9_extract_private_key(SM9MasterSecret *msk, const char *id, size_t idlen); SM9PublicKey *SM9_extract_public_key(SM9PublicParameters *mpk, const char *id, size_t idlen); =head1 DESCRIPTION SM9_setup() calls SM9_generate_master_secret() and SM9_extract_public_parameters() to set up public parameters and master key for a later usage of SM9 system. SM9_setup()通过调用SM9_generate_master_secret()和SM9_extract_public_parameters()来设置SM9系统的公共参数和主密钥,以备之后使用。 SM9_generate_master_secret() generates a new B structure and set its parameters including pairing type, helper functions, master secret value and master public point. SM9_generate_master_secret()产生一个新的B结构,并为它设置双线性对类型、主密钥等参数值。 SM9_extract_public_parameters() allocates an empty B structure and copies some parameters from the given B structure. SM9_extract_public_parameters()分配一个空的B结构,并从给定的B结构中拷贝部分变量值。 SM9_extract_private_key() and SM9_extract_public_key() both call SM9_MASTER_KEY_extract_key() (but using a different identifier) to generate public or private key for SM9. SM9_extract_private_key()和SM9_extract_public_key()都调用SM9_MASTER_KEY_extract_key()生成一个B结构,但通过一个标识位区别生成的是公钥还是私钥。 =head1 RETURN VALUES SM9_setup() returns 1 on success or 0 on failure. SM9_setup()如果执行成功则返回1,失败返回0。 SM9_generate_master_secret() returns a pointer to an allocated B structure or NULL on error. SM9_generate_master_secret()返回一个指向已分配的B结构的指针。如果发生错误则返回NULL。 SM9_extract_public_parameters() returns a pointer to an allocated B structure or NULL on error. SM9_extract_public_parameters()返回一个指向已分配的B结构的指针。如果发生错误则返回NULL。 SM9_extract_private_key() and SM9_extract_public_key() return a pointer to an allocated B structure or NULL on error. SM9_extract_private_key()和SM9_extract_public_key()返回一个指向已分配的B结构的指针。如果发生错误则返回NULL。 =head1 CONFORMING TO GM/T 0044-2016 SM9 Identification Cryptographic Algorithm =head1 SEE ALSO L =head1 COPYRIGHT Copyright 2014-2019 The GmSSL Project. All Rights Reserved. Licensed under the GmSSL license (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at L. =cut