On 12/10/2012 6:27 PM, Tayade, Nilesh wrote:
Hi,
As per RFC5246 - the TLS1.2 uses SHA256, SHA384 MAC.
I would appreciate any pointers on how the PRF is implemented for TLS1.2.
E.g. For TLS1.0, TLS1.1 - the HMAC-SHA1 is implemented as below. And SHA-1 uses
20bytes at a time.
How many bytes SHA256 uses at a time?
As per the definition in RFC2104, the loop constants follow the
properties of the hash function. Replace 64 by the internal block size
of the hash function (64 for MD2/MD4/MD5/SHA-0/SHA-1/SHA256, 128 for
SHA384/SHA512 etc.) Replace 20 by the size of the hash value (16 for
MD2/MD4/MD5, 20 for SHA-1, 32 for SHA256, 48 for SHA384, 64 for SHA512
etc.)
// First initialize the input and output to 0x36 and 0x5C respectively
for (i = 0; i < 64; i++) {
k_ipad[i] ^= 0x36;
k_opad[i] ^= 0x5C;
}
/* SHA1(key XOR ipad, text); */
SHA1_Init(&context);
SHA1_Update(&context, k_ipad, 64);
SHA1_Update(&context, text, text_len);
SHA1_Final(outbuf, &context);
/* SHA1(key XOR opad, SHA1(key XOR ipad, text))*/
SHA1_Init(&context);
SHA1_Update(&context, k_opad, 64);
SHA1_Update(&context, outbuf, 20);
SHA1_Final(outbuf, &context);
Could someone please advice how is HMAC-SHA256 implemented?
Enjoy
Jakob
--
Jakob Bohm, CIO, Partner, WiseMo A/S. http://www.wisemo.com
Transformervej 29, 2730 Herlev, Denmark. Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List openssl-users@openssl.org
Automated List Manager majord...@openssl.org