The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/crypto/proc.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Scatterlist Cryptographic API.
    3  *
    4  * Procfs information.
    5  *
    6  * Copyright (c) 2002 James Morris <jmorris@intercode.com.au>
    7  *
    8  * This program is free software; you can redistribute it and/or modify it
    9  * under the terms of the GNU General Public License as published by the Free
   10  * Software Foundation; either version 2 of the License, or (at your option) 
   11  * any later version.
   12  *
   13  */
   14 #include <linux/init.h>
   15 #include <linux/crypto.h>
   16 #include <linux/rwsem.h>
   17 #include <linux/proc_fs.h>
   18 #include <linux/seq_file.h>
   19 #include "internal.h"
   20 
   21 extern struct list_head crypto_alg_list;
   22 extern struct rw_semaphore crypto_alg_sem;
   23 
   24 static void *c_start(struct seq_file *m, loff_t *pos)
   25 {
   26         struct list_head *v;
   27         loff_t n = *pos;
   28 
   29         down_read(&crypto_alg_sem);
   30         list_for_each(v, &crypto_alg_list)
   31                 if (!n--)
   32                         return list_entry(v, struct crypto_alg, cra_list);
   33         return NULL;
   34 }
   35 
   36 static void *c_next(struct seq_file *m, void *p, loff_t *pos)
   37 {
   38         struct list_head *v = p;
   39         
   40         (*pos)++;
   41         v = v->next;
   42         return (v == &crypto_alg_list) ?
   43                 NULL : list_entry(v, struct crypto_alg, cra_list);
   44 }
   45 
   46 static void c_stop(struct seq_file *m, void *p)
   47 {
   48         up_read(&crypto_alg_sem);
   49 }
   50 
   51 static int c_show(struct seq_file *m, void *p)
   52 {
   53         struct crypto_alg *alg = (struct crypto_alg *)p;
   54         
   55         seq_printf(m, "name         : %s\n", alg->cra_name);
   56         seq_printf(m, "module       : %s\n",
   57                    (alg->cra_module ?
   58                     alg->cra_module->name :
   59                     "kernel"));
   60         
   61         switch (alg->cra_flags & CRYPTO_ALG_TYPE_MASK) {
   62         case CRYPTO_ALG_TYPE_CIPHER:
   63                 seq_printf(m, "blocksize    : %u\n", alg->cra_blocksize);
   64                 seq_printf(m, "min keysize  : %u\n",
   65                                         alg->cra_cipher.cia_min_keysize);
   66                 seq_printf(m, "max keysize  : %u\n",
   67                                         alg->cra_cipher.cia_max_keysize);
   68                 seq_printf(m, "ivsize       : %u\n",
   69                                         alg->cra_cipher.cia_ivsize);
   70                 break;
   71                 
   72         case CRYPTO_ALG_TYPE_DIGEST:
   73                 seq_printf(m, "blocksize    : %u\n", alg->cra_blocksize);
   74                 seq_printf(m, "digestsize   : %u\n",
   75                            alg->cra_digest.dia_digestsize);
   76                 break;
   77         }
   78 
   79         seq_putc(m, '\n');
   80         return 0;
   81 }
   82 
   83 static struct seq_operations crypto_seq_ops = {
   84         .start          = c_start,
   85         .next           = c_next,
   86         .stop           = c_stop,
   87         .show           = c_show
   88 };
   89 
   90 static int crypto_info_open(struct inode *inode, struct file *file)
   91 {
   92         return seq_open(file, &crypto_seq_ops);
   93 }
   94         
   95 static struct file_operations proc_crypto_ops = {
   96         .open           = crypto_info_open,
   97         .read           = seq_read,
   98         .llseek         = seq_lseek,
   99         .release        = seq_release
  100 };
  101 
  102 void __init crypto_init_proc(void)
  103 {
  104         struct proc_dir_entry *proc;
  105         
  106         proc = create_proc_entry("crypto", 0, NULL);
  107         if (proc)
  108                 proc->proc_fops = &proc_crypto_ops;
  109 }

Cache object: a52d55c0dab4ed18e4fa4767c672d7cd


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.