Ordo  0.3.4
Symmetric Cryptography Library
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Functions
curve25519.h File Reference

Misc. asymmetric module (temp) More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

ORDO_PUBLIC int curve25519_gen (void *priv)
 
ORDO_PUBLIC void curve25519_pub (void *pub, const void *priv)
 
ORDO_PUBLIC void curve25519_ecdh (void *shared, const void *priv, const void *other)
 

Detailed Description

Misc. asymmetric module (temp)

This header provides access to the curve25519 asymmetric elliptic curve DH algorithm. It is in this folder temporarily as an experimental module.

Function Documentation

ORDO_PUBLIC int curve25519_gen ( void *  priv)

Generates a random private key.

Parameters
[out]privOutput buffer for the private key.
Returns
ORDO_SUCCESS on success, else an error code.
Remarks
The private key is exactly 32 bytes (256 bits) long.
This function uses os_secure_random().
ORDO_PUBLIC void curve25519_pub ( void *  pub,
const void *  priv 
)

Retrieves the public key corresponding to a private key.

Parameters
[out]pubOutput buffer for the public key.
[in]privThe private key to be used.
Remarks
The public key is exactly 32 bytes (256 bits) long.
The private key must be in the proper format - that is, correctly masked according to the curve25519 specification (relating to the first and last bytes of the private key).
ORDO_PUBLIC void curve25519_ecdh ( void *  shared,
const void *  priv,
const void *  other 
)

Computes the shared secret between two keypairs.

Parameters
[out]sharedOutput buffer for the shared secret.
[in]privThe private key of the first keypair.
[in]otherThe public key of the second keypair.
Remarks
The shared secret is exactly 32 bytes (256 bits) long.
Warning
This shared secret is unique to a given pair of keypairs, thus it should be treated as long-term key material, i.e. don't use it directly for encryption or other (derive secondary keys from it).