Add space
[sipe-libnice.git] / stun / stunhmac.h
blob43de0420e6c40f2dbbb2af702aa80323914f5309
1 /*
2 * This file is part of the Nice GLib ICE library.
4 * (C) 2008 Collabora Ltd.
5 * (C) 2008 Nokia Corporation. All rights reserved.
6 * Contact: Youness Alaoui
8 * The contents of this file are subject to the Mozilla Public License Version
9 * 1.1 (the "License"); you may not use this file except in compliance with
10 * the License. You may obtain a copy of the License at
11 * http://www.mozilla.org/MPL/
13 * Software distributed under the License is distributed on an "AS IS" basis,
14 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
15 * for the specific language governing rights and limitations under the
16 * License.
18 * The Original Code is the Nice GLib ICE library.
20 * The Initial Developers of the Original Code are Collabora Ltd and Nokia
21 * Corporation. All Rights Reserved.
24 * Alternatively, the contents of this file may be used under the terms of the
25 * the GNU Lesser General Public License Version 2.1 (the "LGPL"), in which
26 * case the provisions of LGPL are applicable instead of those above. If you
27 * wish to allow use of your version of this file only under the terms of the
28 * LGPL and not to allow others to use your version of this file under the
29 * MPL, indicate your decision by deleting the provisions above and replace
30 * them with the notice and other provisions required by the LGPL. If you do
31 * not delete the provisions above, a recipient may use your version of this
32 * file under either the MPL or the LGPL.
35 #ifndef _STUN_HMAC_H
36 #define _STUN_HMAC_H
38 #include "stunmessage.h"
40 /**
41 * Computes the MESSAGE-INTEGRITY hash of a STUN message.
42 * @param msg pointer to the STUN message
43 * @param len size of the message from header (inclusive) and up to
44 * MESSAGE-INTEGRITY attribute (inclusive)
45 * @param sha output buffer for SHA1 hash (20 bytes)
46 * @param key HMAC key
47 * @param keylen HMAC key bytes length
49 * @return fingerprint value in <b>host</b> byte order.
51 void stun_sha1 (const uint8_t *msg, size_t len,
52 uint8_t *sha, const void *key, size_t keylen, int padding);
54 /**
55 * SIP H(A1) computation
58 void stun_hash_creds (const uint8_t *realm, size_t realm_len,
59 const uint8_t *username, size_t username_len,
60 const uint8_t *password, size_t password_len,
61 unsigned char md5[16]);
62 /**
63 * Generates a pseudo-random secure STUN transaction ID.
65 void stun_make_transid (stun_transid_t id);
68 #endif /* _STUN_HMAC_H */