comment out (#if 0 ... #endif) unused parts of srp library

This commit is contained in:
F. Duncanh
2023-12-06 01:06:58 -05:00
parent b790a6fd47
commit f5da0a8f63
2 changed files with 17 additions and 4 deletions

View File

@@ -64,7 +64,8 @@ struct NGHex
/* All constants here were pulled from Appendix A of RFC 5054 */ /* All constants here were pulled from Appendix A of RFC 5054 */
static struct NGHex global_Ng_constants[] = { static struct NGHex global_Ng_constants[] = {
{ /* 1024 */ #if 0 /* begin removed section 1 */
{ /* 1024 */
"EEAF0AB9ADB38DD69C33F80AFA8FC5E86072618775FF3C0B9EA2314C9C256576D674DF7496" "EEAF0AB9ADB38DD69C33F80AFA8FC5E86072618775FF3C0B9EA2314C9C256576D674DF7496"
"EA81D3383B4813D692C6E0E0D5D8E250B98BE48E495C1D6089DAD15DC7D7B46154D6B6CE8E" "EA81D3383B4813D692C6E0E0D5D8E250B98BE48E495C1D6089DAD15DC7D7B46154D6B6CE8E"
"F4AD69B15D4982559B297BCF1885C529F566660E57EC68EDBC3C05726CC02FD4CBF4976EAA" "F4AD69B15D4982559B297BCF1885C529F566660E57EC68EDBC3C05726CC02FD4CBF4976EAA"
@@ -81,6 +82,7 @@ static struct NGHex global_Ng_constants[] = {
"8CE7A28C2442C6F315180F93499A234DCF76E3FED135F9BB", "8CE7A28C2442C6F315180F93499A234DCF76E3FED135F9BB",
"2" "2"
}, },
#endif /* end removed section 1 */
{ /* 2048 */ { /* 2048 */
"AC6BDB41324A9A9BF166DE5E1389582FAF72B6651987EE07FC3192943DB56050A37329CBB4" "AC6BDB41324A9A9BF166DE5E1389582FAF72B6651987EE07FC3192943DB56050A37329CBB4"
"A099ED8193E0757767A13DD52312AB4B03310DCD7F48A9DA04FD50E8083969EDB767B0CF60" "A099ED8193E0757767A13DD52312AB4B03310DCD7F48A9DA04FD50E8083969EDB767B0CF60"
@@ -91,6 +93,7 @@ static struct NGHex global_Ng_constants[] = {
"FBB694B5C803D89F7AE435DE236D525F54759B65E372FCD68EF20FA7111F9E4AFF73", "FBB694B5C803D89F7AE435DE236D525F54759B65E372FCD68EF20FA7111F9E4AFF73",
"2" "2"
}, },
#if 0 /* begin removed section 2 */
{ /* 3072 */ { /* 3072 */
"FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B" "FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B"
"139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485" "139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485"
@@ -198,6 +201,7 @@ static struct NGHex global_Ng_constants[] = {
"60C980DD98EDD3DFFFFFFFFFFFFFFFFF", "60C980DD98EDD3DFFFFFFFFFFFFFFFFF",
"13" "13"
}, },
#endif /* end removed section 2 */
{0,0} /* null sentinel */ {0,0} /* null sentinel */
}; };
@@ -259,6 +263,7 @@ struct SRPVerifier
#endif #endif
}; };
#if 0 /*begin removed section 3*/
struct SRPUser struct SRPUser
{ {
SRP_HashAlgorithm hash_alg; SRP_HashAlgorithm hash_alg;
@@ -285,7 +290,7 @@ struct SRPUser
#endif #endif
}; };
#endif /*end removed section 3*/
static void handle_error(const char* location) { static void handle_error(const char* location) {
long error = ERR_get_error(); long error = ERR_get_error();
const char* error_str = ERR_error_string(error, NULL); const char* error_str = ERR_error_string(error, NULL);
@@ -944,7 +949,7 @@ void srp_verifier_verify_session( struct SRPVerifier * ver, const unsigned char
} }
/*******************************************************************************/ /*******************************************************************************/
#if 0 /*begin removed section 4 */
struct SRPUser * srp_user_new( SRP_HashAlgorithm alg, SRP_NGType ng_type, const char * username, struct SRPUser * srp_user_new( SRP_HashAlgorithm alg, SRP_NGType ng_type, const char * username,
const unsigned char * bytes_password, int len_password, const unsigned char * bytes_password, int len_password,
const char * n_hex, const char * g_hex, const char * n_hex, const char * g_hex,
@@ -1170,3 +1175,4 @@ void srp_user_verify_session( struct SRPUser * usr, const unsigned char * bytes_
if ( memcmp( usr->H_AMK, bytes_HAMK, hash_length(usr->hash_alg) ) == 0 ) if ( memcmp( usr->H_AMK, bytes_HAMK, hash_length(usr->hash_alg) ) == 0 )
usr->authenticated = 1; usr->authenticated = 1;
} }
#endif /*end removed section 4 */

View File

@@ -62,17 +62,22 @@
#define APPLE_VARIANT #define APPLE_VARIANT
struct SRPVerifier; struct SRPVerifier;
#if 0 /*begin removed section 1*/
struct SRPUser; struct SRPUser;
#endif /*end removed section 1*/
typedef enum typedef enum
{ {
#if 0 /* begin removed section 2*/
SRP_NG_1024, SRP_NG_1024,
SRP_NG_1536, SRP_NG_1536,
#endif /* end removed section 2*/
SRP_NG_2048, SRP_NG_2048,
#if 0 /* begin removed section 3*/
SRP_NG_3072, SRP_NG_3072,
SRP_NG_4096, SRP_NG_4096,
SRP_NG_6144, SRP_NG_6144,
SRP_NG_8192, SRP_NG_8192,
#endif /* end removed section 3*/
SRP_NG_CUSTOM SRP_NG_CUSTOM
} SRP_NGType; } SRP_NGType;
@@ -193,6 +198,7 @@ void srp_verifier_verify_session( struct SRPVerifier * ver,
* breaks compatibility with previous versions of the csrp library but is recommended * breaks compatibility with previous versions of the csrp library but is recommended
* for new code. * for new code.
*/ */
#if 0 /*begin removed section 4 */
struct SRPUser * srp_user_new( SRP_HashAlgorithm alg, SRP_NGType ng_type, const char * username, struct SRPUser * srp_user_new( SRP_HashAlgorithm alg, SRP_NGType ng_type, const char * username,
const unsigned char * bytes_password, int len_password, const unsigned char * bytes_password, int len_password,
const char * n_hex, const char * g_hex, const char * n_hex, const char * g_hex,
@@ -226,4 +232,5 @@ void srp_user_process_challenge( struct SRPUser * usr,
/* (in APPLE_VARIANT case, session_key_length is DOUBLE the length of bytes_HAMK) */ /* (in APPLE_VARIANT case, session_key_length is DOUBLE the length of bytes_HAMK) */
void srp_user_verify_session( struct SRPUser * usr, const unsigned char * bytes_HAMK ); void srp_user_verify_session( struct SRPUser * usr, const unsigned char * bytes_HAMK );
#endif /*end removed section 4*/
#endif /* Include Guard */ #endif /* Include Guard */