Skip to content

Commit

Permalink
fedora crypto-policies: line lengths cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
philljj committed Nov 20, 2024
1 parent 07fd60a commit 2b8ae8b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 24 deletions.
22 changes: 12 additions & 10 deletions src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -2497,6 +2497,7 @@ int InitSSL_Ctx(WOLFSSL_CTX* ctx, WOLFSSL_METHOD* method, void* heap)

XMEMSET(ctx, 0, sizeof(WOLFSSL_CTX));

ctx->method = method;
if (heap == NULL) {
ctx->heap = ctx; /* defaults to self */
}
Expand All @@ -2505,14 +2506,12 @@ int InitSSL_Ctx(WOLFSSL_CTX* ctx, WOLFSSL_METHOD* method, void* heap)
}
ctx->timeout = WOLFSSL_SESSION_TIMEOUT;

ctx->method = method;

#ifdef WOLFSSL_DTLS
#ifdef WOLFSSL_DTLS
if (method->version.major == DTLS_MAJOR) {
ctx->minDowngrade = WOLFSSL_MIN_DTLS_DOWNGRADE;
}
else
#endif /* WOLFSSL_DTLS */
#endif /* WOLFSSL_DTLS */
{
/* current default: TLSv1_MINOR */
ctx->minDowngrade = WOLFSSL_MIN_DOWNGRADE;
Expand Down Expand Up @@ -3621,7 +3620,8 @@ void InitSuites(Suites* suites, ProtocolVersion pv, int keySz, word16 haveRSA,

#ifdef BUILD_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
#ifdef OPENSSL_EXTRA
if ((tls1_2 && haveRSA && haveAES128) || (tls1_2 && haveECDSAsig && haveAES128)) {
if ((tls1_2 && haveRSA && haveAES128) ||
(tls1_2 && haveECDSAsig && haveAES128)) {
#else
if (tls1_2 && haveRSA && haveAES128) {
#endif
Expand Down Expand Up @@ -3779,7 +3779,8 @@ void InitSuites(Suites* suites, ProtocolVersion pv, int keySz, word16 haveRSA,

#ifdef BUILD_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
#ifdef OPENSSL_EXTRA
if ((tls1_2 && haveRSA && haveAES128) || (tls1_2 && haveECDSAsig && haveAES128)) {
if ((tls1_2 && haveRSA && haveAES128) ||
(tls1_2 && haveECDSAsig && haveAES128)) {
#else
if (tls1_2 && haveRSA && haveAES128) {
#endif
Expand Down Expand Up @@ -3917,7 +3918,8 @@ void InitSuites(Suites* suites, ProtocolVersion pv, int keySz, word16 haveRSA,

#ifdef BUILD_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
#ifdef OPENSSL_EXTRA
if ((tls && haveRSA && haveAES128 && haveSHA1) || (tls && haveECDSAsig && haveAES128 && haveSHA1)) {
if ((tls && haveRSA && haveAES128 && haveSHA1) ||
(tls && haveECDSAsig && haveAES128 && haveSHA1)) {
#else
if (tls && haveRSA && haveAES128 && haveSHA1) {
#endif
Expand Down Expand Up @@ -4374,7 +4376,7 @@ void InitSuites(Suites* suites, ProtocolVersion pv, int keySz, word16 haveRSA,
#endif

#ifdef BUILD_TLS_PSK_WITH_NULL_SHA
if (tls && havePSK && haveNull && haveSHA1) {
if (tls && havePSK && haveNull) {
suites->suites[idx++] = CIPHER_BYTE;
suites->suites[idx++] = TLS_PSK_WITH_NULL_SHA;
}
Expand Down Expand Up @@ -27960,8 +27962,8 @@ static int ParseCipherList(Suites* suites,
#endif
{
suites->suiteSz = (word16)idx;
InitSuitesHashSigAlgo(suites->hashSigAlgo, haveSig, 1,
keySz, &suites->hashSigAlgoSz);
InitSuitesHashSigAlgo(suites->hashSigAlgo, haveSig, 1, keySz,
&suites->hashSigAlgoSz);
}

#ifdef HAVE_RENEGOTIATION_INDICATION
Expand Down
4 changes: 2 additions & 2 deletions src/ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1122,9 +1122,9 @@ WOLFSSL_CTX* wolfSSL_CTX_new_ex(WOLFSSL_METHOD* method, void* heap)
if (wolfSSL_CTX_set_min_proto_version(ctx,
(method->version.major == DTLS_MAJOR) ?
DTLS1_VERSION : SSL3_VERSION) != WOLFSSL_SUCCESS ||
#ifdef HAVE_ANON
#ifdef HAVE_ANON
wolfSSL_CTX_allow_anon_cipher(ctx) != WOLFSSL_SUCCESS ||
#endif
#endif
wolfSSL_CTX_set_group_messages(ctx) != WOLFSSL_SUCCESS) {
WOLFSSL_MSG("Setting OpenSSL CTX defaults failed");
wolfSSL_CTX_free(ctx);
Expand Down
3 changes: 2 additions & 1 deletion wolfssl/error-ssl.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ enum wolfSSL_ErrorCodes {
WOLFSSL_EVP_R_DECODE_ERROR = -514,
WOLFSSL_EVP_R_PRIVATE_KEY_DECODE_ERROR = -515,

CRYPTO_POLICY_FORBIDDEN = -516, /* operation forbidden by system crypto-policy */
CRYPTO_POLICY_FORBIDDEN = -516, /* operation forbidden by system
* crypto-policy */

WOLFSSL_LAST_E = -516

Expand Down
22 changes: 11 additions & 11 deletions wolfssl/ssl.h
Original file line number Diff line number Diff line change
Expand Up @@ -3068,21 +3068,21 @@ WOLFSSL_ABI WOLFSSL_API int wolfSSL_Init(void);
WOLFSSL_ABI WOLFSSL_API int wolfSSL_Cleanup(void);

#if defined(WOLFSSL_SYS_CRYPTO_POLICY)
WOLFSSL_API int wolfSSL_crypto_policy_enable(const char * policy);
WOLFSSL_API int wolfSSL_crypto_policy_enable_buffer(const char * buf);
WOLFSSL_API void wolfSSL_crypto_policy_disable(void);
WOLFSSL_API int wolfSSL_crypto_policy_is_enabled(void);
WOLFSSL_API int wolfSSL_crypto_policy_enable(const char * policy);
WOLFSSL_API int wolfSSL_crypto_policy_enable_buffer(const char * buf);
WOLFSSL_API void wolfSSL_crypto_policy_disable(void);
WOLFSSL_API int wolfSSL_crypto_policy_is_enabled(void);
WOLFSSL_API const char * wolfSSL_crypto_policy_get_ciphers(void);
WOLFSSL_API int wolfSSL_crypto_policy_get_level(void);
WOLFSSL_LOCAL int wolfSSL_crypto_policy_init_ctx(WOLFSSL_CTX * ctx,
WOLFSSL_METHOD * method);
WOLFSSL_API int wolfSSL_crypto_policy_get_level(void);
WOLFSSL_LOCAL int wolfSSL_crypto_policy_init_ctx(WOLFSSL_CTX * ctx,
WOLFSSL_METHOD * method);
#endif /* WOLFSSL_SYS_CRYPTO_POLICY */
/* compat functions. */
WOLFSSL_API void wolfSSL_CTX_set_security_level(WOLFSSL_CTX* ctx, int level);
WOLFSSL_API int wolfSSL_CTX_get_security_level(const WOLFSSL_CTX * ctx);
WOLFSSL_API int wolfSSL_get_security_level(const WOLFSSL * ssl);
WOLFSSL_API void wolfSSL_CTX_set_security_level(WOLFSSL_CTX* ctx, int level);
WOLFSSL_API int wolfSSL_CTX_get_security_level(const WOLFSSL_CTX * ctx);
WOLFSSL_API int wolfSSL_get_security_level(const WOLFSSL * ssl);
#ifndef NO_WOLFSSL_STUB
WOLFSSL_API void wolfSSL_set_security_level(WOLFSSL * ssl, int level);
WOLFSSL_API void wolfSSL_set_security_level(WOLFSSL * ssl, int level);
#endif /* !NO_WOLFSSL_STUB */

/* which library version do we have */
Expand Down

0 comments on commit 2b8ae8b

Please sign in to comment.