-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Curve customization support: extract curve array from yaml and make a list of mapped number strings #721
base: v2.x/staging
Are you sure you want to change the base?
Curve customization support: extract curve array from yaml and make a list of mapped number strings #721
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1171,6 +1171,7 @@ static char* generateCookieNameV2(ConfigManager *configmgr, int port) { | |
#define ENV_AGENT_HTTPS_KEY(key) AGENT_HTTPS_PREFIX key | ||
|
||
TLS_IANA_CIPHER_MAP(ianaCipherMap) | ||
TLS_IANA_CURVE_MAP(ianaCurveMap) | ||
|
||
static bool readAgentHttpsSettingsV2(ShortLivedHeap *slh, | ||
ConfigManager *configmgr, | ||
|
@@ -1226,6 +1227,42 @@ static bool readAgentHttpsSettingsV2(ShortLivedHeap *slh, | |
|
||
} | ||
|
||
Json *tlsConfig = NULL; | ||
int tlsGetStatus = cfgGetAnyC(configmgr,ZSS_CFGNAME,&tlsConfig, 4,"zowe","network","server","tls"); | ||
if (tlsGetStatus) { | ||
zowelog(NULL, LOG_COMP_ID_MVD_SERVER, ZOWE_LOG_INFO, "TLS is NOT configured for this ZSS\n"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this have a message ID? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure on that because elsewhere is the code I can see its a similar message without any ID as such. |
||
} else { | ||
JsonObject *tlsConfigObject = jsonAsObject(tlsConfig); | ||
Json *curveJson = jsonObjectGetPropertyValue(tlsConfigObject, "curves"); | ||
char *curves = NULL; | ||
if(jsonIsArray(curveJson)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What if there is no There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes Irek that's true, thanks for pointing that one. |
||
JsonArray *curveArray = jsonObjectGetArray(tlsConfigObject, "curves"); | ||
Gautham-coder marked this conversation as resolved.
Show resolved
Hide resolved
|
||
int count = jsonArrayGetCount(curveArray); | ||
int curveCharLength = 4; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure Irek. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is it 4? Can you tie it to some struct's field size? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We know that the length will always be 4. Its better not to put in the struct field because we are initializing the array of structs in |
||
curves = (char *)safeMalloc((sizeof(char) * curveCharLength * count)+1, "curve list"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks Irek, I will correct it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are you casting this to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I think this is redundant, I will remove the typecast. Thanks |
||
for (int i = 0; i < count; i++) { | ||
char *ianaName = jsonArrayGetString(curveArray, i); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is defined as a string so it can be NULL, I will add a check for this. |
||
zowelog(NULL, LOG_COMP_ID_MVD_SERVER, ZOWE_LOG_DEBUG, "curve request=%s\n", ianaName); | ||
CurveMap *curve = (CurveMap *)ianaCurveMap; | ||
bool found = false; | ||
while (curve->groupId != NULL) { | ||
if (!strcmp(ianaName, curve->name)) { | ||
strcat(curves, curve->groupId); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How do you know There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here: (https://www.ibm.com/docs/en/zos/3.1.0?topic=reference-gsk-attribute-set-buffer) It says 1 or more 4-character decimal values. |
||
zowelog(NULL, LOG_COMP_ID_MVD_SERVER, ZOWE_LOG_DEBUG, "Curve match=%s\n", curve->groupId); | ||
found = true; | ||
break; | ||
} | ||
++curve; | ||
} | ||
if (!found) { | ||
zowelog(NULL, LOG_COMP_ID_MVD_SERVER, ZOWE_LOG_WARNING, ZSS_LOG_CURVE_INVALID_MSG, ianaName); | ||
} | ||
} | ||
zowelog(NULL, LOG_COMP_ID_MVD_SERVER, ZOWE_LOG_DEBUG, "Curve array is %s\n", curves); | ||
settings->curves = curves; | ||
} | ||
} | ||
|
||
ECVT *ecvt = getECVT(); | ||
/* | ||
2.3 (1020300) no tls 1.3 | ||
|
+3 −0 | CHANGELOG.md | |
+1 −1 | build/configmgr.proj.env | |
+1 −1 | build/getesm.proj.env | |
+23 −0 | c/tls.c | |
+104 −0 | h/tls.h | |
+1 −1 | manifest.template.yaml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you in some cases use blanks between arguments and in some cases you don't?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for pointing that out Irek, I will make correct this.