Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions build-aux/scripts/gen-crypt-hashes-h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,16 @@ EOT

#define HASH_ALGORITHM_DEFAULT "$default_prefix"
EOT

# List of supported hash methods
my @provided_hashes = ('#define SUPPORTED_HASH_METHODS');
while (my ($e, $v) = each %{$hconf->hashes}){
if ($enabled{$e}) {
push @provided_hashes, " \"$e:@{[$v->prefix]};\"";
}
}
print join " \\\n", @provided_hashes;

print <<'EOT';

#endif /* crypt-hashes.h */
Expand Down
6 changes: 6 additions & 0 deletions lib/crypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,3 +419,9 @@ crypt_preferred_method (void)
}
SYMVER_crypt_preferred_method;
#endif

const char *crypt_get_supported_hash_methods(void)
{
return SUPPORTED_HASH_METHODS;
}
SYMVER_crypt_get_supported_hash_methods;
5 changes: 5 additions & 0 deletions lib/crypt.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,11 @@ extern const char *crypt_preferred_method (void);
/* Version number as a string constant. */
#define XCRYPT_VERSION_STR "@XCRYPT_VERSION_STR@"

/* List of provided by the current build hash algorithms*/

#define CRYPT_GET_SUPPORTED_HASH_METHODS_AVAILABLE 1
extern const char *crypt_get_supported_hash_methods(void);

@END_DECLS@

#endif /* crypt.h */
3 changes: 2 additions & 1 deletion lib/libcrypt.map.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ crypt_gensalt_ra XCRYPT_2.0 GLIBC_2.0:owl:suse GLIBC_2.2.2:alt OW_CRYPT_1.0:
# Actively supported interfaces from libxcrypt.
crypt_checksalt XCRYPT_4.3
crypt_preferred_method XCRYPT_4.4
crypt_get_supported_hash_methods XCRYPT_4.6

# Interfaces for code compatibility with libxcrypt v3.1.1 and earlier.
# No longer available to new binaries. Include in version-script, only
Expand All @@ -45,4 +46,4 @@ fcrypt - GLIBC_2.0
%chain GLIBC_2.3 GLIBC_2.4 GLIBC_2.12 GLIBC_2.16 GLIBC_2.17 GLIBC_2.18
%chain GLIBC_2.21 GLIBC_2.27 GLIBC_2.29 GLIBC_2.32 GLIBC_2.33 GLIBC_2.35
%chain GLIBC_2.36 GLIBC_2.38
%chain OW_CRYPT_1.0 XCRYPT_2.0 XCRYPT_4.3 XCRYPT_4.4
%chain OW_CRYPT_1.0 XCRYPT_2.0 XCRYPT_4.3 XCRYPT_4.4 XCRYPT_4.6