| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 #endif // SRTP_RELATIVE_PATH | 55 #endif // SRTP_RELATIVE_PATH |
| 56 } | 56 } |
| 57 | 57 |
| 58 #define EXTERNAL_HMAC_SHA1 HMAC_SHA1 + 1 | 58 #define EXTERNAL_HMAC_SHA1 HMAC_SHA1 + 1 |
| 59 #define HMAC_KEY_LENGTH 20 | 59 #define HMAC_KEY_LENGTH 20 |
| 60 | 60 |
| 61 // The HMAC context structure used to store authentication keys. | 61 // The HMAC context structure used to store authentication keys. |
| 62 // The pointer to the key will be allocated in the external_hmac_init function. | 62 // The pointer to the key will be allocated in the external_hmac_init function. |
| 63 // This pointer is owned by srtp_t in a template context. | 63 // This pointer is owned by srtp_t in a template context. |
| 64 typedef struct { | 64 typedef struct { |
| 65 uint8 key[HMAC_KEY_LENGTH]; | 65 uint8_t key[HMAC_KEY_LENGTH]; |
| 66 int key_length; | 66 int key_length; |
| 67 } ExternalHmacContext; | 67 } ExternalHmacContext; |
| 68 | 68 |
| 69 err_status_t external_hmac_alloc(auth_t** a, int key_len, int out_len); | 69 err_status_t external_hmac_alloc(auth_t** a, int key_len, int out_len); |
| 70 | 70 |
| 71 err_status_t external_hmac_dealloc(auth_t* a); | 71 err_status_t external_hmac_dealloc(auth_t* a); |
| 72 | 72 |
| 73 err_status_t external_hmac_init(ExternalHmacContext* state, | 73 err_status_t external_hmac_init(ExternalHmacContext* state, |
| 74 const uint8_t* key, | 74 const uint8_t* key, |
| 75 int key_len); | 75 int key_len); |
| 76 | 76 |
| 77 err_status_t external_hmac_start(ExternalHmacContext* state); | 77 err_status_t external_hmac_start(ExternalHmacContext* state); |
| 78 | 78 |
| 79 err_status_t external_hmac_update(ExternalHmacContext* state, | 79 err_status_t external_hmac_update(ExternalHmacContext* state, |
| 80 const uint8_t* message, | 80 const uint8_t* message, |
| 81 int msg_octets); | 81 int msg_octets); |
| 82 | 82 |
| 83 err_status_t external_hmac_compute(ExternalHmacContext* state, | 83 err_status_t external_hmac_compute(ExternalHmacContext* state, |
| 84 const void* message, | 84 const void* message, |
| 85 int msg_octets, | 85 int msg_octets, |
| 86 int tag_len, | 86 int tag_len, |
| 87 uint8_t* result); | 87 uint8_t* result); |
| 88 | 88 |
| 89 err_status_t external_crypto_init(); | 89 err_status_t external_crypto_init(); |
| 90 | 90 |
| 91 #endif // defined(HAVE_SRTP) && defined(ENABLE_EXTERNAL_AUTH) | 91 #endif // defined(HAVE_SRTP) && defined(ENABLE_EXTERNAL_AUTH) |
| 92 #endif // TALK_SESSION_MEDIA_EXTERNAL_HMAC_H_ | 92 #endif // TALK_SESSION_MEDIA_EXTERNAL_HMAC_H_ |
| OLD | NEW |