Commit 6a4be40e 6a4be40e01252fe8b2911a98d6dc1767328ccb67 by Sergey Poznyakoff

Added to the repository by gnulib-sync

1 parent 13c0d7dd
1 # full-header-path.m4 serial 2
2 dnl Copyright (C) 2006 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
6
7 dnl From Derek Price.
8
9 # gl_FULL_HEADER_PATH(HEADER1 HEADER2 ...)
10 # ----------------------------------------
11 # Find the full path to a header file, assuming the header exists.
12 # If the header were sys/inttypes.h, this macro would define
13 # FULL_PATH_SYS_INTTYPES_H to the `<>' quoted full path to sys/inttypes.h
14 # in config.h
15 # (e.g. `#define FULL_PATH_SYS_INTTYPES_H </usr/include/sys/inttypes.h>').
16 AC_DEFUN([gl_FULL_HEADER_PATH],
17 [AC_LANG_PREPROC_REQUIRE()dnl
18 AC_FOREACH([gl_HEADER_NAME], [$1],
19 [AS_VAR_PUSHDEF([gl_full_header_path],
20 [gl_cv_full_path_]m4_quote(m4_defn([gl_HEADER_NAME])))dnl
21 AC_CACHE_CHECK([full path to <]m4_quote(m4_defn([gl_HEADER_NAME]))[>],
22 m4_quote(m4_defn([gl_full_header_path])),
23 [AS_VAR_PUSHDEF([ac_header_exists],
24 [ac_cv_header_]m4_quote(m4_defn([gl_HEADER_NAME])))dnl
25 AC_CHECK_HEADERS_ONCE(m4_quote(m4_defn([gl_HEADER_NAME])))dnl
26 if test AS_VAR_GET(ac_header_exists) = yes; then
27 AC_LANG_CONFTEST([AC_LANG_SOURCE([[#include <]]m4_dquote(m4_defn([gl_HEADER_NAME]))[[>]])])
28 dnl eval is necessary to expand ac_cpp.
29 dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell.
30 AS_VAR_SET(gl_full_header_path,
31 [`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD |
32 sed -n '\#/]m4_quote(m4_defn([gl_HEADER_NAME]))[#{s#.*"\(.*/]m4_quote(m4_defn([gl_HEADER_NAME]))[\)".*#\1#;p;q;}'`])
33 fi
34 AS_VAR_POPDEF([ac_header_exists])dnl
35 ])dnl
36 AC_DEFINE_UNQUOTED(AS_TR_CPP([FULL_PATH_]m4_quote(m4_defn([gl_HEADER_NAME]))),
37 [<AS_VAR_GET(gl_full_header_path)>],
38 [Define this to the full path to <]m4_quote(m4_defn([gl_HEADER_NAME]))[>.])
39 AS_VAR_POPDEF([gl_full_header_path])dnl
40 ])dnl
41 ])# gl_FULL_HEADER_PATH
1 # sha1.m4 serial 6
2 dnl Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
6
7 AC_DEFUN([gl_SHA1],
8 [
9 MU_LIBSOURCES([sha1.c, sha1.h])
10 MU_LIBOBJ([sha1])
11
12 dnl Prerequisites of lib/sha1.c.
13 AC_REQUIRE([AC_C_BIGENDIAN])
14 :
15 ])
1 # unistd_h.m4 serial 2
2 dnl Copyright (C) 2006 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
6
7 dnl Written by Simon Josefsson
8
9 AC_DEFUN([gl_HEADER_UNISTD],
10 [
11 dnl Prerequisites of lib/unistd.h.
12 AC_CHECK_HEADERS([unistd.h], [
13 UNISTD_H=''
14 ], [
15 UNISTD_H='unistd.h'
16 ])
17 AC_SUBST(UNISTD_H)
18 ])
1 /* Declarations of functions and data types used for SHA1 sum
2 library functions.
3 Copyright (C) 2000, 2001, 2003, 2005, 2006 Free Software Foundation, Inc.
4
5 This program is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by the
7 Free Software Foundation; either version 2, or (at your option) any
8 later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software Foundation,
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
18
19 #ifndef SHA1_H
20 # define SHA1_H 1
21
22 # include <stdio.h>
23 # include <stdint.h>
24
25 /* Structure to save state of computation between the single steps. */
26 struct sha1_ctx
27 {
28 uint32_t A;
29 uint32_t B;
30 uint32_t C;
31 uint32_t D;
32 uint32_t E;
33
34 uint32_t total[2];
35 uint32_t buflen;
36 uint32_t buffer[32];
37 };
38
39
40 /* Initialize structure containing state of computation. */
41 extern void sha1_init_ctx (struct sha1_ctx *ctx);
42
43 /* Starting with the result of former calls of this function (or the
44 initialization function update the context for the next LEN bytes
45 starting at BUFFER.
46 It is necessary that LEN is a multiple of 64!!! */
47 extern void sha1_process_block (const void *buffer, size_t len,
48 struct sha1_ctx *ctx);
49
50 /* Starting with the result of former calls of this function (or the
51 initialization function update the context for the next LEN bytes
52 starting at BUFFER.
53 It is NOT required that LEN is a multiple of 64. */
54 extern void sha1_process_bytes (const void *buffer, size_t len,
55 struct sha1_ctx *ctx);
56
57 /* Process the remaining bytes in the buffer and put result from CTX
58 in first 20 bytes following RESBUF. The result is always in little
59 endian byte order, so that a byte-wise output yields to the wanted
60 ASCII representation of the message digest.
61
62 IMPORTANT: On some systems it is required that RESBUF be correctly
63 aligned for a 32 bits value. */
64 extern void *sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf);
65
66
67 /* Put result from CTX in first 20 bytes following RESBUF. The result is
68 always in little endian byte order, so that a byte-wise output yields
69 to the wanted ASCII representation of the message digest.
70
71 IMPORTANT: On some systems it is required that RESBUF is correctly
72 aligned for a 32 bits value. */
73 extern void *sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf);
74
75
76 /* Compute SHA1 message digest for bytes read from STREAM. The
77 resulting message digest number will be written into the 20 bytes
78 beginning at RESBLOCK. */
79 extern int sha1_stream (FILE *stream, void *resblock);
80
81 /* Compute SHA1 message digest for LEN bytes beginning at BUFFER. The
82 result is always in little endian byte order, so that a byte-wise
83 output yields to the wanted ASCII representation of the message
84 digest. */
85 extern void *sha1_buffer (const char *buffer, size_t len, void *resblock);
86
87 #endif