Skip to content

Commit

Permalink
digest_auth: add functions for AKA digest
Browse files Browse the repository at this point in the history
  • Loading branch information
razvancrainea authored and bogdan-iancu committed Apr 18, 2024
1 parent de16dda commit dcc6bf0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/digest_auth/dauth_calc.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,28 +30,40 @@ const struct digest_auth_calc* get_digest_calc(alg_t algorithm)
switch (algorithm) {
case ALG_UNSPEC:
case ALG_MD5:
case ALG_AKAv1_MD5:
case ALG_AKAv2_MD5:
digest_calc = &md5_digest_calc;
break;

case ALG_MD5SESS:
case ALG_AKAv1_MD5SESS:
case ALG_AKAv2_MD5SESS:
digest_calc = &md5sess_digest_calc;
break;

#if defined(SHA_256_ENABLE)
case ALG_SHA256:
case ALG_AKAv1_SHA256:
case ALG_AKAv2_SHA256:
digest_calc = &sha256_digest_calc;
break;

case ALG_SHA256SESS:
case ALG_AKAv1_SHA256SESS:
case ALG_AKAv2_SHA256SESS:
digest_calc = &sha256sess_digest_calc;
break;
#endif
#if defined(SHA_512_256_ENABLE)
case ALG_SHA512_256:
case ALG_AKAv1_SHA512_256:
case ALG_AKAv2_SHA512_256:
digest_calc = &sha512t256_digest_calc;
break;

case ALG_SHA512_256SESS:
case ALG_AKAv1_SHA512_256SESS:
case ALG_AKAv2_SHA512_256SESS:
digest_calc = &sha512t256sess_digest_calc;
break;
#endif
Expand Down
12 changes: 12 additions & 0 deletions lib/digest_auth/digest_auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,25 @@ int digest_algorithm_available(alg_t algorithm)
case ALG_UNSPEC:
case ALG_MD5:
case ALG_MD5SESS:
case ALG_AKAv1_MD5:
case ALG_AKAv1_MD5SESS:
case ALG_AKAv2_MD5:
case ALG_AKAv2_MD5SESS:
#if defined(SHA_256_ENABLE)
case ALG_SHA256:
case ALG_SHA256SESS:
case ALG_AKAv1_SHA256:
case ALG_AKAv1_SHA256SESS:
case ALG_AKAv2_SHA256:
case ALG_AKAv2_SHA256SESS:
#endif
#if defined(SHA_512_256_ENABLE)
case ALG_SHA512_256:
case ALG_SHA512_256SESS:
case ALG_AKAv1_SHA512_256:
case ALG_AKAv1_SHA512_256SESS:
case ALG_AKAv2_SHA512_256:
case ALG_AKAv2_SHA512_256SESS:
#endif
return (1);

Expand Down

0 comments on commit dcc6bf0

Please sign in to comment.