1242e52a64
to reprompt for the passphrase if the key does not meet certain criteria. The currently implemented methods are ``none'' and ``disklabel''. The first behaves in the original fashion, the second will scan for a disklabel on the cgd after configuration and if it does not find a disklabel then it will reprompt for the password and reconfigure the disk.
96 lines
3.6 KiB
C
96 lines
3.6 KiB
C
/* $NetBSD: params.h,v 1.2 2002/10/12 21:02:18 elric Exp $ */
|
|
|
|
/*-
|
|
* Copyright (c) 2002 The NetBSD Foundation, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
|
* by Roland C. Dowdeswell.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without
|
|
* modification, are permitted provided that the following conditions
|
|
* are met:
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
* notice, this list of conditions and the following disclaimer.
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
* documentation and/or other materials provided with the distribution.
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
* must display the following acknowledgement:
|
|
* This product includes software developed by the NetBSD
|
|
* Foundation, Inc. and its contributors.
|
|
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
* contributors may be used to endorse or promote products derived
|
|
* from this software without specific prior written permission.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
*/
|
|
|
|
struct params {
|
|
char *alg;
|
|
char *ivmeth;
|
|
u_int8_t *key;
|
|
int keylen;
|
|
int bsize;
|
|
int keygen_method;
|
|
u_int8_t *keygen_salt;
|
|
int keygen_saltlen;
|
|
int keygen_iterations;
|
|
int verify_method;
|
|
u_int8_t *key_hash;
|
|
int key_hashlen;
|
|
u_int8_t *xor_key;
|
|
int xor_keylen;
|
|
};
|
|
|
|
/* key generation methods */
|
|
|
|
#define KEYGEN_UNKNOWN 0x0
|
|
#define KEYGEN_RANDOMKEY 0x1
|
|
#define KEYGEN_PKCS5_PBKDF2 0x2
|
|
|
|
/* verification methods */
|
|
|
|
#define VERIFY_UNKNOWN 0x0
|
|
#define VERIFY_NONE 0x1
|
|
#define VERIFY_DISKLABEL 0x2
|
|
|
|
void params_init(struct params *);
|
|
void params_free(struct params *);
|
|
|
|
int params_filldefaults(struct params *);
|
|
int params_changed(const struct params *);
|
|
|
|
int params_fget(struct params *, FILE *);
|
|
int params_fput(struct params *, FILE *);
|
|
|
|
int params_cget(struct params *, const char *);
|
|
|
|
|
|
/* interface to the structure */
|
|
|
|
int params_setalgorithm(struct params *, const char *);
|
|
int params_setivmeth(struct params *, const char *);
|
|
int params_setkeylen(struct params *, int);
|
|
int params_setbsize(struct params *, int);
|
|
int params_setkeygen_method(struct params *, int);
|
|
int params_setkeygen_method_str(struct params *, const char *);
|
|
int params_setkeygen_salt(struct params *, const char *, int);
|
|
int params_setkeygen_salt_b64(struct params *, const char *);
|
|
int params_setverify_method(struct params *, int);
|
|
int params_setverify_method_str(struct params *, const char *);
|
|
int params_setxor_key(struct params *, const char *, int);
|
|
int params_setxor_key_b64(struct params *, const char *);
|
|
int params_setkey_hash(struct params *, const char *, int);
|
|
int params_setkey_hash_b64(struct params *, const char *);
|