|
@@ -157,6 +157,7 @@ static char * configDN = "cn=encryption,cn=config";
|
|
|
#define CIPHER_IS_WEAK 0x4
|
|
#define CIPHER_IS_WEAK 0x4
|
|
|
#define CIPHER_IS_DEPRECATED 0x8
|
|
#define CIPHER_IS_DEPRECATED 0x8
|
|
|
static char **cipher_names = NULL;
|
|
static char **cipher_names = NULL;
|
|
|
|
|
+static char **enabled_cipher_names = NULL;
|
|
|
typedef struct {
|
|
typedef struct {
|
|
|
char *name;
|
|
char *name;
|
|
|
int num;
|
|
int num;
|
|
@@ -265,7 +266,8 @@ slapd_SSL_warn(char *fmt, ...)
|
|
|
va_end(args);
|
|
va_end(args);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-char ** getSupportedCiphers()
|
|
|
|
|
|
|
+char **
|
|
|
|
|
+getSupportedCiphers()
|
|
|
{
|
|
{
|
|
|
SSLCipherSuiteInfo info;
|
|
SSLCipherSuiteInfo info;
|
|
|
char *sep = "::";
|
|
char *sep = "::";
|
|
@@ -294,6 +296,44 @@ char ** getSupportedCiphers()
|
|
|
return cipher_names;
|
|
return cipher_names;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+char **
|
|
|
|
|
+getEnabledCiphers()
|
|
|
|
|
+{
|
|
|
|
|
+ SSLCipherSuiteInfo info;
|
|
|
|
|
+ char *sep = "::";
|
|
|
|
|
+ int number_of_ciphers = 0;
|
|
|
|
|
+ int x;
|
|
|
|
|
+ int idx = 0;
|
|
|
|
|
+ PRBool enabled;
|
|
|
|
|
+
|
|
|
|
|
+ /* We have to wait until the SSL initialization is done. */
|
|
|
|
|
+ if (!slapd_ssl_listener_is_initialized()) {
|
|
|
|
|
+ return NULL;
|
|
|
|
|
+ }
|
|
|
|
|
+ if ((enabled_cipher_names == NULL) && _conf_ciphers) {
|
|
|
|
|
+ for (x = 0; _conf_ciphers[x].name; x++) {
|
|
|
|
|
+ SSL_CipherPrefGetDefault(_conf_ciphers[x].num, &enabled);
|
|
|
|
|
+ if (enabled) {
|
|
|
|
|
+ number_of_ciphers++;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ enabled_cipher_names = (char **)slapi_ch_calloc((number_of_ciphers + 1), sizeof(char *));
|
|
|
|
|
+ for (x = 0; _conf_ciphers[x].name; x++) {
|
|
|
|
|
+ SSL_CipherPrefGetDefault(_conf_ciphers[x].num, &enabled);
|
|
|
|
|
+ if (enabled) {
|
|
|
|
|
+ SSL_GetCipherSuiteInfo((PRUint16)_conf_ciphers[x].num,&info,sizeof(info));
|
|
|
|
|
+ enabled_cipher_names[idx++] = PR_smprintf("%s%s%s%s%s%s%d",
|
|
|
|
|
+ _conf_ciphers[x].name,sep,
|
|
|
|
|
+ info.symCipherName,sep,
|
|
|
|
|
+ info.macAlgorithmName,sep,
|
|
|
|
|
+ info.symKeyBits);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return enabled_cipher_names;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
static PRBool
|
|
static PRBool
|
|
|
cipher_check_fips(int idx, char ***suplist, char ***unsuplist)
|
|
cipher_check_fips(int idx, char ***suplist, char ***unsuplist)
|
|
|
{
|
|
{
|