Blame lib/nettle/gost/hmac-streebog.c

Packit aea12f
/* hmac-streebog.c
Packit aea12f
Packit aea12f
   HMAC-Streebog message authentication code.
Packit aea12f
Packit aea12f
   Copyright (C) 2016 Dmitry Eremin-Solenikov
Packit aea12f
Packit aea12f
   This file is part of GNU Nettle.
Packit aea12f
Packit aea12f
   GNU Nettle is free software: you can redistribute it and/or
Packit aea12f
   modify it under the terms of either:
Packit aea12f
Packit aea12f
     * the GNU Lesser General Public License as published by the Free
Packit aea12f
       Software Foundation; either version 3 of the License, or (at your
Packit aea12f
       option) any later version.
Packit aea12f
Packit aea12f
   or
Packit aea12f
Packit aea12f
     * the GNU General Public License as published by the Free
Packit aea12f
       Software Foundation; either version 2 of the License, or (at your
Packit aea12f
       option) any later version.
Packit aea12f
Packit aea12f
   or both in parallel, as here.
Packit aea12f
Packit aea12f
   GNU Nettle is distributed in the hope that it will be useful,
Packit aea12f
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit aea12f
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit aea12f
   General Public License for more details.
Packit aea12f
Packit aea12f
   You should have received copies of the GNU General Public License and
Packit aea12f
   the GNU Lesser General Public License along with this program.  If
Packit aea12f
   not, see https://www.gnu.org/licenses/.
Packit aea12f
*/
Packit aea12f
Packit aea12f
#if HAVE_CONFIG_H
Packit aea12f
# include <config.h>
Packit aea12f
#endif
Packit aea12f
Packit Service 991b93
#ifndef HAVE_NETTLE_STREEBOG512_UPDATE
Packit aea12f
#include <gnutls_int.h>
Packit aea12f
Packit aea12f
#include <nettle/hmac.h>
Packit aea12f
#include "hmac-gost.h"
Packit aea12f
Packit aea12f
void
Packit aea12f
hmac_streebog512_set_key(struct hmac_streebog512_ctx *ctx,
Packit aea12f
		    size_t key_length, const uint8_t *key)
Packit aea12f
{
Packit aea12f
  HMAC_SET_KEY(ctx, &nettle_streebog512, key_length, key);
Packit aea12f
}
Packit aea12f
Packit aea12f
void
Packit aea12f
hmac_streebog512_update(struct hmac_streebog512_ctx *ctx,
Packit aea12f
		   size_t length, const uint8_t *data)
Packit aea12f
{
Packit aea12f
  streebog512_update(&ctx->state, length, data);
Packit aea12f
}
Packit aea12f
Packit aea12f
void
Packit aea12f
hmac_streebog512_digest(struct hmac_streebog512_ctx *ctx,
Packit aea12f
		   size_t length, uint8_t *digest)
Packit aea12f
{
Packit aea12f
  HMAC_DIGEST(ctx, &nettle_streebog512, length, digest);
Packit aea12f
}
Packit aea12f
Packit aea12f
void
Packit aea12f
hmac_streebog256_set_key(struct hmac_streebog256_ctx *ctx,
Packit aea12f
		    size_t key_length, const uint8_t *key)
Packit aea12f
{
Packit aea12f
  HMAC_SET_KEY(ctx, &nettle_streebog256, key_length, key);
Packit aea12f
}
Packit aea12f
Packit aea12f
void
Packit aea12f
hmac_streebog256_digest(struct hmac_streebog256_ctx *ctx,
Packit aea12f
		   size_t length, uint8_t *digest)
Packit aea12f
{
Packit aea12f
  HMAC_DIGEST(ctx, &nettle_streebog256, length, digest);
Packit aea12f
}
Packit Service 991b93
#endif