* Copyright (C) 2004, Christophe Saout <christophe@saout.de>
* Copyright (C) 2004-2007, Clemens Fruhwirth <clemens@endorphin.org>
* Copyright (C) 2009-2012, Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2012, Milan Broz
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
- * version 2 as published by the Free Software Foundation.
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
quit++;
}
+int tools_signals_blocked(void)
+{
+ return signals_blocked;
+}
+
void set_int_block(int block)
{
sigset_t signals_open;
*r = -EINTR;
}
-/* crypt_get_key() with signal handler */
-int tools_get_key(const char *prompt,
- char **key, size_t *key_size,
- size_t keyfile_offset, size_t keyfile_size_max,
- const char *key_file,
- int timeout, int verify,
- struct crypt_device *cd)
-{
- int r, block;
-
- block = signals_blocked;
- if (block)
- set_int_block(0);
-
- r = crypt_get_key(prompt, key, key_size, keyfile_offset,
- keyfile_size_max, key_file, timeout, verify, cd);
- if (block && !quit)
- set_int_block(1);
-
- return r;
-}
-
__attribute__((format(printf, 5, 6)))
void clogger(struct crypt_device *cd, int level, const char *file, int line,
const char *format, ...)
size_t size = 0;
int r = 1, block;
- block = signals_blocked;
+ block = tools_signals_blocked();
if (block)
set_int_block(0);