intel / cryptography-primitives

Apache License 2.0
318 stars 86 forks source link

Some questions about SM2 key exchange #76

Open xiaonan-INTC opened 5 months ago

xiaonan-INTC commented 5 months ago
  1. Does ipp-crypto have a sample code about how to do SM2 key exchange since it is hard to use those ippsGFpECKeyExchangeSM2_* APIs without a sample or a guide.

  2. For IppStatus ippsGFpECKeyExchangeSM2_Init (IppsGFpECKeyExchangeSM2State pKE, IppsKeyExchangeRoleSM2 role, IppsGFpECState pEC):

role has 2: ippKESM2Requester and ippKESM2Responder, does we need to call this API 2 times? if not, how to call this API?

  1. For IppStatus ippsGFpECKeyExchangeSM2_Setup(const Ipp8u pZSelf[IPP_SM3_DIGEST_BYTESIZE], const Ipp8u pZPeer[IPP_SM3_DIGEST_BYTESIZE], const IppsGFpECPoint pPublicKeySelf, const IppsGFpECPoint pPublicKeyPeer, const IppsGFpECPoint pEphPublicKeySelf, const IppsGFpECPoint pEphPublicKeyPeer, psGFpECKeyExchangeSM2State * pKE):

pZSelf: Pointer to the Self-User ID Hash pZPeer: Pointer to the Peer-User ID Hash What are they and how to get or compute them?

  1. For IppStatus ippsGFpECKeyExchangeSM2_SharedKey(Ipp8u pSharedKey, int sharedKeySize, Ipp8u pSSelf, const IppsBigNumState pPrvKey, IppsBigNumState pEphPrvKey, IppsGFpECKeyExchangeSM2State pKE, Ipp8u pScratchBuffer):

pPrvKey and pEphPrvKey are both requester's? Does responser need to call this API too?

  1. For IppStatus ippsGFpECKeyExchangeSM2_Confirm(const Ipp8u pSPeer[IPP_SM3_DIGEST_BYTESIZE], int pStatus, IppsGFpECKeyExchangeSM2State pKE):

pSPeer is from where? Not see it in other APIs before...