tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

arcfive.c (2660B)


      1 /*
      2 * arcfive.c - stubs for RC5 - NOT a working implementation!
      3 *
      4 * This Source Code Form is subject to the terms of the Mozilla Public
      5 * License, v. 2.0. If a copy of the MPL was not distributed with this
      6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      7 
      8 #ifdef FREEBL_NO_DEPEND
      9 #include "stubs.h"
     10 #endif
     11 
     12 #include "blapi.h"
     13 #include "prerror.h"
     14 
     15 /******************************************/
     16 /*
     17 ** RC5 symmetric block cypher -- 64-bit block size
     18 */
     19 
     20 /*
     21 ** Create a new RC5 context suitable for RC5 encryption/decryption.
     22 **      "key" raw key data
     23 **      "len" the number of bytes of key data
     24 **      "iv" is the CBC initialization vector (if mode is NSS_RC5_CBC)
     25 **      "mode" one of NSS_RC5 or NSS_RC5_CBC
     26 **
     27 ** When mode is set to NSS_RC5_CBC the RC5 cipher is run in "cipher block
     28 ** chaining" mode.
     29 */
     30 RC5Context *
     31 RC5_CreateContext(const SECItem *key, unsigned int rounds,
     32                  unsigned int wordSize, const unsigned char *iv, int mode)
     33 {
     34    PORT_SetError(PR_NOT_IMPLEMENTED_ERROR);
     35    return NULL;
     36 }
     37 
     38 /*
     39 ** Destroy an RC5 encryption/decryption context.
     40 **      "cx" the context
     41 **      "freeit" if PR_TRUE then free the object as well as its sub-objects
     42 */
     43 void
     44 RC5_DestroyContext(RC5Context *cx, PRBool freeit)
     45 {
     46    PORT_SetError(PR_NOT_IMPLEMENTED_ERROR);
     47 }
     48 
     49 /*
     50 ** Perform RC5 encryption.
     51 **      "cx" the context
     52 **      "output" the output buffer to store the encrypted data.
     53 **      "outputLen" how much data is stored in "output". Set by the routine
     54 **         after some data is stored in output.
     55 **      "maxOutputLen" the maximum amount of data that can ever be
     56 **         stored in "output"
     57 **      "input" the input data
     58 **      "inputLen" the amount of input data
     59 */
     60 SECStatus
     61 RC5_Encrypt(RC5Context *cx, unsigned char *output, unsigned int *outputLen,
     62            unsigned int maxOutputLen,
     63            const unsigned char *input, unsigned int inputLen)
     64 {
     65    PORT_SetError(PR_NOT_IMPLEMENTED_ERROR);
     66    return SECFailure;
     67 }
     68 
     69 /*
     70 ** Perform RC5 decryption.
     71 **      "cx" the context
     72 **      "output" the output buffer to store the decrypted data.
     73 **      "outputLen" how much data is stored in "output". Set by the routine
     74 **         after some data is stored in output.
     75 **      "maxOutputLen" the maximum amount of data that can ever be
     76 **         stored in "output"
     77 **      "input" the input data
     78 **      "inputLen" the amount of input data
     79 */
     80 SECStatus
     81 RC5_Decrypt(RC5Context *cx, unsigned char *output, unsigned int *outputLen,
     82            unsigned int maxOutputLen,
     83            const unsigned char *input, unsigned int inputLen)
     84 {
     85    PORT_SetError(PR_NOT_IMPLEMENTED_ERROR);
     86    return SECFailure;
     87 }