Crypto work, packet work

This commit is contained in:
Adam Ierymenko 2019-08-20 15:34:30 -07:00
parent 83d723eb79
commit 3a21fdc304
No known key found for this signature in database
GPG key ID: 1657198823E52A61
5 changed files with 110 additions and 66 deletions

View file

@ -63,7 +63,7 @@ namespace ZeroTier {
/**
* Generate a NIST P-384 key pair
*
*
* @param pub Buffer to receive point compressed public key
* @param priv Buffer to receiver private key
*/
@ -71,10 +71,10 @@ void ECC384GenerateKey(uint8_t pub[ZT_ECC384_PUBLIC_KEY_SIZE],uint8_t priv[ZT_EC
/**
* Sign a hash with a NIST P-384 private key
*
* The hash must be 48 bytes in size and is typically the first 48 bytes
* of a SHA512 hash or something similar. Extra bytes of course are ignored.
*
*
* The hash must be 48 bytes in size. If it's longer only the first 48
* bytes are used.
*
* @param priv Private key
* @param hash 48-byte hash
* @param sig Buffer to receive signature
@ -83,7 +83,7 @@ void ECC384ECDSASign(const uint8_t priv[ZT_ECC384_PRIVATE_KEY_SIZE],const uint8_
/**
* Verify a signature
*
*
* @param pub Public key
* @param hash 48-byte hash (usually first 48 bytes of SHA512(msg))
* @param sig Signature to check
@ -93,10 +93,10 @@ bool ECC384ECDSAVerify(const uint8_t pub[ZT_ECC384_PUBLIC_KEY_SIZE],const uint8_
/**
* Perform ECDH key agreement
*
*
* The secret generated here is the raw 48-byte result of ECDH.
* It's typically hashed prior to use.
*
*
* @param theirPub Remote public key
* @param ourPriv Local private key
* @param secret Buffer to receive 48-byte secret