MCPcopy Create free account
hub / github.com/cisco/libsrtp / srtp_null_cipher_alloc

Function srtp_null_cipher_alloc

crypto/cipher/null_cipher.c:57–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55#include "cipher_types.h"
56
57static srtp_err_status_t srtp_null_cipher_alloc(srtp_cipher_t **c,
58 int key_len,
59 int tlen)
60{
61 extern const srtp_cipher_type_t srtp_null_cipher;
62 (void)tlen;
63
64 debug_print(srtp_mod_cipher, "allocating cipher with key length %d",
65 key_len);
66
67 /* allocate memory a cipher of type null_cipher */
68 *c = (srtp_cipher_t *)srtp_crypto_alloc(sizeof(srtp_cipher_t));
69 if (*c == NULL) {
70 return srtp_err_status_alloc_fail;
71 }
72
73 /* set pointers */
74 (*c)->algorithm = SRTP_NULL_CIPHER;
75 (*c)->type = &srtp_null_cipher;
76 (*c)->state = (void *)0x1; /* The null cipher does not maintain state */
77
78 /* set key size */
79 (*c)->key_len = key_len;
80
81 return srtp_err_status_ok;
82}
83
84static srtp_err_status_t srtp_null_cipher_dealloc(srtp_cipher_t *c)
85{

Callers

nothing calls this directly

Calls 1

srtp_crypto_allocFunction · 0.85

Tested by

no test coverage detected