Skip to content

Commit 686c7d9

Browse files
committed
- [email protected] 2014/05/02 03:27:54
[chacha.h cipher-chachapoly.h digest.h hmac.h kex.h kexc25519.c] [misc.h poly1305.h ssh-pkcs11.c defines.h] revert __bounded change; it causes way more problems for portable than it solves; pointed out by dtucker@
1 parent 294c58a commit 686c7d9

11 files changed

+49
-62
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@
7171
UMAC can use our local fallback implementation of AES when OpenSSL isn't
7272
available. Glue code straight from Ted Krovetz's original umac.c.
7373
ok markus@
74+
- [email protected] 2014/05/02 03:27:54
75+
[chacha.h cipher-chachapoly.h digest.h hmac.h kex.h kexc25519.c]
76+
[misc.h poly1305.h ssh-pkcs11.c defines.h]
77+
revert __bounded change; it causes way more problems for portable than
78+
it solves; pointed out by dtucker@
7479

7580
20140430
7681
- (dtucker) [defines.h] Define __GNUC_PREREQ__ macro if we don't already

chacha.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: chacha.h,v 1.2 2014/03/26 04:55:35 djm Exp $ */
1+
/* $OpenBSD: chacha.h,v 1.3 2014/05/02 03:27:54 djm Exp $ */
22

33
/*
44
chacha-merged.c version 20080118
@@ -22,14 +22,14 @@ struct chacha_ctx {
2222
#define CHACHA_BLOCKLEN 64
2323

2424
void chacha_keysetup(struct chacha_ctx *x, const u_char *k, u_int kbits)
25-
__bounded((__minbytes__, 2, CHACHA_MINKEYLEN));
25+
__attribute__((__bounded__(__minbytes__, 2, CHACHA_MINKEYLEN)));
2626
void chacha_ivsetup(struct chacha_ctx *x, const u_char *iv, const u_char *ctr)
27-
__bounded((__minbytes__, 2, CHACHA_NONCELEN))
28-
__bounded((__minbytes__, 3, CHACHA_CTRLEN));
27+
__attribute__((__bounded__(__minbytes__, 2, CHACHA_NONCELEN)))
28+
__attribute__((__bounded__(__minbytes__, 3, CHACHA_CTRLEN)));
2929
void chacha_encrypt_bytes(struct chacha_ctx *x, const u_char *m,
3030
u_char *c, u_int bytes)
31-
__bounded((__buffer__, 2, 4))
32-
__bounded((__buffer__, 3, 4));
31+
__attribute__((__bounded__(__buffer__, 2, 4)))
32+
__attribute__((__bounded__(__buffer__, 3, 4)));
3333

3434
#endif /* CHACHA_H */
3535

cipher-chachapoly.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: cipher-chachapoly.h,v 1.2 2014/03/26 04:55:35 djm Exp $ */
1+
/* $OpenBSD: cipher-chachapoly.h,v 1.3 2014/05/02 03:27:54 djm Exp $ */
22

33
/*
44
* Copyright (c) Damien Miller 2013 <[email protected]>
@@ -30,12 +30,12 @@ struct chachapoly_ctx {
3030

3131
void chachapoly_init(struct chachapoly_ctx *cpctx,
3232
const u_char *key, u_int keylen)
33-
__bounded((__buffer__, 2, 3));
33+
__attribute__((__bounded__(__buffer__, 2, 3)));
3434
int chachapoly_crypt(struct chachapoly_ctx *cpctx, u_int seqnr,
3535
u_char *dest, const u_char *src, u_int len, u_int aadlen, u_int authlen,
3636
int do_encrypt);
3737
int chachapoly_get_length(struct chachapoly_ctx *cpctx,
3838
u_int *plenp, u_int seqnr, const u_char *cp, u_int len)
39-
__bounded((__buffer__, 4, 5));
39+
__attribute__((__bounded__(__buffer__, 4, 5)));
4040

4141
#endif /* CHACHA_POLY_AEAD_H */

defines.h

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#ifndef _DEFINES_H
2626
#define _DEFINES_H
2727

28-
/* $Id: defines.h,v 1.178 2014/04/30 16:24:35 dtucker Exp $ */
28+
/* $Id: defines.h,v 1.179 2014/05/15 04:37:04 djm Exp $ */
2929

3030

3131
/* Constants */
@@ -826,22 +826,4 @@ struct winsize {
826826
# define arc4random_stir()
827827
#endif
828828

829-
/* Macro to test if we're using a specific version of gcc or later. */
830-
#if defined(__GNUC__) && !defined(__GNUC_PREREQ__)
831-
#define __GNUC_PREREQ__(ma, mi) \
832-
((__GNUC__ > (ma)) || (__GNUC__ == (ma) && __GNUC_MINOR__ >= (mi)))
833-
#else
834-
#define __GNUC_PREREQ__(ma, mi) 0
835-
#endif
836-
837-
/* __bounded macro */
838-
#ifndef __bounded
839-
# if defined(__GNUC__) && __GNUC_PREREQ__(3,3) && !defined(__clang__)
840-
# define __bounded(args) __attribute__ ((__bounded__ args ))
841-
# else
842-
# define __bounded(args) /* delete */
843-
# endif /* __GNUC_PREREQ__(3,3) && !defined(__clang__) */
844-
#endif
845-
846-
847829
#endif /* _DEFINES_H */

digest.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: digest.h,v 1.3 2014/03/26 04:55:35 djm Exp $ */
1+
/* $OpenBSD: digest.h,v 1.4 2014/05/02 03:27:54 djm Exp $ */
22
/*
33
* Copyright (c) 2013 Damien Miller <[email protected]>
44
*
@@ -45,18 +45,18 @@ int ssh_digest_copy_state(struct ssh_digest_ctx *from,
4545
/* One-shot API */
4646
int ssh_digest_memory(int alg, const void *m, size_t mlen,
4747
u_char *d, size_t dlen)
48-
__bounded((__buffer__, 2, 3))
49-
__bounded((__buffer__, 4, 5));
48+
__attribute__((__bounded__(__buffer__, 2, 3)))
49+
__attribute__((__bounded__(__buffer__, 4, 5)));
5050
int ssh_digest_buffer(int alg, const Buffer *b, u_char *d, size_t dlen)
51-
__bounded((__buffer__, 3, 4));
51+
__attribute__((__bounded__(__buffer__, 3, 4)));
5252

5353
/* Update API */
5454
struct ssh_digest_ctx *ssh_digest_start(int alg);
5555
int ssh_digest_update(struct ssh_digest_ctx *ctx, const void *m, size_t mlen)
56-
__bounded((__buffer__, 2, 3));
56+
__attribute__((__bounded__(__buffer__, 2, 3)));
5757
int ssh_digest_update_buffer(struct ssh_digest_ctx *ctx, const Buffer *b);
5858
int ssh_digest_final(struct ssh_digest_ctx *ctx, u_char *d, size_t dlen)
59-
__bounded((__buffer__, 2, 3));
59+
__attribute__((__bounded__(__buffer__, 2, 3)));
6060
void ssh_digest_free(struct ssh_digest_ctx *ctx);
6161

6262
#endif /* _DIGEST_H */

hmac.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: hmac.h,v 1.7 2014/03/26 04:55:35 djm Exp $ */
1+
/* $OpenBSD: hmac.h,v 1.8 2014/05/02 03:27:54 djm Exp $ */
22
/*
33
* Copyright (c) 2014 Markus Friedl. All rights reserved.
44
*
@@ -26,12 +26,12 @@ struct ssh_hmac_ctx *ssh_hmac_start(int alg);
2626

2727
/* Sets the state of the HMAC or resets the state if key == NULL */
2828
int ssh_hmac_init(struct ssh_hmac_ctx *ctx, const void *key, size_t klen)
29-
__bounded((__buffer__, 2, 3));
29+
__attribute__((__bounded__(__buffer__, 2, 3)));
3030
int ssh_hmac_update(struct ssh_hmac_ctx *ctx, const void *m, size_t mlen)
31-
__bounded((__buffer__, 2, 3));
31+
__attribute__((__bounded__(__buffer__, 2, 3)));
3232
int ssh_hmac_update_buffer(struct ssh_hmac_ctx *ctx, const Buffer *b);
3333
int ssh_hmac_final(struct ssh_hmac_ctx *ctx, u_char *d, size_t dlen)
34-
__bounded((__buffer__, 2, 3));
34+
__attribute__((__bounded__(__buffer__, 2, 3)));
3535
void ssh_hmac_free(struct ssh_hmac_ctx *ctx);
3636

3737
#endif /* _HMAC_H */

kex.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: kex.h,v 1.63 2014/03/26 04:55:35 djm Exp $ */
1+
/* $OpenBSD: kex.h,v 1.64 2014/05/02 03:27:54 djm Exp $ */
22

33
/*
44
* Copyright (c) 2000, 2001 Markus Friedl. All rights reserved.
@@ -187,12 +187,12 @@ kex_c25519_hash(int, char *, char *, char *, int,
187187

188188
#define CURVE25519_SIZE 32
189189
void kexc25519_keygen(u_char[CURVE25519_SIZE], u_char[CURVE25519_SIZE])
190-
__bounded((__minbytes__, 1, CURVE25519_SIZE))
191-
__bounded((__minbytes__, 2, CURVE25519_SIZE));
190+
__attribute__((__bounded__(__minbytes__, 1, CURVE25519_SIZE)))
191+
__attribute__((__bounded__(__minbytes__, 2, CURVE25519_SIZE)));
192192
void kexc25519_shared_key(const u_char key[CURVE25519_SIZE],
193193
const u_char pub[CURVE25519_SIZE], Buffer *out)
194-
__bounded((__minbytes__, 1, CURVE25519_SIZE))
195-
__bounded((__minbytes__, 2, CURVE25519_SIZE));
194+
__attribute__((__bounded__(__minbytes__, 1, CURVE25519_SIZE)))
195+
__attribute__((__bounded__(__minbytes__, 2, CURVE25519_SIZE)));
196196

197197
void
198198
derive_ssh1_session_id(BIGNUM *, BIGNUM *, u_int8_t[8], u_int8_t[16]);

kexc25519.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: kexc25519.c,v 1.6 2014/03/26 04:55:35 djm Exp $ */
1+
/* $OpenBSD: kexc25519.c,v 1.7 2014/05/02 03:27:54 djm Exp $ */
22
/*
33
* Copyright (c) 2001, 2013 Markus Friedl. All rights reserved.
44
* Copyright (c) 2010 Damien Miller. All rights reserved.
@@ -45,9 +45,9 @@
4545

4646
extern int crypto_scalarmult_curve25519(u_char a[CURVE25519_SIZE],
4747
const u_char b[CURVE25519_SIZE], const u_char c[CURVE25519_SIZE])
48-
__bounded((__minbytes__, 1, CURVE25519_SIZE))
49-
__bounded((__minbytes__, 2, CURVE25519_SIZE))
50-
__bounded((__minbytes__, 3, CURVE25519_SIZE));
48+
__attribute__((__bounded__(__minbytes__, 1, CURVE25519_SIZE)))
49+
__attribute__((__bounded__(__minbytes__, 2, CURVE25519_SIZE)))
50+
__attribute__((__bounded__(__minbytes__, 3, CURVE25519_SIZE)));
5151

5252
void
5353
kexc25519_keygen(u_char key[CURVE25519_SIZE], u_char pub[CURVE25519_SIZE])

misc.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: misc.h,v 1.52 2014/04/20 02:30:25 djm Exp $ */
1+
/* $OpenBSD: misc.h,v 1.53 2014/05/02 03:27:54 djm Exp $ */
22

33
/*
44
* Author: Tatu Ylonen <[email protected]>
@@ -70,23 +70,23 @@ int tun_open(int, int);
7070

7171
/* Functions to extract or store big-endian words of various sizes */
7272
u_int64_t get_u64(const void *)
73-
__bounded(( __minbytes__, 1, 8));
73+
__attribute__((__bounded__( __minbytes__, 1, 8)));
7474
u_int32_t get_u32(const void *)
75-
__bounded(( __minbytes__, 1, 4));
75+
__attribute__((__bounded__( __minbytes__, 1, 4)));
7676
u_int16_t get_u16(const void *)
77-
__bounded(( __minbytes__, 1, 2));
77+
__attribute__((__bounded__( __minbytes__, 1, 2)));
7878
void put_u64(void *, u_int64_t)
79-
__bounded(( __minbytes__, 1, 8));
79+
__attribute__((__bounded__( __minbytes__, 1, 8)));
8080
void put_u32(void *, u_int32_t)
81-
__bounded(( __minbytes__, 1, 4));
81+
__attribute__((__bounded__( __minbytes__, 1, 4)));
8282
void put_u16(void *, u_int16_t)
83-
__bounded(( __minbytes__, 1, 2));
83+
__attribute__((__bounded__( __minbytes__, 1, 2)));
8484

8585
/* Little-endian store/load, used by umac.c */
8686
u_int32_t get_u32_le(const void *)
87-
__bounded(( __minbytes__, 1, 4));
87+
__attribute__((__bounded__(__minbytes__, 1, 4)));
8888
void put_u32_le(void *, u_int32_t)
89-
__bounded(( __minbytes__, 1, 4));
89+
__attribute__((__bounded__(__minbytes__, 1, 4)));
9090

9191
struct bwlimit {
9292
size_t buflen;

poly1305.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: poly1305.h,v 1.3 2014/03/26 04:55:35 djm Exp $ */
1+
/* $OpenBSD: poly1305.h,v 1.4 2014/05/02 03:27:54 djm Exp $ */
22

33
/*
44
* Public Domain poly1305 from Andrew Moon
@@ -15,8 +15,8 @@
1515

1616
void poly1305_auth(u_char out[POLY1305_TAGLEN], const u_char *m, size_t inlen,
1717
const u_char key[POLY1305_KEYLEN])
18-
__bounded((__minbytes__, 1, POLY1305_TAGLEN))
19-
__bounded((__buffer__, 2, 3))
20-
__bounded((__minbytes__, 4, POLY1305_KEYLEN));
18+
__attribute__((__bounded__(__minbytes__, 1, POLY1305_TAGLEN)))
19+
__attribute__((__bounded__(__buffer__, 2, 3)))
20+
__attribute__((__bounded__(__minbytes__, 4, POLY1305_KEYLEN)));
2121

2222
#endif /* POLY1305_H */

ssh-pkcs11.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: ssh-pkcs11.c,v 1.12 2014/03/26 04:55:35 djm Exp $ */
1+
/* $OpenBSD: ssh-pkcs11.c,v 1.13 2014/05/02 03:27:54 djm Exp $ */
22
/*
33
* Copyright (c) 2010 Markus Friedl. All rights reserved.
44
*
@@ -386,7 +386,7 @@ pkcs11_open_session(struct pkcs11_provider *p, CK_ULONG slotidx, char *pin)
386386
*/
387387
static int pkcs11_fetch_keys_filter(struct pkcs11_provider *, CK_ULONG,
388388
CK_ATTRIBUTE [], CK_ATTRIBUTE [3], Key ***, int *)
389-
__bounded((__minbytes__,4, 3 * sizeof(CK_ATTRIBUTE)));
389+
__attribute__((__bounded__(__minbytes__,4, 3 * sizeof(CK_ATTRIBUTE))));
390390

391391
static int
392392
pkcs11_fetch_keys(struct pkcs11_provider *p, CK_ULONG slotidx,

0 commit comments

Comments
 (0)