X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Fsecurity.c;h=f160d683f6cbf4755bc92f8ef28b96fa9f8dfcb4;hp=6348918ac5f20407ac2efc4b174444eceda0d67e;hb=80b48ed7aeb8e6c9460ab254920818f9e36d656e;hpb=2fdc3bd720f5bc49680dc2284ea42a537d1acc07 diff --git a/src/security.c b/src/security.c index 6348918a..f160d683 100644 --- a/src/security.c +++ b/src/security.c @@ -7,20 +7,18 @@ /* * Copyright (C) 2012, 2013, 2014 Eric Biggers * - * This file is part of wimlib, a library for working with WIM files. + * This file is free software; you can redistribute it and/or modify it under + * the terms of the GNU Lesser General Public License as published by the Free + * Software Foundation; either version 3 of the License, or (at your option) any + * later version. * - * wimlib 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. - * - * wimlib 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 + * This file 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 Lesser General Public License for more * details. * - * You should have received a copy of the GNU General Public License - * along with wimlib; if not, see http://www.gnu.org/licenses/. + * You should have received a copy of the GNU Lesser General Public License + * along with this file; if not, see http://www.gnu.org/licenses/. */ #ifdef HAVE_CONFIG_H @@ -159,8 +157,8 @@ read_wim_security_data(const u8 *buf, size_t buf_len, p += sd->sizes[i]; } out_align_total_length: - total_len = (total_len + 7) & ~7; - sd->total_length = (sd->total_length + 7) & ~7; + total_len = ALIGN(total_len, 8); + sd->total_length = ALIGN(sd->total_length, 8); if (total_len != sd->total_length) { WARNING("Expected WIM security data total length of " "%u bytes, but calculated %u bytes", @@ -232,7 +230,7 @@ free_wim_security_data(struct wim_security_data *sd) } struct sd_node { - int security_id; + s32 security_id; u8 hash[SHA1_HASH_SIZE]; struct avl_tree_node index_node; }; @@ -286,7 +284,7 @@ insert_sd_node(struct wim_sd_set *set, struct sd_node *new) /* Returns the index of the security descriptor having a SHA1 message digest of * @hash. If not found, return -1. */ -static int +static s32 lookup_sd(struct wim_sd_set *set, const u8 hash[SHA1_HASH_SIZE]) { struct avl_tree_node *res; @@ -307,11 +305,11 @@ lookup_sd(struct wim_sd_set *set, const u8 hash[SHA1_HASH_SIZE]) * the security ID for it. If a new security descriptor cannot be allocated, * return -1. */ -int +s32 sd_set_add_sd(struct wim_sd_set *sd_set, const char *descriptor, size_t size) { u8 hash[SHA1_HASH_SIZE]; - int security_id; + s32 security_id; struct sd_node *new; u8 **descriptors; u64 *sizes;