Print this page
10076 make usr/src/test smatch clean


  59         if (ret < 0 || *arg != CRYPTO_SUCCESS)
  60                 (void) fprintf(stderr, "%s: Error = %d %d 0x%02x\n",
  61                     (opstr == NULL) ? "ioctl" : opstr,
  62                     ret, errno, *arg);
  63 
  64         if (ret < 0)
  65                 return (errno);
  66 
  67         return (*arg);
  68 }
  69 
  70 crypto_op_t *
  71 cryptotest_init(cryptotest_t *arg, crypto_func_group_t fg)
  72 {
  73         crypto_op_t *op = malloc(sizeof (*op));
  74 
  75         if (op == NULL)
  76                 return (NULL);
  77 
  78         while ((fd = open(CRYPTO_DEVICE, O_RDWR)) < 0) {
  79                 if (errno != EINTR)

  80                         return (NULL);
  81         }

  82 
  83         op->in = (char *)arg->in;
  84         op->out = (char *)arg->out;
  85         op->key = (char *)arg->key;
  86         op->param = (char *)arg->param;
  87 
  88         op->inlen = arg->inlen;
  89         op->outlen = arg->outlen;
  90         op->keylen = arg->keylen * 8; /* kcf uses keylen in bits */
  91         op->paramlen = arg->plen;
  92         op->updatelen = arg->updatelen;
  93 
  94         op->mechname = arg->mechname;
  95 
  96         op->hsession = CRYPTO_INVALID_SESSION;
  97         op->fg = fg;
  98 
  99         if (op->out == NULL)
 100                 op->outlen = op->inlen;
 101         return (op);




  59         if (ret < 0 || *arg != CRYPTO_SUCCESS)
  60                 (void) fprintf(stderr, "%s: Error = %d %d 0x%02x\n",
  61                     (opstr == NULL) ? "ioctl" : opstr,
  62                     ret, errno, *arg);
  63 
  64         if (ret < 0)
  65                 return (errno);
  66 
  67         return (*arg);
  68 }
  69 
  70 crypto_op_t *
  71 cryptotest_init(cryptotest_t *arg, crypto_func_group_t fg)
  72 {
  73         crypto_op_t *op = malloc(sizeof (*op));
  74 
  75         if (op == NULL)
  76                 return (NULL);
  77 
  78         while ((fd = open(CRYPTO_DEVICE, O_RDWR)) < 0) {
  79                 if (errno != EINTR) {
  80                         free(op);
  81                         return (NULL);
  82                 }
  83         }
  84 
  85         op->in = (char *)arg->in;
  86         op->out = (char *)arg->out;
  87         op->key = (char *)arg->key;
  88         op->param = (char *)arg->param;
  89 
  90         op->inlen = arg->inlen;
  91         op->outlen = arg->outlen;
  92         op->keylen = arg->keylen * 8; /* kcf uses keylen in bits */
  93         op->paramlen = arg->plen;
  94         op->updatelen = arg->updatelen;
  95 
  96         op->mechname = arg->mechname;
  97 
  98         op->hsession = CRYPTO_INVALID_SESSION;
  99         op->fg = fg;
 100 
 101         if (op->out == NULL)
 102                 op->outlen = op->inlen;
 103         return (op);