Blame crypt/sha512.h

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