Home
last modified time | relevance | path

Searched refs:buf (Results 1 – 25 of 180) sorted by relevance

12345678

/net-tools-3.6.0/mbedtls-2.4.0/library/
Derror.c153 void mbedtls_strerror( int ret, char *buf, size_t buflen ) in mbedtls_strerror() argument
161 memset( buf, 0x00, buflen ); in mbedtls_strerror()
175 mbedtls_snprintf( buf, buflen, "CIPHER - The selected feature is not available" ); in mbedtls_strerror()
177 mbedtls_snprintf( buf, buflen, "CIPHER - Bad input parameters to function" ); in mbedtls_strerror()
179 mbedtls_snprintf( buf, buflen, "CIPHER - Failed to allocate memory" ); in mbedtls_strerror()
181 … mbedtls_snprintf( buf, buflen, "CIPHER - Input data contains invalid padding and is rejected" ); in mbedtls_strerror()
183 mbedtls_snprintf( buf, buflen, "CIPHER - Decryption of block requires a full block" ); in mbedtls_strerror()
185 mbedtls_snprintf( buf, buflen, "CIPHER - Authentication failed (for AEAD modes)" ); in mbedtls_strerror()
187 … mbedtls_snprintf( buf, buflen, "CIPHER - The context is invalid, eg because it was free()ed" ); in mbedtls_strerror()
192 mbedtls_snprintf( buf, buflen, "DHM - Bad input parameters to function" ); in mbedtls_strerror()
[all …]
Dx509write_crt.c142 unsigned char buf[9]; in mbedtls_x509write_crt_set_basic_constraints() local
143 unsigned char *c = buf + sizeof(buf); in mbedtls_x509write_crt_set_basic_constraints()
146 memset( buf, 0, sizeof(buf) ); in mbedtls_x509write_crt_set_basic_constraints()
155 MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_int( &c, buf, max_pathlen ) ); in mbedtls_x509write_crt_set_basic_constraints()
157 MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_bool( &c, buf, 1 ) ); in mbedtls_x509write_crt_set_basic_constraints()
160 MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_len( &c, buf, len ) ); in mbedtls_x509write_crt_set_basic_constraints()
161 MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_tag( &c, buf, MBEDTLS_ASN1_CONSTRUCTED | in mbedtls_x509write_crt_set_basic_constraints()
166 0, buf + sizeof(buf) - len, len ); in mbedtls_x509write_crt_set_basic_constraints()
173 unsigned char buf[MBEDTLS_MPI_MAX_SIZE * 2 + 20]; /* tag, length + 2xMPI */ in mbedtls_x509write_crt_set_subject_key_identifier() local
174 unsigned char *c = buf + sizeof(buf); in mbedtls_x509write_crt_set_subject_key_identifier()
[all …]
Dpkwrite.c90 unsigned char buf[MBEDTLS_ECP_MAX_PT_LEN]; in pk_write_ec_pubkey() local
94 &len, buf, sizeof( buf ) ) ) != 0 ) in pk_write_ec_pubkey()
103 memcpy( *p, buf, len ); in pk_write_ec_pubkey()
151 int mbedtls_pk_write_pubkey_der( mbedtls_pk_context *key, unsigned char *buf, size_t size ) in mbedtls_pk_write_pubkey_der() argument
158 c = buf + size; in mbedtls_pk_write_pubkey_der()
160 MBEDTLS_ASN1_CHK_ADD( len, mbedtls_pk_write_pubkey( &c, buf, key ) ); in mbedtls_pk_write_pubkey_der()
162 if( c - buf < 1 ) in mbedtls_pk_write_pubkey_der()
173 MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_len( &c, buf, len ) ); in mbedtls_pk_write_pubkey_der()
174 MBEDTLS_ASN1_CHK_ADD( len, mbedtls_asn1_write_tag( &c, buf, MBEDTLS_ASN1_BIT_STRING ) ); in mbedtls_pk_write_pubkey_der()
185 MBEDTLS_ASN1_CHK_ADD( par_len, pk_write_ec_param( &c, buf, mbedtls_pk_ec( *key ) ) ); in mbedtls_pk_write_pubkey_der()
[all …]
Dentropy.c227 unsigned char buf[MBEDTLS_ENTROPY_MAX_GATHER]; in entropy_gather_internal() local
243 buf, MBEDTLS_ENTROPY_MAX_GATHER, &olen ) ) != 0 ) in entropy_gather_internal()
253 entropy_update( ctx, (unsigned char) i, buf, olen ); in entropy_gather_internal()
290 unsigned char buf[MBEDTLS_ENTROPY_BLOCK_SIZE]; in mbedtls_entropy_func() local
333 memset( buf, 0, MBEDTLS_ENTROPY_BLOCK_SIZE ); in mbedtls_entropy_func()
336 mbedtls_sha512_finish( &ctx->accumulator, buf ); in mbedtls_entropy_func()
343 mbedtls_sha512_update( &ctx->accumulator, buf, MBEDTLS_ENTROPY_BLOCK_SIZE ); in mbedtls_entropy_func()
348 mbedtls_sha512( buf, MBEDTLS_ENTROPY_BLOCK_SIZE, buf, 0 ); in mbedtls_entropy_func()
350 mbedtls_sha256_finish( &ctx->accumulator, buf ); in mbedtls_entropy_func()
357 mbedtls_sha256_update( &ctx->accumulator, buf, MBEDTLS_ENTROPY_BLOCK_SIZE ); in mbedtls_entropy_func()
[all …]
Dpem.c138 unsigned char *buf, size_t buflen, in pem_des_decrypt() argument
150 des_iv, buf, buf ); in pem_des_decrypt()
160 unsigned char *buf, size_t buflen, in pem_des3_decrypt() argument
172 des3_iv, buf, buf ); in pem_des3_decrypt()
184 unsigned char *buf, size_t buflen, in pem_aes_decrypt() argument
196 aes_iv, buf, buf ); in pem_aes_decrypt()
212 unsigned char *buf; in mbedtls_pem_read_buffer() local
327 if( ( buf = mbedtls_calloc( 1, len ) ) == NULL ) in mbedtls_pem_read_buffer()
330 if( ( ret = mbedtls_base64_decode( buf, len, &len, s1, s2 - s1 ) ) != 0 ) in mbedtls_pem_read_buffer()
332 mbedtls_free( buf ); in mbedtls_pem_read_buffer()
[all …]
Dssl_srv.c91 const unsigned char *buf, in ssl_parse_servername_ext() argument
100 servername_list_size = ( ( buf[0] << 8 ) | ( buf[1] ) ); in ssl_parse_servername_ext()
107 p = buf + 2; in ssl_parse_servername_ext()
146 const unsigned char *buf, in ssl_parse_renegotiation_info() argument
156 buf[0] != ssl->verify_data_len || in ssl_parse_renegotiation_info()
157 mbedtls_ssl_safer_memcmp( buf + 1, ssl->peer_verify_data, in ssl_parse_renegotiation_info()
171 if( len != 1 || buf[0] != 0x0 ) in ssl_parse_renegotiation_info()
190 const unsigned char *buf, in ssl_parse_signature_algorithms_ext() argument
195 const unsigned char *end = buf + len; in ssl_parse_signature_algorithms_ext()
199 sig_alg_list_size = ( ( buf[0] << 8 ) | ( buf[1] ) ); in ssl_parse_signature_algorithms_ext()
[all …]
Decdh.c119 unsigned char *buf, size_t blen, in mbedtls_ecdh_make_params() argument
133 if( ( ret = mbedtls_ecp_tls_write_group( &ctx->grp, &grp_len, buf, blen ) ) in mbedtls_ecdh_make_params()
137 buf += grp_len; in mbedtls_ecdh_make_params()
141 &pt_len, buf, blen ) ) != 0 ) in mbedtls_ecdh_make_params()
156 const unsigned char **buf, const unsigned char *end ) in mbedtls_ecdh_read_params() argument
160 if( ( ret = mbedtls_ecp_tls_read_group( &ctx->grp, buf, end - *buf ) ) != 0 ) in mbedtls_ecdh_read_params()
163 if( ( ret = mbedtls_ecp_tls_read_point( &ctx->grp, &ctx->Qp, buf, end - *buf ) ) in mbedtls_ecdh_read_params()
200 unsigned char *buf, size_t blen, in mbedtls_ecdh_make_public() argument
214 olen, buf, blen ); in mbedtls_ecdh_make_public()
221 const unsigned char *buf, size_t blen ) in mbedtls_ecdh_read_public() argument
[all …]
Dx509write_csr.c90 unsigned char buf[4]; in mbedtls_x509write_csr_set_key_usage() local
94 c = buf + 4; in mbedtls_x509write_csr_set_key_usage()
96 if( ( ret = mbedtls_asn1_write_bitstring( &c, buf, &key_usage, 7 ) ) != 4 ) in mbedtls_x509write_csr_set_key_usage()
101 buf, 4 ); in mbedtls_x509write_csr_set_key_usage()
111 unsigned char buf[4]; in mbedtls_x509write_csr_set_ns_cert_type() local
115 c = buf + 4; in mbedtls_x509write_csr_set_ns_cert_type()
117 if( ( ret = mbedtls_asn1_write_bitstring( &c, buf, &ns_cert_type, 8 ) ) != 4 ) in mbedtls_x509write_csr_set_ns_cert_type()
122 buf, 4 ); in mbedtls_x509write_csr_set_ns_cert_type()
129 int mbedtls_x509write_csr_der( mbedtls_x509write_csr *ctx, unsigned char *buf, size_t size, in mbedtls_x509write_csr_der() argument
212 c2 = buf + size; in mbedtls_x509write_csr_der()
[all …]
/net-tools-3.6.0/mbedtls-2.4.0/programs/pkey/
Ddh_client.c79 unsigned char buf[2048]; in main() local
158 memset( buf, 0, sizeof( buf ) ); in main()
160 if( ( ret = mbedtls_net_recv( &server_fd, buf, 2 ) ) != 2 ) in main()
166 n = buflen = ( buf[0] << 8 ) | buf[1]; in main()
167 if( buflen < 1 || buflen > sizeof( buf ) ) in main()
176 memset( buf, 0, sizeof( buf ) ); in main()
178 if( ( ret = mbedtls_net_recv( &server_fd, buf, n ) ) != (int) n ) in main()
184 p = buf, end = buf + buflen; in main()
215 mbedtls_sha1( buf, (int)( p - 2 - buf ), hash ); in main()
231 if( ( ret = mbedtls_dhm_make_public( &dhm, (int) dhm.len, buf, n, in main()
[all …]
Ddh_server.c78 unsigned char buf[2048]; in main() local
194 memset( buf, 0, sizeof( buf ) ); in main()
196 if( ( ret = mbedtls_dhm_make_params( &dhm, (int) mbedtls_mpi_size( &dhm.P ), buf, &n, in main()
206 mbedtls_sha1( buf, n, hash ); in main()
208 buf[n ] = (unsigned char)( rsa.len >> 8 ); in main()
209 buf[n + 1] = (unsigned char)( rsa.len ); in main()
212 0, hash, buf + n + 2 ) ) != 0 ) in main()
223 ( ret = mbedtls_net_send( &client_fd, buf, buflen ) ) != (int) buflen ) in main()
235 memset( buf, 0, sizeof( buf ) ); in main()
237 if( ( ret = mbedtls_net_recv( &client_fd, buf, n ) ) != (int) n ) in main()
[all …]
/net-tools-3.6.0/mbedtls-2.4.0/tests/suites/
Dtest_suite_asn1write.function18 unsigned char buf[150];
24 memset( buf, GUARD_VAL, sizeof( buf ) );
29 p = buf + GUARD_LEN + buf_len;
31 ret = mbedtls_asn1_write_octet_string( &p, buf + GUARD_LEN, str, str_len );
36 TEST_ASSERT( buf[i] == GUARD_VAL );
37 TEST_ASSERT( buf[GUARD_LEN + buf_len + i] == GUARD_VAL );
43 TEST_ASSERT( p + asn1_len == buf + GUARD_LEN + buf_len );
55 unsigned char buf[150];
60 memset( buf, GUARD_VAL, sizeof( buf ) );
65 p = buf + GUARD_LEN + buf_len;
[all …]
Dtest_suite_pkwrite.function16 unsigned char buf[5000];
22 memset( buf, 0, sizeof( buf ) );
28 ret = mbedtls_pk_write_pubkey_pem( &key, buf, sizeof( buf ));
36 TEST_ASSERT( ilen == strlen( (char *) buf ) );
37 TEST_ASSERT( memcmp( (char *) buf, (char *) check_buf, ilen ) == 0 );
48 unsigned char buf[5000];
54 memset( buf, 0, sizeof( buf ) );
60 ret = mbedtls_pk_write_key_pem( &key, buf, sizeof( buf ));
68 TEST_ASSERT( ilen == strlen( (char *) buf ) );
69 TEST_ASSERT( memcmp( (char *) buf, (char *) check_buf, ilen ) == 0 );
Dtest_suite_x509write.function19 unsigned char buf[4096];
42 ret = mbedtls_x509write_csr_pem( &req, buf, sizeof(buf),
46 pem_len = strlen( (char *) buf );
54 TEST_ASSERT( memcmp( buf, check_buf, pem_len - 1 ) == 0 );
56 der_len = mbedtls_x509write_csr_der( &req, buf, sizeof( buf ),
63 ret = mbedtls_x509write_csr_der( &req, buf, (size_t)( der_len - 1 ),
83 unsigned char buf[4096];
126 ret = mbedtls_x509write_crt_pem( &crt, buf, sizeof(buf),
130 pem_len = strlen( (char *) buf );
139 TEST_ASSERT( memcmp( buf, check_buf, pem_len - 1 ) == 0 );
[all …]
Dmain_test.function139 int get_line( FILE *f, char *buf, size_t len )
143 ret = fgets( buf, len, f );
147 if( strlen( buf ) && buf[strlen(buf) - 1] == '\n' )
148 buf[strlen(buf) - 1] = '\0';
149 if( strlen( buf ) && buf[strlen(buf) - 1] == '\r' )
150 buf[strlen(buf) - 1] = '\0';
155 int parse_arguments( char *buf, size_t len, char *params[50] )
158 char *cur = buf;
159 char *p = buf, *q;
163 while( *p != '\0' && p < buf + len )
[all …]
/net-tools-3.6.0/mbedtls-2.4.0/programs/test/
Dbenchmark.c235 unsigned char buf[BUFSIZE]; variable
325 memset( buf, 0xAA, sizeof( buf ) ); in main()
330 TIME_AND_TSC( "MD4", mbedtls_md4( buf, BUFSIZE, tmp ) ); in main()
335 TIME_AND_TSC( "MD5", mbedtls_md5( buf, BUFSIZE, tmp ) ); in main()
340 TIME_AND_TSC( "RIPEMD160", mbedtls_ripemd160( buf, BUFSIZE, tmp ) ); in main()
345 TIME_AND_TSC( "SHA-1", mbedtls_sha1( buf, BUFSIZE, tmp ) ); in main()
350 TIME_AND_TSC( "SHA-256", mbedtls_sha256( buf, BUFSIZE, tmp, 0 ) ); in main()
355 TIME_AND_TSC( "SHA-512", mbedtls_sha512( buf, BUFSIZE, tmp, 0 ) ); in main()
364 TIME_AND_TSC( "ARC4", mbedtls_arc4_crypt( &arc4, BUFSIZE, buf, buf ) ); in main()
377 mbedtls_des3_crypt_cbc( &des3, MBEDTLS_DES_ENCRYPT, BUFSIZE, tmp, buf, buf ) ); in main()
[all …]
/net-tools-3.6.0/libcoap/tests/
Dtest_wellknown.c30 unsigned char buf[40]; in t_wellknown1() local
49 buflen = sizeof(buf); in t_wellknown1()
51 result = coap_print_link(r, buf, &buflen, &ofs); in t_wellknown1()
55 CU_ASSERT(memcmp(buf, teststr + offset, sizeof(teststr) - offset) == 0); in t_wellknown1()
60 buflen = sizeof(buf); in t_wellknown1()
61 result = coap_print_link(r, buf, &buflen, &ofs); in t_wellknown1()
67 buflen = sizeof(buf); in t_wellknown1()
69 result = coap_print_link(r, buf, &buflen, &ofs); in t_wellknown1()
79 unsigned char buf[10]; /* smaller than teststr */ in t_wellknown2() local
94 for (offset = 0; offset < sizeof(teststr) - sizeof(buf); offset++) { in t_wellknown2()
[all …]
/net-tools-3.6.0/mbedtls-2.4.0/yotta/data/example-benchmark/
Dmain.cpp337 unsigned char buf[BUFSIZE]; variable
421 memset( buf, 0xAA, sizeof( buf ) ); in benchmark()
426 TIME_AND_TSC( "MD4", mbedtls_md4( buf, BUFSIZE, tmp ) ); in benchmark()
431 TIME_AND_TSC( "MD5", mbedtls_md5( buf, BUFSIZE, tmp ) ); in benchmark()
436 TIME_AND_TSC( "RIPEMD160", mbedtls_ripemd160( buf, BUFSIZE, tmp ) ); in benchmark()
441 TIME_AND_TSC( "SHA-1", mbedtls_sha1( buf, BUFSIZE, tmp ) ); in benchmark()
446 TIME_AND_TSC( "SHA-256", mbedtls_sha256( buf, BUFSIZE, tmp, 0 ) ); in benchmark()
451 TIME_AND_TSC( "SHA-512", mbedtls_sha512( buf, BUFSIZE, tmp, 0 ) ); in benchmark()
460 TIME_AND_TSC( "ARC4", mbedtls_arc4_crypt( &arc4, BUFSIZE, buf, buf ) ); in benchmark()
472 mbedtls_des3_crypt_cbc( &des3, MBEDTLS_DES_ENCRYPT, BUFSIZE, tmp, buf, buf ) ); in benchmark()
[all …]
/net-tools-3.6.0/mbedtls-2.4.0/programs/x509/
Dcert_write.c192 char buf[1024]; in main() local
219 memset( buf, 0, 1024 ); in main()
378 mbedtls_strerror( ret, buf, 1024 ); in main()
379 mbedtls_printf( " failed\n ! mbedtls_ctr_drbg_seed returned %d - %s\n", ret, buf ); in main()
392 mbedtls_strerror( ret, buf, 1024 ); in main()
393 … mbedtls_printf( " failed\n ! mbedtls_mpi_read_string returned -0x%02x - %s\n\n", -ret, buf ); in main()
411 mbedtls_strerror( ret, buf, 1024 ); in main()
412 …mbedtls_printf( " failed\n ! mbedtls_x509_crt_parse_file returned -0x%02x - %s\n\n", -ret, buf ); in main()
420 mbedtls_strerror( ret, buf, 1024 ); in main()
421 … mbedtls_printf( " failed\n ! mbedtls_x509_dn_gets returned -0x%02x - %s\n\n", -ret, buf ); in main()
[all …]
/net-tools-3.6.0/libcoap/include/coap/
Dprng.h32 coap_prng_impl(unsigned char *buf, size_t len) { in coap_prng_impl() argument
34 *buf++ = rand() & 0xFF; in coap_prng_impl()
48 contiki_prng_impl(unsigned char *buf, size_t len) { in contiki_prng_impl() argument
51 memcpy(buf, &v, sizeof(v)); in contiki_prng_impl()
53 buf += sizeof(v); in contiki_prng_impl()
57 memcpy(buf, &v, len); in contiki_prng_impl()
67 lwip_prng_impl(unsigned char *buf, size_t len) { in lwip_prng_impl() argument
70 memcpy(buf, &v, sizeof(v)); in lwip_prng_impl()
72 buf += sizeof(v); in lwip_prng_impl()
76 memcpy(buf, &v, len); in lwip_prng_impl()
/net-tools-3.6.0/libcoap/src/
Ddebug.c162 coap_print_addr(const struct coap_address_t *addr, unsigned char *buf, size_t len) { in coap_print_addr() argument
166 unsigned char *p = buf; in coap_print_addr()
184 memcpy(buf, "(unknown address type)", min(22, len)); in coap_print_addr()
196 if (p < buf + len) { in coap_print_addr()
202 p += snprintf((char *)p, buf + len - p + 1, ":%d", port); in coap_print_addr()
204 return buf + len - p; in coap_print_addr()
207 unsigned char *p = buf; in coap_print_addr()
233 if (buf + len - p < 6) in coap_print_addr()
237 p += snprintf((char *)p, buf + len - p + 1, ":%d", uip_htons(addr->port)); in coap_print_addr()
242 return p - buf; in coap_print_addr()
[all …]
/net-tools-3.6.0/mbedtls-2.4.0/programs/util/
Dpem2der.c119 static int load_file( const char *path, unsigned char **buf, size_t *n ) in load_file() argument
138 ( *buf = mbedtls_calloc( 1, *n + 1 ) ) == NULL ) in load_file()
144 if( fread( *buf, 1, *n, f ) != *n ) in load_file()
147 free( *buf ); in load_file()
148 *buf = NULL; in load_file()
154 (*buf)[*n] = '\0'; in load_file()
162 static int write_file( const char *path, unsigned char *buf, size_t n ) in write_file() argument
169 if( fwrite( buf, 1, n, f ) != n ) in write_file()
184 char buf[1024]; in main() local
192 memset( buf, 0, sizeof(buf) ); in main()
[all …]
/net-tools-3.6.0/tinydtls-0.8.2/
Dprng.h33 dtls_prng(unsigned char *buf, size_t len) { in dtls_prng() argument
35 *buf++ = rand() & 0xFF; in dtls_prng()
49 dtls_prng(unsigned char *buf, size_t len) in dtls_prng() argument
51 return contiki_prng_impl(buf, len); in dtls_prng()
60 dtls_prng(unsigned char *buf, size_t len) { in dtls_prng() argument
63 memcpy(buf, &v, sizeof(v)); in dtls_prng()
65 buf += sizeof(v); in dtls_prng()
69 memcpy(buf, &v, len); in dtls_prng()
Dcrypto.c188 unsigned char *buf, size_t buflen) { in dtls_p_hash() argument
222 memcpy(buf, tmp, dlen); in dtls_p_hash()
223 buf += dlen; in dtls_p_hash()
239 memcpy(buf, tmp, buflen - len); in dtls_p_hash()
253 unsigned char *buf, size_t buflen) { in dtls_prf() argument
256 memset(buf, 0, buflen); in dtls_prf()
262 buf, buflen); in dtls_prf()
269 unsigned char *buf) { in dtls_mac() argument
279 dtls_hmac_finalize(hmac_ctx, buf); in dtls_mac()
284 unsigned char *buf, in dtls_ccm_encrypt() argument
[all …]
/net-tools-3.6.0/mbedtls-2.4.0/programs/ssl/
Dssl_mail_client.c171 unsigned char buf[1024]; in do_handshake() local
172 memset(buf, 0, 1024); in do_handshake()
185 mbedtls_strerror( ret, (char *) buf, 1024 ); in do_handshake()
187 mbedtls_printf( " failed\n ! mbedtls_ssl_handshake returned %d: %s\n\n", ret, buf ); in do_handshake()
215 mbedtls_x509_crt_info( (char *) buf, sizeof( buf ) - 1, " ", in do_handshake()
217 mbedtls_printf( "%s\n", buf ); in do_handshake()
222 static int write_ssl_data( mbedtls_ssl_context *ssl, unsigned char *buf, size_t len ) in write_ssl_data() argument
226 mbedtls_printf("\n%s", buf); in write_ssl_data()
227 while( len && ( ret = mbedtls_ssl_write( ssl, buf, len ) ) <= 0 ) in write_ssl_data()
239 static int write_ssl_and_get_response( mbedtls_ssl_context *ssl, unsigned char *buf, size_t len ) in write_ssl_and_get_response() argument
[all …]
/net-tools-3.6.0/tinydtls-0.8.2/sha2/
Dsha2prog.c58 unsigned char buf[BUFLEN]; in main() local
101 while ((l = read(fd,buf,BUFLEN)) > 0) { in main()
103 SHA256_Update(&ctx256, (unsigned char*)buf, l); in main()
104 SHA384_Update(&ctx384, (unsigned char*)buf, l); in main()
105 SHA512_Update(&ctx512, (unsigned char*)buf, l); in main()
112 SHA256_End(&ctx256, buf); in main()
115 printf("%s\n", buf); in main()
118 SHA384_End(&ctx384, buf); in main()
121 printf("%s\n", buf); in main()
124 SHA512_End(&ctx512, buf); in main()
[all …]

12345678