Lines Matching refs:ctx

123     void *ctx = mbedtls_calloc(1, sizeof(mbedtls_gcm_context));  in gcm_ctx_alloc()  local
125 if (ctx != NULL) { in gcm_ctx_alloc()
126 mbedtls_gcm_init((mbedtls_gcm_context *) ctx); in gcm_ctx_alloc()
129 return ctx; in gcm_ctx_alloc()
132 static void gcm_ctx_free(void *ctx) in gcm_ctx_free() argument
134 mbedtls_gcm_free(ctx); in gcm_ctx_free()
135 mbedtls_free(ctx); in gcm_ctx_free()
145 void *ctx = mbedtls_calloc(1, sizeof(mbedtls_ccm_context)); in ccm_ctx_alloc() local
147 if (ctx != NULL) { in ccm_ctx_alloc()
148 mbedtls_ccm_init((mbedtls_ccm_context *) ctx); in ccm_ctx_alloc()
151 return ctx; in ccm_ctx_alloc()
154 static void ccm_ctx_free(void *ctx) in ccm_ctx_free() argument
156 mbedtls_ccm_free(ctx); in ccm_ctx_free()
157 mbedtls_free(ctx); in ccm_ctx_free()
163 static int aes_crypt_ecb_wrap(void *ctx, mbedtls_operation_t operation, in aes_crypt_ecb_wrap() argument
166 return mbedtls_aes_crypt_ecb((mbedtls_aes_context *) ctx, operation, input, output); in aes_crypt_ecb_wrap()
170 static int aes_crypt_cbc_wrap(void *ctx, mbedtls_operation_t operation, size_t length, in aes_crypt_cbc_wrap() argument
173 return mbedtls_aes_crypt_cbc((mbedtls_aes_context *) ctx, operation, length, iv, input, in aes_crypt_cbc_wrap()
179 static int aes_crypt_cfb128_wrap(void *ctx, mbedtls_operation_t operation, in aes_crypt_cfb128_wrap() argument
183 return mbedtls_aes_crypt_cfb128((mbedtls_aes_context *) ctx, operation, length, iv_off, iv, in aes_crypt_cfb128_wrap()
189 static int aes_crypt_ofb_wrap(void *ctx, size_t length, size_t *iv_off, in aes_crypt_ofb_wrap() argument
192 return mbedtls_aes_crypt_ofb((mbedtls_aes_context *) ctx, length, iv_off, in aes_crypt_ofb_wrap()
198 static int aes_crypt_ctr_wrap(void *ctx, size_t length, size_t *nc_off, in aes_crypt_ctr_wrap() argument
202 return mbedtls_aes_crypt_ctr((mbedtls_aes_context *) ctx, length, nc_off, nonce_counter, in aes_crypt_ctr_wrap()
208 static int aes_crypt_xts_wrap(void *ctx, mbedtls_operation_t operation, in aes_crypt_xts_wrap() argument
214 mbedtls_aes_xts_context *xts_ctx = ctx; in aes_crypt_xts_wrap()
234 static int aes_setkey_dec_wrap(void *ctx, const unsigned char *key, in aes_setkey_dec_wrap() argument
237 return mbedtls_aes_setkey_dec((mbedtls_aes_context *) ctx, key, key_bitlen); in aes_setkey_dec_wrap()
241 static int aes_setkey_enc_wrap(void *ctx, const unsigned char *key, in aes_setkey_enc_wrap() argument
244 return mbedtls_aes_setkey_enc((mbedtls_aes_context *) ctx, key, key_bitlen); in aes_setkey_enc_wrap()
260 static void aes_ctx_free(void *ctx) in aes_ctx_free() argument
262 mbedtls_aes_free((mbedtls_aes_context *) ctx); in aes_ctx_free()
263 mbedtls_free(ctx); in aes_ctx_free()
479 static int xts_aes_setkey_enc_wrap(void *ctx, const unsigned char *key, in xts_aes_setkey_enc_wrap() argument
482 mbedtls_aes_xts_context *xts_ctx = ctx; in xts_aes_setkey_enc_wrap()
486 static int xts_aes_setkey_dec_wrap(void *ctx, const unsigned char *key, in xts_aes_setkey_dec_wrap() argument
489 mbedtls_aes_xts_context *xts_ctx = ctx; in xts_aes_setkey_dec_wrap()
504 static void xts_aes_ctx_free(void *ctx) in xts_aes_ctx_free() argument
506 mbedtls_aes_xts_context *xts_ctx = ctx; in xts_aes_ctx_free()
570 static int gcm_aes_setkey_wrap(void *ctx, const unsigned char *key, in gcm_aes_setkey_wrap() argument
573 return mbedtls_gcm_setkey((mbedtls_gcm_context *) ctx, MBEDTLS_CIPHER_ID_AES, in gcm_aes_setkey_wrap()
654 static int ccm_aes_setkey_wrap(void *ctx, const unsigned char *key, in ccm_aes_setkey_wrap() argument
657 return mbedtls_ccm_setkey((mbedtls_ccm_context *) ctx, MBEDTLS_CIPHER_ID_AES, in ccm_aes_setkey_wrap()
777 static int camellia_crypt_ecb_wrap(void *ctx, mbedtls_operation_t operation, in camellia_crypt_ecb_wrap() argument
780 return mbedtls_camellia_crypt_ecb((mbedtls_camellia_context *) ctx, operation, input, in camellia_crypt_ecb_wrap()
785 static int camellia_crypt_cbc_wrap(void *ctx, mbedtls_operation_t operation, in camellia_crypt_cbc_wrap() argument
789 return mbedtls_camellia_crypt_cbc((mbedtls_camellia_context *) ctx, operation, length, iv, in camellia_crypt_cbc_wrap()
795 static int camellia_crypt_cfb128_wrap(void *ctx, mbedtls_operation_t operation, in camellia_crypt_cfb128_wrap() argument
799 return mbedtls_camellia_crypt_cfb128((mbedtls_camellia_context *) ctx, operation, length, in camellia_crypt_cfb128_wrap()
805 static int camellia_crypt_ctr_wrap(void *ctx, size_t length, size_t *nc_off, in camellia_crypt_ctr_wrap() argument
809 return mbedtls_camellia_crypt_ctr((mbedtls_camellia_context *) ctx, length, nc_off, in camellia_crypt_ctr_wrap()
815 static int camellia_setkey_dec_wrap(void *ctx, const unsigned char *key, in camellia_setkey_dec_wrap() argument
818 return mbedtls_camellia_setkey_dec((mbedtls_camellia_context *) ctx, key, key_bitlen); in camellia_setkey_dec_wrap()
822 static int camellia_setkey_enc_wrap(void *ctx, const unsigned char *key, in camellia_setkey_enc_wrap() argument
825 return mbedtls_camellia_setkey_enc((mbedtls_camellia_context *) ctx, key, key_bitlen); in camellia_setkey_enc_wrap()
830 mbedtls_camellia_context *ctx; in camellia_ctx_alloc() local
831 ctx = mbedtls_calloc(1, sizeof(mbedtls_camellia_context)); in camellia_ctx_alloc()
833 if (ctx == NULL) { in camellia_ctx_alloc()
837 mbedtls_camellia_init(ctx); in camellia_ctx_alloc()
839 return ctx; in camellia_ctx_alloc()
842 static void camellia_ctx_free(void *ctx) in camellia_ctx_free() argument
844 mbedtls_camellia_free((mbedtls_camellia_context *) ctx); in camellia_ctx_free()
845 mbedtls_free(ctx); in camellia_ctx_free()
1016 static int gcm_camellia_setkey_wrap(void *ctx, const unsigned char *key, in gcm_camellia_setkey_wrap() argument
1019 return mbedtls_gcm_setkey((mbedtls_gcm_context *) ctx, MBEDTLS_CIPHER_ID_CAMELLIA, in gcm_camellia_setkey_wrap()
1087 static int ccm_camellia_setkey_wrap(void *ctx, const unsigned char *key, in ccm_camellia_setkey_wrap() argument
1090 return mbedtls_ccm_setkey((mbedtls_ccm_context *) ctx, MBEDTLS_CIPHER_ID_CAMELLIA, in ccm_camellia_setkey_wrap()
1194 static int aria_crypt_ecb_wrap(void *ctx, mbedtls_operation_t operation, in aria_crypt_ecb_wrap() argument
1198 return mbedtls_aria_crypt_ecb((mbedtls_aria_context *) ctx, input, in aria_crypt_ecb_wrap()
1203 static int aria_crypt_cbc_wrap(void *ctx, mbedtls_operation_t operation, in aria_crypt_cbc_wrap() argument
1207 return mbedtls_aria_crypt_cbc((mbedtls_aria_context *) ctx, operation, length, iv, in aria_crypt_cbc_wrap()
1213 static int aria_crypt_cfb128_wrap(void *ctx, mbedtls_operation_t operation, in aria_crypt_cfb128_wrap() argument
1217 return mbedtls_aria_crypt_cfb128((mbedtls_aria_context *) ctx, operation, length, in aria_crypt_cfb128_wrap()
1223 static int aria_crypt_ctr_wrap(void *ctx, size_t length, size_t *nc_off, in aria_crypt_ctr_wrap() argument
1227 return mbedtls_aria_crypt_ctr((mbedtls_aria_context *) ctx, length, nc_off, in aria_crypt_ctr_wrap()
1233 static int aria_setkey_dec_wrap(void *ctx, const unsigned char *key, in aria_setkey_dec_wrap() argument
1236 return mbedtls_aria_setkey_dec((mbedtls_aria_context *) ctx, key, key_bitlen); in aria_setkey_dec_wrap()
1240 static int aria_setkey_enc_wrap(void *ctx, const unsigned char *key, in aria_setkey_enc_wrap() argument
1243 return mbedtls_aria_setkey_enc((mbedtls_aria_context *) ctx, key, key_bitlen); in aria_setkey_enc_wrap()
1248 mbedtls_aria_context *ctx; in aria_ctx_alloc() local
1249 ctx = mbedtls_calloc(1, sizeof(mbedtls_aria_context)); in aria_ctx_alloc()
1251 if (ctx == NULL) { in aria_ctx_alloc()
1255 mbedtls_aria_init(ctx); in aria_ctx_alloc()
1257 return ctx; in aria_ctx_alloc()
1260 static void aria_ctx_free(void *ctx) in aria_ctx_free() argument
1262 mbedtls_aria_free((mbedtls_aria_context *) ctx); in aria_ctx_free()
1263 mbedtls_free(ctx); in aria_ctx_free()
1434 static int gcm_aria_setkey_wrap(void *ctx, const unsigned char *key, in gcm_aria_setkey_wrap() argument
1437 return mbedtls_gcm_setkey((mbedtls_gcm_context *) ctx, MBEDTLS_CIPHER_ID_ARIA, in gcm_aria_setkey_wrap()
1505 static int ccm_aria_setkey_wrap(void *ctx, const unsigned char *key, in ccm_aria_setkey_wrap() argument
1508 return mbedtls_ccm_setkey((mbedtls_ccm_context *) ctx, MBEDTLS_CIPHER_ID_ARIA, in ccm_aria_setkey_wrap()
1612 static int des_crypt_ecb_wrap(void *ctx, mbedtls_operation_t operation, in des_crypt_ecb_wrap() argument
1616 return mbedtls_des_crypt_ecb((mbedtls_des_context *) ctx, input, output); in des_crypt_ecb_wrap()
1619 static int des3_crypt_ecb_wrap(void *ctx, mbedtls_operation_t operation, in des3_crypt_ecb_wrap() argument
1623 return mbedtls_des3_crypt_ecb((mbedtls_des3_context *) ctx, input, output); in des3_crypt_ecb_wrap()
1627 static int des_crypt_cbc_wrap(void *ctx, mbedtls_operation_t operation, size_t length, in des_crypt_cbc_wrap() argument
1630 return mbedtls_des_crypt_cbc((mbedtls_des_context *) ctx, operation, length, iv, input, in des_crypt_cbc_wrap()
1636 static int des3_crypt_cbc_wrap(void *ctx, mbedtls_operation_t operation, size_t length, in des3_crypt_cbc_wrap() argument
1639 return mbedtls_des3_crypt_cbc((mbedtls_des3_context *) ctx, operation, length, iv, input, in des3_crypt_cbc_wrap()
1644 static int des_setkey_dec_wrap(void *ctx, const unsigned char *key, in des_setkey_dec_wrap() argument
1649 return mbedtls_des_setkey_dec((mbedtls_des_context *) ctx, key); in des_setkey_dec_wrap()
1652 static int des_setkey_enc_wrap(void *ctx, const unsigned char *key, in des_setkey_enc_wrap() argument
1657 return mbedtls_des_setkey_enc((mbedtls_des_context *) ctx, key); in des_setkey_enc_wrap()
1660 static int des3_set2key_dec_wrap(void *ctx, const unsigned char *key, in des3_set2key_dec_wrap() argument
1665 return mbedtls_des3_set2key_dec((mbedtls_des3_context *) ctx, key); in des3_set2key_dec_wrap()
1668 static int des3_set2key_enc_wrap(void *ctx, const unsigned char *key, in des3_set2key_enc_wrap() argument
1673 return mbedtls_des3_set2key_enc((mbedtls_des3_context *) ctx, key); in des3_set2key_enc_wrap()
1676 static int des3_set3key_dec_wrap(void *ctx, const unsigned char *key, in des3_set3key_dec_wrap() argument
1681 return mbedtls_des3_set3key_dec((mbedtls_des3_context *) ctx, key); in des3_set3key_dec_wrap()
1684 static int des3_set3key_enc_wrap(void *ctx, const unsigned char *key, in des3_set3key_enc_wrap() argument
1689 return mbedtls_des3_set3key_enc((mbedtls_des3_context *) ctx, key); in des3_set3key_enc_wrap()
1705 static void des_ctx_free(void *ctx) in des_ctx_free() argument
1707 mbedtls_des_free((mbedtls_des_context *) ctx); in des_ctx_free()
1708 mbedtls_free(ctx); in des_ctx_free()
1725 static void des3_ctx_free(void *ctx) in des3_ctx_free() argument
1727 mbedtls_des3_free((mbedtls_des3_context *) ctx); in des3_ctx_free()
1728 mbedtls_free(ctx); in des3_ctx_free()
1886 static int chacha20_setkey_wrap(void *ctx, const unsigned char *key, in chacha20_setkey_wrap() argument
1893 if (0 != mbedtls_chacha20_setkey((mbedtls_chacha20_context *) ctx, key)) { in chacha20_setkey_wrap()
1900 static int chacha20_stream_wrap(void *ctx, size_t length, in chacha20_stream_wrap() argument
1906 ret = mbedtls_chacha20_update(ctx, length, input, output); in chacha20_stream_wrap()
1916 mbedtls_chacha20_context *ctx; in chacha20_ctx_alloc() local
1917 ctx = mbedtls_calloc(1, sizeof(mbedtls_chacha20_context)); in chacha20_ctx_alloc()
1919 if (ctx == NULL) { in chacha20_ctx_alloc()
1923 mbedtls_chacha20_init(ctx); in chacha20_ctx_alloc()
1925 return ctx; in chacha20_ctx_alloc()
1928 static void chacha20_ctx_free(void *ctx) in chacha20_ctx_free() argument
1930 mbedtls_chacha20_free((mbedtls_chacha20_context *) ctx); in chacha20_ctx_free()
1931 mbedtls_free(ctx); in chacha20_ctx_free()
1976 static int chachapoly_setkey_wrap(void *ctx, in chachapoly_setkey_wrap() argument
1984 if (0 != mbedtls_chachapoly_setkey((mbedtls_chachapoly_context *) ctx, key)) { in chachapoly_setkey_wrap()
1993 mbedtls_chachapoly_context *ctx; in chachapoly_ctx_alloc() local
1994 ctx = mbedtls_calloc(1, sizeof(mbedtls_chachapoly_context)); in chachapoly_ctx_alloc()
1996 if (ctx == NULL) { in chachapoly_ctx_alloc()
2000 mbedtls_chachapoly_init(ctx); in chachapoly_ctx_alloc()
2002 return ctx; in chachapoly_ctx_alloc()
2005 static void chachapoly_ctx_free(void *ctx) in chachapoly_ctx_free() argument
2007 mbedtls_chachapoly_free((mbedtls_chachapoly_context *) ctx); in chachapoly_ctx_free()
2008 mbedtls_free(ctx); in chachapoly_ctx_free()
2052 static int null_crypt_stream(void *ctx, size_t length, in null_crypt_stream() argument
2056 ((void) ctx); in null_crypt_stream()
2061 static int null_setkey(void *ctx, const unsigned char *key, in null_setkey() argument
2064 ((void) ctx); in null_setkey()
2076 static void null_ctx_free(void *ctx) in null_ctx_free() argument
2078 ((void) ctx); in null_ctx_free()
2125 void *ctx = mbedtls_calloc(1, sizeof(mbedtls_nist_kw_context)); in kw_ctx_alloc() local
2127 if (ctx != NULL) { in kw_ctx_alloc()
2128 mbedtls_nist_kw_init((mbedtls_nist_kw_context *) ctx); in kw_ctx_alloc()
2131 return ctx; in kw_ctx_alloc()
2134 static void kw_ctx_free(void *ctx) in kw_ctx_free() argument
2136 mbedtls_nist_kw_free(ctx); in kw_ctx_free()
2137 mbedtls_free(ctx); in kw_ctx_free()
2140 static int kw_aes_setkey_wrap(void *ctx, const unsigned char *key, in kw_aes_setkey_wrap() argument
2143 return mbedtls_nist_kw_setkey((mbedtls_nist_kw_context *) ctx, in kw_aes_setkey_wrap()
2147 static int kw_aes_setkey_unwrap(void *ctx, const unsigned char *key, in kw_aes_setkey_unwrap() argument
2150 return mbedtls_nist_kw_setkey((mbedtls_nist_kw_context *) ctx, in kw_aes_setkey_unwrap()