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.2 by root, Wed Jul 17 04:36:03 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#include "crypto.h"
38
37// see RFC5869 39// see RFC5869
38struct hkdf 40struct hkdf
39{ 41{
40 HMAC_CTX ctx; 42 hmac ctx;
41 u8 prk[EVP_MAX_MD_SIZE]; 43 u8 prk[EVP_MAX_MD_SIZE];
42 44
43 hkdf (const void *salt = 0, int len = 0, const EVP_MD *xtr_hash = EVP_sha512 ()); 45 hkdf (const void *salt = 0, int len = 0, const EVP_MD *xtr_hash = EVP_sha512 ())
44 ~hkdf (); 46 {
47 ctx.init (salt, len, xtr_hash);
48 }
45 49
46 void extract (const void *ikm, int len); 50 void extract (const void *ikm, int len);
47 void extract_done (const EVP_MD *prf_hash = 0); 51 void extract_done (const EVP_MD *prf_hash = 0);
48 52
49 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);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines