From 86b9c46ebde8851690265b6a282106b07d4f788a Mon Sep 17 00:00:00 2001 From: Reyk Floeter Date: Fri, 21 Aug 2015 11:59:29 +0000 Subject: Switch iked to C99-style fixed-width integer types. OK mikeb@ --- sbin/iked/crypto.c | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) (limited to 'sbin/iked/crypto.c') diff --git a/sbin/iked/crypto.c b/sbin/iked/crypto.c index 3c694a7a96d..c956e79ff8e 100644 --- a/sbin/iked/crypto.c +++ b/sbin/iked/crypto.c @@ -1,4 +1,4 @@ -/* $OpenBSD: crypto.c,v 1.17 2015/08/19 14:12:43 reyk Exp $ */ +/* $OpenBSD: crypto.c,v 1.18 2015/08/21 11:59:27 reyk Exp $ */ /* * Copyright (c) 2010-2013 Reyk Floeter @@ -40,22 +40,22 @@ #include "ikev2.h" /* RFC 7427, A.1 */ -static const u_int8_t sha256WithRSAEncryption[] = { +static const uint8_t sha256WithRSAEncryption[] = { 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0b, 0x05, 0x00 }; -static const u_int8_t sha384WithRSAEncryption[] = { +static const uint8_t sha384WithRSAEncryption[] = { 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0c, 0x05, 0x00 }; -static const u_int8_t sha512WithRSAEncryption[] = { +static const uint8_t sha512WithRSAEncryption[] = { 0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x0d, 0x05, 0x00 }; struct { - u_int8_t sc_len; - const u_int8_t *sc_oid; + uint8_t sc_len; + const uint8_t *sc_oid; const EVP_MD *(*sc_md)(void); } schemes[] = { { sizeof(sha256WithRSAEncryption), @@ -66,12 +66,12 @@ struct { sha512WithRSAEncryption, EVP_sha512 }, }; -int _dsa_verify_init(struct iked_dsa *, const u_int8_t *, size_t); -size_t _dsa_verify_offset(struct iked_dsa *, u_int8_t *); -int _dsa_sign_encode(struct iked_dsa *, u_int8_t *, size_t *); +int _dsa_verify_init(struct iked_dsa *, const uint8_t *, size_t); +size_t _dsa_verify_offset(struct iked_dsa *, uint8_t *); +int _dsa_sign_encode(struct iked_dsa *, uint8_t *, size_t *); struct iked_hash * -hash_new(u_int8_t type, u_int16_t id) +hash_new(uint8_t type, uint16_t id) { struct iked_hash *hash; const EVP_MD *md = NULL; @@ -229,7 +229,7 @@ hash_update(struct iked_hash *hash, void *buf, size_t len) void hash_final(struct iked_hash *hash, void *buf, size_t *len) { - u_int length = 0; + unsigned int length = 0; HMAC_Final(hash->hash_ctx, buf, &length); *len = (size_t)length; @@ -254,7 +254,7 @@ hash_keylength(struct iked_hash *hash) } struct iked_cipher * -cipher_new(u_int8_t type, u_int16_t id, u_int16_t id_length) +cipher_new(uint8_t type, uint16_t id, uint16_t id_length) { struct iked_cipher *encr; const EVP_CIPHER *cipher = NULL; @@ -466,7 +466,7 @@ cipher_outlength(struct iked_cipher *encr, size_t inlen) } struct iked_dsa * -dsa_new(u_int16_t id, struct iked_hash *prf, int sign) +dsa_new(uint16_t id, struct iked_hash *prf, int sign) { struct iked_dsa *dsap = NULL, dsa; @@ -536,13 +536,13 @@ dsa_new(u_int16_t id, struct iked_hash *prf, int sign) } struct iked_dsa * -dsa_sign_new(u_int16_t id, struct iked_hash *prf) +dsa_sign_new(uint16_t id, struct iked_hash *prf) { return (dsa_new(id, prf, 1)); } struct iked_dsa * -dsa_verify_new(u_int16_t id, struct iked_hash *prf) +dsa_verify_new(uint16_t id, struct iked_hash *prf) { return (dsa_new(id, prf, 0)); } @@ -568,7 +568,7 @@ dsa_free(struct iked_dsa *dsa) } struct ibuf * -dsa_setkey(struct iked_dsa *dsa, void *key, size_t keylen, u_int8_t type) +dsa_setkey(struct iked_dsa *dsa, void *key, size_t keylen, uint8_t type) { BIO *rawcert = NULL; X509 *cert = NULL; @@ -640,9 +640,9 @@ dsa_setkey(struct iked_dsa *dsa, void *key, size_t keylen, u_int8_t type) } int -_dsa_verify_init(struct iked_dsa *dsa, const u_int8_t *sig, size_t len) +_dsa_verify_init(struct iked_dsa *dsa, const uint8_t *sig, size_t len) { - u_int8_t oidlen; + uint8_t oidlen; size_t i; if (dsa->dsa_priv != NULL) @@ -725,7 +725,7 @@ dsa_update(struct iked_dsa *dsa, const void *buf, size_t len) /* Prefix signature hash with encoded type */ int -_dsa_sign_encode(struct iked_dsa *dsa, u_int8_t *ptr, size_t *offp) +_dsa_sign_encode(struct iked_dsa *dsa, uint8_t *ptr, size_t *offp) { if (offp) *offp = 0; @@ -758,9 +758,9 @@ dsa_length(struct iked_dsa *dsa) ssize_t dsa_sign_final(struct iked_dsa *dsa, void *buf, size_t len) { - u_int siglen; - size_t off = 0; - u_int8_t *ptr = buf; + unsigned int siglen; + size_t off = 0; + uint8_t *ptr = buf; if (len < dsa_length(dsa)) return (-1); @@ -781,7 +781,7 @@ dsa_sign_final(struct iked_dsa *dsa, void *buf, size_t len) } size_t -_dsa_verify_offset(struct iked_dsa *dsa, u_int8_t *ptr) +_dsa_verify_offset(struct iked_dsa *dsa, uint8_t *ptr) { /* * XXX assumes that _dsa_verify_init() has already checked @@ -795,9 +795,9 @@ _dsa_verify_offset(struct iked_dsa *dsa, u_int8_t *ptr) ssize_t dsa_verify_final(struct iked_dsa *dsa, void *buf, size_t len) { - u_int8_t sig[EVP_MAX_MD_SIZE]; - u_int siglen = sizeof(sig); - u_int8_t *ptr = buf; + uint8_t sig[EVP_MAX_MD_SIZE]; + unsigned int siglen = sizeof(sig); + uint8_t *ptr = buf; size_t off = 0; if (dsa->dsa_hmac) { -- cgit v1.2.3