dh.h File Reference

Diffie-Hellman key exchange. More...

#include "core/crypto.h"
#include "mpi/mpi.h"

Go to the source code of this file.

Data Structures

struct  DhParameters
 Diffie-Hellman parameters. More...
 
struct  DhContext
 Diffie-Hellman context. More...
 

Functions

void dhInit (DhContext *context)
 Initialize Diffie-Hellman context. More...
 
void dhFree (DhContext *context)
 Release Diffie-Hellman context. More...
 
error_t dhGenerateKeyPair (DhContext *context, const PrngAlgo *prngAlgo, void *prngContext)
 Diffie-Hellman key pair generation. More...
 
error_t dhCheckPublicKey (DhParameters *params, const Mpi *publicKey)
 Check Diffie-Hellman public value. More...
 
error_t dhComputeSharedSecret (DhContext *context, uint8_t *output, size_t outputSize, size_t *outputLen)
 Compute Diffie-Hellman shared secret. More...
 

Detailed Description

Diffie-Hellman key exchange.

License

Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneCrypto Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
1.9.0

Definition in file dh.h.

Function Documentation

◆ dhCheckPublicKey()

error_t dhCheckPublicKey ( DhParameters params,
const Mpi publicKey 
)

Check Diffie-Hellman public value.

Parameters
[in]paramsPointer to the Diffie-Hellman parameters
[in]publicKeyPublic value to be checked
Returns
Error code

Definition at line 152 of file dh.c.

◆ dhComputeSharedSecret()

error_t dhComputeSharedSecret ( DhContext context,
uint8_t *  output,
size_t  outputSize,
size_t *  outputLen 
)

Compute Diffie-Hellman shared secret.

Parameters
[in]contextPointer to the Diffie-Hellman context
[out]outputBuffer where to store the shared secret
[in]outputSizeSize of the buffer in bytes
[out]outputLenLength of the resulting shared secret
Returns
Error code

Definition at line 188 of file dh.c.

◆ dhFree()

void dhFree ( DhContext context)

Release Diffie-Hellman context.

Parameters
[in]contextPointer to the Diffie-Hellman context

Definition at line 69 of file dh.c.

◆ dhGenerateKeyPair()

error_t dhGenerateKeyPair ( DhContext context,
const PrngAlgo prngAlgo,
void *  prngContext 
)

Diffie-Hellman key pair generation.

Parameters
[in]contextPointer to the Diffie-Hellman context
[in]prngAlgoPRNG algorithm
[in]prngContextPointer to the PRNG context
Returns
Error code

Definition at line 89 of file dh.c.

◆ dhInit()

void dhInit ( DhContext context)

Initialize Diffie-Hellman context.

Parameters
[in]contextPointer to the Diffie-Hellman context

Definition at line 52 of file dh.c.