hmacsha.c revision 0c27b3fe77ac1d5094ba3521e8142d9e7973133f
/*
* Copyright (C) 2005-2007, 2009, 2011-2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* $Id$ */
/*
* This code implements the HMAC-SHA1, HMAC-SHA224, HMAC-SHA256, HMAC-SHA384
* and HMAC-SHA512 keyed hash algorithm described in RFC 2104 and
*/
#include "config.h"
#include <isc/assertions.h>
#include <isc/platform.h>
#if PKCS11CRYPTO
#include <pk11/internal.h>
#endif
#ifdef ISC_PLATFORM_OPENSSLHASH
void
unsigned int len)
{
#ifdef HMAC_RETURN_INT
#else
#endif
}
void
}
void
unsigned int len)
{
#ifdef HMAC_RETURN_INT
#else
#endif
}
void
unsigned char newdigest[ISC_SHA1_DIGESTLENGTH];
#ifdef HMAC_RETURN_INT
#else
#endif
}
void
unsigned int len)
{
#ifdef HMAC_RETURN_INT
#else
#endif
}
void
}
void
unsigned int len)
{
#ifdef HMAC_RETURN_INT
#else
#endif
}
void
unsigned char newdigest[ISC_SHA224_DIGESTLENGTH];
#ifdef HMAC_RETURN_INT
#else
#endif
}
void
unsigned int len)
{
#ifdef HMAC_RETURN_INT
#else
#endif
}
void
}
void
unsigned int len)
{
#ifdef HMAC_RETURN_INT
#else
#endif
}
void
unsigned char newdigest[ISC_SHA256_DIGESTLENGTH];
#ifdef HMAC_RETURN_INT
#else
#endif
}
void
unsigned int len)
{
#ifdef HMAC_RETURN_INT
#else
#endif
}
void
}
void
unsigned int len)
{
#ifdef HMAC_RETURN_INT
#else
#endif
}
void
unsigned char newdigest[ISC_SHA384_DIGESTLENGTH];
#ifdef HMAC_RETURN_INT
#else
#endif
}
void
unsigned int len)
{
#ifdef HMAC_RETURN_INT
#else
#endif
}
void
}
void
unsigned int len)
{
#ifdef HMAC_RETURN_INT
#else
#endif
}
void
unsigned char newdigest[ISC_SHA512_DIGESTLENGTH];
#ifdef HMAC_RETURN_INT
#else
#endif
}
void
unsigned int len)
{
{
};
}
void
return;
}
void
unsigned int len)
{
}
void
}
void
unsigned int len)
{
{
};
}
void
return;
}
void
unsigned int len)
{
}
void
}
void
unsigned int len)
{
{
};
}
void
return;
}
void
unsigned int len)
{
}
void
}
void
unsigned int len)
{
{
};
}
void
return;
}
void
unsigned int len)
{
}
void
}
void
unsigned int len)
{
{
};
}
void
return;
}
void
unsigned int len)
{
}
void
}
#else
#define IPAD 0x36
#define OPAD 0x5C
/*
* Start HMAC-SHA1 process. Initialize an sha1 context and digest the key.
*/
void
unsigned int len)
{
unsigned char ipad[ISC_SHA1_BLOCK_LENGTH];
unsigned int i;
} else
for (i = 0; i < ISC_SHA1_BLOCK_LENGTH; i++)
}
void
}
/*
* Update context to reflect the concatenation of another buffer full
* of bytes.
*/
void
unsigned int len)
{
}
/*
* Compute signature - finalize SHA1 operation and reapply SHA1.
*/
void
unsigned char opad[ISC_SHA1_BLOCK_LENGTH];
unsigned char newdigest[ISC_SHA1_DIGESTLENGTH];
unsigned int i;
for (i = 0; i < ISC_SHA1_BLOCK_LENGTH; i++)
}
/*
* Start HMAC-SHA224 process. Initialize an sha224 context and digest the key.
*/
void
unsigned int len)
{
unsigned char ipad[ISC_SHA224_BLOCK_LENGTH];
unsigned int i;
} else
for (i = 0; i < ISC_SHA224_BLOCK_LENGTH; i++)
}
void
}
/*
* Update context to reflect the concatenation of another buffer full
* of bytes.
*/
void
unsigned int len)
{
}
/*
* Compute signature - finalize SHA224 operation and reapply SHA224.
*/
void
unsigned char opad[ISC_SHA224_BLOCK_LENGTH];
unsigned char newdigest[ISC_SHA224_DIGESTLENGTH];
unsigned int i;
for (i = 0; i < ISC_SHA224_BLOCK_LENGTH; i++)
}
/*
* Start HMAC-SHA256 process. Initialize an sha256 context and digest the key.
*/
void
unsigned int len)
{
unsigned char ipad[ISC_SHA256_BLOCK_LENGTH];
unsigned int i;
} else
for (i = 0; i < ISC_SHA256_BLOCK_LENGTH; i++)
}
void
}
/*
* Update context to reflect the concatenation of another buffer full
* of bytes.
*/
void
unsigned int len)
{
}
/*
* Compute signature - finalize SHA256 operation and reapply SHA256.
*/
void
unsigned char opad[ISC_SHA256_BLOCK_LENGTH];
unsigned char newdigest[ISC_SHA256_DIGESTLENGTH];
unsigned int i;
for (i = 0; i < ISC_SHA256_BLOCK_LENGTH; i++)
}
/*
* Start HMAC-SHA384 process. Initialize an sha384 context and digest the key.
*/
void
unsigned int len)
{
unsigned char ipad[ISC_SHA384_BLOCK_LENGTH];
unsigned int i;
} else
for (i = 0; i < ISC_SHA384_BLOCK_LENGTH; i++)
}
void
}
/*
* Update context to reflect the concatenation of another buffer full
* of bytes.
*/
void
unsigned int len)
{
}
/*
* Compute signature - finalize SHA384 operation and reapply SHA384.
*/
void
unsigned char opad[ISC_SHA384_BLOCK_LENGTH];
unsigned char newdigest[ISC_SHA384_DIGESTLENGTH];
unsigned int i;
for (i = 0; i < ISC_SHA384_BLOCK_LENGTH; i++)
}
/*
* Start HMAC-SHA512 process. Initialize an sha512 context and digest the key.
*/
void
unsigned int len)
{
unsigned char ipad[ISC_SHA512_BLOCK_LENGTH];
unsigned int i;
} else
for (i = 0; i < ISC_SHA512_BLOCK_LENGTH; i++)
}
void
}
/*
* Update context to reflect the concatenation of another buffer full
* of bytes.
*/
void
unsigned int len)
{
}
/*
* Compute signature - finalize SHA512 operation and reapply SHA512.
*/
void
unsigned char opad[ISC_SHA512_BLOCK_LENGTH];
unsigned char newdigest[ISC_SHA512_DIGESTLENGTH];
unsigned int i;
for (i = 0; i < ISC_SHA512_BLOCK_LENGTH; i++)
}
#endif /* !ISC_PLATFORM_OPENSSLHASH */
/*
* Verify signature - finalize SHA1 operation and reapply SHA1, then
* compare to the supplied digest.
*/
unsigned char newdigest[ISC_SHA1_DIGESTLENGTH];
}
/*
* Verify signature - finalize SHA224 operation and reapply SHA224, then
* compare to the supplied digest.
*/
unsigned char newdigest[ISC_SHA224_DIGESTLENGTH];
}
/*
* Verify signature - finalize SHA256 operation and reapply SHA256, then
* compare to the supplied digest.
*/
unsigned char newdigest[ISC_SHA256_DIGESTLENGTH];
}
/*
* Verify signature - finalize SHA384 operation and reapply SHA384, then
* compare to the supplied digest.
*/
unsigned char newdigest[ISC_SHA384_DIGESTLENGTH];
}
/*
* Verify signature - finalize SHA512 operation and reapply SHA512, then
* compare to the supplied digest.
*/
unsigned char newdigest[ISC_SHA512_DIGESTLENGTH];
}