krb5 commit [krb5-1.17]: Rename hmac() function

Greg Hudson <[email protected]>
Newsgroups gmane.comp.encryption.kerberos.cvs
Message-ID <[email protected]>
https://github.com/krb5/krb5/commit/bfc4bcaf6b132e12d15b0855c1cc71ddbe52c554
commit bfc4bcaf6b132e12d15b0855c1cc71ddbe52c554
Author: Thomas Klausner <[email protected]>
Date:   Mon May 6 16:03:38 2019 +0200

    Rename hmac() function
    
    NetBSD 8's stdlib.h declares a hmac() function; rename ours to avoid a
    conflict.
    
    [[email protected]: picked a different name and added a comment]
    
    (cherry picked from commit e8b463c8d2c9b903d61c8646af3c0106808f906d)
    
    ticket: 8803
    version_fixed: 1.17.1

 src/lib/crypto/builtin/pbkdf2.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/lib/crypto/builtin/pbkdf2.c b/src/lib/crypto/builtin/pbkdf2.c
index 8905f26..d1a0710 100644
--- a/src/lib/crypto/builtin/pbkdf2.c
+++ b/src/lib/crypto/builtin/pbkdf2.c
@@ -73,10 +73,12 @@ static void printd (const char *descr, krb5_data *d) {
  * Implements the hmac-sha1 PRF.  pass has been pre-hashed (if
  * necessary) and converted to a key already; salt has had the block
  * index appended to the original salt.
+ *
+ * NetBSD 8 declares an hmac() function in stdlib.h, so avoid that name.
  */
 static krb5_error_code
-hmac(const struct krb5_hash_provider *hash, krb5_keyblock *pass,
-     krb5_data *salt, krb5_data *out)
+k5_hmac(const struct krb5_hash_provider *hash, krb5_keyblock *pass,
+        krb5_data *salt, krb5_data *out)
 {
     krb5_error_code err;
     krb5_crypto_iov iov;
@@ -111,7 +113,7 @@ F(char *output, char *u_tmp1, char *u_tmp2,
 
     out = make_data(u_tmp1, hlen);
 
-    err = hmac(hash, pass, &sdata, &out);
+    err = k5_hmac(hash, pass, &sdata, &out);
     if (err)
         return err;
 
@@ -121,7 +123,7 @@ F(char *output, char *u_tmp1, char *u_tmp2,
     sdata.length = hlen;
     for (j = 2; j <= count; j++) {
         memcpy(u_tmp2, u_tmp1, hlen);
-        err = hmac(hash, pass, &sdata, &out);
+        err = k5_hmac(hash, pass, &sdata, &out);
         if (err)
             return err;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.