upstream commit

convert KRL code to new buffer API

ok markus@
This commit is contained in:
djm@openbsd.org 2014-12-04 01:49:59 +00:00 committed by Damien Miller
parent db995f2eed
commit 74de254bb9
3 changed files with 358 additions and 337 deletions

653
krl.c

File diff suppressed because it is too large Load Diff

38
krl.h
View File

@ -14,7 +14,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $OpenBSD: krl.h,v 1.2 2013/01/18 00:24:58 djm Exp $ */ /* $OpenBSD: krl.h,v 1.3 2014/12/04 01:49:59 djm Exp $ */
#ifndef _KRL_H #ifndef _KRL_H
#define _KRL_H #define _KRL_H
@ -36,28 +36,30 @@
#define KRL_SECTION_CERT_SERIAL_BITMAP 0x22 #define KRL_SECTION_CERT_SERIAL_BITMAP 0x22
#define KRL_SECTION_CERT_KEY_ID 0x23 #define KRL_SECTION_CERT_KEY_ID 0x23
struct sshkey;
struct sshbuf;
struct ssh_krl; struct ssh_krl;
struct ssh_krl *ssh_krl_init(void); struct ssh_krl *ssh_krl_init(void);
void ssh_krl_free(struct ssh_krl *krl); void ssh_krl_free(struct ssh_krl *krl);
void ssh_krl_set_version(struct ssh_krl *krl, u_int64_t version); void ssh_krl_set_version(struct ssh_krl *krl, u_int64_t version);
void ssh_krl_set_sign_key(struct ssh_krl *krl, const Key *sign_key); void ssh_krl_set_sign_key(struct ssh_krl *krl, const struct sshkey *sign_key);
void ssh_krl_set_comment(struct ssh_krl *krl, const char *comment); int ssh_krl_set_comment(struct ssh_krl *krl, const char *comment);
int ssh_krl_revoke_cert_by_serial(struct ssh_krl *krl, const Key *ca_key, int ssh_krl_revoke_cert_by_serial(struct ssh_krl *krl,
u_int64_t serial); const struct sshkey *ca_key, u_int64_t serial);
int ssh_krl_revoke_cert_by_serial_range(struct ssh_krl *krl, const Key *ca_key, int ssh_krl_revoke_cert_by_serial_range(struct ssh_krl *krl,
u_int64_t lo, u_int64_t hi); const struct sshkey *ca_key, u_int64_t lo, u_int64_t hi);
int ssh_krl_revoke_cert_by_key_id(struct ssh_krl *krl, const Key *ca_key, int ssh_krl_revoke_cert_by_key_id(struct ssh_krl *krl,
const char *key_id); const struct sshkey *ca_key, const char *key_id);
int ssh_krl_revoke_key_explicit(struct ssh_krl *krl, const Key *key); int ssh_krl_revoke_key_explicit(struct ssh_krl *krl, const struct sshkey *key);
int ssh_krl_revoke_key_sha1(struct ssh_krl *krl, const Key *key); int ssh_krl_revoke_key_sha1(struct ssh_krl *krl, const struct sshkey *key);
int ssh_krl_revoke_key(struct ssh_krl *krl, const Key *key); int ssh_krl_revoke_key(struct ssh_krl *krl, const struct sshkey *key);
int ssh_krl_to_blob(struct ssh_krl *krl, Buffer *buf, const Key **sign_keys, int ssh_krl_to_blob(struct ssh_krl *krl, struct sshbuf *buf,
u_int nsign_keys); const struct sshkey **sign_keys, u_int nsign_keys);
int ssh_krl_from_blob(Buffer *buf, struct ssh_krl **krlp, int ssh_krl_from_blob(struct sshbuf *buf, struct ssh_krl **krlp,
const Key **sign_ca_keys, u_int nsign_ca_keys); const struct sshkey **sign_ca_keys, u_int nsign_ca_keys);
int ssh_krl_check_key(struct ssh_krl *krl, const Key *key); int ssh_krl_check_key(struct ssh_krl *krl, const struct sshkey *key);
int ssh_krl_file_contains_key(const char *path, const Key *key); int ssh_krl_file_contains_key(const char *path, const struct sshkey *key);
#endif /* _KRL_H */ #endif /* _KRL_H */

View File

@ -1,4 +1,4 @@
/* $OpenBSD: sshbuf-getput-basic.c,v 1.1 2014/04/30 05:29:56 djm Exp $ */ /* $OpenBSD: sshbuf-getput-basic.c,v 1.2 2014/12/04 01:49:59 djm Exp $ */
/* /*
* Copyright (c) 2011 Damien Miller * Copyright (c) 2011 Damien Miller
* *
@ -359,7 +359,7 @@ sshbuf_put_string(struct sshbuf *buf, const void *v, size_t len)
int int
sshbuf_put_cstring(struct sshbuf *buf, const char *v) sshbuf_put_cstring(struct sshbuf *buf, const char *v)
{ {
return sshbuf_put_string(buf, (u_char *)v, strlen(v)); return sshbuf_put_string(buf, (u_char *)v, v == NULL ? 0 : strlen(v));
} }
int int