Changeset 1159
- Timestamp:
- 12/10/11 22:55:01 (5 months ago)
- Location:
- trunk
- Files:
-
- 38 edited
-
ChangeLog (modified) (1 diff)
-
include/polarssl/asn1.h (modified) (1 diff)
-
include/polarssl/base64.h (modified) (1 diff)
-
include/polarssl/bignum.h (modified) (25 diffs)
-
include/polarssl/ctr_drbg.h (modified) (1 diff)
-
include/polarssl/entropy.h (modified) (1 diff)
-
include/polarssl/error.h (modified) (1 diff)
-
include/polarssl/md2.h (modified) (2 diffs)
-
include/polarssl/md4.h (modified) (2 diffs)
-
include/polarssl/md5.h (modified) (2 diffs)
-
include/polarssl/sha1.h (modified) (2 diffs)
-
include/polarssl/sha2.h (modified) (2 diffs)
-
include/polarssl/sha4.h (modified) (2 diffs)
-
include/polarssl/ssl.h (modified) (2 diffs)
-
include/polarssl/x509.h (modified) (4 diffs)
-
library/asn1parse.c (modified) (1 diff)
-
library/bignum.c (modified) (1 diff)
-
library/ctr_drbg.c (modified) (5 diffs)
-
library/error.c (modified) (10 diffs)
-
library/md2.c (modified) (2 diffs)
-
library/md4.c (modified) (2 diffs)
-
library/md5.c (modified) (2 diffs)
-
library/sha1.c (modified) (2 diffs)
-
library/sha2.c (modified) (2 diffs)
-
library/sha4.c (modified) (2 diffs)
-
library/ssl_tls.c (modified) (4 diffs)
-
library/x509parse.c (modified) (26 diffs)
-
programs/ssl/ssl_client2.c (modified) (2 diffs)
-
programs/ssl/ssl_fork_server.c (modified) (2 diffs)
-
programs/ssl/ssl_mail_client.c (modified) (3 diffs)
-
programs/ssl/ssl_server.c (modified) (2 diffs)
-
programs/test/ssl_cert_test.c (modified) (2 diffs)
-
programs/test/ssl_test.c (modified) (2 diffs)
-
programs/x509/cert_app.c (modified) (2 diffs)
-
scripts/generate_errors.pl (modified) (1 diff)
-
tests/suites/test_suite_ctr_drbg.function (modified) (1 diff)
-
tests/suites/test_suite_debug.function (modified) (1 diff)
-
tests/suites/test_suite_x509parse.function (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r1154 r1159 39 39 * Added permissive certificate parsing to x509parse_crt() and 40 40 x509parse_crtfile(). With permissive parsing the parsing does not stop on 41 encountering a parse-error 41 encountering a parse-error. Beware that the meaning of return values has 42 changed! 43 * All error codes are now negative. Even on mermory failures and IO errors. 42 44 43 45 Bugfix -
trunk/include/polarssl/asn1.h
r1110 r1159 53 53 #define POLARSSL_ERR_ASN1_LENGTH_MISMATCH -0x001A /**< Actual length differs from expected length. */ 54 54 #define POLARSSL_ERR_ASN1_INVALID_DATA -0x001C /**< Data is invalid. (not used) */ 55 #define POLARSSL_ERR_ASN1_MALLOC_FAILED -0x001E /**< Memory allocation failed */ 55 56 /* \} name */ 56 57 -
trunk/include/polarssl/base64.h
r1027 r1159 30 30 #include <string.h> 31 31 32 #define POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL -0x00 10/**< Output buffer too small. */33 #define POLARSSL_ERR_BASE64_INVALID_CHARACTER -0x00 12/**< Invalid character in input. */32 #define POLARSSL_ERR_BASE64_BUFFER_TOO_SMALL -0x002A /**< Output buffer too small. */ 33 #define POLARSSL_ERR_BASE64_INVALID_CHARACTER -0x002C /**< Invalid character in input. */ 34 34 35 35 #ifdef __cplusplus -
trunk/include/polarssl/bignum.h
r1136 r1159 34 34 #define POLARSSL_ERR_MPI_BAD_INPUT_DATA -0x0004 /**< Bad input parameters to function. */ 35 35 #define POLARSSL_ERR_MPI_INVALID_CHARACTER -0x0006 /**< There is an invalid character in the digit string. */ 36 #define POLARSSL_ERR_MPI_BUFFER_TOO_SMALL -0x0008 /**< The buffer is too small to write to o. */36 #define POLARSSL_ERR_MPI_BUFFER_TOO_SMALL -0x0008 /**< The buffer is too small to write to. */ 37 37 #define POLARSSL_ERR_MPI_NEGATIVE_VALUE -0x000A /**< The input arguments are negative or result in illegal output. */ 38 38 #define POLARSSL_ERR_MPI_DIVISION_BY_ZERO -0x000C /**< The input argument for division is zero, which is not allowed. */ 39 39 #define POLARSSL_ERR_MPI_NOT_ACCEPTABLE -0x000E /**< The input arguments are not acceptable. */ 40 #define POLARSSL_ERR_MPI_MALLOC_FAILED -0x0010 /**< Memory allocation failed. */ 40 41 41 42 #define MPI_CHK(f) if( ( ret = f ) != 0 ) goto cleanup … … 146 147 * 147 148 * \return 0 if successful, 148 * 1if memory allocation failed149 * POLARSSL_ERR_MPI_MALLOC_FAILED if memory allocation failed 149 150 */ 150 151 int mpi_grow( mpi *X, size_t nblimbs ); … … 157 158 * 158 159 * \return 0 if successful, 159 * 1if memory allocation failed160 * POLARSSL_ERR_MPI_MALLOC_FAILED if memory allocation failed 160 161 */ 161 162 int mpi_copy( mpi *X, const mpi *Y ); … … 176 177 * 177 178 * \return 0 if successful, 178 * 1if memory allocation failed179 * POLARSSL_ERR_MPI_MALLOC_FAILED if memory allocation failed 179 180 */ 180 181 int mpi_lset( mpi *X, t_sint z ); … … 201 202 * 202 203 * \return 0 if successful, 203 * 1if memory allocation failed,204 * POLARSSL_ERR_MPI_MALLOC_FAILED if memory allocation failed, 204 205 * POLARSSL_ERR_MPI_BAD_INPUT_DATA if val is not 0 or 1 205 206 */ … … 290 291 * 291 292 * \return 0 if successful, 292 * 1if memory allocation failed293 * POLARSSL_ERR_MPI_MALLOC_FAILED if memory allocation failed 293 294 */ 294 295 int mpi_read_binary( mpi *X, const unsigned char *buf, size_t buflen ); … … 313 314 * 314 315 * \return 0 if successful, 315 * 1if memory allocation failed316 * POLARSSL_ERR_MPI_MALLOC_FAILED if memory allocation failed 316 317 */ 317 318 int mpi_shift_l( mpi *X, size_t count ); … … 324 325 * 325 326 * \return 0 if successful, 326 * 1if memory allocation failed327 * POLARSSL_ERR_MPI_MALLOC_FAILED if memory allocation failed 327 328 */ 328 329 int mpi_shift_r( mpi *X, size_t count ); … … 372 373 * 373 374 * \return 0 if successful, 374 * 1if memory allocation failed375 * POLARSSL_ERR_MPI_MALLOC_FAILED if memory allocation failed 375 376 */ 376 377 int mpi_add_abs( mpi *X, const mpi *A, const mpi *B ); … … 396 397 * 397 398 * \return 0 if successful, 398 * 1if memory allocation failed399 * POLARSSL_ERR_MPI_MALLOC_FAILED if memory allocation failed 399 400 */ 400 401 int mpi_add_mpi( mpi *X, const mpi *A, const mpi *B ); … … 408 409 * 409 410 * \return 0 if successful, 410 * 1if memory allocation failed411 * POLARSSL_ERR_MPI_MALLOC_FAILED if memory allocation failed 411 412 */ 412 413 int mpi_sub_mpi( mpi *X, const mpi *A, const mpi *B ); … … 420 421 * 421 422 * \return 0 if successful, 422 * 1if memory allocation failed423 * POLARSSL_ERR_MPI_MALLOC_FAILED if memory allocation failed 423 424 */ 424 425 int mpi_add_int( mpi *X, const mpi *A, t_sint b ); … … 432 433 * 433 434 * \return 0 if successful, 434 * 1if memory allocation failed435 * POLARSSL_ERR_MPI_MALLOC_FAILED if memory allocation failed 435 436 */ 436 437 int mpi_sub_int( mpi *X, const mpi *A, t_sint b ); … … 444 445 * 445 446 * \return 0 if successful, 446 * 1if memory allocation failed447 * POLARSSL_ERR_MPI_MALLOC_FAILED if memory allocation failed 447 448 */ 448 449 int mpi_mul_mpi( mpi *X, const mpi *A, const mpi *B ); … … 458 459 * 459 460 * \return 0 if successful, 460 * 1if memory allocation failed461 * POLARSSL_ERR_MPI_MALLOC_FAILED if memory allocation failed 461 462 */ 462 463 int mpi_mul_int( mpi *X, const mpi *A, t_sint b ); … … 471 472 * 472 473 * \return 0 if successful, 473 * 1if memory allocation failed,474 * POLARSSL_ERR_MPI_MALLOC_FAILED if memory allocation failed, 474 475 * POLARSSL_ERR_MPI_DIVISION_BY_ZERO if B == 0 475 476 * … … 487 488 * 488 489 * \return 0 if successful, 489 * 1if memory allocation failed,490 * POLARSSL_ERR_MPI_MALLOC_FAILED if memory allocation failed, 490 491 * POLARSSL_ERR_MPI_DIVISION_BY_ZERO if b == 0 491 492 * … … 502 503 * 503 504 * \return 0 if successful, 504 * 1if memory allocation failed,505 * POLARSSL_ERR_MPI_MALLOC_FAILED if memory allocation failed, 505 506 * POLARSSL_ERR_MPI_DIVISION_BY_ZERO if B == 0, 506 507 * POLARSSL_ERR_MPI_NEGATIVE_VALUE if B < 0 … … 516 517 * 517 518 * \return 0 if successful, 518 * 1if memory allocation failed,519 * POLARSSL_ERR_MPI_MALLOC_FAILED if memory allocation failed, 519 520 * POLARSSL_ERR_MPI_DIVISION_BY_ZERO if b == 0, 520 521 * POLARSSL_ERR_MPI_NEGATIVE_VALUE if b < 0 … … 532 533 * 533 534 * \return 0 if successful, 534 * 1if memory allocation failed,535 * POLARSSL_ERR_MPI_MALLOC_FAILED if memory allocation failed, 535 536 * POLARSSL_ERR_MPI_BAD_INPUT_DATA if N is negative or even 536 537 * … … 550 551 * 551 552 * \return 0 if successful, 552 * 1if memory allocation failed553 * POLARSSL_ERR_MPI_MALLOC_FAILED if memory allocation failed 553 554 */ 554 555 int mpi_fill_random( mpi *X, size_t size, … … 564 565 * 565 566 * \return 0 if successful, 566 * 1if memory allocation failed567 * POLARSSL_ERR_MPI_MALLOC_FAILED if memory allocation failed 567 568 */ 568 569 int mpi_gcd( mpi *G, const mpi *A, const mpi *B ); … … 576 577 * 577 578 * \return 0 if successful, 578 * 1if memory allocation failed,579 * POLARSSL_ERR_MPI_MALLOC_FAILED if memory allocation failed, 579 580 * POLARSSL_ERR_MPI_BAD_INPUT_DATA if N is negative or nil 580 581 POLARSSL_ERR_MPI_NOT_ACCEPTABLE if A has no inverse mod N … … 590 591 * 591 592 * \return 0 if successful (probably prime), 592 * 1if memory allocation failed,593 * POLARSSL_ERR_MPI_MALLOC_FAILED if memory allocation failed, 593 594 * POLARSSL_ERR_MPI_NOT_ACCEPTABLE if X is not prime 594 595 */ … … 607 608 * 608 609 * \return 0 if successful (probably prime), 609 * 1if memory allocation failed,610 * POLARSSL_ERR_MPI_MALLOC_FAILED if memory allocation failed, 610 611 * POLARSSL_ERR_MPI_BAD_INPUT_DATA if nbits is < 3 611 612 */ -
trunk/include/polarssl/ctr_drbg.h
r1156 r1159 35 35 #define POLARSSL_ERR_CTR_DRBG_REQUEST_TOO_BIG -0x0036 /**< Too many random requested in single call. */ 36 36 #define POLARSSL_ERR_CTR_DRBG_INPUT_TOO_BIG -0x0038 /**< Input too large (Entropy + additional). */ 37 #define POLARSSL_ERR_CTR_DRBG_FILE_IO_ERROR -0x003A /**< Read/write error in file. */ 37 38 38 39 #define CTR_DRBG_BLOCKSIZE 16 /**< Block size used by the cipher */ -
trunk/include/polarssl/entropy.h
r1157 r1159 32 32 #include "sha4.h" 33 33 34 #define POLARSSL_ERR_ENTROPY_SOURCE_FAILED -0x003 A/**< Critical entropy source failure. */35 #define POLARSSL_ERR_ENTROPY_MAX_SOURCES -0x003 C/**< No more sources can be added. */34 #define POLARSSL_ERR_ENTROPY_SOURCE_FAILED -0x003C /**< Critical entropy source failure. */ 35 #define POLARSSL_ERR_ENTROPY_MAX_SOURCES -0x003E /**< No more sources can be added. */ 36 36 37 37 #define ENTROPY_MAX_SOURCES 20 /**< Maximum number of sources supported */ -
trunk/include/polarssl/error.h
r1138 r1159 49 49 * 50 50 * Module Nr Codes assigned 51 * MPI 7 0x0002-0x000E 52 * BASE64 2 0x0010-0x0012 53 * ASN1 5 0x0014-0x001C 51 * MPI 7 0x0002-0x0010 52 * ASN1 6 0x0014-0x001E 54 53 * AES 2 0x0020-0x0022 55 54 * CAMELLIA 2 0x0024-0x0026 56 55 * XTEA 1 0x0028-0x0028 56 * BASE64 2 0x002A-0x002C 57 57 * PADLOCK 1 0x0030-0x0030 58 58 * DES 1 0x0032-0x0032 59 59 * NET 11 0x0040-0x0054 60 * CTR_DBRG 3 0x0034-0x0038 61 * ENTROPY 2 0x003A-0x003C 60 * CTR_DBRG 3 0x0034-0x003A 61 * ENTROPY 2 0x003C-0x003E 62 * MD2 1 0x0070-0x0070 63 * MD4 1 0x0072-0x0072 64 * MD5 1 0x0074-0x0074 65 * SHA1 1 0x0076-0x0076 66 * SHA2 1 0x0078-0x0078 67 * SHA4 1 0x007A-0x007A 62 68 * 63 69 * High-level module nr (3 bits - 0x1...-0x8...) 64 70 * Name ID Nr of Errors 65 71 * PEM 1 8 66 * X509 2 2 072 * X509 2 21 67 73 * DHM 3 6 68 74 * RSA 4 9 69 75 * MD 5 1 70 76 * CIPER 6 1 71 * SSL 7 2777 * SSL 7 30 72 78 * 73 79 * Module dependent error code (5 bits 0x.08.-0x.F8.) -
trunk/include/polarssl/md2.h
r1097 r1159 29 29 30 30 #include <string.h> 31 32 #define POLARSSL_ERR_MD2_FILE_IO_ERROR -0x0070 /**< Read/write error in file. */ 31 33 32 34 /** … … 88 90 * \param output MD2 checksum result 89 91 * 90 * \return 0 if successful, 1 if fopen failed, 91 * or 2 if fread failed 92 * \return 0 if successful, or POLARSSL_ERR_MD2_FILE_IO_ERROR 92 93 */ 93 94 int md2_file( const char *path, unsigned char output[16] ); -
trunk/include/polarssl/md4.h
r1014 r1159 29 29 30 30 #include <string.h> 31 32 #define POLARSSL_ERR_MD4_FILE_IO_ERROR -0x0072 /**< Read/write error in file. */ 31 33 32 34 /** … … 87 89 * \param output MD4 checksum result 88 90 * 89 * \return 0 if successful, 1 if fopen failed, 90 * or 2 if fread failed 91 * \return 0 if successful, or POLARSSL_ERR_MD4_FILE_IO_ERROR 91 92 */ 92 93 int md4_file( const char *path, unsigned char output[16] ); -
trunk/include/polarssl/md5.h
r1014 r1159 29 29 30 30 #include <string.h> 31 32 #define POLARSSL_ERR_MD5_FILE_IO_ERROR -0x0074 /**< Read/write error in file. */ 31 33 32 34 /** … … 87 89 * \param output MD5 checksum result 88 90 * 89 * \return 0 if successful, 1 if fopen failed, 90 * or 2 if fread failed 91 * \return 0 if successful, or POLARSSL_ERR_MD5_FILE_IO_ERROR 91 92 */ 92 93 int md5_file( const char *path, unsigned char output[16] ); -
trunk/include/polarssl/sha1.h
r1014 r1159 29 29 30 30 #include <string.h> 31 32 #define POLARSSL_ERR_SHA1_FILE_IO_ERROR -0x0076 /**< Read/write error in file. */ 31 33 32 34 /** … … 87 89 * \param output SHA-1 checksum result 88 90 * 89 * \return 0 if successful, 1 if fopen failed, 90 * or 2 if fread failed 91 * \return 0 if successful, or POLARSSL_ERR_SHA1_FILE_IO_ERROR 91 92 */ 92 93 int sha1_file( const char *path, unsigned char output[20] ); -
trunk/include/polarssl/sha2.h
r1014 r1159 29 29 30 30 #include <string.h> 31 32 #define POLARSSL_ERR_SHA2_FILE_IO_ERROR -0x0078 /**< Read/write error in file. */ 31 33 32 34 /** … … 92 94 * \param is224 0 = use SHA256, 1 = use SHA224 93 95 * 94 * \return 0 if successful, 1 if fopen failed, 95 * or 2 if fread failed 96 * \return 0 if successful, or POLARSSL_ERR_SHA2_FILE_IO_ERROR 96 97 */ 97 98 int sha2_file( const char *path, unsigned char output[32], int is224 ); -
trunk/include/polarssl/sha4.h
r1145 r1159 29 29 30 30 #include <string.h> 31 32 #define POLARSSL_ERR_SHA4_FILE_IO_ERROR -0x007A /**< Read/write error in file. */ 31 33 32 34 #if defined(_MSC_VER) || defined(__WATCOMC__) … … 100 102 * \param is384 0 = use SHA512, 1 = use SHA384 101 103 * 102 * \return 0 if successful, 1 if fopen failed, 103 * or 2 if fread failed 104 * \return 0 if successful, or POLARSSL_ERR_SHA4_FILE_IO_ERROR 104 105 */ 105 106 int sha4_file( const char *path, unsigned char output[64], int is384 ); -
trunk/include/polarssl/ssl.h
r1132 r1159 82 82 #define POLARSSL_ERR_SSL_BAD_HS_CHANGE_CIPHER_SPEC -0x7E00 /**< Processing of the ChangeCipherSpec handshake message failed. */ 83 83 #define POLARSSL_ERR_SSL_BAD_HS_FINISHED -0x7E80 /**< Processing of the Finished handshake message failed. */ 84 #define POLARSSL_ERR_SSL_MALLOC_FAILED -0x7F00 /**< Memory allocation failed */ 84 85 85 86 /* … … 374 375 * \param ssl SSL context 375 376 * 376 * \return 0 if successful, or 1 if memory allocation failed 377 * \return 0 if successful, or POLARSSL_ERR_SSL_MALLOC_FAILED if 378 * memory allocation failed 377 379 */ 378 380 int ssl_init( ssl_context *ssl ); -
trunk/include/polarssl/x509.h
r1140 r1159 60 60 #define POLARSSL_ERR_X509_KEY_INVALID_FORMAT -0x2900 /**< Invalid RSA key tag or value. */ 61 61 #define POLARSSL_ERR_X509_CERT_UNKNOWN_FORMAT -0x2980 /**< Format not recognized as DER or PEM. */ 62 #define POLARSSL_ERR_X509_VALUE_TO_LENGTH -0x2A00 /**< Not used. */ 62 #define POLARSSL_ERR_X509_INVALID_INPUT -0x2A00 /**< Input invalid. */ 63 #define POLARSSL_ERR_X509_MALLOC_FAILED -0x2A80 /**< Allocation of memory failed. */ 64 #define POLARSSL_ERR_X509_FILE_IO_ERROR -0x2B00 /**< Read/write of file failed. */ 63 65 /* \} name */ 64 66 … … 228 230 #define X509_FORMAT_PEM 2 229 231 230 #define X509_NON_PERMISSIVE 0231 #define X509_PERMISSIVE 1232 233 234 232 /** 235 233 * \addtogroup x509_module … … 421 419 /** 422 420 * \brief Parse one or more certificates and add them 423 * to the chained list. With permissive parsing enabled 424 * all certificates that cannot be parsed are ignored. 425 * If none complete correctly, the first error is returned. 421 * to the chained list. Parses permissively. If some 422 * certificates can be parsed, the result is the number 423 * of failed certificates it encountered. If none complete 424 * correctly, the first error is returned. 426 425 * 427 426 * \param chain points to the start of the chain 428 427 * \param buf buffer holding the certificate data 429 428 * \param buflen size of the buffer 430 * \param permissive X509_PERMISSIVE or X509_NON_PERMISSIVE 431 * 432 * \return 0 if successful, or a specific X509 or PEM error code 433 */ 434 int x509parse_crt( x509_cert *chain, const unsigned char *buf, size_t buflen, 435 int permissive ); 429 * 430 * \return 0 if all certificates parsed successfully, a positive number 431 * if partly successful or a specific X509 or PEM error code 432 */ 433 int x509parse_crt( x509_cert *chain, const unsigned char *buf, size_t buflen ); 436 434 437 435 /** \ingroup x509_module */ 438 436 /** 439 437 * \brief Load one or more certificates and add them 440 * to the chained list. With permissive parsing enabled 441 * all certificates that cannot be parsed are ignored. 442 * If none complete correctly, the first error is returned. 438 * to the chained list. Parses permissively. If some 439 * certificates can be parsed, the result is the number 440 * of failed certificates it encountered. If none complete 441 * correctly, the first error is returned. 443 442 * 444 443 * \param chain points to the start of the chain 445 444 * \param path filename to read the certificates from 446 * \param permissive X509_PERMISSIVE or X509_NON_PERMISSIVE447 * 448 * \return 0 if successful,or a specific X509 or PEM error code449 */ 450 int x509parse_crtfile( x509_cert *chain, const char *path , int permissive);445 * 446 * \return 0 if all certificates parsed successfully, a positive number 447 * if partly successful or a specific X509 or PEM error code 448 */ 449 int x509parse_crtfile( x509_cert *chain, const char *path ); 451 450 452 451 /** \ingroup x509_module */ … … 552 551 553 552 /** \} name Functions to read in DHM parameters, a certificate, CRL or private RSA key */ 554 555 556 553 557 554 /** -
trunk/library/asn1parse.c
r1110 r1159 243 243 244 244 if( cur->next == NULL ) 245 return( 1);245 return( POLARSSL_ERR_ASN1_MALLOC_FAILED ); 246 246 247 247 cur = cur->next; -
trunk/library/bignum.c
r1136 r1159 90 90 91 91 if( nblimbs > POLARSSL_MPI_MAX_LIMBS ) 92 return( 1);92 return( POLARSSL_ERR_MPI_MALLOC_FAILED ); 93 93 94 94 if( X->n < nblimbs ) 95 95 { 96 96 if( ( p = (t_uint *) malloc( nblimbs * ciL ) ) == NULL ) 97 return( 1);97 return( POLARSSL_ERR_MPI_MALLOC_FAILED ); 98 98 99 99 memset( p, 0, nblimbs * ciL ); -
trunk/library/ctr_drbg.c
r1158 r1159 245 245 246 246 /* 247 * Gather POLARSSL_CTR_DRBG_ENTROPYLENbytes of entropy to seed state247 * Gather enropy_len bytes of entropy to seed state 248 248 */ 249 249 if( 0 != ctx->f_entropy( ctx->p_entropy, seed, … … 358 358 359 359 if( ( f = fopen( path, "wb" ) ) == NULL ) 360 return( 1);360 return( POLARSSL_ERR_CTR_DRBG_FILE_IO_ERROR ); 361 361 362 362 if( ( ret = ctr_drbg_random( ctx, buf, CTR_DRBG_MAX_INPUT ) ) != 0 ) … … 366 366 { 367 367 fclose( f ); 368 return( 1);368 return( POLARSSL_ERR_CTR_DRBG_FILE_IO_ERROR ); 369 369 } 370 370 … … 380 380 381 381 if( ( f = fopen( path, "rb" ) ) == NULL ) 382 return( 1);382 return( POLARSSL_ERR_CTR_DRBG_FILE_IO_ERROR ); 383 383 384 384 fseek( f, 0, SEEK_END ); … … 392 392 { 393 393 fclose( f ); 394 return( 1);394 return( POLARSSL_ERR_CTR_DRBG_FILE_IO_ERROR ); 395 395 } 396 396 -
trunk/library/error.c
r1140 r1159 68 68 #endif 69 69 70 #if defined(POLARSSL_MD2_C) 71 #include "polarssl/md2.h" 72 #endif 73 74 #if defined(POLARSSL_MD4_C) 75 #include "polarssl/md4.h" 76 #endif 77 78 #if defined(POLARSSL_MD5_C) 79 #include "polarssl/md5.h" 80 #endif 81 70 82 #if defined(POLARSSL_NET_C) 71 83 #include "polarssl/net.h" … … 82 94 #if defined(POLARSSL_RSA_C) 83 95 #include "polarssl/rsa.h" 96 #endif 97 98 #if defined(POLARSSL_SHA1_C) 99 #include "polarssl/sha1.h" 100 #endif 101 102 #if defined(POLARSSL_SHA2_C) 103 #include "polarssl/sha2.h" 104 #endif 105 106 #if defined(POLARSSL_SHA4_C) 107 #include "polarssl/sha4.h" 84 108 #endif 85 109 … … 259 283 if( use_ret == -(POLARSSL_ERR_SSL_BAD_HS_FINISHED) ) 260 284 snprintf( buf, buflen, "SSL - Processing of the Finished handshake message failed" ); 285 if( use_ret == -(POLARSSL_ERR_SSL_MALLOC_FAILED) ) 286 snprintf( buf, buflen, "SSL - Memory allocation failed" ); 261 287 #endif /* POLARSSL_SSL_TLS_C */ 262 288 … … 300 326 if( use_ret == -(POLARSSL_ERR_X509_CERT_UNKNOWN_FORMAT) ) 301 327 snprintf( buf, buflen, "X509 - Format not recognized as DER or PEM" ); 302 if( use_ret == -(POLARSSL_ERR_X509_VALUE_TO_LENGTH) ) 303 snprintf( buf, buflen, "X509 - Not used" ); 328 if( use_ret == -(POLARSSL_ERR_X509_INVALID_INPUT) ) 329 snprintf( buf, buflen, "X509 - Input invalid" ); 330 if( use_ret == -(POLARSSL_ERR_X509_MALLOC_FAILED) ) 331 snprintf( buf, buflen, "X509 - Allocation of memory failed" ); 332 if( use_ret == -(POLARSSL_ERR_X509_FILE_IO_ERROR) ) 333 snprintf( buf, buflen, "X509 - Read/write of file failed" ); 304 334 #endif /* POLARSSL_X509_PARSE_C */ 305 335 … … 349 379 if( use_ret == -(POLARSSL_ERR_ASN1_INVALID_DATA) ) 350 380 snprintf( buf, buflen, "ASN1 - Data is invalid. (not used)" ); 381 if( use_ret == -(POLARSSL_ERR_ASN1_MALLOC_FAILED) ) 382 snprintf( buf, buflen, "ASN1 - Memory allocation failed" ); 351 383 #endif /* POLARSSL_ASN1_PARSE_C */ 352 384 … … 366 398 snprintf( buf, buflen, "BIGNUM - There is an invalid character in the digit string" ); 367 399 if( use_ret == -(POLARSSL_ERR_MPI_BUFFER_TOO_SMALL) ) 368 snprintf( buf, buflen, "BIGNUM - The output buffer is too small to write too" );400 snprintf( buf, buflen, "BIGNUM - The buffer is too small to write to" ); 369 401 if( use_ret == -(POLARSSL_ERR_MPI_NEGATIVE_VALUE) ) 370 402 snprintf( buf, buflen, "BIGNUM - The input arguments are negative or result in illegal output" ); … … 373 405 if( use_ret == -(POLARSSL_ERR_MPI_NOT_ACCEPTABLE) ) 374 406 snprintf( buf, buflen, "BIGNUM - The input arguments are not acceptable" ); 407 if( use_ret == -(POLARSSL_ERR_MPI_MALLOC_FAILED) ) 408 snprintf( buf, buflen, "BIGNUM - Memory allocation failed" ); 375 409 #endif /* POLARSSL_BIGNUM_C */ 376 410 … … 389 423 if( use_ret == -(POLARSSL_ERR_CTR_DRBG_INPUT_TOO_BIG) ) 390 424 snprintf( buf, buflen, "CTR_DRBG - Input too large (Entropy + additional)" ); 425 if( use_ret == -(POLARSSL_ERR_CTR_DRBG_FILE_IO_ERROR) ) 426 snprintf( buf, buflen, "CTR_DRBG - Read/write error in file" ); 391 427 #endif /* POLARSSL_CTR_DRBG_C */ 392 428 … … 402 438 snprintf( buf, buflen, "ENTROPY - No more sources can be added" ); 403 439 #endif /* POLARSSL_ENTROPY_C */ 440 441 #if defined(POLARSSL_MD2_C) 442 if( use_ret == -(POLARSSL_ERR_MD2_FILE_IO_ERROR) ) 443 snprintf( buf, buflen, "MD2 - Read/write error in file" ); 444 #endif /* POLARSSL_MD2_C */ 445 446 #if defined(POLARSSL_MD4_C) 447 if( use_ret == -(POLARSSL_ERR_MD4_FILE_IO_ERROR) ) 448 snprintf( buf, buflen, "MD4 - Read/write error in file" ); 449 #endif /* POLARSSL_MD4_C */ 450 451 #if defined(POLARSSL_MD5_C) 452 if( use_ret == -(POLARSSL_ERR_MD5_FILE_IO_ERROR) ) 453 snprintf( buf, buflen, "MD5 - Read/write error in file" ); 454 #endif /* POLARSSL_MD5_C */ 404 455 405 456 #if defined(POLARSSL_NET_C) … … 433 484 #endif /* POLARSSL_PADLOCK_C */ 434 485 486 #if defined(POLARSSL_SHA1_C) 487 if( use_ret == -(POLARSSL_ERR_SHA1_FILE_IO_ERROR) ) 488 snprintf( buf, buflen, "SHA1 - Read/write error in file" ); 489 #endif /* POLARSSL_SHA1_C */ 490 491 #if defined(POLARSSL_SHA2_C) 492 if( use_ret == -(POLARSSL_ERR_SHA2_FILE_IO_ERROR) ) 493 snprintf( buf, buflen, "SHA2 - Read/write error in file" ); 494 #endif /* POLARSSL_SHA2_C */ 495 496 #if defined(POLARSSL_SHA4_C) 497 if( use_ret == -(POLARSSL_ERR_SHA4_FILE_IO_ERROR) ) 498 snprintf( buf, buflen, "SHA4 - Read/write error in file" ); 499 #endif /* POLARSSL_SHA4_C */ 500 435 501 #if defined(POLARSSL_XTEA_C) 436 502 if( use_ret == -(POLARSSL_ERR_XTEA_INVALID_INPUT_LENGTH) ) -
trunk/library/md2.c
r1097 r1159 190 190 191 191 if( ( f = fopen( path, "rb" ) ) == NULL ) 192 return( 1);192 return( POLARSSL_ERR_MD2_FILE_IO_ERROR ); 193 193 194 194 md2_starts( &ctx ); … … 204 204 { 205 205 fclose( f ); 206 return( 2);206 return( POLARSSL_ERR_MD2_FILE_IO_ERROR ); 207 207 } 208 208 -
trunk/library/md4.c
r1052 r1159 286 286 287 287 if( ( f = fopen( path, "rb" ) ) == NULL ) 288 return( 1);288 return( POLARSSL_ERR_MD4_FILE_IO_ERROR ); 289 289 290 290 md4_starts( &ctx ); … … 300 300 { 301 301 fclose( f ); 302 return( 2);302 return( POLARSSL_ERR_MD4_FILE_IO_ERROR ); 303 303 } 304 304 -
trunk/library/md5.c
r1052 r1159 305 305 306 306 if( ( f = fopen( path, "rb" ) ) == NULL ) 307 return( 1);307 return( POLARSSL_ERR_MD5_FILE_IO_ERROR ); 308 308 309 309 md5_starts( &ctx ); … … 319 319 { 320 320 fclose( f ); 321 return( 2);321 return( POLARSSL_ERR_MD5_FILE_IO_ERROR ); 322 322 } 323 323 -
trunk/library/sha1.c
r1052 r1159 340 340 341 341 if( ( f = fopen( path, "rb" ) ) == NULL ) 342 return( 1);342 return( POLARSSL_ERR_SHA1_FILE_IO_ERROR ); 343 343 344 344 sha1_starts( &ctx ); … … 354 354 { 355 355 fclose( f ); 356 return( 2);356 return( POLARSSL_ERR_SHA1_FILE_IO_ERROR ); 357 357 } 358 358 -
trunk/library/sha2.c
r1052 r1159 342 342 343 343 if( ( f = fopen( path, "rb" ) ) == NULL ) 344 return( 1);344 return( POLARSSL_ERR_SHA2_FILE_IO_ERROR ); 345 345 346 346 sha2_starts( &ctx, is224 ); … … 356 356 { 357 357 fclose( f ); 358 return( 2);358 return( POLARSSL_ERR_SHA2_FILE_IO_ERROR ); 359 359 } 360 360 -
trunk/library/sha4.c
r1145 r1159 340 340 341 341 if( ( f = fopen( path, "rb" ) ) == NULL ) 342 return( 1);342 return( POLARSSL_ERR_SHA4_FILE_IO_ERROR ); 343 343 344 344 sha4_starts( &ctx, is384 ); … … 354 354 { 355 355 fclose( f ); 356 return( 2);356 return( POLARSSL_ERR_SHA4_FILE_IO_ERROR ); 357 357 } 358 358 -
trunk/library/ssl_tls.c
r1140 r1159 1377 1377 SSL_DEBUG_MSG( 1, ( "malloc(%d bytes) failed", 1378 1378 sizeof( x509_cert ) ) ); 1379 return( 1);1379 return( POLARSSL_ERR_SSL_MALLOC_FAILED ); 1380 1380 } 1381 1381 … … 1402 1402 } 1403 1403 1404 ret = x509parse_crt( ssl->peer_cert, ssl->in_msg + i, n, 1405 X509_NON_PERMISSIVE ); 1404 ret = x509parse_crt( ssl->peer_cert, ssl->in_msg + i, n ); 1406 1405 if( ret != 0 ) 1407 1406 { … … 1708 1707 { 1709 1708 SSL_DEBUG_MSG( 1, ( "malloc(%d bytes) failed", len ) ); 1710 return( 1);1709 return( POLARSSL_ERR_SSL_MALLOC_FAILED ); 1711 1710 } 1712 1711 … … 1719 1718 SSL_DEBUG_MSG( 1, ( "malloc(%d bytes) failed", len ) ); 1720 1719 free( ssl-> in_ctr ); 1721 return( 1);1720 return( POLARSSL_ERR_SSL_MALLOC_FAILED ); 1722 1721 } 1723 1722 -
trunk/library/x509parse.c
r1153 r1159 285 285 286 286 if( use->next == NULL ) 287 return( 1);287 return( POLARSSL_ERR_X509_MALLOC_FAILED ); 288 288 289 289 memset( use->next, 0, sizeof( x509_name ) ); … … 304 304 305 305 if( cur->next == NULL ) 306 return( 1);306 return( POLARSSL_ERR_X509_MALLOC_FAILED ); 307 307 308 308 return( x509_get_name( p, end2, cur->next ) ); … … 1019 1019 */ 1020 1020 if( crt == NULL || buf == NULL ) 1021 return( 1);1021 return( POLARSSL_ERR_X509_INVALID_INPUT ); 1022 1022 1023 1023 p = (unsigned char *) malloc( len = buflen ); 1024 1024 1025 1025 if( p == NULL ) 1026 return( 1);1026 return( POLARSSL_ERR_X509_MALLOC_FAILED ); 1027 1027 1028 1028 memcpy( p, buf, buflen ); … … 1260 1260 * Parse one or more PEM certificates from a buffer and add them to the chained list 1261 1261 */ 1262 int x509parse_crt( x509_cert *chain, const unsigned char *buf, size_t buflen, 1263 int permissive ) 1264 { 1265 int ret, success = 0, first_error = 0; 1262 int x509parse_crt( x509_cert *chain, const unsigned char *buf, size_t buflen ) 1263 { 1264 int ret, success = 0, first_error = 0, total_failed = 0; 1266 1265 x509_cert *crt, *prev = NULL; 1267 1266 int buf_format = X509_FORMAT_DER; … … 1273 1272 */ 1274 1273 if( crt == NULL || buf == NULL ) 1275 return( 1);1274 return( POLARSSL_ERR_X509_INVALID_INPUT ); 1276 1275 1277 1276 while( crt->version != 0 && crt->next != NULL ) … … 1289 1288 1290 1289 if( crt->next == NULL ) 1291 return( 1);1290 return( POLARSSL_ERR_X509_MALLOC_FAILED ); 1292 1291 1293 1292 prev = crt; … … 1350 1349 { 1351 1350 /* 1352 * quit parsing on a memory error or if in non-permissive parsing mode1351 * quit parsing on a memory error 1353 1352 */ 1354 if( ret == 1 || permissive != 1)1353 if( ret == POLARSSL_ERR_X509_MALLOC_FAILED ) 1355 1354 { 1356 1355 if( prev ) … … 1365 1364 if( first_error == 0 ) 1366 1365 first_error = ret; 1366 1367 total_failed++; 1367 1368 1368 1369 memset( crt, 0, sizeof( x509_cert ) ); … … 1378 1379 1379 1380 if( crt->next == NULL ) 1380 return( 1);1381 return( POLARSSL_ERR_X509_MALLOC_FAILED ); 1381 1382 1382 1383 prev = crt; … … 1397 1398 1398 1399 if( success ) 1399 return( 0);1400 return( total_failed ); 1400 1401 else if( first_error ) 1401 1402 return( first_error ); … … 1424 1425 */ 1425 1426 if( crl == NULL || buf == NULL ) 1426 return( 1);1427 return( POLARSSL_ERR_X509_INVALID_INPUT ); 1427 1428 1428 1429 while( crl->version != 0 && crl->next != NULL ) … … 1439 1440 { 1440 1441 x509_crl_free( crl ); 1441 return( 1);1442 return( POLARSSL_ERR_X509_MALLOC_FAILED ); 1442 1443 } 1443 1444 … … 1482 1483 1483 1484 if( p == NULL ) 1484 return( 1);1485 return( POLARSSL_ERR_X509_MALLOC_FAILED ); 1485 1486 1486 1487 memcpy( p, buf, buflen ); … … 1492 1493 1493 1494 if( p == NULL ) 1494 return( 1);1495 return( POLARSSL_ERR_X509_MALLOC_FAILED ); 1495 1496 1496 1497 memcpy( p, buf, buflen ); … … 1681 1682 { 1682 1683 x509_crl_free( crl ); 1683 return( 1);1684 return( POLARSSL_ERR_X509_MALLOC_FAILED ); 1684 1685 } 1685 1686 … … 1702 1703 1703 1704 if( ( f = fopen( path, "rb" ) ) == NULL ) 1704 return( 1);1705 return( POLARSSL_ERR_X509_FILE_IO_ERROR ); 1705 1706 1706 1707 fseek( f, 0, SEEK_END ); … … 1709 1710 1710 1711 if( ( *buf = (unsigned char *) malloc( *n + 1 ) ) == NULL ) 1711 return( 1);1712 return( POLARSSL_ERR_X509_MALLOC_FAILED ); 1712 1713 1713 1714 if( fread( *buf, 1, *n, f ) != *n ) … … 1715 1716 fclose( f ); 1716 1717 free( *buf ); 1717 return( 1);1718 return( POLARSSL_ERR_X509_FILE_IO_ERROR ); 1718 1719 } 1719 1720 … … 1728 1729 * Load one or more certificates and add them to the chained list 1729 1730 */ 1730 int x509parse_crtfile( x509_cert *chain, const char *path , int permissive)1731 int x509parse_crtfile( x509_cert *chain, const char *path ) 1731 1732 { 1732 1733 int ret; … … 1734 1735 unsigned char *buf; 1735 1736 1736 if ( load_file( path, &buf, &n ))1737 return( 1);1738 1739 ret = x509parse_crt( chain, buf, n , permissive);1737 if ( (ret = load_file( path, &buf, &n ) ) != 0 ) 1738 return( ret ); 1739 1740 ret = x509parse_crt( chain, buf, n ); 1740 1741 1741 1742 memset( buf, 0, n + 1 ); … … 1754 1755 unsigned char *buf; 1755 1756 1756 if ( load_file( path, &buf, &n ))1757 return( 1);1757 if ( (ret = load_file( path, &buf, &n ) ) != 0 ) 1758 return( ret ); 1758 1759 1759 1760 ret = x509parse_crl( chain, buf, n ); … … 1774 1775 unsigned char *buf; 1775 1776 1776 if ( load_file( path, &buf, &n ))1777 return( 1);1777 if ( (ret = load_file( path, &buf, &n ) ) != 0 ) 1778 return( ret ); 1778 1779 1779 1780 if( pwd == NULL ) … … 1798 1799 unsigned char *buf; 1799 1800 1800 if ( load_file( path, &buf, &n ))1801 return( 1);1801 if ( (ret = load_file( path, &buf, &n ) ) != 0 ) 1802 return( ret ); 1802 1803 1803 1804 ret = x509parse_public_key( rsa, buf, n ); … … 2251 2252 unsigned char *buf; 2252 2253 2253 if ( load_file( path, &buf, &n ))2254 return( 1);2254 if ( ( ret = load_file( path, &buf, &n ) ) != 0 ) 2255 return( ret ); 2255 2256 2256 2257 ret = x509parse_dhm( dhm, buf, n ); … … 3156 3157 3157 3158 ret = x509parse_crt( &clicert, (unsigned char *) test_cli_crt, 3158 strlen( test_cli_crt ) , X509_NON_PERMISSIVE);3159 strlen( test_cli_crt ) ); 3159 3160 if( ret != 0 ) 3160 3161 { … … 3168 3169 3169 3170 ret = x509parse_crt( &cacert, (unsigned char *) test_ca_crt, 3170 strlen( test_ca_crt ) , X509_NON_PERMISSIVE);3171 strlen( test_ca_crt ) ); 3171 3172 if( ret != 0 ) 3172 3173 { -
trunk/programs/ssl/ssl_client2.c
r1143 r1159 242 242 #if defined(POLARSSL_FS_IO) 243 243 if( strlen( opt.ca_file ) ) 244 ret = x509parse_crtfile( &cacert, opt.ca_file , X509_NON_PERMISSIVE);244 ret = x509parse_crtfile( &cacert, opt.ca_file ); 245 245 else 246 246 #endif 247 247 #if defined(POLARSSL_CERTS_C) 248 248 ret = x509parse_crt( &cacert, (unsigned char *) test_ca_crt, 249 strlen( test_ca_crt ) , X509_NON_PERMISSIVE);249 strlen( test_ca_crt ) ); 250 250 #else 251 251 { … … 272 272 #if defined(POLARSSL_FS_IO) 273 273 if( strlen( opt.crt_file ) ) 274 ret = x509parse_crtfile( &clicert, opt.crt_file , X509_NON_PERMISSIVE);274 ret = x509parse_crtfile( &clicert, opt.crt_file ); 275 275 else 276 276 #endif 277 277 #if defined(POLARSSL_CERTS_C) 278 278 ret = x509parse_crt( &clicert, (unsigned char *) test_cli_crt, 279 strlen( test_cli_crt ) , X509_NON_PERMISSIVE);279 strlen( test_cli_crt ) ); 280 280 #else 281 281 { -
trunk/programs/ssl/ssl_fork_server.c
r1143 r1159 251 251 */ 252 252 ret = x509parse_crt( &srvcert, (unsigned char *) test_srv_crt, 253 strlen( test_srv_crt ) , X509_NON_PERMISSIVE);253 strlen( test_srv_crt ) ); 254 254 if( ret != 0 ) 255 255 { … … 259 259 260 260 ret = x509parse_crt( &srvcert, (unsigned char *) test_ca_crt, 261 strlen( test_ca_crt ) , X509_NON_PERMISSIVE);261 strlen( test_ca_crt ) ); 262 262 if( ret != 0 ) 263 263 { -
trunk/programs/ssl/ssl_mail_client.c
r1143 r1159 494 494 #if defined(POLARSSL_FS_IO) 495 495 if( strlen( opt.ca_file ) ) 496 ret = x509parse_crtfile( &cacert, opt.ca_file , X509_NON_PERMISSIVE);496 ret = x509parse_crtfile( &cacert, opt.ca_file ); 497 497 else 498 498 #endif 499 499 #if defined(POLARSSL_CERTS_C) 500 500 ret = x509parse_crt( &cacert, (unsigned char *) test_ca_crt, 501 strlen( test_ca_crt ) , X509_NON_PERMISSIVE);501 strlen( test_ca_crt ) ); 502 502 #else 503 503 { … … 524 524 #if defined(POLARSSL_FS_IO) 525 525 if( strlen( opt.crt_file ) ) 526 ret = x509parse_crtfile( &clicert, opt.crt_file , X509_NON_PERMISSIVE);526 ret = x509parse_crtfile( &clicert, opt.crt_file ); 527 527 else 528 528 #endif 529 529 #if defined(POLARSSL_CERTS_C) 530 530 ret = x509parse_crt( &clicert, (unsigned char *) test_cli_crt, 531 strlen( test_cli_crt ) , X509_NON_PERMISSIVE);531 strlen( test_cli_crt ) ); 532 532 #else 533 533 { 534 ret = 1;534 ret = -1; 535 535 printf("POLARSSL_CERTS_C not defined."); 536 536 } … … 552 552 #else 553 553 { 554 ret = 1;554 ret = -1; 555 555 printf("POLARSSL_CERTS_C not defined."); 556 556 } -
trunk/programs/ssl/ssl_server.c
r1143 r1159 221 221 */ 222 222 ret = x509parse_crt( &srvcert, (unsigned char *) test_srv_crt, 223 strlen( test_srv_crt ) , X509_NON_PERMISSIVE);223 strlen( test_srv_crt ) ); 224 224 if( ret != 0 ) 225 225 { … … 229 229 230 230 ret = x509parse_crt( &srvcert, (unsigned char *) test_ca_crt, 231 strlen( test_ca_crt ) , X509_NON_PERMISSIVE);231 strlen( test_ca_crt ) ); 232 232 if( ret != 0 ) 233 233 { -
trunk/programs/test/ssl_cert_test.c
r1140 r1159 101 101 * .crt file by calling x509parse_crtfile( &cacert, "myca.crt" ). 102 102 */ 103 ret = x509parse_crtfile( &cacert, "ssl/test-ca/test-ca.crt" , X509_NON_PERMISSIVE);103 ret = x509parse_crtfile( &cacert, "ssl/test-ca/test-ca.crt" ); 104 104 if( ret != 0 ) 105 105 { … … 149 149 fflush( stdout ); 150 150 151 ret = x509parse_crtfile( &clicert, name , X509_NON_PERMISSIVE);151 ret = x509parse_crtfile( &clicert, name ); 152 152 if( ret != 0 ) 153 153 { -
trunk/programs/test/ssl_test.c
r1143 r1159 215 215 #else 216 216 ret = x509parse_crt( &srvcert, (unsigned char *) test_srv_crt, 217 strlen( test_srv_crt ) , X509_NON_PERMISSIVE);217 strlen( test_srv_crt ) ); 218 218 if( ret != 0 ) 219 219 { … … 223 223 224 224 ret = x509parse_crt( &srvcert, (unsigned char *) test_ca_crt, 225 strlen( test_ca_crt ) , X509_NON_PERMISSIVE);225 strlen( test_ca_crt ) ); 226 226 if( ret != 0 ) 227 227 { -
trunk/programs/x509/cert_app.c
r1143 r1159 201 201 fflush( stdout ); 202 202 203 ret = x509parse_crtfile( &crt, opt.filename , opt.permissive);204 205 if( ret !=0 )203 ret = x509parse_crtfile( &crt, opt.filename ); 204 205 if( ret < 0 ) 206 206 { 207 207 printf( " failed\n ! x509parse_crt returned %d\n\n", ret ); … … 210 210 } 211 211 212 if( opt.permissive == 0 && ret > 0 ) 213 { 214 printf( " failed\n ! x509parse_crt failed to parse %d certificates\n\n", ret ); 215 x509_free( &crt ); 216 goto exit; 217 } 218 212 219 printf( " ok\n" ); 213 220 221 214 222 /* 215 223 * 1.2 Print the certificate(s) -
trunk/scripts/generate_errors.pl
r1138 r1159 10 10 11 11 my @low_level_modules = ( "AES", "ASN1", "CAMELLIA", "BIGNUM", "BASE64", "XTEA", 12 "PADLOCK", "DES", "NET", "CTR_DRBG", "ENTROPY" ); 12 "PADLOCK", "DES", "NET", "CTR_DRBG", "ENTROPY", 13 "MD2", "MD4", "MD5", "SHA1", "SHA2", "SHA4" ); 13 14 my @high_level_modules = ( "PEM", "X509", "DHM", "RSA", "MD", "CIPHER", "SSL" ); 14 15 -
trunk/tests/suites/test_suite_ctr_drbg.function
r1158 r1159 3 3 4 4 int test_offset; 5 int entropy_func( void * p, unsigned char *buf, size_t len )5 int entropy_func( void *data, unsigned char *buf, size_t len ) 6 6 { 7 unsigned char *p = (unsigned char *) data; 7 8 memcpy( buf, p + test_offset, len ); 8 9 test_offset += 32; -
trunk/tests/suites/test_suite_debug.function
r1140 r1159 36 36 ssl_set_dbg(&ssl, string_debug, &buffer); 37 37 38 TEST_ASSERT( x509parse_crtfile( &crt, {crt_file} , X509_NON_PERMISSIVE) == 0 );38 TEST_ASSERT( x509parse_crtfile( &crt, {crt_file} ) == 0 ); 39 39 debug_print_crt( &ssl, 0, {file}, {line}, {prefix}, &crt); 40 40 -
trunk/tests/suites/test_suite_x509parse.function
r1140 r1159 39 39 memset( buf, 0, 2000 ); 40 40 41 TEST_ASSERT( x509parse_crtfile( &crt, {crt_file} , X509_NON_PERMISSIVE) == 0 );41 TEST_ASSERT( x509parse_crtfile( &crt, {crt_file} ) == 0 ); 42 42 res = x509parse_cert_info( buf, 2000, "", &crt ); 43 43 … … 82 82 memset( &crl, 0, sizeof( x509_crl ) ); 83 83 84 TEST_ASSERT( x509parse_crtfile( &crt, {crt_file} , X509_NON_PERMISSIVE) == 0 );85 TEST_ASSERT( x509parse_crtfile( &ca, {ca_file} , X509_NON_PERMISSIVE) == 0 );84 TEST_ASSERT( x509parse_crtfile( &crt, {crt_file} ) == 0 ); 85 TEST_ASSERT( x509parse_crtfile( &ca, {ca_file} ) == 0 ); 86 86 TEST_ASSERT( x509parse_crlfile( &crl, {crl_file} ) == 0 ); 87 87 … … 103 103 memset( buf, 0, 2000 ); 104 104 105 TEST_ASSERT( x509parse_crtfile( &crt, {crt_file} , X509_NON_PERMISSIVE) == 0 );105 TEST_ASSERT( x509parse_crtfile( &crt, {crt_file} ) == 0 ); 106 106 res = x509parse_dn_gets( buf, 2000, &crt.{entity} ); 107 107 … … 120 120 memset( &crt, 0, sizeof( x509_cert ) ); 121 121 122 TEST_ASSERT( x509parse_crtfile( &crt, {crt_file} , X509_NON_PERMISSIVE) == 0 );122 TEST_ASSERT( x509parse_crtfile( &crt, {crt_file} ) == 0 ); 123 123 TEST_ASSERT( x509parse_time_expired( &crt.{entity} ) == {result} ); 124 124 } … … 177 177 data_len = unhexify( buf, {crt_data} ); 178 178 179 TEST_ASSERT( x509parse_crt( &crt, buf, data_len , X509_NON_PERMISSIVE) == ( {result} ) );179 TEST_ASSERT( x509parse_crt( &crt, buf, data_len ) == ( {result} ) ); 180 180 if( ( {result} ) == 0 ) 181 181 {
Note: See TracChangeset
for help on using the changeset viewer.


