Skip to content

Commit

Permalink
Merge pull request wolfSSL#8216 from douzzer/20241122-opensslcoexist-…
Browse files Browse the repository at this point in the history
…expansion

20241122-opensslcoexist-expansion
  • Loading branch information
dgarske authored Nov 25, 2024
2 parents fc7ba56 + bfeb0ad commit 71abfa3
Show file tree
Hide file tree
Showing 42 changed files with 1,881 additions and 1,716 deletions.
158 changes: 79 additions & 79 deletions linuxkm/lkcapi_glue.c

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -796,16 +796,16 @@ static int ExportCipherSpecState(WOLFSSL* ssl, byte* exp, word32 len, byte ver,
ssl->specs.bulk_cipher_algorithm == wolfssl_aes) {
byte *pt = (byte*)ssl->encrypt.aes->reg;

if ((idx + 2*AES_BLOCK_SIZE) > len) {
if ((idx + 2*WC_AES_BLOCK_SIZE) > len) {
WOLFSSL_MSG("Can not fit AES state into buffer");
return BUFFER_E;
}
XMEMCPY(exp + idx, pt, AES_BLOCK_SIZE);
idx += AES_BLOCK_SIZE;
XMEMCPY(exp + idx, pt, WC_AES_BLOCK_SIZE);
idx += WC_AES_BLOCK_SIZE;

pt = (byte*)ssl->decrypt.aes->reg;
XMEMCPY(exp + idx, pt, AES_BLOCK_SIZE);
idx += AES_BLOCK_SIZE;
XMEMCPY(exp + idx, pt, WC_AES_BLOCK_SIZE);
idx += WC_AES_BLOCK_SIZE;
}

WOLFSSL_LEAVE("ExportCipherSpecState", idx);
Expand Down Expand Up @@ -1048,12 +1048,12 @@ static int ImportCipherSpecState(WOLFSSL* ssl, const byte* exp, word32 len,
if (type == WOLFSSL_EXPORT_TLS &&
ssl->specs.bulk_cipher_algorithm == wolfssl_aes) {
byte *pt = (byte*)ssl->encrypt.aes->reg;
XMEMCPY(pt, exp + idx, AES_BLOCK_SIZE);
idx += AES_BLOCK_SIZE;
XMEMCPY(pt, exp + idx, WC_AES_BLOCK_SIZE);
idx += WC_AES_BLOCK_SIZE;

pt = (byte*)ssl->decrypt.aes->reg;
XMEMCPY(pt, exp + idx, AES_BLOCK_SIZE);
idx += AES_BLOCK_SIZE;
XMEMCPY(pt, exp + idx, WC_AES_BLOCK_SIZE);
idx += WC_AES_BLOCK_SIZE;
}

WOLFSSL_LEAVE("ImportCipherSpecState", idx);
Expand Down Expand Up @@ -2108,7 +2108,7 @@ int wolfSSL_session_export_internal(WOLFSSL* ssl, byte* buf, word32* sz,

/* possible AES state needed */
if (type == WOLFSSL_EXPORT_TLS) {
*sz += AES_BLOCK_SIZE*2;
*sz += WC_AES_BLOCK_SIZE*2;
}
ret = WC_NO_ERR_TRACE(LENGTH_ONLY_E);
}
Expand Down Expand Up @@ -39554,7 +39554,7 @@ static int TicketEncDec(byte* key, int keyLen, byte* iv, byte* aad, int aadSz,
}
if (ret == 0) {
ret = wc_AesGcmEncrypt(aes, in, out, inLen, iv, GCM_NONCE_MID_SZ,
tag, AES_BLOCK_SIZE, aad, aadSz);
tag, WC_AES_BLOCK_SIZE, aad, aadSz);
}
wc_AesFree(aes);
}
Expand All @@ -39565,7 +39565,7 @@ static int TicketEncDec(byte* key, int keyLen, byte* iv, byte* aad, int aadSz,
}
if (ret == 0) {
ret = wc_AesGcmDecrypt(aes, in, out, inLen, iv, GCM_NONCE_MID_SZ,
tag, AES_BLOCK_SIZE, aad, aadSz);
tag, WC_AES_BLOCK_SIZE, aad, aadSz);
}
wc_AesFree(aes);
}
Expand Down
150 changes: 75 additions & 75 deletions src/keys.c

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/pk.c
Original file line number Diff line number Diff line change
Expand Up @@ -12980,7 +12980,7 @@ int wolfSSL_PEM_write_mem_ECPrivateKey(WOLFSSL_EC_KEY* ec,
/* Calculate maximum size of DER encoding.
* 4 > size of pub, priv + ASN.1 additional information */
der_max_len = 4 * (word32)wc_ecc_size((ecc_key*)ec->internal) +
AES_BLOCK_SIZE;
WC_AES_BLOCK_SIZE;

/* Allocate buffer big enough to hold encoding. */
derBuf = (byte*)XMALLOC((size_t)der_max_len, NULL,
Expand Down
10 changes: 5 additions & 5 deletions src/ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -24982,7 +24982,7 @@ int wolfSSL_RAND_load_file(const char* fname, long len)
case WC_AES_192_CTR_TYPE :
case WC_AES_256_CTR_TYPE :
WOLFSSL_MSG("AES CTR");
XMEMCPY(ctx->iv, &ctx->cipher.aes.reg, AES_BLOCK_SIZE);
XMEMCPY(ctx->iv, &ctx->cipher.aes.reg, WC_AES_BLOCK_SIZE);
break;
#endif /* WOLFSSL_AES_COUNTER */
#ifdef WOLFSSL_AES_CFB
Expand Down Expand Up @@ -25121,15 +25121,15 @@ int wolfSSL_RAND_load_file(const char* fname, long len)
case WC_AES_192_CBC_TYPE :
case WC_AES_256_CBC_TYPE :
WOLFSSL_MSG("AES CBC");
XMEMCPY(&ctx->cipher.aes.reg, ctx->iv, AES_BLOCK_SIZE);
XMEMCPY(&ctx->cipher.aes.reg, ctx->iv, WC_AES_BLOCK_SIZE);
break;
#endif
#ifdef HAVE_AESGCM
case WC_AES_128_GCM_TYPE :
case WC_AES_192_GCM_TYPE :
case WC_AES_256_GCM_TYPE :
WOLFSSL_MSG("AES GCM");
XMEMCPY(&ctx->cipher.aes.reg, ctx->iv, AES_BLOCK_SIZE);
XMEMCPY(&ctx->cipher.aes.reg, ctx->iv, WC_AES_BLOCK_SIZE);
break;
#endif
#ifdef HAVE_AES_ECB
Expand All @@ -25144,7 +25144,7 @@ int wolfSSL_RAND_load_file(const char* fname, long len)
case WC_AES_192_CTR_TYPE :
case WC_AES_256_CTR_TYPE :
WOLFSSL_MSG("AES CTR");
XMEMCPY(&ctx->cipher.aes.reg, ctx->iv, AES_BLOCK_SIZE);
XMEMCPY(&ctx->cipher.aes.reg, ctx->iv, WC_AES_BLOCK_SIZE);
break;
#endif

Expand Down Expand Up @@ -25274,7 +25274,7 @@ void wolfSSL_aes_ctr_iv(WOLFSSL_EVP_CIPHER_CTX* ctx, int doset,
if (doset)
(void)wc_AesSetIV(&ctx->cipher.aes, iv); /* OpenSSL compat, no ret */
else
XMEMCPY(iv, &ctx->cipher.aes.reg, AES_BLOCK_SIZE);
XMEMCPY(iv, &ctx->cipher.aes.reg, WC_AES_BLOCK_SIZE);
}

#endif /* NO_AES */
Expand Down
Loading

0 comments on commit 71abfa3

Please sign in to comment.