Skip to content
Snippets Groups Projects
Select Git revision
  • v3.12-rc6
  • master default protected
  • objtool-32bit
  • objtool
  • v5.9
  • v5.9-rc8
  • v5.9-rc7
  • v5.9-rc6
  • v5.9-rc5
  • v5.9-rc4
  • v5.9-rc3
  • v5.9-rc2
  • v5.9-rc1
  • v5.8
  • v5.8-rc7
  • v5.8-rc6
  • v5.8-rc5
  • v5.8-rc4
  • v5.8-rc3
  • v5.8-rc2
  • v5.8-rc1
  • v5.7
  • v5.7-rc7
  • v5.7-rc6
24 results

aead.c

Blame
  • Forked from Jonas Rabenstein / Linux
    Source project has a limited visibility.
    • Mathias Krause's avatar
      9a5467bf
      crypto: user - fix info leaks in report API · 9a5467bf
      Mathias Krause authored
      
      Three errors resulting in kernel memory disclosure:
      
      1/ The structures used for the netlink based crypto algorithm report API
      are located on the stack. As snprintf() does not fill the remainder of
      the buffer with null bytes, those stack bytes will be disclosed to users
      of the API. Switch to strncpy() to fix this.
      
      2/ crypto_report_one() does not initialize all field of struct
      crypto_user_alg. Fix this to fix the heap info leak.
      
      3/ For the module name we should copy only as many bytes as
      module_name() returns -- not as much as the destination buffer could
      hold. But the current code does not and therefore copies random data
      from behind the end of the module name, as the module name is always
      shorter than CRYPTO_MAX_ALG_NAME.
      
      Also switch to use strncpy() to copy the algorithm's name and
      driver_name. They are strings, after all.
      
      Signed-off-by: default avatarMathias Krause <minipli@googlemail.com>
      Cc: Steffen Klassert <steffen.klassert@secunet.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      9a5467bf
      History
      crypto: user - fix info leaks in report API
      Mathias Krause authored
      
      Three errors resulting in kernel memory disclosure:
      
      1/ The structures used for the netlink based crypto algorithm report API
      are located on the stack. As snprintf() does not fill the remainder of
      the buffer with null bytes, those stack bytes will be disclosed to users
      of the API. Switch to strncpy() to fix this.
      
      2/ crypto_report_one() does not initialize all field of struct
      crypto_user_alg. Fix this to fix the heap info leak.
      
      3/ For the module name we should copy only as many bytes as
      module_name() returns -- not as much as the destination buffer could
      hold. But the current code does not and therefore copies random data
      from behind the end of the module name, as the module name is always
      shorter than CRYPTO_MAX_ALG_NAME.
      
      Also switch to use strncpy() to copy the algorithm's name and
      driver_name. They are strings, after all.
      
      Signed-off-by: default avatarMathias Krause <minipli@googlemail.com>
      Cc: Steffen Klassert <steffen.klassert@secunet.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    cache-tree.h 1.63 KiB
    #ifndef CACHE_TREE_H
    #define CACHE_TREE_H
    
    #include "tree.h"
    #include "tree-walk.h"
    
    struct cache_tree;
    struct cache_tree_sub {
    	struct cache_tree *cache_tree;
    	int count;		/* internally used by update_one() */
    	int namelen;
    	int used;
    	char name[FLEX_ARRAY];
    };
    
    struct cache_tree {
    	int entry_count; /* negative means "invalid" */
    	unsigned char sha1[20];
    	int subtree_nr;
    	int subtree_alloc;
    	struct cache_tree_sub **down;
    };
    
    struct cache_tree *cache_tree(void);
    void cache_tree_free(struct cache_tree **);
    void cache_tree_invalidate_path(struct index_state *, const char *);
    struct cache_tree_sub *cache_tree_sub(struct cache_tree *, const char *);
    
    void cache_tree_write(struct strbuf *, struct cache_tree *root);
    struct cache_tree *cache_tree_read(const char *buffer, unsigned long size);
    
    int cache_tree_fully_valid(struct cache_tree *);
    int cache_tree_update(struct index_state *, int);
    
    int update_main_cache_tree(int);
    
    /* bitmasks to write_cache_as_tree flags */
    #define WRITE_TREE_MISSING_OK 1
    #define WRITE_TREE_IGNORE_CACHE_TREE 2
    #define WRITE_TREE_DRY_RUN 4
    #define WRITE_TREE_SILENT 8
    #define WRITE_TREE_REPAIR 16
    
    /* error return codes */
    #define WRITE_TREE_UNREADABLE_INDEX (-1)
    #define WRITE_TREE_UNMERGED_INDEX (-2)
    #define WRITE_TREE_PREFIX_ERROR (-3)
    
    int write_index_as_tree(unsigned char *sha1, struct index_state *index_state, const char *index_path, int flags, const char *prefix);
    int write_cache_as_tree(unsigned char *sha1, int flags, const char *prefix);
    void prime_cache_tree(struct index_state *, struct tree *);
    
    extern int cache_tree_matches_traversal(struct cache_tree *, struct name_entry *ent, struct traverse_info *info);
    
    #endif