char *base64;
size_t base64len;
- result = curlx_base64_encode((const char *) Curl_bufref_ptr(msg),
+ result = curlx_base64_encode(Curl_bufref_ptr(msg),
Curl_bufref_len(msg), &base64, &base64len);
if(!result)
Curl_bufref_set(msg, base64, base64len, curl_free);
* @unittest: 1302
*/
CURLcode curlx_base64_decode(const char *src,
- unsigned char **outptr, size_t *outlen)
+ uint8_t **outptr, size_t *outlen)
{
size_t srclen = 0;
size_t padding = 0;
}
static CURLcode base64_encode(const char *table64,
- unsigned char padbyte,
- const char *inputbuff, size_t insize,
+ uint8_t padbyte,
+ const uint8_t *inputbuff, size_t insize,
char **outptr, size_t *outlen)
{
char *output;
*
* @unittest: 1302
*/
-CURLcode curlx_base64_encode(const char *inputbuff, size_t insize,
+CURLcode curlx_base64_encode(const uint8_t *inputbuff, size_t insize,
char **outptr, size_t *outlen)
{
return base64_encode(Curl_base64encdec, '=',
*
* @unittest: 1302
*/
-CURLcode curlx_base64url_encode(const char *inputbuff, size_t insize,
+CURLcode curlx_base64url_encode(const uint8_t *inputbuff, size_t insize,
char **outptr, size_t *outlen)
{
return base64_encode(base64url, 0, inputbuff, insize, outptr, outlen);
*
***************************************************************************/
-CURLcode curlx_base64_encode(const char *inputbuff, size_t insize,
+CURLcode curlx_base64_encode(const uint8_t *inputbuff, size_t insize,
char **outptr, size_t *outlen);
-CURLcode curlx_base64url_encode(const char *inputbuff, size_t insize,
+CURLcode curlx_base64url_encode(const uint8_t *inputbuff, size_t insize,
char **outptr, size_t *outlen);
CURLcode curlx_base64_decode(const char *src,
- unsigned char **outptr, size_t *outlen);
+ uint8_t **outptr, size_t *outlen);
extern const char Curl_base64encdec[];
if(!out)
return CURLE_OUT_OF_MEMORY;
- result = curlx_base64_encode(out, strlen(out), &authorization, &size);
+ result = curlx_base64_encode((uint8_t *)out, strlen(out),
+ &authorization, &size);
if(result)
goto fail;
return CURLE_FAILED_INIT;
}
- result = curlx_base64url_encode((const char *)binsettings, binlen,
- &base64, &blen);
+ result = curlx_base64url_encode(binsettings, binlen, &base64, &blen);
if(result) {
curlx_dyn_free(req);
return result;
hostname, ntlm, &ntlmmsg);
if(!result) {
DEBUGASSERT(Curl_bufref_len(&ntlmmsg) != 0);
- result = curlx_base64_encode((const char *) Curl_bufref_ptr(&ntlmmsg),
+ result = curlx_base64_encode(Curl_bufref_ptr(&ntlmmsg),
Curl_bufref_len(&ntlmmsg), &base64, &len);
if(!result) {
free(*allocuserpwd);
result = Curl_auth_create_ntlm_type3_message(data, userp, passwdp,
ntlm, &ntlmmsg);
if(!result && Curl_bufref_len(&ntlmmsg)) {
- result = curlx_base64_encode((const char *) Curl_bufref_ptr(&ntlmmsg),
+ result = curlx_base64_encode(Curl_bufref_ptr(&ntlmmsg),
Curl_bufref_len(&ntlmmsg), &base64, &len);
if(!result) {
free(*allocuserpwd);
curl_strequal(";binary", attr + (attr_len - 7)) ) {
/* Binary attribute, encode to base64. */
if(vals[i]->bv_len) {
- result = curlx_base64_encode(vals[i]->bv_val, vals[i]->bv_len,
+ result = curlx_base64_encode((uint8_t *)vals[i]->bv_val,
+ vals[i]->bv_len,
&val_b64, &val_b64_sz);
if(result) {
ldap_value_free_len(vals);
/* Binary value, encode to base64. */
if(bvals[i].bv_len)
- result = curlx_base64_encode(bvals[i].bv_val, bvals[i].bv_len,
+ result = curlx_base64_encode((uint8_t *)bvals[i].bv_val,
+ bvals[i].bv_len,
&val_b64, &val_b64_sz);
if(!result)
result = client_write(data, STRCONST(": "), val_b64, val_b64_sz,
if(result)
return result;
- result = curlx_base64_encode(cnoncebuf, sizeof(cnoncebuf),
+ result = curlx_base64_encode((uint8_t *)cnoncebuf, sizeof(cnoncebuf),
&cnonce, &cnonce_sz);
if(result)
return result;
char **outptr, size_t *outlen)
{
/* Base64 encode the already generated response */
- CURLcode result = curlx_base64_encode((const char *)nego->output_token,
+ CURLcode result = curlx_base64_encode(nego->output_token,
nego->output_token_length, outptr,
outlen);
if(!result && (!*outptr || !*outlen)) {
/* The length of fingerprint is 32 bytes for SHA256.
* See libssh2_hostkey_hash documentation. */
- if(curlx_base64_encode(fingerprint, 32, &fingerprint_b64,
+ if(curlx_base64_encode((const uint8_t *)fingerprint, 32, &fingerprint_b64,
&fingerprint_b64_len) != CURLE_OK) {
myssh_state(data, sshc, SSH_SESSION_FREE);
return CURLE_PEER_FAILED_VERIFICATION;
int rv = 1;
# ifndef HAVE_BORINGSSL_LIKE
char *inner = NULL;
- unsigned char *rcs = NULL;
+ uint8_t *rcs = NULL;
char *outer = NULL;
# else
const char *inner = NULL;
char *b64str = NULL;
size_t blen = 0;
- result = curlx_base64_encode((const char *)rcs, rcl, &b64str, &blen);
+ result = curlx_base64_encode(rcs, rcl, &b64str, &blen);
if(!result && b64str) {
infof(data, "ECH: retry_configs %s", b64str);
free(b64str);
sha256sumdigest, CURL_SHA256_DIGEST_LENGTH);
if(!encode)
- encode = curlx_base64_encode((char *)sha256sumdigest,
+ encode = curlx_base64_encode(sha256sumdigest,
CURL_SHA256_DIGEST_LENGTH,
&cert_hash, &cert_hash_len);
Curl_safefree(sha256sumdigest);
char *b64str = NULL;
size_t blen = 0;
- result = curlx_base64_encode((const char *)echConfigs, echConfigsLen,
+ result = curlx_base64_encode(echConfigs, echConfigsLen,
&b64str, &blen);
if(!result && b64str)
infof(data, "ECH: (not yet) retry_configs %s", b64str);
curlx_dyn_reset(&out);
/* Generate PEM certificate. */
- result = curlx_base64_encode(cert.certificate.beg,
+ result = curlx_base64_encode((const uint8_t *)cert.certificate.beg,
cert.certificate.end - cert.certificate.beg,
&certptr, &clen);
if(result)
result = Curl_rand(data, rand, sizeof(rand));
if(result)
return result;
- result = curlx_base64_encode((char *)rand, sizeof(rand), &randstr, &randlen);
+ result = curlx_base64_encode(rand, sizeof(rand), &randstr, &randlen);
if(result)
return result;
DEBUGASSERT(randlen < sizeof(keyval));
"# This file was generated by libcurl! Edit at your own risk.\n",
ctx->fp);
- r = curlx_base64_encode((const char *)shmac, shmac_len, &enc, &enc_len);
+ r = curlx_base64_encode(shmac, shmac_len, &enc, &enc_len);
if(r)
goto out;
r = CURLE_WRITE_ERROR;
if(EOF == fputc(':', ctx->fp))
goto out;
tool_safefree(enc);
- r = curlx_base64_encode((const char *)sdata, sdata_len, &enc, &enc_len);
+ r = curlx_base64_encode(sdata, sdata_len, &enc, &enc_len);
if(r)
goto out;
r = CURLE_WRITE_ERROR;
if(clen) {
char *enc;
size_t elen;
- CURLcode result = curlx_base64_encode(c, clen, &enc, &elen);
+ CURLcode result = curlx_base64_encode((uint8_t *)c, clen, &enc, &elen);
if(result) {
err = PARAM_NO_MEM;
break;
size_t dlen;
/* first encode */
- rc = curlx_base64_encode(e->input, e->ilen, &out, &olen);
+ rc = curlx_base64_encode((const uint8_t *)e->input, e->ilen, &out, &olen);
abort_unless(rc == CURLE_OK, "return code should be CURLE_OK");
abort_unless(olen == e->olen, "wrong output size");
if(memcmp(out, e->output, e->olen)) {
struct etest *e = &url[i];
char *out;
size_t olen;
- rc = curlx_base64url_encode(e->input, e->ilen, &out, &olen);
+ rc = curlx_base64url_encode((const uint8_t *)e->input, e->ilen,
+ &out, &olen);
abort_unless(rc == CURLE_OK, "return code should be CURLE_OK");
if(olen != e->olen) {
curl_mfprintf(stderr, "Test %u URL encoded output length %zu "