From c2033df432af87d0176347858c7d11acfe2ed89f Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 3 Dec 2012 23:04:47 +0100 Subject: build: Include a copy of Nix's libstore and daemon; build it. * configure.ac: Call `AC_USE_SYSTEM_EXTENSIONS', and `GUIX_SYSTEM_TYPE'. Add `--with-store-dir' option, and substitute `storedir'. Include `config-daemon.ac'. * config-daemon.ac: New file. * Makefile.am [BUILD_DAEMON]: Include `daemon.am'. * daemon.am: New file. * m4/guix.m4 (GUIX_SYSTEM_TYPE): New macro. * nix/libutil/gcrypt-hash.cc, nix/libutil/gcrypt-hash.hh, nix/libutil/md5.h, nix/libutil/sha1.h, nix/libutil/sha256.h, nix/nix-daemon/guix-daemon.cc, nix/nix-daemon/shared.hh: New files. --- nix/libutil/sha256.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 nix/libutil/sha256.h (limited to 'nix/libutil/sha256.h') diff --git a/nix/libutil/sha256.h b/nix/libutil/sha256.h new file mode 100644 index 0000000000..c436d6402c --- /dev/null +++ b/nix/libutil/sha256.h @@ -0,0 +1,35 @@ +/* Guix --- Nix package management from Guile. -*- coding: utf-8 -*- + Copyright (C) 2012 Ludovic Courtès + + This file is part of Guix. + + Guix is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or (at + your option) any later version. + + Guix is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Guix. If not, see . */ + +#include + +#define SHA256_CTX guix_hash_context + +static inline void +SHA256_Init (struct SHA256_CTX *ctx) +{ + guix_hash_init (ctx, GCRY_MD_SHA256); +} + +#define SHA256_Update guix_hash_update + +static inline void +SHA256_Final (void *resbuf, struct SHA256_CTX *ctx) +{ + guix_hash_final (ctx, ctx, GCRY_MD_SHA256); +} -- cgit 1.4.1 From 0adb527600a40055383970330f572e9f0399cd75 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 4 Dec 2012 23:10:54 +0100 Subject: daemon: Fix typo in libgcrypt bindings. * nix/libutil/md5.h (MD5_Final): Pass RESBUF as the first argument to `guix_hash_final'. * nix/libutil/sha1.h (SHA1_Final): Likewise. * nix/libutil/sha256.h (SHA256_Final): Likewise. --- nix/libutil/md5.h | 2 +- nix/libutil/sha1.h | 2 +- nix/libutil/sha256.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'nix/libutil/sha256.h') diff --git a/nix/libutil/md5.h b/nix/libutil/md5.h index c275e381f8..7fa29087d7 100644 --- a/nix/libutil/md5.h +++ b/nix/libutil/md5.h @@ -31,5 +31,5 @@ MD5_Init (struct MD5_CTX *ctx) static inline void MD5_Final (void *resbuf, struct MD5_CTX *ctx) { - guix_hash_final (ctx, ctx, GCRY_MD_MD5); + guix_hash_final (resbuf, ctx, GCRY_MD_MD5); } diff --git a/nix/libutil/sha1.h b/nix/libutil/sha1.h index 8af92725ea..0eca8e310d 100644 --- a/nix/libutil/sha1.h +++ b/nix/libutil/sha1.h @@ -31,5 +31,5 @@ SHA1_Init (struct SHA_CTX *ctx) static inline void SHA1_Final (void *resbuf, struct SHA_CTX *ctx) { - guix_hash_final (ctx, ctx, GCRY_MD_SHA1); + guix_hash_final (resbuf, ctx, GCRY_MD_SHA1); } diff --git a/nix/libutil/sha256.h b/nix/libutil/sha256.h index c436d6402c..a91f18f689 100644 --- a/nix/libutil/sha256.h +++ b/nix/libutil/sha256.h @@ -31,5 +31,5 @@ SHA256_Init (struct SHA256_CTX *ctx) static inline void SHA256_Final (void *resbuf, struct SHA256_CTX *ctx) { - guix_hash_final (ctx, ctx, GCRY_MD_SHA256); + guix_hash_final (resbuf, ctx, GCRY_MD_SHA256); } -- cgit 1.4.1