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>
This commit is contained in:
Jouni Malinen 2019-11-27 15:21:28 +02:00 committed by Jouni Malinen
parent c54227c26a
commit a4255a207b
3 changed files with 11 additions and 11 deletions

View file

@ -4679,9 +4679,9 @@ static int dpp_build_jwk(struct wpabuf *buf, const char *name, EVP_PKEY *key,
if (!pub) if (!pub)
goto fail; goto fail;
pos = wpabuf_head(pub); 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; 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) if (!x || !y)
goto fail; goto fail;
@ -4853,10 +4853,10 @@ skip_groups:
auth->conf->kid, curve->jws_alg); auth->conf->kid, curve->jws_alg);
signed1 = (char *) base64_url_encode((unsigned char *) jws_prot_hdr, signed1 = (char *) base64_url_encode((unsigned char *) jws_prot_hdr,
os_strlen(jws_prot_hdr), os_strlen(jws_prot_hdr),
&signed1_len, 0); &signed1_len);
signed2 = (char *) base64_url_encode(wpabuf_head(dppcon), signed2 = (char *) base64_url_encode(wpabuf_head(dppcon),
wpabuf_len(dppcon), wpabuf_len(dppcon),
&signed2_len, 0); &signed2_len);
if (!signed1 || !signed2) if (!signed1 || !signed2)
goto fail; goto fail;
@ -4907,7 +4907,7 @@ skip_groups:
wpa_hexdump(MSG_DEBUG, "DPP: signedConnector ECDSA signature (raw r,s)", wpa_hexdump(MSG_DEBUG, "DPP: signedConnector ECDSA signature (raw r,s)",
signature, signature_len); signature, signature_len);
signed3 = (char *) base64_url_encode(signature, signature_len, signed3 = (char *) base64_url_encode(signature, signature_len,
&signed3_len, 0); &signed3_len);
if (!signed3) if (!signed3)
goto fail; goto fail;
@ -6607,7 +6607,7 @@ struct wpabuf * dpp_build_conn_status_result(struct dpp_authentication *auth,
if (ssid) { if (ssid) {
unsigned char *ssid64; unsigned char *ssid64;
ssid64 = base64_url_encode(ssid, ssid_len, NULL, 0); ssid64 = base64_url_encode(ssid, ssid_len, NULL);
if (!ssid64) if (!ssid64)
goto fail; goto fail;
wpabuf_put_str(json, ",\"ssid64\":\""); 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), conf->kid = (char *) base64_url_encode(kid_hash, sizeof(kid_hash),
NULL, 0); NULL);
if (!conf->kid) if (!conf->kid)
goto fail; goto fail;
out: out:
@ -8766,7 +8766,7 @@ char * dpp_corrupt_connector_signature(const char *connector)
wpa_hexdump(MSG_DEBUG, "DPP: Corrupted Connector signature", wpa_hexdump(MSG_DEBUG, "DPP: Corrupted Connector signature",
signature, signature_len); signature, signature_len);
signed3 = (char *) base64_url_encode(signature, signature_len, signed3 = (char *) base64_url_encode(signature, signature_len,
&signed3_len, 0); &signed3_len);
if (!signed3) if (!signed3)
goto fail; goto fail;
os_memcpy(pos, signed3, signed3_len); os_memcpy(pos, signed3, signed3_len);

View file

@ -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, 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);
} }

View file

@ -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, unsigned char * base64_decode(const unsigned char *src, size_t len,
size_t *out_len); size_t *out_len);
unsigned char * base64_url_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);
unsigned char * base64_url_decode(const unsigned char *src, size_t len, unsigned char * base64_url_decode(const unsigned char *src, size_t len,
size_t *out_len); size_t *out_len);