mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-12 01:53:07 +03:00
Added comments to hmac and rc4 code and extra diagnotics to cert # out of
bounds. git-svn-id: svn://svn.code.sf.net/p/axtls/code/trunk@192 9a5d90b5-6617-0410-8a86-bb477d3ed2e3
This commit is contained in:
@ -30,6 +30,8 @@
|
||||
|
||||
/**
|
||||
* HMAC implementation - This code was originally taken from RFC2104
|
||||
* See http://www.ietf.org/rfc/rfc2104.txt and
|
||||
* http://www.faqs.org/rfcs/rfc2202.html
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
@ -38,6 +40,7 @@
|
||||
|
||||
/**
|
||||
* Perform HMAC-MD5
|
||||
* NOTE: does not handle keys larger than the block size.
|
||||
*/
|
||||
void hmac_md5(const uint8_t *msg, int length, const uint8_t *key,
|
||||
int key_len, uint8_t *digest)
|
||||
@ -70,6 +73,7 @@ void hmac_md5(const uint8_t *msg, int length, const uint8_t *key,
|
||||
|
||||
/**
|
||||
* Perform HMAC-SHA1
|
||||
* NOTE: does not handle keys larger than the block size.
|
||||
*/
|
||||
void hmac_sha1(const uint8_t *msg, int length, const uint8_t *key,
|
||||
int key_len, uint8_t *digest)
|
||||
|
@ -67,12 +67,12 @@ void RC4_setup(RC4_CTX *ctx, const uint8_t *key, int length)
|
||||
/**
|
||||
* Perform the encrypt/decrypt operation (can use it for either since
|
||||
* this is a stream cipher).
|
||||
* NOTE: *msg and *out must be the same pointer (performance tweak)
|
||||
*/
|
||||
void RC4_crypt(RC4_CTX *ctx, const uint8_t *msg, uint8_t *out, int length)
|
||||
{
|
||||
int i;
|
||||
uint8_t *m, x, y, a, b;
|
||||
out = (uint8_t *)msg;
|
||||
|
||||
x = ctx->x;
|
||||
y = ctx->y;
|
||||
|
Reference in New Issue
Block a user