Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages  

beecrypt/dhaes.c File Reference

DHAES, code. More...

#include "system.h"
#include "dhaes.h"
#include "dlsvdp-dh.h"
#include "blockmode.h"
#include "blockpad.h"
#include "debug.h"

Go to the source code of this file.

Functions

int dhaes_pUsable (const dhaes_pParameters *params)
int dhaes_pContextInit (dhaes_pContext *ctxt, const dhaes_pParameters *params)
int dhaes_pContextInitDecrypt (dhaes_pContext *ctxt, const dhaes_pParameters *params, const mp32number *pri)
int dhaes_pContextInitEncrypt (dhaes_pContext *ctxt, const dhaes_pParameters *params, const mp32number *pub)
int dhaes_pContextFree (dhaes_pContext *ctxt)
int dhaes_pContextSetup (dhaes_pContext *ctxt, const mp32number *privkey, const mp32number *pubkey, const mp32number *message, cipherOperation op)
memchunk * dhaes_pContextEncrypt (dhaes_pContext *ctxt, mp32number *ephemeralPublicKey, mp32number *mac, const memchunk *cleartext, randomGeneratorContext *rng)
 NOTE: blockciphers and keyed hash functions take keys with sizes specified in bits and key data passed in 32-bit words. More...

memchunk * dhaes_pContextDecrypt (dhaes_pContext *ctxt, const mp32number *ephemeralPublicKey, const mp32number *mac, const memchunk *ciphertext)


Detailed Description

DHAES, code.

This code implements the encryption scheme from the paper:

"DHAES: An Encryption Scheme Based on the Diffie-Hellman Problem" Michel Abdalla, Mihir Bellare, Phillip Rogaway September 1998

Good combinations will be:

Definition in file dhaes.c.


Function Documentation

memchunk* dhaes_pContextDecrypt (  dhaes_pContext *    ctxt,
const mp32number *    ephemeralPublicKey,
const mp32number *    mac,
const memchunk *    ciphertext
) 
 

Definition at line 306 of file dhaes.c.

References blockCipherContext::algo, blockDecrypt, blockCipher::blocksize, CBC, dhaes_pContext::cipher, memchunk::data, DECRYPT, dhaes_pContextSetup, keyedHashFunctionContextDigestMatch, keyedHashFunctionContextUpdateMC, dhaes_pContext::mac, blockCipherContext::param, pkcs5Unpad, dhaes_pContext::pri, memchunk::size, and uint32.

memchunk* dhaes_pContextEncrypt (  dhaes_pContext *    ctxt,
mp32number *    ephemeralPublicKey,
mp32number *    mac,
const memchunk *    cleartext,
randomGeneratorContext *    rng
) 
 

NOTE: blockciphers and keyed hash functions take keys with sizes specified in bits and key data passed in 32-bit words.

Both blockcipher and keyed hash function have a min and max key size.

This function will split the digest of the shared secret in two halves, and pad with zero bits or truncate if necessary to meet algorithm key size requirements.

Definition at line 252 of file dhaes.c.

References blockCipherContext::algo, blockEncrypt, blockCipher::blocksize, CBC, dhaes_pContext::cipher, memchunk::data, dhaes_pContextSetup, dldp_pPair, ENCRYPT, keyedHashFunctionContextDigest, keyedHashFunctionContextUpdateMC, dhaes_pContext::mac, mp32nfree, mp32nwipe, mp32nzero, blockCipherContext::param, dhaes_pContext::param, pkcs5PadCopy, dhaes_pContext::pub, memchunk::size, and uint32.

int dhaes_pContextFree (  dhaes_pContext *    ctxt ) 
 

Definition at line 165 of file dhaes.c.

References blockCipherContextFree, dhaes_pContext::cipher, dldp_pFree, dhaes_pContext::hash, hashFunctionContextFree, keyedHashFunctionContextFree, dhaes_pContext::mac, mp32nfree, dhaes_pContext::param, dhaes_pContext::pri, and dhaes_pContext::pub.

int dhaes_pContextInit (  dhaes_pContext *    ctxt,
const dhaes_pParameters *    params
) 
 

Definition at line 99 of file dhaes.c.

References blockCipherContextInit, dhaes_pContext::cipher, dhaes_pParameters::cipher, dhaes_pParameters::cipherkeybits, dhaes_pContext::cipherkeybits, dhaes_pUsable, dldp_pCopy, dldp_pInit, dhaes_pContext::hash, dhaes_pParameters::hash, hashFunctionContextInit, keyedHashFunctionContextInit, dhaes_pContext::mac, dhaes_pParameters::mac, dhaes_pParameters::mackeybits, dhaes_pContext::mackeybits, mp32nzero, dhaes_pContext::param, dhaes_pParameters::param, dhaes_pContext::pri, and dhaes_pContext::pub.

int dhaes_pContextInitDecrypt (  dhaes_pContext *    ctxt,
const dhaes_pParameters *    params,
const mp32number *    pri
) 
 

Definition at line 145 of file dhaes.c.

References dhaes_pContextInit, mp32ncopy, and dhaes_pContext::pri.

int dhaes_pContextInitEncrypt (  dhaes_pContext *    ctxt,
const dhaes_pParameters *    params,
const mp32number *    pub
) 
 

Definition at line 155 of file dhaes.c.

References dhaes_pContextInit, mp32ncopy, and dhaes_pContext::pub.

int dhaes_pContextSetup (  dhaes_pContext *    ctxt,
const mp32number *    privkey,
const mp32number *    pubkey,
const mp32number *    message,
cipherOperation    op
)  [static]
 

Definition at line 188 of file dhaes.c.

References blockCipherContextSetup, cipherOperation, mp32number::data, dlsvdp_pDHSecret, hashFunctionContextDigest, hashFunctionContextReset, hashFunctionContextUpdateMP32, keyedHashFunctionContextSetup, mp32nfree, mp32nwipe, mp32nzero, mp32number::size, and uint32.

Referenced by dhaes_pContextDecrypt, and dhaes_pContextEncrypt.

int dhaes_pUsable (  const dhaes_pParameters *    params ) 
 

Definition at line 58 of file dhaes.c.

References dhaes_pParameters::cipher, dhaes_pParameters::cipherkeybits, hashFunction::digestsize, dhaes_pParameters::hash, keyedHashFunction::keybitsinc, blockCipher::keybitsinc, keyedHashFunction::keybitsmax, blockCipher::keybitsmax, keyedHashFunction::keybitsmin, blockCipher::keybitsmin, dhaes_pParameters::mac, and dhaes_pParameters::mackeybits.


Generated on Wed Sep 4 12:49:58 2002 for rpm by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002