aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouni Malinen <jouni@codeaurora.org>2019-11-27 13:21:28 (GMT)
committerJouni Malinen <j@w1.fi>2019-11-27 13:35:19 (GMT)
commita4255a207b21747406e0ed4328e195876aac8fd7 (patch)
treef408c2cbdc44d25a164b92bf5d2a3b3dfa3c956e
parentc54227c26a9f55ca619037255f52e5fa4a90cf63 (diff)
downloadhostap-a4255a207b21747406e0ed4328e195876aac8fd7.zip
hostap-a4255a207b21747406e0ed4328e195876aac8fd7.tar.gz
hostap-a4255a207b21747406e0ed4328e195876aac8fd7.tar.bz2
Simplify base64_url_encode() prototype
There is no use case for adding padding into the base64url encoded strings, so remove the unneeded add_pad argument that was hardcoded to 0 in all callers. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
-rw-r--r--src/common/dpp.c16
-rw-r--r--src/utils/base64.c4
-rw-r--r--src/utils/base64.h2
3 files changed, 11 insertions, 11 deletions
diff --git a/src/common/dpp.c b/src/common/dpp.c
index f015106..b82ac8a 100644
--- a/src/common/dpp.c
+++ b/src/common/dpp.c
@@ -4679,9 +4679,9 @@ static int dpp_build_jwk(struct wpabuf *buf, const char *name, EVP_PKEY *key,
if (!pub)
goto fail;
pos = wpabuf_head(pub);
- x = (char *) base64_url_encode(pos, curve->prime_len, NULL, 0);
+ x = (char *) base64_url_encode(pos, curve->prime_len, NULL);
pos += curve->prime_len;
- y = (char *) base64_url_encode(pos, curve->prime_len, NULL, 0);
+ y = (char *) base64_url_encode(pos, curve->prime_len, NULL);
if (!x || !y)
goto fail;
@@ -4853,10 +4853,10 @@ skip_groups:
auth->conf->kid, curve->jws_alg);
signed1 = (char *) base64_url_encode((unsigned char *) jws_prot_hdr,
os_strlen(jws_prot_hdr),
- &signed1_len, 0);
+ &signed1_len);
signed2 = (char *) base64_url_encode(wpabuf_head(dppcon),
wpabuf_len(dppcon),
- &signed2_len, 0);
+ &signed2_len);
if (!signed1 || !signed2)
goto fail;
@@ -4907,7 +4907,7 @@ skip_groups:
wpa_hexdump(MSG_DEBUG, "DPP: signedConnector ECDSA signature (raw r,s)",
signature, signature_len);
signed3 = (char *) base64_url_encode(signature, signature_len,
- &signed3_len, 0);
+ &signed3_len);
if (!signed3)
goto fail;
@@ -6607,7 +6607,7 @@ struct wpabuf * dpp_build_conn_status_result(struct dpp_authentication *auth,
if (ssid) {
unsigned char *ssid64;
- ssid64 = base64_url_encode(ssid, ssid_len, NULL, 0);
+ ssid64 = base64_url_encode(ssid, ssid_len, NULL);
if (!ssid64)
goto fail;
wpabuf_put_str(json, ",\"ssid64\":\"");
@@ -6759,7 +6759,7 @@ dpp_keygen_configurator(const char *curve, const u8 *privkey,
}
conf->kid = (char *) base64_url_encode(kid_hash, sizeof(kid_hash),
- NULL, 0);
+ NULL);
if (!conf->kid)
goto fail;
out:
@@ -8766,7 +8766,7 @@ char * dpp_corrupt_connector_signature(const char *connector)
wpa_hexdump(MSG_DEBUG, "DPP: Corrupted Connector signature",
signature, signature_len);
signed3 = (char *) base64_url_encode(signature, signature_len,
- &signed3_len, 0);
+ &signed3_len);
if (!signed3)
goto fail;
os_memcpy(pos, signed3, signed3_len);
diff --git a/src/utils/base64.c b/src/utils/base64.c
index 53a92f4..50a828a 100644
--- a/src/utils/base64.c
+++ b/src/utils/base64.c
@@ -173,9 +173,9 @@ unsigned char * base64_encode(const unsigned char *src, size_t len,
unsigned char * base64_url_encode(const unsigned char *src, size_t len,
- size_t *out_len, int add_pad)
+ size_t *out_len)
{
- return base64_gen_encode(src, len, out_len, base64_url_table, add_pad);
+ return base64_gen_encode(src, len, out_len, base64_url_table, 0);
}
diff --git a/src/utils/base64.h b/src/utils/base64.h
index 5a72c3e..2e755a8 100644
--- a/src/utils/base64.h
+++ b/src/utils/base64.h
@@ -14,7 +14,7 @@ unsigned char * base64_encode(const unsigned char *src, size_t len,
unsigned char * base64_decode(const unsigned char *src, size_t len,
size_t *out_len);
unsigned char * base64_url_encode(const unsigned char *src, size_t len,
- size_t *out_len, int add_pad);
+ size_t *out_len);
unsigned char * base64_url_decode(const unsigned char *src, size_t len,
size_t *out_len);