summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordoug <>2014-10-03 06:02:38 +0000
committerdoug <>2014-10-03 06:02:38 +0000
commit079e384e3438a23d2ddc504f4d34e5a46d9dd6e8 (patch)
treeec58ae0912470726cdc0183e7bc10028ba918120 /src
parent8b25549254bce5b7fc083b5930f89878aa04174f (diff)
downloadopenbsd-079e384e3438a23d2ddc504f4d34e5a46d9dd6e8.tar.gz
openbsd-079e384e3438a23d2ddc504f4d34e5a46d9dd6e8.tar.bz2
openbsd-079e384e3438a23d2ddc504f4d34e5a46d9dd6e8.zip
Use string literals in printf style calls so gcc's -Wformat works.
ok tedu@, miod@
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/asn1/asn1_par.c5
-rw-r--r--src/lib/libcrypto/ocsp/ocsp_ht.c12
-rw-r--r--src/lib/libcrypto/ui/ui_lib.c16
-rw-r--r--src/lib/libssl/src/crypto/asn1/asn1_par.c5
-rw-r--r--src/lib/libssl/src/crypto/ocsp/ocsp_ht.c12
-rw-r--r--src/lib/libssl/src/crypto/ui/ui_lib.c16
-rw-r--r--src/lib/libssl/src/ssl/ssl_ciph.c6
-rw-r--r--src/lib/libssl/ssl_ciph.c6
8 files changed, 38 insertions, 40 deletions
diff --git a/src/lib/libcrypto/asn1/asn1_par.c b/src/lib/libcrypto/asn1/asn1_par.c
index f5e3a8b529..2c8062bb8a 100644
--- a/src/lib/libcrypto/asn1/asn1_par.c
+++ b/src/lib/libcrypto/asn1/asn1_par.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn1_par.c,v 1.20 2014/07/12 16:03:36 miod Exp $ */ 1/* $OpenBSD: asn1_par.c,v 1.21 2014/10/03 06:02:38 doug Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -71,7 +71,6 @@ static int
71asn1_print_info(BIO *bp, int tag, int xclass, int constructed, 71asn1_print_info(BIO *bp, int tag, int xclass, int constructed,
72 int indent) 72 int indent)
73{ 73{
74 static const char fmt[] = "%-18s";
75 char str[128]; 74 char str[128];
76 const char *p; 75 const char *p;
77 76
@@ -95,7 +94,7 @@ asn1_print_info(BIO *bp, int tag, int xclass, int constructed,
95 else 94 else
96 p = ASN1_tag2str(tag); 95 p = ASN1_tag2str(tag);
97 96
98 if (BIO_printf(bp, fmt, p) <= 0) 97 if (BIO_printf(bp, "%-18s", p) <= 0)
99 goto err; 98 goto err;
100 return (1); 99 return (1);
101err: 100err:
diff --git a/src/lib/libcrypto/ocsp/ocsp_ht.c b/src/lib/libcrypto/ocsp/ocsp_ht.c
index 5d1627192c..4d21543396 100644
--- a/src/lib/libcrypto/ocsp/ocsp_ht.c
+++ b/src/lib/libcrypto/ocsp/ocsp_ht.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ocsp_ht.c,v 1.21 2014/07/25 06:05:32 doug Exp $ */ 1/* $OpenBSD: ocsp_ht.c,v 1.22 2014/10/03 06:02:38 doug Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -119,11 +119,8 @@ OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx)
119int 119int
120OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req) 120OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req)
121{ 121{
122 static const char req_hdr[] = 122 if (BIO_printf(rctx->mem, "Content-Type: application/ocsp-request\r\n"
123 "Content-Type: application/ocsp-request\r\n" 123 "Content-Length: %d\r\n\r\n", i2d_OCSP_REQUEST(req, NULL)) <= 0)
124 "Content-Length: %d\r\n\r\n";
125
126 if (BIO_printf(rctx->mem, req_hdr, i2d_OCSP_REQUEST(req, NULL)) <= 0)
127 return 0; 124 return 0;
128 if (i2d_OCSP_REQUEST_bio(rctx->mem, req) <= 0) 125 if (i2d_OCSP_REQUEST_bio(rctx->mem, req) <= 0)
129 return 0; 126 return 0;
@@ -154,7 +151,6 @@ OCSP_REQ_CTX_add1_header(OCSP_REQ_CTX *rctx, const char *name,
154OCSP_REQ_CTX * 151OCSP_REQ_CTX *
155OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req, int maxline) 152OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req, int maxline)
156{ 153{
157 static const char post_hdr[] = "POST %s HTTP/1.0\r\n";
158 OCSP_REQ_CTX *rctx; 154 OCSP_REQ_CTX *rctx;
159 155
160 rctx = malloc(sizeof(OCSP_REQ_CTX)); 156 rctx = malloc(sizeof(OCSP_REQ_CTX));
@@ -177,7 +173,7 @@ OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req, int maxline)
177 if (!path) 173 if (!path)
178 path = "/"; 174 path = "/";
179 175
180 if (BIO_printf(rctx->mem, post_hdr, path) <= 0) { 176 if (BIO_printf(rctx->mem, "POST %s HTTP/1.0\r\n", path) <= 0) {
181 free(rctx->iobuf); 177 free(rctx->iobuf);
182 BIO_free(rctx->mem); 178 BIO_free(rctx->mem);
183 free(rctx); 179 free(rctx);
diff --git a/src/lib/libcrypto/ui/ui_lib.c b/src/lib/libcrypto/ui/ui_lib.c
index baf86d7635..2c53f534e7 100644
--- a/src/lib/libcrypto/ui/ui_lib.c
+++ b/src/lib/libcrypto/ui/ui_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ui_lib.c,v 1.28 2014/07/22 02:21:20 beck Exp $ */ 1/* $OpenBSD: ui_lib.c,v 1.29 2014/10/03 06:02:38 doug Exp $ */
2/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL 2/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
3 * project 2001. 3 * project 2001.
4 */ 4 */
@@ -386,7 +386,6 @@ UI_dup_error_string(UI *ui, const char *text)
386char * 386char *
387UI_construct_prompt(UI *ui, const char *object_desc, const char *object_name) 387UI_construct_prompt(UI *ui, const char *object_desc, const char *object_name)
388{ 388{
389 const char *format = "Enter %s for %s:";
390 char *prompt; 389 char *prompt;
391 390
392 if (ui->meth->ui_construct_prompt) 391 if (ui->meth->ui_construct_prompt)
@@ -395,10 +394,15 @@ UI_construct_prompt(UI *ui, const char *object_desc, const char *object_name)
395 394
396 if (object_desc == NULL) 395 if (object_desc == NULL)
397 return NULL; 396 return NULL;
398 if (object_name == NULL) 397
399 format = "Enter %s:"; 398 if (object_name == NULL) {
400 if (asprintf(&prompt, format, object_desc, object_name) == -1) 399 if (asprintf(&prompt, "Enter %s:", object_desc) == -1)
401 return NULL; 400 return (NULL);
401 } else {
402 if (asprintf(&prompt, "Enter %s for %s:", object_desc,
403 object_name) == -1)
404 return (NULL);
405 }
402 406
403 return prompt; 407 return prompt;
404} 408}
diff --git a/src/lib/libssl/src/crypto/asn1/asn1_par.c b/src/lib/libssl/src/crypto/asn1/asn1_par.c
index f5e3a8b529..2c8062bb8a 100644
--- a/src/lib/libssl/src/crypto/asn1/asn1_par.c
+++ b/src/lib/libssl/src/crypto/asn1/asn1_par.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn1_par.c,v 1.20 2014/07/12 16:03:36 miod Exp $ */ 1/* $OpenBSD: asn1_par.c,v 1.21 2014/10/03 06:02:38 doug Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -71,7 +71,6 @@ static int
71asn1_print_info(BIO *bp, int tag, int xclass, int constructed, 71asn1_print_info(BIO *bp, int tag, int xclass, int constructed,
72 int indent) 72 int indent)
73{ 73{
74 static const char fmt[] = "%-18s";
75 char str[128]; 74 char str[128];
76 const char *p; 75 const char *p;
77 76
@@ -95,7 +94,7 @@ asn1_print_info(BIO *bp, int tag, int xclass, int constructed,
95 else 94 else
96 p = ASN1_tag2str(tag); 95 p = ASN1_tag2str(tag);
97 96
98 if (BIO_printf(bp, fmt, p) <= 0) 97 if (BIO_printf(bp, "%-18s", p) <= 0)
99 goto err; 98 goto err;
100 return (1); 99 return (1);
101err: 100err:
diff --git a/src/lib/libssl/src/crypto/ocsp/ocsp_ht.c b/src/lib/libssl/src/crypto/ocsp/ocsp_ht.c
index 5d1627192c..4d21543396 100644
--- a/src/lib/libssl/src/crypto/ocsp/ocsp_ht.c
+++ b/src/lib/libssl/src/crypto/ocsp/ocsp_ht.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ocsp_ht.c,v 1.21 2014/07/25 06:05:32 doug Exp $ */ 1/* $OpenBSD: ocsp_ht.c,v 1.22 2014/10/03 06:02:38 doug Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -119,11 +119,8 @@ OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx)
119int 119int
120OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req) 120OCSP_REQ_CTX_set1_req(OCSP_REQ_CTX *rctx, OCSP_REQUEST *req)
121{ 121{
122 static const char req_hdr[] = 122 if (BIO_printf(rctx->mem, "Content-Type: application/ocsp-request\r\n"
123 "Content-Type: application/ocsp-request\r\n" 123 "Content-Length: %d\r\n\r\n", i2d_OCSP_REQUEST(req, NULL)) <= 0)
124 "Content-Length: %d\r\n\r\n";
125
126 if (BIO_printf(rctx->mem, req_hdr, i2d_OCSP_REQUEST(req, NULL)) <= 0)
127 return 0; 124 return 0;
128 if (i2d_OCSP_REQUEST_bio(rctx->mem, req) <= 0) 125 if (i2d_OCSP_REQUEST_bio(rctx->mem, req) <= 0)
129 return 0; 126 return 0;
@@ -154,7 +151,6 @@ OCSP_REQ_CTX_add1_header(OCSP_REQ_CTX *rctx, const char *name,
154OCSP_REQ_CTX * 151OCSP_REQ_CTX *
155OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req, int maxline) 152OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req, int maxline)
156{ 153{
157 static const char post_hdr[] = "POST %s HTTP/1.0\r\n";
158 OCSP_REQ_CTX *rctx; 154 OCSP_REQ_CTX *rctx;
159 155
160 rctx = malloc(sizeof(OCSP_REQ_CTX)); 156 rctx = malloc(sizeof(OCSP_REQ_CTX));
@@ -177,7 +173,7 @@ OCSP_sendreq_new(BIO *io, char *path, OCSP_REQUEST *req, int maxline)
177 if (!path) 173 if (!path)
178 path = "/"; 174 path = "/";
179 175
180 if (BIO_printf(rctx->mem, post_hdr, path) <= 0) { 176 if (BIO_printf(rctx->mem, "POST %s HTTP/1.0\r\n", path) <= 0) {
181 free(rctx->iobuf); 177 free(rctx->iobuf);
182 BIO_free(rctx->mem); 178 BIO_free(rctx->mem);
183 free(rctx); 179 free(rctx);
diff --git a/src/lib/libssl/src/crypto/ui/ui_lib.c b/src/lib/libssl/src/crypto/ui/ui_lib.c
index baf86d7635..2c53f534e7 100644
--- a/src/lib/libssl/src/crypto/ui/ui_lib.c
+++ b/src/lib/libssl/src/crypto/ui/ui_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ui_lib.c,v 1.28 2014/07/22 02:21:20 beck Exp $ */ 1/* $OpenBSD: ui_lib.c,v 1.29 2014/10/03 06:02:38 doug Exp $ */
2/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL 2/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
3 * project 2001. 3 * project 2001.
4 */ 4 */
@@ -386,7 +386,6 @@ UI_dup_error_string(UI *ui, const char *text)
386char * 386char *
387UI_construct_prompt(UI *ui, const char *object_desc, const char *object_name) 387UI_construct_prompt(UI *ui, const char *object_desc, const char *object_name)
388{ 388{
389 const char *format = "Enter %s for %s:";
390 char *prompt; 389 char *prompt;
391 390
392 if (ui->meth->ui_construct_prompt) 391 if (ui->meth->ui_construct_prompt)
@@ -395,10 +394,15 @@ UI_construct_prompt(UI *ui, const char *object_desc, const char *object_name)
395 394
396 if (object_desc == NULL) 395 if (object_desc == NULL)
397 return NULL; 396 return NULL;
398 if (object_name == NULL) 397
399 format = "Enter %s:"; 398 if (object_name == NULL) {
400 if (asprintf(&prompt, format, object_desc, object_name) == -1) 399 if (asprintf(&prompt, "Enter %s:", object_desc) == -1)
401 return NULL; 400 return (NULL);
401 } else {
402 if (asprintf(&prompt, "Enter %s for %s:", object_desc,
403 object_name) == -1)
404 return (NULL);
405 }
402 406
403 return prompt; 407 return prompt;
404} 408}
diff --git a/src/lib/libssl/src/ssl/ssl_ciph.c b/src/lib/libssl/src/ssl/ssl_ciph.c
index 586ae13974..35e81e18f1 100644
--- a/src/lib/libssl/src/ssl/ssl_ciph.c
+++ b/src/lib/libssl/src/ssl/ssl_ciph.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_ciph.c,v 1.68 2014/09/19 16:02:35 jsing Exp $ */ 1/* $OpenBSD: ssl_ciph.c,v 1.69 2014/10/03 06:02:38 doug Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -1559,7 +1559,6 @@ ssl_create_cipher_list(const SSL_METHOD *ssl_method,
1559char * 1559char *
1560SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int len) 1560SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int len)
1561{ 1561{
1562 static const char *fmt="%-23s %s Kx=%-8s Au=%-4s Enc=%-9s Mac=%-4s\n";
1563 unsigned long alg_mkey, alg_auth, alg_enc, alg_mac, alg_ssl, alg2; 1562 unsigned long alg_mkey, alg_auth, alg_enc, alg_mac, alg_ssl, alg2;
1564 const char *ver, *kx, *au, *enc, *mac; 1563 const char *ver, *kx, *au, *enc, *mac;
1565 char *ret; 1564 char *ret;
@@ -1692,7 +1691,8 @@ SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int len)
1692 break; 1691 break;
1693 } 1692 }
1694 1693
1695 if (asprintf(&ret, fmt, cipher->name, ver, kx, au, enc, mac) == -1) 1694 if (asprintf(&ret, "%-23s %s Kx=%-8s Au=%-4s Enc=%-9s Mac=%-4s\n",
1695 cipher->name, ver, kx, au, enc, mac) == -1)
1696 return "OPENSSL_malloc Error"; 1696 return "OPENSSL_malloc Error";
1697 1697
1698 if (buf != NULL) { 1698 if (buf != NULL) {
diff --git a/src/lib/libssl/ssl_ciph.c b/src/lib/libssl/ssl_ciph.c
index 586ae13974..35e81e18f1 100644
--- a/src/lib/libssl/ssl_ciph.c
+++ b/src/lib/libssl/ssl_ciph.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ssl_ciph.c,v 1.68 2014/09/19 16:02:35 jsing Exp $ */ 1/* $OpenBSD: ssl_ciph.c,v 1.69 2014/10/03 06:02:38 doug Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -1559,7 +1559,6 @@ ssl_create_cipher_list(const SSL_METHOD *ssl_method,
1559char * 1559char *
1560SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int len) 1560SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int len)
1561{ 1561{
1562 static const char *fmt="%-23s %s Kx=%-8s Au=%-4s Enc=%-9s Mac=%-4s\n";
1563 unsigned long alg_mkey, alg_auth, alg_enc, alg_mac, alg_ssl, alg2; 1562 unsigned long alg_mkey, alg_auth, alg_enc, alg_mac, alg_ssl, alg2;
1564 const char *ver, *kx, *au, *enc, *mac; 1563 const char *ver, *kx, *au, *enc, *mac;
1565 char *ret; 1564 char *ret;
@@ -1692,7 +1691,8 @@ SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int len)
1692 break; 1691 break;
1693 } 1692 }
1694 1693
1695 if (asprintf(&ret, fmt, cipher->name, ver, kx, au, enc, mac) == -1) 1694 if (asprintf(&ret, "%-23s %s Kx=%-8s Au=%-4s Enc=%-9s Mac=%-4s\n",
1695 cipher->name, ver, kx, au, enc, mac) == -1)
1696 return "OPENSSL_malloc Error"; 1696 return "OPENSSL_malloc Error";
1697 1697
1698 if (buf != NULL) { 1698 if (buf != NULL) {