Changeset 2b5d966 in mainline


Ignore:
Timestamp:
2015-04-30T21:44:54Z (9 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
df2bce3
Parents:
bf1733d3
Message:

libext4, crypto: add the CRC16-IBM implementation to the crypto library.

Location:
uspace
Files:
1 added
2 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/crypto/Makefile

    rbf1733d3 r2b5d966  
    3333        crypto.c \
    3434        aes.c \
    35         rc4.c
     35        rc4.c \
     36        crc16_ibm.c
    3637
    3738include $(USPACE_PREFIX)/Makefile.common
  • uspace/lib/crypto/crypto.h

    rbf1733d3 r2b5d966  
    5656extern int pbkdf2(uint8_t *, size_t, uint8_t *, size_t, uint8_t *);
    5757
     58extern uint16_t crc16_ibm(uint16_t crc, uint8_t *buf, size_t len);
     59
    5860#endif
  • uspace/lib/ext4/Makefile

    rbf1733d3 r2b5d966  
    2929USPACE_PREFIX = ../..
    3030LIBRARY = libext4
    31 EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX)
    32 LIBS = $(LIBBLOCK_PREFIX)/libblock.a
     31EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX) -I$(LIBCRYPTO_PREFIX)
     32LIBS = $(LIBBLOCK_PREFIX)/libblock.a $(LIBCRYPTO_PREFIX)/libcrypto.a
    3333
    3434SOURCES = \
     
    3636        libext4_bitmap.c \
    3737        libext4_block_group.c \
    38         libext4_crc.c \
    3938        libext4_directory.c \
    4039        libext4_directory_index.c \
  • uspace/lib/ext4/libext4.h

    rbf1733d3 r2b5d966  
    3737#include "libext4_bitmap.h"
    3838#include "libext4_block_group.h"
    39 #include "libext4_crc.h"
    4039#include "libext4_directory.h"
    4140#include "libext4_directory_index.h"
  • uspace/lib/ext4/libext4_filesystem.c

    rbf1733d3 r2b5d966  
    4141#include <ipc/vfs.h>
    4242#include <align.h>
     43#include <crypto.h>
    4344#include "libext4.h"
    4445
     
    5455    enum cache_mode cmode)
    5556{
     57        int rc;
    5658        ext4_superblock_t *temp_superblock = NULL;
    5759
     
    5961
    6062        /* Initialize block library (4096 is size of communication channel) */
    61         int rc = block_init(EXCHANGE_SERIALIZE, fs->device, 4096);
     63        rc = block_init(EXCHANGE_SERIALIZE, fs->device, 4096);
    6264        if (rc != EOK)
    6365                goto err;
     
    140142        /* Release memory space for superblock */
    141143        free(fs->superblock);
    142        
     144
    143145        /* Finish work with block library */
    144146        block_cache_fini(fs->device);
     
    532534        /* If checksum not supported, 0 will be returned */
    533535        uint16_t crc = 0;
    534        
     536
    535537        /* Compute the checksum only if the filesystem supports it */
    536538        if (ext4_superblock_has_feature_read_only(sb,
     
    545547               
    546548                /* Initialization */
    547                 crc = crc16(~0, sb->uuid, sizeof(sb->uuid));
     549                crc = crc16_ibm(~0, sb->uuid, sizeof(sb->uuid));
    548550               
    549551                /* Include index of block group */
    550                 crc = crc16(crc, (uint8_t *) &le_group, sizeof(le_group));
     552                crc = crc16_ibm(crc, (uint8_t *) &le_group, sizeof(le_group));
    551553               
    552554                /* Compute crc from the first part (stop before checksum field) */
    553                 crc = crc16(crc, (uint8_t *) bg, offset);
     555                crc = crc16_ibm(crc, (uint8_t *) bg, offset);
    554556               
    555557                /* Skip checksum */
     
    560562                    EXT4_FEATURE_INCOMPAT_64BIT)) &&
    561563                    (offset < ext4_superblock_get_desc_size(sb)))
    562                         crc = crc16(crc, ((uint8_t *) bg) + offset,
     564                        crc = crc16_ibm(crc, ((uint8_t *) bg) + offset,
    563565                            ext4_superblock_get_desc_size(sb) - offset);
    564566        }
  • uspace/srv/fs/ext4fs/Makefile

    rbf1733d3 r2b5d966  
    2828
    2929USPACE_PREFIX = ../../..
    30 LIBS = $(LIBBLOCK_PREFIX)/libblock.a $(LIBFS_PREFIX)/libfs.a $(LIBEXT4_PREFIX)/libext4.a
    31 EXTRA_CFLAGS += -I$(LIBBLOCK_PREFIX) -I$(LIBFS_PREFIX) -I$(LIBEXT4_PREFIX)
     30LIBS = $(LIBBLOCK_PREFIX)/libblock.a $(LIBFS_PREFIX)/libfs.a \
     31    $(LIBEXT4_PREFIX)/libext4.a $(LIBCRYPTO_PREFIX)/libcrypto.a
     32EXTRA_CFLAGS += -I$(LIBBLOCK_PREFIX) -I$(LIBFS_PREFIX) -I$(LIBEXT4_PREFIX) -I$(LIBCRYPTO_PREFIX)
    3233BINARY = ext4fs
    3334STATIC_NEEDED = y
Note: See TracChangeset for help on using the changeset viewer.