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