ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/gvpe/src/hkdf.h
(Generate patch)

Comparing gvpe/src/hkdf.h (file contents):
Revision 1.1 by root, Tue Jul 16 16:44:36 2013 UTC vs.
Revision 1.3 by root, Thu Jun 30 11:43:38 2016 UTC

1/* 1/*
2 hkdf.h -- RFC 5869 HKDF implementation 2 hkdf.h -- RFC 5869 HKDF implementation
3 Copyright (C) 2013 Marc Lehmann <gvpe@schmorp.de> 3 Copyright (C) 2013,2016 Marc Lehmann <gvpe@schmorp.de>
4 4
5 This file is part of GVPE. 5 This file is part of GVPE.
6 6
7 GVPE is free software; you can redistribute it and/or modify it 7 GVPE is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the 8 under the terms of the GNU General Public License as published by the
32#ifndef HKDF_H__ 32#ifndef HKDF_H__
33#define HKDF_H__ 33#define HKDF_H__
34 34
35#include "global.h" 35#include "global.h"
36 36
37#define HKDF_HASH EVP_sha512 37#include "crypto.h"
38 38
39// see RFC5869 39// see RFC5869
40struct hkdf 40struct hkdf
41{ 41{
42 HMAC_CTX ctx; 42 hmac ctx;
43 u8 prk[EVP_MAX_MD_SIZE]; 43 u8 prk[EVP_MAX_MD_SIZE];
44 44
45 hkdf (const void *salt = 0, int len = 0, const EVP_MD *hash = HKDF_HASH ()); 45 hkdf (const void *salt = 0, int len = 0, const EVP_MD *xtr_hash = EVP_sha512 ())
46 ~hkdf (); 46 {
47 ctx.init (salt, len, xtr_hash);
48 }
47 49
48 void extract (const void *ikm, int len); 50 void extract (const void *ikm, int len);
49 void extract_done (); 51 void extract_done (const EVP_MD *prf_hash = 0);
50 52
51 void expand (void *okm, int len, const void *info = 0, int infolen = 0); 53 void expand (void *okm, int len, const void *info = 0, int infolen = 0);
52 54
53 static void verify (); 55 static void verify ();
54}; 56};

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines