OPENSSL_UNTARGET_AVX2
OPENSSL_TARGET_AVX2
-int encode_base64_avx2(EVP_ENCODE_CTX *ctx, unsigned char *dst,
+size_t encode_base64_avx2(EVP_ENCODE_CTX *ctx, unsigned char *dst,
const unsigned char *src, int srclen, int ctx_length,
int *final_wrap_cnt)
{
*out++ = '\n';
}
- return (int)(out - (uint8_t *)dst) + +evp_encodeblock_int(ctx, out, src + i, srclen - i, final_wrap_cnt);
+ return (size_t)(out - (uint8_t *)dst) + evp_encodeblock_int(ctx, out, src + i, srclen - i, final_wrap_cnt);
}
OPENSSL_UNTARGET_AVX2
#endif /* !defined(_M_ARM64EC) */
#define OSSL_CRYPTO_EVP_B64_AVX2_H
#include <openssl/evp.h>
+#include <stddef.h>
#if defined(__x86_64) || defined(__x86_64__) || defined(_M_AMD64) || defined(_M_X64)
#if !defined(_M_ARM64EC)
-int encode_base64_avx2(EVP_ENCODE_CTX *ctx,
+size_t encode_base64_avx2(EVP_ENCODE_CTX *ctx,
unsigned char *out, const unsigned char *src, int srclen,
int newlines, int *wrap_cnt);
#endif /* !defined(_M_ARM64EC) */
static unsigned char conv_ascii2bin(unsigned char a,
const unsigned char *table);
-int evp_encodeblock_int(EVP_ENCODE_CTX *ctx, unsigned char *t,
+size_t evp_encodeblock_int(EVP_ENCODE_CTX *ctx, unsigned char *t,
const unsigned char *f, int dlen, int *wrap_cnt);
static int evp_decodeblock_int(EVP_ENCODE_CTX *ctx, unsigned char *t,
const unsigned char *f, int n, int eof);
int EVP_EncodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl,
const unsigned char *in, int inl)
{
- int i, j;
+ int i;
+ size_t j;
size_t total = 0;
*outl = 0;
void EVP_EncodeFinal(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl)
{
- int ret = 0;
+ size_t ret = 0;
int wrap_cnt = 0;
if (ctx->num != 0) {
ret = evp_encodeblock_int(ctx, out, ctx->enc_data, ctx->num,
&wrap_cnt);
- if (ossl_assert(ret >= 0)) {
+ if (ret > 0) {
if ((ctx->flags & EVP_ENCODE_CTX_NO_NEWLINES) == 0)
out[ret++] = '\n';
out[ret] = '\0';
ctx->num = 0;
}
}
- *outl = ret;
+ *outl = (int)ret;
}
int EVP_EncodeBlock(unsigned char *t, const unsigned char *f, int dlen)
int wrap_cnt = 0;
#if defined(__AVX2__)
- return encode_base64_avx2(NULL, t, f, dlen, 0, &wrap_cnt);
+ return (int)encode_base64_avx2(NULL, t, f, dlen, 0, &wrap_cnt);
#elif defined(HAS_IA32CAP_IS_64)
if ((OPENSSL_ia32cap_P[2] & (1u << 5)) != 0)
- return encode_base64_avx2(NULL, t, f, dlen, 0, &wrap_cnt);
+ return (int)encode_base64_avx2(NULL, t, f, dlen, 0, &wrap_cnt);
else
- return evp_encodeblock_int(NULL, t, f, dlen, &wrap_cnt);
+ return (int)evp_encodeblock_int(NULL, t, f, dlen, &wrap_cnt);
#else
- return evp_encodeblock_int(NULL, t, f, dlen, &wrap_cnt);
+ return (int)evp_encodeblock_int(NULL, t, f, dlen, &wrap_cnt);
#endif
}