summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2014-06-27 06:07:36 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2014-06-27 06:07:36 +0000
commitca395964e0e6cbec283b3fbe7c1df989daad9134 (patch)
tree707fc4daa8763356ef31a82ef7ed1280fdd2032e /lib
parentdf68e54ef0107e5e1c2f9803b908372b49ef4425 (diff)
hand-KNF macro the do { } while loops
Diffstat (limited to 'lib')
-rw-r--r--lib/libcrypto/bn/bn.h3
-rw-r--r--lib/libcrypto/bn/bn_ctx.c24
-rw-r--r--lib/libcrypto/dsa/dsa_ossl.c36
-rw-r--r--lib/libcrypto/modes/gcm128.c26
4 files changed, 49 insertions, 40 deletions
diff --git a/lib/libcrypto/bn/bn.h b/lib/libcrypto/bn/bn.h
index ca2d69c7059..155adf4fe05 100644
--- a/lib/libcrypto/bn/bn.h
+++ b/lib/libcrypto/bn/bn.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: bn.h,v 1.23 2014/06/12 15:49:28 deraadt Exp $ */
+/* $OpenBSD: bn.h,v 1.24 2014/06/27 06:07:35 deraadt Exp $ */
/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -346,6 +346,7 @@ int BN_GENCB_call(BN_GENCB *cb, int a, int b);
_tmp_bn->top = 0; \
_tmp_bn->neg = 0; \
} while(0)
+
#ifdef OPENSSL_NO_DEPRECATED
#define BN_zero(a) BN_zero_ex(a)
#else
diff --git a/lib/libcrypto/bn/bn_ctx.c b/lib/libcrypto/bn/bn_ctx.c
index ed0f434e609..e3ea72516b5 100644
--- a/lib/libcrypto/bn/bn_ctx.c
+++ b/lib/libcrypto/bn/bn_ctx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bn_ctx.c,v 1.9 2014/06/12 15:49:28 deraadt Exp $ */
+/* $OpenBSD: bn_ctx.c,v 1.10 2014/06/27 06:07:35 deraadt Exp $ */
/* Written by Ulf Moeller for the OpenSSL project. */
/* ====================================================================
* Copyright (c) 1998-2004 The OpenSSL Project. All rights reserved.
@@ -179,15 +179,19 @@ ctxdbg(BN_CTX *ctx)
}
fprintf(stderr, "\n");
}
-#define CTXDBG_ENTRY(str, ctx) do { \
- ctxdbg_cur = (str); \
- fprintf(stderr,"Starting %s\n", ctxdbg_cur); \
- ctxdbg(ctx); \
- } while(0)
-#define CTXDBG_EXIT(ctx) do { \
- fprintf(stderr,"Ending %s\n", ctxdbg_cur); \
- ctxdbg(ctx); \
- } while(0)
+#define CTXDBG_ENTRY(str, ctx) \
+ do { \
+ ctxdbg_cur = (str); \
+ fprintf(stderr, "Starting %s\n", ctxdbg_cur); \
+ ctxdbg(ctx); \
+ } while(0)
+
+#define CTXDBG_EXIT(ctx) \
+ do { \
+ fprintf(stderr, "Ending %s\n", ctxdbg_cur); \
+ ctxdbg(ctx); \
+ } while(0)
+
#define CTXDBG_RET(ctx,ret)
#else
#define CTXDBG_ENTRY(str, ctx)
diff --git a/lib/libcrypto/dsa/dsa_ossl.c b/lib/libcrypto/dsa/dsa_ossl.c
index c3f01b0f119..61a20f41a74 100644
--- a/lib/libcrypto/dsa/dsa_ossl.c
+++ b/lib/libcrypto/dsa/dsa_ossl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dsa_ossl.c,v 1.17 2014/06/12 15:49:28 deraadt Exp $ */
+/* $OpenBSD: dsa_ossl.c,v 1.18 2014/06/27 06:07:35 deraadt Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -97,24 +97,28 @@ static DSA_METHOD openssl_dsa_meth = {
#define DSA_MOD_EXP(err_instr,dsa,rr,a1,p1,a2,p2,m,ctx,in_mont) \
do { \
- int _tmp_res53; \
- if((dsa)->meth->dsa_mod_exp) \
- _tmp_res53 = (dsa)->meth->dsa_mod_exp((dsa), (rr), (a1), (p1), \
- (a2), (p2), (m), (ctx), (in_mont)); \
- else \
- _tmp_res53 = BN_mod_exp2_mont((rr), (a1), (p1), (a2), (p2), \
- (m), (ctx), (in_mont)); \
- if(!_tmp_res53) err_instr; \
+ int _tmp_res53; \
+ if((dsa)->meth->dsa_mod_exp) \
+ _tmp_res53 = (dsa)->meth->dsa_mod_exp((dsa), (rr), \
+ (a1), (p1), (a2), (p2), (m), (ctx), (in_mont)); \
+ else \
+ _tmp_res53 = BN_mod_exp2_mont((rr), (a1), \
+ (p1), (a2), (p2), (m), (ctx), (in_mont)); \
+ if(!_tmp_res53) \
+ err_instr; \
} while(0)
+
#define DSA_BN_MOD_EXP(err_instr,dsa,r,a,p,m,ctx,m_ctx) \
do { \
- int _tmp_res53; \
- if((dsa)->meth->bn_mod_exp) \
- _tmp_res53 = (dsa)->meth->bn_mod_exp((dsa), (r), (a), (p), \
- (m), (ctx), (m_ctx)); \
- else \
- _tmp_res53 = BN_mod_exp_mont((r), (a), (p), (m), (ctx), (m_ctx)); \
- if(!_tmp_res53) err_instr; \
+ int _tmp_res53; \
+ if((dsa)->meth->bn_mod_exp) \
+ _tmp_res53 = (dsa)->meth->bn_mod_exp((dsa), (r), \
+ (a), (p), (m), (ctx), (m_ctx)); \
+ else \
+ _tmp_res53 = BN_mod_exp_mont((r), (a), (p), (m), \
+ (ctx), (m_ctx)); \
+ if(!_tmp_res53) \
+ err_instr; \
} while(0)
const DSA_METHOD *DSA_OpenSSL(void)
diff --git a/lib/libcrypto/modes/gcm128.c b/lib/libcrypto/modes/gcm128.c
index 45951878e58..def8cca4964 100644
--- a/lib/libcrypto/modes/gcm128.c
+++ b/lib/libcrypto/modes/gcm128.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gcm128.c,v 1.8 2014/06/12 15:49:30 deraadt Exp $ */
+/* $OpenBSD: gcm128.c,v 1.9 2014/06/27 06:07:35 deraadt Exp $ */
/* ====================================================================
* Copyright (c) 2010 The OpenSSL Project. All rights reserved.
*
@@ -70,18 +70,18 @@
#endif
#define PACK(s) ((size_t)(s)<<(sizeof(size_t)*8-16))
-#define REDUCE1BIT(V) do { \
- if (sizeof(size_t)==8) { \
- u64 T = U64(0xe100000000000000) & (0-(V.lo&1)); \
- V.lo = (V.hi<<63)|(V.lo>>1); \
- V.hi = (V.hi>>1 )^T; \
- } \
- else { \
- u32 T = 0xe1000000U & (0-(u32)(V.lo&1)); \
- V.lo = (V.hi<<63)|(V.lo>>1); \
- V.hi = (V.hi>>1 )^((u64)T<<32); \
- } \
-} while(0)
+#define REDUCE1BIT(V) \
+ do { \
+ if (sizeof(size_t)==8) { \
+ u64 T = U64(0xe100000000000000) & (0-(V.lo&1)); \
+ V.lo = (V.hi<<63)|(V.lo>>1); \
+ V.hi = (V.hi>>1 )^T; \
+ } else { \
+ u32 T = 0xe1000000U & (0-(u32)(V.lo&1)); \
+ V.lo = (V.hi<<63)|(V.lo>>1); \
+ V.hi = (V.hi>>1 )^((u64)T<<32); \
+ } \
+ } while(0)
/*
* Even though permitted values for TABLE_BITS are 8, 4 and 1, it should