예제 #1
0
func ECDHSecret(our_priv ECDHPrivate, their_publ ECDHPublic) []byte {
	toret := make([]byte, ECDHKeyLength)
	C.crypto_scalarmult(
		(*C.uchar)(&toret[0]),
		(*C.uchar)(&our_priv[0]),
		(*C.uchar)(&their_publ[0]))
	return toret
}
예제 #2
0
func CryptoScalarMult(n []byte, p []byte) ([]byte, int) {
	support.CheckSize(n, CryptoScalarmultScalarBytes(), "secret key")
	support.CheckSize(p, CryptoScalarmultScalarBytes(), "public key")
	q := make([]byte, CryptoScalarmultBytes())
	var exit C.int
	exit = C.crypto_scalarmult(
		(*C.uchar)(&q[0]),
		(*C.uchar)(&n[0]),
		(*C.uchar)(&p[0]))

	return q, int(exit)

}