Nist P-384 guts and glory

This commit is contained in:
Adam Ierymenko 2019-07-16 16:09:14 -05:00
parent debd5a5c5e
commit 94ba242c33
8 changed files with 1557 additions and 31 deletions

View file

@ -125,6 +125,11 @@ public:
/**
* Sign a message with a sender's key pair
*
* Note that this generates a 96-byte signature that contains an extra 32 bytes
* of hash data. This data is included for historical reasons and is optional. The
* verify function here will take the first 64 bytes only (normal ed25519 signature)
* or a 96-byte length signature with the extra input hash data.
*
* @param myPrivate My private key
* @param myPublic My public key
* @param msg Message to sign
@ -150,10 +155,11 @@ public:
* @param their Public key to verify against
* @param msg Message to verify signature integrity against
* @param len Length of message in bytes
* @param signature 96-byte signature
* @param signature Signature bytes
* @param siglen Length of signature in bytes
* @return True if signature is valid and the message is authentic and unmodified
*/
static bool verify(const Public &their,const void *msg,unsigned int len,const void *signature);
static bool verify(const Public &their,const void *msg,unsigned int len,const void *signature,const unsigned int siglen);
/**
* Verify a message's signature
@ -164,10 +170,7 @@ public:
* @param signature 96-byte signature
* @return True if signature is valid and the message is authentic and unmodified
*/
static inline bool verify(const Public &their,const void *msg,unsigned int len,const Signature &signature)
{
return verify(their,msg,len,signature.data);
}
static inline bool verify(const Public &their,const void *msg,unsigned int len,const Signature &signature) { return verify(their,msg,len,signature.data,96); }
private:
// derive first 32 bytes of kp.pub from first 32 bytes of kp.priv