Blame crypt/sha512.h

Packit 6c4009
/* Declaration of functions and data types used for SHA512 sum computing
Packit 6c4009
   library functions.
Packit 6c4009
   Copyright (C) 2007-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#ifndef _SHA512_H
Packit 6c4009
#define _SHA512_H 1
Packit 6c4009
Packit 6c4009
#include <limits.h>
Packit 6c4009
#include <stdint.h>
Packit 6c4009
#include <stdio.h>
Packit 6c4009
#include <endian.h>
Packit 6c4009
#include <bits/wordsize.h>
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Structure to save state of computation between the single steps.  */
Packit 6c4009
struct sha512_ctx
Packit 6c4009
{
Packit 6c4009
  uint64_t H[8];
Packit 6c4009
Packit 6c4009
  union
Packit 6c4009
  {
Packit 6c4009
#if defined __GNUC__ && __WORDSIZE == 64
Packit 6c4009
# define USE_TOTAL128
Packit 6c4009
    unsigned int total128 __attribute__ ((__mode__ (TI)));
Packit 6c4009
#endif
Packit 6c4009
#define TOTAL128_low (1 - (BYTE_ORDER == LITTLE_ENDIAN))
Packit 6c4009
#define TOTAL128_high (BYTE_ORDER == LITTLE_ENDIAN)
Packit 6c4009
    uint64_t total[2];
Packit 6c4009
  };
Packit 6c4009
  uint64_t buflen;
Packit 6c4009
  union
Packit 6c4009
  {
Packit 6c4009
    char buffer[256];
Packit 6c4009
    uint64_t buffer64[32];
Packit 6c4009
  };
Packit 6c4009
};
Packit 6c4009
Packit 6c4009
/* Initialize structure containing state of computation.
Packit 6c4009
   (FIPS 180-2: 5.3.3)  */
Packit 6c4009
extern void __sha512_init_ctx (struct sha512_ctx *ctx) __THROW;
Packit 6c4009
Packit 6c4009
/* Starting with the result of former calls of this function (or the
Packit 6c4009
   initialization function update the context for the next LEN bytes
Packit 6c4009
   starting at BUFFER.
Packit 6c4009
   It is NOT required that LEN is a multiple of 128.  */
Packit 6c4009
extern void __sha512_process_bytes (const void *buffer, size_t len,
Packit 6c4009
				    struct sha512_ctx *ctx) __THROW;
Packit 6c4009
Packit 6c4009
/* Process the remaining bytes in the buffer and put result from CTX
Packit 6c4009
   in first 64 bytes following RESBUF.
Packit 6c4009
Packit 6c4009
   IMPORTANT: On some systems it is required that RESBUF is correctly
Packit 6c4009
   aligned for a 64 bits value.  */
Packit 6c4009
extern void *__sha512_finish_ctx (struct sha512_ctx *ctx, void *resbuf)
Packit 6c4009
  __THROW;
Packit 6c4009
Packit 6c4009
#endif /* sha512.h */