Changeset 5417

Show
Ignore:
Timestamp:
03/15/08 17:47:19 (4 months ago)
Author:
morris
Message:

Split crypto classes into their own files

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • libwired/trunk/libwired/base/wi-base.c

    r5368 r5417  
    6060         
    6161#ifdef WI_CRYPTO 
    62         wi_crypto_register(); 
     62        wi_cipher_register(); 
    6363#endif 
    6464         
     
    7474        wi_number_register(); 
    7575        wi_regexp_register(); 
     76 
     77#ifdef WI_CRYPTO 
     78        wi_rsa_register(); 
     79#endif 
    7680         
    7781#ifdef WI_P7 
     
    104108        wi_version_register(); 
    105109         
     110#ifdef WI_CRYPTO 
     111        wi_x509_register(); 
     112#endif 
     113 
    106114        wi_lock_initialize(); 
    107115        wi_runtime_initialize(); 
     
    117125 
    118126#ifdef WI_CRYPTO 
    119         wi_crypto_initialize(); 
     127        wi_cipher_initialize(); 
    120128#endif 
    121129         
     
    132140        wi_regexp_initialize(); 
    133141         
     142#ifdef WI_CRYPTO 
     143        wi_rsa_initialize(); 
     144#endif 
     145 
    134146#ifdef WI_P7 
    135147        wi_p7_message_initialize(); 
     
    156168        wi_uuid_initialize(); 
    157169        wi_version_initialize(); 
     170 
     171#ifdef WI_CRYPTO 
     172        wi_x509_initialize(); 
     173#endif 
    158174} 
    159175 
  • libwired/trunk/libwired/base/wi-private.h

    r5368 r5417  
    5858WI_EXPORT void                                                  wi_address_register(void); 
    5959WI_EXPORT void                                                  wi_array_register(void); 
     60WI_EXPORT void                                                  wi_cipher_register(void); 
    6061WI_EXPORT void                                                  wi_config_register(void); 
    61 WI_EXPORT void                                                  wi_crypto_register(void); 
    6262WI_EXPORT void                                                  wi_data_register(void); 
    6363WI_EXPORT void                                                  wi_date_register(void); 
     
    7676WI_EXPORT void                                                  wi_process_register(void); 
    7777WI_EXPORT void                                                  wi_regexp_register(void); 
     78WI_EXPORT void                                                  wi_rsa_register(void); 
    7879WI_EXPORT void                                                  wi_runtime_register(void); 
    7980WI_EXPORT void                                                  wi_set_register(void); 
     
    8990WI_EXPORT void                                                  wi_uuid_register(void); 
    9091WI_EXPORT void                                                  wi_version_register(void); 
     92WI_EXPORT void                                                  wi_x509_register(void); 
    9193 
    9294WI_EXPORT void                                                  wi_address_initialize(void); 
    9395WI_EXPORT void                                                  wi_array_initialize(void); 
     96WI_EXPORT void                                                  wi_cipher_initialize(void); 
    9497WI_EXPORT void                                                  wi_config_initialize(void); 
    95 WI_EXPORT void                                                  wi_crypto_initialize(void); 
    9698WI_EXPORT void                                                  wi_data_initialize(void); 
    9799WI_EXPORT void                                                  wi_date_initialize(void); 
     
    110112WI_EXPORT void                                                  wi_process_initialize(void); 
    111113WI_EXPORT void                                                  wi_regexp_initialize(void); 
     114WI_EXPORT void                                                  wi_rsa_initialize(void); 
    112115WI_EXPORT void                                                  wi_runtime_initialize(void); 
    113116WI_EXPORT void                                                  wi_set_initialize(void); 
     
    123126WI_EXPORT void                                                  wi_uuid_initialize(void); 
    124127WI_EXPORT void                                                  wi_version_initialize(void); 
     128WI_EXPORT void                                                  wi_x509_initialize(void); 
    125129 
    126130WI_EXPORT void                                                  wi_process_load(int, const char **); 
  • libwired/trunk/libwired/crypto/wi-cipher.c

    r5410 r5417  
    3232 
    3333#include <wired/wi-data.h> 
    34 #include <wired/wi-crypto.h> 
     34#include <wired/wi-cipher.h> 
    3535#include <wired/wi-private.h> 
    3636#include <wired/wi-string.h> 
    3737#include <wired/wi-system.h> 
    3838 
    39 #include <openssl/pem.h> 
     39#include <openssl/evp.h> 
    4040#include <openssl/rand.h> 
    41 #include <openssl/rsa.h> 
    42 #include <openssl/x509.h> 
    43  
    44 struct _wi_rsa { 
    45         wi_runtime_base_t                                       base; 
    46          
    47         RSA                                                                     *rsa; 
    48         wi_data_t                                                       *public_key; 
    49         wi_data_t                                                       *private_key; 
    50 }; 
    51  
    52 static void                                                             _wi_rsa_dealloc(wi_runtime_instance_t *); 
    53 static wi_string_t *                                    _wi_rsa_description(wi_runtime_instance_t *); 
    54  
    55 static wi_runtime_id_t                                  _wi_rsa_runtime_id = WI_RUNTIME_ID_NULL; 
    56 static wi_runtime_class_t                               _wi_rsa_runtime_class = { 
    57         "wi_rsa_t", 
    58         _wi_rsa_dealloc, 
    59         NULL, 
    60         NULL, 
    61         _wi_rsa_description, 
    62         NULL 
    63 }; 
    64  
    65  
    66  
    67 struct _wi_x509 { 
    68         wi_runtime_base_t                                       base; 
    69          
    70         X509                                                            *x509; 
    71          
    72         wi_string_t                                                     *common_name; 
    73 }; 
    74  
    75 static void                                                             _wi_x509_dealloc(wi_runtime_instance_t *); 
    76 static wi_string_t *                                    _wi_x509_description(wi_runtime_instance_t *); 
    77  
    78 static wi_runtime_id_t                                  _wi_x509_runtime_id = WI_RUNTIME_ID_NULL; 
    79 static wi_runtime_class_t                               _wi_x509_runtime_class = { 
    80         "wi_x509_t", 
    81         _wi_x509_dealloc, 
    82         NULL, 
    83         NULL, 
    84         _wi_x509_description, 
    85         NULL 
    86 }; 
    87  
    88  
    8941 
    9042struct _wi_cipher { 
     
    11769 
    11870 
    119 void wi_crypto_register(void) { 
    120         _wi_rsa_runtime_id = wi_runtime_register_class(&_wi_rsa_runtime_class); 
    121         _wi_x509_runtime_id = wi_runtime_register_class(&_wi_x509_runtime_class); 
     71void wi_cipher_register(void) { 
    12272        _wi_cipher_runtime_id = wi_runtime_register_class(&_wi_cipher_runtime_class); 
    12373} 
     
    12575 
    12676 
    127 void wi_crypto_initialize(void) { 
    128 
    129  
    130  
    131  
    132 #pragma mark - 
    133  
    134 wi_runtime_id_t wi_rsa_runtime_id(void) { 
    135         return _wi_rsa_runtime_id; 
    136 
    137  
    138  
    139  
    140 #pragma mark - 
    141  
    142 wi_rsa_t * wi_rsa_alloc(void) { 
    143         return wi_runtime_create_instance(_wi_rsa_runtime_id, sizeof(wi_rsa_t)); 
    144 
    145  
    146  
    147  
    148 wi_rsa_t * wi_rsa_init_with_bits(wi_rsa_t *rsa, wi_uinteger_t size) { 
    149         rsa->rsa = RSA_generate_key(size, RSA_F4, NULL, NULL); 
    150          
    151         if(!rsa->rsa) { 
    152                 wi_release(rsa); 
    153                  
    154                 return NULL; 
    155         } 
    156          
    157         return rsa; 
    158 
    159  
    160  
    161  
    162 wi_rsa_t * wi_rsa_init_with_rsa(wi_rsa_t *rsa, void *_rsa) { 
    163         rsa->rsa = _rsa; 
    164          
    165         return rsa; 
    166 
    167  
    168  
    169  
    170 wi_rsa_t * wi_rsa_init_with_pem_file(wi_rsa_t *rsa, wi_string_t *path) { 
    171         FILE            *fp; 
    172          
    173         fp = fopen(wi_string_cstring(path), "r"); 
    174          
    175         if(!fp) { 
    176                 wi_error_set_errno(errno); 
    177                  
    178                 wi_release(rsa); 
    179                  
    180                 return NULL; 
    181         } 
    182          
    183         rsa->rsa = PEM_read_RSAPrivateKey(fp, NULL, NULL, NULL); 
    184          
    185         fclose(fp); 
    186          
    187         if(!rsa->rsa) { 
    188                 wi_error_set_openssl_error(); 
    189                  
    190                 wi_release(rsa); 
    191                  
    192                 return NULL; 
    193         } 
    194          
    195         return rsa; 
    196 
    197  
    198  
    199  
    200 wi_rsa_t * wi_rsa_init_with_private_key(wi_rsa_t *rsa, wi_data_t *data) { 
    201         const unsigned char     *buffer; 
    202         long                            length; 
    203          
    204         buffer = wi_data_bytes(data); 
    205         length = wi_data_length(data); 
    206          
    207         rsa->rsa = d2i_RSAPrivateKey(NULL, &buffer, length); 
    208  
    209         if(!rsa->rsa) { 
    210                 wi_error_set_openssl_error(); 
    211                  
    212                 wi_release(rsa); 
    213                  
    214                 return NULL; 
    215         } 
    216          
    217         rsa->private_key = wi_retain(data); 
    218          
    219         return rsa; 
    220 
    221  
    222  
    223  
    224 wi_rsa_t * wi_rsa_init_with_public_key(wi_rsa_t *rsa, wi_data_t *data) { 
    225         const unsigned char     *buffer; 
    226         long                            length; 
    227          
    228         buffer = wi_data_bytes(data); 
    229         length = wi_data_length(data); 
    230          
    231         rsa->rsa = d2i_RSAPublicKey(NULL, (const unsigned char **) &buffer, length); 
    232  
    233         if(!rsa->rsa) { 
    234                 wi_error_set_openssl_error(); 
    235                  
    236                 wi_release(rsa); 
    237                  
    238                 return NULL; 
    239         } 
    240          
    241         rsa->public_key = wi_retain(data); 
    242          
    243         return rsa; 
    244 
    245  
    246  
    247  
    248 static void _wi_rsa_dealloc(wi_runtime_instance_t *instance) { 
    249         wi_rsa_t                *rsa = instance; 
    250          
    251         RSA_free(rsa->rsa); 
    252          
    253         wi_release(rsa->public_key); 
    254         wi_release(rsa->private_key); 
    255 
    256  
    257  
    258  
    259 static wi_string_t * _wi_rsa_description(wi_runtime_instance_t *instance) { 
    260         wi_rsa_t                *rsa = instance; 
    261          
    262         return wi_string_with_format(WI_STR("<%@ %p>{key = %p, bits = %lu}"), 
    263         wi_runtime_class_name(rsa), 
    264                 rsa, 
    265                 rsa->rsa, 
    266                 wi_rsa_bits(rsa)); 
    267 
    268  
    269  
    270  
    271 #pragma mark - 
    272  
    273 void * wi_rsa_rsa(wi_rsa_t *rsa) { 
    274         return rsa->rsa; 
    275 
    276  
    277  
    278  
    279 wi_data_t * wi_rsa_public_key(wi_rsa_t *rsa) { 
    280         unsigned char   *buffer; 
    281         int                             length; 
    282  
    283         if(!rsa->public_key) { 
    284                 buffer = NULL; 
    285                 length = i2d_RSAPublicKey(rsa->rsa, &buffer); 
    286                  
    287                 if(length <= 0) { 
    288                         wi_error_set_openssl_error(); 
    289                          
    290                         return NULL; 
    291                 } 
    292                  
    293                 rsa->public_key = wi_data_init_with_bytes(wi_data_alloc(), buffer, length); 
    294  
    295                 OPENSSL_free(buffer); 
    296         } 
    297          
    298         return rsa->public_key; 
    299 
    300  
    301  
    302  
    303 wi_data_t * wi_rsa_private_key(wi_rsa_t *rsa) { 
    304         unsigned char   *buffer; 
    305         int                             length; 
    306  
    307         if(!rsa->private_key) { 
    308                 buffer = NULL; 
    309                 length = i2d_RSAPrivateKey(rsa->rsa, &buffer); 
    310                  
    311                 if(length <= 0) { 
    312                         wi_error_set_openssl_error(); 
    313                          
    314                         return NULL; 
    315                 } 
    316                  
    317                 rsa->private_key = wi_data_init_with_bytes(wi_data_alloc(), buffer, length); 
    318  
    319                 OPENSSL_free(buffer); 
    320         } 
    321          
    322         return rsa->private_key; 
    323 
    324  
    325  
    326  
    327 wi_uinteger_t wi_rsa_bits(wi_rsa_t *rsa) { 
    328         return RSA_size(rsa->rsa) * 8; 
    329 
    330  
    331  
    332  
    333 #pragma mark - 
    334  
    335 wi_data_t * wi_rsa_encrypt(wi_rsa_t *rsa, wi_data_t *decrypted_data) { 
    336         const void              *decrypted_buffer; 
    337         void                    *encrypted_buffer; 
    338         wi_uinteger_t   decrypted_length, encrypted_length; 
    339          
    340         decrypted_buffer = wi_data_bytes(decrypted_data); 
    341         decrypted_length = wi_data_length(decrypted_data); 
    342          
    343         if(!wi_rsa_encrypt_bytes(rsa, decrypted_buffer, decrypted_length, &encrypted_buffer, &encrypted_length)) 
    344                 return NULL; 
    345          
    346         return wi_data_with_bytes_no_copy(encrypted_buffer, encrypted_length, true); 
    347 
    348  
    349  
    350  
    351 wi_boolean_t wi_rsa_encrypt_bytes(wi_rsa_t *rsa, const void *decrypted_buffer, wi_uinteger_t decrypted_length, void **out_buffer, wi_uinteger_t *out_length) { 
    352         void            *encrypted_buffer; 
    353         int32_t         encrypted_length; 
    354  
    355         encrypted_buffer = wi_malloc(RSA_size(rsa->rsa)); 
    356         encrypted_length = RSA_public_encrypt(decrypted_length, decrypted_buffer, encrypted_buffer, rsa->rsa, RSA_PKCS1_PADDING); 
    357          
    358         if(encrypted_length == -1) { 
    359                 wi_error_set_openssl_error(); 
    360                  
    361                 wi_free(encrypted_buffer); 
    362                  
    363                 return false; 
    364         } 
    365          
    366         *out_buffer = encrypted_buffer; 
    367         *out_length = encrypted_length; 
    368  
    369         return true; 
    370 
    371  
    372  
    373  
    374 wi_data_t * wi_rsa_decrypt(wi_rsa_t *rsa, wi_data_t *encrypted_data) { 
    375         const void              *encrypted_buffer; 
    376         void                    *decrypted_buffer; 
    377         wi_uinteger_t   encrypted_length, decrypted_length; 
    378          
    379         encrypted_buffer = wi_data_bytes(encrypted_data); 
    380         encrypted_length = wi_data_length(encrypted_data); 
    381          
    382         if(!wi_rsa_decrypt_bytes(rsa, encrypted_buffer, encrypted_length, &decrypted_buffer, &decrypted_length)) 
    383                 return NULL; 
    384          
    385         return wi_data_with_bytes_no_copy(decrypted_buffer, decrypted_length, true); 
    386 
    387  
    388  
    389  
    390 wi_boolean_t wi_rsa_decrypt_bytes(wi_rsa_t *rsa, const void *encrypted_buffer, wi_uinteger_t encrypted_length, void **out_buffer, wi_uinteger_t *out_length) { 
    391         void            *decrypted_buffer; 
    392         int32_t         decrypted_length; 
    393          
    394         decrypted_buffer = wi_malloc(RSA_size(rsa->rsa)); 
    395         decrypted_length = RSA_private_decrypt(encrypted_length, encrypted_buffer, decrypted_buffer, rsa->rsa, RSA_PKCS1_PADDING); 
    396  
    397         if(decrypted_length == -1) { 
    398                 wi_error_set_openssl_error(); 
    399                  
    400                 wi_free(decrypted_buffer); 
    401  
    402                 return false; 
    403         } 
    404          
    405         *out_buffer = decrypted_buffer; 
    406         *out_length = decrypted_length; 
    407  
    408         return true; 
    409 
    410  
    411  
    412  
    413 #pragma mark - 
    414  
    415 wi_runtime_id_t wi_x509_runtime_id(void) { 
    416         return _wi_x509_runtime_id; 
    417 
    418  
    419  
    420  
    421 #pragma mark - 
    422  
    423 wi_x509_t * wi_x509_alloc(void) { 
    424         return wi_runtime_create_instance(_wi_x509_runtime_id, sizeof(wi_x509_t)); 
    425 
    426  
    427  
    428  
    429  
    430 wi_x509_t * wi_x509_init_with_common_name(wi_x509_t *x509, wi_rsa_t *rsa, wi_string_t *common_name) { 
    431         X509_REQ                *req; 
    432         EVP_PKEY                *pkey = NULL; 
    433         X509_NAME               *name = NULL; 
    434         BIGNUM                  *bn = NULL; 
    435          
    436         x509->common_name = wi_retain(common_name); 
    437          
    438         req = X509_REQ_new(); 
    439          
    440         if(!req) 
    441                 goto err; 
    442  
    443         if(X509_REQ_set_version(req, 0) != 1) 
    444                 goto err; 
    445          
    446         name = X509_NAME_new(); 
    447          
    448         if(X509_NAME_add_entry_by_NID(name, 
    449                                                                   NID_commonName, 
    450                                                                   MBSTRING_ASC, 
    451                                                                   (unsigned char *) wi_string_cstring(common_name), 
    452                                                                   -1, 
    453                                                                   -1, 
    454                                                                   0) != 1) 
    455                 goto err; 
    456  
    457         if(X509_REQ_set_subject_name(req, name) != 1) 
    458                 goto err; 
    459  
    460         pkey = EVP_PKEY_new(); 
    461         EVP_PKEY_set1_RSA(pkey, rsa->rsa); 
    462          
    463         if(X509_REQ_set_pubkey(req, pkey) != 1) 
    464                 goto err; 
    465          
    466         x509->x509 = X509_new(); 
    467          
    468         if(!x509->x509) 
    469                 goto err; 
    470          
    471         bn = BN_new(); 
    472          
    473         if(!bn) 
    474                 goto err; 
    475          
    476         if(BN_pseudo_rand(bn, 64, 0, 0) != 1) 
    477                 goto err; 
    478          
    479         if(!BN_to_ASN1_INTEGER(bn, X509_get_serialNumber(x509->x509))) 
    480                 goto err; 
    481          
    482         if(X509_set_issuer_name(x509->x509, X509_REQ_get_subject_name(req)) != 1) 
    483                 goto err; 
    484  
    485         if(!X509_gmtime_adj(X509_get_notBefore(x509->x509), 0)) 
    486                 goto err; 
    487  
    488         if(!X509_gmtime_adj(X509_get_notAfter(x509->x509), 3600 * 24 * 365)) 
    489                 goto err; 
    490  
    491         if(X509_set_subject_name(x509->x509, X509_REQ_get_subject_name(req)) != 1) 
    492                 goto end; 
    493  
    494         if(X509_set_pubkey(x509->x509, pkey) != 1) 
    495                 goto err; 
    496          
    497         if(X509_sign(x509->x509, pkey, EVP_sha1()) == 0) 
    498                 goto err; 
    499          
    500         goto end; 
    501          
    502 err: 
    503         wi_error_set_openssl_error(); 
    504  
    505         wi_release(x509); 
    506  
    507         x509 = NULL; 
    508          
    509 end: 
    510         if(req) 
    511                 X509_REQ_free(req); 
    512          
    513         if(pkey) 
    514                 EVP_PKEY_free(pkey); 
    515          
    516         if(name) 
    517                 X509_NAME_free(name); 
    518  
    519         if(bn) 
    520                 BN_free(bn); 
    521          
    522         return x509; 
    523 
    524  
    525  
    526  
    527 wi_x509_t * wi_x509_init_with_pem_file(wi_x509_t *x509, wi_string_t *path) { 
    528         FILE            *fp; 
    529          
    530         fp = fopen(wi_string_cstring(path), "r"); 
    531          
    532         if(!fp) { 
    533                 wi_error_set_errno(errno); 
    534                  
    535                 wi_release(x509); 
    536                  
    537                 return NULL; 
    538         } 
    539          
    540         x509->x509 = PEM_read_X509(fp, NULL, NULL, NULL); 
    541          
    542         fclose(fp); 
    543          
    544         if(!x509->x509) { 
    545                 wi_error_set_openssl_error(); 
    546                  
    547                 wi_release(x509); 
    548                  
    549                 return NULL; 
    550         } 
    551          
    552         return x509; 
    553 
    554  
    555  
    556  
    557 static void _wi_x509_dealloc(wi_runtime_instance_t *instance) { 
    558         wi_x509_t               *x509 = instance; 
    559          
    560         X509_free(x509->x509); 
    561          
    562         wi_release(x509->common_name); 
    563 
    564  
    565  
    566  
    567 static wi_string_t * _wi_x509_description(wi_runtime_instance_t *instance) { 
    568         wi_x509_t               *x509 = instance; 
    569          
    570         return wi_string_with_format(WI_STR("<%@ %p>{x509 = %p, name = %@}"), 
    571         wi_runtime_class_name(x509), 
    572                 x509, 
    573                 x509->x509, 
    574                 x509->common_name); 
    575 
    576  
    577  
    578  
    579 #pragma mark - 
    580  
    581 void * wi_x509_x509(wi_x509_t *x509) { 
    582         return x509->x509; 
     77void wi_cipher_initialize(void) { 
    58378} 
    58479 
  • libwired/trunk/libwired/crypto/wi-cipher.h

    r5400 r5417  
    2727 */ 
    2828 
    29 #ifndef WI_CRYPTO_H 
    30 #define WI_CRYPTO_H 1 
     29#ifndef WI_CIPHER_H 
     30#define WI_CIPHER_H 1 
    3131 
    3232#include <wired/wi-base.h> 
     
    4444 
    4545 
    46 typedef struct _wi_rsa                                  wi_rsa_t; 
    47 typedef struct _wi_x509                                 wi_x509_t; 
    4846typedef struct _wi_cipher                               wi_cipher_t; 
    49  
    50  
    51 WI_EXPORT wi_runtime_id_t                               wi_rsa_runtime_id(void); 
    52  
    53 WI_EXPORT wi_rsa_t *                                    wi_rsa_alloc(void); 
    54 WI_EXPORT wi_rsa_t *                                    wi_rsa_init_with_bits(wi_rsa_t *, wi_uinteger_t); 
    55 WI_EXPORT wi_rsa_t *                                    wi_rsa_init_with_rsa(wi_rsa_t *, void *); 
    56 WI_EXPORT wi_rsa_t *                                    wi_rsa_init_with_pem_file(wi_rsa_t *, wi_string_t *); 
    57 WI_EXPORT wi_rsa_t *                                    wi_rsa_init_with_private_key(wi_rsa_t *, wi_data_t *); 
    58 WI_EXPORT wi_rsa_t *                                    wi_rsa_init_with_public_key(wi_rsa_t *, wi_data_t *); 
    59  
    60 WI_EXPORT void *                                                wi_rsa_rsa(wi_rsa_t *); 
    61 WI_EXPORT wi_data_t *                                   wi_rsa_public_key(wi_rsa_t *); 
    62 WI_EXPORT wi_data_t *                                   wi_rsa_private_key(wi_rsa_t *); 
    63 WI_EXPORT wi_uinteger_t                                 wi_rsa_bits(wi_rsa_t *); 
    64  
    65 WI_EXPORT wi_data_t *                                   wi_rsa_encrypt(wi_rsa_t *, wi_data_t *); 
    66 WI_EXPORT wi_boolean_t                                  wi_rsa_encrypt_bytes(wi_rsa_t *, const void *, wi_uinteger_t, void **, wi_uinteger_t *); 
    67 WI_EXPORT wi_data_t *                                   wi_rsa_decrypt(wi_rsa_t *, wi_data_t *); 
    68 WI_EXPORT wi_boolean_t                                  wi_rsa_decrypt_bytes(wi_rsa_t *, const void *, wi_uinteger_t, void **, wi_uinteger_t *); 
    69  
    70  
    71 WI_EXPORT wi_runtime_id_t                               wi_x509_runtime_id(void); 
    72  
    73 WI_EXPORT wi_x509_t *                                   wi_x509_alloc(void); 
    74 WI_EXPORT wi_x509_t *                                   wi_x509_init_with_common_name(wi_x509_t *, wi_rsa_t *, wi_string_t *); 
    75 WI_EXPORT wi_x509_t *                                   wi_x509_init_with_pem_file(wi_x509_t *, wi_string_t *); 
    76  
    77 WI_EXPORT void *                                                wi_x509_x509(wi_x509_t *); 
    7847 
    7948 
     
    9665WI_EXPORT wi_integer_t                                  wi_cipher_decrypt_bytes(wi_cipher_t *, const void *, wi_uinteger_t, void *); 
    9766 
    98 #endif /* WI_CRYPTO_H */ 
     67#endif /* WI_CIPHER_H */ 
  • libwired/trunk/libwired/net/wi-socket.c

    r5405 r5417  
    5757#include <wired/wi-assert.h> 
    5858#include <wired/wi-address.h> 
    59 #include <wired/wi-crypto.h> 
    6059#include <wired/wi-date.h> 
    6160#include <wired/wi-macros.h> 
    6261#include <wired/wi-lock.h> 
    6362#include <wired/wi-private.h> 
     63#include <wired/wi-rsa.h> 
    6464#include <wired/wi-socket.h> 
    6565#include <wired/wi-string.h> 
    6666#include <wired/wi-system.h> 
    6767#include <wired/wi-thread.h> 
     68#include <wired/wi-x509.h> 
    6869 
    6970#define _WI_SOCKET_BUFFER_MAX_SIZE              131072 
  • libwired/trunk/libwired/net/wi-socket.h

    r5405 r5417  
    3434#include <netdb.h> 
    3535#include <wired/wi-base.h> 
    36 #include <wired/wi-crypto.h> 
     36#include <wired/wi-rsa.h> 
    3737#include <wired/wi-runtime.h> 
     38#include <wired/wi-x509.h> 
    3839 
    3940#define WI_SOCKET_BUFFER_SIZE                   BUFSIZ 
  • libwired/trunk/libwired/p7/wi-p7-socket.c

    r5406 r5417  
    3636 
    3737#include <wired/wi-byteorder.h> 
    38 #include <wired/wi-crypto.h> 
     38#include <wired/wi-cipher.h> 
    3939#include <wired/wi-error.h> 
    4040#include <wired/wi-log.h> 
     
    4444#include <wired/wi-p7-private.h> 
    4545#include <wired/wi-private.h> 
     46#include <wired/wi-rsa.h> 
    4647#include <wired/wi-string.h> 
    4748#include <wired/wi-system.h> 
  • libwired/trunk/libwired/p7/wi-p7-socket.h

    r5406 r5417  
    3131 
    3232#include <wired/wi-base.h> 
    33 #include <wired/wi-crypto.h> 
     33#include <wired/wi-cipher.h> 
     34#include <wired/wi-rsa.h> 
    3435#include <wired/wi-runtime.h> 
    3536#include <wired/wi-socket.h> 
  • libwired/trunk/libwired/wired.h

    r5368 r5417  
    3535#include <wired/wi-base.h> 
    3636#include <wired/wi-byteorder.h> 
     37#include <wired/wi-cipher.h> 
    3738#include <wired/wi-config.h> 
    3839#include <wired/wi-compat.h> 
    39 #include <wired/wi-crypto.h> 
    4040#include <wired/wi-data.h> 
    4141#include <wired/wi-date.h> 
     
    5656#include <wired/wi-pool.h> 
    5757#include <wired/wi-process.h> 
     58#include <wired/wi-rsa.h> 
    5859#include <wired/wi-regexp.h> 
    5960#include <wired/wi-runtime.h> 
     
    7273#include <wired/wi-version.h> 
    7374#include <wired/wi-wired.h> 
     75#include <wired/wi-x509.h> 
    7476 
    7577#endif /* WIRED_H */