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